KNewStuff

kpackagejob.h
1 /*
2  SPDX-FileCopyrightText: 2020 Dan Leinir Turthra Jensen <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6 
7 #ifndef KPACKAGEJOB_H
8 #define KPACKAGEJOB_H
9 
10 #include <KCoreAddons/KJob>
11 
12 namespace KNSCore
13 {
14 /**
15  * @brief A job for performing basic actions on KPackage packages asynchronously
16  *
17  * The internals of KPackage's Package functions are synchronous, which makes it easy to work with in some cases,
18  * but has the unfortunate side effect of blocking the UI. This job will perform those operations in a separate
19  * thread, which allows you to perform the work in a fire-and-forget fashion (as suggested by KJob's documentation).
20  *
21  * @since 5.71
22  */
23 class KPackageJob : public KJob
24 {
25  Q_OBJECT
26 public:
27  /**
28  * Create a job for installing the given package into the package root, and treat it as the given service type.
29  *
30  * @param sourcePackage The full path name to the package you wish to install (e.g. /tmp/downloaded-archive.tar.xz)
31  * @param packageRoot The full path name to the location the package should be installed into (e.g. /home/username/.share/plasma/desktoptheme/)
32  * @param serviceType The name of the type of KPackage you intend to install (e.g. Plasma/Theme)
33  * @return A job which you can use to track the completion of the process (there will be useful details in error() and errorText() on failures)
34  */
35  static KPackageJob *install(const QString &sourcePackage, const QString &packageRoot, const QString &serviceType);
36  /**
37  * Create a job for updating the given package, or installing it if it is not already, the given package into the
38  * package root, and treat it as the given service type.
39  *
40  * @param sourcePackage The full path name to the package you wish to update (e.g. /tmp/downloaded-archive.tar.xz)
41  * @param packageRoot The full path name to the location the package should be installed into (e.g. /home/username/.share/plasma/desktoptheme/)
42  * @param serviceType The name of the type of KPackage you intend to update (e.g. Plasma/Theme)
43  * @return A job which you can use to track the completion of the process (there will be useful details in error() and errorText() on failures)
44  */
45  static KPackageJob *update(const QString &sourcePackage, const QString &packageRoot, const QString &serviceType);
46  /**
47  * Create a job for removing the given installed package
48  *
49  * @param packageName The name to the package you wish to remove (this is the plugin name, not the full path name, e.g. The.Package.Name)
50  * @param packageRoot The full path name to the location the package is currently installed (e.g.
51  * /home/username/.share/plasma/desktoptheme/The.Package.Name)
52  * @param serviceType The name of the type of KPackage you intend to remove (e.g. Plasma/Theme)
53  * @return A job which you can use to track the completion of the process (there will be useful details in error() and errorText() on failures)
54  */
55  static KPackageJob *uninstall(const QString &packageName, const QString &packageRoot, const QString &serviceType);
56 
57  ~KPackageJob() override;
58 
59  /**
60  * Start the process asynchronously
61  * @see KJob::start()
62  */
63  Q_SLOT void start() override;
64 
65 private:
66  explicit KPackageJob(QObject *parent = nullptr);
67  class Private;
68  Private *d;
69 };
70 
71 }
72 
73 #endif // KPACKAGEJOB_H
static KPackageJob * uninstall(const QString &packageName, const QString &packageRoot, const QString &serviceType)
Create a job for removing the given installed package.
Contains the core functionality for handling interaction with NewStuff providers. ...
static KPackageJob * update(const QString &sourcePackage, const QString &packageRoot, const QString &serviceType)
Create a job for updating the given package, or installing it if it is not already, the given package into the package root, and treat it as the given service type.
A job for performing basic actions on KPackage packages asynchronously.
Definition: kpackagejob.h:23
Q_OBJECTQ_OBJECT
Q_SLOTQ_SLOT
static KPackageJob * install(const QString &sourcePackage, const QString &packageRoot, const QString &serviceType)
Create a job for installing the given package into the package root, and treat it as the given servic...
Q_SLOT void start() override
Start the process asynchronously.
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Nov 30 2021 22:38:13 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.