mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
column view fixes:
* 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
This commit is contained in:
parent
0c1d1c42f4
commit
1d4cfd16fd
5 changed files with 44 additions and 11 deletions
|
@ -263,12 +263,14 @@ QModelIndex DolphinColumnView::moveCursor(CursorAction cursorAction, Qt::Keyboar
|
|||
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;
|
||||
|
||||
|
@ -426,8 +428,6 @@ void DolphinColumnView::setActiveColumnIndex(int index)
|
|||
m_index = index;
|
||||
m_columns[m_index]->setActive(true);
|
||||
|
||||
m_controller->setUrl(m_columns[m_index]->url());
|
||||
|
||||
assureVisibleActiveColumn();
|
||||
}
|
||||
|
||||
|
|
|
@ -268,6 +268,7 @@ void DolphinColumnWidget::mousePressEvent(QMouseEvent* event)
|
|||
m_view->m_controller->requestActivation();
|
||||
if (!m_active) {
|
||||
m_view->requestActivation(this);
|
||||
m_view->m_controller->triggerUrlChangeRequest(m_url);
|
||||
}
|
||||
|
||||
QListView::mousePressEvent(event);
|
||||
|
@ -291,6 +292,7 @@ void DolphinColumnWidget::contextMenuEvent(QContextMenuEvent* event)
|
|||
{
|
||||
if (!m_active) {
|
||||
m_view->requestActivation(this);
|
||||
m_view->m_controller->triggerUrlChangeRequest(m_url);
|
||||
}
|
||||
|
||||
QListView::contextMenuEvent(event);
|
||||
|
|
|
@ -44,6 +44,13 @@ void DolphinController::setUrl(const KUrl& url)
|
|||
}
|
||||
}
|
||||
|
||||
void DolphinController::triggerUrlChangeRequest(const KUrl& url)
|
||||
{
|
||||
if (m_url != url) {
|
||||
emit requestUrlChange(url);
|
||||
}
|
||||
}
|
||||
|
||||
void DolphinController::triggerContextMenuRequest(const QPoint& pos)
|
||||
{
|
||||
emit activated();
|
||||
|
|
|
@ -49,6 +49,7 @@ class QWidget;
|
|||
* The communication of the view implementations to the abstract view is done by:
|
||||
* - triggerContextMenuRequest()
|
||||
* - requestActivation()
|
||||
* - triggerUrlChangeRequest()
|
||||
* - indicateDroppedUrls()
|
||||
* - indicateSortingChange()
|
||||
* - indicateSortOrderChanged()
|
||||
|
@ -59,6 +60,7 @@ class QWidget;
|
|||
* - emitViewportEntered()
|
||||
*
|
||||
* The communication of the abstract view to the view implementations is done by:
|
||||
* - setUrl()
|
||||
* - setShowHiddenFiles()
|
||||
* - setShowPreview()
|
||||
* - setAdditionalInfoCount()
|
||||
|
@ -74,10 +76,25 @@ public:
|
|||
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
|
||||
|
@ -215,6 +232,12 @@ signals:
|
|||
*/
|
||||
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.
|
||||
|
|
|
@ -88,8 +88,16 @@ DolphinView::DolphinView(QWidget* parent,
|
|||
|
||||
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*)),
|
||||
|
@ -466,18 +474,11 @@ void DolphinView::updateView(const KUrl& url, const KUrl& rootUrl)
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue