Add focus text on entering chat
This commit is contained in:
Sebastian Wolf 2021-05-20 22:03:23 +02:00 committed by GitHub
commit 2adb002c28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 129 additions and 0 deletions

View file

@ -1899,6 +1899,7 @@ Page {
textLeftMargin: 0 textLeftMargin: 0
textTopMargin: 0 textTopMargin: 0
enabled: !attachmentPreviewRow.isLocation enabled: !attachmentPreviewRow.isLocation
focus: appSettings.focusTextAreaOnChatOpen
EnterKey.onClicked: { EnterKey.onClicked: {
if (appSettings.sendByEnter) { if (appSettings.sendByEnter) {
var messageText = newMessageTextField.text; var messageText = newMessageTextField.text;

View file

@ -548,6 +548,17 @@ Page {
} }
} }
TextSwitch {
width: parent.columnWidth
checked: appSettings.focusTextAreaOnChatOpen
text: qsTr("Focus text input on chat open")
description: qsTr("Focus the text input area when entering a chat")
automaticCheck: false
onClicked: {
appSettings.focusTextAreaOnChatOpen = !checked
}
}
TextSwitch { TextSwitch {
width: parent.columnWidth width: parent.columnWidth
checked: appSettings.focusTextAreaAfterSend checked: appSettings.focusTextAreaAfterSend

View file

@ -34,6 +34,7 @@ namespace {
const QString KEY_REMAINING_INTERACTION_HINTS("remainingInteractionHints"); const QString KEY_REMAINING_INTERACTION_HINTS("remainingInteractionHints");
const QString KEY_ONLINE_ONLY_MODE("onlineOnlyMode"); const QString KEY_ONLINE_ONLY_MODE("onlineOnlyMode");
const QString KEY_DELAY_MESSAGE_READ("delayMessageRead"); const QString KEY_DELAY_MESSAGE_READ("delayMessageRead");
const QString KEY_FOCUS_TEXTAREA_ON_CHAT_OPEN("focusTextAreaOnChatOpen");
} }
AppSettings::AppSettings(QObject *parent) : QObject(parent), settings("harbour-fernschreiber", "settings") AppSettings::AppSettings(QObject *parent) : QObject(parent), settings("harbour-fernschreiber", "settings")
@ -222,3 +223,17 @@ void AppSettings::setDelayMessageRead(bool enable)
emit delayMessageReadChanged(); emit delayMessageReadChanged();
} }
} }
bool AppSettings::getFocusTextAreaOnChatOpen() const
{
return settings.value(KEY_FOCUS_TEXTAREA_ON_CHAT_OPEN, false).toBool();
}
void AppSettings::setFocusTextAreaOnChatOpen(bool focusTextAreaOnChatOpen)
{
if (getFocusTextAreaOnChatOpen() != focusTextAreaOnChatOpen) {
LOG(KEY_FOCUS_TEXTAREA_ON_CHAT_OPEN << focusTextAreaOnChatOpen);
settings.setValue(KEY_FOCUS_TEXTAREA_ON_CHAT_OPEN, focusTextAreaOnChatOpen);
emit focusTextAreaOnChatOpenChanged();
}
}

View file

