File 2002-shortcuts.patch of Package okular

diff --git a/shell/shell.cpp b/shell/shell.cpp
index 87cb72cefd5a17560c8338f565aade2fa4d09f0f..fd441c82c8a9c0b9b786bebb8c92c8e7d8bbed3b 100644
--- a/shell/shell.cpp
+++ b/shell/shell.cpp
@@ -763,6 +763,24 @@ void Shell::setCaption(const QString &caption)
     setCaption(caption, modified);
 }
 
+bool Shell::event(QEvent *event)
+{
+    if (event->type() == QEvent::ShortcutOverride) {
+        const QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
+        if (keyEvent->key() == Qt::Key_Space) {
+            const int activeTab = m_tabWidget->currentIndex();
+            Q_ASSERT(activeTab >= 0 && activeTab < m_tabs.size());
+            KParts::ReadWritePart *const activePart = m_tabs[activeTab].part;
+            if (!activePart->widget()->hasFocus()) {
+                event->accept();
+                return true;
+            }
+        }
+    }
+
+    return KParts::MainWindow::event(event);
+}
+
 void Shell::showEvent(QShowEvent *e)
 {
     if (!menuBar()->isNativeMenuBar() && m_showMenuBarAction) {
diff --git a/shell/shell.h b/shell/shell.h
index aefcf9645c67b887f6fa2d38cb435cef9a6bd2f0..0729deefd0eba3a1c1e56cd3a4d5be16f9fe2495 100644
--- a/shell/shell.h
+++ b/shell/shell.h
@@ -111,6 +111,7 @@ protected:
 
     bool queryClose() override;
 
+    bool event(QEvent *event) override;
     void showEvent(QShowEvent *event) override;
     void keyPressEvent(QKeyEvent *) override;
 
openSUSE Build Service is sponsored by