0368f84
diff -Nur kdeadmin-4.2.85/system-config-printer-kde/CMakeLists.txt kdeadmin-4.2.85-printing/system-config-printer-kde/CMakeLists.txt
0368f84
--- kdeadmin-4.2.85/system-config-printer-kde/CMakeLists.txt	2009-04-28 15:47:13.000000000 +0200
0368f84
+++ kdeadmin-4.2.85-printing/system-config-printer-kde/CMakeLists.txt	2009-05-20 16:00:15.000000000 +0200
0368f84
@@ -5,29 +5,9 @@
904988f
 macro_optional_find_package(PythonLibrary)
904988f
 macro_optional_find_package(SIP)
904988f
 
904988f
-macro_optional_find_package(PyQt4)
904988f
-IF(NOT PYQT4_FOUND)
0368f84
-    macro_log_feature(PYQT4_FOUND "PyQt4" "PyQt4 was not found.  It is needed by system-config-printer-kde to run. (Use -DINSTALL_SYSTEM_CONFIG_PRINTER=TRUE to install anyway)" "http://www.riverbankcomputing.co.uk/pyqt/" FALSE)
904988f
-ENDIF(NOT PYQT4_FOUND)
904988f
-
0368f84
-macro_optional_find_package(PyKDE4)
0368f84
-IF(NOT PYKDE4_FOUND)
0368f84
-    macro_log_feature(PYKDE_FOUND "PyKDE4" "PyKDE4 was not found.  It is needed by system-config-printer-kde to run.  (Use -DINSTALL_SYSTEM_CONFIG_PRINTER=TRUE to install anyway)" "http://websvn.kde.org/trunk/KDE/kdebindings/python/pykde4/" FALSE)
0368f84
-ENDIF(NOT PYKDE4_FOUND)
904988f
-
904988f
-macro_optional_find_package(PyCups)
904988f
-IF(NOT PYCUPS_FOUND)
904988f
-    macro_log_feature(PYCUPS_FOUND "PyCups" "PyCups was not found.  It is needed by system-config-printer-kde to run.  (Use -DINSTALL_SYSTEM_CONFIG_PRINTER=TRUE to install anyway)" "http://cyberelk.net/tim/software/pycups/" FALSE)
904988f
-ENDIF(NOT PYCUPS_FOUND)
904988f
-
904988f
-macro_optional_find_package(SystemConfigPrinter)
904988f
-IF(NOT SYSTEMCONFIGPRINTER_FOUND)
904988f
-    macro_log_feature(SYSTEMCONFIGPRINTER_FOUND "system-config-printer" "system-config-printer was not found.  Some of its modules (cupshelpers.py, config.py, smburi.py and debug.py) are required by system-config-printer-kde." "http://cyberelk.net/tim/software/system-config-printer/" FALSE)
904988f
-ENDIF(NOT SYSTEMCONFIGPRINTER_FOUND)
904988f
-
0368f84
-IF(PYQT4_FOUND AND PYKDE4_FOUND AND PYCUPS_FOUND AND SYSTEMCONFIGPRINTER_FOUND)
904988f
-    SET(INSTALL_SYSTEM_CONFIG_PRINTER TRUE)
0368f84
-ENDIF(PYQT4_FOUND AND PYKDE4_FOUND AND PYCUPS_FOUND AND SYSTEMCONFIGPRINTER_FOUND)
904988f
+if(PYTHONLIBRARY_FOUND)
904988f
+   set(INSTALL_SYSTEM_CONFIG_PRINTER TRUE)
904988f
+endif(PYTHONLIBRARY_FOUND)
904988f
 
904988f
 IF(INSTALL_SYSTEM_CONFIG_PRINTER)
904988f
     install( FILES
0368f84
@@ -36,6 +16,8 @@
904988f
         system-config-printer-kde.py
0368f84
         options.py
0368f84
         optionwidgets.py
904988f
+        debug.py
904988f
+        smburi.py
0368f84
         ipp-browse-dialog.ui
0368f84
         smb-browse-dialog.ui
904988f
         DESTINATION ${DATA_INSTALL_DIR}/system-config-printer-kde )
