From: Peter Penz Date: Thu, 13 Nov 2008 21:01:24 +0000 (+0000) Subject: When only one item is selected, show the item name in the statusbar instead of "1... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/f5dafdc48add734a3d3399d987556de2164d0a96?ds=inline When only one item is selected, show the item name in the statusbar instead of "1 Folder selected" or "1 File selected". This is useful in combination with the keyboard navigation. BUG: 172564 svn path=/trunk/KDE/kdebase/apps/; revision=883928 --- diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index aec798d31..31b9de785 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -534,16 +534,25 @@ QString DolphinView::statusBarText() const ++it; } - const QString foldersText = i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount); - const QString filesText = i18ncp("@info:status", "1 File selected", "%1 Files selected", fileCount); - if ((folderCount > 0) && (fileCount > 0)) { - text = i18nc("@info:status folders, files (size)", "%1, %2 (%3)", - foldersText, filesText, KIO::convertSize(totalFileSize)); - } else if (fileCount > 0) { - text = i18nc("@info:status files (size)", "%1 (%2)", filesText, KIO::convertSize(totalFileSize)); + if (folderCount + fileCount == 1) { + // if only one item is selected, show the filename + const QString name = list.first().name(); + text = (folderCount == 1) ? i18nc("@info:status", "%1 selected", name) : + i18nc("@info:status", "%1 selected (%2)", + name, KIO::convertSize(totalFileSize)); } else { - Q_ASSERT(folderCount > 0); - text = foldersText; + // at least 2 items are selected + const QString foldersText = i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount); + const QString filesText = i18ncp("@info:status", "1 File selected", "%1 Files selected", fileCount); + if ((folderCount > 0) && (fileCount > 0)) { + text = i18nc("@info:status folders, files (size)", "%1, %2 (%3)", + foldersText, filesText, KIO::convertSize(totalFileSize)); + } else if (fileCount > 0) { + text = i18nc("@info:status files (size)", "%1 (%2)", filesText, KIO::convertSize(totalFileSize)); + } else { + Q_ASSERT(folderCount > 0); + text = foldersText; + } } } else { calculateItemCount(fileCount, folderCount, totalFileSize);