┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-01-18 20:21:20 +0000
committerPeter Penz <[email protected]>2008-01-18 20:21:20 +0000
commite91a0ff774c1c2b16eafd93860f69ef9e1526165 (patch)
treed974320d39ed0175aa9e2edd904f79abb8d7a1c6 /src
parenta91bb8b0dba763c3537fbf9216df10662c2fc69e (diff)
Backport: show the correct meta information in the information sidebar also for non-local files
BUG: 155534 svn path=/branches/KDE/4.0/kdebase/apps/; revision=763175
Diffstat (limited to 'src')
-rw-r--r--src/infosidebarpage.cpp23
-rw-r--r--src/infosidebarpage.h5
2 files changed, 20 insertions, 8 deletions
diff --git a/src/infosidebarpage.cpp b/src/infosidebarpage.cpp
index 7b0d2d40c..bcb28aa19 100644
--- a/src/infosidebarpage.cpp
+++ b/src/infosidebarpage.cpp
@@ -48,7 +48,9 @@
InfoSidebarPage::InfoSidebarPage(QWidget* parent) :
SidebarPage(parent),
m_pendingPreview(false),
- m_timer(0),
+ m_shownUrl(),
+ m_urlCandidate(),
+ m_fileItem(),
m_preview(0),
m_nameLabel(0),
m_infoLabel(0),
@@ -136,10 +138,13 @@ void InfoSidebarPage::requestDelayedItemInfo(const KFileItem& item)
{
cancelRequest();
+ m_fileItem = KFileItem();
+
if (!item.isNull() && (selection().size() <= 1)) {
const KUrl url = item.url();
if (!url.isEmpty()) {
m_urlCandidate = url;
+ m_fileItem = item;
m_timer->start(TimerDelay);
}
}
@@ -283,16 +288,21 @@ void InfoSidebarPage::showMetaInfo()
const KFileItemList& selectedItems = selection();
if (selectedItems.size() <= 1) {
- KFileItem fileItem(S_IFDIR, KFileItem::Unknown, m_shownUrl);
- fileItem.refresh();
+ KFileItem fileItem;
+ if (m_fileItem.isNull()) {
+ // no pending request is ongoing
+ fileItem = KFileItem(KFileItem::Unknown, KFileItem::Unknown, m_shownUrl);
+ fileItem.refresh();
+ } else {
+ fileItem = m_fileItem;
+ }
if (fileItem.isDir()) {
addInfoLine(text, i18nc("@label", "Type:"), i18nc("@label", "Folder"));
} else {
addInfoLine(text, i18nc("@label", "Type:"), fileItem.mimeComment());
- QString sizeText(KIO::convertSize(fileItem.size()));
- addInfoLine(text, i18nc("@label", "Size:"), sizeText);
+ addInfoLine(text, i18nc("@label", "Size:"), KIO::convertSize(fileItem.size()));
addInfoLine(text, i18nc("@label", "Modified:"), fileItem.timeString());
// TODO: See convertMetaInfo below, find a way to display only interesting information
@@ -335,8 +345,9 @@ void InfoSidebarPage::showMetaInfo()
foreach (const KFileItem& item, selectedItems) {
// Only count the size of files, not dirs; to match what
// DolphinViewContainer::selectionStatusBarText does.
- if (!item.isDir() && !item.isLink())
+ if (!item.isDir() && !item.isLink()) {
totalSize += item.size();
+ }
}
addInfoLine(text, i18nc("@label", "Total size:"), KIO::convertSize(totalSize));
}
diff --git a/src/infosidebarpage.h b/src/infosidebarpage.h
index ef014b316..6012e883c 100644
--- a/src/infosidebarpage.h
+++ b/src/infosidebarpage.h
@@ -139,8 +139,9 @@ private:
private:
bool m_pendingPreview;
QTimer* m_timer;
- KUrl m_shownUrl;
- KUrl m_urlCandidate;
+ KUrl m_shownUrl; // URL that is shown as info
+ KUrl m_urlCandidate; // URL candidate that will replace m_shownURL after a delay
+ KFileItem m_fileItem; // file item for m_shownUrl if available (otherwise null)
PixmapViewer* m_preview;
QLabel* m_nameLabel;