***************************************************************************/
#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()
}
}
+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"
#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.
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;
};