summaryrefslogtreecommitdiff
path: root/noncore/net/mail/settingsdialog.cpp
blob: 74b8b12f5e52ea6f7d399c3f58863c5ce58047fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <qcheckbox.h>
#include <qspinbox.h>

#include <qpe/config.h>

#include "settingsdialog.h"


SettingsDialog::SettingsDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
    : SettingsDialogUI( parent, name, modal, fl ) {

        readConfig();
}

SettingsDialog::~SettingsDialog() {

}

void SettingsDialog::readConfig() {
    Config cfg("mail");
    cfg.setGroup( "Settings" );
    showHtmlButton->setChecked( cfg.readBoolEntry( "showHtml", false ) );
    clickOpenMailButton->setChecked(cfg.readBoolEntry("clickOpensMail",true));
    clickOpenFolderButton->setChecked(cfg.readBoolEntry("clickOpensFolder",true));
    cfg.setGroup( "Compose" );
    checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
    cfg.setGroup( "Applet" );
    cbEnableTaskbarApplet->setChecked( cfg.readBoolEntry( "Disabled", false ) );
    spCheckOften->setValue( cfg.readNumEntry( "CheckEvery", 5 ) );
    cbBlinkLed->setChecked( cfg.readBoolEntry( "BlinkLed", true ) );
    cbPlaySound->setChecked( cfg.readBoolEntry( "PlaySound", false ) );

}

void SettingsDialog::writeConfig() {
    Config cfg( "mail" );
    cfg.setGroup( "Settings" );
    cfg.writeEntry("clickOpensMail",clickOpenMailButton->isChecked());
    cfg.writeEntry("clickOpensFolder",clickOpenFolderButton->isChecked());
    cfg.writeEntry( "showHtml", showHtmlButton->isChecked() );
    cfg.setGroup( "Compose" );
    cfg.writeEntry( "sendLater", checkBoxLater->isChecked() );
    cfg.setGroup( "Applet" );
    cfg.writeEntry( "Disabled", cbEnableTaskbarApplet->isChecked() );
    int check = spCheckOften->value();
    if (check<1)check=1;if (check>99)check=99;
    cfg.writeEntry( "CheckEvery", check);
    cfg.writeEntry( "BlinkLed", cbBlinkLed->isChecked() );
    cfg.writeEntry( "PlaySound", cbPlaySound->isChecked() );
}

void SettingsDialog::accept() {
    writeConfig();
    QDialog::accept();
}