aboutsummaryrefslogtreecommitdiffstats
path: root/kde2/kpsion/setupdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kde2/kpsion/setupdialog.cpp')
-rw-r--r--kde2/kpsion/setupdialog.cpp115
1 files changed, 44 insertions, 71 deletions
diff --git a/kde2/kpsion/setupdialog.cpp b/kde2/kpsion/setupdialog.cpp
index 03eea8c..fa5959c 100644
--- a/kde2/kpsion/setupdialog.cpp
+++ b/kde2/kpsion/setupdialog.cpp
@@ -48,8 +48,6 @@ SetupDialog::SetupDialog(QWidget *parent, rfsv *plpRfsv, rpcs *plpRpcs)
QStringList::Iterator sli;
KPsionConfig pcfg;
- enableLinkedHelp(false);
-
KConfig *config = kapp->config();
// Page 1
@@ -69,96 +67,64 @@ SetupDialog::SetupDialog(QWidget *parent, rfsv *plpRfsv, rpcs *plpRpcs)
i18n("Click here, for opening a dialog which lets you easily select the backup folder."));
grid->addWidget(bdirLabel, 0, 1);
grid->addWidget(bdirButton, 0, 2);
-
- grid->setColStretch(1, 1);
-
+ grid->setColStretch(0, 1);
connect(bdirButton, SIGNAL(clicked()), SLOT(slotBdirBrowse()));
// Page 2
page2 = addPage(i18n("Backup &policy"));
- grid = new QGridLayout(page2);
+ grid = new QGridLayout(page2, 1, 1, marginHint() * 2, spacingHint() * 2);
- QLabel *l = new QLabel(i18n("&Incremental backup reminder"), page2,
+ QLabel *l = new QLabel(i18n("&Incremental backup interval"), page2,
"iBackupIntLabel");
- grid->addWidget(l, 3, 1);
+ grid->addWidget(l, 0, 0);
config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_INCINTERVAL));
i = config->readNumEntry(pcfg.getOptionName(KPsionConfig::OPT_INCINTERVAL));
iIntCombo = new KComboBox(false, page2, "iIntCombo");
- iIntCombo->insertItem(i18n("none"));
- iIntCombo->insertItem(i18n("daily"));
- iIntCombo->insertItem(i18n("every 2 days"));
- iIntCombo->insertItem(i18n("every 3 days"));
- iIntCombo->insertItem(i18n("every 4 days"));
- iIntCombo->insertItem(i18n("every 5 days"));
- iIntCombo->insertItem(i18n("every 6 days"));
- iIntCombo->insertItem(i18n("weekly"));
- iIntCombo->insertItem(i18n("every 2 weeks"));
- iIntCombo->insertItem(i18n("every 3 weeks"));
- iIntCombo->insertItem(i18n("monthly"));
+ iIntCombo->insertStringList(pcfg.getConfigBackupInterval());
iIntCombo->setCurrentItem(i);
- grid->addWidget(iIntCombo, 3, 2);
+ grid->addWidget(iIntCombo, 0, 1);
l->setBuddy(iIntCombo);
- l = new QLabel(i18n("&Full backup reminder"), page2, "fBackupIntLabel");
- grid->addWidget(l, 5, 1);
+ l = new QLabel(i18n("&Full backup interval"), page2, "fBackupIntLabel");
+ grid->addWidget(l, 1, 0);
config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_FULLINTERVAL));
i = config->readNumEntry(pcfg.getOptionName(KPsionConfig::OPT_FULLINTERVAL));
fIntCombo = new KComboBox(false, page2, "fIntCombo");
- fIntCombo->insertItem(i18n("none"));
- fIntCombo->insertItem(i18n("daily"));
- fIntCombo->insertItem(i18n("every 2 days"));
- fIntCombo->insertItem(i18n("every 3 days"));
- fIntCombo->insertItem(i18n("every 4 days"));
- fIntCombo->insertItem(i18n("every 5 days"));
- fIntCombo->insertItem(i18n("every 6 days"));
- fIntCombo->insertItem(i18n("weekly"));
- fIntCombo->insertItem(i18n("every 2 weeks"));
- fIntCombo->insertItem(i18n("every 3 weeks"));
- fIntCombo->insertItem(i18n("monthly"));
+ fIntCombo->insertStringList(pcfg.getConfigBackupInterval());
fIntCombo->setCurrentItem(i);
- grid->addWidget(fIntCombo, 5, 2);
+ grid->addWidget(fIntCombo, 1, 1);
l->setBuddy(fIntCombo);
l = new QLabel(i18n("Backup &generations"), page2, "backupGenLabel");
- grid->addWidget(l, 7, 1);
+ grid->addWidget(l, 2, 0);
config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_BACKUPGEN));
i = config->readNumEntry(pcfg.getOptionName(KPsionConfig::OPT_BACKUPGEN));
genSpin = new KIntSpinBox(0, 10, 1, i, 10, page2, "backupGenSpin");
- grid->addWidget(genSpin, 7, 2);
+ grid->addWidget(genSpin, 2, 1);
l->setBuddy(genSpin);
- grid->setRowStretch(1, 1);
- grid->setColStretch(1, 1);
-
- grid->addRowSpacing(2, KDialog::spacingHint());
- grid->addRowSpacing(4, KDialog::spacingHint());
- grid->addRowSpacing(6, KDialog::spacingHint());
-
- grid->addRowSpacing(0, KDialog::marginHint());
- grid->addRowSpacing(8, KDialog::marginHint());
- grid->addColSpacing(0, KDialog::marginHint());
- grid->addColSpacing(3, KDialog::marginHint());
+ grid->setColStretch(0, 1);
// Page 3
page3 = addPage(i18n("&Connection"));
- grid = new QGridLayout(page3);
+ grid = new QGridLayout(page3, 1, 1, marginHint() * 2, spacingHint() * 2);
l = new QLabel(i18n("&Connection retry interval (sec.)"), page3,
"rconLabel");
- grid->addWidget(l, 3, 1);
+ grid->addWidget(l, 0, 0);
config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_CONNRETRY));
i = config->readNumEntry(pcfg.getOptionName(KPsionConfig::OPT_CONNRETRY));
rconSpin = new KIntSpinBox(0, 600, 1, i, 10, page3, "rconSpin");
- grid->addWidget(rconSpin, 3, 2);
+ grid->addWidget(rconSpin, 0, 1);
l->setBuddy(rconSpin);
l = new QLabel(i18n("Serial &device"), page3, "devLabel");
- grid->addWidget(l, 5, 1);
+ grid->addWidget(l, 1, 0);
config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_SERIALDEV));
tmp = config->readEntry(pcfg.getOptionName(KPsionConfig::OPT_SERIALDEV));
@@ -166,15 +132,18 @@ SetupDialog::SetupDialog(QWidget *parent, rfsv *plpRfsv, rpcs *plpRpcs)
devCombo = new KComboBox(false, page3, "devCombo");
sl = pcfg.getConfigDevices();
devCombo->insertStringList(sl);
- for (i = 0, sli = sl.begin(); sli != sl.end(); ++i, ++sli) {
- if (*sli == tmp)
- devCombo->setCurrentItem(i);
- }
- grid->addWidget(devCombo, 5, 2);
+ if (tmp == "off")
+ devCombo->setCurrentItem(0);
+ else
+ for (i = 0, sli = sl.begin(); sli != sl.end(); ++i, ++sli) {
+ if (*sli == tmp)
+ devCombo->setCurrentItem(i);
+ }
+ grid->addWidget(devCombo, 1, 1);
l->setBuddy(devCombo);
l = new QLabel(i18n("Serial &speed"), page3, "speedLabel");
- grid->addWidget(l, 7, 1);
+ grid->addWidget(l, 2, 0);
config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_SERIALSPEED));
tmp = config->readEntry(pcfg.getOptionName(KPsionConfig::OPT_SERIALSPEED));
@@ -186,27 +155,27 @@ SetupDialog::SetupDialog(QWidget *parent, rfsv *plpRfsv, rpcs *plpRpcs)
if (*sli == tmp)
speedCombo->setCurrentItem(i);
}
- grid->addWidget(speedCombo, 7, 2);
+ grid->addWidget(speedCombo, 2, 1);
l->setBuddy(speedCombo);
- grid->setRowStretch(1, 1);
- grid->setColStretch(1, 1);
-
- grid->addRowSpacing(2, KDialog::spacingHint());
- grid->addRowSpacing(4, KDialog::spacingHint());
- grid->addRowSpacing(6, KDialog::spacingHint());
-
- grid->addRowSpacing(0, KDialog::marginHint());
- grid->addRowSpacing(8, KDialog::marginHint());
- grid->addColSpacing(0, KDialog::marginHint());
- grid->addColSpacing(3, KDialog::marginHint());
+ grid->setColStretch(0, 1);
+ connect(this, SIGNAL(defaultClicked()), SLOT(slotDefaultClicked()));
connect(this, SIGNAL(okClicked()), SLOT(slotSaveSettings()));
connect(this, SIGNAL(applyClicked()), SLOT(slotSaveSettings()));
}
void SetupDialog::
slotDefaultClicked() {
+ KPsionConfig pcfg;
+
+ bdirLabel->setText(pcfg.getStrDefault(KPsionConfig::DEF_BACKUPDIR));
+ iIntCombo->setCurrentItem(pcfg.getIntDefault(KPsionConfig::DEF_INCINTERVAL));
+ fIntCombo->setCurrentItem(pcfg.getIntDefault(KPsionConfig::DEF_FULLINTERVAL));
+ genSpin->setValue(pcfg.getIntDefault(KPsionConfig::DEF_BACKUPGEN));
+ rconSpin->setValue(pcfg.getIntDefault(KPsionConfig::DEF_CONNRETRY));
+ devCombo->setCurrentItem(pcfg.getIntDefault(KPsionConfig::DEF_SERIALDEV));
+ speedCombo->setCurrentItem(pcfg.getIntDefault(KPsionConfig::DEF_SERIALSPEED));
}
void SetupDialog::
@@ -242,8 +211,12 @@ slotSaveSettings() {
rconSpin->value());
config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_SERIALDEV));
- config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_SERIALDEV),
- devCombo->currentText());
+ if (devCombo->currentItem() == 0)
+ config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_SERIALDEV),
+ "off");
+ else
+ config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_SERIALDEV),
+ devCombo->currentText());
config->setGroup(pcfg.getSectionName(KPsionConfig::OPT_SERIALSPEED));
config->writeEntry(pcfg.getOptionName(KPsionConfig::OPT_SERIALSPEED),