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());
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&)),
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&)),
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();
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();
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();
private slots:
void slotEntered(const QModelIndex& index);
void slotViewportEntered();
- void slotSelectionChanged();
void setItemSelected(bool selected);
private: