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

List:       kde-commits
Subject:    [ktexteditor] src/view: add input mode switch shortcut
From:       Michal Humpula <michal.humpula () hudrydum ! cz>
Date:       2015-10-11 8:01:23
Message-ID: E1ZlBZL-0005Db-H2 () scm ! kde ! org
[Download RAW message or body]

Git commit 60c59becf13eb35e7dc558e0dc7a643260910c1b by Michal Humpula.
Committed on 11/10/2015 at 08:00.
Pushed by michalhumpula into branch 'master'.

add input mode switch shortcut

BUG: 347769
REVIEW: 125592

M  +13   -0    src/view/kateview.cpp
M  +1    -0    src/view/kateview.h

http://commits.kde.org/ktexteditor/60c59becf13eb35e7dc558e0dc7a643260910c1b

diff --git a/src/view/kateview.cpp b/src/view/kateview.cpp
index 1b4f620..f23bc39 100644
--- a/src/view/kateview.cpp
+++ b/src/view/kateview.cpp
@@ -673,6 +673,12 @@ void KTextEditor::ViewPrivate::setupActions()
     a->setWhatsThis(i18n("This command allows switching between the normal (line based) selection mode \
and the block selection mode."));  connect(a, SIGNAL(triggered(bool)), SLOT(toggleBlockSelection()));
 
+    a = ac->addAction(QLatin1String("switch_next_input_mode"));
+    a->setText(i18n("Switch to Next Input Mode"));
+    ac->setDefaultShortcut(a, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V));
+    a->setWhatsThis(i18n("Switch to the next input mode."));
+    connect(a, SIGNAL(triggered(bool)), SLOT(cycleInputMode()));
+
     a = m_toggleInsert = new KToggleAction(i18n("Overwr&ite Mode"), this);
     ac->addAction(QLatin1String("set_insert"), a);
     ac->setDefaultShortcut(a, QKeySequence(Qt::Key_Insert));
@@ -3551,6 +3557,13 @@ void KTextEditor::ViewPrivate::toggleInputMode(bool on)
     setInputMode(newmode);
 }
 
+void KTextEditor::ViewPrivate::cycleInputMode()
+{
+    InputMode current = currentInputMode()->viewInputMode();
+    InputMode to = (current == KTextEditor::View::NormalInputMode) ? KTextEditor::View::ViInputMode : \
KTextEditor::View::NormalInputMode; +    setInputMode(to);
+}
+
 //BEGIN KTextEditor::PrintInterface stuff
 bool KTextEditor::ViewPrivate::print()
 {
diff --git a/src/view/kateview.h b/src/view/kateview.h
index e7ddd3a..08db0df 100644
--- a/src/view/kateview.h
+++ b/src/view/kateview.h
@@ -551,6 +551,7 @@ private Q_SLOTS:
     void slotSelectionChanged();
 
     void toggleInputMode(bool);
+    void cycleInputMode();
 
 public:
     /**


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

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