korganizer

configdialog.cpp

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00004         Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include <qlayout.h>
00022 #include <qlabel.h>
00023 #include <qvbuttongroup.h>
00024 #include <qradiobutton.h>
00025 
00026 #include <klocale.h>
00027 #include <kmessagebox.h>
00028 #include <kapplication.h>
00029 #include <kglobal.h>
00030 #include <kconfig.h>
00031 #include <kstandarddirs.h>
00032 #include <ksimpleconfig.h>
00033 
00034 #include "configdialog.h"
00035 #include "configdialog.moc"
00036 
00037 ConfigDialog::ConfigDialog(QWidget *parent)
00038   : KDialogBase(Plain,i18n("Configure Day Numbers"),Ok|Cancel,Ok,parent)
00039 {
00040   QFrame *topFrame = plainPage();
00041   QVBoxLayout *topLayout = new QVBoxLayout(topFrame,0,spacingHint());
00042 
00043 //  QLabel *label = new QLabel(i18n("Show date numbers:"),topFrame);
00044 //  topLayout->addWidget(label);
00045   mDayNumGroup = new QVButtonGroup( i18n("Show Date Number"), topFrame );
00046     topLayout->addWidget( mDayNumGroup );
00047 
00048     new QRadioButton( i18n("Show day number"), mDayNumGroup );
00049     new QRadioButton( i18n("Show days to end of year"), mDayNumGroup );
00050     new QRadioButton( i18n("Show both"), mDayNumGroup );
00051 
00052   load();
00053 }
00054 
00055 ConfigDialog::~ConfigDialog()
00056 {
00057 }
00058 
00059 void ConfigDialog::load()
00060 {
00061   KConfig config( "korganizerrc", true, false); // Open read-only, no kdeglobals
00062   config.setGroup("Calendar/DateNum Plugin");
00063     int datenum = config.readNumEntry( "ShowDayNumbers", 0 );
00064   mDayNumGroup->setButton( datenum );
00065 }
00066 
00067 void ConfigDialog::save()
00068 {
00069   KConfig config( "korganizerrc", false, false); // Open read-write, no kdeglobals
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 Home | KDE Accessibility Home | Description of Access Keys