kdeprint Library API Documentation

cupsdbrowsinggeneralpage.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 "cupsdbrowsinggeneralpage.h" 00021 00022 #include <klocale.h> 00023 #include <qlayout.h> 00024 #include <qcheckbox.h> 00025 #include <qlabel.h> 00026 #include <qwhatsthis.h> 00027 00028 #include <kseparator.h> 00029 00030 #include "cupsdconf.h" 00031 #include "cupsdoption.h" 00032 00033 CupsdBrowsingGeneralPage::CupsdBrowsingGeneralPage(QWidget *parent, const char *name) 00034 : CupsdPage(parent, name) 00035 { 00036 path_.append(i18n("Browsing")); 00037 //path_.append(i18n("General")); 00038 header_ = i18n("Browsing General Configuration"); 00039 00040 for (int i=0;i<5;i++) 00041 opt_[i] = new CupsdOption(this); 00042 00043 browsing_ = new QCheckBox(i18n("Enable browsing"), opt_[0]); 00044 browseshortnames_ = new QCheckBox(i18n("Use short names when possible"), opt_[1]); 00045 00046 KSeparator *sep = new KSeparator(KSeparator::HLine, this); 00047 sep->setFixedHeight(25); 00048 00049 implicitclasses_ = new QCheckBox(i18n("Use implicit classes"), opt_[2]); 00050 implicitanyclasses_ = new QCheckBox(i18n("Create \"Any\" implicit classes when needed"), opt_[3]); 00051 hideimplicitmembers_ = new QCheckBox(i18n("Hide members of implicit classes"), opt_[4]); 00052 00053 QVBoxLayout *main_ = new QVBoxLayout(this, 10, 10); 00054 main_->addWidget(deflabel_, 0, Qt::AlignRight|Qt::AlignVCenter); 00055 main_->addWidget(opt_[0]); 00056 main_->addWidget(opt_[1]); 00057 main_->addWidget(sep); 00058 main_->addWidget(opt_[2]); 00059 main_->addWidget(opt_[3]); 00060 main_->addWidget(opt_[4]); 00061 main_->addStretch(1); 00062 } 00063 00064 CupsdBrowsingGeneralPage::~CupsdBrowsingGeneralPage() 00065 { 00066 } 00067 00068 bool CupsdBrowsingGeneralPage::loadConfig(CupsdConf *conf, QString&) 00069 { 00070 conf_ = conf; 00071 if (conf->browsing_ != -1) 00072 { 00073 opt_[0]->setDefault(0); 00074 browsing_->setChecked(conf->browsing_ == 1); 00075 } 00076 if (conf->browseshortnames_ != -1) 00077 { 00078 opt_[1]->setDefault(0); 00079 browseshortnames_->setChecked(conf->browseshortnames_ == 1); 00080 } 00081 if (conf->implicitclasses_ != -1) 00082 { 00083 opt_[2]->setDefault(0); 00084 implicitclasses_->setChecked(conf->implicitclasses_ == 1); 00085 } 00086 if (conf->implicitanyclasses_ != -1) 00087 { 00088 opt_[3]->setDefault(0); 00089 implicitanyclasses_->setChecked(conf->implicitanyclasses_ == 1); 00090 } 00091 if (conf->hideimplicitmembers_ != -1) 00092 { 00093 opt_[4]->setDefault(0); 00094 hideimplicitmembers_->setChecked(conf->hideimplicitmembers_ == 1); 00095 } 00096 return true; 00097 } 00098 00099 bool CupsdBrowsingGeneralPage::saveConfig(CupsdConf *conf, QString&) 00100 { 00101 if (!opt_[0]->isDefault()) conf->browsing_ = (browsing_->isChecked() ? 1 : 0); 00102 if (!opt_[1]->isDefault()) conf->browseshortnames_ = (browseshortnames_->isChecked() ? 1 : 0); 00103 if (!opt_[2]->isDefault()) conf->implicitclasses_ = (implicitclasses_->isChecked() ? 1 : 0); 00104 if (!opt_[3]->isDefault()) conf->implicitanyclasses_ = (implicitanyclasses_->isChecked() ? 1 : 0); 00105 if (!opt_[4]->isDefault()) conf->hideimplicitmembers_ = (hideimplicitmembers_->isChecked() ? 1 : 0); 00106 return true; 00107 } 00108 00109 void CupsdBrowsingGeneralPage::setDefaults() 00110 { 00111 browsing_->setChecked(true); 00112 browseshortnames_->setChecked(true); 00113 implicitclasses_->setChecked(true); 00114 implicitanyclasses_->setChecked(false); 00115 hideimplicitmembers_->setChecked(true); 00116 } 00117 00118 void CupsdBrowsingGeneralPage::setInfos(CupsdConf *conf) 00119 { 00120 QWhatsThis::add(browsing_, conf->comments_.toolTip(BROWSING_COMM)); 00121 QWhatsThis::add(browseshortnames_, conf->comments_.toolTip(BROWSESHORTNAMES_COMM)); 00122 QWhatsThis::add(implicitclasses_, conf->comments_.toolTip(IMPLICITCLASSES_COMM)); 00123 QWhatsThis::add(implicitanyclasses_, conf->comments_.toolTip(IMPLICITANYCLASSES_COMM)); 00124 QWhatsThis::add(hideimplicitmembers_, conf->comments_.toolTip(HIDEIMPLICITMEMBERS_COMM)); 00125 }
KDE Logo
This file is part of the documentation for kdeprint Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 14 00:34:35 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003