return QPoint(x, y);
}
+void DolphinView::setCurrentItem(const KUrl& url)
+{
+ const QModelIndex dirIndex = m_dolphinModel->indexForUrl(url);
+ if (dirIndex.isValid()) {
+ const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
+ QAbstractItemView* view = itemView();
+ const bool clearSelection = !hasSelection();
+ view->setCurrentIndex(proxyIndex);
+ if (clearSelection) {
+ view->clearSelection();
+ }
+ }
+}
+
void DolphinView::zoomIn()
{
m_controller->triggerZoomIn();
/** Returns the upper left position of the view content. */
QPoint contentsPosition() const;
+ /**
+ * Sets the current item (= item that has the keyboard focus) to
+ * the item with the URL \a url.
+ */
+ void setCurrentItem(const KUrl& url);
+
/** Increases the size of the current set view mode. */
void zoomIn();
m_filterBar(0),
m_statusBar(0),
m_dirLister(0),
- m_proxyModel(0)
+ m_proxyModel(0),
+ m_previousUrl(),
+ m_currentUrl()
{
hide();
m_dirLister = 0; // deleted by m_dolphinModel
}
-void DolphinViewContainer::setUrl(const KUrl& url)
+void DolphinViewContainer::setUrl(const KUrl& newUrl)
{
- m_urlNavigator->setUrl(url);
+ if (newUrl != m_currentUrl) {
+ m_previousUrl = m_currentUrl;
+ m_currentUrl = newUrl;
+ m_urlNavigator->setUrl(newUrl);
+ }
}
const KUrl& DolphinViewContainer::url() const
{
- return m_urlNavigator->url();
+ return m_currentUrl;
}
void DolphinViewContainer::setActive(bool active)
}
updateStatusBar();
-
+ m_view->setCurrentItem(m_previousUrl);
QTimer::singleShot(100, this, SLOT(restoreContentsPos()));
}
DolphinModel* m_dolphinModel;
DolphinDirLister* m_dirLister;
DolphinSortFilterProxyModel* m_proxyModel;
+
+ KUrl m_previousUrl;
+ KUrl m_currentUrl;
};
inline const DolphinStatusBar* DolphinViewContainer::statusBar() const