LCL, fix cups printer properties dialog title, issue #20191

git-svn-id: trunk@32243 -
This commit is contained in:
jesus 2011-09-09 20:49:37 +00:00
parent 7af08b9b8b
commit 6d24d264ef
3 changed files with 21 additions and 4 deletions

View File

@ -359,7 +359,8 @@ end;
//Print the file aFileName with a selected printer an options //Print the file aFileName with a selected printer an options
function TCUPSPrinter.PrintFile(aFileName: String): longint; function TCUPSPrinter.PrintFile(aFileName: String): longint;
var PrinterName : string; var
aPrinterName : string;
begin begin
Result:=-1; Result:=-1;
if not CUPSLibInstalled then Exit; if not CUPSLibInstalled then Exit;
@ -371,11 +372,11 @@ begin
SetOptionsOfPrinter; SetOptionsOfPrinter;
if Assigned(fcupsPrinter) then if Assigned(fcupsPrinter) then
PrinterName:=fcupsPrinter^.Name aPrinterName:=fcupsPrinter^.Name
else else
PrinterName:=''; aPrinterName:='';
Result:=cupsdyn.cupsPrintFile(PChar(PrinterName),PChar(aFileName), Result:=cupsdyn.cupsPrintFile(PChar(aPrinterName),PChar(aFileName),
PChar(Self.Title), PChar(Self.Title),
fcupsNumOpts,fcupsOptions); fcupsNumOpts,fcupsOptions);

View File

@ -6,6 +6,12 @@ Var Dlg : Tdlgpropertiesprinter;
begin begin
Dlg:=TdlgPropertiesPrinter.Create(nil); Dlg:=TdlgPropertiesPrinter.Create(nil);
try try
if (Title='') then
begin
if Printer<>nil then
Dlg.Caption := Printer.PrinterName;
end else
Dlg.Caption := Title;
Result:=(Dlg.ShowModal=mrOk); Result:=(Dlg.ShowModal=mrOk);
if Result then if Result then
Dlg.InitProperties; Dlg.InitProperties;

View File

@ -209,6 +209,7 @@ type
function GetPageWidth: Integer; function GetPageWidth: Integer;
function GetPaperSize: TPaperSize; function GetPaperSize: TPaperSize;
function GetPrinterIndex: integer; function GetPrinterIndex: integer;
function GetPrinterName: string;
function GetPrinters: TStrings; function GetPrinters: TStrings;
procedure SetCanvasClass(const AValue: TPrinterCanvasRef); procedure SetCanvasClass(const AValue: TPrinterCanvasRef);
procedure SetCopies(AValue: Integer); procedure SetCopies(AValue: Integer);
@ -262,6 +263,7 @@ type
property PrinterIndex : integer read GetPrinterIndex write SetPrinterIndex; property PrinterIndex : integer read GetPrinterIndex write SetPrinterIndex;
property PrinterName: string read GetPrinterName;
property PaperSize : TPaperSize read GetPaperSize; property PaperSize : TPaperSize read GetPaperSize;
property Orientation: TPrinterOrientation read GetOrientation write SetOrientation; property Orientation: TPrinterOrientation read GetOrientation write SetOrientation;
property PrinterState : TPrinterState read DoGetPrinterState; property PrinterState : TPrinterState read DoGetPrinterState;
@ -607,6 +609,14 @@ begin
Result:=0; //printer by default Result:=0; //printer by default
end; end;
function TPrinter.GetPrinterName: string;
begin
if PrinterIndex<0 then
result := ''
else
result := Printers[PrinterIndex];
end;
//Return & initialize the printers list //Return & initialize the printers list
function TPrinter.GetPrinters: TStrings; function TPrinter.GetPrinters: TStrings;
begin begin