File indexing completed on 2024-05-12 16:58:56
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 0043 private: 0044 const QString m_name; 0045 const QString m_description; 0046 }; 0047 0048 class DISCOVERNOTIFIERS_EXPORT BackendNotifierModule : public QObject 0049 { 0050 Q_OBJECT 0051 public: 0052 explicit BackendNotifierModule(QObject *parent = nullptr); 0053 ~BackendNotifierModule() override; 0054 0055 /*** Check for new updates. Emits @see foundUpdates when it finds something. **/ 0056 virtual void recheckSystemUpdateNeeded() = 0; 0057 0058 /*** @returns count of !security updates only. **/ 0059 virtual bool hasUpdates() = 0; 0060 0061 /*** @returns count of security updates only. **/ 0062 virtual bool hasSecurityUpdates() = 0; 0063 0064 /** @returns whether the system changed in a way that needs to be rebooted. */ 0065 virtual bool needsReboot() const = 0; 0066 0067 Q_SIGNALS: 0068 /** 0069 * This signal is emitted when any new updates are available. 0070 * @see recheckSystemUpdateNeeded 0071 */ 0072 void foundUpdates(); 0073 0074 /** Notifies that the system needs a reboot. @see needsReboot */ 0075 void needsRebootChanged(); 0076 0077 /** notifies about an available upgrade */ 0078 void foundUpgradeAction(UpgradeAction *action); 0079 }; 0080 0081 Q_DECLARE_INTERFACE(BackendNotifierModule, "org.kde.discover.BackendNotifierModule")