Introduce configurable delay for marking messages as read

This commit is contained in:
Sebastian Wolf 2021-02-03 22:16:22 +01:00
parent ca94e7971b
commit 31ee65fc98
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
16 changed files with 128 additions and 1 deletions

View file

@ -657,7 +657,7 @@ Page {
}
Timer {
id: viewMessageTimer
interval: 1000
interval: appSettings.delayMessageRead ? 1000 : 0
property int lastQueuedIndex: -1
function queueViewMessage(index) {
if (index > lastQueuedIndex) {

View file

@ -560,6 +560,17 @@ Page {
}
}
TextSwitch {
width: parent.columnWidth
checked: appSettings.delayMessageRead
text: qsTr("Delay before marking messages as read")
description: qsTr("Fernschreiber will wait a bit before messages are marked as read")
automaticCheck: false
onClicked: {
appSettings.delayMessageRead = !checked
}
}
TextSwitch {
width: parent.columnWidth
checked: appSettings.useOpenWith

View file

@ -33,6 +33,7 @@ namespace {
const QString KEY_INLINEBOT_LOCATION_ACCESS("allowInlineBotLocationAccess");
const QString KEY_REMAINING_INTERACTION_HINTS("remainingInteractionHints");
const QString KEY_ONLINE_ONLY_MODE("onlineOnlyMode");
const QString KEY_DELAY_MESSAGE_READ("delayMessageRead");
}
AppSettings::AppSettings(QObject *parent) : QObject(parent), settings("harbour-fernschreiber", "settings")
@ -207,3 +208,17 @@ void AppSettings::setOnlineOnlyMode(bool enable)
emit onlineOnlyModeChanged();
}
}
bool AppSettings::delayMessageRead() const
{
return settings.value(KEY_DELAY_MESSAGE_READ, true).toBool();
}
void AppSettings::setDelayMessageRead(bool enable)
{
if (delayMessageRead() != enable) {
LOG(KEY_DELAY_MESSAGE_READ << enable);
settings.setValue(KEY_DELAY_MESSAGE_READ, enable);
emit delayMessageReadChanged();
}
}

View file

@ -35,6 +35,7 @@ class AppSettings : public QObject {
Q_PROPERTY(bool allowInlineBotLocationAccess READ allowInlineBotLocationAccess WRITE setAllowInlineBotLocationAccess NOTIFY allowInlineBotLocationAccessChanged)
Q_PROPERTY(int remainingInteractionHints READ remainingInteractionHints WRITE setRemainingInteractionHints NOTIFY remainingInteractionHintsChanged)
Q_PROPERTY(bool onlineOnlyMode READ onlineOnlyMode WRITE setOnlineOnlyMode NOTIFY onlineOnlyModeChanged)
Q_PROPERTY(bool delayMessageRead READ delayMessageRead WRITE setDelayMessageRead NOTIFY delayMessageReadChanged)
public:
enum NotificationFeedback {
@ -83,6 +84,9 @@ public:
bool onlineOnlyMode() const;
void setOnlineOnlyMode(bool enable);
bool delayMessageRead() const;
void setDelayMessageRead(bool enable);
signals:
void sendByEnterChanged();
void focusTextAreaAfterSendChanged();
@ -96,6 +100,7 @@ signals:
void allowInlineBotLocationAccessChanged();
void remainingInteractionHintsChanged();
void onlineOnlyModeChanged();
void delayMessageReadChanged();
private:
QSettings settings;

View file

@ -1642,6 +1642,14 @@
<source>When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.</source>
<translation>Wenn Töne eingeschaltet sind, wird Fernschreiber den aktuellen Sailfish OS-Hinweiston für Chats verwenden, der in den Systemeinstellungen konfiguriert werden kann.</translation>
</message>
<message>
<source>Delay before marking messages as read</source>
<translation>Verzögerung bevor Nachrichten als gelesen markiert werden</translation>
</message>
<message>
<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>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1642,6 +1642,14 @@
<source>When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.</source>
<translation>When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.</translation>
</message>
<message>
<source>Delay before marking messages as read</source>
<translation>Delay before marking messages as read</translation>
</message>
<message>
<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>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1642,6 +1642,14 @@
<source>When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delay before marking messages as read</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1643,6 +1643,14 @@
<source>When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delay before marking messages as read</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1615,6 +1615,14 @@
<source>When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delay before marking messages as read</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1642,6 +1642,14 @@
<source>When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.</source>
<translation>Quando i suoni di notifica sono attivi, Fernschreiber utilizza l&apos;attuale suono di notifica per i messaggi scelto per Sailfish OS, il quale può essere modificato dalle impostazioni di sistema.</translation>
</message>
<message>
<source>Delay before marking messages as read</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1669,6 +1669,14 @@
<source>When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delay before marking messages as read</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1669,6 +1669,14 @@
<source>When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delay before marking messages as read</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1669,6 +1669,14 @@
<source>When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.</source>
<translation>Keď povolené zvukové upozornenia, Fernschreiber použije aktuálne zvukové upozornenia Sailfish OS pre čety, ktoré môžu byť upravené v nastaveniach systému.</translation>
</message>
<message>
<source>Delay before marking messages as read</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1642,6 +1642,14 @@
<source>When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delay before marking messages as read</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1615,6 +1615,14 @@
<source>When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.</source>
<translation>Fernschreiber </translation>
</message>
<message>
<source>Delay before marking messages as read</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1642,6 +1642,14 @@
<source>When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delay before marking messages as read</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Fernschreiber will wait a bit before messages are marked as read</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>