File indexing completed on 2024-04-28 09:40:24
0001 /* 0002 SPDX-FileCopyrightText: 2018 Harald Sitter <sitter@kde.org> 0003 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 */ 0005 0006 #include "screensaverinhibitor.h" 0007 0008 #include <KLocalizedString> 0009 #include <KNotificationRestrictions> 0010 0011 #include "upgraderwatcher.h" 0012 0013 ScreenSaverInhibitor::ScreenSaverInhibitor(QObject *parent) 0014 : QObject(parent) 0015 { 0016 auto watcher = UpgraderWatcher::self(); 0017 connect(watcher, &UpgraderWatcher::upgraderRunning, this, [this]() { 0018 m_restriction = new KNotificationRestrictions(KNotificationRestrictions::ScreenSaver, 0019 i18nc("Screensaver inhibition reason", "Upgrading Operating System")); 0020 }); 0021 connect(watcher, &UpgraderWatcher::upgraderNotRunning, this, [this]() { 0022 delete m_restriction; 0023 m_restriction = nullptr; 0024 }); 0025 }