File indexing completed on 2024-12-08 03:41:23
0001 /* 0002 SPDX-FileCopyrightText: 2007-2009 Aaron Seigo <aseigo@kde.org> 0003 SPDX-FileCopyrightText: 2012 Sebastian Kügler <sebas@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KPACKAGE_PACKAGEJOBTHREAD_P_H 0009 #define KPACKAGE_PACKAGEJOBTHREAD_P_H 0010 0011 #include "package.h" 0012 #include "packagejob.h" 0013 #include <QRunnable> 0014 0015 namespace KPackage 0016 { 0017 class PackageJobThreadPrivate; 0018 0019 bool indexDirectory(const QString &dir, const QString &dest); 0020 0021 class PackageJobThread : public QObject, public QRunnable 0022 { 0023 Q_OBJECT 0024 public: 0025 explicit PackageJobThread(PackageJob::OperationType type, const QString &src, const QString &dest, const KPackage::Package &package); 0026 ~PackageJobThread() override; 0027 0028 void run() override; 0029 0030 bool install(const QString &src, const QString &dest, const Package &package); 0031 bool update(const QString &src, const QString &dest, const Package &package); 0032 bool uninstall(const QString &packagePath); 0033 0034 PackageJob::JobError errorCode() const; 0035 0036 Q_SIGNALS: 0037 void jobThreadFinished(bool success, PackageJob::JobError errorCode, const QString &errorMessage = QString()); 0038 void percentChanged(int percent); 0039 void error(const QString &errorMessage); 0040 void installPathChanged(const QString &installPath); 0041 0042 private: 0043 // OperationType says whether we want to install, update or any 0044 // new similar operation it will be expanded 0045 bool installDependency(const QUrl &src); 0046 bool installPackage(const QString &src, const QString &dest, const Package &package, PackageJob::OperationType operation); 0047 bool uninstallPackage(const QString &packagePath); 0048 PackageJobThreadPrivate *d; 0049 }; 0050 0051 } 0052 0053 #endif