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
function TCUPSPrinter.PrintFile(aFileName: String): longint;
var PrinterName : string;
var
aPrinterName : string;
begin
Result:=-1;
if not CUPSLibInstalled then Exit;
@ -371,11 +372,11 @@ begin
SetOptionsOfPrinter;
if Assigned(fcupsPrinter) then
PrinterName:=fcupsPrinter^.Name
aPrinterName:=fcupsPrinter^.Name
else
PrinterName:='';
aPrinterName:='';
Result:=cupsdyn.cupsPrintFile(PChar(PrinterName),PChar(aFileName),
Result:=cupsdyn.cupsPrintFile(PChar(aPrinterName),PChar(aFileName),
PChar(Self.Title),
fcupsNumOpts,fcupsOptions);

View File

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

View File

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