┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
Diffstat (limited to 'src/views')
-rw-r--r--src/views/dolphinview.cpp29
-rw-r--r--src/views/dolphinview.h12
2 files changed, 41 insertions, 0 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 8ec7f335d..a94a41e15 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -154,6 +154,12 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
connect(model, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()));
}
+ KItemListView* view = controller->view();
+ connect(view, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
+ this, SLOT(slotSortOrderChangedByHeader(Qt::SortOrder,Qt::SortOrder)));
+ connect(view, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
+ this, SLOT(slotSortRoleChangedByHeader(QByteArray,QByteArray)));
+
KItemListSelectionManager* selectionManager = controller->selectionManager();
connect(selectionManager, SIGNAL(selectionChanged(QSet<int>,QSet<int>)),
this, SLOT(slotSelectionChanged(QSet<int>,QSet<int>)));
@@ -1096,6 +1102,29 @@ void DolphinView::slotRefreshItems()
}
}
+void DolphinView::slotSortOrderChangedByHeader(Qt::SortOrder current, Qt::SortOrder previous)
+{
+ Q_UNUSED(previous);
+ Q_ASSERT(fileItemModel()->sortOrder() == current);
+
+ ViewProperties props(url());
+ props.setSortOrder(current);
+
+ emit sortOrderChanged(current);
+}
+
+void DolphinView::slotSortRoleChangedByHeader(const QByteArray& current, const QByteArray& previous)
+{
+ Q_UNUSED(previous);
+ Q_ASSERT(fileItemModel()->sortRole() == current);
+
+ ViewProperties props(url());
+ const Sorting sorting = sortingForSortRole(current);
+ props.setSorting(sorting);
+
+ emit sortingChanged(sorting);
+}
+
KFileItemModel* DolphinView::fileItemModel() const
{
return static_cast<KFileItemModel*>(m_container->controller()->model());
diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h
index fa0baa61e..9a3a83fa3 100644
--- a/src/views/dolphinview.h
+++ b/src/views/dolphinview.h
@@ -647,6 +647,18 @@ private slots:
void slotRefreshItems();
/**
+ * Is invoked when the sort order has been changed by the user by clicking
+ * on a header item. The view properties of the directory will get updated.
+ */
+ void slotSortOrderChangedByHeader(Qt::SortOrder current, Qt::SortOrder previous);
+
+ /**
+ * Is invoked when the sort role has been changed by the user by clicking
+ * on a header item. The view properties of the directory will get updated.
+ */
+ void slotSortRoleChangedByHeader(const QByteArray& current, const QByteArray& previous);
+
+ /**
* Observes the item with the URL \a url. As soon as the directory
* model indicates that the item is available, the item will
* get selected and it is assured that the item stays visible.