File: BackendNotifierModule.h

package info (click to toggle)
plasma-discover 6.5.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,288 kB
  • sloc: cpp: 30,576; xml: 2,710; python: 311; sh: 5; makefile: 5
file content (83 lines) | stat: -rw-r--r-- 2,093 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 *   SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
 *
 *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
 */

#pragma once

#include "DiscoverConfig.h"
#include "discovernotifiers_export.h"
#include <QObject>

class DISCOVERNOTIFIERS_EXPORT UpgradeAction : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString name READ name CONSTANT)
    Q_PROPERTY(QString description READ description CONSTANT)
public:
    UpgradeAction(const QString &name, const QString &description, QObject *parent)
        : QObject(parent)
        , m_name(name)
        , m_description(description)
    {
    }

    QString name() const
    {
        return m_name;
    }

    QString description() const
    {
        return m_description;
    }

    void trigger()
    {
        Q_EMIT triggered(m_name);
    }

Q_SIGNALS:
    void triggered(const QString &name);
    void showDiscoverUpdates();

private:
    const QString m_name;
    const QString m_description;
};

class DISCOVERNOTIFIERS_EXPORT BackendNotifierModule : public QObject
{
    Q_OBJECT
public:
    explicit BackendNotifierModule(QObject *parent = nullptr);
    ~BackendNotifierModule() override;

    /*** Check for new updates. Emits @see foundUpdates when it finds something. **/
    virtual void recheckSystemUpdateNeeded() = 0;

    /*** @returns count of !security updates only. **/
    virtual bool hasUpdates() = 0;

    /*** @returns count of security updates only. **/
    virtual bool hasSecurityUpdates() = 0;

    /** @returns whether the system changed in a way that needs to be rebooted. */
    virtual bool needsReboot() const = 0;

Q_SIGNALS:
    /**
     * This signal is emitted when any new updates are available.
     * @see recheckSystemUpdateNeeded
     */
    void foundUpdates();

    /** Notifies that the system needs a reboot. @see needsReboot */
    void needsRebootChanged();

    /** notifies about an available upgrade */
    void foundUpgradeAction(UpgradeAction *action);
};

Q_DECLARE_INTERFACE(BackendNotifierModule, DISCOVER_NOTIFIER_IID)