diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 727b317..38c4081 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -243,6 +243,10 @@ Page { } else { tdLibWrapper.sendTextMessage(chatInformation.id, newMessageTextField.text, newMessageColumn.replyToMessageId); } + + if(appSettings.focusTextAreaAfterSend) { + lostFocusTimer.start(); + } } controlSendButton(); newMessageInReplyToRow.inReplyToMessage = null; @@ -1507,7 +1511,9 @@ Page { if (appSettings.sendByEnter) { sendMessage(); newMessageTextField.text = ""; - newMessageTextField.focus = false; + if(!appSettings.focusTextAreaAfterSend) { + newMessageTextField.focus = false; + } } } @@ -1546,7 +1552,9 @@ Page { onClicked: { sendMessage(); newMessageTextField.text = ""; - newMessageTextField.focus = false; + if(!appSettings.focusTextAreaAfterSend) { + newMessageTextField.focus = false; + } } } } diff --git a/qml/pages/SettingsPage.qml b/qml/pages/SettingsPage.qml index e9abe19..800d5ef 100644 --- a/qml/pages/SettingsPage.qml +++ b/qml/pages/SettingsPage.qml @@ -52,6 +52,16 @@ Page { } } + TextSwitch { + checked: appSettings.focusTextAreaAfterSend + text: qsTr("Focus text input area after send") + description: qsTr("Focus the text input area after sending a message") + automaticCheck: false + onClicked: { + appSettings.focusTextAreaAfterSend = !checked + } + } + TextSwitch { checked: appSettings.useOpenWith text: qsTr("Open-with menu integration") diff --git a/src/appsettings.cpp b/src/appsettings.cpp index 497578f..0924a42 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -22,6 +22,7 @@ namespace { const QString KEY_SEND_BY_ENTER("sendByEnter"); + const QString KEY_FOCUS_TEXTAREA_AFTER_SEND("focusTextAreaAfterSend"); const QString KEY_USE_OPEN_WITH("useOpenWith"); const QString KEY_SHOW_STICKERS_AS_IMAGES("showStickersAsImages"); const QString KEY_ANIMATE_STICKERS("animateStickers"); @@ -48,6 +49,20 @@ void AppSettings::setSendByEnter(bool sendByEnter) } } +bool AppSettings::getFocusTextAreaAfterSend() const +{ + return settings.value(KEY_FOCUS_TEXTAREA_AFTER_SEND, false).toBool(); +} + +void AppSettings::setFocusTextAreaAfterSend(bool focusTextAreaAfterSend) +{ + if (getFocusTextAreaAfterSend() != focusTextAreaAfterSend) { + LOG(KEY_FOCUS_TEXTAREA_AFTER_SEND << focusTextAreaAfterSend); + settings.setValue(KEY_FOCUS_TEXTAREA_AFTER_SEND, focusTextAreaAfterSend); + emit focusTextAreaAfterSendChanged(); + } +} + bool AppSettings::getUseOpenWith() const { return settings.value(KEY_USE_OPEN_WITH, true).toBool(); diff --git a/src/appsettings.h b/src/appsettings.h index bb63cdf..a040e60 100644 --- a/src/appsettings.h +++ b/src/appsettings.h @@ -24,6 +24,7 @@ class AppSettings : public QObject { Q_OBJECT Q_PROPERTY(bool sendByEnter READ getSendByEnter WRITE setSendByEnter NOTIFY sendByEnterChanged) + Q_PROPERTY(bool focusTextAreaAfterSend READ getFocusTextAreaAfterSend WRITE setFocusTextAreaAfterSend NOTIFY focusTextAreaAfterSendChanged) Q_PROPERTY(bool useOpenWith READ getUseOpenWith WRITE setUseOpenWith NOTIFY useOpenWithChanged) Q_PROPERTY(bool showStickersAsImages READ showStickersAsImages WRITE setShowStickersAsImages NOTIFY showStickersAsImagesChanged) Q_PROPERTY(bool animateStickers READ animateStickers WRITE setAnimateStickers NOTIFY animateStickersChanged) @@ -45,6 +46,9 @@ public: bool getSendByEnter() const; void setSendByEnter(bool sendByEnter); + bool getFocusTextAreaAfterSend() const; + void setFocusTextAreaAfterSend(bool focusTextAreaAfterSend); + bool getUseOpenWith() const; void setUseOpenWith(bool useOpenWith); @@ -65,6 +69,7 @@ public: signals: void sendByEnterChanged(); + void focusTextAreaAfterSendChanged(); void useOpenWithChanged(); void showStickersAsImagesChanged(); void animateStickersChanged(); diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 489527b..4e13c72 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1391,6 +1391,14 @@ Enable storage optimizer Speicheroptimierer einschalten + + Focus text input area after send + Texteingabe nach Senden fokussieren + + + Focus the text input area after sending a message + Fokussiert die Texteingabe nach Senden einer Nachricht + StickerPicker diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 701afc6..aae0a43 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1391,6 +1391,14 @@ Enable storage optimizer Enable storage optimizer + + Focus text input area after send + Focus text input area after send + + + Focus the text input area after sending a message + Focus the text input area after sending a message + StickerPicker @@ -1803,21 +1811,21 @@ has added %1 to the chat - has added %1 to the chat + has added %1 to the chat has removed %1 from the chat - has removed %1 from the chat + has removed %1 from the chat have added %1 to the chat myself - have added %1 to the chat + have added %1 to the chat have removed %1 from the chat myself - have removed %1 from the chat + have removed %1 from the chat diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 77f11f8..e5e8efc 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1372,6 +1372,14 @@ Enable storage optimizer Optimizador de almacenamiento + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 0882c32..7f0d06b 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1392,6 +1392,14 @@ Enable storage optimizer Käytä tallennustilan optimointia + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 7ca1400..32fcc07 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1372,6 +1372,14 @@ Enable storage optimizer + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 3c2baf9..37072ec 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1391,6 +1391,14 @@ Enable storage optimizer Abilita ottimizzazione memoria + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index c2b925d..e6389ce 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1410,6 +1410,14 @@ Enable storage optimizer Włącz optymalizację pamięci + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 72454c2..ccc1434 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1410,6 +1410,14 @@ Enable storage optimizer Включить оптимизацию хранилища + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index c649561..9d0eeff 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1391,6 +1391,14 @@ Enable storage optimizer Aktivera lagringsoptimering + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 8e4f8f9..424535d 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1372,6 +1372,14 @@ Enable storage optimizer 启用储存加速器 + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 8005242..3468e69 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1391,6 +1391,14 @@ Enable storage optimizer + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker