kmconfigcupsdir.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 "kmconfigcupsdir.h"
00021 
00022 #include <qcheckbox.h>
00023 #include <kurlrequester.h>
00024 #include <klocale.h>
00025 #include <kdialog.h>
00026 #include <kconfig.h>
00027 #include <qgroupbox.h>
00028 #include <qlayout.h>
00029 #include <kcursor.h>
00030 
00031 KMConfigCupsDir::KMConfigCupsDir(QWidget *parent)
00032 : KMConfigPage(parent,"ConfigCupsDir")
00033 {
00034     setPageName(i18n("Folder"));
00035     setPageHeader(i18n("CUPS Folder Settings"));
00036     setPagePixmap("folder");
00037 
00038     QGroupBox *m_dirbox = new QGroupBox(0, Qt::Vertical, i18n("Installation Folder"), this);
00039     m_installdir = new KURLRequester(m_dirbox);
00040     m_installdir->setMode((KFile::Mode)(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly));
00041     m_stddir = new QCheckBox(i18n("Standard installation (/)"), m_dirbox);
00042     m_stddir->setCursor(KCursor::handCursor());
00043 
00044     QVBoxLayout *lay0 = new QVBoxLayout(this, 0, KDialog::spacingHint());
00045     lay0->addWidget(m_dirbox);
00046     lay0->addStretch(1);
00047     QVBoxLayout *lay1 = new QVBoxLayout(m_dirbox->layout(), 10);
00048     lay1->addWidget(m_stddir);
00049     lay1->addWidget(m_installdir);
00050 
00051     connect(m_stddir,SIGNAL(toggled(bool)),m_installdir,SLOT(setDisabled(bool)));
00052     m_stddir->setChecked(true);
00053 }
00054 
00055 void KMConfigCupsDir::loadConfig(KConfig *conf)
00056 {
00057     conf->setGroup("CUPS");
00058     QString dir = conf->readPathEntry("InstallDir");
00059     m_stddir->setChecked(dir.isEmpty());
00060     m_installdir->setURL(dir);
00061 }
00062 
00063 void KMConfigCupsDir::saveConfig(KConfig *conf)
00064 {
00065     conf->setGroup("CUPS");
00066     conf->writePathEntry("InstallDir",(m_stddir->isChecked() ? QString::null : m_installdir->url()));
00067 }
KDE Home | KDE Accessibility Home | Description of Access Keys