summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-27 01:07:05 (UTC)
committer zautrix <zautrix>2004-10-27 01:07:05 (UTC)
commit4efb020e137fbb8b94d845a2aa0ffc894561aea9 (patch) (unidiff)
tree62fa8844366362ccc7b8ed87b908e0222ab9a5f9
parentba3d660ed4f856362d2b914ed744874c235b4001 (diff)
downloadkdepimpi-4efb020e137fbb8b94d845a2aa0ffc894561aea9.zip
kdepimpi-4efb020e137fbb8b94d845a2aa0ffc894561aea9.tar.gz
kdepimpi-4efb020e137fbb8b94d845a2aa0ffc894561aea9.tar.bz2
fixed wn view
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kowhatsnextview.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 59b864c..0f0bf11 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -49,53 +49,60 @@ void WhatsNextTextBrowser::setSource(const QString& n)
49 if (n.startsWith("event:")) { 49 if (n.startsWith("event:")) {
50 emit showIncidence(n); 50 emit showIncidence(n);
51 return; 51 return;
52 } else if (n.startsWith("todo:")) { 52 } else if (n.startsWith("todo:")) {
53 emit showIncidence(n); 53 emit showIncidence(n);
54 return; 54 return;
55 } else { 55 } else {
56 QTextBrowser::setSource(n); 56 QTextBrowser::setSource(n);
57 } 57 }
58} 58}
59 59
60KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, 60KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
61 const char *name) 61 const char *name)
62 : KOrg::BaseView(calendar, parent, name) 62 : KOrg::BaseView(calendar, parent, name)
63{ 63{
64 // mDateLabel = 64 // mDateLabel =
65 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); 65 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
66 // mDateLabel->setMargin(2); 66 // mDateLabel->setMargin(2);
67 // mDateLabel->setAlignment(AlignCenter); 67 // mDateLabel->setAlignment(AlignCenter);
68 setFont( KOPrefs::instance()->mWhatsNextFont ); 68 setFont( KOPrefs::instance()->mWhatsNextFont );
69 mView = new WhatsNextTextBrowser(this); 69 mView = new WhatsNextTextBrowser(this);
70 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); 70 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
71 QStyleSheet* stsh = mView->styleSheet(); 71 QStyleSheet* stsh = mView->styleSheet();
72 QStyleSheetItem * style ; 72 QStyleSheetItem * style ;
73 73 style = stsh->item ("a" );
74 if ( style ) {
75 style->setMargin(QStyleSheetItem::MarginAll,0);
76 }
74 style = stsh->item ("h2" ); 77 style = stsh->item ("h2" );
75 if ( style ) { 78 if ( style ) {
76 style->setMargin(QStyleSheetItem::MarginAll,0); 79 style->setMargin(QStyleSheetItem::MarginAll,0);
77 } 80 }
81 style = stsh->item ("h3" );
82 if ( style ) {
83 style->setMargin(QStyleSheetItem::MarginAll,0);
84 }
78 style = stsh->item ("table" ); 85 style = stsh->item ("table" );
79 if ( style ) { 86 if ( style ) {
80 style->setMargin(QStyleSheetItem::MarginAll,0); 87 style->setMargin(QStyleSheetItem::MarginAll,0);
81 } 88 }
82 mEventViewer = 0; 89 mEventViewer = 0;
83 90
84 QBoxLayout *topLayout = new QVBoxLayout(this); 91 QBoxLayout *topLayout = new QVBoxLayout(this);
85 // topLayout->addWidget(mDateLabel); 92 // topLayout->addWidget(mDateLabel);
86 topLayout->addWidget(mView); 93 topLayout->addWidget(mView);
87 mTimer = new QTimer( this ); 94 mTimer = new QTimer( this );
88 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); 95 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView()));
89 96
90 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 97 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
91 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 98 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
92} 99}
93 100
94KOWhatsNextView::~KOWhatsNextView() 101KOWhatsNextView::~KOWhatsNextView()
95{ 102{
96} 103}
97 104
98int KOWhatsNextView::maxDatesHint() 105int KOWhatsNextView::maxDatesHint()
99{ 106{
100 return 0; 107 return 0;
101} 108}
@@ -243,175 +250,175 @@ void KOWhatsNextView::updateView()
243 //mText +="</table>"; 250 //mText +="</table>";
244 } 251 }
245 if ( itemAdded ) 252 if ( itemAdded )
246 mText += "</table>\n"; 253 mText += "</table>\n";
247 mEventDate = mEventDate.addDays( 1 ); 254 mEventDate = mEventDate.addDays( 1 );
248 } 255 }
249 256
250 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; 257 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios;
251 if (todos.count() > 0 && topmostPrios > 0 ) { 258 if (todos.count() > 0 && topmostPrios > 0 ) {
252 // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 259 // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
253 // mText += "<h2>"; 260 // mText += "<h2>";
254 //<img src=\""; 261 //<img src=\"";
255 // mText += ipath; 262 // mText += ipath;
256 // mText += "\">"; 263 // mText += "\">";
257 // mText += i18n("Overdue To-Do:") + "</h2>\n"; 264 // mText += i18n("Overdue To-Do:") + "</h2>\n";
258 265
259 //mText += "<ul>\n"; 266 //mText += "<ul>\n";
260 bool gotone = false; 267 bool gotone = false;
261 int priority = 1; 268 int priority = 1;
262 int priosFound = 0; 269 int priosFound = 0;
263#ifdef DESKTOP_VERSION 270#ifdef DESKTOP_VERSION
264 mText +="<p></p>"; 271 mText +="<p></p>";
265#endif 272#endif
266 273
267 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></strong></big></big>\n"; 274 mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n";
268 mText += "<ul>\n"; 275 mText += "<ul>\n";
269 while (!gotone && priority<6) { 276 while (!gotone && priority<6) {
270 todo = todos.first(); 277 todo = todos.first();
271 while(todo) { 278 while(todo) {
272 if (!todo->isCompleted() && (todo->priority() == priority) ) { 279 if (!todo->isCompleted() && (todo->priority() == priority) ) {
273 if ( appendTodo(todo) ) 280 if ( appendTodo(todo) )
274 gotone = true; 281 gotone = true;
275 } 282 }
276 todo = todos.next(); 283 todo = todos.next();
277 } 284 }
278 if ( gotone ) { 285 if ( gotone ) {
279 gotone = false; 286 gotone = false;
280 ++priosFound; 287 ++priosFound;
281 if ( priosFound == topmostPrios ) 288 if ( priosFound == topmostPrios )
282 break; 289 break;
283 } 290 }
284 priority++; 291 priority++;
285 // kdDebug() << "adding the todos..." << endl; 292 // kdDebug() << "adding the todos..." << endl;
286 } 293 }
287 mText += "</ul>\n"; 294 mText += "</ul>\n";
288 } 295 }
289 296
290 int replys = 0; 297 int replys = 0;
291 events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); 298 events = calendar()->events(QDate::currentDate(), QDate(2975,12,6));
292 if (events.count() > 0) { 299 if (events.count() > 0) {
293 Event *ev = events.first(); 300 Event *ev = events.first();
294 while(ev) { 301 while(ev) {
295 Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 302 Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
296 if (me!=0) { 303 if (me!=0) {
297 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 304 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
298 if (replys == 0) { 305 if (replys == 0) {
299 mText += "<p></p>"; 306 mText += "<p></p>";
300 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 307 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
301 //mText += "<h2>"; 308 //mText += "<h2>";
302 //<img src=\""; 309 //<img src=\"";
303 // mText += ipath; 310 // mText += ipath;
304 // mText += "\">"; 311 // mText += "\">";
305 //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; 312 //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n";
306 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; 313 mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n";
307 mText += "<table>\n"; 314 mText += "<table>\n";
308 } 315 }
309 replys++; 316 replys++;
310 appendEvent(ev,true); 317 appendEvent(ev,true);
311 } 318 }
312 } 319 }
313 ev = events.next(); 320 ev = events.next();
314 } 321 }
315 } 322 }
316 todos = calendar()->todos(); 323 todos = calendar()->todos();
317 if (todos.count() > 0) { 324 if (todos.count() > 0) {
318 Todo *to = todos.first(); 325 Todo *to = todos.first();
319 while(to) { 326 while(to) {
320 if ( !to->isCompleted() ){ 327 if ( !to->isCompleted() ){
321 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 328 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
322 if (me!=0) { 329 if (me!=0) {
323 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 330 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
324 if (replys == 0) { 331 if (replys == 0) {
325 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; 332 mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n";
326 mText += "<table>\n"; 333 mText += "<table>\n";
327 } 334 }
328 replys++; 335 replys++;
329 appendEvent(to, true); 336 appendEvent(to, true);
330 } 337 }
331 } 338 }
332 } 339 }
333 to = todos.next(); 340 to = todos.next();
334 } 341 }
335 } 342 }
336 if (replys > 0 ) mText += "</table>\n"; 343 if (replys > 0 ) mText += "</table>\n";
337 344
338 345
339 mText += "</td></tr>\n</table></qt>\n"; 346 mText += "</td></tr>\n</table></qt>\n";
340 347
341 mView->setText(mText); 348 mView->setText(mText);
342 mView->setFocus(); 349 mView->setFocus();
343 350
344 // QPixmap bPix = SmallIcon( "back" ); 351 // QPixmap bPix = SmallIcon( "back" );
345 // qDebug("xxxxxxxxxxxxxxxxxxxxx "); 352 // qDebug("xxxxxxxxxxxxxxxxxxxxx ");
346 // QWidget* test = new QWidget(); 353 // QWidget* test = new QWidget();
347 // test->setBackgroundMode(FixedPixmap ); 354 // test->setBackgroundMode(FixedPixmap );
348 // test->setBackgroundPixmap ( bPix ); 355 // test->setBackgroundPixmap ( bPix );
349 // test->resize( 300, 400 ); 356 // test->resize( 300, 400 );
350 // test->show(); 357 // test->show();
351 // mView->setBackgroundMode(FixedPixmap ); 358 // mView->setBackgroundMode(FixedPixmap );
352 // mView->setBackgroundPixmap ( bPix ); 359 // mView->setBackgroundPixmap ( bPix );
353 qDebug("%s ",mText.latin1()); 360 qDebug("%s ",mText.latin1());
354} 361}
355 362
356void KOWhatsNextView::appendDay( int i, QDate eventDate ) 363void KOWhatsNextView::appendDay( int i, QDate eventDate )
357{ 364{
358 QString date; 365 QString date;
359 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); 366 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer);
360 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { 367 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) {
361 if ( i == 0 ) { 368 if ( i == 0 ) {
362 mText += "<table>\n"; 369 mText += "<table>\n";
363 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; 370 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>";
364 } 371 }
365 else if ( i == 1 ) 372 else if ( i == 1 )
366 date = "<em><font color=\"#000080\">" + day + "</font></em>" ; 373 date = "<em><font color=\"#000080\">" + day + "</font></em>" ;
367 else date = "<em><font color=\"#000080\">" + day + "</font></em>"; 374 else date = "<em><font color=\"#000080\">" + day + "</font></em>";
368 //mText += "<h2>" + date + "</h2>\n"; 375 mText += "<h2>" + date + "</h2>\n";
369 mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 376 //mText += "<big><big><strong>" + date + "</strong></big></big>\n";
370 mText += "<table>\n"; 377 mText += "<table>\n";
371 378
372 379
373 380
374 } else { 381 } else {
375 if ( i == 0 ) { 382 if ( i == 0 ) {
376 mText += "<table>\n"; 383 mText += "<table>\n";
377 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; 384 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>";
378 } 385 }
379 386
380#ifdef DESKTOP_VERSION 387#ifdef DESKTOP_VERSION
381 else if ( i == 1 ) { 388 else if ( i == 1 ) {
382 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; 389 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ;
383 } 390 }
384 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; 391 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>";
385#else 392#else
386 else if ( i == 1 ) { 393 else if ( i == 1 ) {
387 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; 394 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ;
388 } 395 }
389 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; 396 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>";
390 397
391#endif 398#endif
392 //mText += "<h2>" + date + "</h2>\n"; 399 mText += "<h2>" + date + "</h2>\n";
393 mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 400 //mText += "<big><big><strong>" + date + "</strong></big></big>\n";
394 mText += "<table>\n"; 401 mText += "<table>\n";
395 } 402 }
396} 403}
397 404
398 405
399void KOWhatsNextView::showDates(const QDate &, const QDate &) 406void KOWhatsNextView::showDates(const QDate &, const QDate &)
400{ 407{
401 updateView(); 408 updateView();
402} 409}
403 410
404void KOWhatsNextView::showEvents(QPtrList<Event>) 411void KOWhatsNextView::showEvents(QPtrList<Event>)
405{ 412{
406} 413}
407 414
408void KOWhatsNextView::changeEventDisplay(Event *, int action) 415void KOWhatsNextView::changeEventDisplay(Event *, int action)
409{ 416{
410 switch(action) { 417 switch(action) {
411 case KOGlobals::EVENTADDED: 418 case KOGlobals::EVENTADDED:
412 updateView(); 419 updateView();
413 break; 420 break;
414 case KOGlobals::EVENTEDITED: 421 case KOGlobals::EVENTEDITED:
415 updateView(); 422 updateView();
416 break; 423 break;
417 case KOGlobals::EVENTDELETED: 424 case KOGlobals::EVENTDELETED: