FindPanel - Corrected operators less / greater than + rebuild of attributes for MIME change

* Operators for Less than/before and Greater than/After were incorrectly set to <= and =>,
  now corrected to < and >
* When query type is set to By attribute and user changes Filetype, corrected the update of attributes
  Before this change, attributes were updated according to previous filetype

Change-Id: I7e02af9cb667c4db2c0efd8fa0da8b2b0c4b9ddf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2990
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
jiceland
2021-03-19 10:17:40 +00:00
committed by Adrien Destugues
parent 87f4776937
commit 7e094dc359
+15 -16
View File
@@ -115,8 +115,8 @@ const int32 operators[] = {
B_NE,
B_BEGINS_WITH,
B_ENDS_WITH,
B_GE,
B_LE
B_GT,
B_LT
};
static const char* operatorLabels[] = {
@@ -1167,12 +1167,6 @@ FindPanel::MessageReceived(BMessage* message)
case kMIMETypeItem:
{
if (fMode == kByAttributeItem) {
// the attributes for this type may be different
RemoveAttrViewItems(false);
AddAttrRow();
}
BMenuItem* item;
if (message->FindPointer("source", (void**)&item) == B_OK) {
// don't add the "All files and folders" to the list
@@ -1181,6 +1175,11 @@ FindPanel::MessageReceived(BMessage* message)
SetCurrentMimeType(item);
}
if (fMode == kByAttributeItem) {
// the attributes for this type may be different
RemoveAttrViewItems(false);
AddAttrRow();
}
break;
}
@@ -2628,12 +2627,12 @@ FindPanel::AddAttributeControls(int32 gridRow)
menu->AddItem(item);
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_GE);
message->AddInt32("operator", B_GT);
submenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(operatorLabels[5]),
message));
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_LE);
message->AddInt32("operator", B_LT);
submenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(operatorLabels[6]),
message));
@@ -2653,12 +2652,12 @@ FindPanel::AddAttributeControls(int32 gridRow)
menu->AddItem(item);
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_LE);
message->AddInt32("operator", B_LT);
submenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(operatorLabels[7]),
message));
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_GE);
message->AddInt32("operator", B_GT);
submenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(operatorLabels[8]),
message));
@@ -2924,21 +2923,21 @@ FindPanel::AddAttributes(BMenu* menu, const BMimeType &mimeType)
submenu->AddItem(new BMenuItem(operatorLabels[1], message));
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_GE);
message->AddInt32("operator", B_GT);
submenu->AddItem(new BMenuItem(operatorLabels[5], message));
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_LE);
message->AddInt32("operator", B_LT);
submenu->AddItem(new BMenuItem(operatorLabels[6], message));
break;
case B_TIME_TYPE:
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_LE);
message->AddInt32("operator", B_LT);
submenu->AddItem(new BMenuItem(operatorLabels[7], message));
message = new BMessage(kAttributeItem);
message->AddInt32("operator", B_GE);
message->AddInt32("operator", B_GT);
submenu->AddItem(new BMenuItem(operatorLabels[8], message));
break;
}