Changeset 45 for trunk/gui


Ignore:
Timestamp:
Sep 18, 2013, 1:08:11 AM (12 years ago)
Author:
Alex Taylor
Message:

Try to handle mismatched case in model name between DRV and PPD.

Location:
trunk/gui
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/printer/cupswiz/cupswiz.VRX

    r40 r45  
    286286*/
    287287/* Creates an OS/2 printer port, queue, and desktop object which point to
    288  * the just-created CUPS printer.  Uses the RINSTPRN utility from IBM.
     288 * the just-created CUPS printer.
    289289 */
    290290CreateOS2Printer: PROCEDURE EXPOSE globals.
     
    341341        ok = CreatePrinterObject( prnt_drv, printer_model,,
    342342                                  port_name, queue_name, printer_title )
    343         CALL LINEOUT globals.!log1, 'CreatePrinterObject(' prnt_drv',' printer_model,
     343        CALL LINEOUT globals.!log1, 'CreatePrinterObject(' prnt_drv',' printer_model ||,
    344344                                    ',' port_name',' queue_name',' printer_title ') RC =' ok
    345         IF ok <> 0 THEN DO
     345        IF ( ok <> 0 ) & ( printer_model <> 'Generic Postscript Printer') THEN DO
    346346            CALL LINEOUT globals.!log1, 'Failed to create printer object; trying again with generic driver.'
    347347            ok = CreatePrinterObject( prnt_drv, 'Generic Postscript Printer',,
    348348                                      port_name, queue_name, printer_title )
    349             CALL LINEOUT globals.!log1, 'CreatePrinterObject(' prnt_drv', Generic Postscript Printer',
     349            CALL LINEOUT globals.!log1, 'CreatePrinterObject(' prnt_drv', Generic Postscript Printer' ||,
    350350                                        ',' port_name',' queue_name',' printer_title ') RC =' ok
    351351        END
     
    412412            END
    413413        END
    414         ELSE IF PrinterExistsInDRV( globals.!os2driver, globals.!prt_nick ) == 0 THEN DO
    415             cups_ppd = globals.!prt_ppd
    416             IF cups_ppd == '' THEN
    417                 cups_ppd = STREAM( globals.!cupsdir'\etc\cups\ppd\'globals.!prt_name'.ppd', 'C', 'QUERY EXISTS')
    418             IF cups_ppd == '' THEN
    419                 CALL PromptForPMName
    420             ELSE DO
    421                 ok = ImportPPD(globals.!os2driver, cups_ppd )
    422                 IF ok <> 0 THEN DO
    423                     CALL LINEOUT globals.!log1, 'PPD import failed:' ok
    424                     CALL VRMessage VRWindow(), NLSGetMessage( 69 ),  NLSGetMessage( 70 ), 'W'
     414        ELSE DO
     415            drv_model = PrinterExistsInDRV( globals.!os2driver, globals.!prt_nick )
     416            IF drv_model == '' THEN DO
     417                cups_ppd = globals.!prt_ppd
     418                IF cups_ppd == '' THEN
     419                    cups_ppd = STREAM( globals.!cupsdir'\etc\cups\ppd\'globals.!prt_name'.ppd', 'C', 'QUERY EXISTS')
     420                IF cups_ppd == '' THEN DO
     421                    CALL LINEOUT globals.!log1, 'CUPS PPD for this printer ('globals.!cupsdir'\etc\cups\ppd\'globals.!prt_name'.ppd) does not exist.'
     422                    CALL LINEOUT globals.!log1, 'Cannot import PPD.  Prompting user for preferred printer model.'
    425423                    CALL PromptForPMName
    426                     /* RETURN 1                RC=1  PPD import failed **/
     424                END
     425                ELSE DO
     426                    ok = ImportPPD(globals.!os2driver, cups_ppd )
     427                    IF ok <> 0 THEN DO
     428                        CALL LINEOUT globals.!log1, 'PPD import failed:' ok
     429                        CALL VRMessage VRWindow(), NLSGetMessage( 69 ),  NLSGetMessage( 70 ), 'W'
     430                        CALL PromptForPMName
     431                        /* RETURN 1                RC=1  PPD import failed **/
     432                    END
    427433                END
    428434            END
     435            ELSE
     436                /* Make sure the name matches, including case */
     437                globals.!prt_nick = drv_model
    429438        END
    430439
     
    11211130    _force_remote = 0
    11221131    globals.!prt_ppd = ''
    1123     IF InitArgs.0 > 0 THEN 
     1132    IF InitArgs.0 > 0 THEN
    11241133    DO i = 1 TO InitArgs.0
    11251134        InitArgs.i = TRANSLATE( InitArgs.i )
     
    13571366/*:VRX         PB_CREATEHELP_Click
    13581367*/
    1359 PB_CREATEHELP_Click: 
     1368PB_CREATEHELP_Click:
    13601369    CALL VRMethod 'SW_CREATE', 'InvokeHelp'
    13611370return
     
    13761385/*:VRX         PB_HELP_Click
    13771386*/
    1378 PB_HELP_Click: 
     1387PB_HELP_Click:
    13791388    CALL VRMethod 'WN_MAIN', 'InvokeHelp'
    13801389return
     
    14021411/*:VRX         PB_NETHELP_Click
    14031412*/
    1404 PB_NETHELP_Click: 
     1413PB_NETHELP_Click:
    14051414    CALL VRMethod 'SW_NETWORK', 'InvokeHelp'
    14061415return
     
    18911900    CALL NLSSetText 'SW_ABOUT',  'Caption', 10                                          /* 10: Product Information */
    18921901    CALL NLSSetText 'DT_ABOUT1', 'Caption', 11                                          /* 11: eCups Printer Install Utility */
    1893     CALL NLSSetText 'DT_ABOUT2', 'Caption', 12, '1.04'                                  /* 12: Version %1 */
     1902    CALL NLSSetText 'DT_ABOUT2', 'Caption', 12, '1.05'                                  /* 12: Version %1 */
    18941903    CALL NLSSetText 'DT_ABOUT3', 'Caption', 13, '2010, 2013'                            /* 13: (C) %1 Alex Taylor */
    18951904    CALL NLSSetText 'PB_ABOUT',  'Caption', 2                                           /* 10: Product Information */
  • trunk/gui/printer/cupswiz/readme.1st

    r40 r45  
    11CUPSWIZ - CUPS printer-creation wizard
    2 Version 1.04
     2Version 1.05
    33
    44  This program is simple graphical front-end for creating CUPS-based printers
  • trunk/gui/printer/manager/readme.txt

    r42 r45  
    11PM Printer Manager
    2 Version 0.44
     2Version 0.45
    33
    44  Printer Manager is a new graphical printer management tool designed to
  • trunk/gui/shared/PrManUtl.VRS

    r44 r45  
    292292/* Determine if the specified PrinterPak driver already contains support
    293293 * for the specified printer model.
     294 *
     295 * If so, return the name of the model as found in the driver (necessary in
     296 * order to make sure the correct case is retained, which may be different
     297 * from what was requested).  Otherwise return ''.
    294298 */
    295299PrinterExistsInDRV: PROCEDURE EXPOSE globals.
     
    312316     */
    313317    start = 1
    314     found = 0
     318    found = ''
    315319    DO WHILE ( found == 0 ) & ( start < total_len )
    316320        _strend = POS('0'x, exist_models, start )
    317321        IF _strend == 0 THEN LEAVE
    318         _model = TRANSLATE( SUBSTR( exist_models, start, _strend - start ))
    319         IF _model == printer_name THEN
    320             found = 1
     322        _model = SUBSTR( exist_models, start, _strend - start )
     323        IF TRANSLATE( _model ) == printer_name THEN
     324            found = _model
    321325        ELSE
    322326            start = _strend + 1
  • trunk/gui/shared/PrintUtl.VRS

    r38 r45  
    177177/* Determine if the specified PrinterPak driver already contains support
    178178 * for the specified printer model.
     179 *
     180 * If so, return the name of the model as found in the driver (necessary in
     181 * order to make sure the correct case is retained, which may be different
     182 * from what was requested).  Otherwise return ''.
    179183 */
    180184PrinterExistsInDRV: PROCEDURE EXPOSE globals.
     
    197201     */
    198202    start = 1
    199     found = 0
     203    found = ''
    200204    DO WHILE ( found == 0 ) & ( start < total_len )
    201205        _strend = POS('0'x, exist_models, start )
    202206        IF _strend == 0 THEN LEAVE
    203         _model = TRANSLATE( SUBSTR( exist_models, start, _strend - start ))
    204         IF _model == printer_name THEN
    205             found = 1
     207        _model = SUBSTR( exist_models, start, _strend - start )
     208        IF TRANSLATE( _model ) == printer_name THEN
     209            found = _model
    206210        ELSE
    207211            start = _strend + 1
Note: See TracChangeset for help on using the changeset viewer.