]> 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 7e5d961d69e93008f481c42fd5ef44a08f05b3df..6936af4311da9bd657d78aeab658de721307dcb1 100644 (file)
@@ -72,6 +72,7 @@ KFileItemModel::KFileItemModel(QObject* parent) :
     connect(m_dirLister, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
     connect(m_dirLister, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
     connect(m_dirLister, SIGNAL(redirection(KUrl,KUrl)), this, SIGNAL(directoryRedirection(KUrl,KUrl)));
+    connect(m_dirLister, SIGNAL(urlIsFileError(KUrl)), this, SIGNAL(urlIsFileError(KUrl)));
 
     // Apply default roles that should be determined
     resetRoles();
@@ -286,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));
         }
     }
 
@@ -559,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);
@@ -938,7 +946,7 @@ void KFileItemModel::insertItems(const KFileItemList& items)
             insertedCount = 0;
         }
 
-        // Insert item at the position targetIndex by transfering
+        // Insert item at the position targetIndex by transferring
         // the ownership of the item-data from sortedItems to m_itemData.
         // m_items will be inserted after the loop (see comment below)
         m_itemData.insert(targetIndex, sortedItems.at(sourceIndex));
@@ -1920,7 +1928,7 @@ void KFileItemModel::determineMimeTypes(const KFileItemList& items, int timeout)
 {
     QElapsedTimer timer;
     timer.start();
-    foreach (KFileItem item, items) {
+    foreach (KFileItem item, items) { // krazy:exclude=foreach
         item.determineMimeType();
         if (timer.elapsed() > timeout) {
             // Don't block the user interface, let the remaining items