KPackage

packagestructure.cpp
1 /*
2  SPDX-FileCopyrightText: 2011 Aaron Seigo <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "packagestructure.h"
8 #include "kpackage_debug.h"
9 #include "private/package_p.h"
10 #include <private/packagejob_p.h>
11 
12 namespace KPackage
13 {
14 PackageStructure::PackageStructure(QObject *parent, const QVariantList &args)
15  : QObject(parent)
16  , d(nullptr)
17 {
18  Q_UNUSED(args)
19 }
20 
21 PackageStructure::~PackageStructure()
22 {
23 }
24 
26 {
27  Q_UNUSED(package)
28 }
29 
31 {
32  Q_UNUSED(package)
33 }
34 
35 KJob *PackageStructure::install(Package *package, const QString &archivePath, const QString &packageRoot)
36 {
37  PackageJob *j = new PackageJob(package);
38  j->install(archivePath, packageRoot);
39  return j;
40 }
41 
42 KJob *PackageStructure::update(Package *package, const QString &archivePath, const QString &packageRoot)
43 {
44  PackageJob *j = new PackageJob(package);
45  j->update(archivePath, packageRoot);
46  return j;
47 }
48 
49 KJob *PackageStructure::uninstall(Package *package, const QString &packageRoot)
50 {
51  PackageJob *j = new PackageJob(package);
52  const QString pluginID = package->metadata().pluginId();
53  QString uninstallPath;
54  // We handle the empty path when uninstalling the package
55  // If the dir already got deleted the pluginId is an empty string, without this
56  // check we would delete the package root, BUG: 410682
57  if (!pluginID.isEmpty()) {
58  uninstallPath = packageRoot + QLatin1Char('/') + pluginID;
59  }
60  j->uninstall(uninstallPath);
61  return j;
62 }
63 
64 }
65 
66 #include "moc_packagestructure.cpp"
virtual KJob * uninstall(Package *package, const QString &packageRoot)
Uninstalls a package matching this package structure.
virtual void initPackage(Package *package)
Called when a the PackageStructure should initialize a Package with the initial structure.
bool isEmpty() const const
object representing an installed package
Definition: package.h:66
Namespace for everything in kpackage.
Definition: package.cpp:33
KPluginMetaData metadata() const
Definition: package.cpp:200
virtual KJob * install(Package *package, const QString &archivePath, const QString &packageRoot)
Installs a package matching this package structure.
virtual void pathChanged(Package *package)
Called whenever the path changes so that subclasses may take package specific actions.
virtual KJob * update(Package *package, const QString &archivePath, const QString &packageRoot)
Updates a package matching this package structure.
QString pluginId() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:53:13 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.