From: Peter Penz Date: Wed, 15 Apr 2009 18:40:08 +0000 (+0000) Subject: After restoring the current item when going back to a folder, the current-item URL... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/0a133e9ef83a48eb305f6af4d2141ffc9bc987b6?ds=inline 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 --- 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(); } }