author | umopapisdn <umopapisdn> | 2003-05-13 22:58:18 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-05-13 22:58:18 (UTC) |
commit | 1e0e2f57472538bd880967ebe061c8f39a7e270b (patch) (unidiff) | |
tree | fcc070d53148385f93c0dc6ab5443d5100be0d26 /core/pim/datebook/datebookweekheaderimpl.cpp | |
parent | 45c0386de12b107e54e4d020d54eb05517a9efac (diff) | |
download | opie-1e0e2f57472538bd880967ebe061c8f39a7e270b.zip opie-1e0e2f57472538bd880967ebe061c8f39a7e270b.tar.gz opie-1e0e2f57472538bd880967ebe061c8f39a7e270b.tar.bz2 |
Bugfix: (Bug #0000902) Adding events in weekview shouldn't create them as events on the first day of the week but rather the last visited day.
Diffstat (limited to 'core/pim/datebook/datebookweekheaderimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookweekheaderimpl.cpp | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp index fd792e2..ff7626f 100644 --- a/core/pim/datebook/datebookweekheaderimpl.cpp +++ b/core/pim/datebook/datebookweekheaderimpl.cpp | |||
@@ -102,38 +102,14 @@ void DateBookWeekHeader::setDate(const QDate &d) { | |||
102 | QDate stop=start.addDays(6); | 102 | QDate stop=start.addDays(6); |
103 | labelDate->setText( QString::number(start.day()) + "." + | 103 | labelDate->setText( QString::number(start.day()) + "." + |
104 | start.monthName(start.month()) + "-" + | 104 | start.monthName(start.month()) + "-" + |
105 | QString::number(stop.day()) + "." + | 105 | QString::number(stop.day()) + "." + |
106 | start.monthName(stop.month()) +" ("+ | 106 | start.monthName(stop.month()) +" ("+ |
107 | tr("w")+":"+QString::number( week ) +")"); | 107 | tr("w")+":"+QString::number( week ) +")"); |
108 | emit dateChanged(year,week); | 108 | emit dateChanged(date); |
109 | } | 109 | } |
110 | 110 | ||
111 | void DateBookWeekHeader::setStartOfWeek( bool onMonday ) | 111 | void DateBookWeekHeader::setStartOfWeek( bool onMonday ) |
112 | { | 112 | { |
113 | bStartOnMonday = onMonday; | 113 | bStartOnMonday = onMonday; |
114 | setDate( date ); | 114 | setDate( date ); |
115 | } | 115 | } |
116 | |||
117 | // dateFromWeek | ||
118 | // compute the date from the week in the year | ||
119 | QDate dateFromWeek( int week, int year, bool startOnMonday ) | ||
120 | { | ||
121 | QDate d; | ||
122 | d.setYMD( year, 1, 1 ); | ||
123 | int dayOfWeek = d.dayOfWeek(); | ||
124 | if ( startOnMonday ) { | ||
125 | if ( dayOfWeek <= 4 ) { | ||
126 | d = d.addDays( ( week - 1 ) * 7 - dayOfWeek + 1 ); | ||
127 | } else { | ||
128 | d = d.addDays( (week) * 7 - dayOfWeek + 1 ); | ||
129 | } | ||
130 | } else { | ||
131 | if ( dayOfWeek <= 4 || dayOfWeek == 7) { | ||
132 | d = d.addDays( ( week - 1 ) * 7 - dayOfWeek % 7 ); | ||
133 | } else { | ||
134 | d = d.addDays( ( week ) * 7 - dayOfWeek % 7 ); | ||
135 | } | ||
136 | } | ||
137 | return d; | ||
138 | } | ||
139 | |||