summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
authorzautrix <zautrix>2005-04-04 20:24:30 (UTC)
committer zautrix <zautrix>2005-04-04 20:24:30 (UTC)
commitc408fcb55de18d1e3e1d20803c3885e3074cfaa4 (patch) (unidiff)
tree092f6e385210a9fa7bd625c2e0cae3ceba68f513 /korganizer/komonthview.cpp
parent8e7f4812c4ad239b6a17cce8aa84c00274ced4df (diff)
downloadkdepimpi-c408fcb55de18d1e3e1d20803c3885e3074cfaa4.zip
kdepimpi-c408fcb55de18d1e3e1d20803c3885e3074cfaa4.tar.gz
kdepimpi-c408fcb55de18d1e3e1d20803c3885e3074cfaa4.tar.bz2
month view fixes
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp116
1 files changed, 64 insertions, 52 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 9f7db69..1ed288b 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -86,2 +86,4 @@ KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
86 resetOnFocusIn = true; 86 resetOnFocusIn = true;
87 setVScrollBarMode(QScrollView::AlwaysOff);
88 setHScrollBarMode(QScrollView::AlwaysOff);
87} 89}
@@ -102,2 +104,24 @@ void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
102 resetOnFocusIn = true; 104 resetOnFocusIn = true;
105
106 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
107 QListBoxItem *fi = firstItem ();
108 if (fi ) {
109 int ihei = fi->height( this );
110 int hei = numRows () * ihei;
111 if ( hei < height() - horizontalScrollBar()->height () ) {
112 setVScrollBarMode(QScrollView::AlwaysOff);
113 }
114 else
115 setVScrollBarMode(QScrollView::Auto);
116 if ( ihei *3 > height() ) {
117 setHScrollBarMode(QScrollView::AlwaysOff);
118 }
119 else {
120 setHScrollBarMode(QScrollView::Auto);
121 }
122 } else {
123 setVScrollBarMode(QScrollView::Auto);
124 setHScrollBarMode(QScrollView::Auto);
125 }
126 }
103} 127}
@@ -109,3 +133,5 @@ void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
109 } 133 }
110 QListBox::focusOutEvent ( e ); 134 QListBox::focusOutEvent ( e );
135 setVScrollBarMode(QScrollView::AlwaysOff);
136 setHScrollBarMode(QScrollView::AlwaysOff);
111} 137}
@@ -245,2 +271,3 @@ MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
245 mInfo = false; 271 mInfo = false;
272 isWeekItem = KOPrefs::instance()->mMonthViewWeek;
246 //qDebug("NEWWWWWWWWWWWWW "); 273 //qDebug("NEWWWWWWWWWWWWW ");
@@ -382,3 +409,3 @@ int MonthViewItem::width(const QListBox *lb) const
382 409
383 if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { 410 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) {
384 int size = PIXMAP_SIZE; 411 int size = PIXMAP_SIZE;
@@ -417,4 +444,2 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
417{ 444{
418
419 mCurrentAvailItem = 0;
420 //QVBoxLayout *topLayout = new QVBoxLayout( this ); 445 //QVBoxLayout *topLayout = new QVBoxLayout( this );
@@ -574,4 +599,10 @@ void MonthViewCell::startUpdateCell()
574 } 599 }
575 mCurrentAvailItem = (MonthViewItem*) firstItem (); 600 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem ();
576 //clear(); 601 //clear();
602 while ( CurrentAvailItem ) {
603 MonthViewItem *item = CurrentAvailItem;
604 CurrentAvailItem = (MonthViewItem *)item->next();
605 mAvailItemList.append( item );
606 takeItem ( item );
607 }
577 608
@@ -595,3 +626,2 @@ void MonthViewCell::insertEvent(Event *event)
595 QString mToolTipText; 626 QString mToolTipText;
596 bool insertNewItem = false;
597 setFocusPolicy(WheelFocus); 627 setFocusPolicy(WheelFocus);
@@ -654,17 +684,11 @@ void MonthViewCell::insertEvent(Event *event)
654 MonthViewItem *item ; 684 MonthViewItem *item ;
655 if ( mCurrentAvailItem ) { 685
656 item = mCurrentAvailItem; 686 if ( mAvailItemList.count() ) {
657 mCurrentAvailItem = (MonthViewItem*) item->next(); 687 item = mAvailItemList.first();
688 mAvailItemList.remove( item );
658 item->recycle( event, mDate, text ); 689 item->recycle( event, mDate, text );
659 } else { 690 } else {
660 if ( mAvailItemList.count() ) { 691 item = new MonthViewItem( event, mDate, text );
661 item = mAvailItemList.first();
662 mAvailItemList.remove( item );
663 item->recycle( event, mDate, text );
664 insertNewItem = true;
665 } else {
666 insertNewItem = true;
667 item = new MonthViewItem( event, mDate, text );
668 }
669 } 692 }
693
670 QPalette pal; 694 QPalette pal;
@@ -708,4 +732,3 @@ void MonthViewCell::insertEvent(Event *event)
708 item->setMultiDay( multiday ); 732 item->setMultiDay( multiday );
709 if ( insertNewItem) 733 insertItem( item );
710 insertItem( item );
711 mToolTip.append( mToolTipText ); 734 mToolTip.append( mToolTipText );
@@ -714,3 +737,2 @@ void MonthViewCell::insertTodo(Todo *todo)
714{ 737{
715 bool insertNewItem = false;
716 setFocusPolicy(WheelFocus); 738 setFocusPolicy(WheelFocus);
@@ -725,16 +747,8 @@ void MonthViewCell::insertTodo(Todo *todo)
725 MonthViewItem *item ; 747 MonthViewItem *item ;
726 if ( mCurrentAvailItem ) { 748 if ( mAvailItemList.count() ) {
727 item = mCurrentAvailItem; 749 item = mAvailItemList.first();
728 mCurrentAvailItem = (MonthViewItem*) item->next(); 750 mAvailItemList.remove( item );
729 item->recycle( todo, mDate, text ); 751 item->recycle( todo, mDate, text );
730 } else { 752 } else {
731 if ( mAvailItemList.count() ) { 753 item = new MonthViewItem( todo, mDate, text );
732 item = mAvailItemList.first();
733 mAvailItemList.remove( item );
734 item->recycle( todo, mDate, text );
735 insertNewItem = true;
736 } else {
737 insertNewItem = true;
738 item = new MonthViewItem( todo, mDate, text );
739 }
740 } 754 }
@@ -769,4 +783,3 @@ void MonthViewCell::insertTodo(Todo *todo)
769 item->setMoreInfo( todo->description().length() > 0 ); 783 item->setMoreInfo( todo->description().length() > 0 );
770 if ( insertNewItem) 784 insertItem( item );
771 insertItem( item );
772 mToolTip.append( text ); 785 mToolTip.append( text );
@@ -784,8 +797,3 @@ void MonthViewCell::finishUpdateCell()
784{ 797{
785 while ( mCurrentAvailItem ) { 798
786 MonthViewItem *item = mCurrentAvailItem;
787 mCurrentAvailItem = (MonthViewItem *)item->next();
788 mAvailItemList.append( item );
789 takeItem ( item );
790 }
791 799
@@ -863,2 +871,4 @@ void MonthViewCell::enableScrollBars( bool enabled )
863{ 871{
872
873 return;
864 if ( enabled ) { 874 if ( enabled ) {
@@ -873,6 +883,8 @@ void MonthViewCell::enableScrollBars( bool enabled )
873 setVScrollBarMode(QScrollView::Auto); 883 setVScrollBarMode(QScrollView::Auto);
874 if ( ihei *3 > height() ) 884 if ( ihei *3 > height() ) {
875 setHScrollBarMode(QScrollView::AlwaysOff); 885 setHScrollBarMode(QScrollView::AlwaysOff);
876 else 886 }
887 else {
877 setHScrollBarMode(QScrollView::Auto); 888 setHScrollBarMode(QScrollView::Auto);
889 }
878 } else { 890 } else {
@@ -983,3 +995,2 @@ void MonthViewCell::cellClicked( QListBoxItem *item )
983{ 995{
984 static QListBoxItem * lastClicked = 0;
985 if ( item == 0 ) { 996 if ( item == 0 ) {
@@ -1093,3 +1104,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1093 mWeekLabels[mNumWeeks]->setText( i18n("W")); 1104 mWeekLabels[mNumWeeks]->setText( i18n("W"));
1094 mWeekLabels[0]->setFocusPolicy(WheelFocus); 1105 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus);
1095 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 1106 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
@@ -1109,3 +1120,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1109 mWeekLabelsW[1]->setText( i18n("W")); 1120 mWeekLabelsW[1]->setText( i18n("W"));
1110 mWeekLabelsW[0]->setFocusPolicy(WheelFocus); 1121 mWeekLabelsW[1]->setFocusPolicy(WheelFocus);
1111 1122
@@ -1400,3 +1411,3 @@ void KOMonthView::changeEventDisplay(Event *, int)
1400 // quick-and-dirty-hack gets the job done for right now. 1411 // quick-and-dirty-hack gets the job done for right now.
1401 qDebug("KOMonthView::changeEventDisplay "); 1412 //qDebug("KOMonthView::changeEventDisplay ");
1402 updateView(); 1413 updateView();
@@ -1530,10 +1541,11 @@ void KOMonthView::setKeyBoardFocus()
1530{ 1541{
1542 //qDebug("KOMonthView::setKeyBoardFocus() ");
1531 bool shootAgain = false; 1543 bool shootAgain = false;
1532 if ( mShowWeekView ) { 1544 if ( mShowWeekView ) {
1533 shootAgain = !mWeekLabelsW[0]->hasFocus(); 1545 shootAgain = !mWeekLabelsW[1]->hasFocus();
1534 mWeekLabelsW[0]->setFocus(); 1546 mWeekLabelsW[1]->setFocus();
1535 } 1547 }
1536 else { 1548 else {
1537 shootAgain = !mWeekLabels[0]->hasFocus(); 1549 shootAgain = !mWeekLabels[mNumWeeks]->hasFocus();
1538 mWeekLabels[0]->setFocus(); 1550 mWeekLabels[mNumWeeks]->setFocus();
1539 } 1551 }