adapted ResolveSpecifier to handle the subspecifier replicant
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17759 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -30,7 +30,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
static property_info sPropertyList[] = {
|
static property_info sShelfPropertyList[] = {
|
||||||
{
|
{
|
||||||
"Replicant",
|
"Replicant",
|
||||||
{ B_COUNT_PROPERTIES, B_CREATE_PROPERTY },
|
{ B_COUNT_PROPERTIES, B_CREATE_PROPERTY },
|
||||||
@@ -55,6 +55,43 @@ static property_info sPropertyList[] = {
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static property_info sReplicantPropertyList[] = {
|
||||||
|
{
|
||||||
|
"ID",
|
||||||
|
{ B_GET_PROPERTY },
|
||||||
|
{ B_DIRECT_SPECIFIER },
|
||||||
|
NULL, 0, { B_INT32_TYPE }
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"Name",
|
||||||
|
{ B_GET_PROPERTY },
|
||||||
|
{ B_DIRECT_SPECIFIER },
|
||||||
|
NULL, 0, { B_STRING_TYPE }
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"Signature",
|
||||||
|
{ B_GET_PROPERTY },
|
||||||
|
{ B_DIRECT_SPECIFIER },
|
||||||
|
NULL, 0, { B_STRING_TYPE }
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"Suites",
|
||||||
|
{ B_GET_PROPERTY },
|
||||||
|
{ B_DIRECT_SPECIFIER },
|
||||||
|
NULL, 0, { B_PROPERTY_INFO_TYPE }
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"View",
|
||||||
|
{ },
|
||||||
|
{ B_DIRECT_SPECIFIER },
|
||||||
|
NULL, 0,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
extern "C" void _ReservedShelf1__6BShelfFv(BShelf *const, int32,
|
extern "C" void _ReservedShelf1__6BShelfFv(BShelf *const, int32,
|
||||||
const BMessage*, const BView*);
|
const BMessage*, const BView*);
|
||||||
@@ -505,16 +542,15 @@ BHandler *
|
|||||||
BShelf::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier,
|
BShelf::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier,
|
||||||
int32 form, const char *property)
|
int32 form, const char *property)
|
||||||
{
|
{
|
||||||
BPropertyInfo propInfo(sPropertyList);
|
BPropertyInfo shelfPropInfo(sShelfPropertyList);
|
||||||
BHandler *target = NULL;
|
BHandler *target = NULL;
|
||||||
|
BView *replicant = NULL;
|
||||||
switch (propInfo.FindMatch(msg, 0, specifier, form, property)) {
|
switch (shelfPropInfo.FindMatch(msg, 0, specifier, form, property)) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
target = this;
|
target = this;
|
||||||
break;
|
break;
|
||||||
case 2: {
|
case 2: {
|
||||||
BView *replicant = NULL;
|
|
||||||
uint32 ID;
|
uint32 ID;
|
||||||
status_t err = B_ERROR;
|
status_t err = B_ERROR;
|
||||||
switch (msg->what) {
|
switch (msg->what) {
|
||||||
@@ -558,17 +594,40 @@ BShelf::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier,
|
|||||||
replyMsg.AddString("message", "Cannot find replicant at/with specified index/name.");
|
replyMsg.AddString("message", "Cannot find replicant at/with specified index/name.");
|
||||||
msg->SendReply(&replyMsg);
|
msg->SendReply(&replyMsg);
|
||||||
}
|
}
|
||||||
return replicant;
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!replicant) {
|
||||||
|
if (target)
|
||||||
|
return target;
|
||||||
|
return BHandler::ResolveSpecifier(msg, index, specifier, form,
|
||||||
|
property);
|
||||||
|
}
|
||||||
|
|
||||||
|
msg->GetCurrentSpecifier(&index);
|
||||||
|
status_t err = msg->GetCurrentSpecifier(&index, specifier, &form, &property);
|
||||||
|
if (err) {
|
||||||
|
BMessage reply(B_REPLY);
|
||||||
|
reply.AddInt32("error", err);
|
||||||
|
msg->SendReply(&reply);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BPropertyInfo replicantPropInfo(sReplicantPropertyList);
|
||||||
|
switch (replicantPropInfo.FindMatch(msg, 0, specifier, form, property)) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
target = this;
|
||||||
|
case 4:
|
||||||
|
target = replicant;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (target)
|
|
||||||
return target;
|
return target;
|
||||||
|
|
||||||
return BHandler::ResolveSpecifier(msg, index, specifier, form,
|
|
||||||
property);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -578,7 +637,7 @@ BShelf::GetSupportedSuites(BMessage *message)
|
|||||||
status_t err;
|
status_t err;
|
||||||
err = message->AddString("suites", "suite/vnd.Be-shelf");
|
err = message->AddString("suites", "suite/vnd.Be-shelf");
|
||||||
if (err == B_OK) {
|
if (err == B_OK) {
|
||||||
BPropertyInfo propInfo(sPropertyList);
|
BPropertyInfo propInfo(sShelfPropertyList);
|
||||||
err = message->AddFlat("messages", &propInfo);
|
err = message->AddFlat("messages", &propInfo);
|
||||||
}
|
}
|
||||||
if (err == B_OK)
|
if (err == B_OK)
|
||||||
|
|||||||
Reference in New Issue
Block a user