[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/libkdepim
From:       Sergio Luis Martins <iamsergio () gmail ! com>
Date:       2010-12-14 14:32:03
Message-ID: 20101214143203.39636AC8AC () svn ! kde ! org
[Download RAW message or body]

SVN commit 1206473 by smartins:

Given two arrays containing week days, one with index0=monday, and one with \
index0=KGlobal::locale()->weekStartDay(); The correct formula to convert index from \
the first array to indexes of the second is: ( 1 + dayOfWeek +  ( 7 - weekStart ) ) % \
7

 M  +1 -4      kweekdaycheckcombo.cpp  


--- trunk/KDE/kdepim/libkdepim/kweekdaycheckcombo.cpp #1206472:1206473
@@ -53,7 +53,6 @@
 
 KWeekdayCheckCombo::~KWeekdayCheckCombo()
 {
-
 }
 
 QBitArray KWeekdayCheckCombo::days() const
@@ -63,9 +62,7 @@
 
   for ( int i = 0; i < 7; ++i ) {
     // i is the nr of the combobox, not the day of week!
-    // label=(i+weekStart+6)%7 + 1;
-    // index in CheckBox array(=day): label-1
-    const int index = ( i + weekStart + 6 ) % 7;
+    const int index = ( 1 + i +  ( 7 - weekStart ) ) % 7;
     days.setBit( i, itemCheckState( index ) == Qt::Checked );
   }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic