| 1 |
Fromscip-debian debian fcitx-kkc 0.1.4-3.1 fcitx-kkc/patches/`0005-If-insertion-is-failed-do-not-change-the-model.patch`#From.: Weng Xuetian <[email protected]scip-debian . . . identity/`[email protected]`.> |
| 2 |
Datescip-debian debian fcitx-kkc 0.1.4-3.1 fcitx-kkc/patches/`0005-If-insertion-is-failed-do-not-change-the-model.patch`#Date.: Sun, 18 Mar 2018 11:22:50 -0700 |
| 3 |
Subjectscip-debian debian fcitx-kkc 0.1.4-3.1 fcitx-kkc/patches/`0005-If-insertion-is-failed-do-not-change-the-model.patch`#Subject.: If insertion is failed, do not change the model. |
| 4 |
|
| 5 |
--- |
| 6 |
gui/shortcutmodel.cpp | 14 ++++++-------- |
| 7 |
1 file changed, 6 insertions(+), 8 deletions(-) |
| 8 |
|
| 9 |
diff --git a/gui/shortcutmodel.cppscip-debian debian fcitx-kkc 0.1.4-3.1 fcitx-kkc/upstream/`gui/shortcutmodel.cpp`: b/gui/shortcutmodel.cppscip-debian debian fcitx-kkc 0.1.4-3.1 fcitx-kkc/upstream/`gui/shortcutmodel.cpp`: |
| 10 |
index 22f2710..52fc745 100644 |
| 11 |
--- a/gui/shortcutmodel.cpp |
| 12 |
+++ b/gui/shortcutmodel.cpp |
| 13 |
@@ -166,20 +166,18 @@ bool ShortcutModel::add(const ShortcutEntry& entry) |
| 14 |
{ |
| 15 |
KkcKeymap* map = kkc_rule_get_keymap(KKC_RULE(m_userRule), entry.mode()); |
| 16 |
bool result = true; |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
+ if (kkc_keymap_lookup_key(map, entry.event())) { |
| 22 |
+ result = false; |
| 23 |
+ } |
| 24 |
+ |
| 25 |
+ if (result) { |
| 26 |
beginInsertRows(QModelIndex(), m_entries.size(), m_entries.size()); |
| 27 |
m_entries << entry; |
| 28 |
kkc_keymap_set(map, entry.event(), entry.command().toUtf8().constData()); |
| 29 |
endInsertRows(); |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
setNeedSave(true); |
| 35 |
} |
| 36 |
+ g_object_unref(map); |
| 37 |
|
| 38 |
return result; |
| 39 |
} |