summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-15 09:06:25 (UTC)
committer zautrix <zautrix>2005-06-15 09:06:25 (UTC)
commit820a1285559d0bb5859f634ebc6865f3a85a93ab (patch) (unidiff)
tree35278bfc95f131b4577d2f1d09c5915b5336e01a
parentc50dea673d7bf65614e042a0e3c0c53c73c705a0 (diff)
downloadkdepimpi-820a1285559d0bb5859f634ebc6865f3a85a93ab.zip
kdepimpi-820a1285559d0bb5859f634ebc6865f3a85a93ab.tar.gz
kdepimpi-820a1285559d0bb5859f634ebc6865f3a85a93ab.tar.bz2
color fixes
Diffstat (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
@@ -437,64 +437,65 @@ void CalendarView::init()
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();
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index f987b63..748f3e4 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -339,72 +339,75 @@ bool KOTodoViewItem::isAlternate()
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 }