File indexing completed on 2024-06-09 05:03:30

0001 /*
0002     SPDX-FileCopyrightText: 2010 Fernando Vilas <kmymoney-devel@kde.org>
0003     SPDX-FileCopyrightText: 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "kinvestmenttypewizardpage.h"
0008 
0009 // ----------------------------------------------------------------------------
0010 // QT Includes
0011 
0012 // ----------------------------------------------------------------------------
0013 // KDE Includes
0014 
0015 #include <KLocalizedString>
0016 
0017 // ----------------------------------------------------------------------------
0018 // Project Includes
0019 
0020 #include "ui_kinvestmenttypewizardpage.h"
0021 
0022 #include "mymoneysecurity.h"
0023 #include "mymoneyenums.h"
0024 
0025 KInvestmentTypeWizardPage::KInvestmentTypeWizardPage(QWidget *parent) :
0026     QWizardPage(parent),
0027     ui(new Ui::KInvestmentTypeWizardPage)
0028 {
0029     ui->setupUi(this);
0030     ui->m_securityType->addItem(i18nc("Security type", "Stock"), (int)eMyMoney::Security::Type::Stock);
0031     ui->m_securityType->addItem(i18nc("Security type", "Mutual Fund"), (int)eMyMoney::Security::Type::MutualFund);
0032     ui->m_securityType->addItem(i18nc("Security type", "Bond"), (int)eMyMoney::Security::Type::Bond);
0033     registerField("securityType", ui->m_securityType, "currentData", SIGNAL(currentIndexChanged(int)));
0034 }
0035 
0036 KInvestmentTypeWizardPage::~KInvestmentTypeWizardPage()
0037 {
0038     delete ui;
0039 }
0040 
0041 void KInvestmentTypeWizardPage::init2(const MyMoneySecurity& security)
0042 {
0043     //get the current text of the security and set the combo index accordingly
0044     auto text = MyMoneySecurity::securityTypeToString(security.securityType());
0045     for (auto i = 0; i < ui->m_securityType->count(); ++i) {
0046         if (ui->m_securityType->itemText(i) == text)
0047             ui->m_securityType->setCurrentIndex(i);
0048     }
0049 }
0050 
0051 void KInvestmentTypeWizardPage::setIntroLabelText(const QString& text)
0052 {
0053     ui->m_introLabel->setText(text);
0054 }