File indexing completed on 2024-05-26 05:10:15

0001 /*
0002     SPDX-FileCopyrightText: 2010 Fernando Vilas <kmymoney-devel@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #include "firstpaymentwizardpage.h"
0007 
0008 // ----------------------------------------------------------------------------
0009 // QT Includes
0010 
0011 
0012 // ----------------------------------------------------------------------------
0013 // KDE Includes
0014 
0015 #include <KLocalizedString>
0016 
0017 // ----------------------------------------------------------------------------
0018 // Project Includes
0019 
0020 #include "ui_firstpaymentwizardpage.h"
0021 
0022 FirstPaymentWizardPage::FirstPaymentWizardPage(QWidget *parent)
0023     : QWizardPage(parent),
0024       ui(new Ui::FirstPaymentWizardPage)
0025 {
0026     ui->setupUi(this);
0027 
0028     // Register the fields with the QWizard and connect the
0029     // appropriate signals to update the "Next" button correctly
0030     registerField("firstDueDateEdit", ui->m_firstDueDateEdit, "date");
0031     connect(ui->m_firstDueDateEdit, &KMyMoneyDateEdit::dateChanged, this, &QWizardPage::completeChanged);
0032 }
0033 
0034 FirstPaymentWizardPage::~FirstPaymentWizardPage()
0035 {
0036     delete ui;
0037 }
0038 
0039 /**
0040  * Update the "Next" button
0041  */
0042 bool FirstPaymentWizardPage::isComplete() const
0043 {
0044     return ui->m_firstDueDateEdit->isValid();
0045 }
0046 
0047 void FirstPaymentWizardPage::initializePage()
0048 {
0049     if (field("allPaymentsButton").toBool()) {
0050         ui->m_firstPaymentLabel->setText(
0051             QString("\n") +
0052             i18n("Please enter the date, the first payment for this loan was/is due."));
0053         ui->m_firstPaymentNote->setText(
0054             i18n("Note: Consult the loan contract for details of the first due date. "
0055                  "Keep in mind, that the first due date usually differs from the date "
0056                  "the contract was signed"));
0057     } else if (field("thisYearPaymentButton").toBool()) {
0058         ui->m_firstPaymentLabel->setText(
0059             QString("\n") +
0060             i18n("Please enter the date, the first payment for this loan was/is due this year."));
0061         ui->m_firstPaymentNote->setText(
0062             i18n("Note: You can easily figure out the date of the first payment "
0063                  "if you consult the last statement of last year."));
0064     }
0065 }