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

kdeprint

  • kdeprint
  • cups
  • cupsdconf2
addressdialog.cpp
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (c) 2001 Michael Goffioul <kdeprint@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 <klocale.h>
28 
29 AddressDialog::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, Qt::AlignRight);
45  m1->addWidget(l2, 1, 0, Qt::AlignRight);
46  m1->addWidget(type_, 0, 1);
47  m1->addWidget(address_, 1, 1);
48 
49  setMainWidget(w);
50  resize(300, 100);
51 }
52 
53 TQString 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 
67 TQString 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 
76 TQString 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 }

kdeprint

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

kdeprint

Skip menu "kdeprint"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeprint by doxygen 1.8.13
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |