File indexing completed on 2024-05-12 05:29:02
0001 /* 0002 * SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include "discovernotifiers_export.h" 0010 #include <QObject> 0011 0012 class DISCOVERNOTIFIERS_EXPORT UpgradeAction : public QObject 0013 { 0014 Q_OBJECT 0015 Q_PROPERTY(QString name READ name CONSTANT) 0016 Q_PROPERTY(QString description READ description CONSTANT) 0017 public: 0018 UpgradeAction(const QString &name, const QString &description, QObject *parent) 0019 : QObject(parent) 0020 , m_name(name) 0021 , m_description(description) 0022 { 0023 } 0024 0025 QString name() const 0026 { 0027 return m_name; 0028 } 0029 0030 QString description() const 0031 { 0032 return m_description; 0033 } 0034 0035 void trigger() 0036 { 0037 Q_EMIT triggered(m_name); 0038 } 0039 0040 Q_SIGNALS: 0041 void triggered(const QString &name); 0042 void showDiscoverUpdates(); 0043 0044 private: 0045 const QString m_name; 0046 const QString m_description; 0047 }; 0048 0049 class DISCOVERNOTIFIERS_EXPORT BackendNotifierModule : public QObject 0050 { 0051 Q_OBJECT 0052 public: 0053 explicit BackendNotifierModule(QObject *parent = nullptr); 0054 ~BackendNotifierModule() override; 0055 0056 /*** Check for new updates. Emits @see foundUpdates when it finds something. **/ 0057 virtual void recheckSystemUpdateNeeded() = 0; 0058 0059 /*** @returns count of !security updates only. **/ 0060 virtual bool hasUpdates() = 0; 0061 0062 /*** @returns count of security updates only. **/ 0063 virtual bool hasSecurityUpdates() = 0; 0064 0065 /** @returns whether the system changed in a way that needs to be rebooted. */ 0066 virtual bool needsReboot() const = 0; 0067 0068 Q_SIGNALS: 0069 /** 0070 * This signal is emitted when any new updates are available. 0071 * @see recheckSystemUpdateNeeded 0072 */ 0073 void foundUpdates(); 0074 0075 /** Notifies that the system needs a reboot. @see needsReboot */ 0076 void needsRebootChanged(); 0077 0078 /** notifies about an available upgrade */ 0079 void foundUpgradeAction(UpgradeAction *action); 0080 }; 0081 0082 Q_DECLARE_INTERFACE(BackendNotifierModule, "org.kde.discover.BackendNotifierModule")