author | zautrix <zautrix> | 2005-03-28 23:39:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-28 23:39:37 (UTC) |
commit | 4e7c45695672ecdbd0cd14cac0ea29a8e134ee78 (patch) (side-by-side diff) | |
tree | 6815e055d6cb35d56d43f036261f5be9d2a9c350 /korganizer | |
parent | 4034290f894ff7d1b0cf1197078e0ed832566bb7 (diff) | |
download | kdepimpi-4e7c45695672ecdbd0cd14cac0ea29a8e134ee78.zip kdepimpi-4e7c45695672ecdbd0cd14cac0ea29a8e134ee78.tar.gz kdepimpi-4e7c45695672ecdbd0cd14cac0ea29a8e134ee78.tar.bz2 |
montview sunday fix
-rw-r--r-- | korganizer/kdatenavigator.cpp | 18 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 25 | ||||
-rw-r--r-- | korganizer/komonthview.h | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 28 |
4 files changed, 24 insertions, 49 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 38bddc2..2fca49e 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp @@ -324,6 +324,7 @@ void KDateNavigator::updateView() daymatrix->updateView(); - + int sub = 4; + if ( ! KGlobal::locale()->weekStartsMonday() ) + --sub; // set the week numbers. for(i = 0; i < 6; i++) { - QString weeknum; // remember, according to ISO 8601, the first week of the year is the @@ -333,12 +334,9 @@ void KDateNavigator::updateView() //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); - int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); - - int add = 0; - if ( ! KGlobal::locale()->weekStartsMonday() ) - ++add; + int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-sub))); + int weekNo; if (dayOfYear % 7 != 0) - weeknum.setNum(dayOfYear / 7 + 1+add); + weekNo = (dayOfYear / 7 + 1); else - weeknum.setNum(dayOfYear / 7 +add); - weeknos[i]->setText(weeknum); + weekNo = (dayOfYear / 7); + weeknos[i]->setText(QString::number( weekNo )); } diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 9085775..d825493 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -1003,6 +1003,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) hb->addWidget( mWidStack ); - mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); mShowWeekView = KOPrefs::instance()->mMonthViewWeek; - if ( mShowWeekView ) - mWeekStartsMonday = true; updatePossible = false; @@ -1219,5 +1216,5 @@ void KOMonthView::updateConfig() - mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); + int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); - if ( mShowWeekView ) { + if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { mWeekStartsMonday = true; @@ -1261,3 +1258,3 @@ void KOMonthView::updateDayLabels() for (int i = 0; i < 7; i++) { - if (mWeekStartsMonday) { + { bool show = mShortDayLabelsW; @@ -1266,6 +1263,2 @@ void KOMonthView::updateDayLabels() (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); - } else { - if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); - else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); - } @@ -1274,3 +1267,3 @@ void KOMonthView::updateDayLabels() for (int i = 0; i < 7; i++) { - if (mWeekStartsMonday) { + if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { bool show = mShortDayLabelsM; @@ -1296,2 +1289,3 @@ void KOMonthView::showDates(const QDate &start, const QDate &) int weekNum = 6; + mStartDate = start; if ( mShowWeekView ) { @@ -1301,2 +1295,5 @@ void KOMonthView::showDates(const QDate &start, const QDate &) weekLabels = &mWeekLabelsW; + if ( !KGlobal::locale()->weekStartsMonday() ) { + mStartDate = mStartDate.addDays( 1 ); + } } else { @@ -1307,4 +1304,7 @@ void KOMonthView::showDates(const QDate &start, const QDate &) - mStartDate = start; + int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); + if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { + mWeekStartsMonday = true; + } int startWeekDay = mWeekStartsMonday ? 1 : 7; @@ -1314,3 +1314,2 @@ void KOMonthView::showDates(const QDate &start, const QDate &) } - bool primary = false; diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index a58f6b8..9e724c7 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -288,3 +288,3 @@ class KOMonthView: public KOEventView int mNumCells; - bool mWeekStartsMonday; + //bool mWeekStartsMonday; bool mShowSatSunComp; diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 2da592b..8e52968 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -1480,29 +1480,7 @@ QString MainWindow::syncFileName() } +#include "koglobals.h" +#include <kcalendarsystem.h> void MainWindow::updateWeek(QDate seda) { - int weekNum = 0; - QDate d = QDate ( seda.year(), 1,1); - seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday - if ( seda.addDays(6).year() != seda.year() ) { - if ( seda.year() != d.year() ) { - if ( d.dayOfWeek() > 4 ) - d = QDate ( seda.year(), 1,1); - else - weekNum = 1; - } else { - QDate dd( seda.year()+1, 1,1); - if ( dd.dayOfWeek() <= 4 ) - weekNum = 1; - } - } - if ( weekNum == 0 ){ - int dow = d.dayOfWeek(); - if ( dow <= 4 ) - d = d.addDays( 1-dow ); - else // 5,6,7 - d = d.addDays( 8-dow ); - // we have the first week of the year.we are on monday - weekNum = d.daysTo( seda ) / 7 +1; - } - + int weekNum = KGlobal::locale()->weekNum ( seda ); mWeekPixmap.fill( mWeekBgColor ); |