Plasma5Support

packagekitjob.cpp
1/*
2 SPDX-FileCopyrightText: 2012 Gregor Taetzner <gregor@freenet.de>
3
4 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
5*/
6
7#include "packagekitjob.h"
8#include <QDBusConnection>
9#include <QDBusMessage>
10
11PackagekitJob::PackagekitJob(const QString &destination, const QString &operation, const QMap<QString, QVariant> &parameters, QObject *parent)
12 : ServiceJob(destination, operation, parameters, parent)
13{
14}
15
16PackagekitJob::~PackagekitJob()
17{
18}
19
20void PackagekitJob::start()
21{
22 const QString operation = operationName();
23
24 if (operation == QLatin1String("uninstallApplication")) {
25 QStringList files(parameters()[QStringLiteral("Url")].toString());
26 QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.PackageKit"),
27 QStringLiteral("/org/freedesktop/PackageKit"),
28 QStringLiteral("org.freedesktop.PackageKit.Modify"),
29 QStringLiteral("RemovePackageByFiles"));
30 message << (uint)0;
31 message << files;
32 message << QString();
33
35 setResult(true);
36 return;
37 }
38
39 setResult(false);
40}
QVariantMap parameters() const
void setResult(const QVariant &result)
Sets the result for an operation.
char * toString(const EngineQuery &query)
QDBusMessage call(const QDBusMessage &message, QDBus::CallMode mode, int timeout) const const
QDBusConnection sessionBus()
QDBusMessage createMethodCall(const QString &service, const QString &path, const QString &interface, const QString &method)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:38 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.