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

tdeprint

  • tdeprint
  • cups
  • cupsdconf2
cupsdserverpage.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 "cupsdserverpage.h"
21#include "cupsdconf.h"
22
23#include <tqlineedit.h>
24#include <tqlabel.h>
25#include <tqcheckbox.h>
26#include <tqcombobox.h>
27#include <tqlayout.h>
28#include <tqwhatsthis.h>
29
30#include <tdelocale.h>
31
32int findComboItem(TQComboBox *cb, const TQString& str)
33{
34 for (int i=0; i<cb->count(); i++)
35 if (cb->text(i) == str)
36 return i;
37 return (-1);
38}
39
40CupsdServerPage::CupsdServerPage(TQWidget *parent, const char *name)
41 : CupsdPage(parent, name)
42{
43 setPageLabel(i18n("Server"));
44 setHeader(i18n("Server Settings"));
45 setPixmap("gear");
46
47 servername_ = new TQLineEdit(this);
48 serveradmin_ = new TQLineEdit(this);
49 otherclassname_ = new TQLineEdit(this);
50 language_ = new TQLineEdit(this);
51 printcap_ = new TQLineEdit(this);
52 classification_ = new TQComboBox(this);
53 charset_ = new TQComboBox(this);
54 printcapformat_ = new TQComboBox(this);
55 classoverride_ = new TQCheckBox(i18n("Allow overrides"), this);
56
57 classification_->insertItem(i18n("None"));
58 classification_->insertItem(i18n("Classified"));
59 classification_->insertItem(i18n("Confidential"));
60 classification_->insertItem(i18n("Secret"));
61 classification_->insertItem(i18n("Top Secret"));
62 classification_->insertItem(i18n("Unclassified"));
63 classification_->insertItem(i18n("Other"));
64
65 charset_->insertItem("UTF-8");
66 charset_->insertItem("ISO-8859-1");
67 charset_->insertItem("ISO-8859-2");
68 charset_->insertItem("ISO-8859-3");
69 charset_->insertItem("ISO-8859-4");
70 charset_->insertItem("ISO-8859-5");
71 charset_->insertItem("ISO-8859-6");
72 charset_->insertItem("ISO-8859-7");
73 charset_->insertItem("ISO-8859-8");
74 charset_->insertItem("ISO-8859-9");
75 charset_->insertItem("ISO-8859-10");
76 charset_->insertItem("ISO-8859-13");
77 charset_->insertItem("ISO-8859-14");
78 charset_->insertItem("ISO-8859-15");
79
80 printcapformat_->insertItem("BSD");
81 printcapformat_->insertItem("SOLARIS");
82
83 TQLabel *l1 = new TQLabel(i18n("Server name:"), this);
84 TQLabel *l2 = new TQLabel(i18n("Server administrator:"), this);
85 TQLabel *l3 = new TQLabel(i18n("Classification:"), this);
86 TQLabel *l4 = new TQLabel(i18n("Default character set:"), this);
87 TQLabel *l5 = new TQLabel(i18n("Default language:"), this);
88 TQLabel *l6 = new TQLabel(i18n("Printcap file:"), this);
89 TQLabel *l7 = new TQLabel(i18n("Printcap format:"), this);
90
91 connect(classification_, TQ_SIGNAL(activated(int)), TQ_SLOT(classChanged(int)));
92 classification_->setCurrentItem(0);
93 charset_->setCurrentItem(0);
94 printcapformat_->setCurrentItem(0);
95 classChanged(0);
96
97 TQGridLayout *m1 = new TQGridLayout(this, 9, 2, 10, 7);
98 m1->setRowStretch(8, 1);
99 m1->setColStretch(1, 1);
100 m1->addWidget(l1, 0, 0, TQt::AlignRight);
101 m1->addWidget(l2, 1, 0, TQt::AlignRight);
102 m1->addWidget(l3, 2, 0, TQt::AlignRight);
103 m1->addWidget(l4, 4, 0, TQt::AlignRight);
104 m1->addWidget(l5, 5, 0, TQt::AlignRight);
105 m1->addWidget(l6, 6, 0, TQt::AlignRight);
106 m1->addWidget(l7, 7, 0, TQt::AlignRight);
107 m1->addWidget(servername_, 0, 1);
108 m1->addWidget(serveradmin_, 1, 1);
109 m1->addWidget(charset_, 4, 1);
110 m1->addWidget(language_, 5, 1);
111 m1->addWidget(printcap_, 6, 1);
112 m1->addWidget(printcapformat_, 7, 1);
113 TQHBoxLayout *m2 = new TQHBoxLayout(0, 0, 5);
114 m1->addLayout(m2, 2, 1);
115 m2->addWidget(classification_);
116 m2->addWidget(otherclassname_);
117 TQWidget *w = new TQWidget(this);
118 w->setFixedWidth(20);
119 TQHBoxLayout *m3 = new TQHBoxLayout(0, 0, 0);
120 m1->addLayout(m3, 3, 1);
121 m3->addWidget(w);
122 m3->addWidget(classoverride_);
123}
124
125bool CupsdServerPage::loadConfig(CupsdConf *conf, TQString&)
126{
127 conf_ = conf;
128 servername_->setText(conf_->servername_);
129 serveradmin_->setText(conf_->serveradmin_);
130 classification_->setCurrentItem(conf_->classification_);
131 classChanged(conf_->classification_);
132 if (conf->classification_ != CLASS_NONE)
133 classoverride_->setChecked(conf_->classoverride_);
134 if (conf->classification_ == CLASS_OTHER)
135 otherclassname_->setText(conf_->otherclassname_);
136 int index = findComboItem(charset_, conf_->charset_.upper());
137 if (index != -1)
138 charset_->setCurrentItem(index);
139 language_->setText(conf_->language_);
140 printcap_->setText(conf_->printcap_);
141 printcapformat_->setCurrentItem(conf_->printcapformat_);
142
143 return true;
144}
145
146bool CupsdServerPage::saveConfig(CupsdConf *conf, TQString&)
147{
148 conf->servername_ = servername_->text();
149 conf->serveradmin_ = serveradmin_->text();
150 conf->classification_ = classification_->currentItem();
151 if (conf->classification_ != CLASS_NONE)
152 conf->classoverride_ = classoverride_->isChecked();
153 if (conf->classification_ == CLASS_OTHER)
154 conf->otherclassname_ = otherclassname_->text();
155 conf->charset_ = charset_->currentText();
156 conf->language_ = language_->text();
157 conf->printcap_ = printcap_->text();
158 conf->printcapformat_ = printcapformat_->currentItem();
159
160 return true;
161}
162
163void CupsdServerPage::setInfos(CupsdConf *conf)
164{
165 TQWhatsThis::add(servername_, conf->comments_.toolTip("servername"));
166 TQWhatsThis::add(serveradmin_, conf->comments_.toolTip("serveradmin"));
167 TQWhatsThis::add(classification_, conf->comments_.toolTip("classification"));
168 TQWhatsThis::add(classoverride_, conf->comments_.toolTip("classifyoverride"));
169 TQWhatsThis::add(charset_, conf->comments_.toolTip("defaultcharset"));
170 TQWhatsThis::add(language_, conf->comments_.toolTip("defaultlanguage"));
171 TQWhatsThis::add(printcap_, conf->comments_.toolTip("printcap"));
172 TQWhatsThis::add(printcapformat_, conf->comments_.toolTip("printcapformat"));
173}
174
175void CupsdServerPage::classChanged(int index)
176{
177 classoverride_->setEnabled(index != 0);
178 otherclassname_->setEnabled(index == CLASS_OTHER);
179}
180
181#include "cupsdserverpage.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.4
This website is maintained by Timothy Pearson.