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

tdeprint

  • tdeprint
  • cups
  • cupsdconf2
addressdialog.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 "addressdialog.h"
21
22#include <tqcombobox.h>
23#include <tqlineedit.h>
24#include <tqlabel.h>
25#include <tqlayout.h>
26
27#include <tdelocale.h>
28
29AddressDialog::AddressDialog(TQWidget *parent, const char *name)
30 : KDialogBase(Swallow, i18n("ACL Address"), Ok|Cancel, Ok, parent, name, true, true)
31{
32 TQWidget *w = new TQWidget(this);
33 type_ = new TQComboBox(w);
34 address_ = new TQLineEdit(w);
35
36 type_->insertItem(i18n("Allow"));
37 type_->insertItem(i18n("Deny"));
38
39 TQLabel *l1 = new TQLabel(i18n("Type:"), w);
40 TQLabel *l2 = new TQLabel(i18n("Address:"), w);
41
42 TQGridLayout *m1 = new TQGridLayout(w, 2, 2, 0, 5);
43 m1->setColStretch(1, 1);
44 m1->addWidget(l1, 0, 0, TQt::AlignRight);
45 m1->addWidget(l2, 1, 0, TQt::AlignRight);
46 m1->addWidget(type_, 0, 1);
47 m1->addWidget(address_, 1, 1);
48
49 setMainWidget(w);
50 resize(300, 100);
51}
52
53TQString AddressDialog::addressString()
54{
55 TQString s;
56 if (type_->currentItem() == 0)
57 s.append("Allow ");
58 else
59 s.append("Deny ");
60 if (address_->text().isEmpty())
61 s.append("All");
62 else
63 s.append(address_->text());
64 return s;
65}
66
67TQString AddressDialog::newAddress(TQWidget *parent)
68{
69 AddressDialog dlg(parent);
70 if (dlg.exec())
71 return dlg.addressString();
72 else
73 return TQString::null;
74}
75
76TQString AddressDialog::editAddress(const TQString& addr, TQWidget *parent)
77{
78 AddressDialog dlg(parent);
79 int p = addr.find(' ');
80 if (p != -1)
81 {
82 dlg.type_->setCurrentItem(addr.left(p).lower() == "deny" ? 1 : 0);
83 dlg.address_->setText(addr.mid(p+1));
84 }
85 if (dlg.exec())
86 return dlg.addressString();
87 else
88 return TQString::null;
89}

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.