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 @@ -591,49 +591,49 @@ QDate DateBookWeek::weekDate() const // 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; |