diff options
| author | Frank Reininghaus <[email protected]> | 2011-09-17 17:49:20 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2011-09-17 22:51:57 +0200 |
| commit | 01d4b8d0820ee3ab9f05df23c31a8230acfe7083 (patch) | |
| tree | 05848ccb8b8b8a49fbd210cbe87745e6553e1052 /src/views/dolphinview.cpp | |
| parent | 9424f5a789b98b148e3c6b39738da164c73e0431 (diff) | |
Implement DolphinView::sorting()
This fixes the problem that changing the sorting criterion
from 'Name' to 'Date' and then back to 'Name' doesn't work.
Diffstat (limited to 'src/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index cdcb9f7cb..11fe17ac5 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -358,8 +358,8 @@ void DolphinView::setSorting(Sorting sorting) DolphinView::Sorting DolphinView::sorting() const { - return DolphinView::SortByName; - //return m_viewAccessor.proxyModel()->sorting(); + KItemModelBase* model = m_container->controller()->model(); + return sortingForSortRole(model->sortRole()); } void DolphinView::setSortOrder(Qt::SortOrder order) @@ -1283,4 +1283,21 @@ QByteArray DolphinView::sortRoleForSorting(Sorting sorting) const return QByteArray(); } +DolphinView::Sorting DolphinView::sortingForSortRole(const QByteArray& sortRole) const +{ + static QHash<QByteArray, DolphinView::Sorting> sortHash; + if (sortHash.isEmpty()) { + sortHash.insert("name", SortByName); + sortHash.insert("size", SortBySize); + sortHash.insert("date", SortByDate); + sortHash.insert("permissions", SortByPermissions); + sortHash.insert("owner", SortByOwner); + sortHash.insert("group", SortByGroup); + sortHash.insert("type", SortByType); + sortHash.insert("destination", SortByDestination); + sortHash.insert("path", SortByPath); + } + return sortHash.value(sortRole); +} + #include "dolphinview.moc" |
