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/views/dolphinview.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/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index ea7441600..148459f68 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -161,6 +161,8 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) : this, SLOT(slotSortOrderChangedByHeader(Qt::SortOrder,Qt::SortOrder))); connect(view, SIGNAL(sortRoleChanged(QByteArray,QByteArray)), this, SLOT(slotSortRoleChangedByHeader(QByteArray,QByteArray))); + connect(view, SIGNAL(visibleRolesChanged(QList<QByteArray>,QList<QByteArray>)), + this, SLOT(slotVisibleRolesChangedByHeader(QList<QByteArray>,QList<QByteArray>))); KItemListSelectionManager* selectionManager = controller->selectionManager(); connect(selectionManager, SIGNAL(selectionChanged(QSet<int>,QSet<int>)), @@ -1157,6 +1159,29 @@ void DolphinView::slotSortRoleChangedByHeader(const QByteArray& current, const Q emit sortingChanged(sorting); } +void DolphinView::slotVisibleRolesChangedByHeader(const QList<QByteArray>& current, + const QList<QByteArray>& previous) +{ + Q_UNUSED(previous); + Q_ASSERT(m_container->controller()->view()->visibleRoles() == current); + + const QList<AdditionalInfo> previousAdditionalInfoList = m_additionalInfoList; + + m_additionalInfoList.clear(); + m_additionalInfoList.reserve(current.count()); + const AdditionalInfoAccessor& infoAccessor = AdditionalInfoAccessor::instance(); + foreach (const QByteArray& role, current) { + if (role != "name") { + m_additionalInfoList.append(infoAccessor.additionalInfo(role)); + } + } + + ViewProperties props(url()); + props.setAdditionalInfoList(m_additionalInfoList); + + emit additionalInfoListChanged(m_additionalInfoList, previousAdditionalInfoList); +} + KFileItemModel* DolphinView::fileItemModel() const { return static_cast<KFileItemModel*>(m_container->controller()->model()); |
