File indexing completed on 2024-04-21 16:29:34

0001 /***************************************************************************
0002  *   Copyright (C) 2008 by Trever Fischer                                  *
0003  *   wm161@wm161.net                                                       *
0004  *   Copyright (C) 2008-2011 by Daniel Nicoletti                           *
0005  *   dantti12@gmail.com                                                    *
0006  *                                                                         *
0007  *   This program is free software; you can redistribute it and/or modify  *
0008  *   it under the terms of the GNU General Public License as published by  *
0009  *   the Free Software Foundation; either version 2 of the License, or     *
0010  *   (at your option) any later version.                                   *
0011  *                                                                         *
0012  *   This program is distributed in the hope that it will be useful,       *
0013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0015  *   GNU General Public License for more details.                          *
0016  *                                                                         *
0017  *   You should have received a copy of the GNU General Public License     *
0018  *   along with this program; see the file COPYING. If not, write to       *
0019  *   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,  *
0020  *   Boston, MA 02110-1301, USA.                                           *
0021  ***************************************************************************/
0022 
0023 #ifndef UPDATER_H
0024 #define UPDATER_H
0025 
0026 #include <PkTransaction.h>
0027 
0028 #include <QStringList>
0029 
0030 using namespace PackageKit;
0031 
0032 class Updater : public QObject
0033 {
0034     Q_OBJECT
0035 public:
0036     explicit Updater(QObject *parent = nullptr);
0037     ~Updater() override;
0038 
0039     void setConfig(const QVariantHash &configs);
0040     void setSystemReady();
0041 
0042 public Q_SLOTS:
0043     void checkForUpdates(bool systemReady);
0044 
0045 private Q_SLOTS:
0046     void packageToUpdate(PackageKit::Transaction::Info info, const QString &packageID, const QString &summary);
0047     void getUpdateFinished();
0048     void autoUpdatesFinished(PkTransaction::ExitStatus exit);
0049     void reviewUpdates();
0050     void installUpdates();
0051     void serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner);
0052 
0053 private:
0054     void showUpdatesPopup();
0055     bool updatePackages(const QStringList &packages, bool downloadOnly, const QString &icon = QString(), const QString &msg = QString());
0056 
0057     bool m_hasAppletIconified;
0058     bool m_systemReady;
0059     Transaction *m_getUpdatesT;
0060     QStringList m_oldUpdateList;
0061     QStringList m_updateList;
0062     QStringList m_importantList;
0063     QStringList m_securityList;
0064     QVariantHash m_configs;
0065 };
0066 
0067 #endif