From 283f97ac27c3cfe5c72682b0843503e31643a612 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 15 Oct 2011 22:55:01 +0200 Subject: Interface cleanups to prepare the return of "grouped sorting" - Rename setCategorizedSorting() to setGroupedSorting() - Change the model interface to allow enabling/disabling grouping without the need to declare a role (the sort role will be taken). - Add dummy group role implementation in KFileItemModel The grouping code itself requires some cleanups and might crash at the moment or lead to weird layouts. --- src/kitemviews/kitemlistview.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/kitemviews/kitemlistview.cpp') diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 6d1aeca24..a4cb4b041 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -845,6 +845,11 @@ void KItemListView::slotItemsChanged(const KItemRangeList& itemRanges, } } +void KItemListView::slotGroupedSortingChanged(bool current) +{ + m_grouped = current; +} + void KItemListView::slotCurrentChanged(int current, int previous) { Q_UNUSED(previous); @@ -1101,11 +1106,13 @@ void KItemListView::setModel(KItemModelBase* model) this, SLOT(slotItemsRemoved(KItemRangeList))); disconnect(m_model, SIGNAL(itemsMoved(KItemRange,QList)), this, SLOT(slotItemsMoved(KItemRange,QList))); + disconnect(m_model, SIGNAL(groupedSortingChanged(bool)), + this, SLOT(slotGroupedSortingChanged(bool))); } m_model = model; m_layouter->setModel(model); - m_grouped = !model->groupRole().isEmpty(); + m_grouped = model->groupedSorting(); if (m_model) { connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), @@ -1116,6 +1123,8 @@ void KItemListView::setModel(KItemModelBase* model) this, SLOT(slotItemsRemoved(KItemRangeList))); connect(m_model, SIGNAL(itemsMoved(KItemRange,QList)), this, SLOT(slotItemsMoved(KItemRange,QList))); + connect(m_model, SIGNAL(groupedSortingChanged(bool)), + this, SLOT(slotGroupedSortingChanged(bool))); } onModelChanged(model, previous); -- cgit v1.3.1