]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Reactivate keyboard navigation again. Previously the Return key did not work, as...
authorPeter Penz <peter.penz19@gmail.com>
Sun, 9 Sep 2007 18:38:04 +0000 (18:38 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sun, 9 Sep 2007 18:38:04 +0000 (18:38 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=710356

src/dolphindetailsview.cpp
src/dolphindetailsview.h
src/dolphiniconsview.cpp
src/dolphiniconsview.h
src/dolphinview.cpp

index 1aec30cca05fd4edb1289776bec04d1b7b3d9612..dfd7018bb8b20e3ca326eb01871e7a062f531634 100644 (file)
@@ -69,6 +69,10 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr
     connect(parent, SIGNAL(sortOrderChanged(Qt::SortOrder)),
             this, SLOT(setSortIndicatorOrder(Qt::SortOrder)));
 
+    // TODO: Connecting to the signal 'activated()' is not possible, as kstyle
+    // does not forward the single vs. doubleclick to it yet (KDE 4.1?). Hence it is
+    // necessary connecting the signal 'singleClick()' or 'doubleClick' and to handle the
+    // RETURN-key in keyPressEvent().
     if (KGlobalSettings::singleClick()) {
         connect(this, SIGNAL(clicked(const QModelIndex&)),
                 this, SLOT(slotItemActivated(const QModelIndex&)));
@@ -271,6 +275,14 @@ void DolphinDetailsView::paintEvent(QPaintEvent* event)
     }
 }
 
+void DolphinDetailsView::keyPressEvent(QKeyEvent* event)
+{
+    QTreeView::keyPressEvent(event);
+    if (event->key() == Qt::Key_Return) {
+        m_controller->triggerItem(selectionModel()->currentIndex());
+    }
+}
+
 void DolphinDetailsView::setSortIndicatorSection(DolphinView::Sorting sorting)
 {
     QHeaderView* headerView = header();
index fdd93b03c47553717970b634eb4ff744f6d4ef25..dc79c31cc1029ecd558759a3d9fbaf29d85e15f0 100644 (file)
@@ -56,6 +56,7 @@ protected:
     virtual void dragMoveEvent(QDragMoveEvent* event);
     virtual void dropEvent(QDropEvent* event);
     virtual void paintEvent(QPaintEvent* event);
+    virtual void keyPressEvent(QKeyEvent* event);
 
 private slots:
     /**
index 37f0bf1727cb27a95db7b370e29784281ad94cf4..ed2332c051ea35e19a7beec611ea556ac5d70cc5 100644 (file)
@@ -46,6 +46,10 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
     setMouseTracking(true);
     viewport()->setAttribute(Qt::WA_Hover);
 
+    // TODO: Connecting to the signal 'activated()' is not possible, as kstyle
+    // does not forward the single vs. doubleclick to it yet (KDE 4.1?). Hence it is
+    // necessary connecting the signal 'singleClick()' or 'doubleClick' and to handle the
+    // RETURN-key in keyPressEvent().
     if (KGlobalSettings::singleClick()) {
         connect(this, SIGNAL(clicked(const QModelIndex&)),
                 controller, SLOT(triggerItem(const QModelIndex&)));
@@ -202,6 +206,14 @@ void DolphinIconsView::paintEvent(QPaintEvent* event)
     }
 }
 
+void DolphinIconsView::keyPressEvent(QKeyEvent* event)
+{
+    KCategorizedView::keyPressEvent(event);
+    if (event->key() == Qt::Key_Return) {
+        m_controller->triggerItem(selectionModel()->currentIndex());
+    }
+}
+
 void DolphinIconsView::slotShowPreviewChanged(bool showPreview)
 {
     updateGridSize(showPreview, m_controller->showAdditionalInfo());
index 7e5544ec09fe5574836a1c920ba4f7098e511cc9..6cd5b220119ee24d23ddc51bfd8e9f43d206e46b 100644 (file)
@@ -56,6 +56,7 @@ protected:
     virtual void dragMoveEvent(QDragMoveEvent* event);
     virtual void dropEvent(QDropEvent* event);
     virtual void paintEvent(QPaintEvent* event);
+    virtual void keyPressEvent(QKeyEvent* event);
 
 private slots:
     void slotShowPreviewChanged(bool show);
index d145597caa7736fc234e44f4ccbe9b7d621e9f4a..3e8070cb3f405e87cd28b76ad0cf51144d5ff7ce 100644 (file)
@@ -432,6 +432,7 @@ void DolphinView::setUrl(const KUrl& url)
     applyViewProperties(url);
 
     startDirLister(url);
+    itemView()->setFocus();
 }
 
 void DolphinView::mouseReleaseEvent(QMouseEvent* event)
@@ -835,6 +836,7 @@ void DolphinView::createView()
             this, SLOT(emitContentsMoved()));
     connect(view->horizontalScrollBar(), SIGNAL(valueChanged(int)),
             this, SLOT(emitContentsMoved()));
+    view->setFocus();
 }
 
 QAbstractItemView* DolphinView::itemView() const