r=rods, sr=blizzard, a=rjesup@wgate.com
OS/2 only - convert native printer names to Unicode
This commit is contained in:
mkaply%us.ibm.com 2002-09-10 04:01:20 +00:00
parent f6c138868c
commit 86e88e2cbb
2 changed files with 12 additions and 3 deletions

View File

@ -507,10 +507,14 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
for (int i = 0; i < mGlobalNumPrinters; i++) {
nsXPIDLCString printer;
nsDeviceContextSpecOS2::PrnDlg.GetPrinter(i, getter_Copies(printer));
PRUnichar* printerName = new PRUnichar[strlen(printer)+1];
MultiByteToWideChar(0, printer, strlen(printer)+1, printerName, strlen(printer)+1);
nsAutoString nativePrinterName(printerName);
delete [] printerName;
if ( defaultPrinter == i )
mGlobalPrinterList->InsertStringAt(NS_ConvertASCIItoUCS2(printer), 0);
mGlobalPrinterList->InsertStringAt(nativePrinterName, 0);
else
mGlobalPrinterList->AppendString(NS_ConvertASCIItoUCS2(printer));
mGlobalPrinterList->AppendString(nativePrinterName);
}
return NS_OK;
}
@ -525,8 +529,12 @@ void GlobalPrinters::GetDefaultPrinterName(PRUnichar*& aDefaultPrinterName)
int defaultPrinter = nsDeviceContextSpecOS2::PrnDlg.GetDefaultPrinter();
nsXPIDLCString printer;
nsDeviceContextSpecOS2::PrnDlg.GetPrinter(defaultPrinter, getter_Copies(printer));
PRUnichar* printerName = new PRUnichar[strlen(printer)+1];
MultiByteToWideChar(0, printer, strlen(printer)+1, printerName, strlen(printer)+1);
nsAutoString nativePrinterName(printerName);
delete [] printerName;
aDefaultPrinterName = ToNewUnicode(NS_ConvertASCIItoUCS2(printer));
aDefaultPrinterName = ToNewUnicode(nativePrinterName);
}
void GlobalPrinters::FreeGlobalPrinters()

View File

@ -56,6 +56,7 @@
#ifdef USE_XPRINT
#include "nsIDeviceContextSpecXPrint.h"
#endif /* USE_XPRINT */
#include "nsGFXDefs.h"
#include "nsPrintdOS2.h"
#include <os2.h>
#include <pmddim.h>