Diffstat (limited to 'noncore/apps/checkbook/qcheckdetails.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/qcheckdetails.cpp | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/noncore/apps/checkbook/qcheckdetails.cpp b/noncore/apps/checkbook/qcheckdetails.cpp new file mode 100644 index 0000000..19a5e82 --- a/dev/null +++ b/noncore/apps/checkbook/qcheckdetails.cpp | |||
@@ -0,0 +1,119 @@ | |||
1 | #include "qcheckdetails.h" | ||
2 | |||
3 | QCheckDetails::QCheckDetails(int row, int col, const QStringList item) | ||
4 | : QMainWindow(), | ||
5 | m_view() | ||
6 | { | ||
7 | m_view = new QCheckDetailsBase(this); | ||
8 | setCentralWidget(m_view); | ||
9 | |||
10 | m_row = row; | ||
11 | m_col = col; | ||
12 | |||
13 | QToolBar *bar = new QToolBar(this); | ||
14 | bar->setHorizontalStretchable( TRUE ); | ||
15 | |||
16 | QPixmap newIcon = Resource::loadPixmap( "edit" ); | ||
17 | QPixmap trashIcon = Resource::loadPixmap( "trash" ); | ||
18 | QToolButton *nb1 = new QToolButton( newIcon, "Edit", QString::null, this, SLOT(editCheck()), bar, "edit transaction" ); | ||
19 | QToolButton *nb2 = new QToolButton( trashIcon, "Delete", QString::null, this, SLOT(deleteCheck()), bar, "delete transaction" ); | ||
20 | addToolBar(bar); | ||
21 | |||
22 | QString text = ""; | ||
23 | if (item[0] == "true") | ||
24 | { | ||
25 | text.append("<b>Payment</b> to <b>"); | ||
26 | text.append(item[1]); | ||
27 | } | ||
28 | if (item[0] == "false") | ||
29 | { | ||
30 | text.append("<b>Deposit</b> from <b>"); | ||
31 | text.append(item[1]); | ||
32 | } | ||
33 | text.append("</b> on <b>"); | ||
34 | text.append(item[7]); | ||
35 | text.append("</b> for <b>"); | ||
36 | text.append(QString("$" + item[5])); | ||
37 | |||
38 | text.append("</b>, to make your balance <b>$"); | ||
39 | text.append(item[9]); | ||
40 | text.append("</b>."); | ||
41 | |||
42 | text.append("<br><br>"); | ||
43 | text.append("<b>Category: </b>"); | ||
44 | text.append(item[2]); | ||
45 | text.append("<br>"); | ||
46 | text.append("<b>Type: </b>"); | ||
47 | |||
48 | QString type = "No Type"; | ||
49 | if (item[0] == "true") | ||
50 | { | ||
51 | if(item[3] == "0") | ||
52 | { | ||
53 | type = "Debit Charge"; | ||
54 | } | ||
55 | if(item[3] == "1") | ||
56 | { | ||
57 | type = "Written Check"; | ||
58 | } | ||
59 | if(item[3] == "2") | ||
60 | { | ||
61 | type = "Transfer"; | ||
62 | } | ||
63 | if(item[3] == "3") | ||
64 | { | ||
65 | type = "Credit Card"; | ||
66 | } | ||
67 | } | ||
68 | |||
69 | if (item[0] == "false") | ||
70 | { | ||
71 | if(item[3] == "0") | ||
72 | { | ||
73 | type = "Written Check"; | ||
74 | } | ||
75 | if(item[3] == "1") | ||
76 | { | ||
77 | type = "Automatic Payment"; | ||
78 | } | ||
79 | if(item[3] == "2") | ||
80 | { | ||
81 | type = "Transfer"; | ||
82 | } | ||
83 | if(item[3] == "3") | ||
84 | { | ||
85 | type = "Cash"; | ||
86 | } | ||
87 | } | ||
88 | |||
89 | text.append(type); | ||
90 | text.append("<br>"); | ||
91 | if (item[4] != "0") | ||
92 | { | ||
93 | text.append("<b>Check Number: </b>"); | ||
94 | text.append(item[4]); | ||
95 | text.append("<br>"); | ||
96 | } | ||
97 | if (item[6] != ".00") | ||
98 | { | ||
99 | text.append("<b>Extra Fee: </b>"); | ||
100 | text.append(QString("$" + item[6])); | ||
101 | m_view->checkDetails->setText(text); | ||
102 | } | ||
103 | if (item[8] != "") | ||
104 | { | ||
105 | text.append("<br><b>Additional Comments: </b>"); | ||
106 | text.append(item[8]); | ||
107 | } | ||
108 | m_view->checkDetails->setText(text); | ||
109 | } | ||
110 | |||
111 | void QCheckDetails::editCheck() | ||
112 | { | ||
113 | emit editClicked(m_row, m_col); | ||
114 | } | ||
115 | |||
116 | void QCheckDetails::deleteCheck() | ||
117 | { | ||
118 | emit deleteClicked(m_row, m_col); | ||
119 | } | ||