File indexing completed on 2024-05-26 05:10:13
0001 /* 0002 SPDX-FileCopyrightText: 2007 Thomas Baumgart <ipwizard@users.sourceforge.net> 0003 SPDX-FileCopyrightText: 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "kbrokeragepage.h" 0008 #include "kbrokeragepage_p.h" 0009 0010 // ---------------------------------------------------------------------------- 0011 // QT Includes 0012 0013 #include <QCheckBox> 0014 #include <QLabel> 0015 0016 // ---------------------------------------------------------------------------- 0017 // KDE Includes 0018 0019 #include <KLineEdit> 0020 0021 // ---------------------------------------------------------------------------- 0022 // Project Includes 0023 0024 #include "ui_kbrokeragepage.h" 0025 0026 #include "kmymoneycurrencyselector.h" 0027 #include "knewaccountwizard.h" 0028 #include "knewaccountwizard_p.h" 0029 #include "kaccounttypepage.h" 0030 #include "kaccounttypepage_p.h" 0031 #include "khierarchypage.h" 0032 #include "kinstitutionpage.h" 0033 #include "kinstitutionpage_p.h" 0034 #include "mymoneyfile.h" 0035 #include "mymoneysecurity.h" 0036 #include "wizardpage.h" 0037 0038 namespace NewAccountWizard 0039 { 0040 BrokeragePage::BrokeragePage(Wizard* wizard) : 0041 QWidget(wizard), 0042 WizardPage<Wizard>(*new BrokeragePagePrivate(wizard), StepBroker, this, wizard) 0043 { 0044 Q_D(BrokeragePage); 0045 d->ui->setupUi(this); 0046 connect(MyMoneyFile::instance(), &MyMoneyFile::dataChanged, this, &BrokeragePage::slotLoadWidgets); 0047 } 0048 0049 BrokeragePage::~BrokeragePage() 0050 { 0051 } 0052 0053 void BrokeragePage::slotLoadWidgets() 0054 { 0055 Q_D(BrokeragePage); 0056 d->ui->m_brokerageCurrency->update(QString("x")); 0057 } 0058 0059 void BrokeragePage::enterPage() 0060 { 0061 Q_D(BrokeragePage); 0062 // assign the currency of the investment account to the 0063 // brokerage account if nothing else has ever been selected 0064 if (d->ui->m_brokerageCurrency->security().id().isEmpty()) { 0065 d->ui->m_brokerageCurrency->setSecurity(d->m_wizard->d_func()->m_accountTypePage->d_func()->ui->m_currencyComboBox->security()); 0066 } 0067 0068 // check if the institution relevant fields should be enabled or not 0069 bool enabled = d->m_wizard->d_func()->m_institutionPage->d_func()->ui->m_accountNumber->isEnabled(); 0070 d->ui->m_accountNumberLabel->setEnabled(enabled); 0071 d->ui->m_accountNumber->setEnabled(enabled); 0072 d->ui->m_ibanLabel->setEnabled(enabled); 0073 d->ui->m_iban->setEnabled(enabled); 0074 } 0075 0076 QWidget* BrokeragePage::initialFocusWidget() const 0077 { 0078 Q_D(const BrokeragePage); 0079 return d->ui->m_createBrokerageButton; 0080 } 0081 0082 KMyMoneyWizardPage* BrokeragePage::nextPage() const 0083 { 0084 Q_D(const BrokeragePage); 0085 return d->m_wizard->d_func()->m_hierarchyPage; 0086 } 0087 }