hebrew/configdialog.cpp
1 /*
2  This file is part of KOrganizer.
3  Copyright (c) 2003 Jonathan Singer <jsinger@leeta.net>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19 #include "configdialog.h"
20 #include "configdialog.moc"
21 #include <tdelocale.h>
22 #include <tqlayout.h>
23 #include <tdeapplication.h>
24 #include <tdeglobal.h>
25 #include <tdeconfig.h>
26 #include <kstandarddirs.h>
27 #include <ksimpleconfig.h>
28 
29 ConfigDialog::ConfigDialog(TQWidget * parent):KDialogBase(Plain, i18n("Configure Holidays"), Ok|Cancel, Ok,
30  parent)
31 {
32  TQFrame *topFrame = plainPage();
33  TQVBoxLayout *topLayout =
34  new TQVBoxLayout(topFrame, 0, spacingHint());
35 
36  israel_box = new TQCheckBox(topFrame);
37  israel_box->setText(i18n("Use Israeli holidays"));
38  topLayout->addWidget(israel_box);
39 
40  parsha_box = new TQCheckBox(topFrame);
41  parsha_box->setText(i18n("Show weekly parsha"));
42  topLayout->addWidget(parsha_box);
43 
44  omer_box = new TQCheckBox(topFrame);
45  omer_box->setText(i18n("Show day of Omer"));
46  topLayout->addWidget(omer_box);
47 
48  chol_box = new TQCheckBox(topFrame);
49  chol_box->setText(i18n("Show Chol HaMoed"));
50  topLayout->addWidget(chol_box);
51 
52  load();
53 }
54 
55 ConfigDialog::~ConfigDialog()
56 {
57 }
58 
59 void ConfigDialog::load()
60 {
61  TDEConfig config("korganizerrc", true, false); // Open read-only, no kdeglobals
62 
63  config.setGroup("Calendar/Hebrew Calendar Plugin");
64  israel_box->setChecked(config.
65  readBoolEntry("Israel",
66  (TDEGlobal::locale()->
67  country() == ".il")));
68  parsha_box->setChecked(config.readBoolEntry("Parsha", true));
69  chol_box->setChecked(config.readBoolEntry("Chol_HaMoed", true));
70  omer_box->setChecked(config.readBoolEntry("Omer", true));
71 
72 }
73 
74 void ConfigDialog::save()
75 {
76  TDEConfig config("korganizerrc", false, false); // Open read-write, no kdeglobals
77 
78  config.setGroup("Calendar/Hebrew Calendar Plugin");
79  config.writeEntry("Israel", israel_box->isChecked());
80  config.writeEntry("Parsha", parsha_box->isChecked());
81  config.writeEntry("Chol_HaMoed", chol_box->isChecked());
82  config.writeEntry("Omer", omer_box->isChecked());
83  config.sync();
84 }
85 
86 void ConfigDialog::slotOk()
87 {
88  save();
89 
90  accept();
91 }