summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-21 16:28:05 (UTC)
committer zautrix <zautrix>2005-03-21 16:28:05 (UTC)
commit070055b60f76ffd6907e44a4ffc2d752578f3211 (patch) (unidiff)
tree727346a900b4712f36842c460bfa0fef1ba6382b /korganizer
parent86c420a68008e4430bd769ebdecdfa430ba552f5 (diff)
downloadkdepimpi-070055b60f76ffd6907e44a4ffc2d752578f3211.zip
kdepimpi-070055b60f76ffd6907e44a4ffc2d752578f3211.tar.gz
kdepimpi-070055b60f76ffd6907e44a4ffc2d752578f3211.tar.bz2
fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigatorcontainer.cpp7
-rw-r--r--korganizer/kodaymatrix.cpp9
2 files changed, 14 insertions, 2 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index 9506768..b147427 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -110,49 +110,54 @@ void DateNavigatorContainer::updateView()
110{ 110{
111 mNavigatorView->updateView(); 111 mNavigatorView->updateView();
112 KDateNavigator *n; 112 KDateNavigator *n;
113 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 113 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
114 n->updateView(); 114 n->updateView();
115 } 115 }
116} 116}
117 117
118void DateNavigatorContainer::updateConfig() 118void DateNavigatorContainer::updateConfig()
119{ 119{
120 mNavigatorView->updateConfig(); 120 mNavigatorView->updateConfig();
121 KDateNavigator *n; 121 KDateNavigator *n;
122 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 122 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
123 n->updateConfig(); 123 n->updateConfig();
124 } 124 }
125} 125}
126 126
127void DateNavigatorContainer::selectDates( const DateList &dateList ) 127void DateNavigatorContainer::selectDates( const DateList &dateList )
128{ 128{
129 mNavigatorView->selectDates( dateList ); 129 mNavigatorView->selectDates( dateList );
130 setBaseDates(); 130 setBaseDates();
131 if ( mExtraViews.count() ) { 131 if ( mExtraViews.count() ) {
132 KDateNavigator *view = mExtraViews.at( 0 ); 132 KDateNavigator *view = mExtraViews.at( 0 );
133 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); 133 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
134 view->dayMatrix()->repaint( false ); 134 view->dayMatrix()->repaint( false );
135 if ( mExtraViews.count() > 1 ) {
136 KDateNavigator *view = mExtraViews.at( 1 );
137 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
138 view->dayMatrix()->repaint( false );
139 }
135 } 140 }
136} 141}
137 142
138void DateNavigatorContainer::setBaseDates() 143void DateNavigatorContainer::setBaseDates()
139{ 144{
140 KCal::DateList dateList = mNavigatorView->selectedDates(); 145 KCal::DateList dateList = mNavigatorView->selectedDates();
141 if ( dateList.isEmpty() ) { 146 if ( dateList.isEmpty() ) {
142 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; 147 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl;
143 } 148 }
144 QDate baseDate = dateList.first(); 149 QDate baseDate = dateList.first();
145 KDateNavigator *n; 150 KDateNavigator *n;
146 bool doRepaint = false; // skip first repaint 151 bool doRepaint = false; // skip first repaint
147 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 152 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
148 baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); 153 baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 );
149 n->setBaseDate( baseDate, doRepaint ); 154 n->setBaseDate( baseDate, doRepaint );
150 doRepaint = true; 155 doRepaint = true;
151 } 156 }
152} 157}
153 158
154void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) 159void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
155{ 160{
156#if 0 161#if 0
157 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; 162 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl;
158 kdDebug(5850) << " CURRENT SIZE: " << size() << endl; 163 kdDebug(5850) << " CURRENT SIZE: " << size() << endl;
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index a776cb6..d7a4112 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -269,48 +269,49 @@ void KODayMatrix::addSelectedDaysTo(DateList& selDays)
269 269
270 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) 270 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1)
271 if (mSelEnd > NUMDAYS-1) { 271 if (mSelEnd > NUMDAYS-1) {
272 for (int i = i0; i <= NUMDAYS-1; i++) { 272 for (int i = i0; i <= NUMDAYS-1; i++) {
273 selDays.append(days[i]); 273 selDays.append(days[i]);
274 } 274 }
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) 287void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
288{ 288{
289 mSelStart = startdate.daysTo(start); 289 mSelStart = startdate.daysTo(start);
290 if ( mSelStart < 0 ) 290 if ( mSelStart < 0 )
291 mSelStart = 0; 291 mSelStart = 0;
292 mSelEnd = startdate.daysTo(end); 292 mSelEnd = startdate.daysTo(end);
293 //qDebug("SELECTION %d %d ", mSelStart ,mSelEnd );
293 if ( mSelEnd < 0 ) 294 if ( mSelEnd < 0 )
294 clearSelection(); 295 clearSelection();
295} 296}
296void KODayMatrix::clearSelection() 297void KODayMatrix::clearSelection()
297{ 298{
298 mSelEnd = mSelStart = NOSELECTION; 299 mSelEnd = mSelStart = NOSELECTION;
299} 300}
300 301
301 302
302void KODayMatrix::recalculateToday() 303void KODayMatrix::recalculateToday()
303{ 304{
304 today = -1; 305 today = -1;
305 for (int i=0; i<NUMDAYS; i++) { 306 for (int i=0; i<NUMDAYS; i++) {
306 events[i] = 0; 307 events[i] = 0;
307 days[i] = startdate.addDays(i); 308 days[i] = startdate.addDays(i);
308 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); 309 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
309 310
310 // if today is in the currently displayed month, hilight today 311 // if today is in the currently displayed month, hilight today
311 if (days[i].year() == QDate::currentDate().year() && 312 if (days[i].year() == QDate::currentDate().year() &&
312 days[i].month() == QDate::currentDate().month() && 313 days[i].month() == QDate::currentDate().month() &&
313 days[i].day() == QDate::currentDate().day()) { 314 days[i].day() == QDate::currentDate().day()) {
314 today = i; 315 today = i;
315 } 316 }
316 } 317 }
@@ -670,49 +671,55 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
670 int row,col; 671 int row,col;
671 int selw, selh; 672 int selw, selh;
672 int xyOff = frameWidth(); 673 int xyOff = frameWidth();
673 int colModulo = sz.width() % 7; 674 int colModulo = sz.width() % 7;
674 int rowModulo = sz.height() % 6; 675 int rowModulo = sz.height() % 6;
675 //qDebug("col %d row %d ",colModulo,rowModulo ); 676 //qDebug("col %d row %d ",colModulo,rowModulo );
676 677
677 bool isRTL = KOGlobals::self()->reverseLayout(); 678 bool isRTL = KOGlobals::self()->reverseLayout();
678 679
679 // draw background and topleft frame 680 // draw background and topleft frame
680 p.fillRect(pevent->rect(), mDefaultBackColor); 681 p.fillRect(pevent->rect(), mDefaultBackColor);
681 p.setPen(mDefaultTextColor); 682 p.setPen(mDefaultTextColor);
682 p.drawRect(0, 0, sz.width()+1, sz.height()+1); 683 p.drawRect(0, 0, sz.width()+1, sz.height()+1);
683 int mSelStartT = mSelStart; 684 int mSelStartT = mSelStart;
684 int mSelEndT = mSelEnd; 685 int mSelEndT = mSelEnd;
685 if ( mSelEndT >= NUMDAYS ) 686 if ( mSelEndT >= NUMDAYS )
686 mSelEndT = NUMDAYS-1; 687 mSelEndT = NUMDAYS-1;
687 // draw selected days with highlighted background color 688 // draw selected days with highlighted background color
688 if (mSelStart != NOSELECTION) { 689 if (mSelStart != NOSELECTION) {
689 bool skip = false; 690 bool skip = false;
690 if ( ! mouseDown ) { 691 if ( ! mouseDown ) {
691 int mo = days[20].month(); 692 int mo = days[20].month();
692 //qDebug("-- %d %d ", mSelStartT, mSelEndT); 693 //qDebug("-- %d %d ", mSelStartT, mSelEndT);
693 //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); 694 //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() );
694 if ( days[mSelStartT].month() > mo || days[mSelEndT].month() < mo ) { 695 int startMo = days[mSelStartT].month();
696 int endMo = days[mSelEndT].month();
697 if ( startMo == 12 && mo == 1 && endMo == 1 )
698 startMo = 1;
699 if ( endMo == 1 && mo == 12 )
700 endMo = 12;
701 if ( (startMo > mo || endMo < mo) ) {
695 skip = true; 702 skip = true;
696 } else { 703 } else {
697 if ( days[mSelStartT].month() != mo ) { 704 if ( days[mSelStartT].month() != mo ) {
698 int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); 705 int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day();
699 mSelStartT += add +1; 706 mSelStartT += add +1;
700 } 707 }
701 if ( days[mSelEndT].month() != mo ) { 708 if ( days[mSelEndT].month() != mo ) {
702 int sub = days[mSelEndT].day(); 709 int sub = days[mSelEndT].day();
703 mSelEndT -= sub ; 710 mSelEndT -= sub ;
704 } 711 }
705 } 712 }
706 } 713 }
707 if ( ! skip ) { 714 if ( ! skip ) {
708 row = mSelStartT/7; 715 row = mSelStartT/7;
709 col = mSelStartT -row*7; 716 col = mSelStartT -row*7;
710 QColor selcol = KOPrefs::instance()->mHighlightColor; 717 QColor selcol = KOPrefs::instance()->mHighlightColor;
711 int addCol = 0; 718 int addCol = 0;
712 int addRow = 0; 719 int addRow = 0;
713 int addRow2 = 0; 720 int addRow2 = 0;
714 int addCol2 = 0; 721 int addCol2 = 0;
715 if (row == mSelEndT/7) { 722 if (row == mSelEndT/7) {
716 if ( rowModulo ) { 723 if ( rowModulo ) {
717 if ( row >= 6 - rowModulo ) 724 if ( row >= 6 - rowModulo )
718 addRow = row - 5 + rowModulo; 725 addRow = row - 5 + rowModulo;