korganizer Library API Documentation

datenums/configdialog.cpp

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 */
00019 
00020 #include <qlayout.h>
00021 #include <qlabel.h>
00022 #include <qvbuttongroup.h>
00023 #include <qradiobutton.h>
00024 
00025 #include <klocale.h>
00026 #include <kmessagebox.h>
00027 #include <kapplication.h>
00028 #include <kglobal.h>
00029 #include <kconfig.h>
00030 #include <kstandarddirs.h>
00031 #include <ksimpleconfig.h>
00032 
00033 #include "configdialog.h"
00034 #include "configdialog.moc"
00035 
00036 ConfigDialog::ConfigDialog(QWidget *parent)
00037   : KDialogBase(Plain,i18n("Configure Day Numbers"),Ok|Cancel,Ok,parent)
00038 {
00039   QFrame *topFrame = plainPage();
00040   QVBoxLayout *topLayout = new QVBoxLayout(topFrame,0,spacingHint());
00041 
00042 //  QLabel *label = new QLabel(i18n("Show date numbers:"),topFrame);
00043 //  topLayout->addWidget(label);
00044   mDayNumGroup = new QVButtonGroup( i18n("Show Date Number"), topFrame );
00045     topLayout->addWidget( mDayNumGroup );
00046 
00047     new QRadioButton( i18n("Show day number"), mDayNumGroup );
00048     new QRadioButton( i18n("Show days to end of year"), mDayNumGroup );
00049     new QRadioButton( i18n("Show both"), mDayNumGroup );
00050 
00051   load();
00052 }
00053 
00054 ConfigDialog::~ConfigDialog()
00055 {
00056 }
00057 
00058 void ConfigDialog::load()
00059 {
00060   KConfig config( locateLocal( "config", "korganizerrc" ));
00061   config.setGroup("Calendar/DateNum Plugin");
00062     int datenum = config.readNumEntry( "ShowDayNumbers", 0 );
00063   mDayNumGroup->setButton( datenum );
00064 }
00065 
00066 void ConfigDialog::save()
00067 {
00068   KConfig config( locateLocal( "config", "korganizerrc" ));
00069 
00070   config.setGroup("Calendar/DateNum Plugin");
00071   config.writeEntry("ShowDayNumbers", mDayNumGroup->selectedId() );
00072   config.sync();
00073 }
00074 
00075 void ConfigDialog::slotOk()
00076 {
00077   save();
00078 
00079   accept();
00080 }
KDE Logo
This file is part of the documentation for korganizer Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 17 09:56:22 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003