Diffstat (limited to 'core/pim/datebook/datebookweekheaderimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookweekheaderimpl.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp index ff7626f..770410e 100644 --- a/core/pim/datebook/datebookweekheaderimpl.cpp +++ b/core/pim/datebook/datebookweekheaderimpl.cpp | |||
@@ -61,51 +61,59 @@ void DateBookWeekHeader::pickDate() | |||
61 | picker = new DateBookMonth( m1, 0, TRUE ); | 61 | picker = new DateBookMonth( m1, 0, TRUE ); |
62 | m1->insertItem( picker ); | 62 | m1->insertItem( picker ); |
63 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( setDate( int, int, int ) ) ); | 63 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( setDate( int, int, int ) ) ); |
64 | // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) ); | 64 | // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) ); |
65 | } | 65 | } |
66 | picker->setDate( date.year(), date.month(), date.day() ); | 66 | picker->setDate( date.year(), date.month(), date.day() ); |
67 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); | 67 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); |
68 | picker->setFocus(); | 68 | picker->setFocus(); |
69 | } | 69 | } |
70 | 70 | ||
71 | void DateBookWeekHeader::nextMonth() | 71 | void DateBookWeekHeader::nextMonth() |
72 | { | 72 | { |
73 | qWarning("nextMonth() " ); | ||
73 | setDate(date.addDays(28)); | 74 | setDate(date.addDays(28)); |
74 | } | 75 | } |
75 | void DateBookWeekHeader::prevMonth() | 76 | void DateBookWeekHeader::prevMonth() |
76 | { | 77 | { |
78 | qWarning("prevMonth() " ); | ||
77 | setDate(date.addDays(-28)); | 79 | setDate(date.addDays(-28)); |
78 | } | 80 | } |
79 | void DateBookWeekHeader::nextWeek() | 81 | void DateBookWeekHeader::nextWeek() |
80 | { | 82 | { |
83 | qWarning("nextWeek() " ); | ||
81 | setDate(date.addDays(7)); | 84 | setDate(date.addDays(7)); |
82 | } | 85 | } |
83 | void DateBookWeekHeader::prevWeek() | 86 | void DateBookWeekHeader::prevWeek() |
84 | { | 87 | { |
88 | qWarning("prevWeek() "); | ||
85 | setDate(date.addDays(-7)); | 89 | setDate(date.addDays(-7)); |
86 | } | 90 | } |
87 | 91 | ||
88 | void DateBookWeekHeader::setDate( int y, int m, int d ) | 92 | void DateBookWeekHeader::setDate( int y, int m, int d ) |
89 | { | 93 | { |
90 | setDate(QDate(y,m,d)); | 94 | setDate(QDate(y,m,d)); |
91 | } | 95 | } |
92 | 96 | ||
93 | void DateBookWeekHeader::setDate(const QDate &d) { | 97 | void DateBookWeekHeader::setDate(const QDate &d) { |
94 | int year,week,dayofweek; | 98 | int year,week,dayofweek; |
95 | date=d; | 99 | date=d; |
96 | dayofweek=d.dayOfWeek(); | 100 | dayofweek=d.dayOfWeek(); |
97 | if(bStartOnMonday) dayofweek--; | 101 | if(bStartOnMonday) |
98 | date=date.addDays(-dayofweek); | 102 | dayofweek--; |
103 | else if( dayofweek == 7 ) | ||
104 | /* we already have the right day -7 would lead to the current week..*/ | ||
105 | dayofweek = 0; | ||
99 | 106 | ||
107 | date=date.addDays(-dayofweek); | ||
100 | calcWeek(date,week,year,bStartOnMonday); | 108 | calcWeek(date,week,year,bStartOnMonday); |
101 | QDate start=date; | 109 | QDate start=date; |
102 | QDate stop=start.addDays(6); | 110 | QDate stop=start.addDays(6); |
103 | labelDate->setText( QString::number(start.day()) + "." + | 111 | labelDate->setText( QString::number(start.day()) + "." + |
104 | start.monthName(start.month()) + "-" + | 112 | start.monthName(start.month()) + "-" + |
105 | QString::number(stop.day()) + "." + | 113 | QString::number(stop.day()) + "." + |
106 | start.monthName(stop.month()) +" ("+ | 114 | start.monthName(stop.month()) +" ("+ |
107 | tr("w")+":"+QString::number( week ) +")"); | 115 | tr("w")+":"+QString::number( week ) +")"); |
108 | emit dateChanged(date); | 116 | emit dateChanged(date); |
109 | } | 117 | } |
110 | 118 | ||
111 | void DateBookWeekHeader::setStartOfWeek( bool onMonday ) | 119 | void DateBookWeekHeader::setStartOfWeek( bool onMonday ) |