Merge remote-tracking branch 'origin/master' into new-chat-from-contacts-7

This commit is contained in:
Sebastian Wolf 2020-11-21 10:21:53 +01:00
commit 4d1bd029bc
16 changed files with 97 additions and 17 deletions

View file

@ -355,7 +355,10 @@ Page {
}
break;
case PageStatus.Inactive:
chatModel.clear();
if (pageStack.depth === 1) {
// Only clear chat model if navigated back to overview page. In other cases we keep the information...
chatModel.clear();
}
break;
}
}

View file

@ -113,6 +113,19 @@ Page {
}
}
TextSwitch {
checked: appSettings.notificationTurnsDisplayOn && enabled
text: qsTr("Notification turns on the display")
height: appSettings.notificationFeedback === AppSettings.NotificationFeedbackNone ? 0 : implicitHeight
clip: height < implicitHeight
visible: height > 0
automaticCheck: false
onClicked: {
appSettings.notificationTurnsDisplayOn = !checked
}
Behavior on height { SmoothedAnimation { duration: 200 } }
}
SectionHeader {
text: qsTr("Appearance")
}

View file

@ -25,6 +25,7 @@ namespace {
const QString KEY_USE_OPEN_WITH("useOpenWith");
const QString KEY_SHOW_STICKERS_AS_IMAGES("showStickersAsImages");
const QString KEY_ANIMATE_STICKERS("animateStickers");
const QString KEY_NOTIFICATION_TURNS_DISPLAY_ON("notificationTurnsDisplayOn");
const QString KEY_NOTIFICATION_FEEDBACK("notificationFeedback");
}
@ -88,6 +89,20 @@ void AppSettings::setAnimateStickers(bool animate)
}
}
bool AppSettings::notificationTurnsDisplayOn() const
{
return settings.value(KEY_NOTIFICATION_TURNS_DISPLAY_ON, false).toBool();
}
void AppSettings::setNotificationTurnsDisplayOn(bool turnOn)
{
if (notificationTurnsDisplayOn() != turnOn) {
LOG(KEY_NOTIFICATION_TURNS_DISPLAY_ON << turnOn);
settings.setValue(KEY_NOTIFICATION_TURNS_DISPLAY_ON, turnOn);
emit notificationTurnsDisplayOnChanged();
}
}
AppSettings::NotificationFeedback AppSettings::notificationFeedback() const
{
return (NotificationFeedback) settings.value(KEY_NOTIFICATION_FEEDBACK, (int) NotificationFeedbackAll).toInt();

View file

@ -27,6 +27,7 @@ class AppSettings : public QObject {
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)
Q_PROPERTY(bool notificationTurnsDisplayOn READ notificationTurnsDisplayOn WRITE setNotificationTurnsDisplayOn NOTIFY notificationTurnsDisplayOnChanged)
Q_PROPERTY(NotificationFeedback notificationFeedback READ notificationFeedback WRITE setNotificationFeedback NOTIFY notificationFeedbackChanged)
public:
@ -52,6 +53,9 @@ public:
bool animateStickers() const;
void setAnimateStickers(bool animate);
bool notificationTurnsDisplayOn() const;
void setNotificationTurnsDisplayOn(bool turnOn);
NotificationFeedback notificationFeedback() const;
void setNotificationFeedback(NotificationFeedback feedback);
@ -60,6 +64,7 @@ signals:
void useOpenWithChanged();
void showStickersAsImagesChanged();
void animateStickersChanged();
void notificationTurnsDisplayOnChanged();
void notificationFeedbackChanged();
private:

View file

@ -26,6 +26,7 @@
#include <QUrl>
#include <QDateTime>
#include <QDBusConnection>
#include <QGuiApplication>
#define LOG(x) qDebug() << "[NotificationManager]" << x
@ -361,11 +362,10 @@ void NotificationManager::publishNotification(const NotificationGroup *notificat
if (!needFeedback || (chatModel->getChatId() == notificationGroup->chatId &&
qGuiApp->applicationState() == Qt::ApplicationActive)) {
nemoNotification->setHintValue(HINT_DISPLAY_ON, false);
nemoNotification->setHintValue(HINT_VISIBILITY, QVariant());
nemoNotification->setHintValue(HINT_VISIBILITY, QString());
nemoNotification->setUrgency(Notification::Low);
} else {
// The "display on" option will be configurable
nemoNotification->setHintValue(HINT_DISPLAY_ON, true);
nemoNotification->setHintValue(HINT_DISPLAY_ON, appSettings->notificationTurnsDisplayOn());
nemoNotification->setHintValue(HINT_VISIBILITY, VISIBILITY_PUBLIC);
nemoNotification->setUrgency(Notification::Normal);
}

View file

@ -1213,6 +1213,10 @@
<source>Animate stickers</source>
<translation>Sticker animieren</translation>
</message>
<message>
<source>Notification turns on the display</source>
<translation>Hinweis schaltet den Bildschirm an</translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1213,6 +1213,10 @@
<source>Animate stickers</source>
<translation>Animate stickers</translation>
</message>
<message>
<source>Notification turns on the display</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1194,6 +1194,10 @@
<source>Animate stickers</source>
<translation>Mostrar pegatinas animadas</translation>
</message>
<message>
<source>Notification turns on the display</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1214,6 +1214,10 @@
<source>Animate stickers</source>
<translation>Animoi tarrat</translation>
</message>
<message>
<source>Notification turns on the display</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1194,6 +1194,10 @@
<source>Animate stickers</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Notification turns on the display</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1213,6 +1213,10 @@
<source>Animate stickers</source>
<translation>Riproduci sticker animati</translation>
</message>
<message>
<source>Notification turns on the display</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1232,6 +1232,10 @@
<source>Animate stickers</source>
<translation>Animowane naklejki</translation>
</message>
<message>
<source>Notification turns on the display</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1232,6 +1232,10 @@
<source>Animate stickers</source>
<translation>Анимировать стикеры</translation>
</message>
<message>
<source>Notification turns on the display</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -331,7 +331,7 @@
</message>
<message>
<source>Select Messages</source>
<translation>Välj meddelanden</translation>
<translation>Markera meddelanden</translation>
</message>
<message numerus="yes">
<source>%Ln Messages deleted</source>
@ -359,8 +359,8 @@
<source>%Ln messages selected</source>
<comment>number of messages selected</comment>
<translation>
<numerusform>%Ln meddelande valt</numerusform>
<numerusform>%Ln meddelanden valda</numerusform>
<numerusform>%Ln meddelande markerat</numerusform>
<numerusform>%Ln meddelanden markerade</numerusform>
</translation>
</message>
<message>
@ -540,7 +540,7 @@
</message>
<message>
<source>sent a voice note</source>
<translation>skickade en röstanteckning</translation>
<translation>skickade ett röstmeddelande</translation>
</message>
<message>
<source>sent a document</source>
@ -603,16 +603,16 @@
<message>
<source>sent a voice note</source>
<comment>myself</comment>
<translation>skickade en röstanteckning</translation>
<translation>skickade ett röstmeddelande</translation>
</message>
<message>
<source>sent a venue</source>
<comment>myself</comment>
<translation>skickade en mötesplats</translation>
<translation>skickade en plats</translation>
</message>
<message>
<source>sent a venue</source>
<translation>skickade en mötesplats</translation>
<translation>skickade en plats</translation>
</message>
<message>
<source>changed the chat title</source>
@ -865,7 +865,7 @@
</message>
<message>
<source>Select Message</source>
<translation>Välj meddelande</translation>
<translation>Markera meddelanden</translation>
</message>
<message>
<source>Pin Message</source>
@ -1213,6 +1213,10 @@
<source>Animate stickers</source>
<translation>Animera dekaler</translation>
</message>
<message>
<source>Notification turns on the display</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>
@ -1271,7 +1275,7 @@
</message>
<message>
<source>Voice Note: %1</source>
<translation>Ljudmeddelande: %1</translation>
<translation>Röstmeddelande: %1</translation>
</message>
<message>
<source>Animation: %1</source>
@ -1299,7 +1303,7 @@
</message>
<message>
<source>sent a voice note</source>
<translation>skickade ett röstanteckning</translation>
<translation>skickade ett röstmeddelande</translation>
</message>
<message>
<source>sent a document</source>
@ -1331,7 +1335,7 @@
</message>
<message>
<source>sent a venue</source>
<translation>skickade en mötesplats</translation>
<translation>skickade en plats</translation>
</message>
<message>
<source>sent a picture</source>
@ -1356,7 +1360,7 @@
<message>
<source>sent a voice note</source>
<comment>myself</comment>
<translation>skickade en röstanteckning</translation>
<translation>skickade ett röstmeddelande</translation>
</message>
<message>
<source>sent a document</source>
@ -1371,7 +1375,7 @@
<message>
<source>sent a venue</source>
<comment>myself</comment>
<translation>skickade en mötesplats</translation>
<translation>skickade en plats</translation>
</message>
<message>
<source>have registered with Telegram</source>

View file

@ -1194,6 +1194,10 @@
<source>Animate stickers</source>
<translation></translation>
</message>
<message>
<source>Notification turns on the display</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1213,6 +1213,10 @@
<source>Animate stickers</source>
<translation>Animate stickers</translation>
</message>
<message>
<source>Notification turns on the display</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>