Commit 2b188ceb authored by Eric Armbruster's avatar Eric Armbruster 🍁 Committed by Christoph Cullmann
Browse files

Assign more shortcuts using Ctrl+T as pseudo meta key

This commit introduces Ctrl+T as pseudo meta. We assign emacs style
shortcuts using this pseudo meta key to actions that are typically not
triggered multiple times in quick succession such as opening a dialog.

Ref #87
parent 98c83562
Pipeline #238349 passed with stage
in 8 minutes and 7 seconds
......@@ -28,6 +28,7 @@
#include <QUrl>
#include <QFontMetrics>
#include <QKeySequence>
#include <QLayout>
#include <QPainter>
#include <QVariant>
......@@ -166,7 +167,7 @@ KateGitBlamePluginView::KateGitBlamePluginView(KateGitBlamePlugin *plugin, KText
setXMLFile(QStringLiteral("ui.rc"));
QAction *showBlameAction = actionCollection()->addAction(QStringLiteral("git_blame_show"));
showBlameAction->setText(i18n("Show Git Blame Details"));
actionCollection()->setDefaultShortcut(showBlameAction, Qt::CTRL | Qt::ALT | Qt::Key_G);
actionCollection()->setDefaultShortcut(showBlameAction, QKeySequence(QStringLiteral("Ctrl+T, B"), QKeySequence::PortableText));
QAction *toggleBlameAction = actionCollection()->addAction(QStringLiteral("git_blame_toggle"));
toggleBlameAction->setText(i18n("Toggle Git Blame Details"));
m_mainWindow->guiFactory()->addClient(this);
......
......@@ -50,6 +50,7 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <QKeyEvent>
#include <QKeySequence>
#include <QMenu>
#include <QPainter>
#include <QPlainTextEdit>
......@@ -620,6 +621,7 @@ public:
format();
});
m_triggerFormat->setText(i18n("Format"));
actionCollection()->setDefaultShortcut(m_triggerFormat, QKeySequence(QStringLiteral("Ctrl+T, F"), QKeySequence::PortableText));
m_triggerRename = actionCollection()->addAction(QStringLiteral("lspclient_rename"), this, &self_type::rename);
m_triggerRename->setText(i18n("Rename"));
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5, 95, 0)
......
......@@ -27,6 +27,7 @@
#include <QEvent>
#include <QHeaderView>
#include <QInputMethodEvent>
#include <QKeySequence>
#include <QLineEdit>
#include <QMap>
#include <QMenu>
......@@ -50,6 +51,7 @@
#include <KTextEditor/View>
#include <kfts_fuzzy_match.h>
#include <qkeysequence.h>
class NumStatStyle final : public QStyledItemDelegate
{
......@@ -231,6 +233,7 @@ GitWidget::GitWidget(KateProject *project, KTextEditor::MainWindow *mainWindow,
a->setIcon(QIcon::fromTheme(QStringLiteral("vcs-push")));
a->setText(pushText);
a->setToolTip(pushText);
ac->setDefaultShortcut(a, QKeySequence(QStringLiteral("Ctrl+T, P"), QKeySequence::PortableText));
m_pushBtn->setDefaultAction(a);
const QString &pullText = i18n("Git Pull");
......@@ -240,6 +243,7 @@ GitWidget::GitWidget(KateProject *project, KTextEditor::MainWindow *mainWindow,
connect(&ppd, &PushPullDialog::runGitCommand, this, &GitWidget::runPushPullCmd);
ppd.openDialog(PushPullDialog::Pull);
});
ac->setDefaultShortcut(a, QKeySequence(QStringLiteral("Ctrl+T, U"), QKeySequence::PortableText));
a->setIcon(QIcon::fromTheme(QStringLiteral("vcs-pull")));
a->setText(pullText);
a->setToolTip(pullText);
......@@ -310,6 +314,7 @@ GitWidget::GitWidget(KateProject *project, KTextEditor::MainWindow *mainWindow,
openCommitChangesDialog();
slotUpdateStatus();
});
ac->setDefaultShortcut(a, QKeySequence(QStringLiteral("Ctrl+T, K"), QKeySequence::PortableText));
a->setText(commitText);
a->setToolTip(commitText);
a->setIcon(commitIcon);
......@@ -902,6 +907,7 @@ void GitWidget::buildMenu(KActionCollection *ac)
});
a->setIcon(QIcon::fromTheme(QStringLiteral("document-edit")));
a->setText(i18n("Amend Last Commit"));
ac->setDefaultShortcut(a, QKeySequence(QStringLiteral("Ctrl+T, Ctrl+K"), QKeySequence::PortableText));
m_gitMenu->addAction(a);
a = ac->addAction(QStringLiteral("vcs_branch_checkout"), this, [this] {
......@@ -910,6 +916,7 @@ void GitWidget::buildMenu(KActionCollection *ac)
});
a->setText(i18n("Checkout Branch"));
a->setIcon(QIcon::fromTheme(QStringLiteral("vcs-branch")));
ac->setDefaultShortcut(a, QKeySequence(QStringLiteral("Ctrl+T, C"), QKeySequence::PortableText));
m_gitMenu->addAction(a);
a = ac->addAction(QStringLiteral("vcs_branch_delete"), this, [this] {
......
......@@ -170,6 +170,7 @@ KateProjectPluginView::KateProjectPluginView(KateProjectPlugin *plugin, KTextEdi
auto a = actionCollection()->addAction(QStringLiteral("projects_open_project"), this, SLOT(openDirectoryOrProject()));
a->setText(i18n("Open Folder..."));
a->setIcon(QIcon::fromTheme(QStringLiteral("document-open-folder")));
actionCollection()->setDefaultShortcut(a, QKeySequence(QKeySequence(QStringLiteral("Ctrl+T, O"), QKeySequence::PortableText)));
m_projectTodosAction = a = actionCollection()->addAction(QStringLiteral("projects_todos"), this, SLOT(showProjectTodos()));
a->setText(i18n("Project TODOs"));
......
Supports Markdown
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