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 2006-02-16 21:32:15 +00:00
Родитель 00fc479a7f
Коммит ed56948926
2 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -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()

Просмотреть файл

@ -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>