File indexing completed on 2024-09-01 10:27:11
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 <QThread> 0013 0014 namespace KPackage 0015 { 0016 class PackageJobThreadPrivate; 0017 0018 bool indexDirectory(const QString &dir, const QString &dest); 0019 0020 // true if version2 is more recent than version1 0021 // TODO: replace with QVersionNumber when we will be able to depend from Qt 5.6 0022 bool isVersionNewer(const QString &version1, const QString &version2); 0023 0024 class PackageJobThread : public QThread 0025 { 0026 Q_OBJECT 0027 0028 public: 0029 enum OperationType { 0030 Install, 0031 Update, 0032 }; 0033 0034 explicit PackageJobThread(QObject *parent = nullptr); 0035 ~PackageJobThread() override; 0036 0037 bool install(const QString &src, const QString &dest); 0038 bool update(const QString &src, const QString &dest); 0039 bool uninstall(const QString &packagePath); 0040 0041 Package::JobError errorCode() const; 0042 0043 Q_SIGNALS: 0044 void jobThreadFinished(bool success, const QString &errorMessage = QString()); 0045 void percentChanged(int percent); 0046 void error(const QString &errorMessage); 0047 void installPathChanged(const QString &installPath); 0048 0049 private: 0050 // OperationType says whether we want to install, update or any 0051 // new similar operation it will be expanded 0052 bool installDependency(const QUrl &src); 0053 bool installPackage(const QString &src, const QString &dest, OperationType operation); 0054 bool uninstallPackage(const QString &packagePath); 0055 PackageJobThreadPrivate *d; 0056 }; 0057 0058 } 0059 0060 #endif