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

tdeprint

  • tdeprint
  • cups
  • cupsdconf2
portdialog.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 "portdialog.h"
21#include "cupsdconf.h"
22
23#include <tqlineedit.h>
24#include <tqspinbox.h>
25#include <tqcheckbox.h>
26#include <tqpushbutton.h>
27#include <tqlabel.h>
28#include <tqlayout.h>
29#include <tqwhatsthis.h>
30
31#include <tdelocale.h>
32
33PortDialog::PortDialog(TQWidget *parent, const char *name)
34 : KDialogBase(parent, name, true, TQString::null, Ok|Cancel, Ok, true)
35{
36 TQWidget *dummy = new TQWidget(this);
37 setMainWidget(dummy);
38 address_ = new TQLineEdit(dummy);
39 port_ = new TQSpinBox(0, 9999, 1, dummy);
40 port_->setValue(631);
41 usessl_ = new TQCheckBox(i18n("Use SSL encryption"), dummy);
42
43 TQLabel *l1 = new TQLabel(i18n("Address:"), dummy);
44 TQLabel *l2 = new TQLabel(i18n("Port:"), dummy);
45
46 TQVBoxLayout *m1 = new TQVBoxLayout(dummy, 0, 10);
47 TQGridLayout *m2 = new TQGridLayout(0, 3, 2, 0, 5);
48 m1->addLayout(m2);
49 m2->addWidget(l1, 0, 0, TQt::AlignRight);
50 m2->addWidget(l2, 1, 0, TQt::AlignRight);
51 m2->addMultiCellWidget(usessl_, 2, 2, 0, 1);
52 m2->addWidget(address_, 0, 1);
53 m2->addWidget(port_, 1, 1);
54
55 setCaption(i18n("Listen To"));
56 resize(250, 100);
57}
58
59TQString PortDialog::listenString()
60{
61 TQString s;
62 if (usessl_->isChecked())
63 s.append("SSLListen ");
64 else
65 s.append("Listen ");
66 if (!address_->text().isEmpty())
67 s.append(address_->text());
68 else
69 s.append("*");
70 s.append(":").append(port_->text());
71 return s;
72}
73
74void PortDialog::setInfos(CupsdConf *conf)
75{
76 TQWhatsThis::add(address_, conf->comments_.toolTip("address"));
77 TQWhatsThis::add(port_, conf->comments_.toolTip("port"));
78 TQWhatsThis::add(usessl_, conf->comments_.toolTip("usessl"));
79}
80
81TQString PortDialog::newListen(TQWidget *parent, CupsdConf *conf)
82{
83 PortDialog dlg(parent);
84 dlg.setInfos(conf);
85 if (dlg.exec())
86 {
87 return dlg.listenString();
88 }
89 return TQString::null;
90}
91
92TQString PortDialog::editListen(const TQString& s, TQWidget *parent, CupsdConf *conf)
93{
94 PortDialog dlg(parent);
95 dlg.setInfos(conf);
96 int p = s.find(' ');
97 if (p != -1)
98 {
99 dlg.usessl_->setChecked(s.left(p).startsWith("SSL"));
100 TQString addr = s.mid(p+1).stripWhiteSpace();
101 int p1 = addr.find(':');
102 if (p1 == -1)
103 {
104 dlg.address_->setText(addr);
105 dlg.port_->setValue(631);
106 }
107 else
108 {
109 dlg.address_->setText(addr.left(p1));
110 dlg.port_->setValue(addr.mid(p1+1).toInt());
111 }
112 }
113 if (dlg.exec())
114 {
115 return dlg.listenString();
116 }
117 return TQString::null;
118}

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.