diff --git a/src/kits/tracker/FindPanel.cpp b/src/kits/tracker/FindPanel.cpp index e9a93693459..659a5fb03ea 100644 --- a/src/kits/tracker/FindPanel.cpp +++ b/src/kits/tracker/FindPanel.cpp @@ -1033,27 +1033,26 @@ FindPanel::Draw(BRect) return; for (int32 index = 0; index < fAttrGrid->CountRows(); index++) { - BMenuField* menuField = dynamic_cast(FindAttrView("MenuField", index)); if (menuField == NULL) - return; + continue; + BLayoutItem* stringView = fAttrGrid->ItemAt(1, index); BMenuItem* item = menuField->Menu()->FindMarked(); - if (item == NULL) - return; - - if (item->Submenu()->FindMarked()) { - BLayoutItem* stringView = fAttrGrid->ItemAt(1, index); - if (stringView == NULL) - stringView = fAttrGrid->AddView(new BStringView("", - item->Submenu()->FindMarked()->Label()), 1, index); - else - dynamic_cast(stringView->View())->SetText( - item->Submenu()->FindMarked()->Label()); + if (item == NULL || item->Submenu() == NULL + || item->Submenu()->FindMarked() == NULL) { + continue; + } + if (stringView == NULL) { + stringView = fAttrGrid->AddView(new BStringView("", + item->Submenu()->FindMarked()->Label()), 1, index); stringView->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, B_ALIGN_VERTICAL_UNSET)); + } else { + dynamic_cast(stringView->View())->SetText( + item->Submenu()->FindMarked()->Label()); } } } @@ -1128,6 +1127,11 @@ FindPanel::MessageReceived(BMessage* message) case kMIMETypeItem: { + if (fMode == kByAttributeItem) { + // the attributes for this type may be different + RemoveAttrViewItems(false); + } + BMenuItem* item; if (message->FindPointer("source", (void**)&item) == B_OK) { // don't add the "All files and folders" to the list @@ -1137,15 +1141,9 @@ FindPanel::MessageReceived(BMessage* message) SetCurrentMimeType(item); } - // mime type switched - if (fMode != kByAttributeItem) - break; - - // the attributes for this type may be different, - // rip out the existing ones - RemoveAttrViewItems(false); + if (fMode == kByAttributeItem) + AddAttrRow(); - AddAttrRow(); break; }