author | simon <simon> | 2002-04-30 14:28:04 (UTC) |
---|---|---|
committer | simon <simon> | 2002-04-30 14:28:04 (UTC) |
commit | b7b0040f0a8069d36e3f5ad0bed0ce992dd30780 (patch) (side-by-side diff) | |
tree | 39ac29f14f3e2e153af816b7a9f0f2d821bb075a /core/pim/datebook/datebookweek.cpp | |
parent | 972fbb128294c821ff0f13ea59a83edb015d571e (diff) | |
download | opie-b7b0040f0a8069d36e3f5ad0bed0ce992dd30780.zip opie-b7b0040f0a8069d36e3f5ad0bed0ce992dd30780.tar.gz opie-b7b0040f0a8069d36e3f5ad0bed0ce992dd30780.tar.bz2 |
- no default args in method impls
- resolved parameter shadowing problem
Diffstat (limited to 'core/pim/datebook/datebookweek.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookweek.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp index e9fcc39..6532ba4 100644 --- a/core/pim/datebook/datebookweek.cpp +++ b/core/pim/datebook/datebookweek.cpp @@ -567,97 +567,97 @@ void DateBookWeek::setTotalWeeks( int numWeeks ) int DateBookWeek::totalWeeks() const { return header->spinWeek->maxValue(); } void DateBookWeek::slotWeekChanged( bool onMonday ) { bStartOnMonday = onMonday; view->setStartOfWeek( bStartOnMonday ); header->setStartOfWeek( bStartOnMonday ); redraw(); } void DateBookWeek::slotClockChanged( bool ap ) { ampm = ap; } // return the date at the beginning of the week... QDate DateBookWeek::weekDate() const { return dateFromWeek( _week, year, bStartOnMonday ); } // this used to only be needed by datebook.cpp, but now we need it inside // week view since // we need to be able to figure out our total number of weeks on the fly... // this is probably the best place to put it.. // For Weeks that start on Monday... (EASY!) // At the moment we will use ISO 8601 method for computing // the week. Granted, other countries use other methods, // bet we aren't doing any Locale stuff at the moment. So, // this should pass. This Algorithim is public domain and // available at: // http://personal.ecu.edu/mccartyr/ISOwdALG.txt // the week number is return, and the year number is returned in year // for Instance 2001/12/31 is actually the first week in 2002. // There is a more mathematical definition, but I will implement it when // we are pass our deadline. // For Weeks that start on Sunday... (ahh... home rolled) // okay, if Jan 1 is on Friday or Saturday, // it will go to the pervious // week... bool calcWeek( const QDate &d, int &week, int &year, - bool startOnMonday = false ) + bool startOnMonday ) { int weekNumber; int yearNumber; // remove a pesky warning, (Optimizations on g++) weekNumber = -1; int jan1WeekDay = QDate(d.year(), 1, 1).dayOfWeek(); int dayOfWeek = d.dayOfWeek(); if ( !d.isValid() ) return false; if ( startOnMonday ) { // find the Jan1Weekday; if ( d.dayOfYear() <= ( 8 - jan1WeekDay) && jan1WeekDay > 4 ) { yearNumber = d.year() - 1; if ( jan1WeekDay == 5 || ( jan1WeekDay == 6 && QDate::leapYear(yearNumber) ) ) weekNumber = 53; else weekNumber = 52; } else yearNumber = d.year(); if ( yearNumber == d.year() ) { int totalDays = 365; if ( QDate::leapYear(yearNumber) ) totalDays++; if ( ((totalDays - d.dayOfYear()) < (4 - dayOfWeek) ) || (jan1WeekDay == 7) && (totalDays - d.dayOfYear()) < 3) { yearNumber++; weekNumber = 1; } } if ( yearNumber == d.year() ) { int j = d.dayOfYear() + (7 - dayOfWeek) + ( jan1WeekDay - 1 ); weekNumber = j / 7; if ( jan1WeekDay > 4 ) weekNumber--; } } else { // it's better to keep these cases separate... if ( d.dayOfYear() <= (7 - jan1WeekDay) && jan1WeekDay > 4 && jan1WeekDay != 7 ) { yearNumber = d.year() - 1; if ( jan1WeekDay == 6 || (jan1WeekDay == 7 && QDate::leapYear(yearNumber) ) ) { weekNumber = 53; }else weekNumber = 52; |