[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [konsole] src: shortcut adaptation to platform standards on Mac
From:       R.J.V. Bertin <rjvbertin () gmail ! com>
Date:       2016-11-24 16:38:27
Message-ID: E1c9x2Z-00011h-3M () code ! kde ! org
[Download RAW message or body]

Git commit 378518ea4bece6fdde0919626512fe652b1949fc by R.J.V. Bertin.
Committed on 24/11/2016 at 16:35.
Pushed by rjvbb into branch 'master'.

shortcut adaptation to platform standards on Mac

REVIEW: 120323

M  +1    -1    src/Application.cpp
M  +2    -1    src/ColorSchemeEditor.cpp
M  +1    -1    src/CopyInputDialog.cpp
M  +2    -1    src/EditProfileDialog.cpp
M  +2    -1    src/HistorySizeDialog.cpp
M  +7    -7    src/MainWindow.cpp
M  +2    -1    src/RenameTabDialog.cpp
M  +1    -11   src/Session.h
M  +40   -16   src/SessionController.cpp
A  +42   -0    src/Shortcut_p.h     [License: GPL (v2+)]
M  +17   -9    src/ViewManager.cpp
M  +1    -1    src/tests/PartManualTest.cpp

https://commits.kde.org/konsole/378518ea4bece6fdde0919626512fe652b1949fc

diff --git a/src/Application.cpp b/src/Application.cpp
index 5b352ec..6256e08 100644
--- a/src/Application.cpp
+++ b/src/Application.cpp
@@ -522,7 +522,7 @@ void Application::startBackgroundMode(MainWindow* window)
     QAction * action = collection->addAction("toggle-background-window");
     action->setObjectName(QLatin1String("Konsole Background Mode"));
     action->setText(i18n("Toggle Background Window"));
-    action->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F12)));
+    action->setGlobalShortcut(QKeySequence(Konsole::ACCEL + Qt::SHIFT + \
Qt::Key_F12)));  
     connect(action, &QAction::triggered, this, \
                &Application::toggleBackgroundInstance);
 */
diff --git a/src/ColorSchemeEditor.cpp b/src/ColorSchemeEditor.cpp
index f9bbe4f..297eecc 100644
--- a/src/ColorSchemeEditor.cpp
+++ b/src/ColorSchemeEditor.cpp
@@ -42,6 +42,7 @@
 #include "ui_ColorSchemeEditor.h"
 #include "ColorScheme.h"
 #include "CharacterColor.h"
+#include "Shortcut_p.h"
 
 using namespace Konsole;
 
@@ -66,7 +67,7 @@ ColorSchemeEditor::ColorSchemeEditor(QWidget* aParent)
     mainLayout->addWidget(mainWidget);
     QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
     okButton->setDefault(true);
-    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+    okButton->setShortcut(Konsole::ACCEL | Qt::Key_Return);
     connect(buttonBox, &QDialogButtonBox::accepted, this, \
                &ColorSchemeEditor::accept);
     connect(buttonBox, &QDialogButtonBox::rejected, this, \
&ColorSchemeEditor::reject);  mainLayout->addWidget(buttonBox);
diff --git a/src/CopyInputDialog.cpp b/src/CopyInputDialog.cpp
index 932744f..be19c8f 100644
--- a/src/CopyInputDialog.cpp
+++ b/src/CopyInputDialog.cpp
@@ -44,7 +44,7 @@ CopyInputDialog::CopyInputDialog(QWidget* parent)
     mainLayout->addWidget(mainWidget);
     QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
     okButton->setDefault(true);
-    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+    okButton->setShortcut(Konsole::ACCEL | Qt::Key_Return);
     connect(buttonBox, &QDialogButtonBox::accepted, this, &CopyInputDialog::accept);
     connect(buttonBox, &QDialogButtonBox::rejected, this, &CopyInputDialog::reject);
     mainLayout->addWidget(buttonBox);
diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp
index c2cca91..f149b64 100644
--- a/src/EditProfileDialog.cpp
+++ b/src/EditProfileDialog.cpp
@@ -57,6 +57,7 @@
 #include "ProfileManager.h"
 #include "ShellCommand.h"
 #include "WindowSystemInfo.h"
+#include "Shortcut_p.h"
 
 using namespace Konsole;
 
