OSDN Git Service

Move the directories
[kita/kita.git] / src / prefs / loginprefpage.cpp
diff --git a/src/prefs/loginprefpage.cpp b/src/prefs/loginprefpage.cpp
new file mode 100644 (file)
index 0000000..255396a
--- /dev/null
@@ -0,0 +1,55 @@
+/***************************************************************************
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
+
+#include "loginprefpage.h"
+
+#include "libkita/accountconfig.h"
+
+using namespace Kita;
+
+LoginPrefPage::LoginPrefPage(QWidget* parent) : AbstractPrefPage(parent)
+{
+    setupUi(this);
+    load();
+    connect(kcfg_BeMailAddress, SIGNAL(textChanged(const QString &)),
+            SIGNAL(changed()));
+    connect(kcfg_BeAuthCode, SIGNAL(textChanged(const QString &)),
+            SIGNAL(changed()));
+    connect(kcfg_UserID, SIGNAL(textChanged(const QString &)),
+            SIGNAL(changed()));
+    connect(kcfg_AutoLogin, SIGNAL(toggled(bool)), SIGNAL(changed()));
+    connect(kcfg_Password, SIGNAL(textChanged(const QString &)),
+            SIGNAL(changed()));
+}
+
+void LoginPrefPage::apply()
+{
+    AccountConfig::setBeMailAddress(kcfg_BeMailAddress->text());
+    AccountConfig::setBeAuthCode(kcfg_BeAuthCode->text());
+    AccountConfig::setUserID(kcfg_UserID->text());
+    AccountConfig::setAutoLogin(kcfg_AutoLogin->isChecked());
+    AccountConfig::setPassword(kcfg_Password->text());
+}
+
+void LoginPrefPage::load()
+{
+    kcfg_BeMailAddress->setText(AccountConfig::beMailAddress());
+    kcfg_BeAuthCode->setText(AccountConfig::beAuthCode());
+    kcfg_UserID->setText(AccountConfig::userID());
+    kcfg_AutoLogin->setChecked(AccountConfig::autoLogin());
+    kcfg_Password->setText(AccountConfig::password());
+}
+
+void LoginPrefPage::reset()
+{
+    AccountConfig::self()->useDefaults(true);
+    load();
+    AccountConfig::self()->useDefaults(false);
+}