]> cloud.milkyroute.net Git - dolphin.git/commitdiff
reset the selection manager when the URL has been changed (otherwise the selection...
authorPeter Penz <peter.penz19@gmail.com>
Sat, 26 Jan 2008 22:32:24 +0000 (22:32 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 26 Jan 2008 22:32:24 +0000 (22:32 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=766918

src/dolphincolumnwidget.cpp
src/dolphindetailsview.cpp
src/dolphiniconsview.cpp
src/selectionmanager.cpp
src/selectionmanager.h

index 8bf66b2c8874e0eb17acccfbb448b70f19cac9de..73cce011fb6725b6f090c0f624d99bee4b6bca49 100644 (file)
@@ -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());
index 09645a489ff723bd29625e5ec999fc773fb28a97..3be22fb4262db912a59e6301f629e99ab5612ef1 100644 (file)
@@ -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&)),
index 18d4accec5291f74bb85c1c26523d07f82bf8cfa..9e4a2604b5cb51ea31f9a2cb4d40a10df3ab68cd 100644 (file)
@@ -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&)),
index 1f9d99b85db7a9e5eab1ba48713e3dc1665a381c..31ad70b742906d0ae6843279acb92a695f4ba584 100644 (file)
@@ -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();
index 1bf4f8b8c2a05a110d5dac4c6ad2b6d3dd0b66f9..82e505eb6d5684f6b71e31b023c4aaf9b9fb5559 100644 (file)
@@ -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: