[kpackagekit] * Mon Aug 01 2011 Kevin Kofler <Kevin at tigcc.ticalc.org> 0.6.3.3-3 - support the InstallResources int
Kevin Kofler
kkofler at fedoraproject.org
Mon Aug 1 14:43:06 UTC 2011
commit 9811dd0ca1482424517b8ff4c2c5ec4b3ecb4d79
Author: Kevin Kofler <Kevin at tigcc.ticalc.org>
Date: Mon Aug 1 16:42:36 2011 +0200
* Mon Aug 01 2011 Kevin Kofler <Kevin at tigcc.ticalc.org> 0.6.3.3-3
- support the InstallResources interface, in particular for Plasma services
- bump minimum PackageKit version to 0.6.16 to support the above
kpackagekit.spec | 11 +-
kpackagekit06-plasma.patch | 361 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 370 insertions(+), 2 deletions(-)
---
diff --git a/kpackagekit.spec b/kpackagekit.spec
index 79c7e77..06a5eca 100644
--- a/kpackagekit.spec
+++ b/kpackagekit.spec
@@ -1,11 +1,11 @@
-%define pk_min_version 0.6.11
+%define pk_min_version 0.6.16
## include app-install support and/or for testing/customizing categories.xml
#define app_install 1
Name: kpackagekit
Version: 0.6.3.3
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: KDE interface for PackageKit
License: GPLv2+
@@ -36,6 +36,8 @@ Patch1: kpackagekit-0.6.3.2-showversion.patch
# on multilib-capable archs where it matters more
%define multilib_arch x86_64
Patch2: kpackagekit-0.6.3.2-showarch.patch
+# support the InstallResources interface, in particular for Plasma services
+Patch3: kpackagekit06-plasma.patch
## upstream patches
@@ -73,6 +75,7 @@ rmdir kpackagekit-translations-%{snap}
%ifarch %{multilib_arch}
%patch2 -p1 -b .showarch
%endif
+%patch3 -p1 -b .plasma
%build
@@ -133,6 +136,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Mon Aug 01 2011 Kevin Kofler <Kevin at tigcc.ticalc.org> 0.6.3.3-3
+- support the InstallResources interface, in particular for Plasma services
+- bump minimum PackageKit version to 0.6.16 to support the above
+
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.6.3.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
diff --git a/kpackagekit06-plasma.patch b/kpackagekit06-plasma.patch
new file mode 100644
index 0000000..208427a
--- /dev/null
+++ b/kpackagekit06-plasma.patch
@@ -0,0 +1,361 @@
+From 07a9869f09d4842de03ef1b2738fbd2b1a0e9209 Mon Sep 17 00:00:00 2001
+Message-Id: <07a9869f09d4842de03ef1b2738fbd2b1a0e9209.1309066726.git.kevin.kofler at chello.at>
+From: Kevin Kofler <kevin.kofler at chello.at>
+Date: Mon, 20 Jun 2011 04:05:07 +0200
+Subject: [PATCH] Support looking up Plasma services.
+
+---
+ SmartIcon/CMakeLists.txt | 1 +
+ SmartIcon/PkInstallPlasmaResources.cpp | 140 ++++++++++++++++++++++++++++++
+ SmartIcon/PkInstallPlasmaResources.h | 54 ++++++++++++
+ SmartIcon/PkInterface.cpp | 28 ++++++
+ SmartIcon/PkInterface.h | 2 +
+ SmartIcon/org.freedesktop.PackageKit.xml | 49 +++++++++++
+ 6 files changed, 274 insertions(+), 0 deletions(-)
+
+diff --git a/SmartIcon/CMakeLists.txt b/SmartIcon/CMakeLists.txt
+index 89bcb6a..4ca8049 100644
+--- a/SmartIcon/CMakeLists.txt
++++ b/SmartIcon/CMakeLists.txt
+@@ -15,6 +15,7 @@ set(kpackagekit_smart_icon_SRCS
+ PkInstallMimeTypes.cpp
+ PkInstallGStreamerResources.cpp
+ PkInstallFontconfigResources.cpp
++ PkInstallPlasmaResources.cpp
+ PkInstallPackageFiles.cpp
+ PkInstallProvideFiles.cpp
+ PkInstallCatalogs.cpp
+diff --git a/SmartIcon/PkInstallPlasmaResources.cpp b/SmartIcon/PkInstallPlasmaResources.cpp
+new file mode 100644
+index 0000000..0c14eae
+--- /dev/null
++++ b/SmartIcon/PkInstallPlasmaResources.cpp
+@@ -0,0 +1,140 @@
++/***************************************************************************
++ * Copyright (C) 2009-2010 by Daniel Nicoletti *
++ * dantti85-pk at yahoo.com.br *
++ * Copyright (C) 2011 Kevin Kofler <kevin.kofler at chello.at> *
++ * *
++ * This program is free software; you can redistribute it and/or modify *
++ * it under the terms of the GNU General Public License as published by *
++ * the Free Software Foundation; either version 2 of the License, or *
++ * (at your option) any later version. *
++ * *
++ * This program is distributed in the hope that it will be useful, *
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
++ * GNU General Public License for more details. *
++ * *
++ * You should have received a copy of the GNU General Public License *
++ * along with this program; see the file COPYING. If not, write to *
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
++ * Boston, MA 02110-1301, USA. *
++ ***************************************************************************/
++
++#include "PkInstallPlasmaResources.h"
++
++#include <KpkReviewChanges.h>
++#include <KpkTransaction.h>
++#include <KpkStrings.h>
++
++#include <KLocale>
++#include <KMessageBox>
++
++#include <KDebug>
++
++PkInstallPlasmaResources::PkInstallPlasmaResources(uint xid,
++ const QStringList &resources,
++ const QString &interaction,
++ const QDBusMessage &message,
++ QWidget *parent)
++ : KpkAbstractTask(xid, interaction, message, parent),
++ m_resources(resources)
++{
++}
++
++PkInstallPlasmaResources::~PkInstallPlasmaResources()
++{
++}
++
++void PkInstallPlasmaResources::start()
++{
++ int ret = KMessageBox::Yes;
++ QStringList niceNames;
++ QStringList search;
++ if (showConfirmSearch()) {
++ // Resources are strings like "dataengine-weather"
++ foreach (const QString &service, m_resources) {
++ QString prettyService = service;
++ if (service.startsWith("dataengine-")) {
++ prettyService = i18n("%1 data engine", service.mid(11));
++ } else if (service.startsWith("scriptengine-")) {
++ prettyService = i18n("%1 script engine", service.mid(13));
++ }
++
++ niceNames << prettyService;
++ search << service;
++ }
++
++ QString message = i18np("The following service is required: <ul><li>%2</li></ul>"
++ "Do you want to search for this now?",
++ "The following services are required: <ul><li>%2</li></ul>"
++ "Do you want to search for these now?",
++ niceNames.size(),
++ niceNames.join("</li><li>"));
++
++ QString title = i18np("Plasma requires an additional service for this operation",
++ "Plasma requires additional services for this operation",
++ m_resources.size());
++
++ QString msg = "<h3>" + title + "</h3>" + message;
++ KGuiItem searchBt = KStandardGuiItem::yes();
++ searchBt.setText(i18nc("Search for packages" ,"Search"));
++ searchBt.setIcon(KIcon("edit-find"));
++ ret = KMessageBox::questionYesNoWId(parentWId(), msg, title, searchBt);
++ }
++
++ if (ret == KMessageBox::Yes) {
++ Transaction *t = Client::instance()->whatProvides(Enum::ProvidesPlasmaService,
++ search,
++ Enum::FilterNotInstalled |
++ Enum::FilterArch |
++ Enum::FilterNewest);
++ if (t->error()) {
++ QString msg(i18n("Failed to search for provides"));
++ KMessageBox::sorryWId(parentWId(), KpkStrings::daemonError(t->error()), msg);
++ sendErrorFinished(InternalError, msg);
++ } else {
++ connect(t, SIGNAL(finished(PackageKit::Enum::Exit, uint)),
++ this, SLOT(whatProvidesFinished(PackageKit::Enum::Exit)));
++ connect(t, SIGNAL(package(QSharedPointer<PackageKit::Package>)),
++ this, SLOT(addPackage(QSharedPointer<PackageKit::Package>)));
++ if (showProgress()) {
++ kTransaction()->setTransaction(t);
++ kTransaction()->show();
++ }
++ }
++ } else {
++ sendErrorFinished(Cancelled, i18n("did not agree to search"));
++ }
++}
++
++void PkInstallPlasmaResources::whatProvidesFinished(PackageKit::Enum::Exit status)
++{
++ kDebug() << "Finished.";
++ if (status == Enum::ExitSuccess) {
++ if (m_foundPackages.size()) {
++ kTransaction()->hide();
++ KpkReviewChanges *frm = new KpkReviewChanges(m_foundPackages, this, parentWId());
++ if (frm->exec(operationModes()) == 0) {
++ sendErrorFinished(Failed, "Transaction did not finish with success");
++ } else {
++ finishTaskOk();
++ }
++ } else {
++ if (showWarning()) {
++ KMessageBox::sorryWId(parentWId(),
++ i18n("Could not find service "
++ "in any configured software source"),
++ i18n("Failed to search for Plasma service"));
++ }
++ sendErrorFinished(NoPackagesFound, "failed to find Plasma service");
++ }
++ } else {
++ sendErrorFinished(Failed, "what provides failed");
++ }
++}
++
++void PkInstallPlasmaResources::addPackage(QSharedPointer<PackageKit::Package> package)
++{
++ m_foundPackages.append(package);
++}
++
++#include "PkInstallPlasmaResources.moc"
+diff --git a/SmartIcon/PkInstallPlasmaResources.h b/SmartIcon/PkInstallPlasmaResources.h
+new file mode 100644
+index 0000000..c733d31
+--- /dev/null
++++ b/SmartIcon/PkInstallPlasmaResources.h
+@@ -0,0 +1,54 @@
++/***************************************************************************
++ * Copyright (C) 2009-2010 by Daniel Nicoletti *
++ * dantti85-pk at yahoo.com.br *
++ * Copyright (C) 2011 Kevin Kofler <kevin.kofler at chello.at> *
++ * *
++ * This program is free software; you can redistribute it and/or modify *
++ * it under the terms of the GNU General Public License as published by *
++ * the Free Software Foundation; either version 2 of the License, or *
++ * (at your option) any later version. *
++ * *
++ * This program is distributed in the hope that it will be useful, *
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
++ * GNU General Public License for more details. *
++ * *
++ * You should have received a copy of the GNU General Public License *
++ * along with this program; see the file COPYING. If not, write to *
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
++ * Boston, MA 02110-1301, USA. *
++ ***************************************************************************/
++
++#ifndef PK_INSTALL_PLASMA_RESOURCES_H
++#define PK_INSTALL_PLASMA_RESOURCES_H
++
++#include "KpkAbstractTask.h"
++
++#include <QPackageKit>
++
++using namespace PackageKit;
++
++class PkInstallPlasmaResources : public KpkAbstractTask
++{
++Q_OBJECT
++public:
++ PkInstallPlasmaResources(uint xid,
++ const QStringList &resources,
++ const QString &interaction,
++ const QDBusMessage &message,
++ QWidget *parent = 0);
++ ~PkInstallPlasmaResources();
++
++public slots:
++ void start();
++
++private slots:
++ void whatProvidesFinished(PackageKit::Enum::Exit status);
++ void addPackage(QSharedPointer<PackageKit::Package> package);
++
++private:
++ QList<QSharedPointer<PackageKit::Package> > m_foundPackages;
++ QStringList m_resources;
++};
++
++#endif
+diff --git a/SmartIcon/PkInterface.cpp b/SmartIcon/PkInterface.cpp
+index 3968843..40e7853 100644
+--- a/SmartIcon/PkInterface.cpp
++++ b/SmartIcon/PkInterface.cpp
+@@ -31,6 +31,7 @@
+ #include "PkInstallMimeTypes.h"
+ #include "PkInstallGStreamerResources.h"
+ #include "PkInstallFontconfigResources.h"
++#include "PkInstallPlasmaResources.h"
+ #include "PkInstallPackageFiles.h"
+ #include "PkInstallProvideFiles.h"
+ #include "PkInstallCatalogs.h"
+@@ -160,6 +161,33 @@ void PkInterface::InstallPrinterDrivers(uint xid, const QStringList &resources,
+ task->run();
+ }
+
++void PkInterface::InstallPlasmaResources(uint xid, const QStringList &resources, const QString &interaction)
++{
++ increaseRunning();
++ kDebug() << xid << resources << interaction;
++ setDelayedReply(true);
++ PkInstallPlasmaResources *task;
++ task = new PkInstallPlasmaResources(xid, resources, interaction, message());
++ connect(task, SIGNAL(finished()), this, SLOT(decreaseRunning()));
++ task->run();
++}
++
++void PkInterface::InstallResources(uint xid, const QString &type, const QStringList &resources, const QString &interaction)
++{
++ if (type == "codec")
++ InstallGStreamerResources(xid, resources, interaction);
++ else if (type == "mimetype")
++ InstallMimeTypes(xid, resources, interaction);
++ else if (type == "font")
++ InstallFontconfigResources(xid, resources, interaction);
++ else if (type == "postscript-driver")
++ InstallPrinterDrivers(xid, resources, interaction);
++ else if (type == "plasma-service")
++ InstallPlasmaResources(xid, resources, interaction);
++ else
++ sendErrorReply("org.freedesktop.PackageKit.Failed", "Unsupported resource type");
++}
++
+ //Query
+ bool PkInterface::IsInstalled(const QString &package_name, const QString &interaction)
+ {
+diff --git a/SmartIcon/PkInterface.h b/SmartIcon/PkInterface.h
+index 61357c6..e396dd1 100644
+--- a/SmartIcon/PkInterface.h
++++ b/SmartIcon/PkInterface.h
+@@ -42,12 +42,14 @@ public slots:
+ void InstallProvideFiles(uint xid, const QStringList &files, const QString &interaction);
+ void RemovePackageByFiles(uint xid, const QStringList &files, const QString &interaction);
+ void InstallPrinterDrivers(uint xid, const QStringList &resources, const QString &interaction);
++ void InstallResources(uint xid, const QString &type, const QStringList &resources, const QString &interaction);
+ //Query
+ bool IsInstalled(const QString &package_name, const QString &interaction);
+ bool SearchFile(const QString &file_name, const QString &interaction, QString &package_name);
+
+ private:
+ QHash<QString, QVariant> parseInteraction(const QString &interaction);
++ void InstallPlasmaResources(uint xid, const QStringList &resources, const QString &interaction);
+ };
+
+
+diff --git a/SmartIcon/org.freedesktop.PackageKit.xml b/SmartIcon/org.freedesktop.PackageKit.xml
+index dd4d2e5..1ed1417 100644
+--- a/SmartIcon/org.freedesktop.PackageKit.xml
++++ b/SmartIcon/org.freedesktop.PackageKit.xml
+@@ -404,6 +404,55 @@
+ </method>
+
+ <!--*****************************************************************************************-->
++ <method name="InstallResources">
++ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
++ <doc:doc>
++ <doc:description>
++ <doc:para>
++ Installs resources of a given type from a configured software source.
++ </doc:para>
++ </doc:description>
++ </doc:doc>
++ <arg type="u" name="xid" direction="in">
++ <doc:doc>
++ <doc:summary>
++ <doc:para>
++ The X window handle ID, used for focus stealing prevention and setting modality.
++ </doc:para>
++ </doc:summary>
++ </doc:doc>
++ </arg>
++ <arg type="s" name="type" direction="in">
++ <doc:doc>
++ <doc:summary>
++ <doc:para>
++ The type of resource to request, e.g. <doc:tt>plasma-service</doc:tt>
++ </doc:para>
++ </doc:summary>
++ </doc:doc>
++ </arg>
++ <arg type="as" name="resources" direction="in">
++ <doc:doc>
++ <doc:summary>
++ <doc:para>
++ An array of resource descriptors
++ </doc:para>
++ </doc:summary>
++ </doc:doc>
++ </arg>
++ <arg type="s" name="interaction" direction="in">
++ <doc:doc>
++ <doc:summary>
++ <doc:para>
++ An optional interaction mode, e.g.
++ <doc:tt>show-confirm-search,show-confirm-deps,show-confirm-install,show-progress,show-finished,show-warning</doc:tt>
++ </doc:para>
++ </doc:summary>
++ </doc:doc>
++ </arg>
++ </method>
++
++ <!--*****************************************************************************************-->
+ <method name="RemovePackageByFiles">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <doc:doc>
+--
+1.7.4.4
+
More information about the scm-commits
mailing list