@ -36,6 +36,8 @@ class AppSettings : public QObject {
Q_PROPERTY(int remainingInteractionHints READ remainingInteractionHints WRITE setRemainingInteractionHints NOTIFY remainingInteractionHintsChanged) Q_PROPERTY(int remainingInteractionHints READ remainingInteractionHints WRITE setRemainingInteractionHints NOTIFY remainingInteractionHintsChanged)
Q_PROPERTY(bool onlineOnlyMode READ onlineOnlyMode WRITE setOnlineOnlyMode NOTIFY onlineOnlyModeChanged) Q_PROPERTY(bool onlineOnlyMode READ onlineOnlyMode WRITE setOnlineOnlyMode NOTIFY onlineOnlyModeChanged)
Q_PROPERTY(bool delayMessageRead READ delayMessageRead WRITE setDelayMessageRead NOTIFY delayMessageReadChanged) Q_PROPERTY(bool delayMessageRead READ delayMessageRead WRITE setDelayMessageRead NOTIFY delayMessageReadChanged)
Q_PROPERTY(bool focusTextAreaOnChatOpen READ getFocusTextAreaOnChatOpen WRITE setFocusTextAreaOnChatOpen NOTIFY focusTextAreaOnChatOpenChanged)
public: public:
enum NotificationFeedback { enum NotificationFeedback {
@ -87,6 +89,9 @@ public:
bool delayMessageRead() const; bool delayMessageRead() const;
void setDelayMessageRead(bool enable); void setDelayMessageRead(bool enable);
bool getFocusTextAreaOnChatOpen() const;
void setFocusTextAreaOnChatOpen(bool focusTextAreaOnChatOpen);
signals: signals:
void sendByEnterChanged(); void sendByEnterChanged();
void focusTextAreaAfterSendChanged(); void focusTextAreaAfterSendChanged();
@ -101,6 +106,7 @@ signals:
void remainingInteractionHintsChanged(); void remainingInteractionHintsChanged();
void onlineOnlyModeChanged(); void onlineOnlyModeChanged();
void delayMessageReadChanged(); void delayMessageReadChanged();
void focusTextAreaOnChatOpenChanged();
private: private:
QSettings settings; QSettings settings;

View file

@ -1709,6 +1709,14 @@
<source>Fernschreiber will wait a bit before messages are marked as read</source> <source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation>Fernschreiber wird ein bisschen warten, bevor Nachrichten als gelesen markiert werden</translation> <translation>Fernschreiber wird ein bisschen warten, bevor Nachrichten als gelesen markiert werden</translation>
</message> </message>
<message>
<source>Focus the text input area when entering a chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Focus text input on chat open</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1711,6 +1711,14 @@ messages</numerusform>
<source>Fernschreiber will wait a bit before messages are marked as read</source> <source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation>Fernschreiber will wait a bit before messages are marked as read</translation> <translation>Fernschreiber will wait a bit before messages are marked as read</translation>
</message> </message>
<message>
<source>Focus the text input area when entering a chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Focus text input on chat open</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1709,6 +1709,14 @@
<source>Fernschreiber will wait a bit before messages are marked as read</source> <source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation>Si esta habilitado, la apl espera un segundo hasta que un mensaje que está en la pantalla se marque como leído. Si deshabilitas esta función, los mensajes se marcarán inmediatamente como leído una vez que esté en la pantalla sin desplazarse al mensaje</translation> <translation>Si esta habilitado, la apl espera un segundo hasta que un mensaje que está en la pantalla se marque como leído. Si deshabilitas esta función, los mensajes se marcarán inmediatamente como leído una vez que esté en la pantalla sin desplazarse al mensaje</translation>
</message> </message>
<message>
<source>Focus the text input area when entering a chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Focus text input on chat open</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1710,6 +1710,14 @@
<source>Fernschreiber will wait a bit before messages are marked as read</source> <source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation>Fernschreiber odottaa hetken ennen kuin viestit merkitään luetuiksi</translation> <translation>Fernschreiber odottaa hetken ennen kuin viestit merkitään luetuiksi</translation>
</message> </message>
<message>
<source>Focus the text input area when entering a chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Focus text input on chat open</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1682,6 +1682,14 @@
<source>Fernschreiber will wait a bit before messages are marked as read</source> <source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Focus the text input area when entering a chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Focus text input on chat open</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1709,6 +1709,14 @@
<source>Fernschreiber will wait a bit before messages are marked as read</source> <source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation>Fernschreiber attende un attimo prima di segnare i messaggi come già letti</translation> <translation>Fernschreiber attende un attimo prima di segnare i messaggi come già letti</translation>
</message> </message>
<message>
<source>Focus the text input area when entering a chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Focus text input on chat open</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1736,6 +1736,14 @@
<source>Fernschreiber will wait a bit before messages are marked as read</source> <source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation>Fernschreiber odczeka chwilę, zanim wiadomości zostaną oznaczone jako przeczytane </translation> <translation>Fernschreiber odczeka chwilę, zanim wiadomości zostaną oznaczone jako przeczytane </translation>
</message> </message>
<message>
<source>Focus the text input area when entering a chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Focus text input on chat open</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1739,6 +1739,14 @@
<source>Fernschreiber will wait a bit before messages are marked as read</source> <source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation>Fernschreiber может отмечать сообщения как прочитанные с некоторой задержкой, а не сразу как только они показываются на экране.</translation> <translation>Fernschreiber может отмечать сообщения как прочитанные с некоторой задержкой, а не сразу как только они показываются на экране.</translation>
</message> </message>
<message>
<source>Focus the text input area when entering a chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Focus text input on chat open</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1736,6 +1736,14 @@
<source>Fernschreiber will wait a bit before messages are marked as read</source> <source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation>Fernschreiber chvíľu počká, kým budú správy označené ako prečítané</translation> <translation>Fernschreiber chvíľu počká, kým budú správy označené ako prečítané</translation>
</message> </message>
<message>
<source>Focus the text input area when entering a chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Focus text input on chat open</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1709,6 +1709,14 @@
<source>Fernschreiber will wait a bit before messages are marked as read</source> <source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation>Fernschreiber väntar en stund innan meddelanden markeras som lästa</translation> <translation>Fernschreiber väntar en stund innan meddelanden markeras som lästa</translation>
</message> </message>
<message>
<source>Focus the text input area when entering a chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Focus text input on chat open</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1683,6 +1683,14 @@
<source>Fernschreiber will wait a bit before messages are marked as read</source> <source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation>Fernschreiber </translation> <translation>Fernschreiber </translation>
</message> </message>
<message>
<source>Focus the text input area when entering a chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Focus text input on chat open</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1709,6 +1709,14 @@
<source>Fernschreiber will wait a bit before messages are marked as read</source> <source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Focus the text input area when entering a chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Focus text input on chat open</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>