diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2019-11-14 17:34:40 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2019-11-15 07:35:24 +0100 |
commit | 3c825bcc483d24bc408f7438d966c79a1f5b084c (patch) | |
tree | f204462ee6d7974ccb0068b50811644424ac8cef /vcl | |
parent | feec8e3c34e08b621098a17f1011dccd0b4f7f4c (diff) |
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@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/generic/print/prtsetup.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
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(); } |