[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/utils/dolphin/src
From: Peter Penz <peter.penz () gmx ! at>
Date: 2007-02-05 23:18:23
Message-ID: 1170717503.670864.24197.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 630675 by ppenz:
update the header indicators corresponding to the current sort column and sort order
M +26 -1 dolphindetailsview.cpp
M +14 -2 dolphindetailsview.h
--- trunk/playground/utils/dolphin/src/dolphindetailsview.cpp #630674:630675
@@ -19,19 +19,32 @@
***************************************************************************/
#include "dolphindetailsview.h"
+
+#include <assert.h>
#include "dolphinmainwindow.h"
#include "dolphinview.h"
-
+#include "viewproperties.h"
#include <QHeaderView>
DolphinDetailsView::DolphinDetailsView(DolphinView* parent) :
QTreeView(parent),
m_parentView(parent)
{
+ assert(parent != 0);
+
setAcceptDrops(true);
setRootIsDecorated(false);
setSortingEnabled(true);
setUniformRowHeights(true);
+
+ const ViewProperties props(parent->url());
+ setSortIndicatorSection(props.sorting());
+ setSortIndicatorOrder(props.sortOrder());
+
+ connect(parent, SIGNAL(sortingChanged(DolphinView::Sorting)),
+ this, SLOT(setSortIndicatorSection(DolphinView::Sorting)));
+ connect(parent, SIGNAL(sortOrderChanged(Qt::SortOrder)),
+ this, SLOT(setSortIndicatorOrder(Qt::SortOrder)));
}
DolphinDetailsView::~DolphinDetailsView()
@@ -107,4 +120,16 @@
}
}
+void DolphinDetailsView::setSortIndicatorSection(DolphinView::Sorting sorting)
+{
+ QHeaderView* headerView = header();
+ headerView->setSortIndicator(sorting, headerView->sortIndicatorOrder());
+}
+
+void DolphinDetailsView::setSortIndicatorOrder(Qt::SortOrder sortOrder)
+{
+ QHeaderView* headerView = header();
+ headerView->setSortIndicator(headerView->sortIndicatorSection(), sortOrder);
+}
+
#include "dolphindetailsview.moc"
--- trunk/playground/utils/dolphin/src/dolphindetailsview.h #630674:630675
@@ -21,10 +21,9 @@
#ifndef DOLPHINDETAILSVIEW_H
#define DOLPHINDETAILSVIEW_H
+#include <dolphinview.h>
#include <QTreeView>
-class DolphinView;
-
/**
* @brief Represents the details view which shows the name, size,
* date, permissions, owner and group of an item.
@@ -49,6 +48,19 @@
virtual void dragEnterEvent(QDragEnterEvent* event);
virtual void dropEvent(QDropEvent* event);
+private slots:
+ /**
+ * Sets the sort indicator section of the header view
+ * corresponding to \a sorting.
+ */
+ void setSortIndicatorSection(DolphinView::Sorting sorting);
+
+ /**
+ * Sets the sort indicator order of the header view
+ * corresponding to \a sortOrder.
+ */
+ void setSortIndicatorOrder(Qt::SortOrder sortOrder);
+
private:
DolphinView* m_parentView;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic