datenums/configdialog.cpp
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19*/
20
21#include <tqlayout.h>
22#include <tqlabel.h>
23#include <tqvbuttongroup.h>
24#include <tqradiobutton.h>
25
26#include <tdelocale.h>
27#include <tdemessagebox.h>
28#include <tdeapplication.h>
29#include <tdeglobal.h>
30#include <tdeconfig.h>
31#include <tdestandarddirs.h>
32#include <ksimpleconfig.h>
33
34#include "configdialog.h"
35#include "configdialog.moc"
36
37ConfigDialog::ConfigDialog(TQWidget *parent)
38 : KDialogBase(Plain,i18n("Configure Day Numbers"),Ok|Cancel,Ok,parent)
39{
40 TQFrame *topFrame = plainPage();
41 TQVBoxLayout *topLayout = new TQVBoxLayout(topFrame,0,spacingHint());
42
43// TQLabel *label = new TQLabel(i18n("Show date numbers:"),topFrame);
44// topLayout->addWidget(label);
45 mDayNumGroup = new TQVButtonGroup( i18n("Show Date Number"), topFrame );
46 topLayout->addWidget( mDayNumGroup );
47
48 new TQRadioButton( i18n("Show day number"), mDayNumGroup );
49 new TQRadioButton( i18n("Show days to end of year"), mDayNumGroup );
50 new TQRadioButton( i18n("Show both"), mDayNumGroup );
51
52 load();
53}
54
55ConfigDialog::~ConfigDialog()
56{
57}
58
59void ConfigDialog::load()
60{
61 TDEConfig config( "korganizerrc", true, false); // Open read-only, no kdeglobals
62 config.setGroup("Calendar/DateNum Plugin");
63 int datenum = config.readNumEntry( "ShowDayNumbers", 0 );
64 mDayNumGroup->setButton( datenum );
65}
66
67void ConfigDialog::save()
68{
69 TDEConfig config( "korganizerrc", false, false); // Open read-write, no kdeglobals
70 config.setGroup("Calendar/DateNum Plugin");
71 config.writeEntry("ShowDayNumbers", mDayNumGroup->selectedId() );
72 config.sync();
73}
74
75void ConfigDialog::slotOk()
76{
77 save();
78
79 accept();
80}