From faf1f0f2d6fcb070a0a0927e3dbb6a9512c9e5c6 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Mon, 28 Jan 2008 19:29:17 +0000 Subject: take care to remove the selection toggle when items have been deleted svn path=/trunk/KDE/kdebase/apps/; revision=767778 --- src/selectionmanager.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/selectionmanager.cpp') diff --git a/src/selectionmanager.cpp b/src/selectionmanager.cpp index 31ad70b74..bdb4c5368 100644 --- a/src/selectionmanager.cpp +++ b/src/selectionmanager.cpp @@ -65,6 +65,9 @@ void SelectionManager::slotEntered(const QModelIndex& index) if (index.isValid() && (index.column() == DolphinModel::Name)) { m_item = itemForIndex(index); + connect(m_view->model(), SIGNAL(rowsRemoved(const QModelIndex&, int, int)), + this, SLOT(slotRowsRemoved(const QModelIndex&, int, int))); + const QRect rect = m_view->visualRect(index); const int gap = 2; const int x = rect.right() - m_button->width() - gap; @@ -83,13 +86,14 @@ void SelectionManager::slotEntered(const QModelIndex& index) m_button->show(); } else { m_item = KFileItem(); + disconnect(m_view->model(), SIGNAL(rowsRemoved(const QModelIndex&, int, int)), + this, SLOT(slotRowsRemoved(const QModelIndex&, int, int))); } } void SelectionManager::slotViewportEntered() { m_button->hide(); - m_item = KFileItem(); } void SelectionManager::setItemSelected(bool selected) @@ -108,6 +112,14 @@ void SelectionManager::setItemSelected(bool selected) } } +void SelectionManager::slotRowsRemoved(const QModelIndex& parent, int start, int end) +{ + Q_UNUSED(parent); + Q_UNUSED(start); + Q_UNUSED(end); + m_button->hide(); +} + KFileItem SelectionManager::itemForIndex(const QModelIndex& index) const { QAbstractProxyModel* proxyModel = static_cast(m_view->model()); -- cgit v1.3