]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Don't request any meta data, if the requested URL is equal to the currently shown...
authorPeter Penz <peter.penz19@gmail.com>
Wed, 8 Oct 2008 19:10:00 +0000 (19:10 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Wed, 8 Oct 2008 19:10:00 +0000 (19:10 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=869328

src/infosidebarpage.cpp
src/infosidebarpage.h

index 8e6bda8e884a7dc68a5b9340de115c9df77c67ab..9fc2286f1f172cd4e67e76ccebb53e9435c966b1 100644 (file)
@@ -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();
index 97d63afa9b24aa4012c376e4b20888c8d15389cc..ff7e1d0d79ab176448462eee4d8bd3112918ac0c 100644 (file)
@@ -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();