]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Don't show the name as part of the "path" role
authorPeter Penz <peter.penz19@gmail.com>
Fri, 23 Dec 2011 22:36:32 +0000 (23:36 +0100)
committerPeter Penz <peter.penz19@gmail.com>
Fri, 23 Dec 2011 22:38:38 +0000 (23:38 +0100)
This allows a useful grouping by paths when e.g. searching files.

BUG: 269335
FIXED-IN: 4.8.0

src/kitemviews/kfileitemlistwidget.cpp
src/kitemviews/kfileitemmodel.cpp

index d3e792ea0d7b76324fb96b7c67a0b9698c699c4a..aba5129df9ad883b873ee1e7e11a7f472071ff49 100644 (file)
@@ -95,7 +95,7 @@ void KFileItemListWidget::paint(QPainter* painter, const QStyleOptionGraphicsIte
     KItemListWidget::paint(painter, option, widget);
 
     // Draw expansion toggle '>' or 'V'
-    if (m_isExpandable) {
+    if (m_isExpandable && !m_expansionArea.isEmpty()) {
         QStyleOption arrowOption;
         arrowOption.rect = m_expansionArea.toRect();
         const QStyle::PrimitiveElement arrow = data()["isExpanded"].toBool()
index baf168ddf1df3050903aec365a2a13bffd172701..70e92eaac1990e56b0810460edbfcb38e1da1ca3 100644 (file)
@@ -1157,12 +1157,16 @@ QHash<QByteArray, QVariant> KFileItemModel::retrieveData(const KFileItem& item)
     }
 
     if (m_requestRole[PathRole]) {
+        QString path;
         if (item.url().protocol() == QLatin1String("trash")) {
-            const KIO::UDSEntry udsEntry = item.entry();
-            data.insert("path", udsEntry.stringValue(KIO::UDSEntry::UDS_EXTRA));
+            path = item.entry().stringValue(KIO::UDSEntry::UDS_EXTRA);
         } else {
-            data.insert("path", item.localPath());
+            path = item.localPath();
         }
+
+        const int index = path.lastIndexOf(item.text());
+        path = path.mid(0, index - 1);
+        data.insert("path", path);
     }
 
     if (m_requestRole[IsExpandedRole]) {