krusader/Handle-arrow-key-press-in-brief-view.patch
Raymond Wooninck 5d416d3ec9 Accepting request 448934 from home:wolfi323:branches:KDE:Extra
- Add Handle-arrow-key-press-in-brief-view.patch to fix the behavior when pressing the left/right cursor keys in brief view (boo#1017533, kde#374238)

OBS-URL: https://build.opensuse.org/request/show/448934
OBS-URL: https://build.opensuse.org/package/show/KDE:Extra/krusader?expand=0&rev=21
2017-01-06 11:04:46 +00:00

82 lines
2.8 KiB
Diff

From 991d28b4c9d14d860583cffd2b778d0f46c4f528 Mon Sep 17 00:00:00 2001
From: Alexander Bikadorov <alex.bikadorov@kdemail.net>
Date: Thu, 29 Dec 2016 18:28:09 +0100
Subject: FIXED: [ 374238 ] Handle left/right arrow key press in brief view
(previously filtered by search bar).
Quickfix. It is maybe better to remove the filtering in KrSearchBar and instead get all key events from KrView.
Bug came with 374238.
BUG: 374238
---
krusader/Panel/krinterbriefview.cpp | 22 ++++++++++++++++------
krusader/Panel/krinterbriefview.h | 2 ++
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/krusader/Panel/krinterbriefview.cpp b/krusader/Panel/krinterbriefview.cpp
index fcf4898..f4d38b8 100644
--- a/krusader/Panel/krinterbriefview.cpp
+++ b/krusader/Panel/krinterbriefview.cpp
@@ -146,9 +146,19 @@ void KrInterBriefView::keyPressEvent(QKeyEvent *e)
{
if (!e || !_model->ready())
return ; // subclass bug
- if ((e->key() != Qt::Key_Left && e->key() != Qt::Key_Right) &&
- (handleKeyEvent(e))) // did the view class handled the event?
+
+ if (handleKeyEvent(e))
return;
+
+ QAbstractItemView::keyPressEvent(e);
+}
+
+bool KrInterBriefView::handleKeyEvent(QKeyEvent *e)
+{
+ if ((e->key() != Qt::Key_Left && e->key() != Qt::Key_Right) &&
+ (KrView::handleKeyEvent(e))) // did the view class handled the event?
+ return true;
+
switch (e->key()) {
case Qt::Key_Right : {
if (e->modifiers() == Qt::ControlModifier) { // let the panel handle it
@@ -178,7 +188,7 @@ void KrInterBriefView::keyPressEvent(QKeyEvent *e)
}
if (e->modifiers() & Qt::ShiftModifier)
op()->emitSelectionChanged();
- break;
+ return true;
}
case Qt::Key_Left : {
if (e->modifiers() == Qt::ControlModifier) { // let the panel handle it
@@ -208,11 +218,11 @@ void KrInterBriefView::keyPressEvent(QKeyEvent *e)
}
if (e->modifiers() & Qt::ShiftModifier)
op()->emitSelectionChanged();
- break;
+ return true;
}
- default:
- QAbstractItemView::keyPressEvent(e);
}
+
+ return false;
}
void KrInterBriefView::wheelEvent(QWheelEvent *ev)
diff --git a/krusader/Panel/krinterbriefview.h b/krusader/Panel/krinterbriefview.h
index 6bc133b..88b286a 100644
--- a/krusader/Panel/krinterbriefview.h
+++ b/krusader/Panel/krinterbriefview.h
@@ -77,6 +77,8 @@ protected slots:
virtual void renameCurrentItem() Q_DECL_OVERRIDE;
protected:
+ // ---- reimplemented from KrView ----
+ virtual bool handleKeyEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
// ---- reimplemented from QAbstractItemView ----
virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
virtual void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
--
cgit v0.11.2