X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/63124f569ca8f6dec6431c667f02d2f985db2979..3bf471e0:/src/kitemviews/kfileitemmodel.cpp diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 2f39cd1a2..6391d7d3f 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -15,7 +15,9 @@ #include #include +#include #include +#include #include #include @@ -574,6 +576,9 @@ bool KFileItemModel::setExpanded(int index, bool expanded) m_expandedDirs.remove(targetUrl); m_dirLister->stop(url); +#if KIO_VERSION >= QT_VERSION_CHECK(5, 92, 0) + m_dirLister->forgetDirs(url); +#endif const int parentLevel = expandedParentsCount(index); const int itemCount = m_itemData.count(); @@ -589,6 +594,9 @@ bool KFileItemModel::setExpanded(int index, bool expanded) const QUrl url = itemData->item.url(); m_expandedDirs.remove(targetUrl); m_dirLister->stop(url); // TODO: try to unit-test this, see https://bugs.kde.org/show_bug.cgi?id=332102#c11 +#if KIO_VERSION >= QT_VERSION_CHECK(5, 92, 0) + m_dirLister->forgetDirs(url); +#endif expandedChildren.append(targetUrl); } ++childIndex; @@ -2088,6 +2096,19 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const break; } + case DimensionsRole: { + const QByteArray role = roleForType(m_sortRole); + const QSize dimensionsA = a->values.value(role).toSize(); + const QSize dimensionsB = b->values.value(role).toSize(); + + if (dimensionsA.width() == dimensionsB.width()) { + result = dimensionsA.height() - dimensionsB.height(); + } else { + result = dimensionsA.width() - dimensionsB.width(); + } + break; + } + default: { const QByteArray role = roleForType(m_sortRole); const QString roleValueA = a->values.value(role).toString(); @@ -2595,6 +2616,7 @@ const KFileItemModel::RoleInfoMap* KFileItemModel::rolesInfoMap(int& count) { "wordCount", WordCountRole, kli18nc("@label", "Word Count"), kli18nc("@label", "Document"), true, true }, { "lineCount", LineCountRole, kli18nc("@label", "Line Count"), kli18nc("@label", "Document"), true, true }, { "imageDateTime", ImageDateTimeRole, kli18nc("@label", "Date Photographed"), kli18nc("@label", "Image"), true, true }, + { "dimensions", DimensionsRole, kli18nc("@label width x height", "Dimensions"), kli18nc("@label", "Image"), true, true }, { "width", WidthRole, kli18nc("@label", "Width"), kli18nc("@label", "Image"), true, true }, { "height", HeightRole, kli18nc("@label", "Height"), kli18nc("@label", "Image"), true, true }, { "orientation", OrientationRole, kli18nc("@label", "Orientation"), kli18nc("@label", "Image"), true, true },