summaryrefslogtreecommitdiffabout
path: root/kmicromail/settingsdialog.cpp
blob: 889c4905fcb128a40842c3db4361689912c53797 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include <qcheckbox.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtabwidget.h>
//Added by qt3to4:
#include <Q3GridLayout>

#include <kconfig.h>
#include <kprefs.h>
#include <klocale.h>
#include <kglobal.h>
#include <kfontdialog.h>

#include "settingsdialog.h"


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

#if 0
    QTabWidget *topFrame = TabWidget2;

    Q3GridLayout *topLayout = new Q3GridLayout(topFrame,3,3);
    topLayout->setSpacing(2);
    topLayout->setMargin(3);
    KPrefsWidFont * tVFont;
    int i = 0;
    KPrefsWidFont *timeLabelsFont =
        addWidFont(i18n("OK"),i18n("Application(nr):"),
                   &(mAppFont),topFrame);
    topLayout->addWidget(timeLabelsFont->label(),i,0);
    topLayout->addWidget(timeLabelsFont->preview(),i,1);
    topLayout->addWidget(timeLabelsFont->button(),i,2);
    ++i;


    timeLabelsFont =
        addWidFont(i18n("Mon 15"),i18n("Compose Mail:"),
                   &(mComposeFont),topFrame);
    topLayout->addWidget(timeLabelsFont->label(),i,0);
    topLayout->addWidget(timeLabelsFont->preview(),i,1);
    topLayout->addWidget(timeLabelsFont->button(),i,2);
    ++i;

    KPrefsWidFont *timeBarFont =
        addWidFont(i18n("Mon 15"),i18n("Read Mail:"),
                 &(mReadFont),topFrame);
    topLayout->addWidget(timeBarFont->label(),i,0);
    topLayout->addWidget(timeBarFont->preview(),i,1);
    topLayout->addWidget(timeBarFont->button(),i,2);
    ++i;

    readConfig();
#endif
}

SettingsDialog::~SettingsDialog() {

}

void SettingsDialog::readConfig() {
    KConfig cfg = ( locateLocal("config","kopiemailrc" ));
    cfg.setGroup( "Settings" );
    showHtmlButton->setChecked( cfg.readBoolEntry( "showHtml", false ) );
    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() {
    KConfig cfg ( locateLocal("config","kopiemailrc" ));
    cfg.setGroup( "Settings" );
    cfg.writeEntry( "showHtml", showHtmlButton->isChecked() );
    cfg.setGroup( "Compose" );
    cfg.writeEntry( "sendLater", checkBoxLater->isChecked() );
    cfg.setGroup( "Applet" );
    cfg.writeEntry( "Disabled", cbEnableTaskbarApplet->isChecked() );
    cfg.writeEntry( "CheckEvery", spCheckOften->value() );
    cfg.writeEntry( "BlinkLed", cbBlinkLed->isChecked() );
    cfg.writeEntry( "PlaySound", cbPlaySound->isChecked() );
}

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