| 1 | /* | 
|---|
| 2 | SPDX-FileCopyrightText: 2007-2009 Aaron Seigo <aseigo@kde.org> | 
|---|
| 3 | SPDX-FileCopyrightText: 2012 Sebastian Kügler <sebas@kde.org> | 
|---|
| 4 |  | 
|---|
| 5 | SPDX-License-Identifier: LGPL-2.0-or-later | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef KPACKAGE_PACKAGEJOBTHREAD_P_H | 
|---|
| 9 | #define KPACKAGE_PACKAGEJOBTHREAD_P_H | 
|---|
| 10 |  | 
|---|
| 11 | #include "package.h" | 
|---|
| 12 | #include "packagejob.h" | 
|---|
| 13 | #include <QRunnable> | 
|---|
| 14 |  | 
|---|
| 15 | namespace KPackage | 
|---|
| 16 | { | 
|---|
| 17 | class PackageJobThreadPrivate; | 
|---|
| 18 |  | 
|---|
| 19 | bool indexDirectory(const QString &dir, const QString &dest); | 
|---|
| 20 |  | 
|---|
| 21 | class PackageJobThread : public QObject, public QRunnable | 
|---|
| 22 | { | 
|---|
| 23 | Q_OBJECT | 
|---|
| 24 | public: | 
|---|
| 25 | explicit PackageJobThread(PackageJob::OperationType type, const QString &src, const QString &dest, const KPackage::Package &package); | 
|---|
| 26 | ~PackageJobThread() override; | 
|---|
| 27 |  | 
|---|
| 28 | void run() override; | 
|---|
| 29 |  | 
|---|
| 30 | bool install(const QString &src, const QString &dest, const Package &package); | 
|---|
| 31 | bool update(const QString &src, const QString &dest, const Package &package); | 
|---|
| 32 | bool uninstall(const QString &packagePath); | 
|---|
| 33 |  | 
|---|
| 34 | PackageJob::JobError errorCode() const; | 
|---|
| 35 |  | 
|---|
| 36 | Q_SIGNALS: | 
|---|
| 37 | void jobThreadFinished(bool success, PackageJob::JobError errorCode, const QString &errorMessage = QString()); | 
|---|
| 38 | void percentChanged(int percent); | 
|---|
| 39 | void error(const QString &errorMessage); | 
|---|
| 40 | void installPathChanged(const QString &installPath); | 
|---|
| 41 |  | 
|---|
| 42 | private: | 
|---|
| 43 | // OperationType says whether we want to install, update or any | 
|---|
| 44 | // new similar operation it will be expanded | 
|---|
| 45 | bool installDependency(const QUrl &src); | 
|---|
| 46 | bool installPackage(const QString &src, const QString &dest, const Package &package, PackageJob::OperationType operation); | 
|---|
| 47 | bool uninstallPackage(const QString &packagePath); | 
|---|
| 48 | PackageJobThreadPrivate *d; | 
|---|
| 49 | }; | 
|---|
| 50 |  | 
|---|
| 51 | } | 
|---|
| 52 |  | 
|---|
| 53 | #endif | 
|---|
| 54 |  | 
|---|