diff --git a/libnotificationmanager/CMakeLists.txt b/libnotificationmanager/CMakeLists.txt index 2fb251b97..f3e480338 100644 --- a/libnotificationmanager/CMakeLists.txt +++ b/libnotificationmanager/CMakeLists.txt @@ -1,118 +1,122 @@ add_definitions(-DTRANSLATION_DOMAIN=\"libnotificationmanager\") add_subdirectory(declarative) if(BUILD_TESTING) add_subdirectory(autotests) endif() set(notificationmanager_LIB_SRCS server.cpp server_p.cpp serverinfo.cpp settings.cpp mirroredscreenstracker.cpp notifications.cpp notification.cpp notificationsmodel.cpp notificationfilterproxymodel.cpp notificationsortproxymodel.cpp notificationgroupingproxymodel.cpp notificationgroupcollapsingproxymodel.cpp jobsmodel.cpp jobsmodel_p.cpp job.cpp job_p.cpp limitedrowcountproxymodel.cpp utils.cpp ) ecm_qt_declare_logging_category(notificationmanager_LIB_SRCS HEADER debug.h IDENTIFIER NOTIFICATIONMANAGER CATEGORY_NAME org.kde.plasma.notifications) install(FILES libnotificationmanager.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}) # Settings -kconfig_add_kcfg_files(notificationmanager_LIB_SRCS kcfg/donotdisturbsettings.kcfgc) -kconfig_add_kcfg_files(notificationmanager_LIB_SRCS kcfg/notificationsettings.kcfgc) -kconfig_add_kcfg_files(notificationmanager_LIB_SRCS kcfg/jobsettings.kcfgc) -kconfig_add_kcfg_files(notificationmanager_LIB_SRCS kcfg/badgesettings.kcfgc) +kconfig_add_kcfg_files(notificationmanager_LIB_SRCS kcfg/donotdisturbsettings.kcfgc GENERATE_MOC) +kconfig_add_kcfg_files(notificationmanager_LIB_SRCS kcfg/notificationsettings.kcfgc GENERATE_MOC) +kconfig_add_kcfg_files(notificationmanager_LIB_SRCS kcfg/jobsettings.kcfgc GENERATE_MOC) +kconfig_add_kcfg_files(notificationmanager_LIB_SRCS kcfg/badgesettings.kcfgc GENERATE_MOC) # DBus # Notifications qt5_add_dbus_adaptor(notificationmanager_LIB_SRCS dbus/org.freedesktop.Notifications.xml server_p.h NotificationManager::ServerPrivate) # JobView qt5_add_dbus_adaptor(notificationmanager_LIB_SRCS dbus/org.kde.kuiserver.xml jobsmodel_p.h NotificationManager::JobsModelPrivate) qt5_add_dbus_adaptor(notificationmanager_LIB_SRCS dbus/org.kde.JobViewServer.xml jobsmodel_p.h NotificationManager::JobsModelPrivate) qt5_add_dbus_adaptor(notificationmanager_LIB_SRCS dbus/org.kde.JobViewServerV2.xml jobsmodel_p.h NotificationManager::JobsModelPrivate) qt5_add_dbus_adaptor(notificationmanager_LIB_SRCS dbus/org.kde.JobViewV2.xml job_p.h NotificationManager::JobPrivate) qt5_add_dbus_adaptor(notificationmanager_LIB_SRCS dbus/org.kde.JobViewV3.xml job_p.h NotificationManager::JobPrivate) add_library(notificationmanager ${notificationmanager_LIB_SRCS}) add_library(PW::LibNotificationManager ALIAS notificationmanager) target_compile_definitions(notificationmanager PRIVATE -DPROJECT_VERSION="${PROJECT_VERSION}") generate_export_header(notificationmanager) target_include_directories(notificationmanager PUBLIC "$" "$") target_link_libraries(notificationmanager PUBLIC Qt5::Core Qt5::Gui Qt5::Quick KF5::ConfigCore KF5::ItemModels PRIVATE Qt5::DBus KF5::ConfigGui KF5::I18n KF5::KIOFileWidgets KF5::Plasma KF5::Screen KF5::Service ) set_target_properties(notificationmanager PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 1 EXPORT_NAME LibNotificationManager) install(TARGETS notificationmanager EXPORT notificationmanagerLibraryTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} ) install(FILES server.h notifications.h notification.h jobsmodel.h job.h settings.h + ${CMAKE_CURRENT_BINARY_DIR}/donotdisturbsettings.h + ${CMAKE_CURRENT_BINARY_DIR}/notificationsettings.h + ${CMAKE_CURRENT_BINARY_DIR}/jobsettings.h + ${CMAKE_CURRENT_BINARY_DIR}/badgesettings.h ${CMAKE_CURRENT_BINARY_DIR}/notificationmanager_export.h DESTINATION ${KDE_INSTALL_INCLUDEDIR}/notificationmanager COMPONENT Devel ) write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/LibNotificationManagerConfigVersion.cmake VERSION "${PROJECT_VERSION}" COMPATIBILITY AnyNewerVersion) set(CMAKECONFIG_INSTALL_DIR ${KDE_INSTALL_LIBDIR}/cmake/LibNotificationManager) configure_package_config_file(LibNotificationManagerConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/LibNotificationManagerConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LibNotificationManagerConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/LibNotificationManagerConfigVersion.cmake DESTINATION ${CMAKECONFIG_INSTALL_DIR}) install(EXPORT notificationmanagerLibraryTargets NAMESPACE PW:: DESTINATION ${CMAKECONFIG_INSTALL_DIR} FILE LibNotificationManagerLibraryTargets.cmake ) install(FILES plasmanotifyrc DESTINATION ${KDE_INSTALL_CONFDIR}) diff --git a/libnotificationmanager/kcfg/badgesettings.kcfg b/libnotificationmanager/kcfg/badgesettings.kcfg index 99798670c..4c013bf4a 100644 --- a/libnotificationmanager/kcfg/badgesettings.kcfg +++ b/libnotificationmanager/kcfg/badgesettings.kcfg @@ -1,14 +1,14 @@ - + true diff --git a/libnotificationmanager/kcfg/badgesettings.kcfgc b/libnotificationmanager/kcfg/badgesettings.kcfgc index b898fe9aa..1e4563753 100644 --- a/libnotificationmanager/kcfg/badgesettings.kcfgc +++ b/libnotificationmanager/kcfg/badgesettings.kcfgc @@ -1,7 +1,10 @@ File=badgesettings.kcfg NameSpace=NotificationManager ClassName=BadgeSettings -Singleton=true +Visibility=NOTIFICATIONMANAGER_EXPORT +IncludeFiles=\"notificationmanager_export.h\" Mutators=true DefaultValueGetters=true Notifiers=true +GenerateProperties=true +ParentInConstructor=true diff --git a/libnotificationmanager/kcfg/donotdisturbsettings.kcfg b/libnotificationmanager/kcfg/donotdisturbsettings.kcfg index 786d55ac7..24855f33f 100644 --- a/libnotificationmanager/kcfg/donotdisturbsettings.kcfg +++ b/libnotificationmanager/kcfg/donotdisturbsettings.kcfg @@ -1,21 +1,21 @@ - + true false diff --git a/libnotificationmanager/kcfg/donotdisturbsettings.kcfgc b/libnotificationmanager/kcfg/donotdisturbsettings.kcfgc index bb3577f89..13768a6c0 100644 --- a/libnotificationmanager/kcfg/donotdisturbsettings.kcfgc +++ b/libnotificationmanager/kcfg/donotdisturbsettings.kcfgc @@ -1,7 +1,10 @@ File=donotdisturbsettings.kcfg NameSpace=NotificationManager ClassName=DoNotDisturbSettings -Singleton=true +Visibility=NOTIFICATIONMANAGER_EXPORT +IncludeFiles=\"notificationmanager_export.h\" Mutators=true DefaultValueGetters=true Notifiers=true +GenerateProperties=true +ParentInConstructor=true diff --git a/libnotificationmanager/kcfg/jobsettings.kcfg b/libnotificationmanager/kcfg/jobsettings.kcfg index 292c7971d..43afece77 100644 --- a/libnotificationmanager/kcfg/jobsettings.kcfg +++ b/libnotificationmanager/kcfg/jobsettings.kcfg @@ -1,20 +1,20 @@ - + true true true diff --git a/libnotificationmanager/kcfg/jobsettings.kcfgc b/libnotificationmanager/kcfg/jobsettings.kcfgc index 9feec3e97..7772ab86e 100644 --- a/libnotificationmanager/kcfg/jobsettings.kcfgc +++ b/libnotificationmanager/kcfg/jobsettings.kcfgc @@ -1,7 +1,10 @@ File=jobsettings.kcfg NameSpace=NotificationManager ClassName=JobSettings -Singleton=true +Visibility=NOTIFICATIONMANAGER_EXPORT +IncludeFiles=\"notificationmanager_export.h\" Mutators=true DefaultValueGetters=true Notifiers=true +GenerateProperties=true +ParentInConstructor=true diff --git a/libnotificationmanager/kcfg/notificationsettings.kcfg b/libnotificationmanager/kcfg/notificationsettings.kcfg index a3d9347ad..82c9b98a1 100644 --- a/libnotificationmanager/kcfg/notificationsettings.kcfg +++ b/libnotificationmanager/kcfg/notificationsettings.kcfg @@ -1,38 +1,38 @@ - + true true true false CloseToWidget 5000 diff --git a/libnotificationmanager/kcfg/notificationsettings.kcfgc b/libnotificationmanager/kcfg/notificationsettings.kcfgc index c65dbc6c7..15d18e6f4 100644 --- a/libnotificationmanager/kcfg/notificationsettings.kcfgc +++ b/libnotificationmanager/kcfg/notificationsettings.kcfgc @@ -1,10 +1,12 @@ File=notificationsettings.kcfg NameSpace=NotificationManager ClassName=NotificationSettings -Singleton=true +Visibility=NOTIFICATIONMANAGER_EXPORT Mutators=true DefaultValueGetters=true Notifiers=true +GenerateProperties=true +ParentInConstructor=true # For Settings::PopupPosition -IncludeFiles=\"settings.h\" -UseEnumTypes=true +IncludeFiles=\"settings.h\",\"notificationmanager_export.h\" +UseEnumTypes=false diff --git a/libnotificationmanager/settings.cpp b/libnotificationmanager/settings.cpp index 778ecd8f5..70d70b70f 100644 --- a/libnotificationmanager/settings.cpp +++ b/libnotificationmanager/settings.cpp @@ -1,618 +1,616 @@ /* * Copyright 2019 Kai Uwe Broulik * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) version 3, or any * later version accepted by the membership of KDE e.V. (or its * successor approved by the membership of KDE e.V.), which shall * act as a proxy defined in Section 6 of version 3 of the license. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include "settings.h" #include #include #include #include "server.h" #include "mirroredscreenstracker_p.h" #include "debug.h" // Settings #include "donotdisturbsettings.h" #include "notificationsettings.h" #include "jobsettings.h" #include "badgesettings.h" using namespace NotificationManager; class Q_DECL_HIDDEN Settings::Private { public: explicit Private(Settings *q); ~Private(); void setDirty(bool dirty); Settings::NotificationBehaviors groupBehavior(const KConfigGroup &group) const; void setGroupBehavior(KConfigGroup &group, const Settings::NotificationBehaviors &behavior); KConfigGroup servicesGroup() const; KConfigGroup applicationsGroup() const; QStringList behaviorMatchesList(const KConfigGroup &group, Settings::NotificationBehavior behavior, bool on) const; Settings *q; KSharedConfig::Ptr config; KConfigWatcher::Ptr watcher; QMetaObject::Connection watcherConnection; MirroredScreensTracker::Ptr mirroredScreensTracker; + DoNotDisturbSettings dndSettings; + NotificationSettings notificationSettings; + JobSettings jobSettings; + BadgeSettings badgeSettings; + bool live = false; // set to true initially in constructor bool dirty = false; }; Settings::Private::Private(Settings *q) : q(q) { } Settings::Private::~Private() = default; void Settings::Private::setDirty(bool dirty) { if (this->dirty != dirty) { this->dirty = dirty; emit q->dirtyChanged(); } } Settings::NotificationBehaviors Settings::Private::groupBehavior(const KConfigGroup &group) const { Settings::NotificationBehaviors behaviors; behaviors.setFlag(Settings::ShowPopups, group.readEntry("ShowPopups", true)); // show popups in dnd mode implies the show popups behaviors.setFlag(Settings::ShowPopupsInDoNotDisturbMode, behaviors.testFlag(Settings::ShowPopups) && group.readEntry("ShowPopupsInDndMode", false)); behaviors.setFlag(Settings::ShowInHistory, group.readEntry("ShowInHistory", true)); behaviors.setFlag(Settings::ShowBadges, group.readEntry("ShowBadges", true)); return behaviors; } void Settings::Private::setGroupBehavior(KConfigGroup &group, const Settings::NotificationBehaviors &behavior) { if (groupBehavior(group) == behavior) { return; } const bool showPopups = behavior.testFlag(Settings::ShowPopups); if (showPopups && !group.hasDefault("ShowPopups")) { group.revertToDefault("ShowPopups", KConfigBase::Notify); } else { group.writeEntry("ShowPopups", showPopups, KConfigBase::Notify); } const bool showPopupsInDndMode = behavior.testFlag(Settings::ShowPopupsInDoNotDisturbMode); if (!showPopupsInDndMode && !group.hasDefault("ShowPopupsInDndMode")) { group.revertToDefault("ShowPopupsInDndMode", KConfigBase::Notify); } else { group.writeEntry("ShowPopupsInDndMode", showPopupsInDndMode, KConfigBase::Notify); } const bool showInHistory = behavior.testFlag(Settings::ShowInHistory); if (showInHistory && !group.hasDefault("ShowInHistory")) { group.revertToDefault("ShowInHistory", KConfig::Notify); } else { group.writeEntry("ShowInHistory", showInHistory, KConfigBase::Notify); } const bool showBadges = behavior.testFlag(Settings::ShowBadges); if (showBadges && !group.hasDefault("ShowBadges")) { group.revertToDefault("ShowBadges", KConfigBase::Notify); } else { group.writeEntry("ShowBadges", showBadges, KConfigBase::Notify); } setDirty(true); } KConfigGroup Settings::Private::servicesGroup() const { return config->group("Services"); } KConfigGroup Settings::Private::applicationsGroup() const { return config->group("Applications"); } QStringList Settings::Private::behaviorMatchesList(const KConfigGroup &group, Settings::NotificationBehavior behavior, bool on) const { QStringList matches; const QStringList apps = group.groupList(); for (const QString &app : apps) { if (groupBehavior(group.group(app)).testFlag(behavior) == on) { matches.append(app); } } return matches; } Settings::Settings(QObject *parent) // FIXME static thing for config file name : Settings(KSharedConfig::openConfig(QStringLiteral("plasmanotifyrc")), parent) { } Settings::Settings(const KSharedConfig::Ptr &config, QObject *parent) : QObject(parent) , d(new Private(this)) { d->config = config; - static bool s_settingsInited = false; - if (!s_settingsInited) { - DoNotDisturbSettings::instance(config); - NotificationSettings::instance(config); - JobSettings::instance(config); - BadgeSettings::instance(config); - s_settingsInited = true; - } - setLive(true); connect(&Server::self(), &Server::inhibitedByApplicationChanged, this, &Settings::notificationsInhibitedByApplicationChanged); connect(&Server::self(), &Server::inhibitionApplicationsChanged, this, &Settings::notificationInhibitionApplicationsChanged); - if (DoNotDisturbSettings::whenScreensMirrored()) { + if (d->dndSettings.whenScreensMirrored()) { d->mirroredScreensTracker = MirroredScreensTracker::createTracker(); connect(d->mirroredScreensTracker.data(), &MirroredScreensTracker::screensMirroredChanged, this, &Settings::screensMirroredChanged); } } Settings::~Settings() { d->config->markAsClean(); } Settings::NotificationBehaviors Settings::applicationBehavior(const QString &desktopEntry) const { return d->groupBehavior(d->applicationsGroup().group(desktopEntry)); } void Settings::setApplicationBehavior(const QString &desktopEntry, NotificationBehaviors behaviors) { KConfigGroup group(d->applicationsGroup().group(desktopEntry)); d->setGroupBehavior(group, behaviors); } Settings::NotificationBehaviors Settings::serviceBehavior(const QString ¬ifyRcName) const { return d->groupBehavior(d->servicesGroup().group(notifyRcName)); } void Settings::setServiceBehavior(const QString ¬ifyRcName, NotificationBehaviors behaviors) { KConfigGroup group(d->servicesGroup().group(notifyRcName)); d->setGroupBehavior(group, behaviors); } void Settings::registerKnownApplication(const QString &desktopEntry) { KService::Ptr service = KService::serviceByDesktopName(desktopEntry); if (!service) { qCDebug(NOTIFICATIONMANAGER) << "Application" << desktopEntry << "cannot be registered as seen application since there is no service for it"; return; } if (service->noDisplay()) { qCDebug(NOTIFICATIONMANAGER) << "Application" << desktopEntry << "will not be registered as seen application since it's marked as NoDisplay"; return; } if (knownApplications().contains(desktopEntry)) { return; } d->applicationsGroup().group(desktopEntry).writeEntry("Seen", true); emit knownApplicationsChanged(); } void Settings::forgetKnownApplication(const QString &desktopEntry) { if (!knownApplications().contains(desktopEntry)) { return; } // Only remove applications that were added through registerKnownApplication if (!d->applicationsGroup().group(desktopEntry).readEntry("Seen", false)) { qCDebug(NOTIFICATIONMANAGER) << "Application" << desktopEntry << "will not be removed from seen applications since it wasn't one."; return; } d->applicationsGroup().deleteGroup(desktopEntry); emit knownApplicationsChanged(); } void Settings::load() { d->config->markAsClean(); d->config->reparseConfiguration(); - DoNotDisturbSettings::self()->load(); - NotificationSettings::self()->load(); - JobSettings::self()->load(); - BadgeSettings::self()->load(); + d->dndSettings.load(); + d->notificationSettings.load(); + d->jobSettings.load(); + d->badgeSettings.load(); emit settingsChanged(); d->setDirty(false); } void Settings::save() { - DoNotDisturbSettings::self()->save(); - NotificationSettings::self()->save(); - JobSettings::self()->save(); - BadgeSettings::self()->save(); + d->dndSettings.save(); + d->notificationSettings.save(); + d->jobSettings.save(); + d->badgeSettings.save(); d->config->sync(); d->setDirty(false); } void Settings::defaults() { - DoNotDisturbSettings::self()->setDefaults(); - NotificationSettings::self()->setDefaults(); - JobSettings::self()->setDefaults(); - BadgeSettings::self()->setDefaults(); + d->dndSettings.setDefaults(); + d->notificationSettings.setDefaults(); + d->jobSettings.setDefaults(); + d->badgeSettings.setDefaults(); + emit settingsChanged(); + d->setDirty(false); } bool Settings::live() const { return d->live; } void Settings::setLive(bool live) { if (live == d->live) { return; } d->live = live; if (live) { d->watcher = KConfigWatcher::create(d->config); d->watcherConnection = connect(d->watcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) { Q_UNUSED(names); if (group.name() == QLatin1String("DoNotDisturb")) { - DoNotDisturbSettings::self()->load(); + d->dndSettings.load(); bool emitScreensMirroredChanged = false; - if (DoNotDisturbSettings::whenScreensMirrored()) { + if (d->dndSettings.whenScreensMirrored()) { if (!d->mirroredScreensTracker) { d->mirroredScreensTracker = MirroredScreensTracker::createTracker(); emitScreensMirroredChanged = d->mirroredScreensTracker->screensMirrored(); connect(d->mirroredScreensTracker.data(), &MirroredScreensTracker::screensMirroredChanged, this, &Settings::screensMirroredChanged); } } else if (d->mirroredScreensTracker) { emitScreensMirroredChanged = d->mirroredScreensTracker->screensMirrored(); d->mirroredScreensTracker.reset(); } if (emitScreensMirroredChanged) { emit screensMirroredChanged(); } } else if (group.name() == QLatin1String("Notifications")) { - NotificationSettings::self()->load(); + d->notificationSettings.load(); } else if (group.name() == QLatin1String("Jobs")) { - JobSettings::self()->load(); + d->jobSettings.load(); } else if (group.name() == QLatin1String("Badges")) { - BadgeSettings::self()->load(); + d->badgeSettings.load(); } emit settingsChanged(); }); } else { disconnect(d->watcherConnection); d->watcherConnection = QMetaObject::Connection(); d->watcher.reset(); } emit liveChanged(); } bool Settings::dirty() const { // KConfigSkeleton doesn't write into the KConfig until calling save() // so we need to track d->config->isDirty() manually return d->dirty; } bool Settings::keepCriticalAlwaysOnTop() const { - return NotificationSettings::criticalAlwaysOnTop(); + return d->notificationSettings.criticalAlwaysOnTop(); } void Settings::setKeepCriticalAlwaysOnTop(bool enable) { if (this->keepCriticalAlwaysOnTop() == enable) { return; } - NotificationSettings::setCriticalAlwaysOnTop(enable); + d->notificationSettings.setCriticalAlwaysOnTop(enable); d->setDirty(true); } bool Settings::criticalPopupsInDoNotDisturbMode() const { - return NotificationSettings::criticalInDndMode(); + return d->notificationSettings.criticalInDndMode(); } void Settings::setCriticalPopupsInDoNotDisturbMode(bool enable) { if (this->criticalPopupsInDoNotDisturbMode() == enable) { return; } - NotificationSettings::setCriticalInDndMode(enable); + d->notificationSettings.setCriticalInDndMode(enable); d->setDirty(true); } bool Settings::lowPriorityPopups() const { - return NotificationSettings::lowPriorityPopups(); + return d->notificationSettings.lowPriorityPopups(); } void Settings::setLowPriorityPopups(bool enable) { if (this->lowPriorityPopups() == enable) { return; } - NotificationSettings::setLowPriorityPopups(enable); + d->notificationSettings.setLowPriorityPopups(enable); d->setDirty(true); } bool Settings::lowPriorityHistory() const { - return NotificationSettings::lowPriorityHistory(); + return d->notificationSettings.lowPriorityHistory(); } void Settings::setLowPriorityHistory(bool enable) { if (this->lowPriorityHistory() == enable) { return; } - NotificationSettings::setLowPriorityHistory(enable); + d->notificationSettings.setLowPriorityHistory(enable); d->setDirty(true); } Settings::PopupPosition Settings::popupPosition() const { - return NotificationSettings::popupPosition(); + return static_cast(d->notificationSettings.popupPosition()); } void Settings::setPopupPosition(Settings::PopupPosition position) { if (this->popupPosition() == position) { return; } - NotificationSettings::setPopupPosition(position); + d->notificationSettings.setPopupPosition(position); d->setDirty(true); } int Settings::popupTimeout() const { - return NotificationSettings::popupTimeout(); + return d->notificationSettings.popupTimeout(); } void Settings::setPopupTimeout(int timeout) { if (this->popupTimeout() == timeout) { return; } - NotificationSettings::setPopupTimeout(timeout); + d->notificationSettings.setPopupTimeout(timeout); d->setDirty(true); } void Settings::resetPopupTimeout() { - setPopupTimeout(NotificationSettings::defaultPopupTimeoutValue()); + setPopupTimeout(d->notificationSettings.defaultPopupTimeoutValue()); } bool Settings::jobsInTaskManager() const { - return JobSettings::inTaskManager(); + return d->jobSettings.inTaskManager(); } void Settings::setJobsInTaskManager(bool enable) { if (jobsInTaskManager() == enable) { return; } - JobSettings::setInTaskManager(enable); + d->jobSettings.setInTaskManager(enable); d->setDirty(true); } bool Settings::jobsInNotifications() const { - return JobSettings::inNotifications(); + return d->jobSettings.inNotifications(); } void Settings::setJobsInNotifications(bool enable) { if (jobsInNotifications() == enable) { return; } - JobSettings::setInNotifications(enable); + d->jobSettings.setInNotifications(enable); d->setDirty(true); } bool Settings::permanentJobPopups() const { - return JobSettings::permanentPopups(); + return d->jobSettings.permanentPopups(); } void Settings::setPermanentJobPopups(bool enable) { if (permanentJobPopups() == enable) { return; } - JobSettings::setPermanentPopups(enable); + d->jobSettings.setPermanentPopups(enable); d->setDirty(true); } bool Settings::badgesInTaskManager() const { - return BadgeSettings::inTaskManager(); + return d->badgeSettings.inTaskManager(); } void Settings::setBadgesInTaskManager(bool enable) { if (badgesInTaskManager() == enable) { return; } - BadgeSettings::setInTaskManager(enable); + d->badgeSettings.setInTaskManager(enable); d->setDirty(true); } QStringList Settings::knownApplications() const { return d->applicationsGroup().groupList(); } QStringList Settings::popupBlacklistedApplications() const { return d->behaviorMatchesList(d->applicationsGroup(), ShowPopups, false); } QStringList Settings::popupBlacklistedServices() const { return d->behaviorMatchesList(d->servicesGroup(), ShowPopups, false); } QStringList Settings::doNotDisturbPopupWhitelistedApplications() const { return d->behaviorMatchesList(d->applicationsGroup(), ShowPopupsInDoNotDisturbMode, true); } QStringList Settings::doNotDisturbPopupWhitelistedServices() const { return d->behaviorMatchesList(d->servicesGroup(), ShowPopupsInDoNotDisturbMode, true); } QStringList Settings::historyBlacklistedApplications() const { return d->behaviorMatchesList(d->applicationsGroup(), ShowInHistory, false); } QStringList Settings::historyBlacklistedServices() const { return d->behaviorMatchesList(d->servicesGroup(), ShowInHistory, false); } QStringList Settings::badgeBlacklistedApplications() const { return d->behaviorMatchesList(d->applicationsGroup(), ShowBadges, false); } QDateTime Settings::notificationsInhibitedUntil() const { - return DoNotDisturbSettings::until(); + return d->dndSettings.until(); } void Settings::setNotificationsInhibitedUntil(const QDateTime &time) { - DoNotDisturbSettings::setUntil(time); + d->dndSettings.setUntil(time); d->setDirty(true); } void Settings::resetNotificationsInhibitedUntil() { - setNotificationsInhibitedUntil(QDateTime());// FIXME DoNotDisturbSettings::defaultUntilValue()); + setNotificationsInhibitedUntil(QDateTime());// FIXME d->dndSettings.defaultUntilValue()); } bool Settings::notificationsInhibitedByApplication() const { return Server::self().inhibitedByApplication(); } QStringList Settings::notificationInhibitionApplications() const { return Server::self().inhibitionApplications(); } QStringList Settings::notificationInhibitionReasons() const { return Server::self().inhibitionReasons(); } bool Settings::inhibitNotificationsWhenScreensMirrored() const { - return DoNotDisturbSettings::whenScreensMirrored(); + return d->dndSettings.whenScreensMirrored(); } void Settings::setInhibitNotificationsWhenScreensMirrored(bool inhibit) { if (inhibit == inhibitNotificationsWhenScreensMirrored()) { return; } - DoNotDisturbSettings::setWhenScreensMirrored(inhibit); + d->dndSettings.setWhenScreensMirrored(inhibit); d->setDirty(true); } bool Settings::screensMirrored() const { return d->mirroredScreensTracker && d->mirroredScreensTracker->screensMirrored(); } void Settings::setScreensMirrored(bool mirrored) { if (mirrored) { qCWarning(NOTIFICATIONMANAGER) << "Cannot forcefully set screens mirrored"; return; } if (d->mirroredScreensTracker) { d->mirroredScreensTracker->setScreensMirrored(mirrored); } } void Settings::revokeApplicationInhibitions() { Server::self().clearInhibitions(); } bool Settings::notificationSoundsInhibited() const { - return DoNotDisturbSettings::notificationSoundsMuted(); + return d->dndSettings.notificationSoundsMuted(); } void Settings::setNotificationSoundsInhibited(bool inhibited) { if (inhibited == notificationSoundsInhibited()) { return; } - DoNotDisturbSettings::setNotificationSoundsMuted(inhibited); + d->dndSettings.setNotificationSoundsMuted(inhibited); d->setDirty(true); }