summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
Unidiff
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 9085775..d825493 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1001,10 +1001,7 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1001#endif 1001#endif
1002 hb->addWidget( mNavigatorBar ); 1002 hb->addWidget( mNavigatorBar );
1003 hb->addWidget( mWidStack ); 1003 hb->addWidget( mWidStack );
1004 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1005 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 1004 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
1006 if ( mShowWeekView )
1007 mWeekStartsMonday = true;
1008 updatePossible = false; 1005 updatePossible = false;
1009 //updatePossible = true; 1006 //updatePossible = true;
1010 mCells.setAutoDelete( true ); 1007 mCells.setAutoDelete( true );
@@ -1217,9 +1214,9 @@ void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1217void KOMonthView::updateConfig() 1214void KOMonthView::updateConfig()
1218{ 1215{
1219 1216
1220 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1217 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1221 1218
1222 if ( mShowWeekView ) { 1219 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1223 mWeekStartsMonday = true; 1220 mWeekStartsMonday = true;
1224 } 1221 }
1225 QFontMetrics fontmetric(mDayLabels[0]->font()); 1222 QFontMetrics fontmetric(mDayLabels[0]->font());
@@ -1259,20 +1256,16 @@ void KOMonthView::updateDayLabels()
1259 1256
1260 mDayLabelsT = &mDayLabelsW; 1257 mDayLabelsT = &mDayLabelsW;
1261 for (int i = 0; i < 7; i++) { 1258 for (int i = 0; i < 7; i++) {
1262 if (mWeekStartsMonday) { 1259 {
1263 bool show = mShortDayLabelsW; 1260 bool show = mShortDayLabelsW;
1264 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1261 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1265 show = true; 1262 show = true;
1266 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1263 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1267 } else {
1268 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW));
1269 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW));
1270
1271 } 1264 }
1272 } 1265 }
1273 mDayLabelsT = &mDayLabels; 1266 mDayLabelsT = &mDayLabels;
1274 for (int i = 0; i < 7; i++) { 1267 for (int i = 0; i < 7; i++) {
1275 if (mWeekStartsMonday) { 1268 if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) {
1276 bool show = mShortDayLabelsM; 1269 bool show = mShortDayLabelsM;
1277 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1270 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1278 show = true; 1271 show = true;
@@ -1294,25 +1287,31 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
1294 QPtrVector<QLabel> *dayLabels; 1287 QPtrVector<QLabel> *dayLabels;
1295 QPtrVector<KOWeekButton> *weekLabels; 1288 QPtrVector<KOWeekButton> *weekLabels;
1296 int weekNum = 6; 1289 int weekNum = 6;
1290 mStartDate = start;
1297 if ( mShowWeekView ) { 1291 if ( mShowWeekView ) {
1298 weekNum = 1; 1292 weekNum = 1;
1299 cells = &mCellsW; 1293 cells = &mCellsW;
1300 dayLabels = &mDayLabelsW; 1294 dayLabels = &mDayLabelsW;
1301 weekLabels = &mWeekLabelsW; 1295 weekLabels = &mWeekLabelsW;
1296 if ( !KGlobal::locale()->weekStartsMonday() ) {
1297 mStartDate = mStartDate.addDays( 1 );
1298 }
1302 } else { 1299 } else {
1303 cells = &mCells; 1300 cells = &mCells;
1304 dayLabels = &mDayLabels; 1301 dayLabels = &mDayLabels;
1305 weekLabels = &mWeekLabels; 1302 weekLabels = &mWeekLabels;
1306 } 1303 }
1307 1304
1308 mStartDate = start; 1305 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1309 1306
1307 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1308 mWeekStartsMonday = true;
1309 }
1310 int startWeekDay = mWeekStartsMonday ? 1 : 7; 1310 int startWeekDay = mWeekStartsMonday ? 1 : 7;
1311 1311
1312 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { 1312 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
1313 mStartDate = mStartDate.addDays( -1 ); 1313 mStartDate = mStartDate.addDays( -1 );
1314 } 1314 }
1315
1316 bool primary = false; 1315 bool primary = false;
1317 uint i; 1316 uint i;
1318 for( i = 0; i < (*cells).size(); ++i ) { 1317 for( i = 0; i < (*cells).size(); ++i ) {