From: Peter Penz Date: Sat, 26 Jan 2008 22:32:24 +0000 (+0000) Subject: reset the selection manager when the URL has been changed (otherwise the selection... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/ab464bc6849dd000b2d0258ececb78ef1eb1a685 reset the selection manager when the URL has been changed (otherwise the selection toggle button would stay visible) svn path=/trunk/KDE/kdebase/apps/; revision=766918 --- diff --git a/src/dolphincolumnwidget.cpp b/src/dolphincolumnwidget.cpp index 8bf66b2c8..73cce011f 100644 --- a/src/dolphincolumnwidget.cpp +++ b/src/dolphincolumnwidget.cpp @@ -126,7 +126,9 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent, SelectionManager* selManager = new SelectionManager(this); connect(selManager, SIGNAL(selectionChanged()), this, SLOT(requestActivation())); - } + connect(m_view->m_controller, SIGNAL(urlChanged(const KUrl&)), + selManager, SLOT(reset())); +} new KMimeTypeResolver(this, m_dolphinModel); m_iconManager = new IconManager(this, m_proxyModel); m_iconManager->setShowPreview(m_view->m_controller->dolphinView()->showPreview()); diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index 09645a489..3be22fb42 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -100,6 +100,8 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr SelectionManager* selManager = new SelectionManager(this); connect(selManager, SIGNAL(selectionChanged()), this, SLOT(requestActivation())); + connect(m_controller, SIGNAL(urlChanged(const KUrl&)), + selManager, SLOT(reset())); } } else { connect(this, SIGNAL(doubleClicked(const QModelIndex&)), diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index 18d4accec..9e4a2604b 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -71,6 +71,8 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle SelectionManager* selManager = new SelectionManager(this); connect(selManager, SIGNAL(selectionChanged()), this, SLOT(requestActivation())); + connect(m_controller, SIGNAL(urlChanged(const KUrl&)), + selManager, SLOT(reset())); } } else { connect(this, SIGNAL(doubleClicked(const QModelIndex&)), diff --git a/src/selectionmanager.cpp b/src/selectionmanager.cpp index 1f9d99b85..31ad70b74 100644 --- a/src/selectionmanager.cpp +++ b/src/selectionmanager.cpp @@ -47,14 +47,18 @@ SelectionManager::SelectionManager(QAbstractItemView* parent) : m_button->hide(); connect(m_button, SIGNAL(clicked(bool)), this, SLOT(setItemSelected(bool))); - connect(m_view->selectionModel(), SIGNAL(selectionChanged()), - this, SLOT(slotSelectionChanged())); } SelectionManager::~SelectionManager() { } +void SelectionManager::reset() +{ + m_button->hide(); + m_item = KFileItem(); +} + void SelectionManager::slotEntered(const QModelIndex& index) { m_button->hide(); @@ -88,15 +92,6 @@ void SelectionManager::slotViewportEntered() m_item = KFileItem(); } -void SelectionManager::slotSelectionChanged() -{ - const QModelIndex index = indexForItem(m_item); - if (index.isValid()) { - QItemSelectionModel* selModel = m_view->selectionModel(); - m_button->setChecked(selModel->isSelected(index)); - } -} - void SelectionManager::setItemSelected(bool selected) { emit selectionChanged(); diff --git a/src/selectionmanager.h b/src/selectionmanager.h index 1bf4f8b8c..82e505eb6 100644 --- a/src/selectionmanager.h +++ b/src/selectionmanager.h @@ -43,6 +43,13 @@ public: SelectionManager(QAbstractItemView* parent); virtual ~SelectionManager(); +public slots: + /** + * Resets the selection manager so that the toggle button gets + * invisible. + */ + void reset(); + signals: /** Is emitted if the selection has been changed by the toggle button. */ void selectionChanged(); @@ -50,7 +57,6 @@ signals: private slots: void slotEntered(const QModelIndex& index); void slotViewportEntered(); - void slotSelectionChanged(); void setItemSelected(bool selected); private: