Tracker: Various sorting issues in Tracker
When sorting files by Modified dates, right clicking on a file was leading to a sorting issue where files were changing positions (without reason). 1. Any changes to stats (size, modification, creation, mode) was triggering the sorting. Now only stats fields currently used as a Sort criteria will trigger such event. 2. The Mimeset of file was set (in case of unknown file format) once per checked add-on when building AddOn Menu. Now it's checked once per file in selection. (so, once per file, rather then once per file, per add-on). 3. Now rely on registrar to force the mimeset (to trigger the sniffer in case the attribute already exist) rather than trying to duplicate the feature in Tracker. 4. When Sorting, if there is a old position known, check if it's working by looking if you should come after the previous item, and before the following item. Previously, the item would be pushed at the top if the group of item all fitting the criteria (same file size, same file kind, etc.. depending on the sorting criteria). Fixes #8478.
This commit is contained in:
@@ -318,12 +318,7 @@ static void
|
||||
AddMimeTypeString(BObjectList<BString> &list, Model *model)
|
||||
{
|
||||
BString *mimeType = new BString(model->MimeType());
|
||||
if (!mimeType->Length() || !mimeType->ICompare(B_FILE_MIMETYPE)) {
|
||||
// if model is of unknown type, try mimeseting it first
|
||||
model->Mimeset(true);
|
||||
mimeType->SetTo(model->MimeType());
|
||||
}
|
||||
|
||||
|
||||
if (mimeType->Length()) {
|
||||
// only add the type if it's not already there
|
||||
for (int32 i = list.CountItems(); i-- > 0;) {
|
||||
@@ -2975,6 +2970,8 @@ BContainerWindow::BuildAddOnMenu(BMenu *menu)
|
||||
break;
|
||||
delete item;
|
||||
}
|
||||
|
||||
_UpdateSelectionMIMEInfo();
|
||||
|
||||
BObjectList<BMenuItem> primaryList;
|
||||
BObjectList<BMenuItem> secondaryList;
|
||||
@@ -3141,6 +3138,29 @@ BContainerWindow::LoadAddOn(BMessage *message)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BContainerWindow::_UpdateSelectionMIMEInfo()
|
||||
{
|
||||
BPose* pose;
|
||||
int32 index = 0;
|
||||
while ((pose = PoseView()->SelectionList()->ItemAt(index++)) != NULL) {
|
||||
BString mimeType(pose->TargetModel()->MimeType());
|
||||
if (!mimeType.Length() || mimeType.ICompare(B_FILE_MIMETYPE) == 0) {
|
||||
pose->TargetModel()->Mimeset(true);
|
||||
if (pose->TargetModel()->IsSymLink()) {
|
||||
Model* resolved = new Model(pose->TargetModel()->EntryRef(), true, true);
|
||||
if (resolved->InitCheck() == B_OK) {
|
||||
mimeType.SetTo(resolved->MimeType());
|
||||
if (!mimeType.Length() || mimeType.ICompare(B_FILE_MIMETYPE) == 0)
|
||||
resolved->Mimeset(true);
|
||||
}
|
||||
delete resolved;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BMenuItem *
|
||||
BContainerWindow::NewAttributeMenuItem(const char *label, const char *name,
|
||||
int32 type, float width, int32 align, bool editable, bool statField)
|
||||
|
||||
Reference in New Issue
Block a user