Bug 111931 - choose last weekday unavailable
Summary: choose last weekday unavailable
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: general (show other bugs)
Version: 3.3
Platform: unspecified Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-02 16:47 UTC by Betty
Modified: 2006-11-05 19:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Betty 2005-09-02 16:47:13 UTC
Version:           3.3 (using KDE 3.3.0, SuSE)
Compiler:          gcc version 3.3.4 (pre 3.3.5 20040809)
OS:                Linux (i686) release 2.6.8-24-default

The last weekday is setted as Saturday. It's not possible to change it to Friday, for example.
Comment 1 Bram Schoenmakers 2005-09-02 17:24:51 UTC
There's no such option to define the last weekday, only the first weekday (and even that option is not KOrganizer). So it's not entirely clear to me what you exactly mean. Could you please be a bit more descriptive? Do you want to set this for a particular view?
Comment 2 Bram Schoenmakers 2006-10-28 14:52:46 UTC
Don't know what was wrong with me a year ago, but the bug is clear now :)

The calendars at the left should behave the same as the calendar in Kicker's Clock applet, regarding the start of the week option.
Comment 3 Reinhold Kainhofer 2006-11-02 19:21:39 UTC
Reassigning all KOrganizer bug reports and wishes to the newly created 
korganizer-devel mailing list.
Comment 4 Bram Schoenmakers 2006-11-05 19:32:07 UTC
SVN commit 602340 by bram:

o Make calendars in the left sidebar respect the First Day Of Week setting, defined in the control center
o Renaming some member variables and unused variable removed

BUG:111931



 M  +19 -25    kdatenavigator.cpp  
 M  +2 -4      kdatenavigator.h  


--- branches/KDE/3.5/kdepim/korganizer/kdatenavigator.cpp #602339:602340
@@ -64,21 +64,21 @@
 
   // Set up the heading fields.
   for( i = 0; i < 7; i++ ) {
-    headings[i] = new QLabel( this );
-    headings[i]->setFont( QFont( generalFont, 10, QFont::Bold ) );
-    headings[i]->setAlignment( AlignCenter );
+    mHeadings[i] = new QLabel( this );
+    mHeadings[i]->setFont( QFont( generalFont, 10, QFont::Bold ) );
+    mHeadings[i]->setAlignment( AlignCenter );
 
-    topLayout->addWidget( headings[i], 1, i + 1 );
+    topLayout->addWidget( mHeadings[i], 1, i + 1 );
   }
 
   // Create the weeknumber labels
   for( i = 0; i < 6; i++ ) {
-    weeknos[i] = new QLabel( this );
-    weeknos[i]->setAlignment( AlignCenter );
-    weeknos[i]->setFont( QFont( generalFont, 10 ) );
-    weeknos[i]->installEventFilter( this );
+    mWeeknos[i] = new QLabel( this );
+    mWeeknos[i]->setAlignment( AlignCenter );
+    mWeeknos[i]->setFont( QFont( generalFont, 10 ) );
+    mWeeknos[i]->installEventFilter( this );
 
-    topLayout->addWidget( weeknos[i], i + 2, 0 );
+    topLayout->addWidget( mWeeknos[i], i + 2, 0 );
   }
 
   mDayMatrix = new KODayMatrix( this, "KDateNavigator::dayMatrix" );
@@ -147,15 +147,14 @@
 
   const KCalendarSystem *calsys = KOGlobals::self()->calendarSystem();
   int m_fstDayOfWkCalsys = calsys->dayOfWeek( dayone );
+  int weekstart = KGlobal::locale()->weekStartDay();
 
   // If month begins on Monday and Monday is first day of week,
   // month should begin on second line. Sunday doesn't have this problem.
-  int nextLine = ( ( m_fstDayOfWkCalsys == 1) &&
-                   ( KGlobal::locale()->weekStartDay() == 1 ) ) ? 7 : 0;
+  int nextLine = m_fstDayOfWkCalsys <= weekstart ? 7 : 0;
 
   // update the matrix dates
-  int index = ( KGlobal::locale()->weekStartDay() == 1 ? 1 : 0 ) -
-              m_fstDayOfWkCalsys - nextLine;
+  int index = weekstart - m_fstDayOfWkCalsys - nextLine;
 
   dayone = dayone.addDays( index );
 
@@ -190,7 +189,7 @@
     } else {
       weeknum.setNum( weeknumstart );
     }
-    weeknos[i]->setText( weeknum );
+    mWeeknos[i]->setText( weeknum );
   }
 
 // each updateDates is followed by an updateView -> repaint is issued there !
@@ -215,18 +214,13 @@
 void KDateNavigator::updateConfig()
 {
   int day;
+  int weekstart = KGlobal::locale()->weekStartDay();
   for( int i = 0; i < 7; i++ ) {
-    // take the first letter of the day name to be the abbreviation
-    if ( KGlobal::locale()->weekStartDay() == 1 ) {
-      day = i + 1;
-    } else {
-      if ( i == 0 ) day = 7;
-      else day = i;
-    }
+    day = weekstart + i <= 7 ? weekstart + i : ( weekstart + i ) % 7;
     QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day,
                                                                         true );
     if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 );
-    headings[i]->setText( dayName );
+    mHeadings[i]->setText( dayName );
   }
 
   // FIXME: Use actual config setting here
@@ -237,9 +231,9 @@
 {
   for( int i = 0; i < 6; i++ ) {
     if( enabled )
-      weeknos[i]->show();
+      mWeeknos[i]->show();
     else
-      weeknos[i]->hide();
+      mWeeknos[i]->hide();
   }
 }
 
@@ -270,7 +264,7 @@
   if ( e->type() == QEvent::MouseButtonPress ) {
     int i;
     for( i = 0; i < 6; ++i ) {
-      if ( o == weeknos[ i ] ) {
+      if ( o == mWeeknos[ i ] ) {
         QDate weekstart = mDayMatrix->getDate( i * 7 );
         emit weekClicked( weekstart );
         break;
--- branches/KDE/3.5/kdepim/korganizer/kdatenavigator.h #602339:602340
@@ -99,16 +99,14 @@
   private:
     NavigatorBar *mNavigatorBar;
 
-    QLabel *headings[ 7 ];
-    QLabel *weeknos[ 7 ];
+    QLabel *mHeadings[ 7 ];
+    QLabel *mWeeknos[ 7 ];
 
     KODayMatrix *mDayMatrix;
 
     KCal::DateList mSelectedDates;
     QDate mBaseDate;
 
-    const QString *curHeaders;
-
     // Disabling copy constructor and assignment operator
     KDateNavigator( const KDateNavigator & );
     KDateNavigator &operator=( const KDateNavigator & );