File indexing completed on 2024-04-14 05:38:49

0001 /*******************************************************************************
0002  * Copyright (C) 2008-2013 Konstantinos Smanis <konstantinos.smanis@gmail.com> *
0003  *                                                                             *
0004  * This program is free software: you can redistribute it and/or modify it     *
0005  * under the terms of the GNU General Public License as published by the Free  *
0006  * Software Foundation, either version 3 of the License, or (at your option)   *
0007  * any later version.                                                          *
0008  *                                                                             *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT *
0010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       *
0011  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    *
0012  * more details.                                                               *
0013  *                                                                             *
0014  * You should have received a copy of the GNU General Public License along     *
0015  * with this program. If not, see <http://www.gnu.org/licenses/>.              *
0016  *******************************************************************************/
0017 
0018 #ifndef QPKBACKEND_H
0019 #define QPKBACKEND_H
0020 
0021 //Qt
0022 #include <QStringList>
0023 
0024 //PackageKit
0025 #include <PackageKit/Transaction>
0026 
0027 class QPkBackend : public QObject
0028 {
0029     Q_OBJECT
0030 public:
0031     explicit QPkBackend(QObject *parent = nullptr);
0032     virtual ~QPkBackend();
0033 
0034     QStringList ownerPackage(const QString &fileName);
0035     void markForRemoval(const QString &packageName);
0036     QStringList markedForRemoval() const;
0037     void removePackages();
0038     void undoChanges();
0039 Q_SIGNALS:
0040     void finished(bool success);
0041     void progress(const QString &status, int percentage);
0042 private Q_SLOTS:
0043     void slotFinished(PackageKit::Transaction::Exit status, uint runtime);
0044     void slotPackage(PackageKit::Transaction::Info info, const QString &packageId, const QString &summary);
0045     void slotUpdateProgress();
0046 private:
0047     bool packageExists(const QString &packageName);
0048 
0049     PackageKit::Transaction *m_t;
0050     PackageKit::Transaction::Exit m_status;
0051     QString m_packageId;
0052     QStringList m_remove;
0053     QStringList m_removeIds;
0054 };
0055 
0056 #endif