r23774 by jghali - Remove obsolete code in ScPrintEngine_GDI::getDefaultPrinter(void)

scribus-commit scribus-commit at lists.scribus.net
Mon May 11 17:31:27 UTC 2020


Author: jghali
Date: Mon May 11 17:31:27 2020
New Revision: 23774

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23774
Log:
Remove obsolete code in ScPrintEngine_GDI::getDefaultPrinter(void)

Modified:
    trunk/Scribus/scribus/scprintengine_gdi.cpp

Modified: trunk/Scribus/scribus/scprintengine_gdi.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23774&path=/trunk/Scribus/scribus/scprintengine_gdi.cpp
==============================================================================
--- trunk/Scribus/scribus/scprintengine_gdi.cpp	(original)
+++ trunk/Scribus/scribus/scprintengine_gdi.cpp	Mon May 11 17:31:27 2020
@@ -640,46 +640,11 @@
 QString ScPrintEngine_GDI::getDefaultPrinter(void)
 {
 	QString defPrinter;
-	OSVERSIONINFO osvi;
-	DWORD returned, buffSize;
 	WCHAR szPrinter[512] = { 0 };
-	WCHAR* p;
-	
-	buffSize = 512;
-	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-	GetVersionEx(&osvi);
-
-	if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5) // Win2k and later
-	{
-		if (GetDefaultPrinterW(szPrinter, &buffSize))
-			defPrinter = QString::fromUtf16((const ushort*) szPrinter);
-	}
-	else if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion < 5) // NT4 or earlier
-	{
-		if (GetProfileStringW(L"windows",L"device",L"", szPrinter, buffSize) < (buffSize - 1))
-		{
-			p = szPrinter;
-			while (*p != 0 && *p != ',')
-				++p;
-			*p = 0;
-			defPrinter = QString::fromUtf16((const ushort*) szPrinter);
-		}
-	}
-	else
-	{
-		DWORD numPrinters;
-		PRINTER_INFO_2W* printerInfos = nullptr;
-		EnumPrintersW (PRINTER_ENUM_DEFAULT, nullptr, 2, nullptr, 0, &buffSize, &numPrinters);
-		printerInfos = (PRINTER_INFO_2W*) malloc(buffSize);
-		if (EnumPrintersW (PRINTER_ENUM_LOCAL, nullptr, 2, (LPBYTE) printerInfos, buffSize, &buffSize, &returned))
-		{
-			if (returned > 0)
-			{
-				defPrinter = QString::fromUtf16((const ushort*) printerInfos->pPrinterName);
-			}
-		}
-		if (printerInfos) free(printerInfos);
-	}
+	DWORD buffSize = 512;
+
+	if (GetDefaultPrinterW(szPrinter, &buffSize))
+		defPrinter = QString::fromUtf16((const ushort*) szPrinter);
 	return defPrinter;
 }
 




More information about the scribus-commit mailing list