Changeset 38 for trunk/gui/printer
- Timestamp:
- May 8, 2013, 5:56:26 PM (12 years ago)
- Location:
- trunk/gui/printer/manager
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/printer/manager/PRINTOOL.VRX
r37 r38 98 98 CheckPrograms: PROCEDURE EXPOSE globals. 99 99 100 globals.!hascups = 0 101 100 102 /* See if CUPSLPR.EXE (required by CUPS.PDR) is installed. 101 103 */ … … 111 113 globals.!programs.!cupslpr = STREAM( globals.!mydir'\cupslpr.exe', 'C', 'QUERY EXISTS') 112 114 115 /* See if CUPS.PDR is installed. 116 */ 117 IF globals.!programs.!cupslpr <> '' THEN DO 118 cups_pdr = VRGetIni('PM_PORT_DRIVER', 'CUPS', 'System') 119 IF cups_pdr == '' THEN DO 120 cups_pdr = STREAM( globals.!bootdrv'\OS2\DLL\CUPS.PDR', 'C', 'QUERY EXISTS') 121 IF cups_pdr <> '' THEN CALL VRSetIni('PM_PORT_DRIVER', 'CUPS', cups_pdr, 'System') 122 END 123 IF cups_pdr <> '' THEN 124 globals.!hascups = 1 125 END 126 113 127 /* See if GZIP.EXE is installed (required for unpacking CUPS PPDs). 114 128 */ … … 119 133 globals.!programs.!gzip = STREAM( globals.!mydir'\gzip.exe', 'C', 'QUERY EXISTS') 120 134 121 IF globals.!hascups THEN DO122 globals.!programs.!lpadmin = STREAM( globals.!cupsdir'\sbin\lpadmin.exe', 'C', 'QUERY EXISTS')123 globals.!programs.!lpinfo = STREAM( globals.!cupsdir'\sbin\lpinfo.exe','C', 'QUERY EXISTS')124 globals.!programs.!lpoptions = STREAM( globals.!cupsdir'\bin\lpoptions.exe','C', 'QUERY EXISTS')125 globals.!programs.!lpstat = STREAM( globals.!cupsdir'\bin\lpstat.exe','C', 'QUERY EXISTS')126 END135 /* Try and find some other CUPS programs we use. 136 */ 137 globals.!programs.!lpadmin = STREAM( globals.!cupsdir'\sbin\lpadmin.exe', 'C', 'QUERY EXISTS') 138 globals.!programs.!lpinfo = STREAM( globals.!cupsdir'\sbin\lpinfo.exe', 'C', 'QUERY EXISTS') 139 globals.!programs.!lpoptions = STREAM( globals.!cupsdir'\bin\lpoptions.exe', 'C', 'QUERY EXISTS') 140 globals.!programs.!lpstat = STREAM( globals.!cupsdir'\bin\lpstat.exe', 'C', 'QUERY EXISTS') 127 141 128 142 RETURN … … 202 216 203 217 IF TRANSLATE( _host ) <> 'LOCALHOST' THEN 204 del_cmd = globals.!programs.!lpadmin '-h' _host '- d' _dest218 del_cmd = globals.!programs.!lpadmin '-h' _host '-x' _dest 205 219 ELSE 206 del_cmd = globals.!programs.!lpadmin '- d' _dest220 del_cmd = globals.!programs.!lpadmin '-x' _dest 207 221 CALL LINEOUT globals.!log1, 'Delete CUPS destination' _dest' with:' del_cmd 208 222 223 /* 209 224 nq = RXQUEUE('CREATE') 210 225 oq = RXQUEUE('SET', nq ) … … 213 228 PARSE PULL _output 214 229 CALL LINEOUT globals.!log2, _output 215 IF LEFT( _output, 8 ) == 'Password' & RIGHT( STRIP( _output ), 1 ) == '?' THEN DO230 IF LEFT( _output, 12 ) == 'Password for' & RIGHT( STRIP( _output ), 1 ) == '?' THEN DO 216 231 CALL SysSleep 1 217 CALL CHAROUT,'0d0a'x232 PUSH '0d0a'x 218 233 END 219 234 END 220 235 CALL RXQUEUE 'SET', oq 221 236 CALL RXQUEUE 'DELETE', nq 222 /* 237 */ 238 239 _od = DIRECTORY() 240 CALL DIRECTORY VRParseFileName( globals.!programs.!lpadmin, 'DP') 223 241 ADDRESS CMD '@' del_cmd '2>&1 >>' globals.!log2 224 */ 242 CALL DIRECTORY _od 225 243 226 244 CALL LINEOUT globals.!log2, '' … … 238 256 /*:VRX DriverDelete 239 257 */ 240 DriverDelete: PROCEDURE EXPOSE globals 258 DriverDelete: PROCEDURE EXPOSE globals. 259 PARSE ARG record 260 IF record == '' THEN DO 261 ok = VRMethod( "CN_DEVICES", "GetRecordList", "Selected", "recs." ) 262 IF ok == 0 | recs.0 < 1 THEN RETURN 263 record = recs.1 264 END 265 CALL VRMethod 'CN_DEVICES', 'SetRecordAttr', record, 'Source', 0 266 267 _name = VRMethod('CN_DEVICES', 'GetFieldData', record, globals.!hcfDevices.!model ) 268 _driver = VRMethod('CN_DEVICES', 'GetFieldData', record, globals.!hcfDevices.!driver ) 269 IF _name == '' THEN RETURN 270 IF _driver == '' THEN RETURN 271 272 IF _driver == 'IBMNULL' THEN DO 273 CALL VRMessage 'WN_MAIN', NLSGetMessage( 212 ), NLSGetMessage( 209 ), 'W' 274 RETURN 275 END 276 277 device_name = _driver'.'_name 278 device_in_use = 0 279 printers.0 = 0 280 CALL RPUEnumPrinters 'printers.' 281 DO i = 1 TO printers.0 282 CALL RPUPrinterQuery printers.i.!name, 'details.' 283 CALL StringTokenize details.!drivers, ',', 'used_dev.' 284 DO j = 1 TO used_dev.0 285 IF used_dev.j == device_name THEN DO 286 device_in_use = 1 287 LEAVE 288 END 289 END 290 IF device_in_use == 1 THEN DO 291 _title = TRANSLATE( printers.i.!description, ' ', '0d0a'x) 292 CALL VRMessage 'WN_MAIN', NLSGetMessage( 208, device_name, _title ), NLSGetMessage( 209 ), 'W' 293 RETURN 294 END 295 END 296 297 _btns.0 = 2 298 _btns.1 = NLSGetMessage( 14 ) 299 _btns.2 = NLSGetMessage( 15 ) 300 _confirm = VRMessage('WN_MAIN', NLSGetMessage( 203, device_name ), NLSGetMessage( 200 ), 'Q', '_btns.', 2, 2 ) 301 IF _confirm == 1 THEN DO 302 success = DeletePrintDriver( _driver, _name ) 303 IF success == 1 THEN CALL RefreshDevices 304 /* TODO check if any other _driver definitions exist and if not, offer to delete _driver files & profile */ 305 END 241 306 242 307 RETURN … … 739 804 LoadSettings: PROCEDURE EXPOSE globals. 740 805 741 globals.!version = '0.3 '806 globals.!version = '0.31' 742 807 globals.!copyright = '2013' 743 808 … … 754 819 cupsdrv = STRIP( cupsdrv, 'T', '\') 755 820 globals.!cupsdir = cupsdrv'\cups' 756 globals.!hascups = VRIsDir( globals.!cupsdir )757 821 758 822 /* Get system paths. … … 1126 1190 CALL New_CUPS new_ppd 1127 1191 CALL SW_IMPORT_Close 1192 CALL VRSet 'WN_MAIN', 'Shutdown', 1 1128 1193 RETURN 1129 1194 END … … 1418 1483 /*:VRX PortDelete 1419 1484 */ 1420 PortDelete: PARSE ARG record 1485 PortDelete: PROCEDURE EXPOSE globals. 1486 PARSE ARG record 1421 1487 IF record == '' THEN DO 1422 1488 ok = VRMethod( "CN_PORTS", "GetRecordList", "Selected", "recs." ) … … 1424 1490 record = recs.1 1425 1491 END 1492 CALL VRMethod 'CN_PORTS', 'SetRecordAttr', record, 'Source', 0 1426 1493 1427 1494 _name = VRMethod('CN_PORTS', 'GetFieldData', record, globals.!hcfPorts.!name ) 1495 1496 printers.0 = 0 1497 CALL RPUEnumPrinters 'printers.' 1498 DO i = 1 TO printers.0 1499 CALL RPUPrinterQuery printers.i.!name, 'details.' 1500 IF _name == details.!port THEN DO 1501 _title = TRANSLATE( printers.i.!description, ' ', '0d0a'x) 1502 CALL VRMessage 'WN_MAIN', NLSGetMessage( 206, _name, _title ), NLSGetMessage( 207 ), 'W' 1503 RETURN 1504 END 1505 END 1506 1428 1507 IF _name == '' THEN RETURN 1429 1508 _btns.0 = 2 … … 1435 1514 IF success == 1 THEN CALL RefreshPorts 1436 1515 END 1437 1438 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 01439 1516 1440 1517 RETURN … … 1499 1576 IF _confirm == 1 THEN DO 1500 1577 success = CupsDeletePrinter( cups_host, cups_queue ) 1501 IF success == 0 THEN 1578 IF success == 0 THEN DO 1502 1579 CALL RPUPortDelete _port 1580 CALL RefreshPorts 1581 END 1503 1582 ELSE 1504 1583 CALL VRMessage 'WN_MAIN', NLSGetMessage( 251, cups_queue, success ), NLSGetMessage( 18 ), 'E' -
trunk/gui/printer/manager/printm_en.txt
r37 r38 218 218 PTM0204I: Printer "%1" points to the local CUPS queue "%2" via port %3. Delete this CUPS queue and port as well? 219 219 PTM0205I: Add a new port of type %1? 220 PTM0206 ?:221 PTM0207 ?:222 PTM0208 ?:223 PTM0209 ?:220 PTM0206I: Port %1 cannot be deleted, as it is currently assigned to the printer "%2". 221 PTM0207I: Port In Use 222 PTM0208I: Driver "%1" cannot be deleted, as it is currently in use by the printer "%2". 223 PTM0209I: Device In Use 224 224 PTM0210I: No Properties 225 225 PTM0211I: There are no properties available for the port %1. 226 PTM0212 ?:226 PTM0212I: The IBMNULL driver cannot be deleted. 227 227 PTM0213?: 228 228 PTM0214?:
Note:
See TracChangeset
for help on using the changeset viewer.