Diffstat (limited to 'core/pim/datebook/datebookweeklst.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index de74d46..fe2ab51 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -139,98 +139,98 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, | |||
139 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); | 139 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); |
140 | } | 140 | } |
141 | 141 | ||
142 | void DateBookWeekLstDayHdr::showDay() { | 142 | void DateBookWeekLstDayHdr::showDay() { |
143 | emit showDate(date.year(), date.month(), date.day()); | 143 | emit showDate(date.year(), date.month(), date.day()); |
144 | } | 144 | } |
145 | 145 | ||
146 | void DateBookWeekLstDayHdr::newEvent() { | 146 | void DateBookWeekLstDayHdr::newEvent() { |
147 | QDateTime start, stop; | 147 | QDateTime start, stop; |
148 | start=stop=date; | 148 | start=stop=date; |
149 | start.setTime(QTime(10,0)); | 149 | start.setTime(QTime(10,0)); |
150 | stop.setTime(QTime(12,0)); | 150 | stop.setTime(QTime(12,0)); |
151 | 151 | ||
152 | emit addEvent(start,stop,"",0); | 152 | emit addEvent(start,stop,"",0); |
153 | } | 153 | } |
154 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | 154 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, |
155 | int weeklistviewconfig, | 155 | int weeklistviewconfig, |
156 | QWidget* parent, | 156 | QWidget* parent, |
157 | const char* name, | 157 | const char* name, |
158 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) | 158 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) |
159 | { | 159 | { |
160 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", | 160 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", |
161 | QString s,start,middle,end,day; | 161 | QString s,start,middle,end,day; |
162 | 162 | ||
163 | Opie::Core::odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl; | 163 | odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl; |
164 | if(weeklistviewconfig==NONE) {// No times displayed. | 164 | if(weeklistviewconfig==NONE) {// No times displayed. |
165 | // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | 165 | // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); |
166 | // middle.sprintf("<--->"); | 166 | // middle.sprintf("<--->"); |
167 | // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | 167 | // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); |
168 | // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | 168 | // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); |
169 | } else if(weeklistviewconfig==NORMAL) {// "Normal", only display start time. | 169 | } else if(weeklistviewconfig==NORMAL) {// "Normal", only display start time. |
170 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 170 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
171 | middle.sprintf(" |---"); | 171 | middle.sprintf(" |---"); |
172 | end.sprintf("__|__"); | 172 | end.sprintf("__|__"); |
173 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 173 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
174 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. | 174 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. |
175 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | 175 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); |
176 | middle.sprintf("<--->"); | 176 | middle.sprintf("<--->"); |
177 | end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | 177 | end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); |
178 | day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | 178 | day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); |
179 | } | 179 | } |
180 | 180 | ||
181 | if(ev.event().type() == Event::Normal) { | 181 | if(ev.event().type() == Event::Normal) { |
182 | if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) {// day event. | 182 | if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) {// day event. |
183 | s=day; | 183 | s=day; |
184 | } else if(ev.startDate()==ev.date()) {// start event. | 184 | } else if(ev.startDate()==ev.date()) {// start event. |
185 | s=start; | 185 | s=start; |
186 | } else if(ev.endDate()==ev.date()) { // end event. | 186 | } else if(ev.endDate()==ev.date()) { // end event. |
187 | s=end; | 187 | s=end; |
188 | } else {// middle day. | 188 | } else {// middle day. |
189 | s=middle; | 189 | s=middle; |
190 | } | 190 | } |
191 | } else { | 191 | } else { |
192 | s=""; | 192 | s=""; |
193 | } | 193 | } |
194 | setText(QString(s) + " " + ev.description()); | 194 | setText(QString(s) + " " + ev.description()); |
195 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 195 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
196 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 196 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
197 | } | 197 | } |
198 | void DateBookWeekLstEvent::editMe() { | 198 | void DateBookWeekLstEvent::editMe() { |
199 | emit editEvent(event.event()); | 199 | emit editEvent(event.event()); |
200 | } | 200 | } |
201 | 201 | ||
202 | 202 | ||
203 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | 203 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, |
204 | const QDate &d, bool onM, | 204 | const QDate &d, bool onM, |
205 | QWidget* parent, | 205 | QWidget* parent, |
206 | const char* name, WFlags fl) | 206 | const char* name, WFlags fl) |
207 | : QWidget( parent, name, fl ) | 207 | : QWidget( parent, name, fl ) |
208 | { | 208 | { |
209 | Config config("DateBook"); | 209 | Config config("DateBook"); |
210 | config.setGroup("Main"); | 210 | config.setGroup("Main"); |
211 | int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); | 211 | int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); |
212 | Opie::Core::odebug << "weeklistviewconfig: " << weeklistviewconfig << oendl; | 212 | odebug << "weeklistviewconfig: " << weeklistviewconfig << oendl; |
213 | 213 | ||
214 | bStartOnMonday=onM; | 214 | bStartOnMonday=onM; |
215 | setPalette(white); | 215 | setPalette(white); |
216 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); | 216 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); |
217 | 217 | ||
218 | QVBoxLayout *layout = new QVBoxLayout( this ); | 218 | QVBoxLayout *layout = new QVBoxLayout( this ); |
219 | 219 | ||
220 | qBubbleSort(ev); | 220 | qBubbleSort(ev); |
221 | QValueListIterator<EffectiveEvent> it; | 221 | QValueListIterator<EffectiveEvent> it; |
222 | it=ev.begin(); | 222 | it=ev.begin(); |
223 | 223 | ||
224 | int dayOrder[7]; | 224 | int dayOrder[7]; |
225 | if (bStartOnMonday) { | 225 | if (bStartOnMonday) { |
226 | for (int d=0; d<7; d++) dayOrder[d]=d+1; | 226 | for (int d=0; d<7; d++) dayOrder[d]=d+1; |
227 | } else { | 227 | } else { |
228 | for (int d=0; d<7; d++) dayOrder[d]=d; | 228 | for (int d=0; d<7; d++) dayOrder[d]=d; |
229 | dayOrder[0]=7; | 229 | dayOrder[0]=7; |
230 | } | 230 | } |
231 | 231 | ||
232 | // Calculate offset to first day of week. | 232 | // Calculate offset to first day of week. |
233 | int dayoffset=d.dayOfWeek(); | 233 | int dayoffset=d.dayOfWeek(); |
234 | if(bStartOnMonday) dayoffset--; | 234 | if(bStartOnMonday) dayoffset--; |
235 | else if( dayoffset == 7 ) dayoffset = 0; | 235 | else if( dayoffset == 7 ) dayoffset = 0; |
236 | 236 | ||