cupsdbrowsingrelaypage.cpp
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
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 }
 
This file is part of the documentation for kdeprint Library Version 3.2.0.