summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookweeklst.cpp18
-rw-r--r--core/pim/datebook/datebookweeklst.h8
2 files changed, 13 insertions, 13 deletions
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index e8e12ba..5334a16 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -44,335 +44,335 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent,
44 connect(back, SIGNAL(clicked()), this, SLOT(prevWeek())); 44 connect(back, SIGNAL(clicked()), this, SLOT(prevWeek()));
45 connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek())); 45 connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek()));
46 connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate())); 46 connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate()));
47 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); 47 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool)));
48 onMonday=onM; 48 onMonday=onM;
49} 49}
50DateBookWeekLstHeader::~DateBookWeekLstHeader(){} 50DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
51void DateBookWeekLstHeader::setDate(const QDate &d) { 51void DateBookWeekLstHeader::setDate(const QDate &d) {
52 date=d; 52 date=d;
53 53
54 int year,week; 54 int year,week;
55 calcWeek(d,week,year,onMonday); 55 calcWeek(d,week,year,onMonday);
56 labelWeek->setText(tr( "W: %1" ).arg( ( QString::number(week)) ) ); 56 labelWeek->setText(tr( "W: %1" ).arg( ( QString::number(week)) ) );
57 57
58 QDate start=date; 58 QDate start=date;
59 QDate stop=start.addDays(6); 59 QDate stop=start.addDays(6);
60 labelDate->setText( QString::number(start.day()) + " " + 60 labelDate->setText( QString::number(start.day()) + " " +
61 start.monthName(start.month()) + " - " + 61 start.monthName(start.month()) + " - " +
62 QString::number(stop.day()) + " " + 62 QString::number(stop.day()) + " " +
63 start.monthName(stop.month()) ); 63 start.monthName(stop.month()) );
64 emit dateChanged(year,week); 64 emit dateChanged(year,week);
65} 65}
66void DateBookWeekLstHeader::pickDate() { 66void DateBookWeekLstHeader::pickDate() {
67 static QPopupMenu *m1 = 0; 67 static QPopupMenu *m1 = 0;
68 static DateBookMonth *picker = 0; 68 static DateBookMonth *picker = 0;
69 if ( !m1 ) { 69 if ( !m1 ) {
70 m1 = new QPopupMenu( this ); 70 m1 = new QPopupMenu( this );
71 picker = new DateBookMonth( m1, 0, TRUE ); 71 picker = new DateBookMonth( m1, 0, TRUE );
72 m1->insertItem( picker ); 72 m1->insertItem( picker );
73 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 73 connect( picker, SIGNAL( dateClicked( int, int, int ) ),
74 this, SLOT( setDate( int, int, int ) ) ); 74 this, SLOT( setDate( int, int, int ) ) );
75 //connect( m1, SIGNAL( aboutToHide() ), 75 //connect( m1, SIGNAL( aboutToHide() ),
76 //this, SLOT( gotHide() ) ); 76 //this, SLOT( gotHide() ) );
77 } 77 }
78 picker->setDate( date.year(), date.month(), date.day() ); 78 picker->setDate( date.year(), date.month(), date.day() );
79 m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height()))); 79 m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height())));
80 picker->setFocus(); 80 picker->setFocus();
81} 81}
82void DateBookWeekLstHeader::setDate(int y, int m, int d) { 82void DateBookWeekLstHeader::setDate(int y, int m, int d) {
83 QDate new_date(y,m,d); 83 QDate new_date(y,m,d);
84 setDate(new_date); 84 setDate(new_date);
85} 85}
86 86
87void DateBookWeekLstHeader::nextWeek() { 87void DateBookWeekLstHeader::nextWeek() {
88 setDate(date.addDays(7)); 88 setDate(date.addDays(7));
89} 89}
90void DateBookWeekLstHeader::prevWeek() { 90void DateBookWeekLstHeader::prevWeek() {
91 setDate(date.addDays(-7)); 91 setDate(date.addDays(-7));
92} 92}
93 93
94DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/, 94DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/,
95 QWidget* parent, 95 QWidget* parent,
96 const char* name, 96 const char* name,
97 WFlags fl ) 97 WFlags fl )
98 : DateBookWeekLstDayHdrBase(parent, name, fl) { 98 : DateBookWeekLstDayHdrBase(parent, name, fl) {
99 99
100 date=d; 100 date=d;
101 101
102 static const char *wdays={"MTWTFSS"}; 102 static const char *wdays={"MTWTFSS"};
103 char day=wdays[d.dayOfWeek()-1]; 103 char day=wdays[d.dayOfWeek()-1];
104 104
105 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " + 105 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +
106 QString::number(d.day()) ); 106 QString::number(d.day()) );
107 add->setText("+"); 107 add->setText("+");
108 108
109 if (d == QDate::currentDate()) { 109 if (d == QDate::currentDate()) {
110 QPalette pal=label->palette(); 110 QPalette pal=label->palette();
111 pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); 111 pal.setColor(QColorGroup::Foreground, QColor(0,0,255));
112 label->setPalette(pal); 112 label->setPalette(pal);
113 113
114 /* 114 /*
115 QFont f=label->font(); 115 QFont f=label->font();
116 f.setItalic(true); 116 f.setItalic(true);
117 label->setFont(f); 117 label->setFont(f);
118 label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); 118 label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor()));
119 */ 119 */
120 } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday 120 } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday
121 QPalette pal=label->palette(); 121 QPalette pal=label->palette();
122 pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); 122 pal.setColor(QColorGroup::Foreground, QColor(255,0,0));
123 label->setPalette(pal); 123 label->setPalette(pal);
124 } 124 }
125 125
126 126
127 connect (label, SIGNAL(clicked()), this, SLOT(showDay())); 127 connect (label, SIGNAL(clicked()), this, SLOT(showDay()));
128 connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); 128 connect (add, SIGNAL(clicked()), this, SLOT(newEvent()));
129} 129}
130 130
131void DateBookWeekLstDayHdr::showDay() { 131void DateBookWeekLstDayHdr::showDay() {
132 emit showDate(date.year(), date.month(), date.day()); 132 emit showDate(date.year(), date.month(), date.day());
133} 133}
134void DateBookWeekLstDayHdr::newEvent() { 134void DateBookWeekLstDayHdr::newEvent() {
135 QDateTime start, stop; 135 QDateTime start, stop;
136 start=stop=date; 136 start=stop=date;
137 start.setTime(QTime(10,0)); 137 start.setTime(QTime(10,0));
138 stop.setTime(QTime(12,0)); 138 stop.setTime(QTime(12,0));
139 139
140 emit addEvent(start,stop,""); 140 emit addEvent(start,stop,"",0);
141} 141}
142DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, 142DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
143 QWidget* parent, 143 QWidget* parent,
144 const char* name, 144 const char* name,
145 WFlags fl) : 145 WFlags fl) :
146 OClickableLabel(parent,name,fl), 146 OClickableLabel(parent,name,fl),
147 event(ev) 147 event(ev)
148{ 148{
149 char s[10]; 149 char s[10];
150 if ( ev.startDate() != ev.date() ) { // multiday event (not first day) 150 if ( ev.startDate() != ev.date() ) { // multiday event (not first day)
151 if ( ev.endDate() == ev.date() ) { // last day 151 if ( ev.endDate() == ev.date() ) { // last day
152 strcpy(s, "__|__"); 152 strcpy(s, "__|__");
153 } else { 153 } else {
154 strcpy(s, " |---"); 154 strcpy(s, " |---");
155 } 155 }
156 } else { 156 } else {
157 if(ev.event().type() == Event::Normal ) 157 if(ev.event().type() == Event::Normal )
158 sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); 158 sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute());
159 else 159 else
160 sprintf(s," "); 160 sprintf(s," ");
161 } 161 }
162 setText(QString(s) + " " + ev.description()); 162 setText(QString(s) + " " + ev.description());
163 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 163 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
164 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); 164 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
165} 165}
166void DateBookWeekLstEvent::editMe() { 166void DateBookWeekLstEvent::editMe() {
167 emit editEvent(event.event()); 167 emit editEvent(event.event());
168} 168}
169 169
170 170
171DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, 171DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
172 const QDate &d, bool onM, 172 const QDate &d, bool onM,
173 QWidget* parent, 173 QWidget* parent,
174 const char* name, WFlags fl) 174 const char* name, WFlags fl)
175 : QWidget( parent, name, fl ) 175 : QWidget( parent, name, fl )
176{ 176{
177 onMonday=onM; 177 onMonday=onM;
178 setPalette(white); 178 setPalette(white);
179 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); 179 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
180 180
181 QVBoxLayout *layout = new QVBoxLayout( this ); 181 QVBoxLayout *layout = new QVBoxLayout( this );
182 182
183 qBubbleSort(ev); 183 qBubbleSort(ev);
184 QValueListIterator<EffectiveEvent> it; 184 QValueListIterator<EffectiveEvent> it;
185 it=ev.begin(); 185 it=ev.begin();
186 186
187 int dayOrder[7]; 187 int dayOrder[7];
188 if (onMonday) 188 if (onMonday)
189 for (int d=0; d<7; d++) dayOrder[d]=d+1; 189 for (int d=0; d<7; d++) dayOrder[d]=d+1;
190 else { 190 else {
191 for (int d=0; d<7; d++) dayOrder[d]=d; 191 for (int d=0; d<7; d++) dayOrder[d]=d;
192 dayOrder[0]=7; 192 dayOrder[0]=7;
193 } 193 }
194 194
195 for (int i=0; i<7; i++) { 195 for (int i=0; i<7; i++) {
196 // Header 196 // Header
197 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), 197 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i),
198 onMonday,this); 198 onMonday,this);
199 connect(hdr, SIGNAL(showDate(int,int,int)), 199 connect(hdr, SIGNAL(showDate(int,int,int)),
200 this, SIGNAL(showDate(int,int,int))); 200 this, SIGNAL(showDate(int,int,int)));
201 connect(hdr, SIGNAL(addEvent(const QDateTime &, 201 connect(hdr, SIGNAL(addEvent(const QDateTime &,
202 const QDateTime &, 202 const QDateTime &,
203 const QString &)), 203 const QString &, const QString &)),
204 this, SIGNAL(addEvent(const QDateTime &, 204 this, SIGNAL(addEvent(const QDateTime &,
205 const QDateTime &, 205 const QDateTime &,
206 const QString &))); 206 const QString &, const QString &)));
207 layout->addWidget(hdr); 207 layout->addWidget(hdr);
208 208
209 // Events 209 // Events
210 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { 210 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
211 if(!((*it).end().hour()==(*it).start().hour() && (*it).end().minute()==(*it).start().minute())) {// Skip effective events with no duration. (i.e ending at 00:00) 211 if(!((*it).end().hour()==(*it).start().hour() && (*it).end().minute()==(*it).start().minute())) {// Skip effective events with no duration. (i.e ending at 00:00)
212 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this); 212 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this);
213 layout->addWidget(l); 213 layout->addWidget(l);
214 connect (l, SIGNAL(editEvent(const Event &)), 214 connect (l, SIGNAL(editEvent(const Event &)),
215 this, SIGNAL(editEvent(const Event &))); 215 this, SIGNAL(editEvent(const Event &)));
216 } 216 }
217 it++; 217 it++;
218 } 218 }
219 219
220 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); 220 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
221 } 221 }
222} 222}
223DateBookWeekLstView::~DateBookWeekLstView(){} 223DateBookWeekLstView::~DateBookWeekLstView(){}
224void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} 224void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();}
225 225
226DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, 226DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
227 QValueList<EffectiveEvent> &ev2, 227 QValueList<EffectiveEvent> &ev2,
228 QDate &d, bool onM, 228 QDate &d, bool onM,
229 QWidget* parent, 229 QWidget* parent,
230 const char* name, WFlags fl) 230 const char* name, WFlags fl)
231 : QWidget( parent, name, fl ) 231 : QWidget( parent, name, fl )
232{ 232{
233 QHBoxLayout *layout = new QHBoxLayout( this ); 233 QHBoxLayout *layout = new QHBoxLayout( this );
234 234
235 DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); 235 DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this);
236 layout->addWidget(w); 236 layout->addWidget(w);
237 connect (w, SIGNAL(editEvent(const Event &)), 237 connect (w, SIGNAL(editEvent(const Event &)),
238 this, SIGNAL(editEvent(const Event &))); 238 this, SIGNAL(editEvent(const Event &)));
239 connect (w, SIGNAL(showDate(int,int,int)), 239 connect (w, SIGNAL(showDate(int,int,int)),
240 this, SIGNAL(showDate(int,int,int))); 240 this, SIGNAL(showDate(int,int,int)));
241 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 241 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
242 const QString &)), 242 const QString &,const QString &)),
243 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 243 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
244 const QString &))); 244 const QString &, const QString &)));
245 245
246 246
247 w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); 247 w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this);
248 layout->addWidget(w); 248 layout->addWidget(w);
249 connect (w, SIGNAL(editEvent(const Event &)), 249 connect (w, SIGNAL(editEvent(const Event &)),
250 this, SIGNAL(editEvent(const Event &))); 250 this, SIGNAL(editEvent(const Event &)));
251 connect (w, SIGNAL(showDate(int,int,int)), 251 connect (w, SIGNAL(showDate(int,int,int)),
252 this, SIGNAL(showDate(int,int,int))); 252 this, SIGNAL(showDate(int,int,int)));
253 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 253 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
254 const QString &)), 254 const QString &, const QString &)),
255 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 255 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
256 const QString &))); 256 const QString &, const QString &)));
257} 257}
258 258
259DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, 259DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
260 QWidget *parent, 260 QWidget *parent,
261 const char *name ) 261 const char *name )
262 : QWidget( parent, name ), 262 : QWidget( parent, name ),
263 db( newDB ), 263 db( newDB ),
264 startTime( 0 ), 264 startTime( 0 ),
265 ampm( ap ), 265 ampm( ap ),
266 onMonday(onM) 266 onMonday(onM)
267{ 267{
268 setFocusPolicy(StrongFocus); 268 setFocusPolicy(StrongFocus);
269 layout = new QVBoxLayout( this ); 269 layout = new QVBoxLayout( this );
270 layout->setMargin(0); 270 layout->setMargin(0);
271 271
272 header=new DateBookWeekLstHeader(onM, this); 272 header=new DateBookWeekLstHeader(onM, this);
273 layout->addWidget( header ); 273 layout->addWidget( header );
274 connect(header, SIGNAL(dateChanged(int,int)), 274 connect(header, SIGNAL(dateChanged(int,int)),
275 this, SLOT(dateChanged(int,int))); 275 this, SLOT(dateChanged(int,int)));
276 connect(header, SIGNAL(setDbl(bool)), 276 connect(header, SIGNAL(setDbl(bool)),
277 this, SLOT(setDbl(bool))); 277 this, SLOT(setDbl(bool)));
278 278
279 scroll=new QScrollView(this); 279 scroll=new QScrollView(this);
280 //scroll->setVScrollBarMode(QScrollView::AlwaysOn); 280 //scroll->setVScrollBarMode(QScrollView::AlwaysOn);
281 //scroll->setHScrollBarMode(QScrollView::AlwaysOff); 281 //scroll->setHScrollBarMode(QScrollView::AlwaysOff);
282 scroll->setResizePolicy(QScrollView::AutoOneFit); 282 scroll->setResizePolicy(QScrollView::AutoOneFit);
283 layout->addWidget(scroll); 283 layout->addWidget(scroll);
284 284
285 view=NULL; 285 view=NULL;
286 Config config("DateBook"); 286 Config config("DateBook");
287 config.setGroup("Main"); 287 config.setGroup("Main");
288 dbl=config.readBoolEntry("weeklst_dbl", false); 288 dbl=config.readBoolEntry("weeklst_dbl", false);
289 header->dbl->setOn(dbl); 289 header->dbl->setOn(dbl);
290} 290}
291DateBookWeekLst::~DateBookWeekLst(){ 291DateBookWeekLst::~DateBookWeekLst(){
292 Config config("DateBook"); 292 Config config("DateBook");
293 config.setGroup("Main"); 293 config.setGroup("Main");
294 config.writeEntry("weeklst_dbl", dbl); 294 config.writeEntry("weeklst_dbl", dbl);
295} 295}
296 296
297void DateBookWeekLst::setDate(const QDate &d) { 297void DateBookWeekLst::setDate(const QDate &d) {
298 int w,y; 298 int w,y;
299 calcWeek(d,w,y,onMonday); 299 calcWeek(d,w,y,onMonday);
300 year=y; 300 year=y;
301 _week=w; 301 _week=w;
302 header->setDate(date()); 302 header->setDate(date());
303} 303}
304void DateBookWeekLst::setDbl(bool on) { 304void DateBookWeekLst::setDbl(bool on) {
305 dbl=on; 305 dbl=on;
306 redraw(); 306 redraw();
307} 307}
308void DateBookWeekLst::redraw() {getEvents();} 308void DateBookWeekLst::redraw() {getEvents();}
309 309
310QDate DateBookWeekLst::date() const { 310QDate DateBookWeekLst::date() const {
311 QDate d; 311 QDate d;
312 d.setYMD(year,1,1); 312 d.setYMD(year,1,1);
313 313
314 int dow= d.dayOfWeek(); 314 int dow= d.dayOfWeek();
315 if (!onMonday) 315 if (!onMonday)
316 if (dow==7) dow=1; 316 if (dow==7) dow=1;
317 else dow++; 317 else dow++;
318 318
319 d=d.addDays( (_week-1)*7 - dow + 1 ); 319 d=d.addDays( (_week-1)*7 - dow + 1 );
320 return d; 320 return d;
321} 321}
322 322
323void DateBookWeekLst::getEvents() { 323void DateBookWeekLst::getEvents() {
324 QDate start = date(); 324 QDate start = date();
325 QDate stop = start.addDays(6); 325 QDate stop = start.addDays(6);
326 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); 326 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
327 327
328 if (view) delete view; 328 if (view) delete view;
329 if (dbl) { 329 if (dbl) {
330 QDate start2=start.addDays(7); 330 QDate start2=start.addDays(7);
331 stop=start2.addDays(6); 331 stop=start2.addDays(6);
332 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); 332 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
333 333
334 view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll); 334 view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll);
335 } else { 335 } else {
336 view=new DateBookWeekLstView(el,start,onMonday,scroll); 336 view=new DateBookWeekLstView(el,start,onMonday,scroll);
337 } 337 }
338 338
339 connect (view, SIGNAL(editEvent(const Event &)), 339 connect (view, SIGNAL(editEvent(const Event &)),
340 this, SIGNAL(editEvent(const Event &))); 340 this, SIGNAL(editEvent(const Event &)));
341 connect (view, SIGNAL(showDate(int,int,int)), 341 connect (view, SIGNAL(showDate(int,int,int)),
342 this, SIGNAL(showDate(int,int,int))); 342 this, SIGNAL(showDate(int,int,int)));
343 connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 343 connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
344 const QString &)), 344 const QString &, const QString &)),
345 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 345 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
346 const QString &))); 346 const QString &, const QString &)));
347 347
348 scroll->addChild(view); 348 scroll->addChild(view);
349 view->show(); 349 view->show();
350 scroll->updateScrollBars(); 350 scroll->updateScrollBars();
351} 351}
352 352
353void DateBookWeekLst::dateChanged(int y, int w) { 353void DateBookWeekLst::dateChanged(int y, int w) {
354 year=y; 354 year=y;
355 _week=w; 355 _week=w;
356 getEvents(); 356 getEvents();
357} 357}
358 358
359void DateBookWeekLst::keyPressEvent(QKeyEvent *e) 359void DateBookWeekLst::keyPressEvent(QKeyEvent *e)
360{ 360{
361 switch(e->key()) { 361 switch(e->key()) {
362 case Key_Up: 362 case Key_Up:
363 scroll->scrollBy(0, -20); 363 scroll->scrollBy(0, -20);
364 break; 364 break;
365 case Key_Down: 365 case Key_Down:
366 scroll->scrollBy(0, 20); 366 scroll->scrollBy(0, 20);
367 break; 367 break;
368 case Key_Left: 368 case Key_Left:
369 header->prevWeek(); 369 header->prevWeek();
370 break; 370 break;
371 case Key_Right: 371 case Key_Right:
372 header->nextWeek(); 372 header->nextWeek();
373 break; 373 break;
374 default: 374 default:
375 e->ignore(); 375 e->ignore();
376 } 376 }
377} 377}
378 378
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h
index 24f6c83..ea88f20 100644
--- a/core/pim/datebook/datebookweeklst.h
+++ b/core/pim/datebook/datebookweeklst.h
@@ -1,151 +1,151 @@
1#ifndef DATEBOOKWEEKLST 1#ifndef DATEBOOKWEEKLST
2#define DATEBOOKWEEKLST 2#define DATEBOOKWEEKLST
3 3
4#include <qwidget.h> 4#include <qwidget.h>
5#include <qdatetime.h> 5#include <qdatetime.h>
6#include <qpe/event.h> 6#include <qpe/event.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qscrollview.h> 8#include <qscrollview.h>
9 9
10#include "datebookweeklstheader.h" 10#include "datebookweeklstheader.h"
11#include "datebookweeklstdayhdr.h" 11#include "datebookweeklstdayhdr.h"
12 12
13#include <opie/oclickablelabel.h> 13#include <opie/oclickablelabel.h>
14 14
15class QDateTime; 15class QDateTime;
16class DateBookDB; 16class DateBookDB;
17 17
18class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase 18class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase
19{ 19{
20 Q_OBJECT 20 Q_OBJECT
21public: 21public:
22 DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0, 22 DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0,
23 WFlags fl = 0 ); 23 WFlags fl = 0 );
24 ~DateBookWeekLstHeader(); 24 ~DateBookWeekLstHeader();
25 void setDate(const QDate &d); 25 void setDate(const QDate &d);
26 26
27public slots: 27public slots:
28 void nextWeek(); 28 void nextWeek();
29 void prevWeek(); 29 void prevWeek();
30 void pickDate(); 30 void pickDate();
31 void setDate(int y, int m, int d); 31 void setDate(int y, int m, int d);
32signals: 32signals:
33 void dateChanged(int y, int w); 33 void dateChanged(int y, int w);
34 void setDbl(bool on); 34 void setDbl(bool on);
35private: 35private:
36 QDate date; 36 QDate date;
37 bool onMonday; 37 bool onMonday;
38}; 38};
39 39
40class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase 40class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase
41{ 41{
42 Q_OBJECT 42 Q_OBJECT
43public: 43public:
44 DateBookWeekLstDayHdr(const QDate &d, bool onM, 44 DateBookWeekLstDayHdr(const QDate &d, bool onM,
45 QWidget* parent = 0, const char* name = 0, 45 QWidget* parent = 0, const char* name = 0,
46 WFlags fl = 0 ); 46 WFlags fl = 0 );
47public slots: 47public slots:
48 void showDay(); 48 void showDay();
49 void newEvent(); 49 void newEvent();
50signals: 50signals:
51 void showDate(int y, int m, int d); 51 void showDate(int y, int m, int d);
52 void addEvent(const QDateTime &start, const QDateTime &stop, 52 void addEvent(const QDateTime &start, const QDateTime &stop,
53 const QString &str); 53 const QString &str, const QString &location);
54private: 54private:
55 QDate date; 55 QDate date;
56}; 56};
57 57
58class DateBookWeekLstEvent: public OClickableLabel 58class DateBookWeekLstEvent: public OClickableLabel
59{ 59{
60 Q_OBJECT 60 Q_OBJECT
61public: 61public:
62 DateBookWeekLstEvent(const EffectiveEvent &ev, 62 DateBookWeekLstEvent(const EffectiveEvent &ev,
63 QWidget* parent = 0, const char* name = 0, 63 QWidget* parent = 0, const char* name = 0,
64 WFlags fl = 0); 64 WFlags fl = 0);
65signals: 65signals:
66 void editEvent(const Event &e); 66 void editEvent(const Event &e);
67private slots: 67private slots:
68 void editMe(); 68 void editMe();
69private: 69private:
70 const EffectiveEvent event; 70 const EffectiveEvent event;
71}; 71};
72 72
73class DateBookWeekLstView: public QWidget 73class DateBookWeekLstView: public QWidget
74{ 74{
75 Q_OBJECT 75 Q_OBJECT
76public: 76public:
77 DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, 77 DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM,
78 QWidget* parent = 0, const char* name = 0, 78 QWidget* parent = 0, const char* name = 0,
79 WFlags fl = 0 ); 79 WFlags fl = 0 );
80 ~DateBookWeekLstView(); 80 ~DateBookWeekLstView();
81signals: 81signals:
82 void editEvent(const Event &e); 82 void editEvent(const Event &e);
83 void showDate(int y, int m, int d); 83 void showDate(int y, int m, int d);
84 void addEvent(const QDateTime &start, const QDateTime &stop, 84 void addEvent(const QDateTime &start, const QDateTime &stop,
85 const QString &str); 85 const QString &str, const QString &location);
86private: 86private:
87 bool onMonday; 87 bool onMonday;
88protected slots: 88protected slots:
89 void keyPressEvent(QKeyEvent *); 89 void keyPressEvent(QKeyEvent *);
90}; 90};
91 91
92class DateBookWeekLstDblView: public QWidget { 92class DateBookWeekLstDblView: public QWidget {
93 Q_OBJECT 93 Q_OBJECT
94public: 94public:
95 DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, 95 DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
96 QValueList<EffectiveEvent> &ev2, 96 QValueList<EffectiveEvent> &ev2,
97 QDate &d, bool onM, 97 QDate &d, bool onM,
98 QWidget* parent = 0, const char* name = 0, 98 QWidget* parent = 0, const char* name = 0,
99 WFlags fl = 0 ); 99 WFlags fl = 0 );
100signals: 100signals:
101 void editEvent(const Event &e); 101 void editEvent(const Event &e);
102 void showDate(int y, int m, int d); 102 void showDate(int y, int m, int d);
103 void addEvent(const QDateTime &start, const QDateTime &stop, 103 void addEvent(const QDateTime &start, const QDateTime &stop,
104 const QString &str); 104 const QString &str, const QString &location);
105}; 105};
106 106
107class DateBookWeekLst : public QWidget 107class DateBookWeekLst : public QWidget
108{ 108{
109 Q_OBJECT 109 Q_OBJECT
110 110
111public: 111public:
112 DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB, 112 DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB,
113 QWidget *parent = 0, 113 QWidget *parent = 0,
114 const char *name = 0 ); 114 const char *name = 0 );
115 ~DateBookWeekLst(); 115 ~DateBookWeekLst();
116 void setDate( int y, int w ); 116 void setDate( int y, int w );
117 void setDate(const QDate &d ); 117 void setDate(const QDate &d );
118 int week() const { return _week; }; 118 int week() const { return _week; };
119 QDate date() const; 119 QDate date() const;
120 120
121public slots: 121public slots:
122 void redraw(); 122 void redraw();
123 void dateChanged(int y, int w); 123 void dateChanged(int y, int w);
124 124
125protected slots: 125protected slots:
126 void keyPressEvent(QKeyEvent *); 126 void keyPressEvent(QKeyEvent *);
127 void setDbl(bool on); 127 void setDbl(bool on);
128 128
129signals: 129signals:
130 void showDate(int y, int m, int d); 130 void showDate(int y, int m, int d);
131 void addEvent(const QDateTime &start, const QDateTime &stop, 131 void addEvent(const QDateTime &start, const QDateTime &stop,
132 const QString &str); 132 const QString &str, const QString &location);
133 void editEvent(const Event &e); 133 void editEvent(const Event &e);
134 134
135private: 135private:
136 DateBookDB *db; 136 DateBookDB *db;
137 int startTime; 137 int startTime;
138 bool ampm; 138 bool ampm;
139 bool onMonday; 139 bool onMonday;
140 bool dbl; 140 bool dbl;
141 int year, _week; 141 int year, _week;
142 DateBookWeekLstHeader *header; 142 DateBookWeekLstHeader *header;
143 QWidget *view; 143 QWidget *view;
144 QVBoxLayout *layout; 144 QVBoxLayout *layout;
145 QScrollView *scroll; 145 QScrollView *scroll;
146 146
147 void getEvents(); 147 void getEvents();
148}; 148};
149 149
150#endif 150#endif
151 151