From: Peter Penz Date: Sun, 30 Aug 2009 19:17:08 +0000 (+0000) Subject: Move the selection listener from DolphinView to ViewExtensionsFactory. The statusbar... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/a2a99926359cb58519b7814bba662f2afa4eee5d Move the selection listener from DolphinView to ViewExtensionsFactory. The statusbar and information panel are now informed correctly about selection changes also when using the column view. svn path=/trunk/KDE/kdebase/apps/; revision=1017497 --- diff --git a/src/dolphincontroller.cpp b/src/dolphincontroller.cpp index a7c91def5..bf26df626 100644 --- a/src/dolphincontroller.cpp +++ b/src/dolphincontroller.cpp @@ -250,6 +250,11 @@ void DolphinController::emitViewportEntered() emit viewportEntered(); } +void DolphinController::emitSelectionChanged() +{ + emit selectionChanged(); +} + void DolphinController::updateMouseButtonState() { m_mouseButtons = QApplication::mouseButtons(); diff --git a/src/dolphincontroller.h b/src/dolphincontroller.h index 355cff8cf..bd2189e21 100644 --- a/src/dolphincontroller.h +++ b/src/dolphincontroller.h @@ -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. diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 2c3c6c38d..7e8b4e74f 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -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())); diff --git a/src/viewextensionsfactory.cpp b/src/viewextensionsfactory.cpp index 0974e2126..b8606d65b 100644 --- a/src/viewextensionsfactory.cpp +++ b/src/viewextensionsfactory.cpp @@ -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&)));