diff --git a/libnotificationmanager/settings.h b/libnotificationmanager/settings.h --- a/libnotificationmanager/settings.h +++ b/libnotificationmanager/settings.h @@ -266,6 +266,13 @@ Q_INVOKABLE void save(); Q_INVOKABLE void defaults(); + /** + * Whether a property is immutable or not given by its entry name. + * + * @note entry name must be unique accross all settings objects. + */ + Q_INVOKABLE bool isImmutable(const QString &name) const; + bool live() const; void setLive(bool live); diff --git a/libnotificationmanager/settings.cpp b/libnotificationmanager/settings.cpp --- a/libnotificationmanager/settings.cpp +++ b/libnotificationmanager/settings.cpp @@ -25,6 +25,8 @@ #include #include +#include + #include "server.h" #include "mirroredscreenstracker_p.h" #include "debug.h" @@ -289,6 +291,22 @@ d->setDirty(false); } +bool Settings::isImmutable(const QString &name) const +{ + const std::array skeletons = { DoNotDisturbSettings::self() + , NotificationSettings::self() + , JobSettings::self() + , BadgeSettings::self() }; + + for (const auto *skeleton : skeletons) { + const auto *item = skeleton->findItem(name); + if (item) { + return item->isImmutable(); + } + } + return false; +} + bool Settings::live() const { return d->live;