@@ -73,7 +74,7 @@ EditProfileDialog::EditProfileDialog(QWidget* aParent)
     mainLayout->addWidget(mainWidget);
     QPushButton *okButton = mButtonBox->button(QDialogButtonBox::Ok);
     okButton->setDefault(true);
-    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+    okButton->setShortcut(Konsole::ACCEL | Qt::Key_Return);
     connect(mButtonBox, &QDialogButtonBox::accepted, this, \
                &Konsole::EditProfileDialog::accept);
     connect(mButtonBox, &QDialogButtonBox::rejected, this, \
&Konsole::EditProfileDialog::reject);  
diff --git a/src/HistorySizeDialog.cpp b/src/HistorySizeDialog.cpp
index dbef529..6aeed7b 100644
--- a/src/HistorySizeDialog.cpp
+++ b/src/HistorySizeDialog.cpp
@@ -23,6 +23,7 @@
 
 // Konsole
 #include "ui_HistorySizeDialog.h"
+#include "Shortcut_p.h"
 
 #include <KLocalizedString>
 #include <QDialogButtonBox>
@@ -42,7 +43,7 @@ HistorySizeDialog::HistorySizeDialog(QWidget* parent)
     mainLayout->addWidget(mainWidget);
     QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
     okButton->setDefault(true);
-    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+    okButton->setShortcut(Konsole::ACCEL | Qt::Key_Return);
     connect(buttonBox, &QDialogButtonBox::accepted, this, \
                &HistorySizeDialog::accept);
     connect(buttonBox, &QDialogButtonBox::rejected, this, \
&HistorySizeDialog::reject);  mainLayout->addWidget(buttonBox);
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 9b34788..8e31361 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -182,8 +182,8 @@ void MainWindow::correctStandardShortcuts()
     // changed the shortcut; however, if the user changed it to Ctrl+B
     // this will still get changed to Ctrl+Shift+B
     QAction* bookmarkAction = \
                actionCollection()->action(QStringLiteral("add_bookmark"));
-    if (bookmarkAction && bookmarkAction->shortcut() == QKeySequence(Qt::CTRL + \
                Qt::Key_B)) {
-        actionCollection()->setDefaultShortcut(bookmarkAction, Qt::CTRL + Qt::SHIFT \
+ Qt::Key_B); +    if (bookmarkAction && bookmarkAction->shortcut() == \
QKeySequence(Konsole::ACCEL + Qt::Key_B)) { +        \
actionCollection()->setDefaultShortcut(bookmarkAction, Konsole::ACCEL + Qt::SHIFT + \
Qt::Key_B);  }
 }
 
@@ -289,7 +289,7 @@ void MainWindow::setupActions()
 
     // File Menu
     _newTabMenuAction = new KActionMenu(QIcon::fromTheme(QStringLiteral("tab-new")), \
                i18nc("@action:inmenu", "&New Tab"), collection);
-    collection->setDefaultShortcut(_newTabMenuAction, Qt::CTRL + Qt::SHIFT + \
Qt::Key_T); +    collection->setDefaultShortcut(_newTabMenuAction, Konsole::ACCEL + \
Qt::SHIFT + Qt::Key_T);  collection->setShortcutsConfigurable(_newTabMenuAction, \
true);  _newTabMenuAction->setAutoRepeat(false);
     connect(_newTabMenuAction, &KActionMenu::triggered, this, \
&Konsole::MainWindow::newTab); @@ -306,14 +306,14 @@ void MainWindow::setupActions()
     menuAction = collection->addAction(QStringLiteral("new-window"));
     menuAction->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
     menuAction->setText(i18nc("@action:inmenu", "New &Window"));
-    collection->setDefaultShortcut(menuAction, Qt::CTRL + Qt::SHIFT + Qt::Key_N);
+    collection->setDefaultShortcut(menuAction, Konsole::ACCEL + Qt::SHIFT + \
Qt::Key_N);  menuAction->setAutoRepeat(false);
     connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::newWindow);
 
     menuAction = collection->addAction(QStringLiteral("close-window"));
     menuAction->setIcon(QIcon::fromTheme(QStringLiteral("window-close")));
     menuAction->setText(i18nc("@action:inmenu", "Close Window"));
-    collection->setDefaultShortcut(menuAction, Qt::CTRL + Qt::SHIFT + Qt::Key_Q);
+    collection->setDefaultShortcut(menuAction, Konsole::ACCEL + Qt::SHIFT + \
                Qt::Key_Q);
     connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::close);
 
     // Bookmark Menu
