]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Move the selection listener from DolphinView to ViewExtensionsFactory. The statusbar...
authorPeter Penz <peter.penz19@gmail.com>
Sun, 30 Aug 2009 19:17:08 +0000 (19:17 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sun, 30 Aug 2009 19:17:08 +0000 (19:17 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=1017497

src/dolphincontroller.cpp
src/dolphincontroller.h
src/dolphinview.cpp
src/viewextensionsfactory.cpp

index a7c91def54713e0aa74e979c0202248ecaaf7634..bf26df62670128c7375ae654fe874d1d5a00494c 100644 (file)
@@ -250,6 +250,11 @@ void DolphinController::emitViewportEntered()
     emit viewportEntered();
 }
 
+void DolphinController::emitSelectionChanged()
+{
+    emit selectionChanged();
+}
+
 void DolphinController::updateMouseButtonState()
 {
     m_mouseButtons = QApplication::mouseButtons();
index 355cff8cfc12bbbe7930c2a83e3cf3bdadffcbe7..bd2189e21730565cf6fd7679667c1cec66680cb5 100644 (file)
@@ -62,6 +62,7 @@ class QPoint;
  * - handleKeyPressEvent()
  * - emitItemEntered()
  * - emitViewportEntered()
+ * - emitSelectionChanged()
  * - replaceUrlByClipboard()
  * - hideToolTip()
  * - setVersionControlActions()
@@ -269,23 +270,29 @@ public slots:
     /**
      * Emits the signal tabRequested(), if the file item for the index \a index
      * represents a directory and when the middle mouse button has been pressed.
-     * The method should be invoked by the controller parent.
+     * The method should be invoked by the view implementation.
      */
     void requestTab(const QModelIndex& index);
 
     /**
      * Emits the signal itemEntered() if the file item for the index \a index
-     * is not null. The method should be invoked by the controller parent
+     * is not null. The method should be invoked by the view implementation
      * whenever the mouse cursor is above an item.
      */
     void emitItemEntered(const QModelIndex& index);
 
     /**
      * Emits the signal viewportEntered(). The method should be invoked by
-     * the controller parent whenever the mouse cursor is above the viewport.
+     * the view implementation whenever the mouse cursor is above the viewport.
      */
     void emitViewportEntered();
 
+    /**
+     * Emits the signal selectionChanged(). The method should be invoked by
+     * the view implementation whenever the selection has been changed.
+     */
+    void emitSelectionChanged();
+
 signals:
     /**
      * Is emitted if the URL for the Dolphin controller has been changed
@@ -389,11 +396,18 @@ signals:
 
     /**
      * Is emitted if the mouse cursor has entered
-     * the viewport (see emitViewportEntered().
+     * the viewport (see emitViewportEntered()).
      * The abstract Dolphin view connects to this signal.
      */
     void viewportEntered();
 
+    /**
+     * Is emitted whenever the selection of the view implementation
+     * has been changed (see emitSelectionChanged()). The abstract
+     * Dolphin view connects to this signal.
+     */
+    void selectionChanged();
+
     /**
      * Is emitted if the view should respect the name filter \a nameFilter. The view
      * implementation must connect to this signal if it supports name filters.
index 2c3c6c38d88554fe615e73dbeaa81fdaff5e63d2..7e8b4e74fd2573cd10c5c0049257dc4c421f6358 100644 (file)
@@ -1336,7 +1336,7 @@ void DolphinView::createView()
     }
     m_selectionModel->setParent(this);
 
-    connect(view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
+    connect(m_controller, SIGNAL(selectionChanged()),
             this, SLOT(emitDelayedSelectionChangedSignal()));
     connect(view->verticalScrollBar(), SIGNAL(valueChanged(int)),
             this, SLOT(emitContentsMoved()));
index 0974e21261389ad87e9d7514c8d9ad9cc299f9e9..b8606d65bfff1aeb2ab7fea2499d708c431d008d 100644 (file)
@@ -110,6 +110,10 @@ ViewExtensionsFactory::ViewExtensionsFactory(QAbstractItemView* view,
     connect(dolphinView, SIGNAL(sortFoldersFirstChanged(bool)),
             this, SLOT(slotSortFoldersFirstChanged(bool)));
 
+    // inform the controller about selection changes
+    connect(view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
+            controller, SLOT(emitSelectionChanged()));
+
     connect(controller, SIGNAL(nameFilterChanged(const QString&)),
             this, SLOT(slotNameFilterChanged(const QString&)));