]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Only the infosidebar panel is interested in selections -> move it from the sidebar...
authorPeter Penz <peter.penz19@gmail.com>
Wed, 14 May 2008 15:15:31 +0000 (15:15 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Wed, 14 May 2008 15:15:31 +0000 (15:15 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=807729

src/infosidebarpage.cpp
src/infosidebarpage.h
src/sidebarpage.cpp
src/sidebarpage.h

index a6d8a0916c76a6be7c2b76d3ca8ba0f7bc1fc623..a9cc356d41c0b4fea31dc2e5101c84701ec179a3 100644 (file)
@@ -53,6 +53,7 @@ InfoSidebarPage::InfoSidebarPage(QWidget* parent) :
     m_shownUrl(),
     m_urlCandidate(),
     m_fileItem(),
     m_shownUrl(),
     m_urlCandidate(),
     m_fileItem(),
+    m_selection(),
     m_nameLabel(0),
     m_preview(0),
     m_metaDataWidget(0),
     m_nameLabel(0),
     m_preview(0),
     m_metaDataWidget(0),
@@ -128,7 +129,7 @@ void InfoSidebarPage::setUrl(const KUrl& url)
 
 void InfoSidebarPage::setSelection(const KFileItemList& selection)
 {
 
 void InfoSidebarPage::setSelection(const KFileItemList& selection)
 {
-    SidebarPage::setSelection(selection);
+    m_selection = selection;
 
     const int count = selection.count();
     if (count == 0) {
 
     const int count = selection.count();
     if (count == 0) {
@@ -150,7 +151,7 @@ void InfoSidebarPage::requestDelayedItemInfo(const KFileItem& item)
     if (item.isNull()) {
         // The cursor is above the viewport. If files are selected,
         // show information regarding the selection.
     if (item.isNull()) {
         // The cursor is above the viewport. If files are selected,
         // show information regarding the selection.
-        if (selection().size() > 0) {
+        if (m_selection.size() > 0) {
             m_timer->start(TimerDelay);
         }
     } else if (!item.url().isEmpty()) {
             m_timer->start(TimerDelay);
         }
     } else if (!item.url().isEmpty()) {
@@ -194,13 +195,12 @@ void InfoSidebarPage::showItemInfo()
 
     cancelRequest();
 
 
     cancelRequest();
 
-    const KFileItemList& selectedItems = selection();
-    const KUrl file = (!m_fileItem.isNull() || selectedItems.isEmpty()) ? m_shownUrl : selectedItems[0].url();
+    const KUrl file = (!m_fileItem.isNull() || m_selection.isEmpty()) ? m_shownUrl : m_selection[0].url();
     if (!file.isValid()) {
         return;
     }
 
     if (!file.isValid()) {
         return;
     }
 
-    const int selectionCount = selectedItems.count();
+    const int selectionCount = m_selection.count();
     if (m_fileItem.isNull() && (selectionCount > 1)) {
         KIconLoader iconLoader;
         QPixmap icon = iconLoader.loadIcon("dialog-information",
     if (m_fileItem.isNull() && (selectionCount > 1)) {
         KIconLoader iconLoader;
         QPixmap icon = iconLoader.loadIcon("dialog-information",
@@ -290,12 +290,11 @@ void InfoSidebarPage::showMetaInfo()
 {
     m_metaTextLabel->clear();
 
 {
     m_metaTextLabel->clear();
 
-    const KFileItemList& selectedItems = selection();
-    if ((selectedItems.size() <= 1) || !m_fileItem.isNull()) {
+    if ((m_selection.size() <= 1) || !m_fileItem.isNull()) {
         KFileItem fileItem;
         if (m_fileItem.isNull()) {
             // no pending request is ongoing
         KFileItem fileItem;
         if (m_fileItem.isNull()) {
             // no pending request is ongoing
-            const KUrl url = (selectedItems.size() == 1) ? selectedItems.first().url() : m_shownUrl;
+            const KUrl url = (m_selection.size() == 1) ? m_selection.first().url() : m_shownUrl;
             fileItem = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url);
             fileItem.refresh();
         } else {
             fileItem = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url);
             fileItem.refresh();
         } else {
@@ -341,14 +340,14 @@ void InfoSidebarPage::showMetaInfo()
     } else {
         if (m_metaDataWidget != 0) {
             KUrl::List urls;
     } else {
         if (m_metaDataWidget != 0) {
             KUrl::List urls;
-            foreach (const KFileItem& item, selectedItems) {
+            foreach (const KFileItem& item, m_selection) {
                 urls.append(item.targetUrl());
             }
             m_metaDataWidget->setFiles(urls);
         }
 
         unsigned long int totalSize = 0;
                 urls.append(item.targetUrl());
             }
             m_metaDataWidget->setFiles(urls);
         }
 
         unsigned long int totalSize = 0;
-        foreach (const KFileItem& item, selectedItems) {
+        foreach (const KFileItem& item, m_selection) {
             // Only count the size of files, not dirs to match what
             // DolphinViewContainer::selectionStatusBarText() does.
             if (!item.isDir() && !item.isLink()) {
             // Only count the size of files, not dirs to match what
             // DolphinViewContainer::selectionStatusBarText() does.
             if (!item.isDir() && !item.isLink()) {
index 6cdc1e824859a4867a29ba0aac5e05928d2a2879..fa9fa9d411f162ddb3e701a2455d6fae557a317c 100644 (file)
@@ -59,8 +59,11 @@ public slots:
     /** @see SidebarPage::setUrl() */
     virtual void setUrl(const KUrl& url);
 
     /** @see SidebarPage::setUrl() */
     virtual void setUrl(const KUrl& url);
 
-    /** @see SidebarPage::setSelection() */
-    virtual void setSelection(const KFileItemList& selection);
+    /**
+     * This is invoked to inform the sidebar that the user has selected a new
+     * set of items.
+     */
+    void setSelection(const KFileItemList& selection);
 
     /**
      * Does a delayed request of information for the item \a item.
 
     /**
      * Does a delayed request of information for the item \a item.
@@ -135,6 +138,7 @@ private:
     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)
     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)
+    KFileItemList m_selection;
 
     QLabel* m_nameLabel;
     PixmapViewer* m_preview;
 
     QLabel* m_nameLabel;
     PixmapViewer* m_preview;
index 889dc48c450389c9885296955d766abd787c8374..594f59f24bcad6df0d01b407d0a43aef4b8a330e 100644 (file)
@@ -25,8 +25,7 @@
 
 SidebarPage::SidebarPage(QWidget* parent) :
     QWidget(parent),
 
 SidebarPage::SidebarPage(QWidget* parent) :
     QWidget(parent),
-    m_url(KUrl()),
-    m_currentSelection()
+    m_url(KUrl())
 {
 }
 
 {
 }
 
@@ -39,19 +38,9 @@ const KUrl& SidebarPage::url() const
     return m_url;
 }
 
     return m_url;
 }
 
-const KFileItemList& SidebarPage::selection() const
-{
-    return m_currentSelection;
-}
-
 void SidebarPage::setUrl(const KUrl& url)
 {
     m_url = url;
 }
 
 void SidebarPage::setUrl(const KUrl& url)
 {
     m_url = url;
 }
 
-void SidebarPage::setSelection(const KFileItemList& selection)
-{
-    m_currentSelection = selection;
-}
-
 #include "sidebarpage.moc"
 #include "sidebarpage.moc"
index 1c6b26be303852db10036ca13b2de7014faa126e..20a44758ebf63d26081f211cb3f31682df33c3ec 100644 (file)
@@ -31,6 +31,7 @@
 class SidebarPage : public QWidget
 {
     Q_OBJECT
 class SidebarPage : public QWidget
 {
     Q_OBJECT
+
 public:
     explicit SidebarPage(QWidget* parent = 0);
     virtual ~SidebarPage();
 public:
     explicit SidebarPage(QWidget* parent = 0);
     virtual ~SidebarPage();
@@ -38,9 +39,6 @@ public:
     /** Returns the current set URL of the active Dolphin view. */
     const KUrl& url() const;
 
     /** Returns the current set URL of the active Dolphin view. */
     const KUrl& url() const;
 
-    /** Returns the current selected items of the active Dolphin view. */
-    const KFileItemList& selection() const;
-
 public slots:
     /**
      * This is invoked every time the folder being displayed in the
 public slots:
     /**
      * This is invoked every time the folder being displayed in the
@@ -48,15 +46,8 @@ public slots:
      */
     virtual void setUrl(const KUrl& url);
 
      */
     virtual void setUrl(const KUrl& url);
 
-    /**
-     * This is invoked to inform the sidebar that the user has selected a new
-     * set of items.
-     */
-    virtual void setSelection(const KFileItemList& selection);
-
 private:
     KUrl m_url;
 private:
     KUrl m_url;
-    KFileItemList m_currentSelection;
 };
 
 #endif // _SIDEBARPAGE_H_
 };
 
 #endif // _SIDEBARPAGE_H_