X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/3bf8fa5901f200d26acc2eb527eef88087e6edb9..2c689ca4f7c8dfe62c75dc3c93ac9df2f31c0a8c:/src/dolphinview.cpp diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 91a41b531..5f7fc1148 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -219,7 +219,12 @@ bool DolphinView::showHiddenFiles() const void DolphinView::setCategorizedSorting(bool categorized) { - if (!supportsCategorizedSorting() || (categorized == categorizedSorting())) { + if (categorized && !supportsCategorizedSorting()) { + setCategorizedSorting(false); + return; + } + + if (categorized == categorizedSorting()) { return; } @@ -252,15 +257,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 +428,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);