korganizer
configdialog.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "configdialog.h"
00020 #include "configdialog.moc"
00021 #include <klocale.h>
00022 #include <qlayout.h>
00023 #include <kapplication.h>
00024 #include <kglobal.h>
00025 #include <kconfig.h>
00026 #include <kstandarddirs.h>
00027 #include <ksimpleconfig.h>
00028
00029 ConfigDialog::ConfigDialog(QWidget * parent):KDialogBase(Plain, i18n("Configure Holidays"), Ok|Cancel, Ok,
00030 parent)
00031 {
00032 QFrame *topFrame = plainPage();
00033 QVBoxLayout *topLayout =
00034 new QVBoxLayout(topFrame, 0, spacingHint());
00035
00036 israel_box = new QCheckBox(topFrame);
00037 israel_box->setText(i18n("Use Israeli holidays"));
00038 topLayout->addWidget(israel_box);
00039
00040 parsha_box = new QCheckBox(topFrame);
00041 parsha_box->setText(i18n("Show weekly parsha"));
00042 topLayout->addWidget(parsha_box);
00043
00044 omer_box = new QCheckBox(topFrame);
00045 omer_box->setText(i18n("Show day of Omer"));
00046 topLayout->addWidget(omer_box);
00047
00048 chol_box = new QCheckBox(topFrame);
00049 chol_box->setText(i18n("Show Chol HaMoed"));
00050 topLayout->addWidget(chol_box);
00051
00052 load();
00053 }
00054
00055 ConfigDialog::~ConfigDialog()
00056 {
00057 }
00058
00059 void ConfigDialog::load()
00060 {
00061 KConfig config("korganizerrc", true, false);
00062
00063 config.setGroup("Calendar/Hebrew Calendar Plugin");
00064 israel_box->setChecked(config.
00065 readBoolEntry("Israel",
00066 (KGlobal::locale()->
00067 country() == ".il")));
00068 parsha_box->setChecked(config.readBoolEntry("Parsha", true));
00069 chol_box->setChecked(config.readBoolEntry("Chol_HaMoed", true));
00070 omer_box->setChecked(config.readBoolEntry("Omer", true));
00071
00072 }
00073
00074 void ConfigDialog::save()
00075 {
00076 KConfig config("korganizerrc", false, false);
00077
00078 config.setGroup("Calendar/Hebrew Calendar Plugin");
00079 config.writeEntry("Israel", israel_box->isChecked());
00080 config.writeEntry("Parsha", parsha_box->isChecked());
00081 config.writeEntry("Chol_HaMoed", chol_box->isChecked());
00082 config.writeEntry("Omer", omer_box->isChecked());
00083 config.sync();
00084 }
00085
00086 void ConfigDialog::slotOk()
00087 {
00088 save();
00089
00090 accept();
00091 }
|