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