Make sure the correct name filter is selected in the Mac file dialog
Since we have to add the filters one by one to the Mac file dialog it was finding the one that would match the filter by comparing the start of the filter string. However it would continue to check the start of other filters even if it had already found the one it should be using. Now it uses either an exact match or the first one that it matches the start of. Change-Id: Ie6441acd48e45ec9c712afc12a2ea47755835bb3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
This commit is contained in:
parent
7024bc7091
commit
d6506c129d
@ -493,14 +493,18 @@ static QString strippedText(QString s)
|
||||
[mPopUpButton setTarget:self];
|
||||
[mPopUpButton setAction:@selector(filterChanged:)];
|
||||
|
||||
QStringList *filters = mNameFilterDropDownList;
|
||||
if (filters->size() > 0){
|
||||
if (mNameFilterDropDownList->size() > 0) {
|
||||
int filterToUse = -1;
|
||||
for (int i=0; i<mNameFilterDropDownList->size(); ++i) {
|
||||
QString filter = hideDetails ? [self removeExtensions:filters->at(i)] : filters->at(i);
|
||||
QString currentFilter = mNameFilterDropDownList->at(i);
|
||||
if (selectedFilter == currentFilter ||
|
||||
(filterToUse == -1 && currentFilter.startsWith(selectedFilter)))
|
||||
filterToUse = i;
|
||||
QString filter = hideDetails ? [self removeExtensions:currentFilter] : currentFilter;
|
||||
[mPopUpButton addItemWithTitle:QT_PREPEND_NAMESPACE(QCFString::toNSString)(filter)];
|
||||
if (filters->at(i).startsWith(selectedFilter))
|
||||
[mPopUpButton selectItemAtIndex:i];
|
||||
}
|
||||
if (filterToUse != -1)
|
||||
[mPopUpButton selectItemAtIndex:filterToUse];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user