@@ -324,7 +324,7 @@ void MainWindow::setupActions()
 
     // Settings Menu
     _toggleMenuBarAction = KStandardAction::showMenubar(menuBar(), \
                SLOT(setVisible(bool)), collection);
-    collection->setDefaultShortcut(_toggleMenuBarAction, Qt::CTRL + Qt::SHIFT + \
Qt::Key_M); +    collection->setDefaultShortcut(_toggleMenuBarAction, Konsole::ACCEL \
+ Qt::SHIFT + Qt::Key_M);  
     // Full Screen
     menuAction = KStandardAction::fullScreen(this, SLOT(viewFullScreen(bool)), this, \
collection); @@ -342,7 +342,7 @@ void MainWindow::setupActions()
     // Set up an shortcut-only action for activating menu bar.
     menuAction = collection->addAction(QStringLiteral("activate-menu"));
     menuAction->setText(i18nc("@item", "Activate Menu"));
-    collection->setDefaultShortcut(menuAction, Qt::CTRL + Qt::SHIFT + Qt::Key_F10);
+    collection->setDefaultShortcut(menuAction, Konsole::ACCEL + Qt::SHIFT + \
                Qt::Key_F10);
     connect(menuAction, &QAction::triggered, this, \
&Konsole::MainWindow::activateMenuBar);  }
 
diff --git a/src/RenameTabDialog.cpp b/src/RenameTabDialog.cpp
index 6dc2b26..6601662 100644
--- a/src/RenameTabDialog.cpp
+++ b/src/RenameTabDialog.cpp
@@ -22,6 +22,7 @@
 
 // Konsole
 #include "ui_RenameTabDialog.h"
+#include "Shortcut_p.h"
 
 #include <KLocalizedString>
 #include <QDialogButtonBox>
@@ -41,7 +42,7 @@ RenameTabDialog::RenameTabDialog(QWidget* parent)
     mainLayout->addWidget(mainWidget);
     QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
     okButton->setAutoDefault(true);
-    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+    okButton->setShortcut(Konsole::ACCEL | Qt::Key_Return);
     connect(buttonBox, &QDialogButtonBox::accepted, this, &RenameTabDialog::accept);
     connect(buttonBox, &QDialogButtonBox::rejected, this, &RenameTabDialog::reject);
     mainLayout->addWidget(buttonBox);
diff --git a/src/Session.h b/src/Session.h
index 30248b3..e323bea 100644
--- a/src/Session.h
+++ b/src/Session.h
@@ -37,6 +37,7 @@
 // Konsole
 #include "konsoleprivate_export.h"
 #include "config-konsole.h"
+#include "Shortcut_p.h"
 
 class QColor;
 
