Tracker: Unchecked dynamic_cast, CID 1210857
This commit is contained in:
parent
e85fa8f787
commit
350af1ce3f
@ -2652,45 +2652,52 @@ FindPanel::AddAttributeControls(int32 gridRow)
|
|||||||
void
|
void
|
||||||
FindPanel::RestoreAttrState(const BMessage &message, int32 index)
|
FindPanel::RestoreAttrState(const BMessage &message, int32 index)
|
||||||
{
|
{
|
||||||
BMenu* menu = dynamic_cast<BMenuField*>(FindAttrView("MenuField", index))
|
BMenuField* menuField
|
||||||
->Menu();
|
= dynamic_cast<BMenuField*>(FindAttrView("MenuField", index));
|
||||||
// decode menu selections
|
if (menuField != NULL) {
|
||||||
|
// decode menu selections
|
||||||
|
BMenu* menu = menuField->Menu();
|
||||||
|
|
||||||
AddMimeTypeAttrs(menu);
|
ASSERT(menu != NULL);
|
||||||
|
|
||||||
const char* label;
|
AddMimeTypeAttrs(menu);
|
||||||
if (message.FindString("menuSelection", index, &label) == B_OK) {
|
const char* label;
|
||||||
int32 itemIndex = SelectItemWithLabel(menu, label);
|
if (message.FindString("menuSelection", index, &label) == B_OK) {
|
||||||
if (itemIndex >=0) {
|
int32 itemIndex = SelectItemWithLabel(menu, label);
|
||||||
menu = menu->SubmenuAt(itemIndex);
|
if (itemIndex >= 0) {
|
||||||
if (menu && message.FindString("subMenuSelection", index, &label)
|
menu = menu->SubmenuAt(itemIndex);
|
||||||
== B_OK)
|
if (menu != NULL && message.FindString("subMenuSelection",
|
||||||
SelectItemWithLabel(menu, label);
|
index, &label) == B_OK) {
|
||||||
|
SelectItemWithLabel(menu, label);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// decode attribute text
|
// decode attribute text
|
||||||
BString textEntryString = "TextEntry";
|
BString textEntryString = "TextEntry";
|
||||||
textEntryString << index;
|
textEntryString << index;
|
||||||
BTextControl* textControl
|
BTextControl* textControl = dynamic_cast<BTextControl*>(
|
||||||
= dynamic_cast<BTextControl*>(FindAttrView(textEntryString.String(), index));
|
FindAttrView(textEntryString.String(), index));
|
||||||
|
|
||||||
ASSERT(textControl != NULL);
|
ASSERT(textControl != NULL);
|
||||||
|
|
||||||
const char* string;
|
const char* string;
|
||||||
if (textControl != NULL && textControl->TextView() != NULL
|
if (textControl != NULL
|
||||||
&& message.FindString("attrViewText", index, &string) == B_OK) {
|
&& message.FindString("attrViewText", index, &string) == B_OK) {
|
||||||
textControl->TextView()->SetText(string);
|
textControl->SetText(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 logicMenuSelectedIndex;
|
int32 logicMenuSelectedIndex;
|
||||||
if (message.FindInt32("logicalRelation", index,
|
if (message.FindInt32("logicalRelation", index,
|
||||||
&logicMenuSelectedIndex) == B_OK) {
|
&logicMenuSelectedIndex) == B_OK) {
|
||||||
BMenuField* field = dynamic_cast<BMenuField*>(FindAttrView("Logic", index));
|
BMenuField* field = dynamic_cast<BMenuField*>(
|
||||||
|
FindAttrView("Logic", index));
|
||||||
if (field != NULL) {
|
if (field != NULL) {
|
||||||
BMenu* fieldMenu = field->Menu();
|
BMenu* fieldMenu = field->Menu();
|
||||||
if (fieldMenu != NULL) {
|
if (fieldMenu != NULL) {
|
||||||
BMenuItem* logicItem = fieldMenu->ItemAt(logicMenuSelectedIndex);
|
BMenuItem* logicItem
|
||||||
|
= fieldMenu->ItemAt(logicMenuSelectedIndex);
|
||||||
if (logicItem != NULL) {
|
if (logicItem != NULL) {
|
||||||
logicItem->SetMarked(true);
|
logicItem->SetMarked(true);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user