]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kfileitemmodel.cpp
Merge branch 'KDE/4.9' of git://anongit.kde.org/kde-baseapps into KDE/4.9
[dolphin.git] / src / kitemviews / kfileitemmodel.cpp
index f8302cfab4408ad4e9f8862e9c5bce2289d21bfb..6936af4311da9bd657d78aeab658de721307dcb1 100644 (file)
@@ -287,7 +287,7 @@ QString KFileItemModel::roleDescription(const QByteArray& role) const
         int count = 0;
         const RoleInfoMap* map = rolesInfoMap(count);
         for (int i = 0; i < count; ++i) {
-            description.insert(map[i].role, map[i].roleTranslation);
+            description.insert(map[i].role, i18nc(map[i].roleTranslationContext, map[i].roleTranslation));
         }
     }
 
@@ -560,8 +560,15 @@ QList<KFileItemModel::RoleInfo> KFileItemModel::rolesInformation()
             if (map[i].roleType != NoRole) {
                 RoleInfo info;
                 info.role = map[i].role;
-                info.translation = map[i].roleTranslation;
-                info.group = map[i].groupTranslation;
+                info.translation = i18nc(map[i].roleTranslationContext, map[i].roleTranslation);
+                if (map[i].groupTranslation) {
+                    info.group = i18nc(map[i].groupTranslationContext, map[i].groupTranslation);
+                } else {
+                    // For top level roles, groupTranslation is 0. We must make sure that
+                    // info.group is an empty string then because the code that generates
+                    // menus tries to put the actions into sub menus otherwise.
+                    info.group = QString();
+                }
                 info.requiresNepomuk = map[i].requiresNepomuk;
                 info.requiresIndexer = map[i].requiresIndexer;
                 rolesInfo.append(info);