apply sorting + sort order to the column view

BUG: 157343

svn path=/trunk/KDE/kdebase/apps/; revision=773766
This commit is contained in:
Peter Penz 2008-02-11 18:27:49 +00:00
parent 142c7628e8
commit d432679df0
5 changed files with 40 additions and 1 deletions

View file

@ -59,6 +59,10 @@ DolphinColumnView::DolphinColumnView(QWidget* parent, DolphinController* control
this, SLOT(updateColumnsBackground(bool)));
const DolphinView* view = controller->dolphinView();
connect(view, SIGNAL(sortingChanged(DolphinView::Sorting)),
this, SLOT(slotSortingChanged(DolphinView::Sorting)));
connect(view, SIGNAL(sortOrderChanged(Qt::SortOrder)),
this, SLOT(slotSortOrderChanged(Qt::SortOrder)));
connect(view, SIGNAL(showHiddenFilesChanged()),
this, SLOT(slotShowHiddenFilesChanged()));
connect(view, SIGNAL(showPreviewChanged()),
@ -408,6 +412,20 @@ void DolphinColumnView::updateColumnsBackground(bool active)
}
}
void DolphinColumnView::slotSortingChanged(DolphinView::Sorting sorting)
{
foreach (DolphinColumnWidget* column, m_columns) {
column->setSorting(sorting);
}
}
void DolphinColumnView::slotSortOrderChanged(Qt::SortOrder order)
{
foreach (DolphinColumnWidget* column, m_columns) {
column->setSortOrder(order);
}
}
void DolphinColumnView::slotShowHiddenFilesChanged()
{
const bool show = m_controller->dolphinView()->showHiddenFiles();

View file

@ -20,6 +20,8 @@
#ifndef DOLPHINCOLUMNVIEW_H
#define DOLPHINCOLUMNVIEW_H
#include "dolphinview.h"
#include <kurl.h>
#include <QAbstractItemView>
@ -128,6 +130,8 @@ private slots:
*/
void updateColumnsBackground(bool active);
void slotSortingChanged(DolphinView::Sorting sorting);
void slotSortOrderChanged(Qt::SortOrder order);
void slotShowHiddenFilesChanged();
void slotShowPreviewChanged();

View file

@ -118,6 +118,9 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent,
m_proxyModel = new DolphinSortFilterProxyModel(this);
m_proxyModel->setSourceModel(m_dolphinModel);
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
const DolphinView* dolphinView = m_view->m_controller->dolphinView();
m_proxyModel->setSorting(dolphinView->sorting());
m_proxyModel->setSortOrder(dolphinView->sortOrder());
setModel(m_proxyModel);
const bool useSelManager = KGlobalSettings::singleClick() &&
@ -173,6 +176,16 @@ void DolphinColumnWidget::reload()
m_dirLister->openUrl(m_url, KDirLister::Reload);
}
void DolphinColumnWidget::setSorting(DolphinView::Sorting sorting)
{
m_proxyModel->setSorting(sorting);
}
void DolphinColumnWidget::setSortOrder(Qt::SortOrder order)
{
m_proxyModel->setSortOrder(order);
}
void DolphinColumnWidget::setShowHiddenFiles(bool show)
{
if (show != m_dirLister->showingDotFiles()) {

View file

@ -20,6 +20,8 @@
#ifndef DOLPHINCOLUMNWIDGET_H
#define DOLPHINCOLUMNWIDGET_H
#include "dolphinview.h"
#include <QFont>
#include <QListView>
#include <QSize>
@ -79,6 +81,8 @@ public:
/** Reloads the directory DolphinColumnWidget::url(). */
void reload();
void setSorting(DolphinView::Sorting sorting);
void setSortOrder(Qt::SortOrder order);
void setShowHiddenFiles(bool show);
void setShowPreview(bool show);

View file

@ -594,7 +594,7 @@ void DolphinView::loadDirectory(const KUrl& url, bool reload)
KUrl DolphinView::viewPropertiesUrl() const
{
if (isColumnViewActive()) {
return m_dirLister->url();
return m_columnView->rootUrl();
}
return url();