00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 #ifndef GLOBALSPRINTERSETUP_H
00032 #define GLOBALSPRINTERSETUP_H
00033 
00034 
00035 #include <qmap.h>
00036 #include <qstring.h>
00037 #include <qdom.h>
00038 
00039 class QWidget;
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 #define LPS_USB_DEVICE_PATH     "/proc/bus/usb/devices"
00050 #define LPS_PARPORT_DEVICE_DIR  "/proc/sys/dev/parport/"
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 #define LPS_DRIVER_DETAILS_DIR       "/usr/share/foomatic/db/source/driver/"
00062 #define LPS_DB_FILE                 "/printerdata.xml"
00063 #define LPS_CUPS_MODEL_DIR_DEFAULT  "/usr/share/cups/model"
00064 #define LPS_LPADMIN_PATH            "/usr/sbin/"
00065 
00066 #define LPS_DRIVER_STYLESHEET_PATH  "/driverdetails.xslt"
00067 #define LPS_APP_NAME                "PrinterSetup"
00068 #define LPS_PRINTER_NAME            "LinuxPrinter"
00069 #define LPS_DB_DOCUMENT_NAME        "CupsDriverDb"
00070 #define LPS_URL                     "http://printersetup.sourceforge.net"
00071 #define LPS_TESTPAGE_WIDTH          263
00072 #define LPS_TESTPAGE_HEIGHT         341
00073 #define LPS_TESTPAGE_IMG_SRC        "testpage.png"
00074 #define LPS_TESTPAGE_PS_SRC         "testpage.ps"
00075 #define LPS_TESTPAGE_JOBNAME        "Testpage"
00076 
00082 namespace LinuxPrinterSetup
00083 {
00084 
00085 
00089 enum ConnectionType
00090 {
00091   UsbConnection,
00092   ParPortConnection
00093 };
00094 
00095 
00100 class PrinterDevice
00101 {
00102 public:
00103 
00107   PrinterDevice();
00108 
00117   PrinterDevice(  const QString & nativeManufacturer,
00118                   const QString & nativeProduct,
00119                   ConnectionType connectionType,
00120                   const QDomNodeList & drivers );
00121 
00122   
00123   QString        nativeManufacturer;  
00124   QString        nativeProduct;       
00125   ConnectionType connectionType;      
00126   QDomNodeList   drivers;             
00127 
00128 };
00129 
00130 
00131 typedef QMap< QString, PrinterDevice > PrinterMap;  
00132 
00133 
00134 typedef struct ppd_info
00135 {
00136   QString ppdFilePath;
00137   QString product;
00138   QString nickName;
00139   QString modelName;
00140   QString manufacturer;
00141   QString languageVersion;
00142 }
00143 PpdInfo;
00144 
00145 
00151 class LpsNotice : public QString
00152 {
00153 public:
00154 
00160   LpsNotice( const char * str );
00161 
00168   LpsNotice( const QString & str );
00169 
00170 };
00171 
00172 
00178 class LpsError : public QString
00179 {
00180 public:
00181 
00187   LpsError( const char * str );
00188 
00195   LpsError( const QString & str );
00196 
00197 };
00198 
00199 
00212 QString sudo();
00213 
00214 
00215 
00216 
00217 
00218 
00219 
00220 
00221 
00222 
00223 
00224 
00225 
00226 
00237 void showPrinterDriverDetails( const QString & driverName );
00238 
00239 
00252 void testPrintRequest( QWidget * widget, const QString & printerName );
00253 
00254 
00265 void installPrinter(  QWidget * widget,
00266                       const QString & printerName,
00267                       const QString & deviceUri,
00268                       const QString & ppdFilePath );
00269 
00270 }; 
00271 
00272 
00273 
00312 #endif