]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinview.cpp
get libkonq from kdebase
[dolphin.git] / src / dolphinview.cpp
index eddd220d38eff8d32174a89befac7bf3d9be53a9..a9f677244206b3bf2d75abe4cf1b02a0f53661a1 100644 (file)
@@ -747,50 +747,19 @@ void DolphinView::startDirLister(const KUrl& url, bool reload)
 
 QString DolphinView::defaultStatusBarText() const
 {
-    // TODO: the following code is not suitable for languages where multiple forms
-    // of plurals are given (e. g. in Poland three forms of plurals exist).
-    const int itemCount = m_folderCount + m_fileCount;
-
-    QString text;
-    if (itemCount == 1) {
-        text = i18n("1 Item");
-    }
-    else {
-        text = i18n("%1 Items",itemCount);
-    }
-
-    text += " (";
-
-    if (m_folderCount == 1) {
-        text += i18n("1 Folder");
-    }
-    else {
-        text += i18n("%1 Folders",m_folderCount);
-    }
-
-    text += ", ";
-
-    if (m_fileCount == 1) {
-        text += i18n("1 File");
-    }
-    else {
-        text += i18n("%1 Files",m_fileCount);
-    }
-
-    text += ")";
-
-    return text;
+    return KIO::itemsSummaryString(m_fileCount + m_folderCount,
+                                   m_fileCount,
+                                   m_folderCount,
+                                   0, false);
 }
 
 QString DolphinView::selectionStatusBarText() const
 {
-    // TODO: the following code is not suitable for languages where multiple forms
-    // of plurals are given (e. g. in Poland three forms of plurals exist).
     QString text;
     const KFileItemList list = selectedItems();
     if (list.isEmpty()) {
-        // TODO: assert(!list.isEmpty()) should be used, as this method is only invoked if
-        // DolphinView::hasSelection() is true. Inconsistent behavior?
+        // when an item is triggered, it is temporary selected but selectedItems()
+        // will return an empty list
         return QString();
     }
 
@@ -811,23 +780,16 @@ QString DolphinView::selectionStatusBarText() const
         ++it;
     }
 
-    if (folderCount == 1) {
-        text = i18n("1 Folder selected");
-    }
-    else if (folderCount > 1) {
-        text = i18n("%1 Folders selected",folderCount);
-    }
-
-    if ((fileCount > 0) && (folderCount > 0)) {
-        text += ", ";
+    if (folderCount > 0) {
+        text = i18np("1 Folder selected", "%1 Folders selected", folderCount);
+        if (fileCount > 0) {
+            text += ", ";
+        }
     }
 
-    const QString sizeText(KIO::convertSize(byteSize));
-    if (fileCount == 1) {
-        text += i18n("1 File selected (%1)",sizeText);
-    }
-    else if (fileCount > 1) {
-        text += i18n("%1 Files selected (%1)",fileCount,sizeText);
+    if (fileCount > 0) {
+        const QString sizeText(KIO::convertSize(byteSize));
+        text += i18np("1 File selected (%2)", "%1 Files selected (%2)", fileCount, sizeText);
     }
 
     return text;