@@ -53,17 +54,6 @@ class ZModemDialog;
 class HistoryType;
 
 /**
- * Platform-specific main shortcut "opcode":
- */
-enum Modifier {
-#ifdef Q_OS_OSX
-    ACCEL = Qt::META
-#else
-    ACCEL = Qt::CTRL
-#endif
-};
-
-/**
  * Represents a terminal session consisting of a pseudo-teletype and a terminal \
                emulation.
  * The pseudo-teletype (or PTY) handles I/O between the terminal process and \
                Konsole.
  * The terminal emulation ( Emulation and subclasses ) processes the output stream \
                from the
diff --git a/src/SessionController.cpp b/src/SessionController.cpp
index a527e99..a3c98a9 100644
--- a/src/SessionController.cpp
+++ b/src/SessionController.cpp
@@ -531,7 +531,7 @@ void SessionController::setupCommonActions()
         action->setText(i18n("&Close Tab"));
 
     action->setIcon(QIcon::fromTheme(QStringLiteral("tab-close")));
-    collection->setDefaultShortcut(action, Qt::CTRL + Qt::SHIFT + Qt::Key_W);
+    collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::SHIFT + Qt::Key_W);
 
     // Open Browser
     action = collection->addAction("open-browser", this, SLOT(openBrowser()));
@@ -540,19 +540,34 @@ void SessionController::setupCommonActions()
 
     // Copy and Paste
     action = KStandardAction::copy(this, SLOT(copy()), collection);
-    collection->setDefaultShortcut(action, Qt::CTRL + Qt::SHIFT + Qt::Key_C);
+#ifdef Q_OS_OSX
+    // Don't use the Konsole::ACCEL const here, we really want the Command key \
(Qt::META) +    // TODO: check what happens if we leave it to Qt to assign the \
default? +    collection->setDefaultShortcut(action, Qt::META + Qt::Key_C);
+#else
+    collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::SHIFT + Qt::Key_C);
+#endif
     // disabled at first, since nothing has been selected now
     action->setEnabled(false);
 
     action = KStandardAction::paste(this, SLOT(paste()), collection);
     QList<QKeySequence> pasteShortcut;
-    pasteShortcut.append(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V));
+#ifdef Q_OS_OSX
+    pasteShortcut.append(QKeySequence(Qt::META + Qt::Key_V));
+    // No Insert key on Mac keyboards
+#else
+    pasteShortcut.append(QKeySequence(Konsole::ACCEL + Qt::SHIFT + Qt::Key_V));
     pasteShortcut.append(QKeySequence(Qt::SHIFT + Qt::Key_Insert));
+#endif
     collection->setDefaultShortcuts(action, pasteShortcut);
 
     action = collection->addAction("paste-selection", this, \
SLOT(pasteFromX11Selection()));  action->setText(i18n("Paste Selection"));
-    collection->setDefaultShortcut(action, Qt::CTRL + Qt::SHIFT + Qt::Key_Insert);
+#ifdef Q_OS_OSX
+    collection->setDefaultShortcut(action, Qt::META + Qt::SHIFT + Qt::Key_V);
+#else
+    collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::SHIFT + \
Qt::Key_Insert); +#endif
 
     _webSearchMenu = new KActionMenu(i18n("Web Search"), this);
     _webSearchMenu->setIcon(QIcon::fromTheme(QStringLiteral("preferences-web-browser-shortcuts")));
 @@ -569,10 +584,13 @@ void SessionController::setupCommonActions()
 
     action = KStandardAction::saveAs(this, SLOT(saveHistory()), collection);
     action->setText(i18n("Save Output &As..."));
+#ifdef Q_OS_OSX
+    action->setShortcut(QKeySequence(Qt::META + Qt::Key_S));
+#endif
 
     action = KStandardAction::print(this, SLOT(print_screen()), collection);
     action->setText(i18n("&Print Screen..."));
-    collection->setDefaultShortcut(action, Qt::CTRL + Qt::SHIFT + Qt::Key_P);
+    collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::SHIFT + Qt::Key_P);
 
     action = collection->addAction("adjust-history", this, \
SLOT(showHistoryOptions()));  action->setText(i18n("Adjust Scrollback..."));
@@ -585,7 +603,7 @@ void SessionController::setupCommonActions()
     action = collection->addAction("clear-history-and-reset", this, \
SLOT(clearHistoryAndReset()));  action->setText(i18n("Clear Scrollback and Reset"));
     action->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear-history")));
-    collection->setDefaultShortcut(action, Qt::CTRL + Qt::SHIFT + Qt::Key_K);
+    collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::SHIFT + Qt::Key_K);
 
     // Profile Options
     action = collection->addAction("edit-current-profile", this, \
SLOT(editCurrentProfile())); @@ -626,7 +644,7 @@ void \
                SessionController::setupExtraActions()
     action = collection->addAction("rename-session", this, SLOT(renameSession()));
     action->setText(i18n("&Rename Tab..."));
     action->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename")));
-    collection->setDefaultShortcut(action, Qt::CTRL + Qt::ALT + Qt::Key_S);
+    collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::ALT + Qt::Key_S);
 
     // Copy input to ==> all tabs
     KToggleAction* copyInputToAllTabsAction = \
collection->add<KToggleAction>("copy-input-to-all-tabs"); @@ -638,13 +656,13 @@ void \
SessionController::setupExtraActions()  // Copy input to ==> selected tabs
     KToggleAction* copyInputToSelectedTabsAction = \
collection->add<KToggleAction>("copy-input-to-selected-tabs");  \
                copyInputToSelectedTabsAction->setText(i18n("&Select Tabs..."));
-    collection->setDefaultShortcut(copyInputToSelectedTabsAction, Qt::CTRL + \
Qt::SHIFT + Qt::Key_Period); +    \
collection->setDefaultShortcut(copyInputToSelectedTabsAction, Konsole::ACCEL + \
Qt::SHIFT + Qt::Key_Period);  \
copyInputToSelectedTabsAction->setData(CopyInputToSelectedTabsMode);  
     // Copy input to ==> none
     KToggleAction* copyInputToNoneAction = \
                collection->add<KToggleAction>("copy-input-to-none");
     copyInputToNoneAction->setText(i18nc("@action:inmenu Do not select any tabs", \
                "&None"));
-    collection->setDefaultShortcut(copyInputToNoneAction, Qt::CTRL + Qt::SHIFT + \
Qt::Key_Slash); +    collection->setDefaultShortcut(copyInputToNoneAction, \
Konsole::ACCEL + Qt::SHIFT + Qt::Key_Slash);  \
copyInputToNoneAction->setData(CopyInputToNoneMode);  \
copyInputToNoneAction->setChecked(true); // the default state  
@@ -660,16 +678,16 @@ void SessionController::setupExtraActions()
     action = collection->addAction("zmodem-upload", this, SLOT(zmodemUpload()));
     action->setText(i18n("&ZModem Upload..."));
     action->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
-    collection->setDefaultShortcut(action, Qt::CTRL + Qt::ALT + Qt::Key_U);
+    collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::ALT + Qt::Key_U);
 
     // Monitor
     toggleAction = new KToggleAction(i18n("Monitor for &Activity"), this);
-    collection->setDefaultShortcut(toggleAction, Qt::CTRL + Qt::SHIFT + Qt::Key_A);
+    collection->setDefaultShortcut(toggleAction, Konsole::ACCEL + Qt::SHIFT + \
Qt::Key_A);  action = collection->addAction("monitor-activity", toggleAction);
     connect(action, &QAction::toggled, this, \
&Konsole::SessionController::monitorActivity);  
     toggleAction = new KToggleAction(i18n("Monitor for &Silence"), this);
-    collection->setDefaultShortcut(toggleAction, Qt::CTRL + Qt::SHIFT + Qt::Key_I);
+    collection->setDefaultShortcut(toggleAction, Konsole::ACCEL + Qt::SHIFT + \
Qt::Key_I);  action = collection->addAction("monitor-silence", toggleAction);
     connect(action, &QAction::toggled, this, \
&Konsole::SessionController::monitorSilence);  
@@ -678,14 +696,14 @@ void SessionController::setupExtraActions()
     action->setText(i18n("Enlarge Font"));
     action->setIcon(QIcon::fromTheme(QStringLiteral("format-font-size-more")));
     QList<QKeySequence> enlargeFontShortcut;
-    enlargeFontShortcut.append(QKeySequence(Qt::CTRL + Qt::Key_Plus));
-    enlargeFontShortcut.append(QKeySequence(Qt::CTRL + Qt::Key_Equal));
+    enlargeFontShortcut.append(QKeySequence(Konsole::ACCEL + Qt::Key_Plus));
+    enlargeFontShortcut.append(QKeySequence(Konsole::ACCEL + Qt::Key_Equal));
     collection->setDefaultShortcuts(action, enlargeFontShortcut);
 
     action = collection->addAction("shrink-font", this, SLOT(decreaseFontSize()));
     action->setText(i18n("Shrink Font"));
     action->setIcon(QIcon::fromTheme(QStringLiteral("format-font-size-less")));
-    collection->setDefaultShortcut(action, Qt::CTRL + Qt::Key_Minus);
+    collection->setDefaultShortcut(action, Konsole::ACCEL + Qt::Key_Minus);
 
 
     // Send signal
@@ -733,9 +751,15 @@ void SessionController::setupExtraActions()
     action->setData(SIGUSR2);
     sendSignalActions->addAction(action);
 
-    collection->setDefaultShortcut(_findAction, Qt::CTRL + Qt::SHIFT + Qt::Key_F);
+#ifdef Q_OS_OSX
+    collection->setDefaultShortcut(_findAction, Qt::META + Qt::Key_F);
+    collection->setDefaultShortcut(_findNextAction, Qt::META + Qt::Key_G);
+    collection->setDefaultShortcut(_findPreviousAction, Qt::META + Qt::SHIFT + \
Qt::Key_G); +#else
+    collection->setDefaultShortcut(_findAction, Konsole::ACCEL + Qt::SHIFT + \
Qt::Key_F);  collection->setDefaultShortcut(_findNextAction, Qt::Key_F3);
     collection->setDefaultShortcut(_findPreviousAction, Qt::SHIFT + Qt::Key_F3);
+#endif
 }
 
 void SessionController::switchProfile(Profile::Ptr profile)
diff --git a/src/Shortcut_p.h b/src/Shortcut_p.h
new file mode 100644
index 0000000..da40bdc
--- /dev/null
+++ b/src/Shortcut_p.h
@@ -0,0 +1,42 @@
+/*
+    This file is part of Konsole, an X terminal.
+
+    Copyright 2015 by René J.V. Bertin <rjvbertin@gmail.com>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301  USA.
+*/
+
+#ifndef SHORTCUT_H
+#define SHORTCUT_H
+
+#include <QtCore/qnamespace.h>
+
+namespace Konsole
+{
+/**
+ * Platform-specific main shortcut "opcode":
+ */
+enum Modifier {
+#ifdef Q_OS_OSX
+    ACCEL = Qt::META
+#else
+    ACCEL = Qt::CTRL
+#endif
+};
+
+}
+
+#endif //SHORTCUT_H
\ No newline at end of file
diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp
index c187e64..541de84 100644
--- a/src/ViewManager.cpp
+++ b/src/ViewManager.cpp
@@ -143,19 +143,19 @@ void ViewManager::setupActions()
         QAction* splitLeftRightAction = new \
