src/solaris/classes/sun/print/IPPPrintService.java

Print this page

        

@@ -412,10 +412,11 @@
                 try {
                     cps = new CUPSPrinter(printer);
                     mediaSizeNames = cps.getMediaSizeNames();
                     mediaTrays = cps.getMediaTrays();
                     customMediaSizeNames = cps.getCustomMediaSizeNames();
+                    defaultMediaIndex = cps.getDefaultMediaIndex();
                     urlConnection.disconnect();
                     init = true;
                     return;
                 } catch (Exception e) {
                     IPPPrintService.debug_println(debugPrefix+

@@ -1430,11 +1431,13 @@
                 return JobSheets.NONE;
             } else {
                 return JobSheets.STANDARD;
             }
         } else if (category == Media.class) {
+            if (defaultMediaIndex == -1) {
             defaultMediaIndex = 0;
+            }
             if (mediaSizeNames.length == 0) {
                 String defaultCountry = Locale.getDefault().getCountry();
                 if (defaultCountry != null &&
                     (defaultCountry.equals("") ||
                      defaultCountry.equals(Locale.US.getCountry()) ||

@@ -1446,21 +1449,11 @@
             }
 
             if (attribClass != null) {
                 String name = attribClass.getStringValue();
                 if (isCupsPrinter) {
-                    for (int i=0; i< customMediaSizeNames.length; i++) {
-                        //REMIND:  get default from PPD. In native _getMedia,
-                        // move default (ppd_option_t->defchoice) to index 0.
-                        // In the meantime, use indexOf because PPD name
-                        // may be different from the IPP attribute name.
-                        if (customMediaSizeNames[i].toString().indexOf(name)
-                            != -1) {
-                            defaultMediaIndex = i;
                             return mediaSizeNames[defaultMediaIndex];
-                        }
-                    }
                 } else {
                     for (int i=0; i< mediaSizeNames.length; i++) {
                         if (mediaSizeNames[i].toString().indexOf(name) != -1) {
                             defaultMediaIndex = i;
                             return mediaSizeNames[defaultMediaIndex];