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
15namespace KPackage
16{
17class PackageJobThreadPrivate;
18
19bool indexDirectory(const QString &dir, const QString &dest);
20
21class PackageJobThread : public QObject, public QRunnable
22{
23 Q_OBJECT
24public:
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
36Q_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
42private:
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

source code of kpackage/src/kpackage/private/packagejobthread_p.h