QAction(QIcon::fromTheme(QStringLiteral("view-split-left-right")),  \
i18nc("@action:inmenu", "Split View Left/Right"),  this);
-        collection->setDefaultShortcut(splitLeftRightAction, Qt::CTRL + \
Qt::Key_ParenLeft); +        collection->setDefaultShortcut(splitLeftRightAction, \
                Konsole::ACCEL + Qt::Key_ParenLeft);
         collection->addAction("split-view-left-right", splitLeftRightAction);
         connect(splitLeftRightAction , &QAction::triggered , this , \
&Konsole::ViewManager::splitLeftRight);  
         QAction* splitTopBottomAction = new \
QAction(QIcon::fromTheme(QStringLiteral("view-split-top-bottom")) ,  \
                i18nc("@action:inmenu", "Split View Top/Bottom"), this);
-        collection->setDefaultShortcut(splitTopBottomAction, Qt::CTRL + \
Qt::Key_ParenRight); +        collection->setDefaultShortcut(splitTopBottomAction, \
                Konsole::ACCEL + Qt::Key_ParenRight);
         collection->addAction("split-view-top-bottom", splitTopBottomAction);
         connect(splitTopBottomAction , &QAction::triggered , this , \
&Konsole::ViewManager::splitTopBottom);  
         QAction* closeActiveAction = new QAction(i18nc("@action:inmenu Close Active \
                View", "Close Active") , this);
         closeActiveAction->setIcon(QIcon::fromTheme(QStringLiteral("view-close")));
