Add a setting to keep normal notifications always on top

BUG: 425071
wilder-5.22
Oleksandr Popel 5 years ago
parent ff4fa345c5
commit 6dc59a6998
  1. 3
      applets/notifications/package/contents/ui/global/Globals.qml
  2. 3
      libnotificationmanager/kcfg/notificationsettings.kcfg
  3. 14
      libnotificationmanager/settings.cpp
  4. 7
      libnotificationmanager/settings.h

@ -456,7 +456,8 @@ QtObject {
readonly property var notificationId: model.notificationId
popupWidth: globals.popupWidth
type: model.urgency === NotificationManager.Notifications.CriticalUrgency && notificationSettings.keepCriticalAlwaysOnTop
type: (model.urgency === NotificationManager.Notifications.CriticalUrgency && notificationSettings.keepCriticalAlwaysOnTop)
|| (model.urgency === NotificationManager.Notifications.NormalUrgency && notificationSettings.keepNormalAlwaysOnTop)
? PlasmaCore.Dialog.CriticalNotification : PlasmaCore.Dialog.Notification
notificationType: model.type

@ -12,6 +12,9 @@
<entry name="CriticalAlwaysOnTop" type="Bool">
<default>true</default>
</entry>
<entry name="NormalAlwaysOnTop" type="Bool">
<default>false</default>
</entry>
<entry name="LowPriorityPopups" type="Bool">
<default>true</default>
</entry>

@ -375,6 +375,20 @@ void Settings::setCriticalPopupsInDoNotDisturbMode(bool enable)
d->setDirty(true);
}
bool Settings::keepNormalAlwaysOnTop() const
{
return d->notificationSettings.normalAlwaysOnTop();
}
void Settings::setKeepNormalAlwaysOnTop(bool enable)
{
if (this->keepNormalAlwaysOnTop() == enable) {
return;
}
d->notificationSettings.setNormalAlwaysOnTop(enable);
d->setDirty(true);
}
bool Settings::lowPriorityPopups() const
{
return d->notificationSettings.lowPriorityPopups();

@ -55,6 +55,10 @@ class NOTIFICATIONMANAGER_EXPORT Settings : public QObject
* Whether to keep critical notifications always on top.
*/
Q_PROPERTY(bool keepCriticalAlwaysOnTop READ keepCriticalAlwaysOnTop WRITE setKeepCriticalAlwaysOnTop NOTIFY settingsChanged)
/**
* Whether to keep normal notifications always on top.
*/
Q_PROPERTY(bool keepNormalAlwaysOnTop READ keepNormalAlwaysOnTop WRITE setKeepNormalAlwaysOnTop NOTIFY settingsChanged)
/**
* Whether to show popups for low priority notifications.
*/
@ -266,6 +270,9 @@ public:
bool keepCriticalAlwaysOnTop() const;
void setKeepCriticalAlwaysOnTop(bool enable);
bool keepNormalAlwaysOnTop() const;
void setKeepNormalAlwaysOnTop(bool enable);
bool lowPriorityPopups() const;
void setLowPriorityPopups(bool enable);

Loading…
Cancel
Save