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

tdeprint

  • tdeprint
  • cups
  • cupsdconf2
cupsdnetworkpage.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 "cupsdnetworkpage.h"
21 #include "cupsdconf.h"
22 #include "editlist.h"
23 #include "portdialog.h"
24 #include "sizewidget.h"
25 
26 #include <tqlabel.h>
27 #include <tqcheckbox.h>
28 #include <tqcombobox.h>
29 #include <tqlayout.h>
30 #include <tqwhatsthis.h>
31 
32 #include <tdelocale.h>
33 #include <knuminput.h>
34 
35 CupsdNetworkPage::CupsdNetworkPage(TQWidget *parent, const char *name)
36  : CupsdPage(parent, name)
37 {
38  setPageLabel(i18n("Network"));
39  setHeader(i18n("Network Settings"));
40  setPixmap("network");
41 
42  keepalive_ = new TQCheckBox(i18n("Keep alive"), this);
43  keepalivetimeout_ = new KIntNumInput(this);
44  maxclients_ = new KIntNumInput(this);
45  maxrequestsize_ = new SizeWidget(this);
46  clienttimeout_ = new KIntNumInput(this);
47  hostnamelookup_ = new TQComboBox(this);
48  listen_ = new EditList(this);
49 
50  keepalivetimeout_->setRange(0, 10000, 1, true);
51  keepalivetimeout_->setSteps(1, 10);
52  keepalivetimeout_->setSpecialValueText(i18n("Unlimited"));
53  keepalivetimeout_->setSuffix(i18n(" sec"));
54 
55  maxclients_->setRange(1, 1000, 1, true);
56  maxclients_->setSteps(1, 10);
57 
58  clienttimeout_->setRange(0, 10000, 1, true);
59  clienttimeout_->setSteps(1, 10);
60  clienttimeout_->setSpecialValueText(i18n("Unlimited"));
61  clienttimeout_->setSuffix(i18n(" sec"));
62 
63  hostnamelookup_->insertItem(i18n("Off"));
64  hostnamelookup_->insertItem(i18n("On"));
65  hostnamelookup_->insertItem(i18n("Double"));
66 
67  TQLabel *l1 = new TQLabel(i18n("Hostname lookups:"), this);
68  TQLabel *l2 = new TQLabel(i18n("Keep-alive timeout:"), this);
69  TQLabel *l3 = new TQLabel(i18n("Max clients:"), this);
70  TQLabel *l4 = new TQLabel(i18n("Max request size:"), this);
71  TQLabel *l5 = new TQLabel(i18n("Client timeout:"), this);
72  TQLabel *l6 = new TQLabel(i18n("Listen to:"), this);
73 
74  TQGridLayout *m1 = new TQGridLayout(this, 8, 2, 10, 7);
75  m1->setRowStretch(7, 1);
76  m1->setColStretch(1, 1);
77  m1->addWidget(l1, 0, 0, TQt::AlignRight);
78  m1->addWidget(l2, 2, 0, TQt::AlignRight);
79  m1->addWidget(l3, 3, 0, TQt::AlignRight);
80  m1->addWidget(l4, 4, 0, TQt::AlignRight);
81  m1->addWidget(l5, 5, 0, TQt::AlignRight);
82  m1->addWidget(l6, 6, 0, TQt::AlignTop|TQt::AlignRight);
83  m1->addWidget(keepalive_, 1, 1);
84  m1->addWidget(hostnamelookup_, 0, 1);
85  m1->addWidget(keepalivetimeout_, 2, 1);
86  m1->addWidget(maxclients_, 3, 1);
87  m1->addWidget(maxrequestsize_, 4, 1);
88  m1->addWidget(clienttimeout_, 5, 1);
89  m1->addWidget(listen_, 6, 1);
90 
91  connect(listen_, TQ_SIGNAL(add()), TQ_SLOT(slotAdd()));
92  connect(listen_, TQ_SIGNAL(edit(int)), TQ_SLOT(slotEdit(int)));
93  connect(listen_, TQ_SIGNAL(defaultList()), TQ_SLOT(slotDefaultList()));
94  connect(keepalive_, TQ_SIGNAL(toggled(bool)), keepalivetimeout_, TQ_SLOT(setEnabled(bool)));
95  keepalive_->setChecked(true);
96 }
97 
98 bool CupsdNetworkPage::loadConfig(CupsdConf *conf, TQString&)
99 {
100  conf_ = conf;
101  hostnamelookup_->setCurrentItem(conf_->hostnamelookup_);
102  keepalive_->setChecked(conf_->keepalive_);
103  keepalivetimeout_->setValue(conf_->keepalivetimeout_);
104  maxclients_->setValue(conf_->maxclients_);
105  maxrequestsize_->setSizeString(conf_->maxrequestsize_);
106  clienttimeout_->setValue(conf_->clienttimeout_);
107  listen_->insertItems(conf_->listenaddresses_);
108 
109  return true;
110 }
111 
112 bool CupsdNetworkPage::saveConfig(CupsdConf *conf, TQString&)
113 {
114  conf->hostnamelookup_ = hostnamelookup_->currentItem();
115  conf->keepalive_ = keepalive_->isChecked();
116  conf->keepalivetimeout_ = keepalivetimeout_->value();
117  conf->maxclients_ = maxclients_->value();
118  conf->maxrequestsize_ = maxrequestsize_->sizeString();
119  conf->clienttimeout_ = clienttimeout_->value();
120  conf->listenaddresses_ = listen_->items();
121 
122  return true;
123 }
124 
125 void CupsdNetworkPage::setInfos(CupsdConf *conf)
126 {
127  TQWhatsThis::add(hostnamelookup_, conf->comments_.toolTip("hostnamelookups"));
128  TQWhatsThis::add(keepalive_, conf->comments_.toolTip("keepalive"));
129  TQWhatsThis::add(keepalivetimeout_, conf->comments_.toolTip("keepalivetimeout"));
130  TQWhatsThis::add(maxclients_, conf->comments_.toolTip("maxclients"));
131  TQWhatsThis::add(maxrequestsize_, conf->comments_.toolTip("maxrequestsize"));
132  TQWhatsThis::add(clienttimeout_, conf->comments_.toolTip("timeout"));
133  TQWhatsThis::add(listen_, conf->comments_.toolTip("listen"));
134 }
135 
136 void CupsdNetworkPage::slotAdd()
137 {
138  TQString s = PortDialog::newListen(this, conf_);
139  if (!s.isEmpty())
140  listen_->insertItem(s);
141 }
142 
143 void CupsdNetworkPage::slotEdit(int index)
144 {
145  TQString s = listen_->text(index);
146  s = PortDialog::editListen(s, this, conf_);
147  if (!s.isEmpty())
148  listen_->setText(index, s);
149 }
150 
151 void CupsdNetworkPage::slotDefaultList()
152 {
153  listen_->clear();
154  TQStringList l;
155  l << "Listen *:631";
156  listen_->insertItems(l);
157 }
158 
159 #include "cupsdnetworkpage.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
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeprint by doxygen 1.9.1
This website is maintained by Timothy Pearson.