fakevim: add an option to pass Control + <x> directly to Creator core

Original code by dcarr.
This commit is contained in:
hjk
2010-09-24 09:07:08 +02:00
parent 5ad1b35a76
commit 74cf70deaf
5 changed files with 24 additions and 2 deletions

View File

@@ -217,6 +217,13 @@ FakeVimSettings *theFakeVimSettings()
item->setCheckable(true); item->setCheckable(true);
instance->insertItem(ConfigShowMarks, item, _("showmarks"), _("sm")); instance->insertItem(ConfigShowMarks, item, _("showmarks"), _("sm"));
item = new SavedAction(instance);
item->setDefaultValue(false);
item->setValue(false);
item->setSettingsKey(group, _("PassControlKey"));
item->setCheckable(true);
instance->insertItem(ConfigPassControlKey, item, _("passcontrolkey"), _("pck"));
return instance; return instance;
} }

View File

@@ -66,6 +66,7 @@ enum FakeVimSettingsCode
// other actions // other actions
ConfigShowMarks, ConfigShowMarks,
ConfigPassControlKey
}; };
class FakeVimSettings : public QObject class FakeVimSettings : public QObject

View File

@@ -1029,6 +1029,7 @@ bool FakeVimHandler::Private::wantsOverride(QKeyEvent *ev)
// We are interested in overriding most Ctrl key combinations // We are interested in overriding most Ctrl key combinations
if (mods == Qt::ControlModifier if (mods == Qt::ControlModifier
&& !config(ConfigPassControlKey).toBool()
&& ((key >= Key_A && key <= Key_Z && key != Key_K) && ((key >= Key_A && key <= Key_Z && key != Key_K)
|| key == Key_BracketLeft || key == Key_BracketRight)) { || key == Key_BracketLeft || key == Key_BracketRight)) {
// Ctrl-K is special as it is the Core's default notion of Locator // Ctrl-K is special as it is the Core's default notion of Locator

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>472</width> <width>472</width>
<height>420</height> <height>421</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
@@ -80,6 +80,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2">
<widget class="QCheckBox" name="checkBoxPassControlKey">
<property name="toolTip">
<string>Checking this box passes key sequences like Ctrl-S to the Creator core instead of interpreting them in FakeVim. This gives easier access to Creator core functionality at the price of losing some features of FakeVim.</string>
</property>
<property name="text">
<string>Pass control key</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2"> <item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxHlSearch"> <widget class="QCheckBox" name="checkBoxHlSearch">
<property name="text"> <property name="text">

View File

@@ -183,6 +183,8 @@ QWidget *FakeVimOptionPage::createPage(QWidget *parent)
m_group.insert(theFakeVimSetting(ConfigIsKeyword), m_group.insert(theFakeVimSetting(ConfigIsKeyword),
m_ui.lineEditIsKeyword); m_ui.lineEditIsKeyword);
m_group.insert(theFakeVimSetting(ConfigPassControlKey),
m_ui.checkBoxPassControlKey);
m_group.insert(theFakeVimSetting(ConfigAutoIndent), m_group.insert(theFakeVimSetting(ConfigAutoIndent),
m_ui.checkBoxAutoIndent); m_ui.checkBoxAutoIndent);
m_group.insert(theFakeVimSetting(ConfigSmartIndent), m_group.insert(theFakeVimSetting(ConfigSmartIndent),
@@ -204,6 +206,7 @@ QWidget *FakeVimOptionPage::createPage(QWidget *parent)
<< ' ' << m_ui.checkBoxExpandTab->text() << ' ' << m_ui.checkBoxExpandTab->text()
<< ' ' << m_ui.checkBoxShowMarks->text() << ' ' << m_ui.checkBoxShowMarks->text()
<< ' ' << m_ui.checkBoxSmartIndent->text() << ' ' << m_ui.checkBoxSmartIndent->text()
<< ' ' << m_ui.checkBoxPassControlKey->text()
<< ' ' << m_ui.checkBoxHlSearch->text() << ' ' << m_ui.checkBoxHlSearch->text()
<< ' ' << m_ui.checkBoxIncSearch->text() << ' ' << m_ui.checkBoxIncSearch->text()
<< ' ' << m_ui.checkBoxSmartTab->text() << ' ' << m_ui.checkBoxSmartTab->text()