author | zautrix <zautrix> | 2005-03-25 05:47:45 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-25 05:47:45 (UTC) |
commit | e3b935f4e24086117213662e670ab26cb2ad8822 (patch) (unidiff) | |
tree | d20ad8e8dd09cc3efb9f9e57568d4d009048d518 | |
parent | 658354b7112aff72f0fadd924c82b977d803bc27 (diff) | |
download | kdepimpi-e3b935f4e24086117213662e670ab26cb2ad8822.zip kdepimpi-e3b935f4e24086117213662e670ab26cb2ad8822.tar.gz kdepimpi-e3b935f4e24086117213662e670ab26cb2ad8822.tar.bz2 |
mal sehn...
-rw-r--r-- | korganizer/kdatenavigator.cpp | 3 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 222 | ||||
-rw-r--r-- | korganizer/komonthview.h | 14 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 3 |
4 files changed, 173 insertions, 69 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 6438c9a..0cb767f 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -119,7 +119,8 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) | |||
119 | mySizeHint = sizeHintTwoButtons(); | 119 | mySizeHint = sizeHintTwoButtons(); |
120 | myFullSizeHint = sizeHintTwoButtons( 4 ); | 120 | myFullSizeHint = sizeHintTwoButtons( 4 ); |
121 | mFontChanged = false; | 121 | mFontChanged = false; |
122 | resize ( 0,0 ); | 122 | resize ( 3,3 ); |
123 | |||
123 | } | 124 | } |
124 | void KDateNavigator::changeFont ( QFont fo ) | 125 | void KDateNavigator::changeFont ( QFont fo ) |
125 | { | 126 | { |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 050bfb9..38cfda7 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -194,6 +194,7 @@ void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | |||
194 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 194 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
195 | : QListBoxItem() | 195 | : QListBoxItem() |
196 | { | 196 | { |
197 | mblockRepaint = true; | ||
197 | setText( s ); | 198 | setText( s ); |
198 | mMultiday = 0; | 199 | mMultiday = 0; |
199 | mIncidence = incidence; | 200 | mIncidence = incidence; |
@@ -202,10 +203,28 @@ MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | |||
202 | mAlarm = false; | 203 | mAlarm = false; |
203 | mReply = false; | 204 | mReply = false; |
204 | mInfo = false; | 205 | mInfo = false; |
206 | //qDebug("NEWWWWWWWWWWWWW "); | ||
207 | } | ||
208 | void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) | ||
209 | { | ||
210 | setText( s ); | ||
211 | mMultiday = 0; | ||
212 | mIncidence = incidence; | ||
213 | mDate = qd; | ||
214 | mRecur = false; | ||
215 | mAlarm = false; | ||
216 | mReply = false; | ||
217 | mInfo = false; | ||
218 | //qDebug("recucleeeeeeeeeeeeeeeee "); | ||
205 | } | 219 | } |
206 | 220 | ||
207 | void MonthViewItem::paint(QPainter *p) | 221 | void MonthViewItem::paint(QPainter *p) |
208 | { | 222 | { |
223 | if ( mblockRepaint ) { | ||
224 | //qDebug("block "); | ||
225 | return; | ||
226 | } | ||
227 | //qDebug("NON block "); | ||
209 | #if QT_VERSION >= 0x030000 | 228 | #if QT_VERSION >= 0x030000 |
210 | bool sel = isSelected(); | 229 | bool sel = isSelected(); |
211 | #else | 230 | #else |
@@ -353,12 +372,13 @@ int MonthViewItem::width(const QListBox *lb) const | |||
353 | 372 | ||
354 | 373 | ||
355 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 374 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
356 | : QWidget( par ), | 375 | : KNoScrollListBox( par ), |
357 | mMonthView( parent ) | 376 | mMonthView( parent ) |
358 | { | 377 | { |
359 | 378 | ||
379 | mCurrentAvailItem = 0; | ||
360 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); | 380 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); |
361 | 381 | currentPalette = 0; | |
362 | // mLabel = new QLabel( this );QPushButton | 382 | // mLabel = new QLabel( this );QPushButton |
363 | mLabel = new QPushButton( this ); | 383 | mLabel = new QPushButton( this ); |
364 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 384 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
@@ -366,10 +386,10 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | |||
366 | //mLabel->setAlignment( AlignCenter ); | 386 | //mLabel->setAlignment( AlignCenter ); |
367 | mLabel->setFlat( true ); | 387 | mLabel->setFlat( true ); |
368 | mLabel->setFocusPolicy(NoFocus); | 388 | mLabel->setFocusPolicy(NoFocus); |
369 | mItemList = new KNoScrollListBox( this ); | 389 | //mItemList = new KNoScrollListBox( this ); |
370 | mItemList->setMinimumSize( 10, 10 ); | 390 | setMinimumSize( 10, 10 ); |
371 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 391 | setFrameStyle( QFrame::Panel | QFrame::Plain ); |
372 | mItemList->setLineWidth( 1 ); | 392 | setLineWidth( 1 ); |
373 | //topLayout->addWidget( mItemList ); | 393 | //topLayout->addWidget( mItemList ); |
374 | mLabel->raise(); | 394 | mLabel->raise(); |
375 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 395 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
@@ -380,16 +400,16 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | |||
380 | updateConfig(); | 400 | updateConfig(); |
381 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 401 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
382 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 402 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
383 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 403 | connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), |
384 | SLOT( defaultAction( QListBoxItem * ) ) ); | 404 | SLOT( defaultAction( QListBoxItem * ) ) ); |
385 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 405 | connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, |
386 | const QPoint &) ), | 406 | const QPoint &) ), |
387 | SLOT( contextMenu( QListBoxItem * ) ) ); | 407 | SLOT( contextMenu( QListBoxItem * ) ) ); |
388 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 408 | connect( this, SIGNAL( highlighted( QListBoxItem *) ), |
389 | SLOT( selection( QListBoxItem * ) ) ); | 409 | SLOT( selection( QListBoxItem * ) ) ); |
390 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 410 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), |
391 | SLOT( cellClicked( QListBoxItem * ) ) ); | 411 | SLOT( cellClicked( QListBoxItem * ) ) ); |
392 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 412 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), |
393 | SLOT( selection( QListBoxItem * ) ) ); | 413 | SLOT( selection( QListBoxItem * ) ) ); |
394 | } | 414 | } |
395 | #ifdef DESKTOP_VERSION | 415 | #ifdef DESKTOP_VERSION |
@@ -424,15 +444,26 @@ void MonthViewCell::setMyPalette() | |||
424 | { | 444 | { |
425 | 445 | ||
426 | if ( mHoliday) { | 446 | if ( mHoliday) { |
447 | if ( currentPalette == 1 ) return; | ||
427 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 448 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
428 | mItemList->setPalette( mHolidayPalette ); | 449 | setPalette( mHolidayPalette ); |
450 | //mLabel->setPalette( mHolidayPalette ); | ||
451 | currentPalette = 1; | ||
452 | |||
429 | } else { | 453 | } else { |
430 | if ( mPrimary ) { | 454 | if ( mPrimary ) { |
455 | if ( currentPalette == 2 ) return; | ||
431 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 456 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
432 | mItemList->setPalette( mPrimaryPalette ); | 457 | //mLabel->setPalette( mPrimaryPalette ); |
458 | setPalette( mPrimaryPalette ); | ||
459 | currentPalette = 2; | ||
460 | |||
433 | } else { | 461 | } else { |
434 | mItemList->setPalette( mNonPrimaryPalette ); | 462 | if ( currentPalette == 3 ) return; |
463 | setPalette( mNonPrimaryPalette ); | ||
435 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 464 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
465 | //mLabel->setPalette( mNonPrimaryPalette );; | ||
466 | currentPalette = 3; | ||
436 | } | 467 | } |
437 | } | 468 | } |
438 | //QPalette pal = palette(); | 469 | //QPalette pal = palette(); |
@@ -471,20 +502,18 @@ void MonthViewCell::setHoliday( const QString &holiday ) | |||
471 | setHoliday( true ); | 502 | setHoliday( true ); |
472 | } | 503 | } |
473 | } | 504 | } |
474 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | ||
475 | { | ||
476 | |||
477 | e->ignore(); | ||
478 | |||
479 | } | ||
480 | 505 | ||
481 | void MonthViewCell::startUpdateCell() | 506 | void MonthViewCell::startUpdateCell() |
482 | { | 507 | { |
483 | 508 | ||
484 | mItemList->setFocusPolicy(NoFocus); | 509 | setFocusPolicy(NoFocus); |
485 | if ( !mMonthView->isUpdatePossible() ) | 510 | if ( !mMonthView->isUpdatePossible() ) |
486 | return; | 511 | return; |
487 | 512 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | |
513 | while ( mitem ) { | ||
514 | mitem->setBlockRepaint( true ); | ||
515 | mitem = (MonthViewItem *)mitem->next(); | ||
516 | } | ||
488 | /* | 517 | /* |
489 | if ( !isVisible() ){ | 518 | if ( !isVisible() ){ |
490 | return; | 519 | return; |
@@ -494,29 +523,33 @@ void MonthViewCell::startUpdateCell() | |||
494 | setPrimary( mDate.month()%2 ); | 523 | setPrimary( mDate.month()%2 ); |
495 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 524 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
496 | if ( mDate == QDate::currentDate() ) { | 525 | if ( mDate == QDate::currentDate() ) { |
497 | mItemList->setLineWidth( 3 ); | 526 | setLineWidth( 3 ); |
498 | } else { | 527 | } else { |
499 | mItemList->setLineWidth( 1 ); | 528 | setLineWidth( 1 ); |
500 | } | 529 | } |
501 | mItemList->clear(); | 530 | mCurrentAvailItem = (MonthViewItem*) firstItem (); |
531 | //clear(); | ||
502 | 532 | ||
503 | #ifdef DESKTOP_VERSION | 533 | #ifdef DESKTOP_VERSION |
504 | QToolTip::remove(this); | 534 | QToolTip::remove(this); |
505 | #endif | 535 | #endif |
506 | mToolTip.clear(); | 536 | mToolTip.clear(); |
507 | //qApp->processEvents(); | 537 | //qApp->processEvents(); |
538 | #if 0 | ||
508 | if ( !mHolidayString.isEmpty() ) { | 539 | if ( !mHolidayString.isEmpty() ) { |
509 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 540 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
510 | item->setPalette( mHolidayPalette ); | 541 | item->setPalette( mHolidayPalette ); |
511 | mItemList->insertItem( item ); | 542 | insertItem( item ); |
512 | mToolTip.append ( mHolidayString ); | 543 | mToolTip.append ( mHolidayString ); |
513 | } | 544 | } |
545 | #endif | ||
514 | } | 546 | } |
515 | 547 | ||
516 | void MonthViewCell::insertEvent(Event *event) | 548 | void MonthViewCell::insertEvent(Event *event) |
517 | { | 549 | { |
518 | QString mToolTipText; | 550 | QString mToolTipText; |
519 | mItemList->setFocusPolicy(WheelFocus); | 551 | bool insertNewItem = false; |
552 | setFocusPolicy(WheelFocus); | ||
520 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 553 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
521 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 554 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
522 | return; | 555 | return; |
@@ -528,7 +561,7 @@ void MonthViewCell::insertEvent(Event *event) | |||
528 | if ( event->isHoliday()) { | 561 | if ( event->isHoliday()) { |
529 | setHoliday( true ); | 562 | setHoliday( true ); |
530 | if ( mDate.dayOfWeek() == 7 ) | 563 | if ( mDate.dayOfWeek() == 7 ) |
531 | mItemList->setLineWidth( 3 ); | 564 | setLineWidth( 3 ); |
532 | } | 565 | } |
533 | QString text; | 566 | QString text; |
534 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 567 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
@@ -573,8 +606,22 @@ void MonthViewCell::insertEvent(Event *event) | |||
573 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 606 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
574 | } | 607 | } |
575 | } | 608 | } |
576 | 609 | MonthViewItem *item ; | |
577 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 610 | if ( mCurrentAvailItem ) { |
611 | item = mCurrentAvailItem; | ||
612 | mCurrentAvailItem = (MonthViewItem*) item->next(); | ||
613 | item->recycle( event, mDate, text ); | ||
614 | } else { | ||
615 | if ( mAvailItemList.count() ) { | ||
616 | item = mAvailItemList.first(); | ||
617 | mAvailItemList.remove( item ); | ||
618 | item->recycle( event, mDate, text ); | ||
619 | insertNewItem = true; | ||
620 | } else { | ||
621 | insertNewItem = true; | ||
622 | item = new MonthViewItem( event, mDate, text ); | ||
623 | } | ||
624 | } | ||
578 | QPalette pal; | 625 | QPalette pal; |
579 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 626 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
580 | QStringList categories = event->categories(); | 627 | QStringList categories = event->categories(); |
@@ -614,12 +661,14 @@ void MonthViewCell::insertEvent(Event *event) | |||
614 | item->setReply(false); | 661 | item->setReply(false); |
615 | #endif | 662 | #endif |
616 | item->setMultiDay( multiday ); | 663 | item->setMultiDay( multiday ); |
617 | mItemList->insertItem( item ); | 664 | if ( insertNewItem) |
665 | insertItem( item ); | ||
618 | mToolTip.append( mToolTipText ); | 666 | mToolTip.append( mToolTipText ); |
619 | } | 667 | } |
620 | void MonthViewCell::insertTodo(Todo *todo) | 668 | void MonthViewCell::insertTodo(Todo *todo) |
621 | { | 669 | { |
622 | mItemList->setFocusPolicy(WheelFocus); | 670 | bool insertNewItem = false; |
671 | setFocusPolicy(WheelFocus); | ||
623 | QString text; | 672 | QString text; |
624 | if (todo->hasDueDate()) { | 673 | if (todo->hasDueDate()) { |
625 | if (!todo->doesFloat()) { | 674 | if (!todo->doesFloat()) { |
@@ -628,8 +677,23 @@ void MonthViewCell::insertTodo(Todo *todo) | |||
628 | } | 677 | } |
629 | } | 678 | } |
630 | text += todo->summary(); | 679 | text += todo->summary(); |
631 | 680 | MonthViewItem *item ; | |
632 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 681 | if ( mCurrentAvailItem ) { |
682 | item = mCurrentAvailItem; | ||
683 | mCurrentAvailItem = (MonthViewItem*) item->next(); | ||
684 | item->recycle( todo, mDate, text ); | ||
685 | } else { | ||
686 | if ( mAvailItemList.count() ) { | ||
687 | item = mAvailItemList.first(); | ||
688 | mAvailItemList.remove( item ); | ||
689 | item->recycle( todo, mDate, text ); | ||
690 | insertNewItem = true; | ||
691 | } else { | ||
692 | insertNewItem = true; | ||
693 | item = new MonthViewItem( todo, mDate, text ); | ||
694 | } | ||
695 | } | ||
696 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | ||
633 | //item->setPalette( mStandardPalette ); | 697 | //item->setPalette( mStandardPalette ); |
634 | QPalette pal; | 698 | QPalette pal; |
635 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 699 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
@@ -658,18 +722,36 @@ void MonthViewCell::insertTodo(Todo *todo) | |||
658 | item->setRecur( todo->recurrence()->doesRecur() ); | 722 | item->setRecur( todo->recurrence()->doesRecur() ); |
659 | item->setAlarm( todo->isAlarmEnabled() ); | 723 | item->setAlarm( todo->isAlarmEnabled() ); |
660 | item->setMoreInfo( todo->description().length() > 0 ); | 724 | item->setMoreInfo( todo->description().length() > 0 ); |
661 | mItemList->insertItem( item ); | 725 | if ( insertNewItem) |
726 | insertItem( item ); | ||
662 | mToolTip.append( text ); | 727 | mToolTip.append( text ); |
663 | } | 728 | } |
729 | void MonthViewCell::repaintfinishUpdateCell() | ||
730 | { | ||
731 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | ||
732 | while ( mitem ) { | ||
733 | mitem->setBlockRepaint( false ); | ||
734 | updateItem ( mitem ); | ||
735 | mitem = (MonthViewItem *)mitem->next(); | ||
736 | } | ||
737 | } | ||
664 | void MonthViewCell::finishUpdateCell() | 738 | void MonthViewCell::finishUpdateCell() |
665 | { | 739 | { |
740 | while ( mCurrentAvailItem ) { | ||
741 | MonthViewItem *item = mCurrentAvailItem; | ||
742 | mCurrentAvailItem = (MonthViewItem *)item->next(); | ||
743 | mAvailItemList.append( item ); | ||
744 | takeItem ( item ); | ||
745 | } | ||
746 | |||
747 | |||
666 | #ifdef DESKTOP_VERSION | 748 | #ifdef DESKTOP_VERSION |
667 | if (mToolTip.count() > 0 ) { | 749 | if (mToolTip.count() > 0 ) { |
668 | mToolTip.sort(); | 750 | mToolTip.sort(); |
669 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); | 751 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); |
670 | } | 752 | } |
671 | #endif | 753 | #endif |
672 | mItemList->sort(); | 754 | sort(); |
673 | //setMyPalette(); | 755 | //setMyPalette(); |
674 | setMyPalette(); | 756 | setMyPalette(); |
675 | QString text; | 757 | QString text; |
@@ -746,52 +828,59 @@ void MonthViewCell::updateConfig( bool bigFont ) // = false | |||
746 | void MonthViewCell::enableScrollBars( bool enabled ) | 828 | void MonthViewCell::enableScrollBars( bool enabled ) |
747 | { | 829 | { |
748 | if ( enabled ) { | 830 | if ( enabled ) { |
749 | //mItemList->setVScrollBarMode(QScrollView::Auto); | 831 | |
750 | mItemList->setHScrollBarMode(QScrollView::Auto); | 832 | QListBoxItem *fi = firstItem (); |
751 | QListBoxItem *fi = mItemList->firstItem (); | ||
752 | if (fi ) { | 833 | if (fi ) { |
753 | int hei = mItemList->numRows () * fi->height(mItemList); | 834 | int ihei = fi->height( this ); |
754 | if ( hei < height() - mItemList->horizontalScrollBar()->height () ) | 835 | int hei = numRows () * ihei; |
755 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 836 | if ( hei < height() - horizontalScrollBar()->height () ) |
837 | setVScrollBarMode(QScrollView::AlwaysOff); | ||
838 | else | ||
839 | setVScrollBarMode(QScrollView::Auto); | ||
840 | if ( ihei *3 > height() ) | ||
841 | setHScrollBarMode(QScrollView::AlwaysOff); | ||
756 | else | 842 | else |
757 | mItemList->setVScrollBarMode(QScrollView::Auto); | 843 | setHScrollBarMode(QScrollView::Auto); |
844 | } else { | ||
845 | setVScrollBarMode(QScrollView::Auto); | ||
846 | setHScrollBarMode(QScrollView::Auto); | ||
758 | } | 847 | } |
759 | } else { | 848 | } else { |
760 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 849 | setVScrollBarMode(QScrollView::AlwaysOff); |
761 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 850 | setHScrollBarMode(QScrollView::AlwaysOff); |
762 | } | 851 | } |
763 | } | 852 | } |
764 | 853 | ||
765 | Incidence *MonthViewCell::selectedIncidence() | 854 | Incidence *MonthViewCell::selectedIncidence() |
766 | { | 855 | { |
767 | int index = mItemList->currentItem(); | 856 | int index = currentItem(); |
768 | if ( index < 0 ) return 0; | 857 | if ( index < 0 ) return 0; |
769 | 858 | ||
770 | MonthViewItem *item = | 859 | MonthViewItem *mitem = |
771 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 860 | static_cast<MonthViewItem *>( item( index ) ); |
772 | 861 | ||
773 | if ( !item ) return 0; | 862 | if ( !mitem ) return 0; |
774 | 863 | ||
775 | return item->incidence(); | 864 | return mitem->incidence(); |
776 | } | 865 | } |
777 | 866 | ||
778 | QDate MonthViewCell::selectedIncidenceDate() | 867 | QDate MonthViewCell::selectedIncidenceDate() |
779 | { | 868 | { |
780 | QDate qd; | 869 | QDate qd; |
781 | int index = mItemList->currentItem(); | 870 | int index = currentItem(); |
782 | if ( index < 0 ) return qd; | 871 | if ( index < 0 ) return qd; |
783 | 872 | ||
784 | MonthViewItem *item = | 873 | MonthViewItem *mitem = |
785 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 874 | static_cast<MonthViewItem *>( item( index ) ); |
786 | 875 | ||
787 | if ( !item ) return qd; | 876 | if ( !mitem ) return qd; |
788 | 877 | ||
789 | return item->incidenceDate(); | 878 | return mitem->incidenceDate(); |
790 | } | 879 | } |
791 | 880 | ||
792 | void MonthViewCell::deselect() | 881 | void MonthViewCell::deselect() |
793 | { | 882 | { |
794 | mItemList->clearSelection(); | 883 | clearSelection(); |
795 | enableScrollBars( false ); | 884 | enableScrollBars( false ); |
796 | // updateCell(); | 885 | // updateCell(); |
797 | } | 886 | } |
@@ -806,16 +895,18 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e ) | |||
806 | return; | 895 | return; |
807 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); | 896 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); |
808 | deselect(); | 897 | deselect(); |
809 | int size = height() - mLabel->height() - 2; | 898 | int size = height() - mLabel->height() - lineWidth()-1; |
899 | //qDebug("LW %d ", lineWidth()); | ||
810 | if ( size > 0 ) | 900 | if ( size > 0 ) |
811 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 901 | verticalScrollBar()->setMaximumHeight( size ); |
812 | size = width() - mLabel->width() -2; | 902 | size = width() - mLabel->width() -lineWidth()-1; |
813 | if ( size > 0 ) | 903 | if ( size > 0 ) |
814 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 904 | horizontalScrollBar()->setMaximumWidth( size ); |
815 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 905 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); |
816 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 906 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
817 | mItemList->resize ( width(), height () ); | 907 | // mItemList->resize ( width(), height () ); |
818 | 908 | if ( e ) | |
909 | KNoScrollListBox::resizeEvent ( e ); | ||
819 | } | 910 | } |
820 | 911 | ||
821 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 912 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
@@ -1260,6 +1351,7 @@ void KOMonthView::updateView() | |||
1260 | 1351 | ||
1261 | if ( !updatePossible ) | 1352 | if ( !updatePossible ) |
1262 | return; | 1353 | return; |
1354 | //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); | ||
1263 | //QTime ti; | 1355 | //QTime ti; |
1264 | //ti.start(); | 1356 | //ti.start(); |
1265 | clearSelection(); | 1357 | clearSelection(); |
@@ -1356,6 +1448,10 @@ void KOMonthView::updateView() | |||
1356 | (*cells)[i]->finishUpdateCell(); | 1448 | (*cells)[i]->finishUpdateCell(); |
1357 | } | 1449 | } |
1358 | processSelectionChange(); | 1450 | processSelectionChange(); |
1451 | qApp->processEvents(); | ||
1452 | for( i = 0; i < timeSpan+1; ++i ) { | ||
1453 | (*cells)[i]->repaintfinishUpdateCell(); | ||
1454 | } | ||
1359 | (*cells)[0]->setFocus(); | 1455 | (*cells)[0]->setFocus(); |
1360 | 1456 | ||
1361 | 1457 | ||
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 89912e0..b997c1a 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -93,12 +93,13 @@ class MonthViewItem: public QListBoxItem | |||
93 | { | 93 | { |
94 | public: | 94 | public: |
95 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 95 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
96 | 96 | void recycle( Incidence *incidence, QDate qd, const QString & s); | |
97 | void setRecur(bool on) { mRecur = on; } | 97 | void setRecur(bool on) { mRecur = on; } |
98 | void setAlarm(bool on) { mAlarm = on; } | 98 | void setAlarm(bool on) { mAlarm = on; } |
99 | void setReply(bool on) { mReply = on; } | 99 | void setReply(bool on) { mReply = on; } |
100 | void setMoreInfo(bool on) { mInfo = on; } | 100 | void setMoreInfo(bool on) { mInfo = on; } |
101 | void setMultiDay(int type) { mMultiday = type; } | 101 | void setMultiDay(int type) { mMultiday = type; } |
102 | void setBlockRepaint(bool on) { mblockRepaint = on; } | ||
102 | 103 | ||
103 | 104 | ||
104 | void setPalette(const QPalette &p) { mPalette = p; } | 105 | void setPalette(const QPalette &p) { mPalette = p; } |
@@ -113,6 +114,7 @@ class MonthViewItem: public QListBoxItem | |||
113 | virtual int width(const QListBox *) const; | 114 | virtual int width(const QListBox *) const; |
114 | 115 | ||
115 | private: | 116 | private: |
117 | bool mblockRepaint; | ||
116 | int mMultiday; | 118 | int mMultiday; |
117 | bool mRecur; | 119 | bool mRecur; |
118 | bool mAlarm; | 120 | bool mAlarm; |
@@ -128,11 +130,12 @@ class MonthViewItem: public QListBoxItem | |||
128 | 130 | ||
129 | class KOMonthView; | 131 | class KOMonthView; |
130 | 132 | ||
131 | class MonthViewCell : public QWidget | 133 | class MonthViewCell : public KNoScrollListBox |
132 | { | 134 | { |
133 | Q_OBJECT | 135 | Q_OBJECT |
134 | public: | 136 | public: |
135 | MonthViewCell(KOMonthView *,QWidget* ); | 137 | MonthViewCell(KOMonthView *,QWidget* ); |
138 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} | ||
136 | 139 | ||
137 | void setDate( const QDate & ); | 140 | void setDate( const QDate & ); |
138 | QDate date() const; | 141 | QDate date() const; |
@@ -146,6 +149,7 @@ class MonthViewCell : public QWidget | |||
146 | void updateCell(); | 149 | void updateCell(); |
147 | void startUpdateCell(); | 150 | void startUpdateCell(); |
148 | void finishUpdateCell(); | 151 | void finishUpdateCell(); |
152 | void repaintfinishUpdateCell(); | ||
149 | void insertEvent(Event *); | 153 | void insertEvent(Event *); |
150 | void insertTodo(Todo *); | 154 | void insertTodo(Todo *); |
151 | 155 | ||
@@ -183,7 +187,10 @@ public slots: | |||
183 | void newEvent(); | 187 | void newEvent(); |
184 | 188 | ||
185 | private: | 189 | private: |
190 | MonthViewItem* mCurrentAvailItem; | ||
191 | QPtrList <MonthViewItem> mAvailItemList; | ||
186 | KOMonthView *mMonthView; | 192 | KOMonthView *mMonthView; |
193 | int currentPalette; | ||
187 | 194 | ||
188 | QDate mDate; | 195 | QDate mDate; |
189 | bool mPrimary; | 196 | bool mPrimary; |
@@ -192,7 +199,7 @@ public slots: | |||
192 | 199 | ||
193 | //QLabel *mLabel; | 200 | //QLabel *mLabel; |
194 | QPushButton *mLabel; | 201 | QPushButton *mLabel; |
195 | QListBox *mItemList; | 202 | //QListBox *mItemList; |
196 | #ifdef DESKTOP_VERSION | 203 | #ifdef DESKTOP_VERSION |
197 | static QToolTipGroup *mToolTipGroup; | 204 | static QToolTipGroup *mToolTipGroup; |
198 | #endif | 205 | #endif |
@@ -204,7 +211,6 @@ public slots: | |||
204 | QPalette mNonPrimaryPalette; | 211 | QPalette mNonPrimaryPalette; |
205 | void setMyPalette(); | 212 | void setMyPalette(); |
206 | QPalette getPalette (); | 213 | QPalette getPalette (); |
207 | void keyPressEvent ( QKeyEvent * ) ; | ||
208 | 214 | ||
209 | }; | 215 | }; |
210 | 216 | ||
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 94d74f1..c6e76c4 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -208,6 +208,7 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | |||
208 | if ( view == 0 ) | 208 | if ( view == 0 ) |
209 | return; | 209 | return; |
210 | } | 210 | } |
211 | bool callupdate = !(view == mCurrentView); | ||
211 | bool full = fullScreen; | 212 | bool full = fullScreen; |
212 | if(view == mCurrentView && view != mWhatsNextView ) { | 213 | if(view == mCurrentView && view != mWhatsNextView ) { |
213 | if ( mCurrentAgendaView < 0 ) | 214 | if ( mCurrentAgendaView < 0 ) |
@@ -229,7 +230,7 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | |||
229 | //raiseCurrentView( full ); | 230 | //raiseCurrentView( full ); |
230 | mMainView->processIncidenceSelection( 0 ); | 231 | mMainView->processIncidenceSelection( 0 ); |
231 | //mMainView->updateView(); | 232 | //mMainView->updateView(); |
232 | raiseCurrentView( full, true ); | 233 | raiseCurrentView( full, callupdate ); |
233 | mMainView->adaptNavigationUnits(); | 234 | mMainView->adaptNavigationUnits(); |
234 | } | 235 | } |
235 | 236 | ||