summaryrefslogtreecommitdiff
path: root/noncore/unsupported/qashmoney/transferdialog.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/qashmoney/transferdialog.cpp') (more/less context) (show whitespace changes)
-rwxr-xr-xnoncore/unsupported/qashmoney/transferdialog.cpp112
1 files changed, 112 insertions, 0 deletions
diff --git a/noncore/unsupported/qashmoney/transferdialog.cpp b/noncore/unsupported/qashmoney/transferdialog.cpp
new file mode 100755
index 0000000..7a12fbf
--- a/dev/null
+++ b/noncore/unsupported/qashmoney/transferdialog.cpp
@@ -0,0 +1,112 @@
1#include "transferdialog.h"
2#include "datepicker.h"
3#include "calculator.h"
4
5
6extern Preferences *preferences;
7extern Account *account;
8
9TransferDialog::TransferDialog ( QWidget *parent, int fromaccountid, int toaccountid ) : QDialog ( parent, 0, TRUE )
10 {
11 dateedited = FALSE;
12 setCaption ( "Transfer" );
13
14 fromaccountlabel = new QLabel ( "From account:", this );
15 QFont f = this->font();
16 f.setWeight ( QFont::Bold );
17 fromaccountlabel->setFont ( f );
18 fromaccount = new QLabel ( account->getAccountName ( fromaccountid ), this );
19
20 toaccountlabel = new QLabel ( "To Account:", this );
21 toaccountlabel->setFont ( f );
22 toaccount = new QLabel ( account->getAccountName ( toaccountid ), this );
23
24 datelabel = new QLabel ( "Date", this );
25
26 datebox = new QHBox ( this );
27 datebox->setSpacing ( 2 );
28 date = new QLineEdit ( datebox );
29 date->setAlignment ( Qt::AlignRight );
30 date->setDisabled ( TRUE );
31 datebutton = new QPushButton ( datebox );
32 datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) );
33 connect ( datebutton, SIGNAL ( released() ), this, SLOT ( showCalendar() ) );
34
35 amounttlabel = new QLabel ( "Amount", this );
36
37 amountbox = new QHBox ( this );
38 amountbox->setSpacing ( 2 );
39 amount = new QLineEdit ( amountbox );
40 amount->setAlignment ( Qt::AlignRight );
41 calculatorbutton = new QPushButton( amountbox );
42 calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
43 connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) );
44
45 clearedcheckbox = new QCheckBox ( "Cleared", this );
46
47 layout = new QVBoxLayout ( this, 4, 2 );
48 layout->addWidget ( fromaccountlabel, Qt::AlignLeft );
49 layout->addWidget ( fromaccount, Qt::AlignLeft );
50 layout->addWidget ( toaccountlabel, Qt::AlignLeft );
51 layout->addWidget ( toaccount, Qt::AlignLeft );
52 layout->addSpacing ( 5 );
53 layout->addWidget ( datelabel, Qt::AlignLeft );
54 layout->addWidget ( datebox, Qt::AlignLeft );
55 layout->addWidget ( amounttlabel, Qt::AlignLeft );
56 layout->addWidget ( amountbox, Qt::AlignLeft );
57 layout->addWidget ( clearedcheckbox, Qt::AlignLeft );
58 }
59
60bool TransferDialog::getDateEdited ()
61 {
62 return dateedited;
63 }
64
65void TransferDialog::showCalendar ()
66 {
67 QDate newDate = QDate::currentDate ();
68 DatePicker *dp = new DatePicker ( newDate );
69 if ( dp->exec () == QDialog::Accepted )
70 {
71 // Set date integers
72 year = dp->getYear();
73 month = dp->getMonth();
74 day = dp->getDay();
75
76 // Set dateedited to TRUE
77 // This tells the accountdisplay object that the user edited an account
78 // and did change the date
79 dateedited = TRUE;
80
81 // Display date with our selected format
82 date->setText ( preferences->getDate ( year, month, day ) );
83 }
84 }
85
86int TransferDialog::getDay ()
87 {
88 return day;
89 }
90
91int TransferDialog::getMonth ()
92 {
93 return month;
94 }
95
96int TransferDialog::getYear ()
97 {
98 return year;
99 }
100
101void TransferDialog::showCalculator ()
102 {
103 Calculator *calculator = new Calculator ( this );
104 if ( calculator->exec () == QDialog::Accepted )
105 amount->setText ( calculator->display->text() );
106 }
107
108
109
110
111
112