File indexing completed on 2024-04-21 05:45:11

0001 /*
0002     SPDX-FileCopyrightText: 2018 Jonathan Riddell <jr@jriddell.org>
0003     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #pragma once
0007 
0008 #include <QObject>
0009 
0010 class DBusInterface;
0011 class Notifier;
0012 class QProcess;
0013 class QNetworkReply;
0014 class UpgraderProcess;
0015 
0016 class DistroReleaseNotifier : public QObject
0017 {
0018     Q_OBJECT
0019 public:
0020     DistroReleaseNotifier(QObject *parent = nullptr);
0021 
0022 private Q_SLOTS:
0023     void checkReleaseUpgradeFinished(int exitCode);
0024     void releaseUpgradeCheck();
0025     void releaseUpgradeActivated();
0026     void forceCheck();
0027     void replyFinished(QNetworkReply *reply);
0028 
0029 private:
0030     DBusInterface *m_dbus;
0031     QProcess *m_checkerProcess;
0032     Notifier *m_notifier;
0033 
0034     // This acts as a safe guard. We listen to network device connections
0035     // to check on network connections. This can get super annoying for users
0036     // if we do in fact act on this a lot of times. So, instead this var
0037     // tracks if we ever had a successful check and if so prevents any further
0038     // checks from even running.
0039     bool m_hasChecked;
0040     QString m_name;
0041     QString m_version;
0042 
0043     // Upgrader is started but not yet on dbus = pending.
0044     // This process auto-deleted itself.
0045     UpgraderProcess *m_pendingUpgrader = nullptr;
0046 };