-        collection->setDefaultShortcut(closeActiveAction, Qt::CTRL + Qt::SHIFT + \
Qt::Key_X); +        collection->setDefaultShortcut(closeActiveAction, Konsole::ACCEL \
+ Qt::SHIFT + Qt::Key_X);  closeActiveAction->setEnabled(false);
         collection->addAction("close-active-view", closeActiveAction);
         connect(closeActiveAction , &QAction::triggered , this , \
&Konsole::ViewManager::closeActiveContainer); @@ -163,7 +163,7 @@ void \
ViewManager::setupActions()  multiViewOnlyActions << closeActiveAction;
 
         QAction* closeOtherAction = new QAction(i18nc("@action:inmenu Close Other \
                Views", "Close Others") , this);
-        collection->setDefaultShortcut(closeOtherAction, Qt::CTRL + Qt::SHIFT + \
Qt::Key_O); +        collection->setDefaultShortcut(closeOtherAction, Konsole::ACCEL \
+ Qt::SHIFT + Qt::Key_O);  closeOtherAction->setEnabled(false);
         collection->addAction("close-other-views", closeOtherAction);
         connect(closeOtherAction , &QAction::triggered , this , \
&Konsole::ViewManager::closeOtherContainers); @@ -172,7 +172,7 @@ void \
ViewManager::setupActions()  
         // Expand & Shrink Active View
         QAction* expandActiveAction = new QAction(i18nc("@action:inmenu", "Expand \
                View") , this);
