Diffstat (limited to 'noncore/apps/qashmoney/datepicker.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-x | noncore/apps/qashmoney/datepicker.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/qashmoney/datepicker.cpp b/noncore/apps/qashmoney/datepicker.cpp index 02fbcf3..7997c0b 100755 --- a/noncore/apps/qashmoney/datepicker.cpp +++ b/noncore/apps/qashmoney/datepicker.cpp | |||
@@ -1,95 +1,95 @@ | |||
1 | #include "datepicker.h" | 1 | #include "datepicker.h" |
2 | 2 | ||
3 | DatePicker::DatePicker ( QDate entrydate ) : QDialog ( 0, 0, TRUE ) | 3 | DatePicker::DatePicker ( QDate entrydate ) : QDialog ( 0, 0, TRUE ) |
4 | { | 4 | { |
5 | setCaption ( "Select Date" ); | 5 | setCaption ( "Select Date" ); |
6 | date = entrydate; | 6 | date = entrydate; |
7 | day = date.day(); | 7 | day = date.day(); |
8 | month = date.month(); | 8 | month = date.month(); |
9 | year = date.year(); | 9 | year = date.year(); |
10 | 10 | ||
11 | daylabel = new QLabel ( "Day", this ); | 11 | daylabel = new QLabel ( "Day", this ); |
12 | monthlabel = new QLabel ( "Month", this ); | 12 | monthlabel = new QLabel ( "Month", this ); |
13 | yearlabel = new QLabel ( "Year", this ); | 13 | yearlabel = new QLabel ( "Year", this ); |
14 | 14 | ||
15 | daybox = new QComboBox ( this, "daybox" ); | 15 | daybox = new QComboBox ( this, "daybox" ); |
16 | connect ( daybox, SIGNAL ( activated ( int ) ), this, SLOT ( setDay ( int ) ) ); | 16 | connect ( daybox, SIGNAL ( activated(int) ), this, SLOT ( setDay(int) ) ); |
17 | displayDays ( daybox ); | 17 | displayDays ( daybox ); |
18 | monthbox = new QComboBox ( this, "monthbox" ); | 18 | monthbox = new QComboBox ( this, "monthbox" ); |
19 | connect ( monthbox, SIGNAL ( activated ( int ) ), this, SLOT ( setMonth ( int ) ) ); | 19 | connect ( monthbox, SIGNAL ( activated(int) ), this, SLOT ( setMonth(int) ) ); |
20 | displayMonths ( monthbox ); | 20 | displayMonths ( monthbox ); |
21 | yearbox = new QComboBox ( this, "yearbox" ); | 21 | yearbox = new QComboBox ( this, "yearbox" ); |
22 | connect ( yearbox, SIGNAL ( activated ( int ) ), this, SLOT ( setYear ( int ) ) ); | 22 | connect ( yearbox, SIGNAL ( activated(int) ), this, SLOT ( setYear(int) ) ); |
23 | displayYears ( yearbox ); | 23 | displayYears ( yearbox ); |
24 | 24 | ||
25 | layout = new QGridLayout ( this, 2, 3, 5, 5, "datepickerlayout" ); | 25 | layout = new QGridLayout ( this, 2, 3, 5, 5, "datepickerlayout" ); |
26 | layout->addWidget ( daylabel, 0, 2 ); | 26 | layout->addWidget ( daylabel, 0, 2 ); |
27 | layout->addWidget ( monthlabel, 0, 1 ); | 27 | layout->addWidget ( monthlabel, 0, 1 ); |
28 | layout->addWidget ( yearlabel, 0, 0 ); | 28 | layout->addWidget ( yearlabel, 0, 0 ); |
29 | layout->addWidget ( daybox, 1, 2 ); | 29 | layout->addWidget ( daybox, 1, 2 ); |
30 | layout->addWidget ( monthbox, 1, 1 ); | 30 | layout->addWidget ( monthbox, 1, 1 ); |
31 | layout->addWidget ( yearbox, 1, 0 ); | 31 | layout->addWidget ( yearbox, 1, 0 ); |
32 | } | 32 | } |
33 | 33 | ||
34 | void DatePicker::displayDays ( QComboBox *daybox ) | 34 | void DatePicker::displayDays ( QComboBox *daybox ) |
35 | { | 35 | { |
36 | int counter; | 36 | int counter; |
37 | int days = date.daysInMonth(); | 37 | int days = date.daysInMonth(); |
38 | for ( counter = 1; counter <= days; counter++ ) | 38 | for ( counter = 1; counter <= days; counter++ ) |
39 | daybox->insertItem ( QString::number ( counter ) ); | 39 | daybox->insertItem ( QString::number ( counter ) ); |
40 | daybox->setCurrentItem ( ( date.day() ) - 1 ); | 40 | daybox->setCurrentItem ( ( date.day() ) - 1 ); |
41 | } | 41 | } |
42 | 42 | ||
43 | void DatePicker::displayMonths ( QComboBox *monthbox ) | 43 | void DatePicker::displayMonths ( QComboBox *monthbox ) |
44 | { | 44 | { |
45 | int counter; | 45 | int counter; |
46 | for ( counter = 1; counter <= 12; counter++ ) | 46 | for ( counter = 1; counter <= 12; counter++ ) |
47 | monthbox->insertItem ( QString::number ( counter ) ); | 47 | monthbox->insertItem ( QString::number ( counter ) ); |
48 | monthbox->setCurrentItem ( ( date.month() ) - 1 ); | 48 | monthbox->setCurrentItem ( ( date.month() ) - 1 ); |
49 | } | 49 | } |
50 | 50 | ||
51 | void DatePicker::displayYears ( QComboBox *yearbox ) | 51 | void DatePicker::displayYears ( QComboBox *yearbox ) |
52 | { | 52 | { |
53 | int counter; | 53 | int counter; |
54 | int indexcounter = 0; | 54 | int indexcounter = 0; |
55 | int yearindex = 0; | 55 | int yearindex = 0; |
56 | int year = date.year(); | 56 | int year = date.year(); |
57 | for ( counter = ( year - 1 ); counter <= ( year + 1 ); counter++ ) | 57 | for ( counter = ( year - 1 ); counter <= ( year + 1 ); counter++ ) |
58 | { | 58 | { |
59 | yearbox->insertItem ( QString::number ( counter ) ); | 59 | yearbox->insertItem ( QString::number ( counter ) ); |
60 | if ( date.year() == counter ) | 60 | if ( date.year() == counter ) |
61 | yearindex = indexcounter; | 61 | yearindex = indexcounter; |
62 | indexcounter ++; | 62 | indexcounter ++; |
63 | } | 63 | } |
64 | yearbox->setCurrentItem ( yearindex ); | 64 | yearbox->setCurrentItem ( yearindex ); |
65 | } | 65 | } |
66 | 66 | ||
67 | void DatePicker::setDay ( int index ) | 67 | void DatePicker::setDay ( int index ) |
68 | { | 68 | { |
69 | day = daybox->text ( index ).toInt(); | 69 | day = daybox->text ( index ).toInt(); |
70 | } | 70 | } |
71 | 71 | ||
72 | void DatePicker::setMonth ( int index ) | 72 | void DatePicker::setMonth ( int index ) |
73 | { | 73 | { |
74 | month = monthbox->text( index ).toInt(); | 74 | month = monthbox->text( index ).toInt(); |
75 | } | 75 | } |
76 | 76 | ||
77 | void DatePicker::setYear ( int index ) | 77 | void DatePicker::setYear ( int index ) |
78 | { | 78 | { |
79 | year = yearbox->text ( index ).toInt(); | 79 | year = yearbox->text ( index ).toInt(); |
80 | } | 80 | } |
81 | 81 | ||
82 | int DatePicker::getDay () | 82 | int DatePicker::getDay () |
83 | { return day; } | 83 | { return day; } |
84 | 84 | ||
85 | int DatePicker::getMonth () | 85 | int DatePicker::getMonth () |
86 | { return month; } | 86 | { return month; } |
87 | 87 | ||
88 | int DatePicker::getYear () | 88 | int DatePicker::getYear () |
89 | { return year; } | 89 | { return year; } |
90 | 90 | ||
91 | 91 | ||
92 | 92 | ||
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||