-rw-r--r-- | korganizer/komonthview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 678cab6..c868270 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -337,97 +337,97 @@ void MonthViewItem::paint(QPainter *p) | |||
337 | x += size + 1; | 337 | x += size + 1; |
338 | } | 338 | } |
339 | if ( mRecur ) { | 339 | if ( mRecur ) { |
340 | p->fillRect ( x, y,size,size, Qt::blue ); | 340 | p->fillRect ( x, y,size,size, Qt::blue ); |
341 | x += size + 1; | 341 | x += size + 1; |
342 | } | 342 | } |
343 | if ( mAlarm ) { | 343 | if ( mAlarm ) { |
344 | p->fillRect ( x, y,size,size, Qt::red ); | 344 | p->fillRect ( x, y,size,size, Qt::red ); |
345 | x += size + 1; | 345 | x += size + 1; |
346 | } | 346 | } |
347 | if ( mReply ) { | 347 | if ( mReply ) { |
348 | p->fillRect ( x, y,size,size, Qt::yellow ); | 348 | p->fillRect ( x, y,size,size, Qt::yellow ); |
349 | x += size + 1; | 349 | x += size + 1; |
350 | } | 350 | } |
351 | } | 351 | } |
352 | if ( mMultiday ) { | 352 | if ( mMultiday ) { |
353 | int yyy = y+(size/2); | 353 | int yyy = y+(size/2); |
354 | int sizeM = size+2; | 354 | int sizeM = size+2; |
355 | p->setBrush( QBrush::SolidPattern ); | 355 | p->setBrush( QBrush::SolidPattern ); |
356 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; | 356 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; |
357 | if ( mMultiday == 2 || mMultiday == 3 ) { | 357 | if ( mMultiday == 2 || mMultiday == 3 ) { |
358 | QPointArray pa ( 3 ); | 358 | QPointArray pa ( 3 ); |
359 | pa.setPoint (0, x, yyy ); | 359 | pa.setPoint (0, x, yyy ); |
360 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 360 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
361 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 361 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
362 | p->drawPolygon( pa ); | 362 | p->drawPolygon( pa ); |
363 | } | 363 | } |
364 | if ( mMultiday == 2 || mMultiday == 1 ) { | 364 | if ( mMultiday == 2 || mMultiday == 1 ) { |
365 | QPointArray pa ( 3 ); | 365 | QPointArray pa ( 3 ); |
366 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | 366 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); |
367 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | 367 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); |
368 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | 368 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); |
369 | p->drawPolygon( pa ); | 369 | p->drawPolygon( pa ); |
370 | } | 370 | } |
371 | if ( mMultiday == 1 ) { | 371 | if ( mMultiday == 1 ) { |
372 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 372 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
373 | 373 | ||
374 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); | 374 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); |
375 | } | 375 | } |
376 | if ( mMultiday == 3 ) { | 376 | if ( mMultiday == 3 ) { |
377 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 377 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
378 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); | 378 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); |
379 | 379 | ||
380 | } | 380 | } |
381 | x += sizeM/2 + 1; | 381 | x += sizeM/2 + 1; |
382 | x += sizeM + 1; | 382 | x += sizeM + 1; |
383 | } | 383 | } |
384 | 384 | ||
385 | if ( mIncidence->type() == "Todo" ){ | 385 | if ( mIncidence->typeID() == todoID ){ |
386 | Todo* td = ( Todo* ) mIncidence; | 386 | Todo* td = ( Todo* ) mIncidence; |
387 | if ( td->isCompleted() ) { | 387 | if ( td->isCompleted() ) { |
388 | int half = size/2; | 388 | int half = size/2; |
389 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; | 389 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; |
390 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; | 390 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; |
391 | x += half+half + 4; | 391 | x += half+half + 4; |
392 | 392 | ||
393 | } else { | 393 | } else { |
394 | int val = td->percentComplete()/20; | 394 | int val = td->percentComplete()/20; |
395 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); | 395 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); |
396 | p->drawRect ( x, y-2,7,size+4); | 396 | p->drawRect ( x, y-2,7,size+4); |
397 | x += size + 3; | 397 | x += size + 3; |
398 | } | 398 | } |
399 | } | 399 | } |
400 | QFontMetrics fm = p->fontMetrics(); | 400 | QFontMetrics fm = p->fontMetrics(); |
401 | int yPos; | 401 | int yPos; |
402 | int pmheight = size; | 402 | int pmheight = size; |
403 | if( pmheight < fm.height() ) | 403 | if( pmheight < fm.height() ) |
404 | yPos = fm.ascent() + fm.leading()/2; | 404 | yPos = fm.ascent() + fm.leading()/2; |
405 | else | 405 | else |
406 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 406 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
407 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 407 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
408 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 408 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
409 | if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { | 409 | if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { |
410 | p->drawText( x, yPos, text() ); | 410 | p->drawText( x, yPos, text() ); |
411 | if ( mIncidence->cancelled() ) { | 411 | if ( mIncidence->cancelled() ) { |
412 | int wid = fm.width( text() ); | 412 | int wid = fm.width( text() ); |
413 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 413 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
414 | } | 414 | } |
415 | } else { | 415 | } else { |
416 | QString pText = text(); | 416 | QString pText = text(); |
417 | if( pText.mid(2,1) == ":" ) | 417 | if( pText.mid(2,1) == ":" ) |
418 | pText = pText.mid( 6 ); | 418 | pText = pText.mid( 6 ); |
419 | p->drawText( x, yPos, pText ); | 419 | p->drawText( x, yPos, pText ); |
420 | if ( mIncidence->cancelled() ) { | 420 | if ( mIncidence->cancelled() ) { |
421 | int wid = fm.width( pText ); | 421 | int wid = fm.width( pText ); |
422 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 422 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
423 | } | 423 | } |
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
427 | int MonthViewItem::height(const QListBox *lb) const | 427 | int MonthViewItem::height(const QListBox *lb) const |
428 | { | 428 | { |
429 | int ret = 10; | 429 | int ret = 10; |
430 | if ( lb ) | 430 | if ( lb ) |
431 | ret = lb->fontMetrics().lineSpacing()+1; | 431 | ret = lb->fontMetrics().lineSpacing()+1; |
432 | return ret; | 432 | return ret; |
433 | } | 433 | } |
@@ -1898,97 +1898,97 @@ void KOMonthView::computeLayout() | |||
1898 | max = h-h/2; | 1898 | max = h-h/2; |
1899 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1899 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); |
1900 | y -= h/2; | 1900 | y -= h/2; |
1901 | } | 1901 | } |
1902 | } else { | 1902 | } else { |
1903 | max = h; | 1903 | max = h; |
1904 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1904 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1905 | } | 1905 | } |
1906 | 1906 | ||
1907 | } | 1907 | } |
1908 | else { | 1908 | else { |
1909 | max = h; | 1909 | max = h; |
1910 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1910 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1911 | } | 1911 | } |
1912 | x += w; | 1912 | x += w; |
1913 | if ( x + w/2 > wid ) { | 1913 | if ( x + w/2 > wid ) { |
1914 | x = 0; | 1914 | x = 0; |
1915 | y += h; | 1915 | y += h; |
1916 | } | 1916 | } |
1917 | //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); | 1917 | //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); |
1918 | } | 1918 | } |
1919 | y= dayLabelHei; | 1919 | y= dayLabelHei; |
1920 | h = cellHei ; | 1920 | h = cellHei ; |
1921 | for ( i = 0; i < 6; i++) { | 1921 | for ( i = 0; i < 6; i++) { |
1922 | if ( i == (6-rowModulo)) | 1922 | if ( i == (6-rowModulo)) |
1923 | ++h; | 1923 | ++h; |
1924 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1924 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1925 | y += h; | 1925 | y += h; |
1926 | } | 1926 | } |
1927 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1927 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1928 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1928 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1929 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1929 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1930 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; | 1930 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; |
1931 | updateDayLabels(); | 1931 | updateDayLabels(); |
1932 | //bool forceUpdate = !updatePossible; | 1932 | //bool forceUpdate = !updatePossible; |
1933 | updatePossible = true; | 1933 | updatePossible = true; |
1934 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1934 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1935 | } | 1935 | } |
1936 | 1936 | ||
1937 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1937 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1938 | { | 1938 | { |
1939 | if( incidence ) | 1939 | if( incidence ) |
1940 | mContextMenu->showIncidencePopup(incidence); | 1940 | mContextMenu->showIncidencePopup(incidence); |
1941 | else { | 1941 | else { |
1942 | //qDebug("KOMonthView::showContextMenu "); | 1942 | //qDebug("KOMonthView::showContextMenu "); |
1943 | mNewItemMenu->popup(QCursor::pos()); | 1943 | mNewItemMenu->popup(QCursor::pos()); |
1944 | } | 1944 | } |
1945 | /* | 1945 | /* |
1946 | if( incidence && incidence->type() == "Event" ) { | 1946 | if( incidence && incidence->typeID() == eventID ) { |
1947 | Event *event = static_cast<Event *>(incidence); | 1947 | Event *event = static_cast<Event *>(incidence); |
1948 | mContextMenu->showEventPopup(event); | 1948 | mContextMenu->showEventPopup(event); |
1949 | } else { | 1949 | } else { |
1950 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1950 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1951 | } | 1951 | } |
1952 | */ | 1952 | */ |
1953 | } | 1953 | } |
1954 | MonthViewCell * KOMonthView::selectedCell( ) | 1954 | MonthViewCell * KOMonthView::selectedCell( ) |
1955 | { | 1955 | { |
1956 | return mSelectedCell; | 1956 | return mSelectedCell; |
1957 | } | 1957 | } |
1958 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1958 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1959 | { | 1959 | { |
1960 | //qDebug("KOMonthView::setSelectedCell %d", cell); | 1960 | //qDebug("KOMonthView::setSelectedCell %d", cell); |
1961 | if ( mSelectedCell && mSelectedCell != cell ) { | 1961 | if ( mSelectedCell && mSelectedCell != cell ) { |
1962 | MonthViewCell * mvc = mSelectedCell; | 1962 | MonthViewCell * mvc = mSelectedCell; |
1963 | mSelectedCell = cell; | 1963 | mSelectedCell = cell; |
1964 | mvc->deselect(); | 1964 | mvc->deselect(); |
1965 | } else | 1965 | } else |
1966 | mSelectedCell = cell; | 1966 | mSelectedCell = cell; |
1967 | // if ( mSelectedCell ) | 1967 | // if ( mSelectedCell ) |
1968 | // mSelectedCell->select(); | 1968 | // mSelectedCell->select(); |
1969 | if ( !mSelectedCell ) | 1969 | if ( !mSelectedCell ) |
1970 | emit incidenceSelected( 0 ); | 1970 | emit incidenceSelected( 0 ); |
1971 | else | 1971 | else |
1972 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1972 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1973 | } | 1973 | } |
1974 | 1974 | ||
1975 | void KOMonthView::processSelectionChange() | 1975 | void KOMonthView::processSelectionChange() |
1976 | { | 1976 | { |
1977 | QPtrList<Incidence> incidences = selectedIncidences(); | 1977 | QPtrList<Incidence> incidences = selectedIncidences(); |
1978 | if (incidences.count() > 0) { | 1978 | if (incidences.count() > 0) { |
1979 | emit incidenceSelected( incidences.first() ); | 1979 | emit incidenceSelected( incidences.first() ); |
1980 | } else { | 1980 | } else { |
1981 | emit incidenceSelected( 0 ); | 1981 | emit incidenceSelected( 0 ); |
1982 | clearSelection(); | 1982 | clearSelection(); |
1983 | } | 1983 | } |
1984 | } | 1984 | } |
1985 | 1985 | ||
1986 | void KOMonthView::clearSelection() | 1986 | void KOMonthView::clearSelection() |
1987 | { | 1987 | { |
1988 | if ( mSelectedCell ) { | 1988 | if ( mSelectedCell ) { |
1989 | mSelectedCell->deselect(); | 1989 | mSelectedCell->deselect(); |
1990 | mSelectedCell = 0; | 1990 | mSelectedCell = 0; |
1991 | } | 1991 | } |
1992 | } | 1992 | } |
1993 | 1993 | ||
1994 | void KOMonthView::keyReleaseEvent ( QKeyEvent * e) | 1994 | void KOMonthView::keyReleaseEvent ( QKeyEvent * e) |