kdeprint Library API Documentation

cupsdbrowsingrelaypage.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., 59 Temple Place - Suite 330,
00017  *  Boston, MA 02111-1307, USA.
00018  **/
00019 
00020 #include "cupsdbrowsingrelaypage.h"
00021 
00022 #include <klocale.h>
00023 #include <qlayout.h>
00024 #include <qlabel.h>
00025 #include <qwhatsthis.h>
00026 
00027 #include "cupsdconf.h"
00028 #include "cupsdoption.h"
00029 #include "cupsrelay.h"
00030 
00031 CupsdBrowsingRelayPage::CupsdBrowsingRelayPage(QWidget *parent, const char *name)
00032     : CupsdPage(parent, name)
00033 {
00034     path_.append(i18n("Browsing"));
00035     path_.append(i18n("Relay"));
00036     header_ = i18n("Browsing Relay Configuration");
00037 
00038     QVBoxLayout *main_ = new QVBoxLayout(this, 10, 10);
00039 
00040     for (int i=0;i<1;i++)
00041         opt_[i] = new CupsdOption(this);
00042 
00043     browserelay_ = new CupsRelay(opt_[0]);
00044 
00045     QLabel  *l1 = new QLabel(i18n("Browser packets relay:"), this);
00046 
00047     main_->addWidget(deflabel_, 0, Qt::AlignRight|Qt::AlignVCenter);
00048     main_->addWidget(l1);
00049     main_->addWidget(opt_[0]);
00050     main_->addStretch(1);
00051 }
00052 
00053 CupsdBrowsingRelayPage::~CupsdBrowsingRelayPage()
00054 {
00055 }
00056 
00057 bool CupsdBrowsingRelayPage::loadConfig(CupsdConf *conf, QString&)
00058 {
00059     conf_ = conf;
00060     QStringList::Iterator   it;
00061     if (conf->browserelay_.count() > 0)
00062     {
00063         opt_[0]->setDefault(false);
00064         for (it=conf->browserelay_.begin();it!=conf->browserelay_.end();++it)
00065         {
00066             QString from, to;
00067             from = (*it);
00068             ++it;
00069             to = (*it);
00070             browserelay_->addRelay(from,to);
00071         }
00072     }
00073     return true;
00074 }
00075 
00076 bool CupsdBrowsingRelayPage::saveConfig(CupsdConf *conf, QString&)
00077 {
00078     if (!opt_[0]->isDefault() && browserelay_->count() > 0)
00079     {
00080         conf->browserelay_.clear();
00081         for (int i=0;i<browserelay_->count();i++)
00082         {
00083             conf->browserelay_.append(browserelay_->relayFrom(i));
00084             conf->browserelay_.append(browserelay_->relayTo(i));
00085         }
00086     }
00087     return true;
00088 }
00089 
00090 void CupsdBrowsingRelayPage::setDefaults()
00091 {
00092 }
00093 
00094 void CupsdBrowsingRelayPage::setInfos(CupsdConf *conf)
00095 {
00096         QWhatsThis::add(browserelay_, conf->comments_.toolTip(BROWSERELAY_COMM));
00097 }
KDE Logo
This file is part of the documentation for kdeprint Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed May 5 07:21:38 2004 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003