summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigatorcontainer.cpp83
-rw-r--r--korganizer/datenavigatorcontainer.h2
-rw-r--r--korganizer/kdatenavigator.h3
-rw-r--r--korganizer/kodaymatrix.cpp16
-rw-r--r--korganizer/kodaymatrix.h2
5 files changed, 82 insertions, 24 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index 18756f0..bb27bce 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -37,24 +37,26 @@
37 37
38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, 38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
39 const char *name ) 39 const char *name )
40 : QWidget( parent, name ), mCalendar( 0 ), 40 : QWidget( parent, name ), mCalendar( 0 ),
41 mHorizontalCount( 1 ), mVerticalCount( 1 ) 41 mHorizontalCount( 1 ), mVerticalCount( 1 )
42{ 42{
43 mExtraViews.setAutoDelete( true ); 43 mExtraViews.setAutoDelete( true );
44 44
45 mNavigatorView = new KDateNavigator( this, name ); 45 mNavigatorView = new KDateNavigator( this, name );
46 46
47 connectNavigatorView( mNavigatorView ); 47 connectNavigatorView( mNavigatorView );
48 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 48 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
49 mDisplayedEndDate = QDate::currentDate();
50 mLastDisplayedDN = 0;
49} 51}
50 52
51DateNavigatorContainer::~DateNavigatorContainer() 53DateNavigatorContainer::~DateNavigatorContainer()
52{ 54{
53} 55}
54 56
55void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) 57void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
56{ 58{
57 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), 59 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
58 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 60 SIGNAL( datesSelected( const KCal::DateList & ) ) );
59#if 0 61#if 0
60 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), 62 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
@@ -71,95 +73,131 @@ void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
71 connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 73 connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
72 connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 74 connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
73 connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); 75 connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
74 connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); 76 connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
75 77
76 connect( v, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); 78 connect( v, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) );
77} 79}
78 80
79void DateNavigatorContainer::setCalendar( Calendar *cal ) 81void DateNavigatorContainer::setCalendar( Calendar *cal )
80{ 82{
81 mCalendar = cal; 83 mCalendar = cal;
82 mNavigatorView->setCalendar( cal ); 84 mNavigatorView->setCalendar( cal );
83 KDateNavigator *n; 85 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
84 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 86 KDateNavigator *n = mExtraViews.at( i );
85 n->setCalendar( cal ); 87 n->setCalendar( cal );
86 } 88 }
87} 89}
88 90
89void DateNavigatorContainer::updateDayMatrix() 91void DateNavigatorContainer::updateDayMatrix()
90{ 92{
91 mNavigatorView->updateDayMatrix(); 93 mNavigatorView->updateDayMatrix();
92 KDateNavigator *n; 94 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
93 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 95 KDateNavigator *n = mExtraViews.at( i );
94 n->updateDayMatrix(); 96 n->updateDayMatrix();
95 } 97 }
96} 98}
97 99
98void DateNavigatorContainer::updateToday() 100void DateNavigatorContainer::updateToday()
99{ 101{
100 qDebug("DateNavigatorContainer::updateToday() NOT IMPL "); 102 qDebug("DateNavigatorContainer::updateToday() NOT IMPL ");
101#if 0 103#if 0
102 mNavigatorView->updateToday(); 104 mNavigatorView->updateToday();
103 KDateNavigator *n; 105 KDateNavigator *n;
104 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 106 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
105 n->updateToday(); 107 n->updateToday();
106 } 108 }
107#endif 109#endif
108} 110}
109 111
110void DateNavigatorContainer::updateView() 112void DateNavigatorContainer::updateView()
111{ 113{
112 mNavigatorView->updateView(); 114 mNavigatorView->updateView();
113 KDateNavigator *n; 115 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
114 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 116 KDateNavigator *n = mExtraViews.at( i );
115 n->updateView(); 117 n->updateView();
116 } 118 }
117} 119}
118 120
119void DateNavigatorContainer::updateConfig() 121void DateNavigatorContainer::updateConfig()
120{ 122{
121 mNavigatorView->updateConfig(); 123 mNavigatorView->updateConfig();
122 KDateNavigator *n; 124 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
123 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 125 KDateNavigator *n = mExtraViews.at( i );
124 n->updateConfig(); 126 n->updateConfig();
125 } 127 }
126} 128}
127 129
128void DateNavigatorContainer::selectDates( const DateList &dateList ) 130void DateNavigatorContainer::selectDates( const DateList &dateList )
129{ 131{
130 mNavigatorView->selectDates( dateList ); 132 if ( !mLastDisplayedDN ) {
131 setBaseDates(); 133 mNavigatorView->selectDates( dateList );
132 if ( mExtraViews.count() ) { 134 return;
135 }
136 QDate fDate = dateList.first();
137 QDate lDate = dateList.last();
138 if ( mLastDisplayedDN <= 2 ) {
139 mNavigatorView->selectDates( dateList );
140 KDateNavigator *view = mExtraViews.at( 0 );
141 QDate bDate = fDate.addDays( fDate.daysInMonth () - fDate.day() +1 );
142 view->setBaseDate( bDate, false );
143 view->dayMatrix()->setSelectedDaysFrom(fDate , lDate);
144 if ( mLastDisplayedDN == 2 ) {
145 view = mExtraViews.at( 1 );
146 bDate = bDate.addDays( bDate.daysInMonth () - bDate.day() +1 );
147 view->setBaseDate( bDate, false );
148 view->dayMatrix()->setSelectedDaysFrom(fDate , lDate);
149 }
150 return;
151 }
152 KDateNavigator *view = mExtraViews.at( 0 );
153 QDate date = view->baseDate();
154
155 QDate curEnd = date.addDays( (mLastDisplayedDN)*30 +7);
156 //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() );
157 if ( lDate < curEnd && date.addDays( -30 ) < fDate) {
158 mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate );
159 mNavigatorView->dayMatrix()->repaint( false );
160 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
161 KDateNavigator *n = mExtraViews.at( i );
162 if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) {
163 n->dayMatrix()->repaint( false );
164 }
165 }
166 return;
167 }
168 mNavigatorView->selectDates( dateList );
169 setBaseDates();
170 if ( mLastDisplayedDN ) {
133 KDateNavigator *view = mExtraViews.at( 0 ); 171 KDateNavigator *view = mExtraViews.at( 0 );
134 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); 172 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
135 view->dayMatrix()->repaint( false ); 173 view->dayMatrix()->repaint( false );
136 if ( mExtraViews.count() > 1 ) { 174 if ( mLastDisplayedDN > 1 ) {
137 KDateNavigator *view = mExtraViews.at( 1 ); 175 KDateNavigator *view = mExtraViews.at( 1 );
138 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); 176 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
139 view->dayMatrix()->repaint( false ); 177 view->dayMatrix()->repaint( false );
140 } 178 }
141 } 179 }
142} 180}
143 181
144void DateNavigatorContainer::setBaseDates() 182void DateNavigatorContainer::setBaseDates()
145{ 183{
146 KCal::DateList dateList = mNavigatorView->selectedDates(); 184 KCal::DateList dateList = mNavigatorView->selectedDates();
147 if ( dateList.isEmpty() ) { 185 if ( dateList.isEmpty() ) {
148 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; 186 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl;
149 } 187 }
150 QDate baseDate = dateList.first(); 188 QDate baseDate = dateList.first();
151 KDateNavigator *n;
152 bool doRepaint = false; // skip first repaint 189 bool doRepaint = false; // skip first repaint
153 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 190 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
191 KDateNavigator *n = mExtraViews.at( i );
154 baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); 192 baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 );
155 n->setBaseDate( baseDate, doRepaint ); 193 n->setBaseDate( baseDate, doRepaint );
156 doRepaint = true; 194 doRepaint = true;
157 } 195 }
158} 196}
159 197
160void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) 198void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
161{ 199{
162#if 0 200#if 0
163 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; 201 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl;
164 kdDebug(5850) << " CURRENT SIZE: " << size() << endl; 202 kdDebug(5850) << " CURRENT SIZE: " << size() << endl;
165 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; 203 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl;
@@ -202,63 +240,68 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
202 verticalCount = 1; 240 verticalCount = 1;
203 fontchange = true; 241 fontchange = true;
204 count = horizontalCount * verticalCount; 242 count = horizontalCount * verticalCount;
205 } else { 243 } else {
206 if ( mNavigatorView->fontChanged() ) { 244 if ( mNavigatorView->fontChanged() ) {
207 fontchange = true; 245 fontchange = true;
208 fo = KOPrefs::instance()->mDateNavigatorFont; 246 fo = KOPrefs::instance()->mDateNavigatorFont;
209 mNavigatorView->changeFont( fo ); 247 mNavigatorView->changeFont( fo );
210 mNavigatorView->unsetFontChanged(); 248 mNavigatorView->unsetFontChanged();
211 } 249 }
212 } 250 }
213 251
252 mLastDisplayedDN = horizontalCount*verticalCount-1;
253 bool setBaseD = false;
214 while ( count > ( mExtraViews.count() + 1 ) ) { 254 while ( count > ( mExtraViews.count() + 1 ) ) {
215 KDateNavigator *n = new KDateNavigator( this ); 255 KDateNavigator *n = new KDateNavigator( this );
216 n->setMonthSignalOffset ( mExtraViews.count()+1 ); 256 n->setMonthSignalOffset ( mExtraViews.count()+1 );
217 mExtraViews.append( n ); 257 mExtraViews.append( n );
218 n->setCalendar( mCalendar ); 258 n->setCalendar( mCalendar );
219 setBaseDates(); 259 setBaseD = true;
220 connectNavigatorView( n ); 260 connectNavigatorView( n );
221 n->show(); 261 n->show();
222 } 262 }
223 int iii = 0; 263 int iii = 0;
224 while ( iii < ( mExtraViews.count() ) ) { 264 while ( iii < ( mExtraViews.count() ) ) {
225 if ( iii < count-1 ) 265 if ( iii < count-1 )
226 mExtraViews.at( iii )->show(); 266 mExtraViews.at( iii )->show();
227 else 267 else
228 mExtraViews.at( iii )->hide(); 268 mExtraViews.at( iii )->hide();
229 ++iii; 269 ++iii;
230 } 270 }
271 if ( setBaseD )
272 setBaseDates();
231 if ( fontchange ) { 273 if ( fontchange ) {
232 //mNavigatorView->changeFont( fo ); 274 //mNavigatorView->changeFont( fo );
233 uint i; 275 uint i;
234 for( i = 0; i < mExtraViews.count(); ++i ) { 276 for( i = 0; i < mExtraViews.count(); ++i ) {
235 KDateNavigator *view = mExtraViews.at( i ); 277 KDateNavigator *view = mExtraViews.at( i );
236 view->changeFont( fo ); 278 view->changeFont( fo );
237 } 279 }
238 } 280 }
239 mHorizontalCount = horizontalCount; 281 mHorizontalCount = horizontalCount;
240 mVerticalCount = verticalCount; 282 mVerticalCount = verticalCount;
283
241 } 284 }
242 //qDebug("COUNT %d ", mExtraViews.count()); 285 //qDebug("COUNT %d ", mExtraViews.count());
243 int height = size().height() / verticalCount; 286 int height = size().height() / verticalCount;
244 int width = size().width() / horizontalCount; 287 int width = size().width() / horizontalCount;
245 288
246 NavigatorBar *bar = mNavigatorView->navigatorBar(); 289 NavigatorBar *bar = mNavigatorView->navigatorBar();
247 if ( horizontalCount > 1 ) bar->showButtons( true, false ); 290 if ( horizontalCount > 1 ) bar->showButtons( true, false );
248 else bar->showButtons( true, true ); 291 else bar->showButtons( true, true );
249 292
250 mNavigatorView->setGeometry(0, 293 mNavigatorView->setGeometry(0,
251 0, width, height ); 294 0, width, height );
252 for( uint i = 0; i < mExtraViews.count(); ++i ) { 295 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
253 int x = ( i + 1 ) % horizontalCount; 296 int x = ( i + 1 ) % horizontalCount;
254 int y = ( i + 1 ) / horizontalCount; 297 int y = ( i + 1 ) / horizontalCount;
255 298
256 KDateNavigator *view = mExtraViews.at( i ); 299 KDateNavigator *view = mExtraViews.at( i );
257 bar = view->navigatorBar(); 300 bar = view->navigatorBar();
258 if ( y > 0 ) bar->showButtons( false, false ); 301 if ( y > 0 ) bar->showButtons( false, false );
259 else { 302 else {
260 if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); 303 if ( x + 1 == horizontalCount ) bar->showButtons( false, true );
261 else bar->showButtons( false, false ); 304 else bar->showButtons( false, false );
262 } 305 }
263 view->setGeometry( x * width, 306 view->setGeometry( x * width,
264 y * height, width, height ); 307 y * height, width, height );
diff --git a/korganizer/datenavigatorcontainer.h b/korganizer/datenavigatorcontainer.h
index affa8e1..f45af20 100644
--- a/korganizer/datenavigatorcontainer.h
+++ b/korganizer/datenavigatorcontainer.h
@@ -68,23 +68,25 @@ class DateNavigatorContainer: public QWidget
68 void goNextYear(); 68 void goNextYear();
69 void goPrevYear(); 69 void goPrevYear();
70 70
71 void monthSelected( int month ); 71 void monthSelected( int month );
72 72
73 protected: 73 protected:
74 void resizeEvent( QResizeEvent * ); 74 void resizeEvent( QResizeEvent * );
75 75
76 void setBaseDates(); 76 void setBaseDates();
77 void connectNavigatorView( KDateNavigator *v ); 77 void connectNavigatorView( KDateNavigator *v );
78 78
79 private: 79 private:
80 int mLastDisplayedDN;
81 QDate mDisplayedEndDate;
80 KDateNavigator *mNavigatorView; 82 KDateNavigator *mNavigatorView;
81 83
82 KCal::Calendar *mCalendar; 84 KCal::Calendar *mCalendar;
83 85
84 QPtrList<KDateNavigator> mExtraViews; 86 QPtrList<KDateNavigator> mExtraViews;
85 87
86 int mHorizontalCount; 88 int mHorizontalCount;
87 int mVerticalCount; 89 int mVerticalCount;
88}; 90};
89 91
90#endif 92#endif
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 10bc1be..93bbceb 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -52,24 +52,27 @@ class KDateNavigator: public QFrame
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 & , bool doRepaint = true ); 63 void setBaseDate( const QDate & , bool doRepaint = true );
64
65 QDate baseDate() const { return m_MthYr;}
66
64 KCal::DateList selectedDates() const { return mSelectedDates; } 67 KCal::DateList selectedDates() const { return mSelectedDates; }
65 NavigatorBar *navigatorBar() const { return mNavigatorBar; } 68 NavigatorBar *navigatorBar() const { return mNavigatorBar; }
66 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;} 69 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;}
67 QSize yourSizeHint()const { return mySizeHint; }; 70 QSize yourSizeHint()const { return mySizeHint; };
68 QSize yourFullSizeHint() const { return myFullSizeHint;}; 71 QSize yourFullSizeHint() const { return myFullSizeHint;};
69 QFont yourFontHint( QSize , bool * b); 72 QFont yourFontHint( QSize , bool * b);
70 bool fontChanged() {return mFontChanged; } 73 bool fontChanged() {return mFontChanged; }
71 void unsetFontChanged() { mFontChanged = false; } 74 void unsetFontChanged() { mFontChanged = false; }
72 KODayMatrix *dayMatrix() { return daymatrix ;} 75 KODayMatrix *dayMatrix() { return daymatrix ;}
73 QSize sizeHint() const; 76 QSize sizeHint() const;
74 QSize sizeHintTwoButtons( int butnum = 2 ) const; 77 QSize sizeHintTwoButtons( int butnum = 2 ) const;
75 void changeFont ( QFont fo ); 78 void changeFont ( QFont fo );
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index a2e0ae0..3ee1fa7 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -275,33 +275,40 @@ void KODayMatrix::addSelectedDaysTo(DateList& selDays)
275 for (int i = NUMDAYS; i < mSelEnd; i++) { 275 for (int i = NUMDAYS; i < mSelEnd; i++) {
276 selDays.append(days[0].addDays(i)); 276 selDays.append(days[0].addDays(i));
277 } 277 }
278 278
279 // apply normal routine to selection being entirely within matrix limits 279 // apply normal routine to selection being entirely within matrix limits
280 } else { 280 } else {
281 for (int i = i0; i <= mSelEnd; i++) { 281 for (int i = i0; i <= mSelEnd; i++) {
282 selDays.append(days[i]); 282 selDays.append(days[i]);
283 } 283 }
284 } 284 }
285} 285}
286 286
287void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) 287bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
288{ 288{
289 bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION );
289 mSelStart = startdate.daysTo(start); 290 mSelStart = startdate.daysTo(start);
290 if ( mSelStart < 0 ) 291 if ( mSelStart < 0 )
291 mSelStart = 0; 292 mSelStart = 0;
292 mSelEnd = startdate.daysTo(end); 293 mSelEnd = startdate.daysTo(end);
293 //qDebug("SELECTION %d %d ", mSelStart ,mSelEnd ); 294 if ( mSelEnd > NUMDAYS-1 )
294 if ( mSelEnd < 0 ) 295 mSelEnd = NUMDAYS-1;
296 if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) {
295 clearSelection(); 297 clearSelection();
298 if ( noSel )
299 return false;
300 }
301
302 return true;
296} 303}
297void KODayMatrix::clearSelection() 304void KODayMatrix::clearSelection()
298{ 305{
299 mSelEnd = mSelStart = NOSELECTION; 306 mSelEnd = mSelStart = NOSELECTION;
300} 307}
301 308
302 309
303void KODayMatrix::recalculateToday() 310void KODayMatrix::recalculateToday()
304{ 311{
305 today = -1; 312 today = -1;
306 for (int i=0; i<NUMDAYS; i++) { 313 for (int i=0; i<NUMDAYS; i++) {
307 events[i] = 0; 314 events[i] = 0;
@@ -690,37 +697,40 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
690 if (mSelStart != NOSELECTION) { 697 if (mSelStart != NOSELECTION) {
691 bool skip = false; 698 bool skip = false;
692 if ( ! mouseDown ) { 699 if ( ! mouseDown ) {
693 int mo = days[20].month(); 700 int mo = days[20].month();
694 //qDebug("-- %d %d ", mSelStartT, mSelEndT); 701 //qDebug("-- %d %d ", mSelStartT, mSelEndT);
695 //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); 702 //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() );
696 int startMo = days[mSelStartT].month(); 703 int startMo = days[mSelStartT].month();
697 int endMo = days[mSelEndT].month(); 704 int endMo = days[mSelEndT].month();
698 if ( startMo == 12 && mo == 1 && endMo <= 2 ) 705 if ( startMo == 12 && mo == 1 && endMo <= 2 )
699 startMo = 1; 706 startMo = 1;
700 if ( endMo == 1 && mo == 12 ) 707 if ( endMo == 1 && mo == 12 )
701 endMo = 12; 708 endMo = 12;
709 if ( mo == 12 && startMo == 1 )
710 startMo = 13;
702 if ( (startMo > mo || endMo < mo) ) { 711 if ( (startMo > mo || endMo < mo) ) {
703 skip = true; 712 skip = true;
704 } else { 713 } else {
705 if ( days[mSelStartT].month() != mo ) { 714 if ( days[mSelStartT].month() != mo ) {
706 int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); 715 int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day();
707 mSelStartT += add +1; 716 mSelStartT += add +1;
708 } 717 }
709 if ( days[mSelEndT].month() != mo ) { 718 if ( days[mSelEndT].month() != mo ) {
710 int sub = days[mSelEndT].day(); 719 int sub = days[mSelEndT].day();
711 mSelEndT -= sub ; 720 mSelEndT -= sub ;
712 } 721 }
713 } 722 }
714 } 723 }
724 //qDebug("SKIP %d ", skip);
715 if ( ! skip ) { 725 if ( ! skip ) {
716 row = mSelStartT/7; 726 row = mSelStartT/7;
717 col = mSelStartT -row*7; 727 col = mSelStartT -row*7;
718 QColor selcol = KOPrefs::instance()->mHighlightColor; 728 QColor selcol = KOPrefs::instance()->mHighlightColor;
719 int addCol = 0; 729 int addCol = 0;
720 int addRow = 0; 730 int addRow = 0;
721 int addRow2 = 0; 731 int addRow2 = 0;
722 int addCol2 = 0; 732 int addCol2 = 0;
723 if (row == mSelEndT/7) { 733 if (row == mSelEndT/7) {
724 if ( rowModulo ) { 734 if ( rowModulo ) {
725 if ( row >= 6 - rowModulo ) 735 if ( row >= 6 - rowModulo )
726 addRow = row - 5 + rowModulo; 736 addRow = row - 5 + rowModulo;
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index 10f4b05..2a1959c 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -145,25 +145,25 @@ public:
145 */ 145 */
146 QString getHolidayLabel(int offset); 146 QString getHolidayLabel(int offset);
147 147
148 /** adds all actual selected days from mSelStart to mSelEnd to the supplied 148 /** adds all actual selected days from mSelStart to mSelEnd to the supplied
149 * DateList. 149 * DateList.
150 */ 150 */
151 void addSelectedDaysTo(DateList&); 151 void addSelectedDaysTo(DateList&);
152 152
153 /** sets the actual to be displayed selection in the day matrix starting from 153 /** sets the actual to be displayed selection in the day matrix starting from
154 * start and ending with end. Theview must be manually updated by calling 154 * start and ending with end. Theview must be manually updated by calling
155 * repaint. (?) 155 * repaint. (?)
156 */ 156 */
157 void setSelectedDaysFrom(const QDate& start, const QDate& end); 157 bool setSelectedDaysFrom(const QDate& start, const QDate& end);
158 void clearSelection(); 158 void clearSelection();
159 159
160 /** Is today visible in the view? Keep this in sync with 160 /** Is today visible in the view? Keep this in sync with
161 * the values today (below) can take. 161 * the values today (below) can take.
162 */ 162 */
163 bool isTodayVisible() const { return today>=0; } ; 163 bool isTodayVisible() const { return today>=0; } ;
164 164
165 /** If today is visible, then we can find out if today is 165 /** If today is visible, then we can find out if today is
166 * near the beginning or the end of the month. 166 * near the beginning or the end of the month.
167 * This is dependent on today remaining the index 167 * This is dependent on today remaining the index
168 * in the array of visible dates and going from 168 * in the array of visible dates and going from
169 * top left (0) to bottom right (41). 169 * top left (0) to bottom right (41).