Added notificationTurnsDisplayOn option
It defaults to false
This commit is contained in:
parent
a4482c72b3
commit
e68340d406
3 changed files with 22 additions and 3 deletions
|
@ -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();
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -362,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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue