1 /*
2  * This file is part of KMyMoney, A Personal Finance Manager by KDE
3  * Copyright (C) 2014-2015 Romain Bignon <romain@symlink.me>
4  * Copyright (C) 2014-2015 Florent Fourcot <weboob@flo.fourcot.fr>
5  * (C) 2017 by Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include "accountsettings.h"
22 
23 // ----------------------------------------------------------------------------
24 // QT Includes
25 
26 // ----------------------------------------------------------------------------
27 // KDE Includes
28 
29 // ----------------------------------------------------------------------------
30 // Project Includes
31 
32 #include "ui_accountsettings.h"
33 
34 #include "mymoneykeyvaluecontainer.h"
35 
36 class AccountSettingsPrivate
37 {
38 public:
AccountSettingsPrivate()39   AccountSettingsPrivate() :
40     ui(new Ui::AccountSettings)
41   {
42   }
43 
~AccountSettingsPrivate()44   ~AccountSettingsPrivate()
45   {
46     delete ui;
47   }
48   Ui::AccountSettings *ui;
49 };
50 
AccountSettings(const MyMoneyAccount &,QWidget * parent)51 AccountSettings::AccountSettings(const MyMoneyAccount& /*acc*/, QWidget* parent) :
52     QWidget(parent),
53     d_ptr(new AccountSettingsPrivate)
54 {
55   Q_D(AccountSettings);
56   d->ui->setupUi(this);
57 }
58 
~AccountSettings()59 AccountSettings::~AccountSettings()
60 {
61   Q_D(AccountSettings);
62   delete d;
63 }
64 
loadUi(const MyMoneyKeyValueContainer & kvp)65 void AccountSettings::loadUi(const MyMoneyKeyValueContainer& kvp)
66 {
67   Q_D(AccountSettings);
68   d->ui->id->setText(kvp.value("wb-id"));
69   d->ui->backend->setText(kvp.value("wb-backend"));
70   d->ui->max_history->setText(kvp.value("wb-max"));
71 }
72 
loadKvp(MyMoneyKeyValueContainer & kvp)73 void AccountSettings::loadKvp(MyMoneyKeyValueContainer& kvp)
74 {
75   Q_D(AccountSettings);
76   kvp.setValue("wb-id", d->ui->id->text());
77   kvp.setValue("wb-backend", d->ui->backend->text());
78   kvp.setValue("wb-max", d->ui->max_history->text());
79 }
80