From c26c9e0aa8c8a3b1d3e8dba018d56dbdb67c65b4 Mon Sep 17 00:00:00 2001 From: zautrix Date: Tue, 28 Jun 2005 09:52:05 +0000 Subject: fixes --- (limited to 'korganizer/komonthview.cpp') diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 1c2d6a2..264cf28 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -370,10 +370,24 @@ void MonthViewItem::paint(QPainter *p) x += size + 1; } } + + + + + if ( sel ) p->setPen( Qt::white ); + else p->setPen( palette().color( QPalette::Normal,QColorGroup::Foreground ) ); + +#if 0 + p->setPen( palette().color( QPalette::Normal, sel ? \ + QColorGroup::HighlightedText : QColorGroup::Foreground ) ); +#endif + QColor textColor = p->pen().color(); + + if ( mMultiday ) { int yyy = y+(size/2); int sizeM = size+2; - p->setBrush( QBrush( p->pen().color() ) ); + p->setBrush( QBrush( textColor ) ); p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; if ( mMultiday == 2 || mMultiday == 3 ) { QPointArray pa ( 3 ); @@ -412,7 +426,7 @@ void MonthViewItem::paint(QPainter *p) } else { int val = td->percentComplete()/20; - p->fillRect ( x+1, y-2, val ,size+4,p->pen().color() ); + p->fillRect ( x+1, y-2, val ,size+4,textColor ); p->drawRect ( x, y-2,7,size+4); x += size + 3; } @@ -424,8 +438,7 @@ void MonthViewItem::paint(QPainter *p) yPos = fm.ascent() + fm.leading()/2; else yPos = pmheight/2 - fm.height()/2 + fm.ascent(); - p->setPen( palette().color( QPalette::Normal, sel ? \ - QColorGroup::HighlightedText : QColorGroup::Foreground ) ); + if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { p->drawText( x, yPos, text() ); if ( mIncidence->cancelled() ) { @@ -617,7 +630,7 @@ void MonthViewCell::setHoliday( const QString &holiday ) void MonthViewCell::startUpdateCell() { - + blockSignals( true ); mdayCount = 0; setFocusPolicy(NoFocus); if ( !mMonthView->isUpdatePossible() ) @@ -881,6 +894,7 @@ void MonthViewCell::repaintfinishUpdateCell() updateItem ( mitem ); mitem = (MonthViewItem *)mitem->next(); } + blockSignals( false ); } void MonthViewCell::finishUpdateCell() { @@ -1026,15 +1040,14 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e ) mLabel->setMaximumHeight( height() - lineWidth()*2 ); QString text; - mLabel->setText( text ); + //mLabel->setText( text ); bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { - text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; + text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " " + QString::number( mDate.day() ); mLabel->resize( mLabelBigSize ); - text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); } else { mLabel->resize( mLabelSize ); - text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); + text = QString::number( mDate.day() ); } mLabel->setText( text ); @@ -1337,7 +1350,6 @@ KOMonthView::~KOMonthView() void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) { - qDebug("11 KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); static Incidence * lastInc = 0; static MonthViewCell * lastCell = 0; @@ -1345,7 +1357,7 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int return; lastInc = inc; lastCell = mc; - qDebug("222 KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); + //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); bool weekview = false; int index = 0; @@ -1369,10 +1381,35 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int cells = &mCells; } for (uint i = 0; i < (*cells).count(); ++i) { - (*cells)[i]->deHighLight(); + (*cells)[i]->deHighLight(); } if ( ! inc ) return; + + int count = (*cells).count(); + bool goLeft = (mday > 1 && index > 0); + bool goRight = (mday < 3 && mday > 0 && index < count -1); + for (uint iii = 1; iii < count; ++iii) { + if ( goLeft ) { + int left = index - iii; + if ( left >= 0 ) { + if ( (*cells)[(uint)left]->doHighLight(inc) ) + goLeft = false; + } else + goLeft = false; + } + if ( goRight ) { + int right = index + iii; + if ( right < count ) { + if ( (*cells)[right]->doHighLight(inc) ) + goRight = false; + + } else + goRight = false; + } + + } +#if 0 if ( mday > 1 && index > 0 ) for (int i = index-1; i >= 0; --i) { //qDebug("index %d iii %d ", index, i); @@ -1384,6 +1421,7 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int if ( (*cells)[i]->doHighLight(inc) ) break; } +#endif } void KOMonthView::selectInternalWeekNum ( int n ) @@ -1721,7 +1759,8 @@ void KOMonthView::updateView() processSelectionChange(); //qApp->processEvents(); for( i = 0; i < timeSpan+1; ++i ) { - (*cells)[i]->repaintfinishUpdateCell(); + //(*cells)[i]->repaintfinishUpdateCell(); + QTimer::singleShot( 0, (*cells)[i], SLOT ( repaintfinishUpdateCell() ) ); } setKeyBFocus(); #else -- cgit v0.9.0.2