[Option][GUI] Disable edit by Up
This commit is contained in:
parent
62de69cbbc
commit
2e540d4d94
5 changed files with 20 additions and 10 deletions
|
|
@ -32,6 +32,7 @@
|
|||
"ktg_settings_sticker_scale_both": "Apply to sticker width",
|
||||
"ktg_settings_sticker_scale_both_about": "When enabled, sticker maximum width will be changed along with sticker height.",
|
||||
"ktg_settings_emoji_outline": "Big emoji outline",
|
||||
"ktg_settings_disable_up_edit": "Disable edit by Up key",
|
||||
"ktg_settings_always_show_scheduled": "Always show scheduled",
|
||||
"ktg_fonts_title": "Fonts",
|
||||
"ktg_settings_fonts": "Change application fonts",
|
||||
|
|
|
|||
|
|
@ -6742,15 +6742,17 @@ void HistoryWidget::keyPressEvent(QKeyEvent *e) {
|
|||
} else if (e->key() == Qt::Key_Down && !commonModifiers) {
|
||||
_scroll->keyPressEvent(e);
|
||||
} else if (e->key() == Qt::Key_Up && !commonModifiers) {
|
||||
const auto item = _history
|
||||
? _history->lastEditableMessage()
|
||||
: nullptr;
|
||||
if (item
|
||||
&& _field->empty()
|
||||
&& !_editMsgId
|
||||
&& !_replyTo) {
|
||||
editMessage(item, {});
|
||||
return;
|
||||
if (!::Kotato::JsonSettings::GetBool("disable_up_edit")) {
|
||||
const auto item = _history
|
||||
? _history->lastEditableMessage()
|
||||
: nullptr;
|
||||
if (item
|
||||
&& _field->empty()
|
||||
&& !_editMsgId
|
||||
&& !_replyTo) {
|
||||
editMessage(item, {});
|
||||
return;
|
||||
}
|
||||
}
|
||||
_scroll->keyPressEvent(e);
|
||||
} else if (e->key() == Qt::Key_Up
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "history/view/controls/history_view_compose_controls.h"
|
||||
|
||||
#include "kotato/kotato_settings.h"
|
||||
#include "base/call_delayed.h"
|
||||
#include "base/event_filter.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
|
|
@ -1539,7 +1540,9 @@ void ComposeControls::initKeyHandler() {
|
|||
_attachRequests.fire({});
|
||||
return;
|
||||
}
|
||||
if (key == Qt::Key_Up && !hasModifiers) {
|
||||
if (key == Qt::Key_Up
|
||||
&& !hasModifiers
|
||||
&& !::Kotato::JsonSettings::GetBool("disable_up_edit")) {
|
||||
if (!isEditingMessage() && _field->empty()) {
|
||||
_editLastMessageRequests.fire(std::move(keyEvent));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -249,6 +249,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
|||
.type = SettingType::IntSetting,
|
||||
.defaultValue = 2,
|
||||
.limitHandler = IntLimit(0, 2, 2), }},
|
||||
{ "disable_up_edit", {
|
||||
.type = SettingType::BoolSetting,
|
||||
.defaultValue = false, }},
|
||||
};
|
||||
|
||||
using OldOptionKey = QString;
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ void SetupKotatoChats(
|
|||
Ui::AddSkip(container);
|
||||
Ui::AddSubsectionTitle(container, rktr("ktg_settings_chats"));
|
||||
|
||||
SettingsMenuJsonSwitch(ktg_settings_disable_up_edit, disable_up_edit);
|
||||
SettingsMenuJsonSwitch(ktg_settings_always_show_scheduled, always_show_scheduled);
|
||||
|
||||
container->add(object_ptr<Button>(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue