author | mickeyl <mickeyl> | 2004-11-04 10:33:04 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-11-04 10:33:04 (UTC) |
commit | 7855b19ce0241a7b7b4fc72e3a8ddd9bf73b0a77 (patch) (unidiff) | |
tree | e76604c6af3da9c19b69dcdcf8105d58bac63f71 /noncore/unsupported/qashmoney/transferdialog.cpp | |
parent | cd2d50799e087fad5b56df9d7fe9aa572a313e64 (diff) | |
download | opie-7855b19ce0241a7b7b4fc72e3a8ddd9bf73b0a77.zip opie-7855b19ce0241a7b7b4fc72e3a8ddd9bf73b0a77.tar.gz opie-7855b19ce0241a7b7b4fc72e3a8ddd9bf73b0a77.tar.bz2 |
opie-qashmoney is now unsupported
Diffstat (limited to 'noncore/unsupported/qashmoney/transferdialog.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-x | noncore/unsupported/qashmoney/transferdialog.cpp | 112 |
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 | |||
6 | extern Preferences *preferences; | ||
7 | extern Account *account; | ||
8 | |||
9 | TransferDialog::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 | |||
60 | bool TransferDialog::getDateEdited () | ||
61 | { | ||
62 | return dateedited; | ||
63 | } | ||
64 | |||
65 | void 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 | |||
86 | int TransferDialog::getDay () | ||
87 | { | ||
88 | return day; | ||
89 | } | ||
90 | |||
91 | int TransferDialog::getMonth () | ||
92 | { | ||
93 | return month; | ||
94 | } | ||
95 | |||
96 | int TransferDialog::getYear () | ||
97 | { | ||
98 | return year; | ||
99 | } | ||
100 | |||
101 | void 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 | |||