summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-15 09:06:25 (UTC)
committer zautrix <zautrix>2005-06-15 09:06:25 (UTC)
commit820a1285559d0bb5859f634ebc6865f3a85a93ab (patch) (unidiff)
tree35278bfc95f131b4577d2f1d09c5915b5336e01a /korganizer
parentc50dea673d7bf65614e042a0e3c0c53c73c705a0 (diff)
downloadkdepimpi-820a1285559d0bb5859f634ebc6865f3a85a93ab.zip
kdepimpi-820a1285559d0bb5859f634ebc6865f3a85a93ab.tar.gz
kdepimpi-820a1285559d0bb5859f634ebc6865f3a85a93ab.tar.bz2
color fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--korganizer/kotodoviewitem.cpp7
2 files changed, 6 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index dd4ea41..1338224 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -373,192 +373,193 @@ void CalendarView::init()
373 mCurrentSyncDevice = ""; 373 mCurrentSyncDevice = "";
374 writeLocale(); 374 writeLocale();
375 mViewManager = new KOViewManager( this ); 375 mViewManager = new KOViewManager( this );
376 mDialogManager = new KODialogManager( this ); 376 mDialogManager = new KODialogManager( this );
377 mEventViewerDialog = 0; 377 mEventViewerDialog = 0;
378 mModified = false; 378 mModified = false;
379 mReadOnly = false; 379 mReadOnly = false;
380 mSelectedIncidence = 0; 380 mSelectedIncidence = 0;
381 mCalPrinter = 0; 381 mCalPrinter = 0;
382 mFilters.setAutoDelete(true); 382 mFilters.setAutoDelete(true);
383 383
384 mCalendar->registerObserver( this ); 384 mCalendar->registerObserver( this );
385 // TODO: Make sure that view is updated, when calendar is changed. 385 // TODO: Make sure that view is updated, when calendar is changed.
386 386
387 mStorage = new FileStorage( mCalendar ); 387 mStorage = new FileStorage( mCalendar );
388 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 388 mNavigator = new DateNavigator( this, "datevav", mViewManager );
389 389
390 QBoxLayout *topLayout = (QBoxLayout*)layout(); 390 QBoxLayout *topLayout = (QBoxLayout*)layout();
391#ifndef KORG_NOSPLITTER 391#ifndef KORG_NOSPLITTER
392 // create the main layout frames. 392 // create the main layout frames.
393 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 393 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
394 topLayout->addWidget(mPanner); 394 topLayout->addWidget(mPanner);
395 395
396 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 396 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
397 "CalendarView::LeftFrame"); 397 "CalendarView::LeftFrame");
398 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 398 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
399 399
400 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 400 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
401 "CalendarView::DateNavigator" ); 401 "CalendarView::DateNavigator" );
402 402
403 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 403 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
404 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 404 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
405 mTodoList->setNavigator( mNavigator ); 405 mTodoList->setNavigator( mNavigator );
406 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 406 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
407 407
408#ifdef KORG_NORESOURCEVIEW 408#ifdef KORG_NORESOURCEVIEW
409 mResourceView = 0; 409 mResourceView = 0;
410#else 410#else
411 if ( mResourceManager ) { 411 if ( mResourceManager ) {
412 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 412 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
413 mResourceView->updateView(); 413 mResourceView->updateView();
414 connect( mResourceView, SIGNAL( resourcesChanged() ), 414 connect( mResourceView, SIGNAL( resourcesChanged() ),
415 SLOT( updateView() ) ); 415 SLOT( updateView() ) );
416 } else { 416 } else {
417 mResourceView = 0; 417 mResourceView = 0;
418 } 418 }
419#endif 419#endif
420 QWidget *rightBox = new QWidget( mPanner ); 420 QWidget *rightBox = new QWidget( mPanner );
421 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 421 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
422 422
423 mRightFrame = new QWidgetStack( rightBox ); 423 mRightFrame = new QWidgetStack( rightBox );
424 rightLayout->addWidget( mRightFrame, 1 ); 424 rightLayout->addWidget( mRightFrame, 1 );
425 425
426 mLeftFrame = mLeftSplitter; 426 mLeftFrame = mLeftSplitter;
427#else 427#else
428 //QWidget *mainBox = new QWidget( this ); 428 //QWidget *mainBox = new QWidget( this );
429 //QWidget *leftFrame = new QWidget( mainBox ); 429 //QWidget *leftFrame = new QWidget( mainBox );
430 //QBoxLayout * mainBoxLayout; 430 //QBoxLayout * mainBoxLayout;
431 if ( KOPrefs::instance()->mVerticalScreen ) { 431 if ( KOPrefs::instance()->mVerticalScreen ) {
432 //mainBoxLayout = new QVBoxLayout(mainBox); 432 //mainBoxLayout = new QVBoxLayout(mainBox);
433 //leftFrameLayout = new QHBoxLayout(leftFrame ); 433 //leftFrameLayout = new QHBoxLayout(leftFrame );
434 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 434 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
435 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 435 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
436 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 436 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
437 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 437 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
438 } else { 438 } else {
439 //mainBoxLayout = new QHBoxLayout(mainBox); 439 //mainBoxLayout = new QHBoxLayout(mainBox);
440 //leftFrameLayout = new QVBoxLayout(leftFrame ); 440 //leftFrameLayout = new QVBoxLayout(leftFrame );
441 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 441 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
442 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 442 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
443 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 443 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
444 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 444 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
445 } 445 }
446 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 446 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
447 //QBoxLayout * leftFrameLayout; 447 //QBoxLayout * leftFrameLayout;
448 topLayout->addWidget( mMainFrame ); 448 topLayout->addWidget( mMainFrame );
449 //mainBoxLayout->addWidget (mLeftFrame); 449 //mainBoxLayout->addWidget (mLeftFrame);
450 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 450 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
451 "CalendarView::DateNavigator" ); 451 "CalendarView::DateNavigator" );
452#if 0 452#if 0
453 // FIXME 453 // FIXME
454 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 454 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
455 "CalendarView::DateNavigator", QDate::currentDate()); 455 "CalendarView::DateNavigator", QDate::currentDate());
456#endif 456#endif
457 // mDateNavigator->blockSignals( true ); 457 // mDateNavigator->blockSignals( true );
458 //leftFrameLayout->addWidget( mDateNavigator ); 458 //leftFrameLayout->addWidget( mDateNavigator );
459 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 459 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
460 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 460 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
461 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 461 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
462 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); 462 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
463 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); 463 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
464 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); 464 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) );
465 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 465 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
466 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 466 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
467 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 467 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
468 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); 468 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
469 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
469 mTodoList->setNavigator( mNavigator ); 470 mTodoList->setNavigator( mNavigator );
470#if 0 471#if 0
471 if ( QApplication::desktop()->width() < 480 ) { 472 if ( QApplication::desktop()->width() < 480 ) {
472 leftFrameLayout->addWidget(mFilterView); 473 leftFrameLayout->addWidget(mFilterView);
473 leftFrameLayout->addWidget(mTodoList, 2 ); 474 leftFrameLayout->addWidget(mTodoList, 2 );
474 475
475 } else { 476 } else {
476 leftFrameLayout->addWidget(mTodoList,2 ); 477 leftFrameLayout->addWidget(mTodoList,2 );
477 leftFrameLayout->addWidget(mFilterView ); 478 leftFrameLayout->addWidget(mFilterView );
478 } 479 }
479#endif 480#endif
480 mFilterView->hide(); 481 mFilterView->hide();
481 mCalEditView->hide(); 482 mCalEditView->hide();
482 QWidget *rightBox = new QWidget( mMainFrame ); 483 QWidget *rightBox = new QWidget( mMainFrame );
483 //mainBoxLayout->addWidget ( rightBox, 10 ); 484 //mainBoxLayout->addWidget ( rightBox, 10 );
484 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 485 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
485 mRightFrame = new QWidgetStack( rightBox ); 486 mRightFrame = new QWidgetStack( rightBox );
486 rightLayout->addWidget( mRightFrame, 10 ); 487 rightLayout->addWidget( mRightFrame, 10 );
487 488
488 //mLeftFrame = (QWidget *)leftFrame; 489 //mLeftFrame = (QWidget *)leftFrame;
489 if ( KOPrefs::instance()->mVerticalScreen ) { 490 if ( KOPrefs::instance()->mVerticalScreen ) {
490 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 491 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
491 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 492 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
492 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 493 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
493 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 494 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
494 } else { 495 } else {
495 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 496 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
496 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 497 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
497 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 498 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
498 } 499 }
499 if ( !KOPrefs::instance()->mShowDateNavigator) 500 if ( !KOPrefs::instance()->mShowDateNavigator)
500 mDateNavigator->hide(); 501 mDateNavigator->hide();
501 //qDebug("Calendarview Size %d %d ", width(), height()); 502 //qDebug("Calendarview Size %d %d ", width(), height());
502#endif 503#endif
503 504
504 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 505 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
505 SLOT( showDates( const KCal::DateList & ) ) ); 506 SLOT( showDates( const KCal::DateList & ) ) );
506 507
507 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 508 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
508 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 509 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
509 510
510 511
511 512
512 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 513 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
513 mViewManager, SLOT( showMonth( const QDate & ) ) ); 514 mViewManager, SLOT( showMonth( const QDate & ) ) );
514 515
515 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 516 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
516 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 517 mNavigator, SLOT( selectWeek( const QDate & ) ) );
517 518
518 connect( mDateNavigator, SIGNAL( goPrevYear() ), 519 connect( mDateNavigator, SIGNAL( goPrevYear() ),
519 mNavigator, SLOT( selectPreviousYear() ) ); 520 mNavigator, SLOT( selectPreviousYear() ) );
520 connect( mDateNavigator, SIGNAL( goNextYear() ), 521 connect( mDateNavigator, SIGNAL( goNextYear() ),
521 mNavigator, SLOT( selectNextYear() ) ); 522 mNavigator, SLOT( selectNextYear() ) );
522 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 523 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
523 mNavigator, SLOT( selectPreviousMonth() ) ); 524 mNavigator, SLOT( selectPreviousMonth() ) );
524 connect( mDateNavigator, SIGNAL( goNextMonth() ), 525 connect( mDateNavigator, SIGNAL( goNextMonth() ),
525 mNavigator, SLOT( selectNextMonth() ) ); 526 mNavigator, SLOT( selectNextMonth() ) );
526 527
527 connect( mDateNavigator, SIGNAL( goPrevious() ), 528 connect( mDateNavigator, SIGNAL( goPrevious() ),
528 mNavigator, SLOT( selectPrevious() ) ); 529 mNavigator, SLOT( selectPrevious() ) );
529 connect( mDateNavigator, SIGNAL( goNext() ), 530 connect( mDateNavigator, SIGNAL( goNext() ),
530 mNavigator, SLOT( selectNext() ) ); 531 mNavigator, SLOT( selectNext() ) );
531 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 532 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
532 mNavigator, SLOT( slotMonthSelect( int ) ) ); 533 mNavigator, SLOT( slotMonthSelect( int ) ) );
533 534
534 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 535 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
535 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 536 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
536#if 0 537#if 0
537 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 538 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
538 SLOT( incidenceAdded( Incidence *) ) ); 539 SLOT( incidenceAdded( Incidence *) ) );
539#endif 540#endif
540 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 541 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
541 542
542 connect( this, SIGNAL( configChanged() ), 543 connect( this, SIGNAL( configChanged() ),
543 mDateNavigator, SLOT( updateConfig() ) ); 544 mDateNavigator, SLOT( updateConfig() ) );
544 545
545 connect( mTodoList, SIGNAL( newTodoSignal() ), 546 connect( mTodoList, SIGNAL( newTodoSignal() ),
546 SLOT( newTodo() ) ); 547 SLOT( newTodo() ) );
547 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 548 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
548 SLOT( newSubTodo( Todo * ) ) ); 549 SLOT( newSubTodo( Todo * ) ) );
549 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 550 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
550 SLOT( editTodo( Todo * ) ) ); 551 SLOT( editTodo( Todo * ) ) );
551 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 552 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
552 SLOT( showTodo( Todo *) ) ); 553 SLOT( showTodo( Todo *) ) );
553 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 554 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
554 SLOT( deleteTodo( Todo *) ) ); 555 SLOT( deleteTodo( Todo *) ) );
555 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 556 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
556 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 557 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
557 SLOT( purgeCompleted() ) ); 558 SLOT( purgeCompleted() ) );
558 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 559 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
559 SIGNAL( todoModified( Todo *, int ) ) ); 560 SIGNAL( todoModified( Todo *, int ) ) );
560 561
561 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 562 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
562 this, SLOT ( cloneIncidence( Incidence * ) ) ); 563 this, SLOT ( cloneIncidence( Incidence * ) ) );
563 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 564 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
564 this, SLOT (cancelIncidence( Incidence * ) ) ); 565 this, SLOT (cancelIncidence( Incidence * ) ) );
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index f987b63..748f3e4 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -275,200 +275,203 @@ void KOTodoViewItem::stateChange(bool state)
275 setText(6,""); 275 setText(6,"");
276 } 276 }
277 else { 277 else {
278 setText(6,mTodo->dtStartTimeStr()); 278 setText(6,mTodo->dtStartTimeStr());
279 QTime t = mTodo->dtStart().time(); 279 QTime t = mTodo->dtStart().time();
280 skeyt.sprintf("%02d%02d",t.hour(),t.minute()); 280 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
281 281
282 } 282 }
283 setSortKey(5,skeyd); 283 setSortKey(5,skeyd);
284 setSortKey(6,skeyt); 284 setSortKey(6,skeyt);
285 } 285 }
286 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); 286 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt);
287 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 287 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
288 288
289 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 289 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
290 if (mTodo->percentComplete()<100) { 290 if (mTodo->percentComplete()<100) {
291 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 291 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
292 else setSortKey(2,QString::number(mTodo->percentComplete())); 292 else setSortKey(2,QString::number(mTodo->percentComplete()));
293 } 293 }
294 else { 294 else {
295 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 295 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
296 else setSortKey(2,QString::number(99)); 296 else setSortKey(2,QString::number(99));
297 } 297 }
298 if ( state ) { 298 if ( state ) {
299 QListViewItem * myChild = firstChild(); 299 QListViewItem * myChild = firstChild();
300 KOTodoViewItem *item; 300 KOTodoViewItem *item;
301 while( myChild ) { 301 while( myChild ) {
302 //qDebug("stateCH "); 302 //qDebug("stateCH ");
303 item = static_cast<KOTodoViewItem*>(myChild); 303 item = static_cast<KOTodoViewItem*>(myChild);
304 item->stateChange(state); 304 item->stateChange(state);
305 myChild = myChild->nextSibling(); 305 myChild = myChild->nextSibling();
306 } 306 }
307 } else { 307 } else {
308 QListViewItem * myChild = parent(); 308 QListViewItem * myChild = parent();
309 if ( myChild ) 309 if ( myChild )
310 (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); 310 (static_cast<KOTodoViewItem*>(myChild))->stateChange(state);
311 } 311 }
312 mTodoView->modified(true); 312 mTodoView->modified(true);
313 setMyPixmap(); 313 setMyPixmap();
314 mTodoView->setTodoModified( mTodo ); 314 mTodoView->setTodoModified( mTodo );
315} 315}
316 316
317bool KOTodoViewItem::isAlternate() 317bool KOTodoViewItem::isAlternate()
318{ 318{
319 319
320 KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); 320 KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
321 if (lv && lv->alternateBackground().isValid()) 321 if (lv && lv->alternateBackground().isValid())
322 { 322 {
323 KOTodoViewItem *above = 0; 323 KOTodoViewItem *above = 0;
324 above = static_cast<KOTodoViewItem *>(itemAbove()); 324 above = static_cast<KOTodoViewItem *>(itemAbove());
325 m_known = above ? above->m_known : true; 325 m_known = above ? above->m_known : true;
326 if (m_known) 326 if (m_known)
327 { 327 {
328 m_odd = above ? !above->m_odd : false; 328 m_odd = above ? !above->m_odd : false;
329 } 329 }
330 else 330 else
331 { 331 {
332 KOTodoViewItem *item; 332 KOTodoViewItem *item;
333 bool previous = true; 333 bool previous = true;
334 if (QListViewItem::parent()) 334 if (QListViewItem::parent())
335 { 335 {
336 item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); 336 item = static_cast<KOTodoViewItem *>(QListViewItem::parent());
337 if (item) 337 if (item)
338 previous = item->m_odd; 338 previous = item->m_odd;
339 item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); 339 item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild());
340 } 340 }
341 else 341 else
342 { 342 {
343 item = static_cast<KOTodoViewItem *>(lv->firstChild()); 343 item = static_cast<KOTodoViewItem *>(lv->firstChild());
344 } 344 }
345 345
346 while(item) 346 while(item)
347 { 347 {
348 item->m_odd = previous = !previous; 348 item->m_odd = previous = !previous;
349 item->m_known = true; 349 item->m_known = true;
350 item = static_cast<KOTodoViewItem *>(item->nextSibling()); 350 item = static_cast<KOTodoViewItem *>(item->nextSibling());
351 } 351 }
352 } 352 }
353 return m_odd; 353 return m_odd;
354 } 354 }
355 return false; 355 return false;
356} 356}
357 357
358void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) 358void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
359{ 359{
360 QColorGroup _cg = cg; 360 QColorGroup _cg = cg;
361 QColorGroup::ColorRole role; 361 QColorGroup::ColorRole role;
362 if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) 362 if ( KOPrefs::instance()->mTodoViewUsesForegroundColor )
363 role = QColorGroup::Text; 363 role = QColorGroup::Text;
364 else 364 else
365 role = QColorGroup::Base; 365 role = QColorGroup::Base;
366 //#ifndef KORG_NOLVALTERNATION 366 //#ifndef KORG_NOLVALTERNATION
367 if (isAlternate()) 367 if (isAlternate())
368 _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); 368 _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground());
369 bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; 369 bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors;
370 QColor colorToSet; 370 QColor colorToSet;
371 if ( setColor ) { 371 if ( column == 0 && mTodo->calID() > 1 ) {
372 setColor = true;
373 colorToSet = KOPrefs::instance()->defaultColor( mTodo->calID() );
374 } else if ( setColor ) {
372 QStringList categories = mTodo->categories(); 375 QStringList categories = mTodo->categories();
373 QString cat = categories.first(); 376 QString cat = categories.first();
374 if ( !cat.isEmpty()) { 377 if ( !cat.isEmpty()) {
375 colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); 378 colorToSet = *(KOPrefs::instance()->categoryColor(cat) );
376 } else 379 } else
377 setColor = false; 380 setColor = false;
378 } 381 }
379 bool openMode = !isOpen(); 382 bool openMode = !isOpen();
380 // maybe we are in flat-display-mode 383 // maybe we are in flat-display-mode
381 if ( !firstChild() ) 384 if ( !firstChild() )
382 openMode = false; 385 openMode = false;
383 bool colorRunning = mTodo->isRunning(); 386 bool colorRunning = mTodo->isRunning();
384 if ( ! colorRunning && openMode ) 387 if ( ! colorRunning && openMode )
385 colorRunning = mTodo->hasRunningSub(); 388 colorRunning = mTodo->hasRunningSub();
386 if ( colorRunning ) { 389 if ( colorRunning ) {
387 setColor = true; 390 setColor = true;
388 colorToSet = KOPrefs::instance()->mTodoRunColor; 391 colorToSet = KOPrefs::instance()->mTodoRunColor;
389 } else { 392 } else {
390 int odue = mTodo->hasDueSubTodo( openMode ); 393 int odue = mTodo->hasDueSubTodo( openMode );
391 if (odue == 2) { 394 if (odue == 2) {
392 colorToSet = KOPrefs::instance()->mTodoOverdueColor; 395 colorToSet = KOPrefs::instance()->mTodoOverdueColor;
393 setColor = true; 396 setColor = true;
394 } else if ( odue == 1 ) { 397 } else if ( odue == 1 ) {
395 colorToSet = KOPrefs::instance()->mTodoDueTodayColor; 398 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
396 setColor = true; 399 setColor = true;
397 } 400 }
398 } 401 }
399 402
400 403
401 if ( setColor ) { 404 if ( setColor ) {
402 _cg.setColor(role,colorToSet ); 405 _cg.setColor(role,colorToSet );
403 if ( role == QColorGroup::Base) { 406 if ( role == QColorGroup::Base) {
404 int rgb = colorToSet.red(); 407 int rgb = colorToSet.red();
405 rgb += colorToSet.blue()/2; 408 rgb += colorToSet.blue()/2;
406 rgb += colorToSet.green(); 409 rgb += colorToSet.green();
407 if ( rgb < 200 ) 410 if ( rgb < 200 )
408 _cg.setColor(QColorGroup::Text,Qt::white ); 411 _cg.setColor(QColorGroup::Text,Qt::white );
409 } 412 }
410 } 413 }
411 //#endif 414 //#endif
412 if ( column > 0 ){ 415 if ( column > 0 ){
413 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { 416 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) {
414 p->save(); 417 p->save();
415 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); 418 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5);
416 419
417 p->fillRect( 0, 0, width, height(), _cg.base() ); // background 420 p->fillRect( 0, 0, width, height(), _cg.base() ); // background
418 // p->setPen(Qt::black ); //border 421 // p->setPen(Qt::black ); //border
419 // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling 422 // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling
420 QColor fc = KOPrefs::instance()->mHighlightColor; 423 QColor fc = KOPrefs::instance()->mHighlightColor;
421 if ( mTodo->percentComplete() == 100 ) 424 if ( mTodo->percentComplete() == 100 )
422 fc = darkGreen; 425 fc = darkGreen;
423 p->drawRect( 2, 2, width-4, height()-4); 426 p->drawRect( 2, 2, width-4, height()-4);
424 p->fillRect( 3, 3, progress, height()-6, 427 p->fillRect( 3, 3, progress, height()-6,
425 fc ); 428 fc );
426 p->restore(); 429 p->restore();
427 } else { 430 } else {
428 QCheckListItem::paintCell(p, _cg, column, width, alignment); 431 QCheckListItem::paintCell(p, _cg, column, width, alignment);
429 } 432 }
430 return; 433 return;
431 } 434 }
432 435
433 int align = alignment; 436 int align = alignment;
434 437
435 if ( !p ) 438 if ( !p )
436 return; 439 return;
437 440
438 p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); 441 p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) );
439 442
440 QListView *lv = listView(); 443 QListView *lv = listView();
441 if ( !lv ) 444 if ( !lv )
442 return; 445 return;
443 int marg = 2;//lv->itemMargin(); 446 int marg = 2;//lv->itemMargin();
444 int r = 0; 447 int r = 0;
445 QCheckListItem::Type myType = QCheckListItem::CheckBox; 448 QCheckListItem::Type myType = QCheckListItem::CheckBox;
446 int BoxSize = 20; 449 int BoxSize = 20;
447 int boxOffset = 2; 450 int boxOffset = 2;
448 int xOffset = 2; 451 int xOffset = 2;
449 if (qApp->desktop()->width() < 300 ) { 452 if (qApp->desktop()->width() < 300 ) {
450 BoxSize = 14; 453 BoxSize = 14;
451 boxOffset = -1; 454 boxOffset = -1;
452 xOffset = 1; 455 xOffset = 1;
453 // marg = 0; 456 // marg = 0;
454 } 457 }
455 if ( height() < BoxSize ) { 458 if ( height() < BoxSize ) {
456 boxOffset = boxOffset - ((BoxSize - height())/2) ; 459 boxOffset = boxOffset - ((BoxSize - height())/2) ;
457 // qDebug("boxOffset %d height %d", boxOffset, height() ); 460 // qDebug("boxOffset %d height %d", boxOffset, height() );
458 BoxSize = height(); 461 BoxSize = height();
459 462
460 } 463 }
461 //bool winStyle = lv->style() == WindowsStyle; 464 //bool winStyle = lv->style() == WindowsStyle;
462 465
463 int lineStart = 5; 466 int lineStart = 5;
464 if ( myType == Controller ) { 467 if ( myType == Controller ) {
465 if ( !pixmap( 0 ) ) 468 if ( !pixmap( 0 ) )
466 r += BoxSize + 4; 469 r += BoxSize + 4;
467 } else { 470 } else {
468 ASSERT( lv ); //### 471 ASSERT( lv ); //###
469 //QFontMetrics fm( lv->font() ); 472 //QFontMetrics fm( lv->font() );
470 //int d = fm.height(); 473 //int d = fm.height();
471 int x = 0; 474 int x = 0;
472 int y = (height() - BoxSize) / 2; 475 int y = (height() - BoxSize) / 2;
473 //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); 476 //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) );
474 if ( myType == CheckBox ) { 477 if ( myType == CheckBox ) {