diff options
| author | Peter Penz <[email protected]> | 2012-03-13 16:26:16 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-03-13 16:29:45 +0100 |
| commit | f041099904d809b5370285185fbbb2303c40b953 (patch) | |
| tree | 5070608d5c19033a119bec98b9466d889bd8bd7c /src/views/dolphinview.cpp | |
| parent | 6c60bf0ad54258976d9dcbd6586b26c65d8d4b78 (diff) | |
Remove RolesInfoAccessor
Now KFileItemModel provides a way to access the available roles
including their translations. Note that the 3 roles "comments",
"rating" and "tags" have not been implemented yet in KFileItemModel
and turning them on does not work currently.
Diffstat (limited to 'src/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index e945b00eb..890a39d89 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -56,7 +56,6 @@ #include <KToggleAction> #include <KUrl> -#include "rolesaccessor.h" #include "dolphindirlister.h" #include "dolphinnewfilemenuobserver.h" #include "dolphin_detailsmodesettings.h" @@ -781,16 +780,15 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos) const QSet<QByteArray> visibleRolesSet = view->visibleRoles().toSet(); // Add all roles to the menu that can be shown or hidden by the user - const RolesAccessor& rolesAccessor = RolesAccessor::instance(); - const QList<QByteArray> roles = rolesAccessor.roles(); - foreach (const QByteArray& role, roles) { - if (role != "name") { - const QString text = fileItemModel()->roleDescription(role); + const QList<KFileItemModel::RoleInfo> rolesInfo = KFileItemModel::rolesInformation(); + foreach (const KFileItemModel::RoleInfo& info, rolesInfo) { + if (info.role != "name") { + const QString text = fileItemModel()->roleDescription(info.role); QAction* action = menu.data()->addAction(text); action->setCheckable(true); - action->setChecked(visibleRolesSet.contains(role)); - action->setData(role); + action->setChecked(visibleRolesSet.contains(info.role)); + action->setData(info.role); } } @@ -802,8 +800,7 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos) ViewProperties props(url()); QList<QByteArray> visibleRoles = view->visibleRoles(); if (action->isChecked()) { - const int index = roles.indexOf(selectedRole) + 1; - visibleRoles.insert(index, selectedRole); + visibleRoles.append(selectedRole); } else { visibleRoles.removeOne(selectedRole); } |
