From ac7958f33503d796e02ba5e364e5a04d762e73fa Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 16 Jan 2024 13:03:44 +0400 Subject: [PATCH] Remove ctrl+shift+N shortcuts by default. Those are used in some input methods, including Farsi. You can always add such bindings in tdata/shortcuts-custom.json for the "account1", "account2", etc commands. Fixes #27334. --- Telegram/SourceFiles/core/shortcuts.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index ad4a79eb7..b2190393a 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -410,9 +410,9 @@ void Manager::fillDefaults() { kShowAccount, ranges::views::ints(1, ranges::unreachable)); - for (const auto &[command, index] : accounts) { - set(u"%1+shift+%2"_q.arg(ctrl).arg(index), command); - } + //for (const auto &[command, index] : accounts) { + // set(u"%1+shift+%2"_q.arg(ctrl).arg(index), command); + //} set(u"%1+shift+down"_q.arg(ctrl), Command::FolderNext); set(u"%1+shift+up"_q.arg(ctrl), Command::FolderPrevious); @@ -458,6 +458,18 @@ void Manager::writeDefaultFile() { } } + // Commands without a default value. + for (const auto command : kShowAccount) { + const auto j = CommandNames.find(command); + if (j != CommandNames.end()) { + QJsonObject entry; + entry.insert(u"keys"_q, QJsonValue()); + entry.insert(u"command"_q, j->second); + shortcuts.append(entry); + } + } + + auto document = QJsonDocument(); document.setArray(shortcuts); file.write(document.toJson(QJsonDocument::Indented));