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 | |||
@@ -106,5 +106,5 @@ void DateBookWeekHeader::setDate(const QDate &d) { | |||
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 | ||
@@ -114,26 +114,2 @@ void DateBookWeekHeader::setStartOfWeek( bool 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 | |||