diff options
| author | Peter Penz <[email protected]> | 2008-10-08 19:10:00 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-10-08 19:10:00 +0000 |
| commit | 7de3ccbf54ee3a2f7c751a2ba5352d3122d5126e (patch) | |
| tree | d8099f0a5e4f3529ede43a82836d31ced9eb96fe /src | |
| parent | 73a8d074c14fe7d1df19e71ddb3e4f5c0afe0809 (diff) | |
Don't request any meta data, if the requested URL is equal to the currently shown URL. This is especially important when opening a directory, where the meta info has been requested twice (the first time on hovering a directory, the second time when opening - now when opening the directory no meta data is requested at all). Further performance improvements will follow...
svn path=/trunk/KDE/kdebase/apps/; revision=869328
Diffstat (limited to 'src')
| -rw-r--r-- | src/infosidebarpage.cpp | 24 | ||||
| -rw-r--r-- | src/infosidebarpage.h | 5 |
2 files changed, 22 insertions, 7 deletions
diff --git a/src/infosidebarpage.cpp b/src/infosidebarpage.cpp index 8e6bda8e8..9fc2286f1 100644 --- a/src/infosidebarpage.cpp +++ b/src/infosidebarpage.cpp @@ -79,7 +79,7 @@ QSize InfoSidebarPage::sizeHint() const void InfoSidebarPage::setUrl(const KUrl& url) { SidebarPage::setUrl(url); - if (url.isValid() && !m_shownUrl.equals(url, KUrl::CompareWithoutTrailingSlash)) { + if (url.isValid() && !isEqualToShownUrl(url)) { if (m_initialized) { cancelRequest(); m_shownUrl = url; @@ -108,8 +108,10 @@ void InfoSidebarPage::setSelection(const KFileItemList& selection) const int count = selection.count(); if (count == 0) { - m_shownUrl = url(); - showItemInfo(); + if (!isEqualToShownUrl(url())) { + m_shownUrl = url(); + showItemInfo(); + } } else { if ((count == 1) && !selection.first().url().isEmpty()) { m_urlCandidate = selection.first().url(); @@ -134,10 +136,13 @@ void InfoSidebarPage::requestDelayedItemInfo(const KFileItem& item) m_pendingPreview = false; m_infoTimer->start(); } - } else if (!item.url().isEmpty()) { - m_urlCandidate = item.url(); - m_fileItem = item; - m_infoTimer->start(); + } else { + const KUrl url = item.url(); + if (url.isValid() && !isEqualToShownUrl(url)) { + m_urlCandidate = item.url(); + m_fileItem = item; + m_infoTimer->start(); + } } } @@ -470,6 +475,11 @@ bool InfoSidebarPage::showMultipleSelectionInfo() const return m_fileItem.isNull() && (m_selection.count() > 1); } +bool InfoSidebarPage::isEqualToShownUrl(const KUrl& url) const +{ + return m_shownUrl.equals(url, KUrl::CompareWithoutTrailingSlash); +} + void InfoSidebarPage::init() { const int spacing = KDialog::spacingHint(); diff --git a/src/infosidebarpage.h b/src/infosidebarpage.h index 97d63afa9..ff7e1d0d7 100644 --- a/src/infosidebarpage.h +++ b/src/infosidebarpage.h @@ -159,6 +159,11 @@ private: * InfosidebarPage::fileUrl(); */ bool showMultipleSelectionInfo() const; + + /** + * Returns true, if \a url is equal to the shown URL m_shownUrl. + */ + bool isEqualToShownUrl(const KUrl& url) const; void init(); |
