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

0001 /***************************************************************************
0002  *   Copyright (C) 2009-2011 by Daniel Nicoletti                           *
0003  *   dantti12@gmail.com                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; see the file COPYING. If not, write to       *
0017  *   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,  *
0018  *   Boston, MA 02110-1301, USA.                                           *
0019  ***************************************************************************/
0020 
0021 #ifndef DISTRO_UPGRADE_H
0022 #define DISTRO_UPGRADE_H
0023 
0024 #include <QProcess>
0025 
0026 #include <Transaction>
0027 
0028 using namespace PackageKit;
0029 
0030 class DistroUpgrade : public QObject
0031 {
0032     Q_OBJECT
0033 public:
0034     explicit DistroUpgrade(QObject *parent = nullptr);
0035     ~DistroUpgrade() override;
0036 
0037     void setConfig(const QVariantHash &configs);
0038 
0039 public Q_SLOTS:
0040     void checkDistroUpgrades();
0041 
0042 private Q_SLOTS:
0043     void distroUpgrade(PackageKit::Transaction::DistroUpgrade type, const QString &name, const QString &description);
0044     void checkDistroFinished(PackageKit::Transaction::Exit status, uint enlapsed);
0045     void handleDistroUpgradeAction(uint action);
0046     void distroUpgradeError(QProcess::ProcessError error);
0047     void distroUpgradeFinished(int exitCode, QProcess::ExitStatus exitStatus);
0048 
0049 private:
0050     QProcess *m_distroUpgradeProcess;
0051     Transaction *m_transaction;
0052     QVariantHash m_configs;
0053     QStringList m_shownDistroUpgrades;
0054 };
0055 
0056 #endif