rpms/kpackagekit/devel kpackagekit-0.6.0svn-InstallPrinterDrivers.patch, NONE, 1.1 kpackagekit.spec, 1.61, 1.62
Kevin Kofler
kkofler at fedoraproject.org
Wed Mar 24 18:02:03 UTC 2010
Author: kkofler
Update of /cvs/pkgs/rpms/kpackagekit/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv8040/devel
Modified Files:
kpackagekit.spec
Added Files:
kpackagekit-0.6.0svn-InstallPrinterDrivers.patch
Log Message:
* Wed Mar 24 2010 Kevin Kofler <Kevin at tigcc.ticalc.org> - 0.6.0-0.9.20100301svn
- add support for automatic printer driver installation (Tim Waugh, #576615)
kpackagekit-0.6.0svn-InstallPrinterDrivers.patch:
CMakeLists.txt | 3
PkInstallPrinterDrivers.cpp | 127 +++++++++++++++++++++++++++++++++++++++++
PkInstallPrinterDrivers.h | 53 +++++++++++++++++
PkInterface.cpp | 13 ++++
PkInterface.h | 1
org.freedesktop.PackageKit.xml | 42 +++++++++++++
6 files changed, 238 insertions(+), 1 deletion(-)
--- NEW FILE kpackagekit-0.6.0svn-InstallPrinterDrivers.patch ---
diff -up kpackagekit-20100301svn/SmartIcon/CMakeLists.txt.InstallPrinterDrivers kpackagekit-20100301svn/SmartIcon/CMakeLists.txt
--- kpackagekit-20100301svn/SmartIcon/CMakeLists.txt.InstallPrinterDrivers 2010-03-02 14:39:07.000000000 +0000
+++ kpackagekit-20100301svn/SmartIcon/CMakeLists.txt 2010-03-23 16:48:42.113628814 +0000
@@ -20,6 +20,7 @@ set(kpackagekit_smart_icon_SRCS
PkInstallProvideFiles.cpp
PkInstallCatalogs.cpp
PkRemovePackageByFiles.cpp
+ PkInstallPrinterDrivers.cpp
)
qt4_add_dbus_adaptor(kpackagekit_smart_dbus_SRCS
@@ -53,4 +54,4 @@ install(FILES KPackageKitSmartIcon.notif
include(PkgConfigGetVar)
dbus_add_activation_service(org.kde.KPackageKitSmartIcon.service.in)
-dbus_add_activation_service(org.freedesktop.PackageKit.service.in)
\ No newline at end of file
+dbus_add_activation_service(org.freedesktop.PackageKit.service.in)
diff -up kpackagekit-20100301svn/SmartIcon/org.freedesktop.PackageKit.xml.InstallPrinterDrivers kpackagekit-20100301svn/SmartIcon/org.freedesktop.PackageKit.xml
--- kpackagekit-20100301svn/SmartIcon/org.freedesktop.PackageKit.xml.InstallPrinterDrivers 2010-03-02 14:39:07.000000000 +0000
+++ kpackagekit-20100301svn/SmartIcon/org.freedesktop.PackageKit.xml 2010-03-23 16:48:42.118628971 +0000
@@ -450,6 +450,48 @@
</doc:doc>
</arg>
</method>
+
+ <method name="InstallPrinterDrivers">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Installs printer drivers 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="as" name="resources" direction="in">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ An array of printer model descriptors in IEEE 1284
+ Device ID format,
+ e.g. <doc:tt>MFG:Hewlett-Packard;MDL:HP LaserJet
+ 6MP;</doc:tt>.
+ </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>
</interface>
</node>
diff -up kpackagekit-20100301svn/SmartIcon/PkInstallPrinterDrivers.cpp.InstallPrinterDrivers kpackagekit-20100301svn/SmartIcon/PkInstallPrinterDrivers.cpp
--- kpackagekit-20100301svn/SmartIcon/PkInstallPrinterDrivers.cpp.InstallPrinterDrivers 2010-03-23 16:48:42.124631113 +0000
+++ kpackagekit-20100301svn/SmartIcon/PkInstallPrinterDrivers.cpp 2010-03-23 17:57:09.838504244 +0000
@@ -0,0 +1,127 @@
+/***************************************************************************
+ * Copyright (C) 2009-2010 by Daniel Nicoletti *
+ * dantti85-pk at yahoo.com.br *
+ * *
+ * 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 "PkInstallPrinterDrivers.h"
+
+#include <KpkReviewChanges.h>
+#include <KpkStrings.h>
+
+#include <KLocale>
+#include <KMessageBox>
+
+#include <KDebug>
+
+#include <QTextStream>
+
+PkInstallPrinterDrivers::PkInstallPrinterDrivers(uint xid,
+ const QStringList &resources,
+ const QString &interaction,
+ const QDBusMessage &message,
+ QWidget *parent)
+ : KpkAbstractTask(xid, interaction, message, parent),
+ m_resources(resources)
+{
+}
+
+PkInstallPrinterDrivers::~PkInstallPrinterDrivers()
+{
+}
+
+void PkInstallPrinterDrivers::start()
+{
+ QStringList search;
+ foreach (const QString &deviceid, m_resources) {
+ QString mfg, mdl;
+ QStringList fields = deviceid.split(';');
+ foreach (const QString &field, fields) {
+ QString keyvalue = field.trimmed();
+ if (keyvalue.startsWith("MFG:"))
+ mfg = keyvalue.mid(4);
+ else if (keyvalue.startsWith("MDL:"))
+ mdl = keyvalue.mid(4);
+ }
+
+ if (!mfg.isEmpty() && !mdl.isEmpty()) {
+ QString prov;
+ QTextStream out(&prov);
+ out << mfg.toLower().replace(' ', '_') << ';'
+ << mdl.toLower().replace(' ', '_') << ';';
+ search << prov;
+ }
+ }
+
+ Transaction *t = Client::instance()->whatProvides(Enum::ProvidesPostscriptDriver,
+ search,
+ Enum::FilterNotInstalled |
+ Enum::FilterArch |
+ Enum::FilterNewest);
+ if (t->error()) {
+ QString msg(i18n("Failed to search for provides"));
+ KMessageBox::sorry(0,
+ KpkStrings::daemonError(t->error()),
+ msg);
+ sendErrorFinished(InternalError, msg);
+ } else {
+ connect(t, SIGNAL(finished(PackageKit::Enum::Exit, uint)),
+ this, SLOT(whatProvidesFinished(PackageKit::Enum::Exit, uint)));
+ connect(t, SIGNAL(package(PackageKit::QSharedPointer<PackageKit::Package>)),
+ this, SLOT(addPackage(PackageKit::QSharedPointer<PackageKit::Package>)));
+ if (showProgress()) {
+ KpkTransaction *trans;
+ trans = new KpkTransaction(t, KpkTransaction::CloseOnFinish);
+ trans->show();
+ }
+ }
+}
+
+void PkInstallPrinterDrivers::whatProvidesFinished(PackageKit::Enum::Exit status, uint runtime)
+{
+ Q_UNUSED(runtime)
+ kDebug() << "Finished.";
+ if (status == Enum::ExitSuccess) {
+ if (m_foundPackages.size()) {
+ KpkReviewChanges *frm = new KpkReviewChanges(m_foundPackages);
+ frm->setTitle(i18np("Do you want to install this package now?",
+ "Do you want to install these packages now?", m_foundPackages.size()));
+ if (frm->exec(operationModes()) == 0) {
+ sendErrorFinished(Failed, "Transaction did not finish with success");
+ } else {
+ finishTaskOk();
+ }
+ } else {
+ if (showWarning()) {
+ KMessageBox::sorry(0,
+ i18n("Could not find printer driver "
+ "in any configured software source"),
+ i18n("Failed to search for printer driver"));
+ }
+ sendErrorFinished(NoPackagesFound, "failed to find printer driver");
+ }
+ } else {
+ sendErrorFinished(Failed, "what provides failed");
+ }
+}
+
+void PkInstallPrinterDrivers::addPackage(QSharedPointer<PackageKit::Package>package)
+{
+ m_foundPackages.append(package);
+}
+
+#include "PkInstallPrinterDrivers.moc"
diff -up kpackagekit-20100301svn/SmartIcon/PkInstallPrinterDrivers.h.InstallPrinterDrivers kpackagekit-20100301svn/SmartIcon/PkInstallPrinterDrivers.h
--- kpackagekit-20100301svn/SmartIcon/PkInstallPrinterDrivers.h.InstallPrinterDrivers 2010-03-23 16:48:42.128628640 +0000
+++ kpackagekit-20100301svn/SmartIcon/PkInstallPrinterDrivers.h 2010-03-23 16:48:42.137627700 +0000
@@ -0,0 +1,53 @@
+/***************************************************************************
+ * Copyright (C) 2009-2010 by Daniel Nicoletti *
+ * dantti85-pk at yahoo.com.br *
+ * *
+ * 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_PRINTER_DRIVERS_H
+#define PK_INSTALL_PRINTER_DRIVERS_H
+
+#include "KpkAbstractTask.h"
+
+#include <QPackageKit>
+
+using namespace PackageKit;
+
+class PkInstallPrinterDrivers : public KpkAbstractTask
+{
+Q_OBJECT
+public:
+ PkInstallPrinterDrivers(uint xid,
+ const QStringList &resources,
+ const QString &interaction,
+ const QDBusMessage &message,
+ QWidget *parent = 0);
+ ~PkInstallPrinterDrivers();
+
+public slots:
+ void start();
+
+private slots:
+ void whatProvidesFinished(PackageKit::Enum::Exit status, uint runtime);
+ void addPackage(QSharedPointer<PackageKit::Package>package);
+
+private:
+ QList<QSharedPointer<PackageKit::Package> > m_foundPackages;
+ QStringList m_resources;
+};
+
+#endif
diff -up kpackagekit-20100301svn/SmartIcon/PkInterface.cpp.InstallPrinterDrivers kpackagekit-20100301svn/SmartIcon/PkInterface.cpp
--- kpackagekit-20100301svn/SmartIcon/PkInterface.cpp.InstallPrinterDrivers 2010-03-02 14:39:07.000000000 +0000
+++ kpackagekit-20100301svn/SmartIcon/PkInterface.cpp 2010-03-23 16:48:42.140629940 +0000
@@ -35,6 +35,7 @@
#include "PkInstallProvideFiles.h"
#include "PkInstallCatalogs.h"
#include "PkRemovePackageByFiles.h"
+#include "PkInstallPrinterDrivers.h"
#include "PkIsInstalled.h"
#include "PkSearchFile.h"
@@ -148,6 +149,18 @@ void PkInterface::RemovePackageByFiles(u
task->run();
}
+void PkInterface::InstallPrinterDrivers(uint xid, const QStringList &resources, const QString &interaction)
+{
+ increaseRunning();
+ kDebug() << xid << resources << interaction;
+ setDelayedReply(true);
+ PkInstallPrinterDrivers *task;
+ task = new PkInstallPrinterDrivers(xid, resources, interaction, message());
+ connect(task, SIGNAL(finished()), this, SLOT(decreaseRunning()));
+ task->run();
+}
+
+
//Query
bool PkInterface::IsInstalled(const QString &package_name, const QString &interaction)
{
diff -up kpackagekit-20100301svn/SmartIcon/PkInterface.h.InstallPrinterDrivers kpackagekit-20100301svn/SmartIcon/PkInterface.h
--- kpackagekit-20100301svn/SmartIcon/PkInterface.h.InstallPrinterDrivers 2010-03-02 14:39:07.000000000 +0000
+++ kpackagekit-20100301svn/SmartIcon/PkInterface.h 2010-03-23 16:48:42.142627991 +0000
@@ -41,6 +41,7 @@ public slots:
void InstallPackageNames(uint xid, const QStringList &packages, const QString &interaction);
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);
//Query
bool IsInstalled(const QString &package_name, const QString &interaction);
bool SearchFile(const QString &file_name, const QString &interaction, QString &package_name);
Index: kpackagekit.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kpackagekit/devel/kpackagekit.spec,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -p -r1.61 -r1.62
--- kpackagekit.spec 13 Mar 2010 21:14:26 -0000 1.61
+++ kpackagekit.spec 24 Mar 2010 18:02:03 -0000 1.62
@@ -5,7 +5,7 @@
Name: kpackagekit
Version: 0.6.0
-Release: 0.8.%{snap}%{?dist}
+Release: 0.9.%{snap}%{?dist}
Summary: KDE interface for PackageKit
License: GPLv2+
@@ -23,6 +23,9 @@ Source0: kpackagekit-%{snap}.tar.bz2
URL: http://www.kde-apps.org/content/show.php/KPackageKit?content=84745
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+# add support for automatic printer driver installation (Tim Waugh, #576615)
+Patch0: kpackagekit-0.6.0svn-InstallPrinterDrivers.patch
+
## FIXME, rebase? better yet, get it upstreamed -- Rex
#Hacks to smash kpackagekit: daily/none default (#469375)
Patch50: kpackagekit-0.5.1-defaults_hacks.patch
@@ -48,6 +51,7 @@ KDE interface for PackageKit.
%prep
%setup -q -n %{name}-%{snap}
+%patch0 -p1 -b .InstallPrinterDrivers
#patch50 -p1 -b .defaults_hacks
@@ -98,6 +102,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Wed Mar 24 2010 Kevin Kofler <Kevin at tigcc.ticalc.org> - 0.6.0-0.9.20100301svn
+- add support for automatic printer driver installation (Tim Waugh, #576615)
+
* Sat Mar 13 2010 Rex Dieter <rdieter at fedoraproject.org> - 0.6.0-0.8.20100301svn
- add minimal kdelibs4 runtime dependency
More information about the scm-commits
mailing list