rpms/kpackagekit/F-13 kpackagekit-0.6.0-InstallPrinterDrivers.patch, NONE, 1.1 kpackagekit.spec, 1.65, 1.66 kpackagekit-0.6.0svn-InstallPrinterDrivers.patch, 1.1, NONE

Kevin Kofler kkofler at fedoraproject.org
Fri Mar 26 20:44:19 UTC 2010


Author: kkofler

Update of /cvs/pkgs/rpms/kpackagekit/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv20691/F-13

Modified Files:
	kpackagekit.spec 
Added Files:
	kpackagekit-0.6.0-InstallPrinterDrivers.patch 
Removed Files:
	kpackagekit-0.6.0svn-InstallPrinterDrivers.patch 
Log Message:
* Fri Mar 26 2010 Kevin Kofler <Kevin at tigcc.ticalc.org> - 0.6.0-2
- rebase InstallPrinterDrivers patch
- readd disttag

kpackagekit-0.6.0-InstallPrinterDrivers.patch:
 CMakeLists.txt                 |    3 
 PkInstallPrinterDrivers.cpp    |  128 +++++++++++++++++++++++++++++++++++++++++
 PkInstallPrinterDrivers.h      |   53 ++++++++++++++++
 PkInterface.cpp                |   13 ++++
 PkInterface.h                  |    1 
 org.freedesktop.PackageKit.xml |   42 +++++++++++++
 6 files changed, 239 insertions(+), 1 deletion(-)

--- NEW FILE kpackagekit-0.6.0-InstallPrinterDrivers.patch ---
diff -Nur KPackageKit-0.6.0/SmartIcon/CMakeLists.txt KPackageKit-0.6.0-InstallPrinterDrivers/SmartIcon/CMakeLists.txt
--- KPackageKit-0.6.0/SmartIcon/CMakeLists.txt	2009-12-07 19:31:35.000000000 +0100
+++ KPackageKit-0.6.0-InstallPrinterDrivers/SmartIcon/CMakeLists.txt	2010-03-26 21:38:24.000000000 +0100
@@ -20,6 +20,7 @@
     PkInstallProvideFiles.cpp
     PkInstallCatalogs.cpp
     PkRemovePackageByFiles.cpp
+    PkInstallPrinterDrivers.cpp
 )
 
 qt4_add_dbus_adaptor(kpackagekit_smart_dbus_SRCS
@@ -53,4 +54,4 @@
 
 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 -Nur KPackageKit-0.6.0/SmartIcon/org.freedesktop.PackageKit.xml KPackageKit-0.6.0-InstallPrinterDrivers/SmartIcon/org.freedesktop.PackageKit.xml
--- KPackageKit-0.6.0/SmartIcon/org.freedesktop.PackageKit.xml	2009-12-07 19:31:35.000000000 +0100
+++ KPackageKit-0.6.0-InstallPrinterDrivers/SmartIcon/org.freedesktop.PackageKit.xml	2010-03-26 21:38:24.000000000 +0100
@@ -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 -Nur KPackageKit-0.6.0/SmartIcon/PkInstallPrinterDrivers.cpp KPackageKit-0.6.0-InstallPrinterDrivers/SmartIcon/PkInstallPrinterDrivers.cpp
--- KPackageKit-0.6.0/SmartIcon/PkInstallPrinterDrivers.cpp	1970-01-01 01:00:00.000000000 +0100
+++ KPackageKit-0.6.0-InstallPrinterDrivers/SmartIcon/PkInstallPrinterDrivers.cpp	2010-03-26 21:39:26.000000000 +0100
@@ -0,0 +1,128 @@
+/***************************************************************************
+ *   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 <KpkTransaction.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 -Nur KPackageKit-0.6.0/SmartIcon/PkInstallPrinterDrivers.h KPackageKit-0.6.0-InstallPrinterDrivers/SmartIcon/PkInstallPrinterDrivers.h
--- KPackageKit-0.6.0/SmartIcon/PkInstallPrinterDrivers.h	1970-01-01 01:00:00.000000000 +0100
+++ KPackageKit-0.6.0-InstallPrinterDrivers/SmartIcon/PkInstallPrinterDrivers.h	2010-03-26 21:38:24.000000000 +0100
@@ -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 -Nur KPackageKit-0.6.0/SmartIcon/PkInterface.cpp KPackageKit-0.6.0-InstallPrinterDrivers/SmartIcon/PkInterface.cpp
--- KPackageKit-0.6.0/SmartIcon/PkInterface.cpp	2010-03-19 22:14:58.000000000 +0100
+++ KPackageKit-0.6.0-InstallPrinterDrivers/SmartIcon/PkInterface.cpp	2010-03-26 21:38:24.000000000 +0100
@@ -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 @@
     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 -Nur KPackageKit-0.6.0/SmartIcon/PkInterface.h KPackageKit-0.6.0-InstallPrinterDrivers/SmartIcon/PkInterface.h
--- KPackageKit-0.6.0/SmartIcon/PkInterface.h	2009-12-07 19:31:35.000000000 +0100
+++ KPackageKit-0.6.0-InstallPrinterDrivers/SmartIcon/PkInterface.h	2010-03-26 21:38:24.000000000 +0100
@@ -41,6 +41,7 @@
     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/F-13/kpackagekit.spec,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -p -r1.65 -r1.66
--- kpackagekit.spec	26 Mar 2010 19:10:35 -0000	1.65
+++ kpackagekit.spec	26 Mar 2010 20:44:19 -0000	1.66
@@ -5,7 +5,7 @@
 
 Name:	  	kpackagekit
 Version:	0.6.0
-Release:	1
+Release:	2%{?dist}
 Summary:	KDE interface for PackageKit
 
 License:	GPLv2+
@@ -24,9 +24,8 @@ URL:		http://www.kde-apps.org/content/sh
 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
+Patch0:		kpackagekit-0.6.0-InstallPrinterDrivers.patch
 
-## FIXME, rebase? better yet, get it upstreamed -- Rex
 #Hacks to smash kpackagekit: daily/none default (#469375)
 Patch50: kpackagekit-0.6.0-defaults_hacks.patch
 
@@ -53,7 +52,7 @@ KDE interface for PackageKit.
 
 %setup -q -n KPackageKit-%{version}
 
-#%patch0 -p1 -b .InstallPrinterDrivers
+%patch0 -p1 -b .InstallPrinterDrivers
 %patch50  -p1 -b .defaults_hacks
 
 %build
@@ -102,6 +101,10 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Fri Mar 26 2010 Kevin Kofler <Kevin at tigcc.ticalc.org> - 0.6.0-2
+- rebase InstallPrinterDrivers patch
+- readd disttag
+
 * Fri Mar 26 2010 Steven M. Parrish <smparrish at gmail.com> - 0.6.0-1
 - Official 0.6.0 release
 


--- kpackagekit-0.6.0svn-InstallPrinterDrivers.patch DELETED ---



More information about the scm-commits mailing list