20 #include "kptagspage.h"
27 #include <tqwhatsthis.h>
29 #include <tdelocale.h>
31 KPTagsPage::KPTagsPage(
bool ro, TQWidget *parent,
const char *name)
36 TQString whatsThisAdditionalTagsTable = i18n(
" <qt><p><b>Additional Tags</b></p>"
37 " You may send additional commands to the CUPS server via this editable list. "
38 " There are 3 purposes for this:"
40 " <li>Use any current or future standard CUPS job option not supported by the "
41 " TDEPrint GUI. </li>"
42 " <li>Control any custom job option you may want to support in custom CUPS filters "
43 " and backends plugged into the CUPS filtering chain.</li> "
44 " <li>Send short messages to the operators of your production printers in your "
45 " <em>Central Repro Department</em>."
47 " <p><b>Standard CUPS job options:</b> A complete list of standard CUPS job "
48 " options is in the <a href=\"http://localhost:631/sum.html\">CUPS User Manual</a>. "
49 " Mappings of the kprinter user interface widgets to respective CUPS job option "
50 " names are named in the various <em>WhatsThis</em> help items..</p>"
51 " <p><b>Custom CUPS job options:</b> CUPS print servers may be customized with additional "
52 " print filters and backends which understand custom job options. You can specify such "
53 " custom job options here. If in doubt, ask your system administrator..</p>"
55 " <p><b>Operator Messages:</b> You may send additional messages to the operator(s) of your"
56 " production printers (e.g. in your <em>Central Repro Department</p>)"
57 " Messages can be read by the operator(s) (or yourself) by viewing"
58 " the <em>\"Job IPP Report\"</em> for the job.</p>"
59 " <b>Examples:</b><br>"
61 " A standard CUPS job option:<br> "
62 " <em>(Name) number-up</em> -- <em>(Value) 9</em> <br>"
64 " A job option for custom CUPS filters or backends:<br> "
65 " <em>(Name) DANKA_watermark</em> -- <em>(Value) Company_Confidential</em> <br>"
67 " A message to the operator(s):<br> "
68 " <em>(Name) Deliver_after_completion</em> -- <em>(Value) to_Marketing_Departm.</em><br>"
70 " <p><b>Note:</b> the fields must not include spaces, tabs or quotes. You may need to "
71 " double-click on a field to edit it."
72 " <p><b>Warning:</b> Do not use such standard CUPS option names which also can be used "
73 " through the TDEPrint GUI. Results may be unpredictable if they conflict, "
74 " or if they are sent multiple times. For all options supported by the GUI, please do use "
75 " the GUI. (Each GUI element's 'WhatsThis' names the related CUPS option name.) </p> "
77 setTitle(i18n(
"Additional Tags"));
78 setOnlyRealPrinters(
true);
80 m_tags =
new TQTable(10, 2,
this);
81 m_tags->horizontalHeader()->setStretchEnabled(
true);
82 m_tags->horizontalHeader()->setLabel(0, i18n(
"Name"));
83 m_tags->horizontalHeader()->setLabel(1, i18n(
"Value"));
84 m_tags->setReadOnly(ro);
85 TQWhatsThis::add(m_tags, whatsThisAdditionalTagsTable);
87 TQVBoxLayout *l0 =
new TQVBoxLayout(
this, 0, 5);
88 l0->addWidget(m_tags);
92 TQLabel *lab =
new TQLabel(i18n(
"Read-Only"),
this);
93 TQFont f = lab->font();
96 lab->setAlignment(AlignVCenter|AlignRight);
101 KPTagsPage::~KPTagsPage()
105 bool KPTagsPage::isValid(TQString& msg)
108 for (
int r=0; r<m_tags->numCols(); r++)
110 TQString tag(m_tags->text(r, 0));
113 else if (tag.find(re) != -1)
115 msg = i18n(
"The tag name must not contain any spaces, tabs or quotes: <b>%1</b>.").arg(tag);
122 void KPTagsPage::setOptions(
const TQMap<TQString,TQString>& opts)
125 TQRegExp re(
"^\"|\"$");
126 for (TQMap<TQString,TQString>::ConstIterator it=opts.begin(); it!=opts.end() && r<m_tags->numRows(); ++it)
128 if (it.key().startsWith(
"KDEPrint-"))
130 m_tags->setText(r, 0, it.key().mid(9));
131 TQString data = it.data();
132 m_tags->setText(r, 1, data.replace(re,
""));
136 for (; r<m_tags->numRows(); r++)
138 m_tags->setText(r, 0, TQString::null);
139 m_tags->setText(r, 1, TQString::null);
143 void KPTagsPage::getOptions(TQMap<TQString,TQString>& opts,
bool)
145 for (
int r=0; r<m_tags->numRows(); r++)
147 TQString tag(m_tags->text(r, 0)), val(m_tags->text(r, 1));
150 tag.prepend(
"KDEPrint-");
151 opts[tag] = val.prepend(
"\"").append(
"\"");
156 TQSize KPTagsPage::sizeHint()
const
158 return TQSize(-1, -1);
161 TQSize KPTagsPage::minimumSizeHint()
const
163 return TQSize(-1, -1);
This class is intended to be used as base class for customized print dialog page.