Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » PrinterDlg changes defaultprinter on Linux
PrinterDlg changes defaultprinter on Linux [message #47577] Tue, 31 January 2017 16:55 Go to next message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
I am looking at this code in PrinterJob.cpp (CtrlLib)
void PrinterDlg::SyncPrinterOptions()
{
	Vector<String> l = Split(System("lpoptions -d " + String(~printer) + " -l"), '\n');
	paper.Disable();
	paper.Clear();
	slot.Disable();
	slot.Clear();
	for(int i = 0; i < l.GetCount(); i++) {
		FillOpt(l[i], "pagesize", paper, true);
		FillOpt(l[i], "inputslot", slot, false);
	}
}

and I think that "lpoptions -d " should be "lpoptions -p " to avoid changing the default printer for all programs of that user, but then it stops working.

[Updated on: Sat, 04 February 2017 19:55]

Report message to a moderator

Re: PrinterDlg changes defaultprinter on Linux [message #47685 is a reply to message #47577] Tue, 07 March 2017 01:09 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Documenation seems confusing, but it looks like -p actually does not allow -l after it...
Re: PrinterDlg changes defaultprinter on Linux [message #47686 is a reply to message #47685] Tue, 07 March 2017 03:16 Go to previous message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
Ah, sorry it seems I didn't quote the original code.
It is
Vector<String> l = Split(System("lpoptions -l -d " + String(~printer)), '\n');

that seems to first list the options and then change the defaultprinter.
Not correct I think as you get the options of the previous printer.
If I change it like I wrote in the first message then it works correctly but still changes the default printer when used.
the -p works ok on the commandline but then the dialog doesn't return the correct printer as it seems to rely on changing the default printer.

[Updated on: Tue, 07 March 2017 03:21]

Report message to a moderator

Previous Topic: IdeCalc -- ERROR: void.sin(): (0,15): 'sin' is not a lambda
Next Topic: automatic build set up does not start up
Goto Forum:
  


Current Time: Fri Mar 29 15:09:47 CET 2024

Total time taken to generate the page: 0.01382 seconds