summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
Unidiff
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp96
1 files changed, 54 insertions, 42 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 5926abe..ffb2e1e 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -94,3 +94,3 @@ QString KNoScrollListBox::getWhatsThisText(QPoint p)
94 if ( ! item ) { 94 if ( ! item ) {
95 return i18n("Click in the cell\nto add an event!"); 95 return i18n("Click in the cell\nto add an event!");
96 } 96 }
@@ -321,3 +321,3 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
321 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), 321 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ),
322 SLOT( selection( QListBoxItem * ) ) ); 322 SLOT( selection( QListBoxItem * ) ) );
323 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), 323 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
@@ -554,39 +554,40 @@ void MonthViewCell::insertTodo(Todo *todo)
554{ 554{
555 QString text; 555 QString text;
556 if (todo->hasDueDate()) { 556 mItemList->setFocusPolicy(WheelFocus);
557 if (!todo->doesFloat()) { 557 if (todo->hasDueDate()) {
558 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 558 if (!todo->doesFloat()) {
559 text += " "; 559 text += KGlobal::locale()->formatTime(todo->dtDue().time());
560 } 560 text += " ";
561 } 561 }
562 text += i18n("Td: %1").arg(todo->summary()); 562 }
563 563 text += i18n("T: %1").arg(todo->summary());
564 MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 564
565 //item->setPalette( mStandardPalette ); 565 MonthViewItem *item = new MonthViewItem( todo, mDate, text );
566 QPalette pal; 566 //item->setPalette( mStandardPalette );
567 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 567 QPalette pal;
568 QStringList categories = todo->categories(); 568 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
569 QString cat = categories.first(); 569 QStringList categories = todo->categories();
570 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 570 QString cat = categories.first();
571 pal = getPalette(); 571 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
572 if (cat.isEmpty()) { 572 pal = getPalette();
573 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 573 if (cat.isEmpty()) {
574 } else { 574 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
575 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
576 }
577
578 } else { 575 } else {
579 if (cat.isEmpty()) { 576 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
580 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
581 } else {
582 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
583 }
584 } 577 }
585 578
586 } else { 579 } else {
587 pal = mStandardPalette ; 580 if (cat.isEmpty()) {
581 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
582 } else {
583 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
584 }
588 } 585 }
589 item->setPalette( pal ); 586
590 mItemList->insertItem( item ); 587 } else {
591 mToolTip += text+"\n"; 588 pal = mStandardPalette ;
589 }
590 item->setPalette( pal );
591 mItemList->insertItem( item );
592 mToolTip += text+"\n";
592} 593}
@@ -784,3 +785,2 @@ void MonthViewCell::selection( QListBoxItem *item )
784 if ( !item ) return; 785 if ( !item ) return;
785
786 mMonthView->setSelectedCell( this ); 786 mMonthView->setSelectedCell( this );
@@ -1267,5 +1267,11 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
1267 if ( ignoreResizeEvent ) { 1267 if ( ignoreResizeEvent ) {
1268 qDebug("KOMonthView::resizeEvent ignored "); 1268 int diff = e->size().height() - e->oldSize().height();
1269 --ignoreResizeEvent; 1269 if ( diff < 0 )
1270 return; 1270 diff = diff * (-1);
1271 if ( diff == ignoreResizeEventHeight ) {
1272 qDebug("KOMonthView::resizeEvent ignored ");
1273 --ignoreResizeEvent;
1274 return;
1275 }
1276 ignoreResizeEvent = 0;
1271 } 1277 }
@@ -1513,3 +1519,3 @@ void KOMonthView::setSelectedCell( MonthViewCell *cell )
1513{ 1519{
1514 // qDebug("KOMonthView::setSelectedCell "); 1520 //qDebug("KOMonthView::setSelectedCell %x ", cell);
1515 if ( mSelectedCell && mSelectedCell != cell ) { 1521 if ( mSelectedCell && mSelectedCell != cell ) {
@@ -1552,3 +1558,6 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
1552 emit prevMonth(); 1558 emit prevMonth();
1553 mCells[0]->setFocus(); 1559 if ( mShowWeekView )
1560 mCellsW[0]->setFocus();
1561 else
1562 mCells[0]->setFocus();
1554 } 1563 }
@@ -1559,4 +1568,7 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
1559 emit nextMonth(); 1568 emit nextMonth();
1560 mCells[0]->setFocus(); 1569 if ( mShowWeekView )
1561 1570 mCellsW[0]->setFocus();
1571 else
1572 mCells[0]->setFocus();
1573
1562 } 1574 }