[Option][GUI] Disable edit by Up
This commit is contained in:
parent
a8bae3231f
commit
6b592808ae
5 changed files with 21 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",
|
||||
|
|
|
|||
|
|
@ -6237,15 +6237,18 @@ 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
|
||||
&& !_replyToId) {
|
||||
editMessage(item);
|
||||
return;
|
||||
if (!::Kotato::JsonSettings::GetBool("disable_up_edit")) {
|
||||
const auto item = _history
|
||||
? _history->lastEditableMessage()
|
||||
: nullptr;
|
||||
if (item
|
||||
&& item->allowsEdit(base::unixtime::now())
|
||||
&& _field->empty()
|
||||
&& !_editMsgId
|
||||
&& !_replyToId) {
|
||||
editMessage(item);
|
||||
return;
|
||||
}
|
||||
}
|
||||
_scroll->keyPressEvent(e);
|
||||
} else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
|
||||
|
|
|
|||
|
|
@ -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/event_filter.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "base/qt_signal_producer.h"
|
||||
|
|
@ -1548,7 +1549,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;
|
||||
|
|
|
|||
|
|
@ -289,6 +289,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
|||
.type = SettingType::IntSetting,
|
||||
.defaultValue = 0,
|
||||
.limitHandler = NetSpeedBoostConv(IntLimit(0, 3)), }},
|
||||
{ "disable_up_edit", {
|
||||
.type = SettingType::BoolSetting,
|
||||
.defaultValue = false, }},
|
||||
};
|
||||
|
||||
using OldOptionKey = QString;
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ void SetupKotatoChats(
|
|||
AddSkip(container);
|
||||
AddSubsectionTitle(container, rktr("ktg_settings_chats"));
|
||||
|
||||
SettingsMenuJsonSwitch(ktg_settings_disable_up_edit, disable_up_edit);
|
||||
SettingsMenuJsonSwitch(ktg_settings_always_show_scheduled, always_show_scheduled);
|
||||
|
||||
AddButton(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue