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 | |||
@@ -107,3 +107,3 @@ void DateBookWeekHeader::setDate(const QDate &d) { | |||
107 | tr("w")+":"+QString::number( week ) +")"); | 107 | tr("w")+":"+QString::number( week ) +")"); |
108 | emit dateChanged(year,week); | 108 | emit dateChanged(date); |
109 | } | 109 | } |
@@ -115,25 +115 @@ void DateBookWeekHeader::setStartOfWeek( bool onMonday ) | |||
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 | |||