Commit cc85a524 authored by Lukáš Tinkl's avatar Lukáš Tinkl

QAction::setShortcut -> KActionCollection::setDefaultShortcut

parent cb1f25d9
......@@ -185,7 +185,7 @@ void MainWindow::correctStandardShortcuts()
// replace F1 shortcut for help contents
QAction* helpAction = actionCollection()->action("help_contents");
if (helpAction) {
helpAction->setShortcut(QKeySequence());
actionCollection()->setDefaultShortcut(helpAction, QKeySequence());
}
// replace Ctrl+B shortcut for bookmarks only if user hasn't already
......@@ -193,7 +193,7 @@ void MainWindow::correctStandardShortcuts()
// this will still get changed to Ctrl+Shift+B
QAction* bookmarkAction = actionCollection()->action("add_bookmark");
if (bookmarkAction && bookmarkAction->shortcut() == QKeySequence(Qt::CTRL + Qt::Key_B)) {
bookmarkAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_B));
actionCollection()->setDefaultShortcut(bookmarkAction, Qt::CTRL + Qt::SHIFT + Qt::Key_B);
}
}
......@@ -299,12 +299,8 @@ void MainWindow::setupActions()
// File Menu
_newTabMenuAction = new KActionMenu(KIcon("tab-new"), i18nc("@action:inmenu", "&New Tab"), collection);
_newTabMenuAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_T));
#pragma message("TODO: How to port KAction::setShortcutConfigurable()?")
#if 0
_newTabMenuAction->setShortcutConfigurable(true);
#endif
collection->setDefaultShortcut(_newTabMenuAction, Qt::CTRL + Qt::SHIFT + Qt::Key_T);
collection->setShortcutsConfigurable(_newTabMenuAction, true);
_newTabMenuAction->setAutoRepeat(false);
connect(_newTabMenuAction, &KActionMenu::triggered, this, &Konsole::MainWindow::newTab);
collection->addAction("new-tab", _newTabMenuAction);
......@@ -312,21 +308,21 @@ void MainWindow::setupActions()
menuAction = collection->addAction("clone-tab");
menuAction->setIcon(KIcon("tab-duplicate"));
menuAction->setText(i18nc("@action:inmenu", "&Clone Tab"));
menuAction->setShortcut(QKeySequence());
collection->setDefaultShortcut(menuAction, QKeySequence());
menuAction->setAutoRepeat(false);
connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::cloneTab);
menuAction = collection->addAction("new-window");
menuAction->setIcon(KIcon("window-new"));
menuAction->setText(i18nc("@action:inmenu", "New &Window"));
menuAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_N));
collection->setDefaultShortcut(menuAction, Qt::CTRL + Qt::SHIFT + Qt::Key_N);
menuAction->setAutoRepeat(false);
connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::newWindow);
menuAction = collection->addAction("close-window");
menuAction->setIcon(KIcon("window-close"));
menuAction->setText(i18nc("@action:inmenu", "Close Window"));
menuAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Q));
collection->setDefaultShortcut(menuAction, Qt::CTRL + Qt::SHIFT + Qt::Key_Q);
connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::close);
// Bookmark Menu
......@@ -337,11 +333,11 @@ void MainWindow::setupActions()
// Settings Menu
_toggleMenuBarAction = KStandardAction::showMenubar(menuBar(), SLOT(setVisible(bool)), collection);
_toggleMenuBarAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_M));
collection->setDefaultShortcut(_toggleMenuBarAction, Qt::CTRL + Qt::SHIFT + Qt::Key_M);
// Full Screen
menuAction = KStandardAction::fullScreen(this, SLOT(viewFullScreen(bool)), this, collection);
menuAction->setShortcut(QKeySequence(Qt::Key_F11));
collection->setDefaultShortcut(menuAction, Qt::Key_F11);
KStandardAction::configureNotifications(this, SLOT(configureNotifications()), collection);
KStandardAction::keyBindings(this, SLOT(showShortcutsDialog()), collection);
......@@ -355,7 +351,7 @@ void MainWindow::setupActions()
// Set up an shortcut-only action for activating menu bar.
menuAction = collection->addAction("activate-menu");
menuAction->setText(i18nc("@item", "Activate Menu"));
menuAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F10));
collection->setDefaultShortcut(menuAction, Qt::CTRL + Qt::SHIFT + Qt::Key_F10);
connect(menuAction, &QAction::triggered, this, &Konsole::MainWindow::activateMenuBar);
}
......
......@@ -179,7 +179,7 @@ public:
QList<Profile::Ptr> sortedFavorites();
/*
/**
* Sorts the profile list by menuindex; those without an menuindex, sort by name.
* The menuindex list is first and then the non-menuindex list.
*
......
......@@ -94,9 +94,9 @@ using namespace Konsole;
// TODO - Replace the icon choices below when suitable icons for silence and
// activity are available
//having global static KIcons no longer works with Qt5/KF5, use K_GLOBAL_STATIC
K_GLOBAL_STATIC_WITH_ARGS(KIcon, _activityIcon, ("dialog-information"));
K_GLOBAL_STATIC_WITH_ARGS(KIcon, _silenceIcon, ("dialog-information"));
K_GLOBAL_STATIC_WITH_ARGS(KIcon, _broadcastIcon, ("emblem-important"));
K_GLOBAL_STATIC_WITH_ARGS(KIcon, _activityIcon, ("dialog-information"))
K_GLOBAL_STATIC_WITH_ARGS(KIcon, _silenceIcon, ("dialog-information"))
K_GLOBAL_STATIC_WITH_ARGS(KIcon, _broadcastIcon, ("emblem-important"))
QSet<SessionController*> SessionController::_allControllers;
int SessionController::_lastControllerId;
......@@ -571,7 +571,7 @@ void SessionController::setupCommonActions()
action->setText(i18n("&Close Tab"));
action->setIcon(KIcon("tab-close"));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_W));
collection->setDefaultShortcut(action, Qt::CTRL + Qt::SHIFT + Qt::Key_W);
// Open Browser
action = collection->addAction("open-browser", this, SLOT(openBrowser()));
......@@ -580,7 +580,7 @@ void SessionController::setupCommonActions()
// Copy and Paste
action = KStandardAction::copy(this, SLOT(copy()), collection);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C));
collection->setDefaultShortcut(action, Qt::CTRL + Qt::SHIFT + Qt::Key_C);
// disabled at first, since nothing has been selected now
action->setEnabled(false);
......@@ -588,11 +588,11 @@ void SessionController::setupCommonActions()
QList<QKeySequence> pasteShortcut;
pasteShortcut.append(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V));
pasteShortcut.append(QKeySequence(Qt::SHIFT + Qt::Key_Insert));
action->setShortcuts(pasteShortcut);
collection->setDefaultShortcuts(action, pasteShortcut);
action = collection->addAction("paste-selection", this, SLOT(pasteFromX11Selection()));
action->setText(i18n("Paste Selection"));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Insert));
collection->setDefaultShortcut(action, Qt::CTRL + Qt::SHIFT + Qt::Key_Insert);
_webSearchMenu = new KActionMenu(i18n("Web Search"), this);
_webSearchMenu->setIcon(KIcon("preferences-web-browser-shortcuts"));
......@@ -612,7 +612,7 @@ void SessionController::setupCommonActions()
action = KStandardAction::print(this, SLOT(print_screen()), collection);
action->setText(i18n("&Print Screen..."));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P));
collection->setDefaultShortcut(action, Qt::CTRL + Qt::SHIFT + Qt::Key_P);
action = collection->addAction("adjust-history", this, SLOT(showHistoryOptions()));
action->setText(i18n("Adjust Scrollback..."));
......@@ -625,7 +625,7 @@ void SessionController::setupCommonActions()
action = collection->addAction("clear-history-and-reset", this, SLOT(clearHistoryAndReset()));
action->setText(i18n("Clear Scrollback and Reset"));
action->setIcon(KIcon("edit-clear-history"));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_K));
collection->setDefaultShortcut(action, Qt::CTRL + Qt::SHIFT + Qt::Key_K);
// Profile Options
action = collection->addAction("edit-current-profile", this, SLOT(editCurrentProfile()));
......@@ -638,14 +638,14 @@ void SessionController::setupCommonActions()
// History
_findAction = KStandardAction::find(this, SLOT(searchBarEvent()), collection);
_findAction->setShortcut(QKeySequence());
collection->setDefaultShortcut(_findAction, QKeySequence());
_findNextAction = KStandardAction::findNext(this, SLOT(findNextInHistory()), collection);
_findNextAction->setShortcut(QKeySequence());
collection->setDefaultShortcut(_findNextAction, QKeySequence());
_findNextAction->setEnabled(false);
_findPreviousAction = KStandardAction::findPrev(this, SLOT(findPreviousInHistory()), collection);
_findPreviousAction->setShortcut(QKeySequence());
collection->setDefaultShortcut(_findPreviousAction, QKeySequence());
_findPreviousAction->setEnabled(false);
// Character Encoding
......@@ -666,7 +666,7 @@ void SessionController::setupExtraActions()
action = collection->addAction("rename-session", this, SLOT(renameSession()));
action->setText(i18n("&Rename Tab..."));
action->setIcon(KIcon("edit-rename"));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S));
collection->setDefaultShortcut(action, Qt::CTRL + Qt::ALT + Qt::Key_S);
// Copy input to ==> all tabs
KToggleAction* copyInputToAllTabsAction = collection->add<KToggleAction>("copy-input-to-all-tabs");
......@@ -678,13 +678,13 @@ void SessionController::setupExtraActions()
// Copy input to ==> selected tabs
KToggleAction* copyInputToSelectedTabsAction = collection->add<KToggleAction>("copy-input-to-selected-tabs");
copyInputToSelectedTabsAction->setText(i18n("&Select Tabs..."));
copyInputToSelectedTabsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Period));
collection->setDefaultShortcut(copyInputToSelectedTabsAction, Qt::CTRL + 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"));
copyInputToNoneAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Slash));
collection->setDefaultShortcut(copyInputToNoneAction, Qt::CTRL + Qt::SHIFT + Qt::Key_Slash);
copyInputToNoneAction->setData(CopyInputToNoneMode);
copyInputToNoneAction->setChecked(true); // the default state
......@@ -700,16 +700,16 @@ void SessionController::setupExtraActions()
action = collection->addAction("zmodem-upload", this, SLOT(zmodemUpload()));
action->setText(i18n("&ZModem Upload..."));
action->setIcon(KIcon("document-open"));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_U));
collection->setDefaultShortcut(action, Qt::CTRL + Qt::ALT + Qt::Key_U);
// Monitor
toggleAction = new KToggleAction(i18n("Monitor for &Activity"), this);
toggleAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_A));
collection->setDefaultShortcut(toggleAction, Qt::CTRL + 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);
toggleAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I));
collection->setDefaultShortcut(toggleAction, Qt::CTRL + Qt::SHIFT + Qt::Key_I);
action = collection->addAction("monitor-silence", toggleAction);
connect(action, &QAction::toggled, this, &Konsole::SessionController::monitorSilence);
......@@ -720,12 +720,12 @@ void SessionController::setupExtraActions()
QList<QKeySequence> enlargeFontShortcut;
enlargeFontShortcut.append(QKeySequence(Qt::CTRL + Qt::Key_Plus));
enlargeFontShortcut.append(QKeySequence(Qt::CTRL + Qt::Key_Equal));
action->setShortcuts(enlargeFontShortcut);
collection->setDefaultShortcuts(action, enlargeFontShortcut);
action = collection->addAction("shrink-font", this, SLOT(decreaseFontSize()));
action->setText(i18n("Shrink Font"));
action->setIcon(KIcon("format-font-size-less"));
action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus));
collection->setDefaultShortcut(action, Qt::CTRL + Qt::Key_Minus);
// Send signal
......@@ -773,9 +773,9 @@ void SessionController::setupExtraActions()
action->setData(SIGUSR2);
sendSignalActions->addAction(action);
_findAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F));
_findNextAction->setShortcut(QKeySequence(Qt::Key_F3));
_findPreviousAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F3));
collection->setDefaultShortcut(_findAction, Qt::CTRL + Qt::SHIFT + Qt::Key_F);
collection->setDefaultShortcut(_findNextAction, Qt::Key_F3);
collection->setDefaultShortcut(_findPreviousAction, Qt::SHIFT + Qt::Key_F3);
}
void SessionController::switchProfile(Profile::Ptr profile)
......
......@@ -151,19 +151,19 @@ void ViewManager::setupActions()
QAction* splitLeftRightAction = new QAction(KIcon("view-split-left-right"),
i18nc("@action:inmenu", "Split View Left/Right"),
this);
splitLeftRightAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_ParenLeft));
collection->setDefaultShortcut(splitLeftRightAction, Qt::CTRL + Qt::Key_ParenLeft);
collection->addAction("split-view-left-right", splitLeftRightAction);
connect(splitLeftRightAction , &QAction::triggered , this , &Konsole::ViewManager::splitLeftRight);
QAction* splitTopBottomAction = new QAction(KIcon("view-split-top-bottom") ,
i18nc("@action:inmenu", "Split View Top/Bottom"), this);
splitTopBottomAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_ParenRight));
collection->setDefaultShortcut(splitTopBottomAction, Qt::CTRL + 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(KIcon("view-close"));
closeActiveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
collection->setDefaultShortcut(closeActiveAction, Qt::CTRL + Qt::SHIFT + Qt::Key_S);
closeActiveAction->setEnabled(false);
collection->addAction("close-active-view", closeActiveAction);
connect(closeActiveAction , &QAction::triggered , this , &Konsole::ViewManager::closeActiveContainer);
......@@ -171,7 +171,7 @@ void ViewManager::setupActions()
multiViewOnlyActions << closeActiveAction;
QAction* closeOtherAction = new QAction(i18nc("@action:inmenu Close Other Views", "Close Others") , this);
closeOtherAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_O));
collection->setDefaultShortcut(closeOtherAction, Qt::CTRL + Qt::SHIFT + Qt::Key_O);
closeOtherAction->setEnabled(false);
collection->addAction("close-other-views", closeOtherAction);
connect(closeOtherAction , &QAction::triggered , this , &Konsole::ViewManager::closeOtherContainers);
......@@ -180,7 +180,7 @@ void ViewManager::setupActions()
// Expand & Shrink Active View
QAction* expandActiveAction = new QAction(i18nc("@action:inmenu", "Expand View") , this);
expandActiveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_BracketRight));
collection->setDefaultShortcut(expandActiveAction, Qt::CTRL + Qt::SHIFT + Qt::Key_BracketRight);
expandActiveAction->setEnabled(false);
collection->addAction("expand-active-view", expandActiveAction);
connect(expandActiveAction , &QAction::triggered , this , &Konsole::ViewManager::expandActiveContainer);
......@@ -188,7 +188,7 @@ void ViewManager::setupActions()
multiViewOnlyActions << expandActiveAction;
QAction* shrinkActiveAction = new QAction(i18nc("@action:inmenu", "Shrink View") , this);
shrinkActiveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_BracketLeft));
collection->setDefaultShortcut(shrinkActiveAction, Qt::CTRL + Qt::SHIFT + Qt::Key_BracketLeft);
shrinkActiveAction->setEnabled(false);
collection->addAction("shrink-active-view", shrinkActiveAction);
connect(shrinkActiveAction , &QAction::triggered , this , &Konsole::ViewManager::shrinkActiveContainer);
......@@ -201,7 +201,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
detachViewAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_H));
collection->setDefaultShortcut(detachViewAction, Qt::CTRL + Qt::SHIFT + Qt::Key_H);
connect(this , &Konsole::ViewManager::splitViewToggle , this , &Konsole::ViewManager::updateDetachViewState);
connect(detachViewAction , &QAction::triggered , this , &Konsole::ViewManager::detachActiveView);
......@@ -233,23 +233,23 @@ void ViewManager::setupActions()
}
// keyboard shortcut only actions
nextViewAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Right));
collection->setDefaultShortcut(nextViewAction, Qt::SHIFT + Qt::Key_Right);
connect(nextViewAction, &QAction::triggered , this , &Konsole::ViewManager::nextView);
_viewSplitter->addAction(nextViewAction);
previousViewAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Left));
collection->setDefaultShortcut(previousViewAction, Qt::SHIFT + Qt::Key_Left);
connect(previousViewAction, &QAction::triggered , this , &Konsole::ViewManager::previousView);
_viewSplitter->addAction(previousViewAction);
nextContainerAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Tab));
collection->setDefaultShortcut(nextContainerAction, Qt::SHIFT + Qt::Key_Tab);
connect(nextContainerAction , &QAction::triggered , this , &Konsole::ViewManager::nextContainer);
_viewSplitter->addAction(nextContainerAction);
moveViewLeftAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Left));
collection->setDefaultShortcut(moveViewLeftAction, Qt::CTRL + Qt::SHIFT + Qt::Key_Left);
connect(moveViewLeftAction , &QAction::triggered , this , &Konsole::ViewManager::moveActiveViewLeft);
_viewSplitter->addAction(moveViewLeftAction);
moveViewRightAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Right));
collection->setDefaultShortcut(moveViewRightAction, Qt::CTRL + Qt::SHIFT + Qt::Key_Right);
connect(moveViewRightAction , &QAction::triggered , this , &Konsole::ViewManager::moveActiveViewRight);
_viewSplitter->addAction(moveViewRightAction);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment