diff options
| author | Peter Penz <[email protected]> | 2012-03-07 22:12:07 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-03-07 22:18:59 +0100 |
| commit | 08a485349f2bd73682ac806b97d3630c3a7dd3fd (patch) | |
| tree | 196869487673eeca1f4d2a3b208efb0f329951d7 /src/kitemviews/kitemlistview.cpp | |
| parent | 90e6190f13caa50773c5d84550a7b42a18adce13 (diff) | |
Allow custom sorting of details-view columns
Fix regression that Dolphin 2.0 did not allow to adjust the sorting
of the details-view columns.
BUG: 164696
FIXED-IN: 4.8.2
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
| -rw-r--r-- | src/kitemviews/kitemlistview.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 3d8224adb..a54e06ddc 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -619,6 +619,8 @@ void KItemListView::setHeaderShown(bool show) connect(m_header, SIGNAL(visibleRoleWidthChanged(QByteArray,qreal,qreal)), this, SLOT(slotVisibleRoleWidthChanged(QByteArray,qreal,qreal))); + connect(m_header, SIGNAL(visibleRoleMoved(QByteArray,int,int)), + this, SLOT(slotVisibleRoleMoved(QByteArray,int,int))); connect(m_header, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)), this, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder))); connect(m_header, SIGNAL(sortRoleChanged(QByteArray,QByteArray)), @@ -1237,6 +1239,23 @@ void KItemListView::slotVisibleRoleWidthChanged(const QByteArray& role, } } +void KItemListView::slotVisibleRoleMoved(const QByteArray& role, + int currentIndex, + int previousIndex) +{ + Q_ASSERT(m_visibleRoles[previousIndex] == role); + + const QList<QByteArray> previous = m_visibleRoles; + + QList<QByteArray> current = m_visibleRoles; + current.removeAt(previousIndex); + current.insert(currentIndex, role); + + setVisibleRoles(current); + + emit visibleRolesChanged(current, previous); +} + void KItemListView::triggerAutoScrolling() { if (!m_autoScrollTimer) { |
