]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix regression that caused "(I18N_EMPTY_MESSAGE)" sub menus in menus
authorFrank Reininghaus <frank78ac@googlemail.com>
Fri, 24 Aug 2012 16:51:27 +0000 (18:51 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Fri, 24 Aug 2012 16:57:47 +0000 (18:57 +0200)
For top-level roles like "Name" and "Size", the group translation is 0.
In that case, the "group" member of the corresponding RoleInfo struct
must be an empty string. This is expected by the code which generates
Dolphin's menus, which group the top-level roles into a sub menu with
the name "(I18N_EMPTY_MESSAGE)" otherwise. This is a recent regression
caused by 199fabbaa8d8a12fb49e4c9922c38ec8b033923c.

Thanks to Christoph Feck for investigating this issue!

CCBUG: 305228

src/kitemviews/kfileitemmodel.cpp

index 1bf9e65d4d6a0c1269c2bab92fc2644d29c79f3c..6936af4311da9bd657d78aeab658de721307dcb1 100644 (file)
@@ -561,7 +561,14 @@ QList<KFileItemModel::RoleInfo> KFileItemModel::rolesInformation()
                 RoleInfo info;
                 info.role = map[i].role;
                 info.translation = i18nc(map[i].roleTranslationContext, map[i].roleTranslation);
                 RoleInfo info;
                 info.role = map[i].role;
                 info.translation = i18nc(map[i].roleTranslationContext, map[i].roleTranslation);
-                info.group = i18nc(map[i].groupTranslationContext, map[i].groupTranslation);
+                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);
                 info.requiresNepomuk = map[i].requiresNepomuk;
                 info.requiresIndexer = map[i].requiresIndexer;
                 rolesInfo.append(info);