diff options
| author | Peter Penz <[email protected]> | 2008-01-18 18:14:10 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-01-18 18:14:10 +0000 |
| commit | c93959934611c95f72e9de350c1dc5b6661f493f (patch) | |
| tree | 5d13511f537f29301ecaf1d2b690576fa2886bc8 /src | |
| parent | 87b827fe5678afc7137d18ac74c1bbe4f6626c68 (diff) | |
show the correct meta information in the information sidebar also for non-local files
BUG: 155534
svn path=/trunk/KDE/kdebase/apps/; revision=763141
Diffstat (limited to 'src')
| -rw-r--r-- | src/infosidebarpage.cpp | 23 | ||||
| -rw-r--r-- | src/infosidebarpage.h | 5 |
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; |
