• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeprint
 

tdeprint

  • tdeprint
  • cups
  • cupsdconf2
cupsdbrowsingpage.cpp
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License version 2 as published by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  **/
19 
20 #include "cupsdbrowsingpage.h"
21 #include "cupsdconf.h"
22 #include "editlist.h"
23 #include "browsedialog.h"
24 
25 #include <tqlabel.h>
26 #include <tqlayout.h>
27 #include <tqcheckbox.h>
28 #include <tqcombobox.h>
29 #include <tqwhatsthis.h>
30 
31 #include <tdelocale.h>
32 #include <knuminput.h>
33 
34 CupsdBrowsingPage::CupsdBrowsingPage(TQWidget *parent, const char *name)
35  : CupsdPage(parent, name)
36 {
37  setPageLabel(i18n("Browsing"));
38  setHeader(i18n("Browsing Settings"));
39  setPixmap("tdeprint_printer_remote");
40 
41  browseinterval_ = new KIntNumInput(this);
42  browseport_ = new KIntNumInput(this);
43  browsetimeout_ = new KIntNumInput(this);
44  browsing_ = new TQCheckBox(i18n("Use browsing"), this);
45  cups_ = new TQCheckBox("CUPS", this);
46  slp_ = new TQCheckBox("SLP", this);
47  browseaddresses_ = new EditList(this);
48  browseorder_ = new TQComboBox(this);
49  useimplicitclasses_ = new TQCheckBox(i18n("Implicit classes"), this);
50  hideimplicitmembers_ = new TQCheckBox(i18n("Hide implicit members"), this);
51  useshortnames_ = new TQCheckBox(i18n("Use short names"), this);
52  useanyclasses_ = new TQCheckBox(i18n("Use \"any\" classes"), this);
53 
54  browseorder_->insertItem(i18n("Allow, Deny"));
55  browseorder_->insertItem(i18n("Deny, Allow"));
56 
57  browseport_->setRange(0, 9999, 1, true);
58  browseport_->setSteps(1, 5);
59  browseinterval_->setRange(0, 10000, 1, true);
60  browseinterval_->setSteps(1, 10);
61  browseinterval_->setSuffix(i18n(" sec"));
62  browsetimeout_->setRange(0, 10000, 1, true);
63  browsetimeout_->setSteps(1, 10);
64  browsetimeout_->setSuffix(i18n(" sec"));
65 
66  TQLabel *l1 = new TQLabel(i18n("Browse port:"), this);
67  TQLabel *l2 = new TQLabel(i18n("Browse interval:"), this);
68  TQLabel *l3 = new TQLabel(i18n("Browse timeout:"), this);
69  TQLabel *l4 = new TQLabel(i18n("Browse addresses:"), this);
70  TQLabel *l5 = new TQLabel(i18n("Browse order:"), this);
71  TQLabel *l6 = new TQLabel(i18n("Browse options:"), this);
72 
73  TQGridLayout *m1 = new TQGridLayout(this, 8, 2, 10, 7);
74  m1->setRowStretch(7, 1);
75  m1->setColStretch(1, 1);
76  TQHBoxLayout *m2 = new TQHBoxLayout(0, 0, 10);
77  m1->addMultiCellLayout(m2, 0, 0, 0, 1);
78  m2->addWidget(browsing_);
79  m2->addWidget(cups_);
80  m2->addWidget(slp_);
81  m2->addStretch(1);
82  m1->addWidget(l1, 1, 0, Qt::AlignRight);
83  m1->addWidget(l2, 2, 0, Qt::AlignRight);
84  m1->addWidget(l3, 3, 0, Qt::AlignRight);
85  m1->addWidget(l4, 4, 0, Qt::AlignRight|Qt::AlignTop);
86  m1->addWidget(l5, 5, 0, Qt::AlignRight);
87  m1->addWidget(l6, 6, 0, Qt::AlignRight|Qt::AlignTop);
88  m1->addWidget(browseport_, 1, 1);
89  m1->addWidget(browseinterval_, 2, 1);
90  m1->addWidget(browsetimeout_, 3, 1);
91  m1->addWidget(browseaddresses_, 4, 1);
92  m1->addWidget(browseorder_, 5, 1);
93  TQGridLayout *m3 = new TQGridLayout(0, 2, 2, 0, 5);
94  m1->addLayout(m3, 6, 1);
95  m3->addWidget(useimplicitclasses_, 0, 0);
96  m3->addWidget(useanyclasses_, 0, 1);
97  m3->addWidget(hideimplicitmembers_, 1, 0);
98  m3->addWidget(useshortnames_, 1, 1);
99 
100  connect(browsing_, TQT_SIGNAL(toggled(bool)), cups_, TQT_SLOT(setEnabled(bool)));
101  connect(browsing_, TQT_SIGNAL(toggled(bool)), slp_, TQT_SLOT(setEnabled(bool)));
102  connect(browsing_, TQT_SIGNAL(toggled(bool)), browseport_, TQT_SLOT(setEnabled(bool)));
103  connect(browsing_, TQT_SIGNAL(toggled(bool)), browseinterval_, TQT_SLOT(setEnabled(bool)));
104  connect(browsing_, TQT_SIGNAL(toggled(bool)), browsetimeout_, TQT_SLOT(setEnabled(bool)));
105  connect(browsing_, TQT_SIGNAL(toggled(bool)), browseaddresses_, TQT_SLOT(setEnabled(bool)));
106  connect(browsing_, TQT_SIGNAL(toggled(bool)), browseorder_, TQT_SLOT(setEnabled(bool)));
107  connect(browsing_, TQT_SIGNAL(toggled(bool)), useimplicitclasses_, TQT_SLOT(setEnabled(bool)));
108  connect(browsing_, TQT_SIGNAL(toggled(bool)), useanyclasses_, TQT_SLOT(setEnabled(bool)));
109  connect(browsing_, TQT_SIGNAL(toggled(bool)), hideimplicitmembers_, TQT_SLOT(setEnabled(bool)));
110  connect(browsing_, TQT_SIGNAL(toggled(bool)), useshortnames_, TQT_SLOT(setEnabled(bool)));
111 
112  connect(browsing_, TQT_SIGNAL(toggled(bool)), l1, TQT_SLOT(setEnabled(bool)));
113  connect(browsing_, TQT_SIGNAL(toggled(bool)), l2, TQT_SLOT(setEnabled(bool)));
114  connect(browsing_, TQT_SIGNAL(toggled(bool)), l3, TQT_SLOT(setEnabled(bool)));
115  connect(browsing_, TQT_SIGNAL(toggled(bool)), l4, TQT_SLOT(setEnabled(bool)));
116  connect(browsing_, TQT_SIGNAL(toggled(bool)), l5, TQT_SLOT(setEnabled(bool)));
117  connect(browsing_, TQT_SIGNAL(toggled(bool)), l6, TQT_SLOT(setEnabled(bool)));
118 
119  connect(browseaddresses_, TQT_SIGNAL(add()), TQT_SLOT(slotAdd()));
120  connect(browseaddresses_, TQT_SIGNAL(edit(int)), TQT_SLOT(slotEdit(int)));
121  connect(browseaddresses_, TQT_SIGNAL(defaultList()), TQT_SLOT(slotDefaultList()));
122  connect(browseinterval_, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(intervalChanged(int)));
123  browsing_->setChecked(true);
124 }
125 
126 bool CupsdBrowsingPage::loadConfig(CupsdConf *conf, TQString&)
127 {
128  conf_ = conf;
129  browsing_->setChecked(conf_->browsing_);
130  cups_->setChecked(conf_->browseprotocols_.findIndex("CUPS") != -1);
131  slp_->setChecked(conf_->browseprotocols_.findIndex("SLP") != -1);
132  browseport_->setValue(conf_->browseport_);
133  browseinterval_->setValue(conf_->browseinterval_);
134  browsetimeout_->setValue(conf_->browsetimeout_);
135  browseaddresses_->insertItems(conf_->browseaddresses_);
136  browseorder_->setCurrentItem(conf_->browseorder_);
137  useimplicitclasses_->setChecked(conf_->useimplicitclasses_);
138  useanyclasses_->setChecked(conf_->useanyclasses_);
139  hideimplicitmembers_->setChecked(conf_->hideimplicitmembers_);
140  useshortnames_->setChecked(conf_->useshortnames_);
141 
142  return true;
143 }
144 
145 bool CupsdBrowsingPage::saveConfig(CupsdConf *conf, TQString&)
146 {
147  conf->browsing_ = browsing_->isChecked();
148  TQStringList l;
149  if (cups_->isChecked()) l << "CUPS";
150  if (slp_->isChecked()) l << "SLP";
151  conf->browseprotocols_ = l;
152  conf->browseport_ = browseport_->value();
153  conf->browseinterval_ = browseinterval_->value();
154  conf->browsetimeout_ = browsetimeout_->value();
155  conf->browseaddresses_ = browseaddresses_->items();
156  conf->browseorder_ = browseorder_->currentItem();
157  conf->useimplicitclasses_ = useimplicitclasses_->isChecked();
158  conf->useanyclasses_ = useanyclasses_->isChecked();
159  conf->hideimplicitmembers_ = hideimplicitmembers_->isChecked();
160  conf->useshortnames_ = useshortnames_->isChecked();
161 
162  return true;
163 }
164 
165 void CupsdBrowsingPage::setInfos(CupsdConf *conf)
166 {
167  TQWhatsThis::add(browsing_, conf->comments_.toolTip("browsing"));
168  TQWhatsThis::add(cups_, conf->comments_.toolTip("browseprotocols"));
169  TQWhatsThis::add(slp_, conf->comments_.toolTip("browseprotocols"));
170  TQWhatsThis::add(browseinterval_, conf->comments_.toolTip("browseinterval"));
171  TQWhatsThis::add(browseport_, conf->comments_.toolTip("browseport"));
172  TQWhatsThis::add(browsetimeout_, conf->comments_.toolTip("browsetimeout"));
173  TQWhatsThis::add(browseaddresses_, conf->comments_.toolTip("browseaddresses"));
174  TQWhatsThis::add(browseorder_, conf->comments_.toolTip("browseorder"));
175  TQWhatsThis::add(useimplicitclasses_, conf->comments_.toolTip("implicitclasses"));
176  TQWhatsThis::add(useanyclasses_, conf->comments_.toolTip("implicitanyclasses"));
177  TQWhatsThis::add(hideimplicitmembers_, conf->comments_.toolTip("hideimplicitmembers"));
178  TQWhatsThis::add(useshortnames_, conf->comments_.toolTip("browseshortnames"));
179 }
180 
181 void CupsdBrowsingPage::slotAdd()
182 {
183  TQString s = BrowseDialog::newAddress(this, conf_);
184  if (!s.isEmpty())
185  browseaddresses_->insertItem(s);
186 }
187 
188 void CupsdBrowsingPage::slotEdit(int index)
189 {
190  TQString s = browseaddresses_->text(index);
191  s = BrowseDialog::editAddress(s, this, conf_);
192  if (!s.isEmpty())
193  browseaddresses_->setText(index, s);
194 }
195 
196 void CupsdBrowsingPage::slotDefaultList()
197 {
198  browseaddresses_->clear();
199  TQStringList l;
200  l << "Send 255.255.255.255";
201  browseaddresses_->insertItems(l);
202 }
203 
204 void CupsdBrowsingPage::intervalChanged(int val)
205 {
206  browsetimeout_->setRange(val, 10000, 1, true);
207  browsetimeout_->setSteps(1, 10);
208 }
209 
210 #include "cupsdbrowsingpage.moc"

tdeprint

Skip menu "tdeprint"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeprint

Skip menu "tdeprint"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeprint by doxygen 1.8.8
This website is maintained by Timothy Pearson.