OSDN Git Service

Rename boardmanager.cpp and boardmanager.h
[kita/kita.git] / src / prefs / aboneprefpage.cpp
1 /***************************************************************************
2 *   Copyright (C) 2003 by Hideki Ikemoto                                  *
3 *   ikemo@wakaba.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 "aboneprefpage.h"
12
13 #include "libkita/abone.h"
14
15 using namespace Kita;
16
17 AbonePrefPage::AbonePrefPage(QWidget *parent)
18 : AbstractPrefPage(parent)
19 {
20     setupUi(this);
21     load();
22     connect(idAboneText, SIGNAL(textChanged()), SIGNAL(changed()));
23     connect(nameAboneText, SIGNAL(textChanged()), SIGNAL(changed()));
24     connect(wordAboneText, SIGNAL(textChanged()), SIGNAL(changed()));
25 }
26
27 void AbonePrefPage::apply()
28 {
29     QString idText = idAboneText->toPlainText();
30     QStringList idList = idText.split('\n', QString::SkipEmptyParts);
31     AboneConfig::setAboneIDList(idList);
32
33     QString nameText = nameAboneText->toPlainText();
34     QStringList nameList = nameText.split('\n', QString::SkipEmptyParts);
35     AboneConfig::setAboneNameList(nameList);
36
37     QString wordText = wordAboneText->toPlainText();
38     QStringList wordList = wordText.split('\n', QString::SkipEmptyParts);
39     AboneConfig::setAboneWordList(wordList);
40 }
41
42 void AbonePrefPage::load()
43 {
44     idAboneText->setText(AboneConfig::aboneIDList().join("\n"));
45     nameAboneText->setText(AboneConfig::aboneNameList().join("\n"));
46     wordAboneText->setText(AboneConfig::aboneWordList().join("\n"));
47 }
48
49 void AbonePrefPage::reset()
50 {
51     AboneConfig::self()->useDefaults(true);
52     load();
53     AboneConfig::self()->useDefaults(false);
54 }