From 0a133e9ef83a48eb305f6af4d2141ffc9bc987b6 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Wed, 15 Apr 2009 18:40:08 +0000 Subject: After restoring the current item when going back to a folder, the current-item URL must be cleared to prevent moving the focus when the directory content will be changed later. BUG: 189522 svn path=/trunk/KDE/kdebase/apps/; revision=954402 --- src/dolphinview.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/dolphinview.cpp') diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 57a2551ad..ed17c94ab 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -1156,15 +1156,18 @@ void DolphinView::slotRequestUrlChange(const KUrl& url) void DolphinView::restoreCurrentItem() { - const QModelIndex dirIndex = m_dolphinModel->indexForUrl(m_currentItemUrl); - if (dirIndex.isValid()) { - const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex); - QAbstractItemView* view = itemView(); - const bool clearSelection = !hasSelection(); - view->setCurrentIndex(proxyIndex); - if (clearSelection) { - view->clearSelection(); + if (!m_currentItemUrl.isEmpty()) { + const QModelIndex dirIndex = m_dolphinModel->indexForUrl(m_currentItemUrl); + if (dirIndex.isValid()) { + const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex); + QAbstractItemView* view = itemView(); + const bool clearSelection = !hasSelection(); + view->setCurrentIndex(proxyIndex); + if (clearSelection) { + view->clearSelection(); + } } + m_currentItemUrl.clear(); } } -- cgit v1.3