OSDN Git Service

255396a19f275e076cafd608c2ec726be33512a5
[kita/kita.git] / kita / src / prefs / loginprefpage.cpp
1 /***************************************************************************
2 *   Copyright (C) 2003 by Hideki Ikemoto                                  *
3 *   ikemo@users.sourceforge.jp                                            *
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
11 #include "loginprefpage.h"
12
13 #include "libkita/accountconfig.h"
14
15 using namespace Kita;
16
17 LoginPrefPage::LoginPrefPage(QWidget* parent) : AbstractPrefPage(parent)
18 {
19     setupUi(this);
20     load();
21     connect(kcfg_BeMailAddress, SIGNAL(textChanged(const QString &)),
22             SIGNAL(changed()));
23     connect(kcfg_BeAuthCode, SIGNAL(textChanged(const QString &)),
24             SIGNAL(changed()));
25     connect(kcfg_UserID, SIGNAL(textChanged(const QString &)),
26             SIGNAL(changed()));
27     connect(kcfg_AutoLogin, SIGNAL(toggled(bool)), SIGNAL(changed()));
28     connect(kcfg_Password, SIGNAL(textChanged(const QString &)),
29             SIGNAL(changed()));
30 }
31
32 void LoginPrefPage::apply()
33 {
34     AccountConfig::setBeMailAddress(kcfg_BeMailAddress->text());
35     AccountConfig::setBeAuthCode(kcfg_BeAuthCode->text());
36     AccountConfig::setUserID(kcfg_UserID->text());
37     AccountConfig::setAutoLogin(kcfg_AutoLogin->isChecked());
38     AccountConfig::setPassword(kcfg_Password->text());
39 }
40
41 void LoginPrefPage::load()
42 {
43     kcfg_BeMailAddress->setText(AccountConfig::beMailAddress());
44     kcfg_BeAuthCode->setText(AccountConfig::beAuthCode());
45     kcfg_UserID->setText(AccountConfig::userID());
46     kcfg_AutoLogin->setChecked(AccountConfig::autoLogin());
47     kcfg_Password->setText(AccountConfig::password());
48 }
49
50 void LoginPrefPage::reset()
51 {
52     AccountConfig::self()->useDefaults(true);
53     load();
54     AccountConfig::self()->useDefaults(false);
55 }