From: Peter Penz Date: Sun, 1 Feb 2009 14:08:40 +0000 (+0000) Subject: Replace patch for bug 181226 by a different approach, as the previous patch resulted... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/8e13b80d5f3b9820a4db37ba1de7070cc5743e80 Replace patch for bug 181226 by a different approach, as the previous patch resulted in a changed behavior when using the double-click mode (-> a treeview item had to be pressed twice to show it in the main view). CCBUG: 172360 CCBUG: 181226 svn path=/trunk/KDE/kdebase/apps/; revision=919648 --- diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index e20da9175..eb957f7b9 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -159,7 +159,7 @@ void FoldersPanel::showEvent(QShowEvent* event) new FolderExpander(m_treeView, m_proxyModel); - connect(m_treeView, SIGNAL(activated(const QModelIndex&)), + connect(m_treeView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(updateActiveView(const QModelIndex&))); connect(m_treeView, SIGNAL(urlsDropped(const QModelIndex&, QDropEvent*)), this, SLOT(dropUrls(const QModelIndex&, QDropEvent*))); @@ -191,6 +191,17 @@ void FoldersPanel::contextMenuEvent(QContextMenuEvent* event) contextMenu.open(); } +void FoldersPanel::keyPressEvent(QKeyEvent* event) +{ + const int key = event->key(); + if ((key == Qt::Key_Enter) || (key == Qt::Key_Return)) { + event->accept(); + updateActiveView(m_treeView->currentIndex()); + } else { + Panel::keyPressEvent(event); + } +} + void FoldersPanel::updateActiveView(const QModelIndex& index) { const QModelIndex dirIndex = m_proxyModel->mapToSource(index); diff --git a/src/panels/folders/folderspanel.h b/src/panels/folders/folderspanel.h index 90f506fd0..1822d17e0 100644 --- a/src/panels/folders/folderspanel.h +++ b/src/panels/folders/folderspanel.h @@ -81,6 +81,9 @@ protected: /** @see QWidget::contextMenuEvent() */ virtual void contextMenuEvent(QContextMenuEvent* event); + /** @see QWidget::keyPressEvent() */ + virtual void keyPressEvent(QKeyEvent* event); + private slots: /** * Updates the active view to the URL