Commit 32bd8efc authored by Roman Inflianskas's avatar Roman Inflianskas

Modernize the syntax of shortcuts

Reviewers: #dolphin, markg

Reviewed By: markg

Subscribers: markg, elvisangelaccio, #dolphin

Differential Revision: https://phabricator.kde.org/D10986
parent 436ad965
......@@ -1049,19 +1049,19 @@ void DolphinMainWindow::setupActions()
QAction* newWindow = actionCollection()->addAction(QStringLiteral("new_window"));
newWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
actionCollection()->setDefaultShortcut(newWindow, Qt::CTRL | Qt::Key_N);
actionCollection()->setDefaultShortcut(newWindow, Qt::CTRL + Qt::Key_N);
connect(newWindow, &QAction::triggered, this, &DolphinMainWindow::openNewMainWindow);
QAction* newTab = actionCollection()->addAction(QStringLiteral("new_tab"));
newTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
newTab->setText(i18nc("@action:inmenu File", "New Tab"));
actionCollection()->setDefaultShortcuts(newTab, {Qt::CTRL | Qt::Key_T, Qt::CTRL | Qt::SHIFT | Qt::Key_N});
actionCollection()->setDefaultShortcuts(newTab, {Qt::CTRL + Qt::Key_T, Qt::CTRL + Qt::SHIFT + Qt::Key_N});
connect(newTab, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::openNewActivatedTab));
QAction* closeTab = actionCollection()->addAction(QStringLiteral("close_tab"));
closeTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-close")));
closeTab->setText(i18nc("@action:inmenu File", "Close Tab"));
actionCollection()->setDefaultShortcut(closeTab, Qt::CTRL | Qt::Key_W);
actionCollection()->setDefaultShortcut(closeTab, Qt::CTRL + Qt::Key_W);
closeTab->setEnabled(false);
connect(closeTab, &QAction::triggered, m_tabWidget, static_cast<void(DolphinTabWidget::*)()>(&DolphinTabWidget::closeTab));
......@@ -1086,13 +1086,13 @@ void DolphinMainWindow::setupActions()
QAction* selectAll = actionCollection()->addAction(QStringLiteral("select_all"));
selectAll->setText(i18nc("@action:inmenu Edit", "Select All"));
selectAll->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-all")));
actionCollection()->setDefaultShortcut(selectAll, Qt::CTRL | Qt::Key_A);
actionCollection()->setDefaultShortcut(selectAll, Qt::CTRL + Qt::Key_A);
connect(selectAll, &QAction::triggered, this, &DolphinMainWindow::selectAll);
QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection"));
invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
invertSelection->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-invert")));
actionCollection()->setDefaultShortcut(invertSelection, Qt::CTRL | Qt::SHIFT | Qt::Key_A);
actionCollection()->setDefaultShortcut(invertSelection, Qt::CTRL + Qt::SHIFT + Qt::Key_A);
connect(invertSelection, &QAction::triggered, this, &DolphinMainWindow::invertSelection);
// setup 'View' menu
......@@ -1103,7 +1103,7 @@ void DolphinMainWindow::setupActions()
connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView);
QAction* stashSplit = actionCollection()->addAction(QStringLiteral("split_stash"));
actionCollection()->setDefaultShortcut(stashSplit, Qt::CTRL | Qt::Key_S);
actionCollection()->setDefaultShortcut(stashSplit, Qt::CTRL + Qt::Key_S);
stashSplit->setText(i18nc("@action:intoolbar Stash", "Stash"));
stashSplit->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window"));
stashSplit->setIcon(QIcon::fromTheme(QStringLiteral("folder-stash")));
......@@ -1130,7 +1130,7 @@ void DolphinMainWindow::setupActions()
QAction* replaceLocation = actionCollection()->addAction(QStringLiteral("replace_location"));
replaceLocation->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
actionCollection()->setDefaultShortcut(replaceLocation, Qt::CTRL | Qt::Key_L);
actionCollection()->setDefaultShortcut(replaceLocation, Qt::CTRL + Qt::Key_L);
connect(replaceLocation, &QAction::triggered, this, &DolphinMainWindow::replaceLocation);
// setup 'Go' menu
......@@ -1150,7 +1150,7 @@ void DolphinMainWindow::setupActions()
QAction* undoCloseTab = actionCollection()->addAction(QStringLiteral("undo_close_tab"));
undoCloseTab->setText(i18nc("@action:inmenu File", "Undo close tab"));
actionCollection()->setDefaultShortcut(undoCloseTab, Qt::CTRL | Qt::SHIFT | Qt::Key_T);
actionCollection()->setDefaultShortcut(undoCloseTab, Qt::CTRL + Qt::SHIFT + Qt::Key_T);
undoCloseTab->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo")));
undoCloseTab->setEnabled(false);
connect(undoCloseTab, &QAction::triggered, recentTabsMenu, &DolphinRecentTabsMenu::undoCloseTab);
......@@ -1180,7 +1180,7 @@ void DolphinMainWindow::setupActions()
QAction* openTerminal = actionCollection()->addAction(QStringLiteral("open_terminal"));
openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
openTerminal->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal")));
actionCollection()->setDefaultShortcut(openTerminal, Qt::SHIFT | Qt::Key_F4);
actionCollection()->setDefaultShortcut(openTerminal, Qt::SHIFT + Qt::Key_F4);
connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal);
}
#endif
......@@ -1193,10 +1193,10 @@ void DolphinMainWindow::setupActions()
// not in menu actions
QList<QKeySequence> nextTabKeys = KStandardShortcut::tabNext();
nextTabKeys.append(QKeySequence(Qt::CTRL | Qt::Key_Tab));
nextTabKeys.append(QKeySequence(Qt::CTRL + Qt::Key_Tab));
QList<QKeySequence> prevTabKeys = KStandardShortcut::tabPrev();
prevTabKeys.append(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Tab));
prevTabKeys.append(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab));
QAction* activateNextTab = actionCollection()->addAction(QStringLiteral("activate_next_tab"));
activateNextTab->setIconText(i18nc("@action:inmenu", "Next Tab"));
......
......@@ -174,7 +174,7 @@ void DolphinPart::createActions()
QAction* selectItemsMatching = actionCollection()->addAction(QStringLiteral("select_items_matching"));
selectItemsMatching->setText(i18nc("@action:inmenu Edit", "Select Items Matching..."));
actionCollection()->setDefaultShortcut(selectItemsMatching, Qt::CTRL | Qt::Key_S);
actionCollection()->setDefaultShortcut(selectItemsMatching, Qt::CTRL + Qt::Key_S);
connect(selectItemsMatching, &QAction::triggered, this, &DolphinPart::slotSelectItemsMatchingPattern);
QAction* unselectItemsMatching = actionCollection()->addAction(QStringLiteral("unselect_items_matching"));
......@@ -189,7 +189,7 @@ void DolphinPart::createActions()
QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection"));
invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
actionCollection()->setDefaultShortcut(invertSelection, Qt::CTRL | Qt::SHIFT | Qt::Key_A);
actionCollection()->setDefaultShortcut(invertSelection, Qt::CTRL + Qt::SHIFT + Qt::Key_A);
connect(invertSelection, &QAction::triggered, m_view, &DolphinView::invertSelection);
// View menu: all done by DolphinViewActionHandler
......@@ -219,7 +219,7 @@ void DolphinPart::createActions()
// Tools menu
m_findFileAction = actionCollection()->addAction(QStringLiteral("find_file"));
m_findFileAction->setText(i18nc("@action:inmenu Tools", "Find File..."));
actionCollection()->setDefaultShortcut(m_findFileAction, Qt::CTRL | Qt::Key_F);
actionCollection()->setDefaultShortcut(m_findFileAction, Qt::CTRL + Qt::Key_F);
m_findFileAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-find")));
connect(m_findFileAction, &QAction::triggered, this, &DolphinPart::slotFindFile);
......
......@@ -45,7 +45,7 @@ FileMetaDataConfigurationDialog::FileMetaDataConfigurationDialog(QWidget* parent
setLayout(mainLayout);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
okButton->setShortcut(Qt::CTRL + Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &FileMetaDataConfigurationDialog::slotAccepted);
connect(buttonBox, &QDialogButtonBox::rejected, this, &FileMetaDataConfigurationDialog::reject);
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
......
......@@ -85,7 +85,7 @@ AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent,
layout->addWidget(buttonBox);
auto okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
okButton->setShortcut(Qt::CTRL + Qt::Key_Return);
okButton->setDefault(true);
const KConfigGroup dialogConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "AdditionalInfoDialog");
......
......@@ -79,6 +79,6 @@ ConfigurePreviewPluginDialog::ConfigurePreviewPluginDialog(const QString& plugin
layout->addWidget(buttonBox);
auto okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
okButton->setShortcut(Qt::CTRL + Qt::Key_Return);
okButton->setDefault(true);
}
......@@ -198,7 +198,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
layout->addWidget(buttonBox);
auto okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
okButton->setShortcut(Qt::CTRL + Qt::Key_Return);
okButton->setDefault(true);
auto applyButton = buttonBox->button(QDialogButtonBox::Apply);
......
......@@ -499,7 +499,7 @@ KToggleAction* DolphinViewActionHandler::iconsModeAction()
KToggleAction* iconsView = m_actionCollection->add<KToggleAction>(QStringLiteral("icons"));
iconsView->setText(i18nc("@action:inmenu View Mode", "Icons"));
iconsView->setToolTip(i18nc("@info", "Icons view mode"));
m_actionCollection->setDefaultShortcut(iconsView, Qt::CTRL | Qt::Key_1);
m_actionCollection->setDefaultShortcut(iconsView, Qt::CTRL + Qt::Key_1);
iconsView->setIcon(QIcon::fromTheme(QStringLiteral("view-list-icons")));
iconsView->setData(QVariant::fromValue(DolphinView::IconsView));
return iconsView;
......@@ -510,7 +510,7 @@ KToggleAction* DolphinViewActionHandler::compactModeAction()
KToggleAction* iconsView = m_actionCollection->add<KToggleAction>(QStringLiteral("compact"));
iconsView->setText(i18nc("@action:inmenu View Mode", "Compact"));
iconsView->setToolTip(i18nc("@info", "Compact view mode"));
m_actionCollection->setDefaultShortcut(iconsView, Qt::CTRL | Qt::Key_2);
m_actionCollection->setDefaultShortcut(iconsView, Qt::CTRL + Qt::Key_2);
iconsView->setIcon(QIcon::fromTheme(QStringLiteral("view-list-details"))); // TODO: discuss with Oxygen-team the wrong (?) name
iconsView->setData(QVariant::fromValue(DolphinView::CompactView));
return iconsView;
......@@ -521,7 +521,7 @@ KToggleAction* DolphinViewActionHandler::detailsModeAction()
KToggleAction* detailsView = m_actionCollection->add<KToggleAction>(QStringLiteral("details"));
detailsView->setText(i18nc("@action:inmenu View Mode", "Details"));
detailsView->setToolTip(i18nc("@info", "Details view mode"));
m_actionCollection->setDefaultShortcut(detailsView, Qt::CTRL | Qt::Key_3);
m_actionCollection->setDefaultShortcut(detailsView, Qt::CTRL + Qt::Key_3);
detailsView->setIcon(QIcon::fromTheme(QStringLiteral("view-list-tree")));
detailsView->setData(QVariant::fromValue(DolphinView::DetailsView));
return detailsView;
......
......@@ -60,7 +60,7 @@ RenameDialog::RenameDialog(QWidget *parent, const KFileItemList& items) :
setLayout(mainLayout);
m_okButton = buttonBox->button(QDialogButtonBox::Ok);
m_okButton->setDefault(true);
m_okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
m_okButton->setShortcut(Qt::CTRL + Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &RenameDialog::slotAccepted);
connect(buttonBox, &QDialogButtonBox::rejected, this, &RenameDialog::reject);
m_okButton->setDefault(true);
......
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