0368f84
diff -Nur kdeadmin-4.2.85/system-config-printer-kde/debug.py kdeadmin-4.2.85-printing/system-config-printer-kde/debug.py
0368f84
--- kdeadmin-4.2.85/system-config-printer-kde/debug.py	1970-01-01 01:00:00.000000000 +0100
0368f84
+++ kdeadmin-4.2.85-printing/system-config-printer-kde/debug.py	2009-05-20 15:57:50.000000000 +0200
904988f
@@ -0,0 +1,55 @@
904988f
+#!/usr/bin/env python
904988f
+
904988f
+## Copyright (C) 2008 Red Hat, Inc.
904988f
+## Copyright (C) 2008 Tim Waugh <twaugh@redhat.com>
904988f
+
904988f
+## This program is free software; you can redistribute it and/or modify
904988f
+## it under the terms of the GNU General Public License as published by
904988f
+## the Free Software Foundation; either version 2 of the License, or
904988f
+## (at your option) any later version.
904988f
+
904988f
+## This program is distributed in the hope that it will be useful,
904988f
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
904988f
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
904988f
+## GNU General Public License for more details.
904988f
+
904988f
+## You should have received a copy of the GNU General Public License
904988f
+## along with this program; if not, write to the Free Software
904988f
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
904988f
+
904988f
+import sys
904988f
+import traceback
904988f
+
904988f
+_debug=False
904988f
+def debugprint (x):
904988f
+    if _debug:
904988f
+        try:
904988f
+            print >>sys.stderr, x
904988f
+        except:
904988f
+            pass
904988f
+
904988f
+def get_debugging ():
904988f
+    return _debug
904988f
+
904988f
+def set_debugging (d):
904988f
+    global _debug
904988f
+    _debug = d
904988f
+
904988f
+def fatalException (exitcode=1):
904988f
+    nonfatalException (type="fatal", end="Exiting")
904988f
+    sys.exit (exitcode)
904988f
+
904988f
+def nonfatalException (type="non-fatal", end="Continuing anyway.."):
904988f
+    d = get_debugging ()
904988f
+    set_debugging (True)
904988f
+    debugprint ("Caught %s exception.  Traceback:" % type)
904988f
+    (type, value, tb) = sys.exc_info ()
904988f
+    tblast = traceback.extract_tb (tb, limit=None)
904988f
+    if len (tblast):
904988f
+        tblast = tblast[:len (tblast) - 1]
904988f
+    extxt = traceback.format_exception_only (type, value)
904988f
+    for line in traceback.format_tb(tb):
904988f
+        debugprint (line.strip ())
904988f
+    debugprint (extxt[0].strip ())
904988f
+    debugprint (end)
904988f
+    set_debugging (d)
0368f84
diff -Nur kdeadmin-4.2.85/system-config-printer-kde/smburi.py kdeadmin-4.2.85-printing/system-config-printer-kde/smburi.py
0368f84
--- kdeadmin-4.2.85/system-config-printer-kde/smburi.py	1970-01-01 01:00:00.000000000 +0100
0368f84
+++ kdeadmin-4.2.85-printing/system-config-printer-kde/smburi.py	2009-05-20 15:57:50.000000000 +0200
904988f
@@ -0,0 +1,95 @@
904988f
+#!/usr/bin/env python
904988f
+
904988f
+## system-config-printer
904988f
+
904988f
+## Copyright (C) 2006, 2007, 2008 Red Hat, Inc.
904988f
+## Copyright (C) 2006, 2007 Florian Festi <ffesti@redhat.com>
904988f
+## Copyright (C) 2006, 2007, 2008 Tim Waugh <twaugh@redhat.com>
904988f
+
904988f
+## This program is free software; you can redistribute it and/or modify
904988f
+## it under the terms of the GNU General Public License as published by
904988f
+## the Free Software Foundation; either version 2 of the License, or
904988f
+## (at your option) any later version.
904988f
+
904988f
+## This program is distributed in the hope that it will be useful,
904988f
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
904988f
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
904988f
+## GNU General Public License for more details.
904988f
+
904988f
+## You should have received a copy of the GNU General Public License
904988f
+## along with this program; if not, write to the Free Software
904988f
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
904988f
+
904988f
+import urllib
904988f
+
904988f
+class SMBURI:
904988f
+    def __init__ (self,
904988f
+                  uri=None,
904988f
+                  group='', host='', share='', user='', password=''):
904988f
+        if uri:
904988f
+            if group or host or share or user or password:
904988f
+                raise RuntimeError
904988f
+
904988f
+            if uri.startswith ("smb://"):
904988f
+                uri = uri[6:]
904988f
+
904988f
+            self.uri = uri
904988f
+        else:
904988f
+            self.uri = self._construct (group, host, share,
904988f
+                                        user=user, password=password)
904988f
+
904988f
+    def _construct (self, group, host, share, user='', password=''):
904988f
+        uri_password = ''
904988f
+        if password:
904988f
+            uri_password = ':' + urllib.quote (password)
904988f
+        if user:
904988f
+            uri_password += '@'
904988f
+        uri = "%s%s%s" % (urllib.quote (user),
904988f
+                          uri_password,
904988f
+                          urllib.quote (group))
904988f
+        if len (group) > 0:
904988f
+            uri += '/'
904988f
+        uri += urllib.quote (host)
904988f
+        if len (share) > 0:
904988f
+            uri += "/" + urllib.quote (share)
904988f
+        return uri
904988f
+
904988f
+    def get_uri (self):
904988f
+        return self.uri
904988f
+
904988f
+    def sanitize_uri (self):
904988f
+        group, host, share, user, password = self.separate ()
904988f
+        return self._construct (group, host, share)
904988f
+
904988f
+    def separate (self):
904988f
+        uri = self.get_uri ()
904988f
+        user = ''
904988f
+        password = ''
904988f
+        auth = uri.find ('@')
904988f
+        if auth != -1:
904988f
+            u = uri[:auth].find(':')
904988f
+            if u != -1:
904988f
+                user = uri[:u]
904988f
+                password = uri[u + 1:auth]
904988f
+            else:
904988f
+                user = uri[:auth]
904988f
+            uri = uri[auth + 1:]
904988f
+        sep = uri.count ('/')
904988f
+        group = ''
904988f
+        if sep == 2:
904988f
+            g = uri.find('/')
904988f
+            group = uri[:g]
904988f
+            uri = uri[g + 1:]
904988f
+        if sep < 1:
904988f
+            host = ''
904988f
+        else:
904988f
+            h = uri.find('/')
904988f
+            host = uri[:h]
904988f
+            uri = uri[h + 1:]
904988f
+            p = host.find(':')
904988f
+            if p != -1:
904988f
+                host = host[:p]
904988f
+        share = uri
904988f
+        return (urllib.unquote (group), urllib.unquote (host),
904988f
+                urllib.unquote (share),
904988f
+                urllib.unquote (user), urllib.unquote (password))
0368f84
diff -Nur kdeadmin-4.2.85/system-config-printer-kde/system-config-printer-kde.py kdeadmin-4.2.85-printing/system-config-printer-kde/system-config-printer-kde.py
0368f84
--- kdeadmin-4.2.85/system-config-printer-kde/system-config-printer-kde.py	2009-04-15 12:26:27.000000000 +0200
0368f84
+++ kdeadmin-4.2.85-printing/system-config-printer-kde/system-config-printer-kde.py	2009-05-20 16:05:17.000000000 +0200
0368f84
@@ -34,7 +34,7 @@
0368f84
 import sys, os, time, traceback, re, tempfile, httplib, thread
904988f
 
904988f
 #load modules from system-config-printer-common (debug, smburi), change path here if you have it installed elsewhere
904988f
-SYSTEM_CONFIG_PRINTER_DIR = "/usr/share/system-config-printer"
904988f
+SYSTEM_CONFIG_PRINTER_DIR = "/usr/share/kde4/apps/system-config-printer-kde"
904988f
 if os.path.exists(SYSTEM_CONFIG_PRINTER_DIR + "/debug.py"):
904988f
     sys.path.append(SYSTEM_CONFIG_PRINTER_DIR)
904988f
 
0368f84
@@ -66,7 +66,6 @@
904988f
 cups.require ("1.9.27")
904988f
 
904988f
 # These come from system-config-printer
904988f
-import config
0368f84
 import cupshelpers, options
0368f84
 from optionwidgets import OptionWidget
904988f
 from smburi import SMBURI