From 9ed99a5ebb93eb4730da5ff0b1f4d54e579b1aeb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafael=20Fern=C3=A1ndez=20L=C3=B3pez?= Date: Wed, 19 Sep 2007 04:11:03 +0000 Subject: [PATCH] More clear categories strings when sorting by permissions svn path=/trunk/KDE/kdebase/apps/; revision=714267 --- src/dolphinmodel.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/src/dolphinmodel.cpp b/src/dolphinmodel.cpp index 6ca2dd8e6..c71062860 100644 --- a/src/dolphinmodel.cpp +++ b/src/dolphinmodel.cpp @@ -20,6 +20,10 @@ #include "dolphinmodel.h" +extern "C" { +#include +} + #include "dolphinsortfilterproxymodel.h" #include "kcategorizedview.h" @@ -159,8 +163,58 @@ QVariant DolphinModel::data(const QModelIndex &index, int role) const } case KDirModel::Permissions: - retString = item.permissionsString(); + { + QString user; + QString group; + QString others; + + mode_t permissions = item.permissions(); + + if (permissions & S_IRUSR) + user = i18n("Read, "); + + if (permissions & S_IWUSR) + user += i18n("Write, "); + + if (permissions & S_IXUSR) + user += i18n("Execute, "); + + if (user.isEmpty()) + user = i18n("Forbidden"); + else + user = user.mid(0, user.count() - 2); + + if (permissions & S_IRGRP) + group = i18n("Read, "); + + if (permissions & S_IWGRP) + group += i18n("Write, "); + + if (permissions & S_IXGRP) + group += i18n("Execute, "); + + if (group.isEmpty()) + group = i18n("Forbidden"); + else + group = group.mid(0, group.count() - 2); + + if (permissions & S_IROTH) + others = i18n("Read, "); + + if (permissions & S_IWOTH) + others += i18n("Write, "); + + if (permissions & S_IXOTH) + others += i18n("Execute, "); + + if (others.isEmpty()) + others = i18n("Forbidden"); + else + others = others.mid(0, others.count() - 2); + + retString = i18nc("This shows files and folders permissions: user, group and others", "(User: %1) (Group: %2) (Others: %3)", user, group, others); break; + } case KDirModel::Owner: retString = item.user(); -- 2.47.3