summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-19 22:56:08 (UTC)
committer zautrix <zautrix>2005-03-19 22:56:08 (UTC)
commit84c18843bbd1203878367572d3a6800a0586c7f1 (patch) (unidiff)
tree9f58b7356ea700d47e6ec84fb4a462a666a24049 /korganizer
parent39b719bdc75d95913c3aaf9a03aaa57b1161cc61 (diff)
downloadkdepimpi-84c18843bbd1203878367572d3a6800a0586c7f1.zip
kdepimpi-84c18843bbd1203878367572d3a6800a0586c7f1.tar.gz
kdepimpi-84c18843bbd1203878367572d3a6800a0586c7f1.tar.bz2
mochn fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--korganizer/datenavigatorcontainer.cpp20
-rw-r--r--korganizer/kdatenavigator.cpp7
-rw-r--r--korganizer/kdatenavigator.h5
-rw-r--r--korganizer/kodaymatrix.cpp2
5 files changed, 24 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 29c530b..9acbbb1 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1835,49 +1835,48 @@ void CalendarView::readSettings()
1835 } 1835 }
1836 if ( !resetval ){// i.e. sizes.count() == 3 1836 if ( !resetval ){// i.e. sizes.count() == 3
1837 if ( KOPrefs::instance()->mVerticalScreen ) { 1837 if ( KOPrefs::instance()->mVerticalScreen ) {
1838 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) 1838 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 )
1839 resetval = mDateNavigator->sizeHint().width()+2; 1839 resetval = mDateNavigator->sizeHint().width()+2;
1840 } else { 1840 } else {
1841 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) 1841 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 )
1842 resetval = mDateNavigator->sizeHint().height()+2; 1842 resetval = mDateNavigator->sizeHint().height()+2;
1843 } 1843 }
1844 } 1844 }
1845 if ( resetval ) { 1845 if ( resetval ) {
1846 sizes.clear(); 1846 sizes.clear();
1847 if ( KOPrefs::instance()->mVerticalScreen ) { 1847 if ( KOPrefs::instance()->mVerticalScreen ) {
1848 maxVal = QApplication::desktop()->width() -10; 1848 maxVal = QApplication::desktop()->width() -10;
1849 } else { 1849 } else {
1850 maxVal = QApplication::desktop()->height()-10; 1850 maxVal = QApplication::desktop()->height()-10;
1851 } 1851 }
1852 sizes << resetval; 1852 sizes << resetval;
1853 if ( maxVal < resetval + resetval) 1853 if ( maxVal < resetval + resetval)
1854 resetval = maxVal - resetval; 1854 resetval = maxVal - resetval;
1855 sizes << resetval; 1855 sizes << resetval;
1856 sizes << 100; 1856 sizes << 100;
1857 } 1857 }
1858 mLeftFrame->setSizes(sizes); 1858 mLeftFrame->setSizes(sizes);
1859 qDebug("sizes count %d ", sizes.count());
1860 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1859 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1861 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1860 else if ( dateCount == 7 ) mNavigator->selectWeek();
1862 else mNavigator->selectDates( dateCount ); 1861 else mNavigator->selectDates( dateCount );
1863 // mViewManager->readSettings( config ); 1862 // mViewManager->readSettings( config );
1864 updateConfig(); 1863 updateConfig();
1865 globalFlagBlockAgenda = 2; 1864 globalFlagBlockAgenda = 2;
1866 mViewManager->readSettings( config ); 1865 mViewManager->readSettings( config );
1867#ifdef DESKTOP_VERSION 1866#ifdef DESKTOP_VERSION
1868 config->setGroup("WidgetLayout"); 1867 config->setGroup("WidgetLayout");
1869 QStringList list; 1868 QStringList list;
1870 list = config->readListEntry("MainLayout"); 1869 list = config->readListEntry("MainLayout");
1871 int x,y,w,h; 1870 int x,y,w,h;
1872 if ( ! list.isEmpty() ) { 1871 if ( ! list.isEmpty() ) {
1873 x = list[0].toInt(); 1872 x = list[0].toInt();
1874 y = list[1].toInt(); 1873 y = list[1].toInt();
1875 w = list[2].toInt(); 1874 w = list[2].toInt();
1876 h = list[3].toInt(); 1875 h = list[3].toInt();
1877 topLevelWidget()->setGeometry(x,y,w,h); 1876 topLevelWidget()->setGeometry(x,y,w,h);
1878 1877
1879 } else { 1878 } else {
1880 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1879 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1881 } 1880 }
1882 list = config->readListEntry("EditEventLayout"); 1881 list = config->readListEntry("EditEventLayout");
1883 if ( ! list.isEmpty() ) { 1882 if ( ! list.isEmpty() ) {
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index 3f6e29b..d09f484 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -106,85 +106,95 @@ void DateNavigatorContainer::updateToday()
106} 106}
107 107
108void DateNavigatorContainer::updateView() 108void DateNavigatorContainer::updateView()
109{ 109{
110 mNavigatorView->updateView(); 110 mNavigatorView->updateView();
111 KDateNavigator *n; 111 KDateNavigator *n;
112 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 112 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
113 n->updateView(); 113 n->updateView();
114 } 114 }
115} 115}
116 116
117void DateNavigatorContainer::updateConfig() 117void DateNavigatorContainer::updateConfig()
118{ 118{
119 mNavigatorView->updateConfig(); 119 mNavigatorView->updateConfig();
120 KDateNavigator *n; 120 KDateNavigator *n;
121 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 121 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
122 n->updateConfig(); 122 n->updateConfig();
123 } 123 }
124} 124}
125 125
126void DateNavigatorContainer::selectDates( const DateList &dateList ) 126void DateNavigatorContainer::selectDates( const DateList &dateList )
127{ 127{
128 mNavigatorView->selectDates( dateList ); 128 mNavigatorView->selectDates( dateList );
129 setBaseDates(); 129 setBaseDates();
130 if ( mExtraViews.count() ) {
131 KDateNavigator *view = mExtraViews.at( 0 );
132 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
133 view->dayMatrix()->repaint();
134 }
130} 135}
131 136
132void DateNavigatorContainer::setBaseDates() 137void DateNavigatorContainer::setBaseDates()
133{ 138{
134 KCal::DateList dateList = mNavigatorView->selectedDates(); 139 KCal::DateList dateList = mNavigatorView->selectedDates();
135 if ( dateList.isEmpty() ) { 140 if ( dateList.isEmpty() ) {
136 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; 141 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl;
137 } 142 }
138 QDate baseDate = dateList.first(); 143 QDate baseDate = dateList.first();
139 KDateNavigator *n; 144 KDateNavigator *n;
145 bool doRepaint = false; // skip first repaint
140 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 146 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
141 baseDate = baseDate.addDays( baseDate.daysInMonth () ); 147 baseDate = baseDate.addDays( baseDate.daysInMonth () );
142 n->setBaseDate( baseDate ); 148 n->setBaseDate( baseDate, doRepaint );
149 doRepaint = true;
143 } 150 }
144} 151}
145 152
146void DateNavigatorContainer::resizeEvent( QResizeEvent * ) 153void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
147{ 154{
148#if 0 155#if 0
149 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; 156 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl;
150 kdDebug(5850) << " CURRENT SIZE: " << size() << endl; 157 kdDebug(5850) << " CURRENT SIZE: " << size() << endl;
151 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; 158 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl;
152 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl; 159 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl;
153 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; 160 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl;
154#endif 161#endif
155 162 QSize minSize = mNavigatorView->yourSizeHint();
156 QSize minSize = mNavigatorView->minimumSizeHint();
157 163
158// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; 164// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl;
159 165
160 int verticalCount = size().height() / minSize.height(); 166 int verticalCount = size().height() / minSize.height();
161 int horizontalCount = size().width() / minSize.width(); 167 int horizontalCount = size().width() / minSize.width();
168 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() );
162 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); 169 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
163 if ( horizontalCount != mHorizontalCount || 170 if ( horizontalCount != mHorizontalCount ||
164 verticalCount != mVerticalCount ) { 171 verticalCount != mVerticalCount ) {
165 uint count = horizontalCount * verticalCount; 172 uint count = horizontalCount * verticalCount;
166 if ( count == 0 ) return; 173 if ( count == 0 ) {
174 mNavigatorView->resize( minSize );
175 return;
176 }
167 177
168 while ( count > ( mExtraViews.count() + 1 ) ) { 178 while ( count > ( mExtraViews.count() + 1 ) ) {
169 KDateNavigator *n = new KDateNavigator( this ); 179 KDateNavigator *n = new KDateNavigator( this );
170 n->setMonthSignalOffset ( mExtraViews.count()+1 ); 180 n->setMonthSignalOffset ( mExtraViews.count()+1 );
171 mExtraViews.append( n ); 181 mExtraViews.append( n );
172 n->setCalendar( mCalendar ); 182 n->setCalendar( mCalendar );
173 setBaseDates(); 183 setBaseDates();
174 connectNavigatorView( n ); 184 connectNavigatorView( n );
175 n->show(); 185 n->show();
176 } 186 }
177 187
178 while ( count < ( mExtraViews.count() + 1 ) ) { 188 while ( count < ( mExtraViews.count() + 1 ) ) {
179 mExtraViews.removeLast(); 189 mExtraViews.removeLast();
180 } 190 }
181 191
182 mHorizontalCount = horizontalCount; 192 mHorizontalCount = horizontalCount;
183 mVerticalCount = verticalCount; 193 mVerticalCount = verticalCount;
184 } 194 }
185 195
186 int height = size().height() / verticalCount; 196 int height = size().height() / verticalCount;
187 int width = size().width() / horizontalCount; 197 int width = size().width() / horizontalCount;
188 198
189 NavigatorBar *bar = mNavigatorView->navigatorBar(); 199 NavigatorBar *bar = mNavigatorView->navigatorBar();
190 if ( horizontalCount > 1 ) bar->showButtons( true, false ); 200 if ( horizontalCount > 1 ) bar->showButtons( true, false );
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index ab9a40f..b097dc1 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -94,76 +94,77 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
94 //weeknos[i]->setFont(QFont("Arial", 10)); 94 //weeknos[i]->setFont(QFont("Arial", 10));
95 if(!m_bShowWeekNums) { 95 if(!m_bShowWeekNums) {
96 weeknos[i]->hide(); 96 weeknos[i]->hide();
97 } 97 }
98 weeknos[i]->installEventFilter(this); 98 weeknos[i]->installEventFilter(this);
99 99
100 topLayout->addWidget(weeknos[i],i+2,0); 100 topLayout->addWidget(weeknos[i],i+2,0);
101 } 101 }
102 102
103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); 103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix");
104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); 104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken);
105 daymatrix->setLineWidth(1); 105 daymatrix->setLineWidth(1);
106 106
107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), 107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
108 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 108 SIGNAL( datesSelected( const KCal::DateList & ) ) );
109 109
110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ), 110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
111 SIGNAL( eventDropped( Event * ) ) ); 111 SIGNAL( eventDropped( Event * ) ) );
112 112
113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7); 113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
114 114
115 // read settings from configuration file. 115 // read settings from configuration file.
116 updateConfig(); 116 updateConfig();
117 enableRollover(FollowMonth); 117 enableRollover(FollowMonth);
118 //setFixedSize ( sizeHint() ); 118 mySizeHint = sizeHint();
119} 119}
120void KDateNavigator::slotMonthSelected( int m ) 120void KDateNavigator::slotMonthSelected( int m )
121{ 121{
122 if ( m_MthYr.month() <= mMonthSignalOffset) 122 if ( m_MthYr.month() <= mMonthSignalOffset)
123 m += 12; 123 m += 12;
124 int mo = m - mMonthSignalOffset; 124 int mo = m - mMonthSignalOffset;
125 emit monthSelected( m - mMonthSignalOffset ); 125 emit monthSelected( m - mMonthSignalOffset );
126 126
127} 127}
128void KDateNavigator::setCalendar( Calendar *cal ) 128void KDateNavigator::setCalendar( Calendar *cal )
129{ 129{
130 daymatrix->setCalendar( cal ); 130 daymatrix->setCalendar( cal );
131} 131}
132 132
133void KDateNavigator::setBaseDate( const QDate &date ) 133void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true
134{ 134{
135 m_MthYr = date; 135 m_MthYr = date;
136 136
137 updateDates(); 137 updateDates();
138 updateView(); 138 updateView();
139 139
140 KCal::DateList dates; 140 KCal::DateList dates;
141 dates.append( date ); 141 dates.append( date );
142 mNavigatorBar->selectDates( dates ); 142 mNavigatorBar->selectDates( dates );
143 143
144 daymatrix->clearSelection(); 144 daymatrix->clearSelection();
145 daymatrix->repaint(); 145 if ( doRepaint )
146 daymatrix->repaint();
146} 147}
147 148
148void KDateNavigator::enableRollover(RolloverType r) 149void KDateNavigator::enableRollover(RolloverType r)
149{ 150{
150 switch(r) 151 switch(r)
151 { 152 {
152 case None : 153 case None :
153 if (updateTimer) 154 if (updateTimer)
154 { 155 {
155 updateTimer->stop(); 156 updateTimer->stop();
156 delete updateTimer; 157 delete updateTimer;
157 updateTimer=0L; 158 updateTimer=0L;
158 } 159 }
159 break; 160 break;
160 case FollowDay : 161 case FollowDay :
161 case FollowMonth : 162 case FollowMonth :
162 if (!updateTimer) 163 if (!updateTimer)
163 { 164 {
164 updateTimer = new QTimer(this); 165 updateTimer = new QTimer(this);
165 QObject::connect(updateTimer,SIGNAL(timeout()), 166 QObject::connect(updateTimer,SIGNAL(timeout()),
166 this,SLOT(possiblyPastMidnight())); 167 this,SLOT(possiblyPastMidnight()));
167 } 168 }
168 updateTimer->start(0,true); 169 updateTimer->start(0,true);
169 lastDayChecked = QDate::currentDate(); 170 lastDayChecked = QDate::currentDate();
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 56822fa..292e71c 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -39,52 +39,54 @@ class KCalendarSystem;
39class NavigatorBar; 39class NavigatorBar;
40 40
41class KDateNavigator: public QFrame 41class KDateNavigator: public QFrame
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44 public: 44 public:
45 KDateNavigator( QWidget *parent = 0,const char *name = 0 ); 45 KDateNavigator( QWidget *parent = 0,const char *name = 0 );
46 ~KDateNavigator(); 46 ~KDateNavigator();
47 47
48 /** The DateNavigator automatically checks for 48 /** The DateNavigator automatically checks for
49 * the passage of midnight. If rollover type is 49 * the passage of midnight. If rollover type is
50 * set to None, no signals are emitted and no 50 * set to None, no signals are emitted and no
51 * processing is done. With rollover set to 51 * processing is done. With rollover set to
52 * FollowDay, the day highlighter changes at 52 * FollowDay, the day highlighter changes at
53 * midnight and dayPassed() is emitted. 53 * midnight and dayPassed() is emitted.
54 * With FollowMonth, it has the same effect 54 * With FollowMonth, it has the same effect
55 * as FollowDay but also adjusts the month that is 55 * as FollowDay but also adjusts the month that is
56 * visible and emits monthPassed() when the month changes. 56 * visible and emits monthPassed() when the month changes.
57 */ 57 */
58 enum RolloverType { None, FollowDay, FollowMonth } ; 58 enum RolloverType { None, FollowDay, FollowMonth } ;
59 void enableRollover( RolloverType ); 59 void enableRollover( RolloverType );
60 60
61 void setShowWeekNums( bool enabled ); 61 void setShowWeekNums( bool enabled );
62 void setCalendar( Calendar * ); 62 void setCalendar( Calendar * );
63 void setBaseDate( const QDate & ); 63 void setBaseDate( const QDate & , bool doRepaint = true );
64 KCal::DateList selectedDates() const { return mSelectedDates; } 64 KCal::DateList selectedDates() const { return mSelectedDates; }
65 NavigatorBar *navigatorBar() const { return mNavigatorBar; } 65 NavigatorBar *navigatorBar() const { return mNavigatorBar; }
66 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off;} 66 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off;}
67 QSize yourSizeHint() { return mySizeHint; }
68 KODayMatrix *dayMatrix() { return daymatrix ;}
67 public slots: 69 public slots:
68 void selectDates( const KCal::DateList & ); 70 void selectDates( const KCal::DateList & );
69 void updateView(); 71 void updateView();
70 void updateConfig(); 72 void updateConfig();
71 void updateDayMatrix(); 73 void updateDayMatrix();
72 74
73 signals: 75 signals:
74 void datesSelected( const KCal::DateList & ); 76 void datesSelected( const KCal::DateList & );
75 void eventDropped( Event * ); 77 void eventDropped( Event * );
76 void weekClicked( const QDate &); 78 void weekClicked( const QDate &);
77 79
78 void goPrevious(); 80 void goPrevious();
79 void goNext(); 81 void goNext();
80 82
81 void goNextMonth(); 83 void goNextMonth();
82 void goPrevMonth(); 84 void goPrevMonth();
83 void goNextYear(); 85 void goNextYear();
84 void goPrevYear(); 86 void goPrevYear();
85 void monthSelected( int ); 87 void monthSelected( int );
86 88
87 // Signals emitted at midnight carrying the new date. 89 // Signals emitted at midnight carrying the new date.
88 void dayPassed( QDate ); 90 void dayPassed( QDate );
89 void monthPassed( QDate ); 91 void monthPassed( QDate );
90 92
@@ -93,48 +95,49 @@ class KDateNavigator: public QFrame
93 /** 95 /**
94 * Called regularly to see if we need to update the view 96 * Called regularly to see if we need to update the view
95 * wrt. the today box and the month box. Only important 97 * wrt. the today box and the month box. Only important
96 * if you leave KOrganizer idle for long periods of time. 98 * if you leave KOrganizer idle for long periods of time.
97 * 99 *
98 * Until we have a reliable way of setting QTimers to go 100 * Until we have a reliable way of setting QTimers to go
99 * off at a particular wall-clock time, we need this, 101 * off at a particular wall-clock time, we need this,
100 * which calls passedMidnight() at the right moments. 102 * which calls passedMidnight() at the right moments.
101 */ 103 */
102 void possiblyPastMidnight(); 104 void possiblyPastMidnight();
103 105
104 /** handles updating the view when midnight has come by due to idle time. 106 /** handles updating the view when midnight has come by due to idle time.
105 * 107 *
106 */ 108 */
107 void passedMidnight(); 109 void passedMidnight();
108 void slotMonthSelected( int m ); 110 void slotMonthSelected( int m );
109 protected: 111 protected:
110 void updateDates(); 112 void updateDates();
111 113
112 void wheelEvent (QWheelEvent *); 114 void wheelEvent (QWheelEvent *);
113 115
114 bool eventFilter (QObject *,QEvent *); 116 bool eventFilter (QObject *,QEvent *);
115 117
116 private: 118 private:
119 QSize mySizeHint;
117 int mMonthSignalOffset; 120 int mMonthSignalOffset;
118 NavigatorBar *mNavigatorBar; 121 NavigatorBar *mNavigatorBar;
119 122
120 QFrame *headingSep; 123 QFrame *headingSep;
121 QFrame *weeknumSep; 124 QFrame *weeknumSep;
122 QLabel *headings[7]; 125 QLabel *headings[7];
123 QLabel *weeknos[7]; 126 QLabel *weeknos[7];
124 KODayMatrix *daymatrix; 127 KODayMatrix *daymatrix;
125 128
126 KCal::DateList mSelectedDates; 129 KCal::DateList mSelectedDates;
127 QDate m_MthYr; 130 QDate m_MthYr;
128 int m_fstDayOfWk; 131 int m_fstDayOfWk;
129 bool m_bShowWeekNums; 132 bool m_bShowWeekNums;
130 133
131 int dayNum(int row, int col); 134 int dayNum(int row, int col);
132 int dayToIndex(int dayNum); 135 int dayToIndex(int dayNum);
133 136
134 Calendar *mCalendar; 137 Calendar *mCalendar;
135 KCalendarSystem *mCalendarSystem; 138 KCalendarSystem *mCalendarSystem;
136 139
137 const QString *curHeaders; 140 const QString *curHeaders;
138 141
139 /** used to update the day view periodically, in particular every 142 /** used to update the day view periodically, in particular every
140 * midnight to move the "today" rectangle. 143 * midnight to move the "today" rectangle.
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index a886f4a..17a8546 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -180,49 +180,49 @@ void KODayMatrix::addSelectedDaysTo(DateList& selDays)
180 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) 180 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1)
181 if (mSelEnd > NUMDAYS-1) { 181 if (mSelEnd > NUMDAYS-1) {
182 for (int i = i0; i <= NUMDAYS-1; i++) { 182 for (int i = i0; i <= NUMDAYS-1; i++) {
183 selDays.append(days[i]); 183 selDays.append(days[i]);
184 } 184 }
185 for (int i = NUMDAYS; i < mSelEnd; i++) { 185 for (int i = NUMDAYS; i < mSelEnd; i++) {
186 selDays.append(days[0].addDays(i)); 186 selDays.append(days[0].addDays(i));
187 } 187 }
188 188
189 // apply normal routine to selection being entirely within matrix limits 189 // apply normal routine to selection being entirely within matrix limits
190 } else { 190 } else {
191 for (int i = i0; i <= mSelEnd; i++) { 191 for (int i = i0; i <= mSelEnd; i++) {
192 selDays.append(days[i]); 192 selDays.append(days[i]);
193 } 193 }
194 } 194 }
195} 195}
196 196
197void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) 197void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
198{ 198{
199 mSelStart = startdate.daysTo(start); 199 mSelStart = startdate.daysTo(start);
200 mSelEnd = startdate.daysTo(end); 200 mSelEnd = startdate.daysTo(end);
201} 201}
202void KODayMatrix::clearSelection() 202void KODayMatrix::clearSelection()
203{ 203{
204 mSelEnd = mSelStart = NOSELECTION; 204 mSelEnd = mSelStart = NOSELECTION;
205} 205}
206 206
207 207
208void KODayMatrix::recalculateToday() 208void KODayMatrix::recalculateToday()
209{ 209{
210 today = -1; 210 today = -1;
211 for (int i=0; i<NUMDAYS; i++) { 211 for (int i=0; i<NUMDAYS; i++) {
212 events[i] = 0; 212 events[i] = 0;
213 days[i] = startdate.addDays(i); 213 days[i] = startdate.addDays(i);
214 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); 214 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
215 215
216 // if today is in the currently displayed month, hilight today 216 // if today is in the currently displayed month, hilight today
217 if (days[i].year() == QDate::currentDate().year() && 217 if (days[i].year() == QDate::currentDate().year() &&
218 days[i].month() == QDate::currentDate().month() && 218 days[i].month() == QDate::currentDate().month() &&
219 days[i].day() == QDate::currentDate().day()) { 219 days[i].day() == QDate::currentDate().day()) {
220 today = i; 220 today = i;
221 } 221 }
222 } 222 }
223 // qDebug(QString("Today is visible at %1.").arg(today)); 223 // qDebug(QString("Today is visible at %1.").arg(today));
224} 224}
225 225
226void KODayMatrix::updateView() 226void KODayMatrix::updateView()
227{ 227{
228 updateView(startdate); 228 updateView(startdate);