┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-09-26 15:26:30 +0000
committerPeter Penz <[email protected]>2007-09-26 15:26:30 +0000
commit34a19e156e2e38b0c26824918277cc047b88a449 (patch)
tree4c76e2f1c9c7cf97ef358afb5400c58a0b6208d0 /src
parent3713f1991ac7862296ccdcbe02b3ecf909e2c295 (diff)
Assure that the categorized sorting is applied correctly to the proxy model if the view does not support the categorization feature (currently only the icons view supports this). Take care that switching between e. g. the icons-view and the details-view does not change the stored categorized sorting. Thanks to Rafael for the initial patch!
CCMAIL: [email protected] svn path=/trunk/KDE/kdebase/apps/; revision=717300
Diffstat (limited to 'src')
-rw-r--r--src/dolphinview.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index 73b44e6fb..8b36e4ec3 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -168,6 +168,17 @@ void DolphinView::setMode(Mode mode)
props.setViewMode(m_mode);
createView();
+
+ // Not all view modes support categorized sorting. Adjust the sorting model
+ // if changing the view mode results in a change of the categorized sorting
+ // capabilities.
+ const bool categorized = props.categorizedSorting() && supportsCategorizedSorting();
+ if (categorized != categorizedSorting()) {
+ m_proxyModel->setCategorizedModel(categorized);
+ m_proxyModel->sort(m_proxyModel->sortColumn(), m_proxyModel->sortOrder());
+ emit categorizedSortingChanged();
+ }
+
startDirLister(viewPropsUrl);
emit modeChanged();
@@ -222,17 +233,9 @@ void DolphinView::setCategorizedSorting(bool categorized)
return;
}
- if (!categorized && !supportsCategorizedSorting())
- {
- m_proxyModel->setCategorizedModel(categorized);
- m_proxyModel->sort(m_proxyModel->sortColumn(), m_proxyModel->sortOrder());
-
- emit categorizedSortingChanged();
-
- return;
- }
-
- Q_ASSERT(m_iconsView != 0);
+ // setCategorizedSorting(true) may only get invoked
+ // if the view supports categorized sorting
+ Q_ASSERT(!categorized || supportsCategorizedSorting());
ViewProperties props(viewPropertiesUrl());
props.setCategorizedSorting(categorized);
@@ -615,9 +618,10 @@ void DolphinView::applyViewProperties(const KUrl& url)
emit showHiddenFilesChanged();
}
- const bool categorized = props.categorizedSorting();
+ const bool categorized = props.categorizedSorting() && supportsCategorizedSorting();
if (categorized != categorizedSorting()) {
m_proxyModel->setCategorizedModel(categorized);
+ m_proxyModel->sort(m_proxyModel->sortColumn(), m_proxyModel->sortOrder());
emit categorizedSortingChanged();
}
@@ -812,19 +816,11 @@ void DolphinView::createView()
case DetailsView:
m_detailsView = new DolphinDetailsView(this, m_controller);
view = m_detailsView;
-
- // categorized sorting is not supported yet for the details
- // view, even if the view properties indicate this
- setCategorizedSorting(false);
break;
case ColumnView:
m_columnView = new DolphinColumnView(this, m_controller);
view = m_columnView;
-
- // categorized sorting is not supported yet for the column
- // view, even if the view properties indicate this
- setCategorizedSorting(false);
break;
}