[Libreoffice-commits] core.git: vcl/unx
Michael Weghorn (via logerrit)
logerrit at kemper.freedesktop.org
Fri Nov 15 06:36:40 UTC 2019
vcl/unx/generic/print/prtsetup.cxx | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 3c825bcc483d24bc408f7438d966c79a1f5b084c
Author: Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Thu Nov 14 17:34:40 2019 +0100
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Fri Nov 15 07:35:24 2019 +0100
tdf#123734 Prepend "Custom." for values of custom PPD options
CUPS supports using custom options in PPDs, which go beyond
what is specified in the PPD specification, s. doc at at [1].
[2] mentions that the "Custom." prefix is needed when specifying
custom page sizes:
> When Custom is listed for the PageSize option, you can specify custom
> media sizes using one of the following forms:
>
> lp -o media=Custom.WIDTHxLENGTH filename
> lp -o media=Custom.WIDTHxLENGTHin filename
> lp -o media=Custom.WIDTHxLENGTHcm filename
> lp -o media=Custom.WIDTHxLENGTHmm filename
While I did not find any explicit documentation that the same
is true for CUPS-specific custom options, this is apparently the case.
(The "CustomPageSize" keyword is expclicitly specified in the PPD
specification [3], section 5.16 "Custom Page Sizes" and thus not
a CUPS-specific custom option.)
This can be seen e.g. by the fact that after setting the default
value for a PPD option to such a custom value, the corresponding
entry in the PPD does get the "Custom." prefix, e.g.
*DefaultPassword: Custom.12345
for the sample PPD from tdf#123734.
For more details, s.a. the discussion on the similar bug report
for Gtk+ at [4], where e.g. comment 0 says:
> According to the cups people, the value should have been
> "Custom.ThisIsAtest" in this case. Without the "Custom." part,
> this is not used by the cups filters.
Therefore, add the "Custom." prefix for custom options, but don't show
them in the UI.
[1] https://www.cups.org/doc/spec-ppd.html#OPTIONS
[2] https://www.cups.org/doc/options.html
[3] https://web.archive.org/web/20161017222612/http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf
[4] https://bugzilla.gnome.org/show_bug.cgi?id=543520
Change-Id: I570d8b55212c6fc33405460f11d152e86cedb0f9
Reviewed-on: https://gerrit.libreoffice.org/82722
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/vcl/unx/generic/print/prtsetup.cxx b/vcl/unx/generic/print/prtsetup.cxx
index ad5d0fc53553..fae6a155220e 100644
--- a/vcl/unx/generic/print/prtsetup.cxx
+++ b/vcl/unx/generic/print/prtsetup.cxx
@@ -411,7 +411,9 @@ IMPL_LINK(RTSDevicePage, ModifyHdl, weld::Entry&, rEdit, void)
{
if (m_pCustomValue)
{
- m_pCustomValue->m_aCustomOption = rEdit.get_text();
+ // tdf#123734 Custom PPD option values are a CUPS extension to PPDs and the user-set value
+ // needs to be prefixed with "Custom." in order to be processed properly
+ m_pCustomValue->m_aCustomOption = "Custom." + rEdit.get_text();
}
}
@@ -477,7 +479,8 @@ void RTSDevicePage::ValueBoxChanged( const PPDKey* pKey )
{
m_pCustomValue = pValue;
m_pParent->m_aJobData.m_aContext.setValue(pKey, pValue);
- m_xCustomEdit->set_text(m_pCustomValue->m_aCustomOption);
+ // don't show the "Custom." prefix in the UI, s.a. comment in ModifyHdl
+ m_xCustomEdit->set_text(m_pCustomValue->m_aCustomOption.replaceFirst("Custom.", ""));
m_xCustomEdit->show();
m_aReselectCustomIdle.Start();
}
More information about the Libreoffice-commits
mailing list