summaryrefslogtreecommitdiff
path: root/core
authorpaule <paule>2007-01-31 09:30:53 (UTC)
committer paule <paule>2007-01-31 09:30:53 (UTC)
commit6b321230cf24e50b11783b3511a457f22ae79a58 (patch) (unidiff)
tree9d04ba6204bdc7be6b9e4ee2645b00d56a9c6f77 /core
parente9c5c237e27d908c890779215b19c22a3706b614 (diff)
downloadopie-6b321230cf24e50b11783b3511a457f22ae79a58.zip
opie-6b321230cf24e50b11783b3511a457f22ae79a58.tar.gz
opie-6b321230cf24e50b11783b3511a457f22ae79a58.tar.bz2
Show events on all visible days in the month view, not just those within the current month. Fixes bug #1351.
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/modules/monthview/odatebookmonth.cpp62
-rw-r--r--core/pim/datebook/modules/monthview/odatebookmonth.h2
2 files changed, 46 insertions, 18 deletions
diff --git a/core/pim/datebook/modules/monthview/odatebookmonth.cpp b/core/pim/datebook/modules/monthview/odatebookmonth.cpp
index d52a092..e4de279 100644
--- a/core/pim/datebook/modules/monthview/odatebookmonth.cpp
+++ b/core/pim/datebook/modules/monthview/odatebookmonth.cpp
@@ -179,2 +179,18 @@ void ODateBookMonthTable::findDay( int day, int &row, int &col )
179 179
180bool ODateBookMonthTable::findDate( QDate date, int &row, int &col )
181{
182 int rows = numRows();
183 int cols = numCols();
184 for(int r=0;r<rows;r++) {
185 for(int c=0;c<cols;c++) {
186 if(getDateAt(r, c) == date) {
187 row = r;
188 col = c;
189 return true;
190 }
191 }
192 }
193 return false;
194}
195
180void ODateBookMonthTable::dayClicked( int row, int col ) 196void ODateBookMonthTable::dayClicked( int row, int col )
@@ -192,27 +208,38 @@ void ODateBookMonthTable::changeDaySelection( int row, int col )
192{ 208{
209 QDate selDate = getDateAt( row, col );
210 selYear = selDate.year();
211 selMonth = selDate.month();
212 selDay = selDate.day();
213}
214
215QDate ODateBookMonthTable::getDateAt( int row, int col )
216{
217 int itemMonth, itemYear;
218
193 DayItemMonth *i = (DayItemMonth*)item( row, col ); 219 DayItemMonth *i = (DayItemMonth*)item( row, col );
194 if ( !i ) 220 if ( !i )
195 return; 221 return QDate(1900, 1, 1);
196 switch ( i->type() ) { 222 switch ( i->type() ) {
197 case Calendar::Day::ThisMonth: 223 case Calendar::Day::ThisMonth:
198 selMonth = month; 224 itemMonth = month;
199 break; 225 break;
200 case Calendar::Day::PrevMonth: 226 case Calendar::Day::PrevMonth:
201 selMonth = month-1; 227 itemMonth = month-1;
202 break; 228 break;
203 default: 229 default:
204 selMonth = month+1; 230 itemMonth = month+1;
205 } 231 }
206 232
207 selYear = year; 233 itemYear = year;
208 if ( selMonth <= 0 ) { 234 if ( itemMonth <= 0 ) {
209 selMonth = 12; 235 itemMonth = 12;
210 selYear--; 236 itemYear--;
211 } else if ( selMonth > 12 ) { 237 }
212 selMonth = 1; 238 else if ( itemMonth > 12 ) {
213 selYear++; 239 itemMonth = 1;
240 itemYear++;
214 } 241 }
215 selDay = i->day();
216}
217 242
243 return QDate( itemYear, itemMonth, i->day());
244}
218 245
@@ -228,6 +255,5 @@ void ODateBookMonthTable::getEvents()
228 255
229 QDate dtStart( year, month, 1 ); 256 QDate dtStart = getDateAt(0,0);
230 d->mMonthEvents = db->getEffectiveEvents( dtStart, 257 QDate dtEnd = getDateAt(numRows()-1, numCols()-1);
231 QDate( year, month, 258 d->mMonthEvents = db->getEffectiveEvents( dtStart, dtEnd);
232 dtStart.daysInMonth() ) );
233 QValueListIterator<EffectiveEvent> it = d->mMonthEvents.begin(); 259 QValueListIterator<EffectiveEvent> it = d->mMonthEvents.begin();
@@ -247,3 +273,3 @@ void ODateBookMonthTable::getEvents()
247 int row, col; 273 int row, col;
248 findDay( e.date().day(), row, col ); 274 findDate( e.date(), row, col );
249 DayItemMonth* w = static_cast<DayItemMonth*>( item( row, col ) ); 275 DayItemMonth* w = static_cast<DayItemMonth*>( item( row, col ) );
diff --git a/core/pim/datebook/modules/monthview/odatebookmonth.h b/core/pim/datebook/modules/monthview/odatebookmonth.h
index e967abe..a81a161 100644
--- a/core/pim/datebook/modules/monthview/odatebookmonth.h
+++ b/core/pim/datebook/modules/monthview/odatebookmonth.h
@@ -83,4 +83,6 @@ private:
83 void findDay( int day, int &row, int &col ); 83 void findDay( int day, int &row, int &col );
84 bool findDate( QDate date, int &row, int &col );
84 void getEvents(); 85 void getEvents();
85 void changeDaySelection( int row, int col ); 86 void changeDaySelection( int row, int col );
87 QDate getDateAt( int row, int col );
86 88