Changeset View
Changeset View
Standalone View
Standalone View
libnotificationmanager/settings.cpp
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 42 | public: | |||
---|---|---|---|---|---|
57 | 57 | | |||
58 | KSharedConfig::Ptr config; | 58 | KSharedConfig::Ptr config; | ||
59 | 59 | | |||
60 | KConfigWatcher::Ptr watcher; | 60 | KConfigWatcher::Ptr watcher; | ||
61 | QMetaObject::Connection watcherConnection; | 61 | QMetaObject::Connection watcherConnection; | ||
62 | 62 | | |||
63 | MirroredScreensTracker::Ptr mirroredScreensTracker; | 63 | MirroredScreensTracker::Ptr mirroredScreensTracker; | ||
64 | 64 | | |||
65 | DoNotDisturbSettings dndSettings; | ||||
66 | NotificationSettings notificationSettings; | ||||
67 | JobSettings jobSettings; | ||||
68 | BadgeSettings badgeSettings; | ||||
69 | | ||||
65 | bool live = false; // set to true initially in constructor | 70 | bool live = false; // set to true initially in constructor | ||
66 | bool dirty = false; | 71 | bool dirty = false; | ||
67 | 72 | | |||
68 | }; | 73 | }; | ||
69 | 74 | | |||
70 | Settings::Private::Private(Settings *q) | 75 | Settings::Private::Private(Settings *q) | ||
71 | : q(q) | 76 | : q(q) | ||
72 | { | 77 | { | ||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Line(s) | |||||
163 | } | 168 | } | ||
164 | 169 | | |||
165 | Settings::Settings(const KSharedConfig::Ptr &config, QObject *parent) | 170 | Settings::Settings(const KSharedConfig::Ptr &config, QObject *parent) | ||
166 | : QObject(parent) | 171 | : QObject(parent) | ||
167 | , d(new Private(this)) | 172 | , d(new Private(this)) | ||
168 | { | 173 | { | ||
169 | d->config = config; | 174 | d->config = config; | ||
170 | 175 | | |||
171 | static bool s_settingsInited = false; | | |||
172 | if (!s_settingsInited) { | | |||
173 | DoNotDisturbSettings::instance(config); | | |||
broulik: I still want to be able to specify what `config` (constructor argument) to use for autotests | |||||
After discussing with kai, let's mark the ctor taking the config parameter as deprecated instead. Should be done in another patch, this one can go as is. ervin: After discussing with kai, let's mark the ctor taking the config parameter as deprecated… | |||||
174 | NotificationSettings::instance(config); | | |||
175 | JobSettings::instance(config); | | |||
176 | BadgeSettings::instance(config); | | |||
177 | s_settingsInited = true; | | |||
178 | } | | |||
179 | | ||||
180 | setLive(true); | 176 | setLive(true); | ||
181 | 177 | | |||
182 | connect(&Server::self(), &Server::inhibitedByApplicationChanged, | 178 | connect(&Server::self(), &Server::inhibitedByApplicationChanged, | ||
183 | this, &Settings::notificationsInhibitedByApplicationChanged); | 179 | this, &Settings::notificationsInhibitedByApplicationChanged); | ||
184 | connect(&Server::self(), &Server::inhibitionApplicationsChanged, | 180 | connect(&Server::self(), &Server::inhibitionApplicationsChanged, | ||
185 | this, &Settings::notificationInhibitionApplicationsChanged); | 181 | this, &Settings::notificationInhibitionApplicationsChanged); | ||
186 | 182 | | |||
187 | if (DoNotDisturbSettings::whenScreensMirrored()) { | 183 | if (d->dndSettings.whenScreensMirrored()) { | ||
188 | d->mirroredScreensTracker = MirroredScreensTracker::createTracker(); | 184 | d->mirroredScreensTracker = MirroredScreensTracker::createTracker(); | ||
189 | connect(d->mirroredScreensTracker.data(), &MirroredScreensTracker::screensMirroredChanged, this, &Settings::screensMirroredChanged); | 185 | connect(d->mirroredScreensTracker.data(), &MirroredScreensTracker::screensMirroredChanged, this, &Settings::screensMirroredChanged); | ||
190 | } | 186 | } | ||
191 | } | 187 | } | ||
192 | 188 | | |||
193 | Settings::~Settings() | 189 | Settings::~Settings() | ||
194 | { | 190 | { | ||
195 | d->config->markAsClean(); | 191 | d->config->markAsClean(); | ||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 239 | { | |||
255 | 251 | | |||
256 | emit knownApplicationsChanged(); | 252 | emit knownApplicationsChanged(); | ||
257 | } | 253 | } | ||
258 | 254 | | |||
259 | void Settings::load() | 255 | void Settings::load() | ||
260 | { | 256 | { | ||
261 | d->config->markAsClean(); | 257 | d->config->markAsClean(); | ||
262 | d->config->reparseConfiguration(); | 258 | d->config->reparseConfiguration(); | ||
263 | DoNotDisturbSettings::self()->load(); | 259 | d->dndSettings.load(); | ||
264 | NotificationSettings::self()->load(); | 260 | d->notificationSettings.load(); | ||
265 | JobSettings::self()->load(); | 261 | d->jobSettings.load(); | ||
266 | BadgeSettings::self()->load(); | 262 | d->badgeSettings.load(); | ||
267 | emit settingsChanged(); | 263 | emit settingsChanged(); | ||
268 | d->setDirty(false); | 264 | d->setDirty(false); | ||
269 | } | 265 | } | ||
270 | 266 | | |||
271 | void Settings::save() | 267 | void Settings::save() | ||
272 | { | 268 | { | ||
273 | DoNotDisturbSettings::self()->save(); | 269 | d->dndSettings.save(); | ||
274 | NotificationSettings::self()->save(); | 270 | d->notificationSettings.save(); | ||
275 | JobSettings::self()->save(); | 271 | d->jobSettings.save(); | ||
276 | BadgeSettings::self()->save(); | 272 | d->badgeSettings.save(); | ||
277 | 273 | | |||
278 | d->config->sync(); | 274 | d->config->sync(); | ||
279 | d->setDirty(false); | 275 | d->setDirty(false); | ||
280 | } | 276 | } | ||
281 | 277 | | |||
282 | void Settings::defaults() | 278 | void Settings::defaults() | ||
283 | { | 279 | { | ||
284 | DoNotDisturbSettings::self()->setDefaults(); | 280 | d->dndSettings.setDefaults(); | ||
285 | NotificationSettings::self()->setDefaults(); | 281 | d->notificationSettings.setDefaults(); | ||
286 | JobSettings::self()->setDefaults(); | 282 | d->jobSettings.setDefaults(); | ||
287 | BadgeSettings::self()->setDefaults(); | 283 | d->badgeSettings.setDefaults(); | ||
284 | emit settingsChanged(); | ||||
285 | d->setDirty(false); | ||||
288 | } | 286 | } | ||
289 | 287 | | |||
290 | bool Settings::live() const | 288 | bool Settings::live() const | ||
291 | { | 289 | { | ||
292 | return d->live; | 290 | return d->live; | ||
293 | } | 291 | } | ||
294 | 292 | | |||
295 | void Settings::setLive(bool live) | 293 | void Settings::setLive(bool live) | ||
296 | { | 294 | { | ||
297 | if (live == d->live) { | 295 | if (live == d->live) { | ||
298 | return; | 296 | return; | ||
299 | } | 297 | } | ||
300 | 298 | | |||
301 | d->live = live; | 299 | d->live = live; | ||
302 | 300 | | |||
303 | if (live) { | 301 | if (live) { | ||
304 | d->watcher = KConfigWatcher::create(d->config); | 302 | d->watcher = KConfigWatcher::create(d->config); | ||
305 | d->watcherConnection = connect(d->watcher.data(), &KConfigWatcher::configChanged, this, | 303 | d->watcherConnection = connect(d->watcher.data(), &KConfigWatcher::configChanged, this, | ||
306 | [this](const KConfigGroup &group, const QByteArrayList &names) { | 304 | [this](const KConfigGroup &group, const QByteArrayList &names) { | ||
307 | Q_UNUSED(names); | 305 | Q_UNUSED(names); | ||
308 | 306 | | |||
309 | if (group.name() == QLatin1String("DoNotDisturb")) { | 307 | if (group.name() == QLatin1String("DoNotDisturb")) { | ||
310 | DoNotDisturbSettings::self()->load(); | 308 | d->dndSettings.load(); | ||
311 | 309 | | |||
312 | bool emitScreensMirroredChanged = false; | 310 | bool emitScreensMirroredChanged = false; | ||
313 | if (DoNotDisturbSettings::whenScreensMirrored()) { | 311 | if (d->dndSettings.whenScreensMirrored()) { | ||
314 | if (!d->mirroredScreensTracker) { | 312 | if (!d->mirroredScreensTracker) { | ||
315 | d->mirroredScreensTracker = MirroredScreensTracker::createTracker(); | 313 | d->mirroredScreensTracker = MirroredScreensTracker::createTracker(); | ||
316 | emitScreensMirroredChanged = d->mirroredScreensTracker->screensMirrored(); | 314 | emitScreensMirroredChanged = d->mirroredScreensTracker->screensMirrored(); | ||
317 | connect(d->mirroredScreensTracker.data(), &MirroredScreensTracker::screensMirroredChanged, this, &Settings::screensMirroredChanged); | 315 | connect(d->mirroredScreensTracker.data(), &MirroredScreensTracker::screensMirroredChanged, this, &Settings::screensMirroredChanged); | ||
318 | } | 316 | } | ||
319 | } else if (d->mirroredScreensTracker) { | 317 | } else if (d->mirroredScreensTracker) { | ||
320 | emitScreensMirroredChanged = d->mirroredScreensTracker->screensMirrored(); | 318 | emitScreensMirroredChanged = d->mirroredScreensTracker->screensMirrored(); | ||
321 | d->mirroredScreensTracker.reset(); | 319 | d->mirroredScreensTracker.reset(); | ||
322 | } | 320 | } | ||
323 | 321 | | |||
324 | if (emitScreensMirroredChanged) { | 322 | if (emitScreensMirroredChanged) { | ||
325 | emit screensMirroredChanged(); | 323 | emit screensMirroredChanged(); | ||
326 | } | 324 | } | ||
327 | } else if (group.name() == QLatin1String("Notifications")) { | 325 | } else if (group.name() == QLatin1String("Notifications")) { | ||
328 | NotificationSettings::self()->load(); | 326 | d->notificationSettings.load(); | ||
329 | } else if (group.name() == QLatin1String("Jobs")) { | 327 | } else if (group.name() == QLatin1String("Jobs")) { | ||
330 | JobSettings::self()->load(); | 328 | d->jobSettings.load(); | ||
331 | } else if (group.name() == QLatin1String("Badges")) { | 329 | } else if (group.name() == QLatin1String("Badges")) { | ||
332 | BadgeSettings::self()->load(); | 330 | d->badgeSettings.load(); | ||
333 | } | 331 | } | ||
334 | 332 | | |||
335 | emit settingsChanged(); | 333 | emit settingsChanged(); | ||
336 | }); | 334 | }); | ||
337 | } else { | 335 | } else { | ||
338 | disconnect(d->watcherConnection); | 336 | disconnect(d->watcherConnection); | ||
339 | d->watcherConnection = QMetaObject::Connection(); | 337 | d->watcherConnection = QMetaObject::Connection(); | ||
340 | d->watcher.reset(); | 338 | d->watcher.reset(); | ||
341 | } | 339 | } | ||
342 | 340 | | |||
343 | emit liveChanged(); | 341 | emit liveChanged(); | ||
344 | } | 342 | } | ||
345 | 343 | | |||
346 | bool Settings::dirty() const | 344 | bool Settings::dirty() const | ||
347 | { | 345 | { | ||
348 | // KConfigSkeleton doesn't write into the KConfig until calling save() | 346 | // KConfigSkeleton doesn't write into the KConfig until calling save() | ||
349 | // so we need to track d->config->isDirty() manually | 347 | // so we need to track d->config->isDirty() manually | ||
350 | return d->dirty; | 348 | return d->dirty; | ||
351 | } | 349 | } | ||
352 | 350 | | |||
353 | bool Settings::keepCriticalAlwaysOnTop() const | 351 | bool Settings::keepCriticalAlwaysOnTop() const | ||
354 | { | 352 | { | ||
355 | return NotificationSettings::criticalAlwaysOnTop(); | 353 | return d->notificationSettings.criticalAlwaysOnTop(); | ||
356 | } | 354 | } | ||
357 | 355 | | |||
358 | void Settings::setKeepCriticalAlwaysOnTop(bool enable) | 356 | void Settings::setKeepCriticalAlwaysOnTop(bool enable) | ||
359 | { | 357 | { | ||
360 | if (this->keepCriticalAlwaysOnTop() == enable) { | 358 | if (this->keepCriticalAlwaysOnTop() == enable) { | ||
361 | return; | 359 | return; | ||
362 | } | 360 | } | ||
363 | NotificationSettings::setCriticalAlwaysOnTop(enable); | 361 | d->notificationSettings.setCriticalAlwaysOnTop(enable); | ||
364 | d->setDirty(true); | 362 | d->setDirty(true); | ||
365 | } | 363 | } | ||
366 | 364 | | |||
367 | bool Settings::criticalPopupsInDoNotDisturbMode() const | 365 | bool Settings::criticalPopupsInDoNotDisturbMode() const | ||
368 | { | 366 | { | ||
369 | return NotificationSettings::criticalInDndMode(); | 367 | return d->notificationSettings.criticalInDndMode(); | ||
370 | } | 368 | } | ||
371 | 369 | | |||
372 | void Settings::setCriticalPopupsInDoNotDisturbMode(bool enable) | 370 | void Settings::setCriticalPopupsInDoNotDisturbMode(bool enable) | ||
373 | { | 371 | { | ||
374 | if (this->criticalPopupsInDoNotDisturbMode() == enable) { | 372 | if (this->criticalPopupsInDoNotDisturbMode() == enable) { | ||
375 | return; | 373 | return; | ||
376 | } | 374 | } | ||
377 | NotificationSettings::setCriticalInDndMode(enable); | 375 | d->notificationSettings.setCriticalInDndMode(enable); | ||
378 | d->setDirty(true); | 376 | d->setDirty(true); | ||
379 | } | 377 | } | ||
380 | 378 | | |||
381 | bool Settings::lowPriorityPopups() const | 379 | bool Settings::lowPriorityPopups() const | ||
382 | { | 380 | { | ||
383 | return NotificationSettings::lowPriorityPopups(); | 381 | return d->notificationSettings.lowPriorityPopups(); | ||
384 | } | 382 | } | ||
385 | 383 | | |||
386 | void Settings::setLowPriorityPopups(bool enable) | 384 | void Settings::setLowPriorityPopups(bool enable) | ||
387 | { | 385 | { | ||
388 | if (this->lowPriorityPopups() == enable) { | 386 | if (this->lowPriorityPopups() == enable) { | ||
389 | return; | 387 | return; | ||
390 | } | 388 | } | ||
391 | NotificationSettings::setLowPriorityPopups(enable); | 389 | d->notificationSettings.setLowPriorityPopups(enable); | ||
392 | d->setDirty(true); | 390 | d->setDirty(true); | ||
393 | } | 391 | } | ||
394 | 392 | | |||
395 | bool Settings::lowPriorityHistory() const | 393 | bool Settings::lowPriorityHistory() const | ||
396 | { | 394 | { | ||
397 | return NotificationSettings::lowPriorityHistory(); | 395 | return d->notificationSettings.lowPriorityHistory(); | ||
398 | } | 396 | } | ||
399 | 397 | | |||
400 | void Settings::setLowPriorityHistory(bool enable) | 398 | void Settings::setLowPriorityHistory(bool enable) | ||
401 | { | 399 | { | ||
402 | if (this->lowPriorityHistory() == enable) { | 400 | if (this->lowPriorityHistory() == enable) { | ||
403 | return; | 401 | return; | ||
404 | } | 402 | } | ||
405 | NotificationSettings::setLowPriorityHistory(enable); | 403 | d->notificationSettings.setLowPriorityHistory(enable); | ||
406 | d->setDirty(true); | 404 | d->setDirty(true); | ||
407 | } | 405 | } | ||
408 | 406 | | |||
409 | Settings::PopupPosition Settings::popupPosition() const | 407 | Settings::PopupPosition Settings::popupPosition() const | ||
410 | { | 408 | { | ||
411 | return NotificationSettings::popupPosition(); | 409 | return static_cast<Settings::PopupPosition>(d->notificationSettings.popupPosition()); | ||
412 | } | 410 | } | ||
413 | 411 | | |||
414 | void Settings::setPopupPosition(Settings::PopupPosition position) | 412 | void Settings::setPopupPosition(Settings::PopupPosition position) | ||
415 | { | 413 | { | ||
416 | if (this->popupPosition() == position) { | 414 | if (this->popupPosition() == position) { | ||
417 | return; | 415 | return; | ||
418 | } | 416 | } | ||
419 | NotificationSettings::setPopupPosition(position); | 417 | d->notificationSettings.setPopupPosition(position); | ||
420 | d->setDirty(true); | 418 | d->setDirty(true); | ||
421 | } | 419 | } | ||
422 | 420 | | |||
423 | int Settings::popupTimeout() const | 421 | int Settings::popupTimeout() const | ||
424 | { | 422 | { | ||
425 | return NotificationSettings::popupTimeout(); | 423 | return d->notificationSettings.popupTimeout(); | ||
426 | } | 424 | } | ||
427 | 425 | | |||
428 | void Settings::setPopupTimeout(int timeout) | 426 | void Settings::setPopupTimeout(int timeout) | ||
429 | { | 427 | { | ||
430 | if (this->popupTimeout() == timeout) { | 428 | if (this->popupTimeout() == timeout) { | ||
431 | return; | 429 | return; | ||
432 | } | 430 | } | ||
433 | NotificationSettings::setPopupTimeout(timeout); | 431 | d->notificationSettings.setPopupTimeout(timeout); | ||
434 | d->setDirty(true); | 432 | d->setDirty(true); | ||
435 | } | 433 | } | ||
436 | 434 | | |||
437 | void Settings::resetPopupTimeout() | 435 | void Settings::resetPopupTimeout() | ||
438 | { | 436 | { | ||
439 | setPopupTimeout(NotificationSettings::defaultPopupTimeoutValue()); | 437 | setPopupTimeout(d->notificationSettings.defaultPopupTimeoutValue()); | ||
440 | } | 438 | } | ||
441 | 439 | | |||
442 | bool Settings::jobsInTaskManager() const | 440 | bool Settings::jobsInTaskManager() const | ||
443 | { | 441 | { | ||
444 | return JobSettings::inTaskManager(); | 442 | return d->jobSettings.inTaskManager(); | ||
445 | } | 443 | } | ||
446 | 444 | | |||
447 | void Settings::setJobsInTaskManager(bool enable) | 445 | void Settings::setJobsInTaskManager(bool enable) | ||
448 | { | 446 | { | ||
449 | if (jobsInTaskManager() == enable) { | 447 | if (jobsInTaskManager() == enable) { | ||
450 | return; | 448 | return; | ||
451 | } | 449 | } | ||
452 | JobSettings::setInTaskManager(enable); | 450 | d->jobSettings.setInTaskManager(enable); | ||
453 | d->setDirty(true); | 451 | d->setDirty(true); | ||
454 | } | 452 | } | ||
455 | 453 | | |||
456 | bool Settings::jobsInNotifications() const | 454 | bool Settings::jobsInNotifications() const | ||
457 | { | 455 | { | ||
458 | return JobSettings::inNotifications(); | 456 | return d->jobSettings.inNotifications(); | ||
459 | } | 457 | } | ||
460 | void Settings::setJobsInNotifications(bool enable) | 458 | void Settings::setJobsInNotifications(bool enable) | ||
461 | { | 459 | { | ||
462 | if (jobsInNotifications() == enable) { | 460 | if (jobsInNotifications() == enable) { | ||
463 | return; | 461 | return; | ||
464 | } | 462 | } | ||
465 | JobSettings::setInNotifications(enable); | 463 | d->jobSettings.setInNotifications(enable); | ||
466 | d->setDirty(true); | 464 | d->setDirty(true); | ||
467 | } | 465 | } | ||
468 | 466 | | |||
469 | bool Settings::permanentJobPopups() const | 467 | bool Settings::permanentJobPopups() const | ||
470 | { | 468 | { | ||
471 | return JobSettings::permanentPopups(); | 469 | return d->jobSettings.permanentPopups(); | ||
472 | } | 470 | } | ||
473 | 471 | | |||
474 | void Settings::setPermanentJobPopups(bool enable) | 472 | void Settings::setPermanentJobPopups(bool enable) | ||
475 | { | 473 | { | ||
476 | if (permanentJobPopups() == enable) { | 474 | if (permanentJobPopups() == enable) { | ||
477 | return; | 475 | return; | ||
478 | } | 476 | } | ||
479 | JobSettings::setPermanentPopups(enable); | 477 | d->jobSettings.setPermanentPopups(enable); | ||
480 | d->setDirty(true); | 478 | d->setDirty(true); | ||
481 | } | 479 | } | ||
482 | 480 | | |||
483 | bool Settings::badgesInTaskManager() const | 481 | bool Settings::badgesInTaskManager() const | ||
484 | { | 482 | { | ||
485 | return BadgeSettings::inTaskManager(); | 483 | return d->badgeSettings.inTaskManager(); | ||
486 | } | 484 | } | ||
487 | 485 | | |||
488 | void Settings::setBadgesInTaskManager(bool enable) | 486 | void Settings::setBadgesInTaskManager(bool enable) | ||
489 | { | 487 | { | ||
490 | if (badgesInTaskManager() == enable) { | 488 | if (badgesInTaskManager() == enable) { | ||
491 | return; | 489 | return; | ||
492 | } | 490 | } | ||
493 | BadgeSettings::setInTaskManager(enable); | 491 | d->badgeSettings.setInTaskManager(enable); | ||
494 | d->setDirty(true); | 492 | d->setDirty(true); | ||
495 | } | 493 | } | ||
496 | 494 | | |||
497 | QStringList Settings::knownApplications() const | 495 | QStringList Settings::knownApplications() const | ||
498 | { | 496 | { | ||
499 | return d->applicationsGroup().groupList(); | 497 | return d->applicationsGroup().groupList(); | ||
500 | } | 498 | } | ||
501 | 499 | | |||
Show All 29 Lines | |||||
531 | 529 | | |||
532 | QStringList Settings::badgeBlacklistedApplications() const | 530 | QStringList Settings::badgeBlacklistedApplications() const | ||
533 | { | 531 | { | ||
534 | return d->behaviorMatchesList(d->applicationsGroup(), ShowBadges, false); | 532 | return d->behaviorMatchesList(d->applicationsGroup(), ShowBadges, false); | ||
535 | } | 533 | } | ||
536 | 534 | | |||
537 | QDateTime Settings::notificationsInhibitedUntil() const | 535 | QDateTime Settings::notificationsInhibitedUntil() const | ||
538 | { | 536 | { | ||
539 | return DoNotDisturbSettings::until(); | 537 | return d->dndSettings.until(); | ||
540 | } | 538 | } | ||
541 | 539 | | |||
542 | void Settings::setNotificationsInhibitedUntil(const QDateTime &time) | 540 | void Settings::setNotificationsInhibitedUntil(const QDateTime &time) | ||
543 | { | 541 | { | ||
544 | DoNotDisturbSettings::setUntil(time); | 542 | d->dndSettings.setUntil(time); | ||
545 | d->setDirty(true); | 543 | d->setDirty(true); | ||
546 | } | 544 | } | ||
547 | 545 | | |||
548 | void Settings::resetNotificationsInhibitedUntil() | 546 | void Settings::resetNotificationsInhibitedUntil() | ||
549 | { | 547 | { | ||
550 | setNotificationsInhibitedUntil(QDateTime());// FIXME DoNotDisturbSettings::defaultUntilValue()); | 548 | setNotificationsInhibitedUntil(QDateTime());// FIXME d->dndSettings.defaultUntilValue()); | ||
551 | } | 549 | } | ||
552 | 550 | | |||
553 | bool Settings::notificationsInhibitedByApplication() const | 551 | bool Settings::notificationsInhibitedByApplication() const | ||
554 | { | 552 | { | ||
555 | return Server::self().inhibitedByApplication(); | 553 | return Server::self().inhibitedByApplication(); | ||
556 | } | 554 | } | ||
557 | 555 | | |||
558 | QStringList Settings::notificationInhibitionApplications() const | 556 | QStringList Settings::notificationInhibitionApplications() const | ||
559 | { | 557 | { | ||
560 | return Server::self().inhibitionApplications(); | 558 | return Server::self().inhibitionApplications(); | ||
561 | } | 559 | } | ||
562 | 560 | | |||
563 | QStringList Settings::notificationInhibitionReasons() const | 561 | QStringList Settings::notificationInhibitionReasons() const | ||
564 | { | 562 | { | ||
565 | return Server::self().inhibitionReasons(); | 563 | return Server::self().inhibitionReasons(); | ||
566 | } | 564 | } | ||
567 | 565 | | |||
568 | bool Settings::inhibitNotificationsWhenScreensMirrored() const | 566 | bool Settings::inhibitNotificationsWhenScreensMirrored() const | ||
569 | { | 567 | { | ||
570 | return DoNotDisturbSettings::whenScreensMirrored(); | 568 | return d->dndSettings.whenScreensMirrored(); | ||
571 | } | 569 | } | ||
572 | 570 | | |||
573 | void Settings::setInhibitNotificationsWhenScreensMirrored(bool inhibit) | 571 | void Settings::setInhibitNotificationsWhenScreensMirrored(bool inhibit) | ||
574 | { | 572 | { | ||
575 | if (inhibit == inhibitNotificationsWhenScreensMirrored()) { | 573 | if (inhibit == inhibitNotificationsWhenScreensMirrored()) { | ||
576 | return; | 574 | return; | ||
577 | } | 575 | } | ||
578 | 576 | | |||
579 | DoNotDisturbSettings::setWhenScreensMirrored(inhibit); | 577 | d->dndSettings.setWhenScreensMirrored(inhibit); | ||
580 | d->setDirty(true); | 578 | d->setDirty(true); | ||
581 | } | 579 | } | ||
582 | 580 | | |||
583 | bool Settings::screensMirrored() const | 581 | bool Settings::screensMirrored() const | ||
584 | { | 582 | { | ||
585 | return d->mirroredScreensTracker && d->mirroredScreensTracker->screensMirrored(); | 583 | return d->mirroredScreensTracker && d->mirroredScreensTracker->screensMirrored(); | ||
586 | } | 584 | } | ||
587 | 585 | | |||
Show All 11 Lines | |||||
599 | 597 | | |||
600 | void Settings::revokeApplicationInhibitions() | 598 | void Settings::revokeApplicationInhibitions() | ||
601 | { | 599 | { | ||
602 | Server::self().clearInhibitions(); | 600 | Server::self().clearInhibitions(); | ||
603 | } | 601 | } | ||
604 | 602 | | |||
605 | bool Settings::notificationSoundsInhibited() const | 603 | bool Settings::notificationSoundsInhibited() const | ||
606 | { | 604 | { | ||
607 | return DoNotDisturbSettings::notificationSoundsMuted(); | 605 | return d->dndSettings.notificationSoundsMuted(); | ||
608 | } | 606 | } | ||
609 | 607 | | |||
610 | void Settings::setNotificationSoundsInhibited(bool inhibited) | 608 | void Settings::setNotificationSoundsInhibited(bool inhibited) | ||
611 | { | 609 | { | ||
612 | if (inhibited == notificationSoundsInhibited()) { | 610 | if (inhibited == notificationSoundsInhibited()) { | ||
613 | return; | 611 | return; | ||
614 | } | 612 | } | ||
615 | 613 | | |||
616 | DoNotDisturbSettings::setNotificationSoundsMuted(inhibited); | 614 | d->dndSettings.setNotificationSoundsMuted(inhibited); | ||
617 | d->setDirty(true); | 615 | d->setDirty(true); | ||
618 | } | 616 | } |
I still want to be able to specify what config (constructor argument) to use for autotests