From: Rafael Fernández López Date: Wed, 19 Sep 2007 04:11:03 +0000 (+0000) Subject: More clear categories strings when sorting by permissions X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/9ed99a5ebb93eb4730da5ff0b1f4d54e579b1aeb?ds=sidebyside More clear categories strings when sorting by permissions svn path=/trunk/KDE/kdebase/apps/; revision=714267 --- 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();