mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
kio: do not cache the name in lower case from KFileItem::name()
case-insensitive comparison is faster and is already done by KDirSortFilterProxyModel Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
8e1a9cfec7
commit
e88a8bd627
3 changed files with 4 additions and 19 deletions
|
@ -171,9 +171,7 @@ bool KDirSortFilterProxyModel::subSortLessThan(const QModelIndex& left,
|
|||
int result = d->compare(leftFileItem.text(), rightFileItem.text(), sortCaseSensitivity());
|
||||
if (result == 0) {
|
||||
// KFileItem::text() may not be unique in case UDS_DISPLAY_NAME is used
|
||||
result = d->compare(leftFileItem.name(sortCaseSensitivity() == Qt::CaseInsensitive),
|
||||
rightFileItem.name(sortCaseSensitivity() == Qt::CaseInsensitive),
|
||||
sortCaseSensitivity());
|
||||
result = d->compare(leftFileItem.name(), rightFileItem.name(), sortCaseSensitivity());
|
||||
if (result == 0) {
|
||||
// If KFileItem::text() is also not unique most probably a search protocol is used
|
||||
// that allows showing the same file names from different directories
|
||||
|
|
|
@ -155,11 +155,6 @@ public:
|
|||
*/
|
||||
mutable QString m_iconName;
|
||||
|
||||
/**
|
||||
* The filename in lower case (to speed up sorting)
|
||||
*/
|
||||
mutable QString m_strLowerCaseName;
|
||||
|
||||
/**
|
||||
* The mimetype of the file
|
||||
*/
|
||||
|
@ -1081,18 +1076,12 @@ QString KFileItem::text() const
|
|||
return d->m_strText;
|
||||
}
|
||||
|
||||
QString KFileItem::name(bool lowerCase) const
|
||||
QString KFileItem::name() const
|
||||
{
|
||||
if (!d) {
|
||||
return QString();
|
||||
}
|
||||
if (!lowerCase) {
|
||||
return d->m_strName;
|
||||
}
|
||||
if (d->m_strLowerCaseName.isNull()) {
|
||||
d->m_strLowerCaseName = d->m_strName.toLower();
|
||||
}
|
||||
return d->m_strLowerCaseName;
|
||||
return d->m_strName;
|
||||
}
|
||||
|
||||
KUrl KFileItem::targetUrl() const
|
||||
|
|
|
@ -282,11 +282,9 @@ public:
|
|||
/**
|
||||
* Return the name of the file item (without a path).
|
||||
* Similar to text(), but unencoded, i.e. the original name.
|
||||
* @param lowerCase if true, the name will be returned in lower case,
|
||||
* which is useful to speed up sorting by name, case insensitively.
|
||||
* @return the file's name
|
||||
*/
|
||||
QString name(bool lowerCase = false) const;
|
||||
QString name() const;
|
||||
|
||||
/**
|
||||
* Returns the mimetype of the file item. Equivalent to mimeTypePtr()->name()
|
||||
|
|
Loading…
Add table
Reference in a new issue