-        collection->setDefaultShortcut(expandActiveAction, Qt::CTRL + Qt::SHIFT + \
Qt::Key_BracketRight); +        collection->setDefaultShortcut(expandActiveAction, \
Konsole::ACCEL + Qt::SHIFT + Qt::Key_BracketRight);  \
expandActiveAction->setEnabled(false);  collection->addAction("expand-active-view", \
                expandActiveAction);
         connect(expandActiveAction , &QAction::triggered , this , \
&Konsole::ViewManager::expandActiveContainer); @@ -180,7 +180,7 @@ void \
ViewManager::setupActions()  multiViewOnlyActions << expandActiveAction;
 
         QAction* shrinkActiveAction = new QAction(i18nc("@action:inmenu", "Shrink \
                View") , this);
-        collection->setDefaultShortcut(shrinkActiveAction, Qt::CTRL + Qt::SHIFT + \
Qt::Key_BracketLeft); +        collection->setDefaultShortcut(shrinkActiveAction, \
Konsole::ACCEL + Qt::SHIFT + Qt::Key_BracketLeft);  \
shrinkActiveAction->setEnabled(false);  collection->addAction("shrink-active-view", \
                shrinkActiveAction);
         connect(shrinkActiveAction , &QAction::triggered , this , \
&Konsole::ViewManager::shrinkActiveContainer); @@ -193,7 +193,7 @@ void \
                ViewManager::setupActions()
         detachViewAction->setText(i18nc("@action:inmenu", "D&etach Current Tab"));
         // Ctrl+Shift+D is not used as a shortcut by default because it is too close
         // to Ctrl+D - which will terminate the session in many cases
-        collection->setDefaultShortcut(detachViewAction, Qt::CTRL + Qt::SHIFT + \
Qt::Key_H); +        collection->setDefaultShortcut(detachViewAction, Konsole::ACCEL \
+ Qt::SHIFT + Qt::Key_H);  
         connect(this , &Konsole::ViewManager::splitViewToggle , this , \
                &Konsole::ViewManager::updateDetachViewState);
         connect(detachViewAction , &QAction::triggered , this , \
&Konsole::ViewManager::detachActiveView); @@ -236,11 +236,19 @@ void \
                ViewManager::setupActions()
     connect(nextContainerAction , &QAction::triggered , this , \
&Konsole::ViewManager::nextContainer);  \
_viewSplitter->addAction(nextContainerAction);  
-    collection->setDefaultShortcut(moveViewLeftAction, Qt::CTRL + Qt::SHIFT + \
Qt::Key_Left); +#ifdef Q_OS_OSX
+    collection->setDefaultShortcut(moveViewLeftAction, Konsole::ACCEL + Qt::SHIFT + \
Qt::Key_BracketLeft); +#else
+    collection->setDefaultShortcut(moveViewLeftAction, Konsole::ACCEL + Qt::SHIFT + \
Qt::Key_Left); +#endif
     connect(moveViewLeftAction , &QAction::triggered , this , \
&Konsole::ViewManager::moveActiveViewLeft);  \
_viewSplitter->addAction(moveViewLeftAction);  
-    collection->setDefaultShortcut(moveViewRightAction, Qt::CTRL + Qt::SHIFT + \
Qt::Key_Right); +#ifdef Q_OS_OSX
+    collection->setDefaultShortcut(moveViewRightAction, Konsole::ACCEL + Qt::SHIFT + \
Qt::Key_BracketRight); +#else
+    collection->setDefaultShortcut(moveViewRightAction, Konsole::ACCEL + Qt::SHIFT + \
Qt::Key_Right); +#endif
     connect(moveViewRightAction , &QAction::triggered , this , \
&Konsole::ViewManager::moveActiveViewRight);  \
_viewSplitter->addAction(moveViewRightAction);  
diff --git a/src/tests/PartManualTest.cpp b/src/tests/PartManualTest.cpp
index 19c1c94..68ee395 100644
--- a/src/tests/PartManualTest.cpp
+++ b/src/tests/PartManualTest.cpp
@@ -61,7 +61,7 @@ void PartManualTest::testShortcutOverride()
     KMainWindow* mainWindow = new KMainWindow();
     QMenu* fileMenu = mainWindow->menuBar()->addMenu("File");
     QAction* testAction = fileMenu->addAction("Test");
-    testAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
+    testAction->setShortcut(QKeySequence(Konsole::ACCEL + Qt::Key_S));
     connect(testAction, &QAction::triggered, this, \
&Konsole::PartManualTest::shortcutTriggered);  
     // Create terminal part and embed in into the main window


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic