Fix bug involving the condition string being removed when it shouldn't
This bug occured when you selected from the mime type menu field while in attribute mode. The rows are removed and added again but the condition string view was left out because the menu item wasn't marked yet. Reordered to remove row, then set marked, then add row checking if marked and adding the condition string view based on the marked mime type. If no mime types are set it uses the first mimetype instead which is what we want in that case.
This commit is contained in:
@@ -1033,27 +1033,26 @@ FindPanel::Draw(BRect)
|
||||
return;
|
||||
|
||||
for (int32 index = 0; index < fAttrGrid->CountRows(); index++) {
|
||||
|
||||
BMenuField* menuField
|
||||
= dynamic_cast<BMenuField*>(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<BStringView*>(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<BStringView*>(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;
|
||||
if (fMode == kByAttributeItem)
|
||||
AddAttrRow();
|
||||
|
||||
// the attributes for this type may be different,
|
||||
// rip out the existing ones
|
||||
RemoveAttrViewItems(false);
|
||||
|
||||
AddAttrRow();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user