• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • @topname@
  • Sitemap
  • Contact Us
 

kdeprint

addressdialog.cpp

00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Library General Public
00007  *  License version 2 as published by the Free Software Foundation.
00008  *
00009  *  This library is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  *  Library General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Library General Public License
00015  *  along with this library; see the file COPYING.LIB.  If not, write to
00016  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  *  Boston, MA 02110-1301, USA.
00018  **/
00019 
00020 #include "addressdialog.h"
00021 
00022 #include <qcombobox.h>
00023 #include <qlineedit.h>
00024 #include <qlabel.h>
00025 #include <qlayout.h>
00026 
00027 #include <klocale.h>
00028 
00029 AddressDialog::AddressDialog(QWidget *parent, const char *name)
00030     : KDialogBase(Swallow, i18n("ACL Address"), Ok|Cancel, Ok, parent, name, true, true)
00031 {
00032     QWidget *w = new QWidget(this);
00033     type_ = new QComboBox(w);
00034     address_ = new QLineEdit(w);
00035 
00036     type_->insertItem(i18n("Allow"));
00037     type_->insertItem(i18n("Deny"));
00038 
00039     QLabel  *l1 = new QLabel(i18n("Type:"), w);
00040     QLabel  *l2 = new QLabel(i18n("Address:"), w);
00041 
00042     QGridLayout *m1 = new QGridLayout(w, 2, 2, 0, 5);
00043     m1->setColStretch(1, 1);
00044     m1->addWidget(l1, 0, 0, Qt::AlignRight);
00045     m1->addWidget(l2, 1, 0, Qt::AlignRight);
00046     m1->addWidget(type_, 0, 1);
00047     m1->addWidget(address_, 1, 1);
00048 
00049     setMainWidget(w);
00050     resize(300, 100);
00051 }
00052 
00053 QString AddressDialog::addressString()
00054 {
00055     QString s;
00056     if (type_->currentItem() == 0)
00057         s.append("Allow ");
00058     else
00059         s.append("Deny ");
00060     if (address_->text().isEmpty())
00061         s.append("All");
00062     else
00063         s.append(address_->text());
00064     return s;
00065 }
00066 
00067 QString AddressDialog::newAddress(QWidget *parent)
00068 {
00069     AddressDialog   dlg(parent);
00070     if (dlg.exec())
00071         return dlg.addressString();
00072     else
00073         return QString::null;
00074 }
00075 
00076 QString AddressDialog::editAddress(const QString& addr, QWidget *parent)
00077 {
00078     AddressDialog   dlg(parent);
00079     int p = addr.find(' ');
00080     if (p != -1)
00081     {
00082         dlg.type_->setCurrentItem(addr.left(p).lower() == "deny" ? 1 : 0);
00083         dlg.address_->setText(addr.mid(p+1));
00084     }
00085     if (dlg.exec())
00086         return dlg.addressString();
00087     else
00088         return QString::null;
00089 }

kdeprint

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

@topname@

Skip menu "@topname@"
  •     kdnssd-avahi
  • 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
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for @topname@ by doxygen 1.5.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal