mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Option to disable Up shortcut to edit in chat
This commit is contained in:
@@ -225,6 +225,11 @@ bool Manager::readCustomFile() {
|
||||
SetDialogListLines(settingsChatListLines);
|
||||
}
|
||||
}
|
||||
|
||||
const auto settingsDisableUpEditIt = settings.constFind(qsl("disable_up_edit"));
|
||||
if (settingsDisableUpEditIt != settings.constEnd() && (*settingsDisableUpEditIt).isBool()) {
|
||||
cSetDisableUpEdit((*settingsDisableUpEditIt).toBool());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -260,6 +265,7 @@ void Manager::writeDefaultFile() {
|
||||
settings.insert(qsl("net_speed_boost"), QJsonValue(QJsonValue::Null));
|
||||
settings.insert(qsl("show_phone_in_drawer"), cShowPhoneInDrawer());
|
||||
settings.insert(qsl("chat_list_lines"), DialogListLines());
|
||||
settings.insert(qsl("disable_up_edit"), cDisableUpEdit());
|
||||
|
||||
auto settingsScales = QJsonArray();
|
||||
settings.insert(qsl("scales"), settingsScales);
|
||||
@@ -313,6 +319,7 @@ void Manager::writeCurrentSettings() {
|
||||
settings.insert(qsl("net_speed_boost"), cNetSpeedBoost());
|
||||
settings.insert(qsl("show_phone_in_drawer"), cShowPhoneInDrawer());
|
||||
settings.insert(qsl("chat_list_lines"), DialogListLines());
|
||||
settings.insert(qsl("disable_up_edit"), cDisableUpEdit());
|
||||
|
||||
auto settingsScales = QJsonArray();
|
||||
auto currentScales = cInterfaceScales();
|
||||
|
@@ -5523,16 +5523,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->lastSentMessage()
|
||||
: nullptr;
|
||||
if (item
|
||||
&& item->allowsEdit(base::unixtime::now())
|
||||
&& _field->empty()
|
||||
&& !_editMsgId
|
||||
&& !_replyToId) {
|
||||
editMessage(item);
|
||||
return;
|
||||
if (!cDisableUpEdit()) {
|
||||
const auto item = _history
|
||||
? _history->lastSentMessage()
|
||||
: 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) {
|
||||
|
@@ -271,3 +271,5 @@ int DialogListLines() {
|
||||
rpl::producer<int> DialogListLinesChanges() {
|
||||
return gDialogListLines.changes();
|
||||
}
|
||||
|
||||
bool gDisableUpEdit = false;
|
@@ -226,3 +226,5 @@ void ClearCustomScales();
|
||||
void SetDialogListLines(int lines);
|
||||
[[nodiscard]] int DialogListLines();
|
||||
[[nodiscard]] rpl::producer<int> DialogListLinesChanges();
|
||||
|
||||
DeclareSetting(bool, DisableUpEdit);
|
||||
|
Reference in New Issue
Block a user