]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinview.cpp
don't expand to the active URL synchronously, wait until the directory lister has...
[dolphin.git] / src / dolphinview.cpp
index 91a41b531b664e53c74878c774da1441bf60cdc6..a85e2db9ba482c08c420c825421f242ff954eabe 100644 (file)
@@ -252,15 +252,24 @@ void DolphinView::selectAll()
 
 void DolphinView::invertSelection()
 {
-    QItemSelectionModel* selectionModel = itemView()->selectionModel();
-    const QAbstractItemModel* itemModel = selectionModel->model();
+    if (isColumnViewActive()) {
+        // QAbstractItemView does not offer a virtual method invertSelection()
+        // as counterpart to QAbstractItemView::selectAll(). This makes it
+        // necessary to delegate the inverting of the selection to the
+        // column view, as only the selection of the active column should get
+        // inverted.
+        m_columnView->invertSelection();
+    } else {
+        QItemSelectionModel* selectionModel = itemView()->selectionModel();
+        const QAbstractItemModel* itemModel = selectionModel->model();
 
-    const QModelIndex topLeft = itemModel->index(0, 0);
-    const QModelIndex bottomRight = itemModel->index(itemModel->rowCount() - 1,
-                                                     itemModel->columnCount() - 1);
+        const QModelIndex topLeft = itemModel->index(0, 0);
+        const QModelIndex bottomRight = itemModel->index(itemModel->rowCount() - 1,
+                                                         itemModel->columnCount() - 1);
 
-    QItemSelection selection(topLeft, bottomRight);
-    selectionModel->select(selection, QItemSelectionModel::Toggle);
+        const QItemSelection selection(topLeft, bottomRight);
+        selectionModel->select(selection, QItemSelectionModel::Toggle);
+    }
 }
 
 bool DolphinView::hasSelection() const
@@ -414,8 +423,7 @@ void DolphinView::updateView(const KUrl& url, const KUrl& rootUrl)
         return;
     }
 
-    const bool restoreColumnView = !isColumnViewActive()
-                                    && !rootUrl.isEmpty()
+    const bool restoreColumnView =  !rootUrl.isEmpty()
                                     && !rootUrl.equals(url, KUrl::CompareWithoutTrailingSlash)
                                     && rootUrl.isParentOf(url);