File 2002-shortcuts.patch of Package okular
diff --git a/shell/shell.cpp b/shell/shell.cpp
index f69fe6384e95f63326e83b349f40a1d24a331b8d..b73b7e6ad4ddb28f3f251520359d60d4cd381b14 100644
--- a/shell/shell.cpp
+++ b/shell/shell.cpp
@@ -779,6 +779,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 020268fa8d386ce1d19bdd7ccdff3b70b38d497d..bc5d16f22c06713cfa0d3caef77575884e66fd2f 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;