* assure that the history does not get messed up when changing the focus to an existing column
* fix issue that the status bar does not get updated when the focus is changed between the columns
svn path=/trunk/KDE/kdebase/apps/; revision=723519
case MoveLeft:
if (m_index > 0) {
setActiveColumnIndex(m_index - 1);
+ m_controller->triggerUrlChangeRequest(activeColumn()->url());
}
break;
case MoveRight:
if (m_index < m_columns.count() - 1) {
setActiveColumnIndex(m_index + 1);
+ m_controller->triggerUrlChangeRequest(m_columns[m_index]->url());
}
break;
m_index = index;
m_columns[m_index]->setActive(true);
- m_controller->setUrl(m_columns[m_index]->url());
-
assureVisibleActiveColumn();
}
m_view->m_controller->requestActivation();
if (!m_active) {
m_view->requestActivation(this);
+ m_view->m_controller->triggerUrlChangeRequest(m_url);
}
QListView::mousePressEvent(event);
{
if (!m_active) {
m_view->requestActivation(this);
+ m_view->m_controller->triggerUrlChangeRequest(m_url);
}
QListView::contextMenuEvent(event);
}
}
+void DolphinController::triggerUrlChangeRequest(const KUrl& url)
+{
+ if (m_url != url) {
+ emit requestUrlChange(url);
+ }
+}
+
void DolphinController::triggerContextMenuRequest(const QPoint& pos)
{
emit activated();
* The communication of the view implementations to the abstract view is done by:
* - triggerContextMenuRequest()
* - requestActivation()
+ * - triggerUrlChangeRequest()
* - indicateDroppedUrls()
* - indicateSortingChange()
* - indicateSortOrderChanged()
* - emitViewportEntered()
*
* The communication of the abstract view to the view implementations is done by:
+ * - setUrl()
* - setShowHiddenFiles()
* - setShowPreview()
* - setAdditionalInfoCount()
explicit DolphinController(QObject* parent);
virtual ~DolphinController();
- /** Sets the URL to \a url and emits the signal urlChanged(). */
+ /**
+ * Sets the URL to \a url and emits the signal urlChanged() if
+ * \a url is different for the current URL. This method should
+ * be invoked by the abstract Dolphin view whenever the current
+ * URL has been changed.
+ */
void setUrl(const KUrl& url);
const KUrl& url() const;
+ /**
+ * Allows a view implementation to request an URL change to \a url.
+ * The signal requestUrlChange() is emitted and the abstract Dolphin view
+ * will assure that the URL of the Dolphin Controller will be updated
+ * later. Invoking this method makes only sense if the view implementation
+ * shows a hierarchy of URLs and allows to change the URL within
+ * the view (e. g. this is the case in the column view).
+ */
+ void triggerUrlChangeRequest(const KUrl& url);
+
/**
* Requests a context menu for the position \a pos. This method
* should be invoked by the view implementation when a context
*/
void urlChanged(const KUrl& url);
+ /**
+ * Is emitted if the view implementation requests a changing of the current
+ * URL to \a url (see triggerUrlChangeRequest()).
+ */
+ void requestUrlChange(const KUrl& url);
+
/**
* Is emitted if a context menu should be opened (see triggerContextMenuRequest()).
* The abstract Dolphin view connects to this signal and will open the context menu.
m_controller = new DolphinController(this);
m_controller->setUrl(url);
+
+ // Receiver of the DolphinView signal 'urlChanged()' don't need
+ // to care whether the internal controller changed the URL already or whether
+ // the controller just requested an URL change and will be updated later.
+ // In both cases the URL has been changed:
connect(m_controller, SIGNAL(urlChanged(const KUrl&)),
this, SIGNAL(urlChanged(const KUrl&)));
+ connect(m_controller, SIGNAL(requestUrlChange(const KUrl&)),
+ this, SIGNAL(urlChanged(const KUrl&)));
+
connect(m_controller, SIGNAL(requestContextMenu(const QPoint&)),
this, SLOT(openContextMenu(const QPoint&)));
connect(m_controller, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&, const QModelIndex&, QWidget*)),
return;
}
- const bool restoreColumnView = !rootUrl.isEmpty()
- && !rootUrl.equals(url, KUrl::CompareWithoutTrailingSlash)
- && rootUrl.isParentOf(url);
-
m_controller->setUrl(url); // emits urlChanged, which we forward
- if (restoreColumnView) {
+ if (!rootUrl.isEmpty() && rootUrl.isParentOf(url)) {
applyViewProperties(rootUrl);
loadDirectory(rootUrl);
- // Restoring the column view relies on the URL-history. It might be possible
- // that the view properties have been changed or deleted in the meantime, so
- // it cannot be asserted that really a column view has been created:
if (itemView() == m_columnView) {
m_columnView->setRootUrl(rootUrl);
m_columnView->showColumn(url);