Changeset 37 for trunk/gui/printer
- Timestamp:
- May 3, 2013, 8:16:28 PM (12 years ago)
- Location:
- trunk/gui/printer/manager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/printer/manager/PRINTOOL.VRX
r33 r37 119 119 globals.!programs.!gzip = STREAM( globals.!mydir'\gzip.exe', 'C', 'QUERY EXISTS') 120 120 121 IF globals.!hascups THEN DO 122 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 END 127 121 128 RETURN 122 129 … … 188 195 CALL PrinterOpen VRInfo("Record") 189 196 RETURN 197 198 /*:VRX CupsDeletePrinter 199 */ 200 CupsDeletePrinter: PROCEDURE EXPOSE globals. 201 PARSE ARG _host, _dest 202 203 IF TRANSLATE( _host ) <> 'LOCALHOST' THEN 204 del_cmd = globals.!programs.!lpadmin '-h' _host '-d' _dest 205 ELSE 206 del_cmd = globals.!programs.!lpadmin '-d' _dest 207 CALL LINEOUT globals.!log1, 'Delete CUPS destination' _dest' with:' del_cmd 208 209 nq = RXQUEUE('CREATE') 210 oq = RXQUEUE('SET', nq ) 211 ADDRESS CMD '@' del_cmd '2>&1 | RXQUEUE' nq 212 DO QUEUED() 213 PARSE PULL _output 214 CALL LINEOUT globals.!log2, _output 215 IF LEFT( _output, 8 ) == 'Password' & RIGHT( STRIP( _output ), 1 ) == '?' THEN DO 216 CALL SysSleep 1 217 CALL CHAROUT, '0d0a'x 218 END 219 END 220 CALL RXQUEUE 'SET', oq 221 CALL RXQUEUE 'DELETE', nq 222 /* 223 ADDRESS CMD '@' del_cmd '2>&1 >>' globals.!log2 224 */ 225 226 CALL LINEOUT globals.!log2, '' 227 CALL LINEOUT globals.!log2 228 CALL LINEOUT globals.!log1, '' 229 230 RETURN rc 190 231 191 232 /*:VRX DriverAdd … … 673 714 RETURN 674 715 716 /*:VRX InitMessageLog 717 */ 718 /* Initialize the message logfile. Unlike the error log, which is cleared and 719 * recreated every time the program starts, the message log is appended to 720 * until it reaches 100kB in size. If the message log is larger than 100kB when 721 * this function is called, it is renamed (with '~' appended to the name) and 722 * a new message log is started. 723 */ 724 InitMessageLog: PROCEDURE EXPOSE globals. 725 726 logsize = STREAM( globals.!log1, 'C', 'QUERY SIZE') 727 IF ( logsize <> '') & ( logsize > 102400 ) THEN DO 728 CALL VRCopyFile globals.!log1, globals.!log1 || '~' 729 CALL VRDeleteFile globals.!log1 730 END 731 732 datestr = DATE('L') TIME('N') 733 CALL LINEOUT globals.!log1, '--[' datestr ']' ||, 734 COPIES('-', 73 - LENGTH( datestr )) 735 RETURN 736 675 737 /*:VRX LoadSettings 676 738 */ 677 739 LoadSettings: PROCEDURE EXPOSE globals. 678 740 679 globals.!version = '0. 21'741 globals.!version = '0.3' 680 742 globals.!copyright = '2013' 681 743 … … 692 754 cupsdrv = STRIP( cupsdrv, 'T', '\') 693 755 globals.!cupsdir = cupsdrv'\cups' 694 695 /** TODO Identify if CUPS and/or CUPS.PDR is installed */ 696 globals.!hascups = 1 756 globals.!hascups = VRIsDir( globals.!cupsdir ) 697 757 698 758 /* Get system paths. … … 711 771 globals.!logdir = globals.!mydir 712 772 713 globals.!log1 = globals.!logdir'\printmgr.l1' 714 globals.!log2 = globals.!logdir'\printmgr.l2' 773 globals.!log1 = globals.!logdir'\printman.l1' 774 globals.!log2 = globals.!logdir'\printman.l2' 775 CALL InitMessageLog 776 IF VRFileExists( globals.!log2 ) THEN 777 CALL VRDeleteFile globals.!log2 778 715 779 716 780 /* Get printer-related paths. … … 944 1008 od = DIRECTORY() 945 1009 CALL DIRECTORY _workdir 946 IF ppd_file <> '' & VRFileExists( ppd_file ) THEN 1010 IF ppd_file <> '' & VRFileExists( ppd_file ) THEN 947 1011 _parms = _parms ppd_file 948 1012 ADDRESS CMD 'start' cupswiz _parms 949 1013 CALL DIRECTORY od 1014 CALL Quit 950 1015 END 951 1016 … … 957 1022 958 1023 ok = OpenPrinterTemplate('WPRPrinter') 1024 CALL Quit 959 1025 960 1026 RETURN ok … … 965 1031 966 1032 ok = OpenPrinterTemplate('WPPrinter') 1033 CALL Quit 967 1034 968 1035 RETURN ok … … 1404 1471 record = recs.1 1405 1472 END 1473 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0 1406 1474 1407 1475 success = 0 1408 1476 _title = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!title ) 1409 1477 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue ) 1478 _port = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!port ) 1479 1410 1480 _btns.0 = 2 1411 1481 _btns.1 = NLSGetMessage( 14 ) … … 1414 1484 IF _confirm == 1 THEN DO 1415 1485 success = RPUPrinterDelete( _queue ) 1416 END 1417 1418 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0 1486 CALL RPUPortInfo _port, 'port.' 1487 IF port.!driver == 'CUPS' THEN DO 1488 /* If this corresponds to a locally-defined CUPS queue, offer to 1489 * to delete that as well. 1490 */ 1491 cups_prnt = RPUPortQuery('CUPS', _port ) 1492 IF cups_prnt <> '' & ( LENGTH( cups_prnt ) == 130 ) THEN DO 1493 PARSE VAR cups_prnt 1 _cups_host 66 _cups_queue 1494 PARSE VAR _cups_host cups_host '00'x . 1495 PARSE VAR _cups_queue cups_queue '00'x . 1496 IF ( TRANSLATE( cups_host ) == 'LOCALHOST') | cups_host = '127.0.0.1' THEN DO 1497 _confirm = VRMessage('WN_MAIN', NLSGetMessage( 204, _title, cups_queue, _port ),, 1498 NLSGetMessage( 200 ), 'Q', '_btns.', 2, 2 ) 1499 IF _confirm == 1 THEN DO 1500 success = CupsDeletePrinter( cups_host, cups_queue ) 1501 IF success == 0 THEN 1502 CALL RPUPortDelete _port 1503 ELSE 1504 CALL VRMessage 'WN_MAIN', NLSGetMessage( 251, cups_queue, success ), NLSGetMessage( 18 ), 'E' 1505 END 1506 END 1507 END 1508 END 1509 END 1510 1511 CALL RefreshPrinters 1512 1419 1513 RETURN success 1420 1514 -
trunk/gui/printer/manager/printm_en.txt
r33 r37 20 20 PTM0016I: Operation Successful 21 21 PTM0017I: Continue 22 PTM0018 ?:22 PTM0018I: Operation Failed 23 23 PTM0019?: 24 24 ; ------- [20-99]: Menus … … 216 216 PTM0202I: Delete port %1? 217 217 PTM0203I: Delete driver "%1"? 218 PTM0204 ?: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 220 PTM0206?: … … 252 252 PTM0238I: The PPD has been imported. 253 253 PTM0239?: 254 PTM0240?: 255 PTM0241?: 256 PTM0242?: 257 PTM0243?: 258 PTM0244?: 259 PTM0245?: 260 PTM0246?: 261 PTM0247?: 262 PTM0248?: 263 PTM0249?: 264 ; CUPS errors 265 PTM0250I: The CUPS printer %1 could not be created (CUPS return code %2). 266 PTM0251I: The CUPS printer %1 could not be deleted (CUPS return code %2). 267 PTM0252?: 268 PTM0253?: 269 PTM0254?: 270 PTM0255?: 271 PTM0256?: 272 PTM0257?: 273 PTM0258?: 274 PTM0259?: 254 275 276 277
Note:
See TracChangeset
for help on using the changeset viewer.