kmconfiglpr.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 "kmconfiglpr.h" 00021 #include "lprsettings.h" 00022 00023 #include <qcombobox.h> 00024 #include <qlabel.h> 00025 #include <qlayout.h> 00026 #include <qgroupbox.h> 00027 #include <klocale.h> 00028 #include <kconfig.h> 00029 00030 KMConfigLpr::KMConfigLpr(QWidget *parent, const char *name) 00031 : KMConfigPage(parent, name) 00032 { 00033 setPageName(i18n("Spooler")); 00034 setPageHeader(i18n("Spooler Settings")); 00035 setPagePixmap("gear"); 00036 00037 QGroupBox *m_modebox = new QGroupBox(1, Qt::Vertical, i18n("Spooler"), this); 00038 00039 m_mode = new QComboBox(m_modebox); 00040 m_mode->insertItem("LPR (BSD compatible)"); 00041 m_mode->insertItem("LPRng"); 00042 00043 QVBoxLayout *l0 = new QVBoxLayout(this, 5, 10); 00044 l0->addWidget(m_modebox); 00045 l0->addStretch(1); 00046 } 00047 00048 void KMConfigLpr::loadConfig(KConfig*) 00049 { 00050 m_mode->setCurrentItem(LprSettings::self()->mode()); 00051 } 00052 00053 void KMConfigLpr::saveConfig(KConfig *conf) 00054 { 00055 LprSettings::self()->setMode((LprSettings::Mode)(m_mode->currentItem())); 00056 00057 QString modestr; 00058 switch (m_mode->currentItem()) 00059 { 00060 default: 00061 case 0: modestr = "LPR"; break; 00062 case 1: modestr = "LPRng"; break; 00063 } 00064 conf->setGroup("LPR"); 00065 conf->writeEntry("Mode", modestr); 00066 }