1 /***************************************************************************
2 firstpaymentwizardpage - description
3 -------------------
4 begin : Sun Jul 4 2010
5 copyright : (C) 2010 by Fernando Vilas
6 email : kmymoney-devel@kde.org
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18 #include "firstpaymentwizardpage.h"
19
20 // ----------------------------------------------------------------------------
21 // QT Includes
22
23
24 // ----------------------------------------------------------------------------
25 // KDE Includes
26
27 #include <KLocalizedString>
28
29 // ----------------------------------------------------------------------------
30 // Project Includes
31
32 #include "ui_firstpaymentwizardpage.h"
33
FirstPaymentWizardPage(QWidget * parent)34 FirstPaymentWizardPage::FirstPaymentWizardPage(QWidget *parent)
35 : QWizardPage(parent),
36 ui(new Ui::FirstPaymentWizardPage)
37 {
38 ui->setupUi(this);
39
40 // Register the fields with the QWizard and connect the
41 // appropriate signals to update the "Next" button correctly
42 registerField("firstDueDateEdit", ui->m_firstDueDateEdit, "date");
43 connect(ui->m_firstDueDateEdit, &KMyMoneyDateInput::dateChanged, this, &QWizardPage::completeChanged);
44 }
45
~FirstPaymentWizardPage()46 FirstPaymentWizardPage::~FirstPaymentWizardPage()
47 {
48 delete ui;
49 }
50
51 /**
52 * Update the "Next" button
53 */
isComplete() const54 bool FirstPaymentWizardPage::isComplete() const
55 {
56 return ui->m_firstDueDateEdit->date().isValid();
57 }
58
initializePage()59 void FirstPaymentWizardPage::initializePage()
60 {
61 if (field("allPaymentsButton").toBool()) {
62 ui->m_firstPaymentLabel->setText(
63 QString("\n") +
64 i18n("Please enter the date, the first payment for this loan was/is due."));
65 ui->m_firstPaymentNote->setText(
66 i18n("Note: Consult the loan contract for details of the first due date. "
67 "Keep in mind, that the first due date usually differs from the date "
68 "the contract was signed"));
69 } else if (field("thisYearPaymentButton").toBool()) {
70 ui->m_firstPaymentLabel->setText(
71 QString("\n") +
72 i18n("Please enter the date, the first payment for this loan was/is due this year."));
73 ui->m_firstPaymentNote->setText(
74 i18n("Note: You can easily figure out the date of the first payment "
75 "if you consult the last statement of last year."));
76 }
77 }
78