Revert a change to printer orientation
authorTitta Heikkala <titta.heikkala@digia.com>
Thu, 6 Sep 2012 09:58:18 +0000 (12:58 +0300)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 15 Oct 2012 20:01:47 +0000 (22:01 +0200)
Reverting change: Ia6bc9ae14d79a646e61bfc97652f9f5af90738b3
The previous change does not set the printer correctly. It looks
based on the tests that the correct printer is set, but in reality
the default printer is used (even though printerName() is returning
the printer set).

Updated taskQTBUG4497_reusePrinterOnDifferentFiles() test case
so that it generates PDF instead of PS. Testing the binary output
can't be guaranteed to work in this case.

Change-Id: Iee111f2c2dec84f86344a38816c21e191f5373ea
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
src/printsupport/kernel/qprintengine_win.cpp
tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp

index 759a76d..27351de 100644 (file)
@@ -1174,16 +1174,6 @@ void QWin32PrintEnginePrivate::doReinit()
     if (state == QPrinter::Active) {
         reinit = true;
     } else {
-        if (!name.isEmpty()) {
-            HANDLE hCheckPrinter;
-            if (!OpenPrinter((LPWSTR)name.utf16(), (LPHANDLE)&hCheckPrinter, 0)) {
-                initialize();
-                return;
-            } else {
-                ClosePrinter(hCheckPrinter);
-                hCheckPrinter = 0;
-            }
-        }
         resetDC();
         initDevRects();
         reinit = false;
@@ -1306,12 +1296,9 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
 
     case PPK_PrinterName:
         d->name = value.toString();
-        if (d->name.isEmpty()) {
+        if (d->name.isEmpty())
             d->queryDefault();
-            d->initialize();
-        } else {
-            d->doReinit();
-        }
+        d->initialize();
         break;
 
     case PPK_Resolution:
index 7f872a4..0f7c7f7 100644 (file)
@@ -965,28 +965,28 @@ static void printPage(QPainter *painter)
 
 void tst_QPrinter::taskQTBUG4497_reusePrinterOnDifferentFiles()
 {
-    TempFileCleanup tmpFile1("out1.ps");
-    TempFileCleanup tmpFile2("out2.ps");
+    TempFileCleanup tmpFile1("out1.pdf");
+    TempFileCleanup tmpFile2("out2.pdf");
 
     QPrinter printer;
     {
 
-        printer.setOutputFileName("out1.ps");
+        printer.setOutputFileName("out1.pdf");
         QPainter painter(&printer);
         printPage(&painter);
 
     }
     {
 
-        printer.setOutputFileName("out2.ps");
+        printer.setOutputFileName("out2.pdf");
         QPainter painter(&printer);
         printPage(&painter);
 
     }
-    QFile file1("out1.ps");
+    QFile file1("out1.pdf");
     QVERIFY(file1.open(QIODevice::ReadOnly));
 
-    QFile file2("out2.ps");
+    QFile file2("out2.pdf");
     QVERIFY(file2.open(QIODevice::ReadOnly));
 
     while (!file1.atEnd() && !file2.atEnd()) {