[korganizer] /: allow configuring first day of week.

Allen Winter null at kde.org
Sat Mar 31 15:01:02 UTC 2018


Git commit 121b91e503688dc752e32500314eb1c286e15736 by Allen Winter.
Committed on 31/03/2018 at 14:57.
Pushed by winterz into branch 'master'.

allow configuring first day of week.
BUG: 358106
FIXED-IN: 5.8.0

note that we've only supported this in the agenda and month views.
it is currently not available in other views, like timeline or whatsnext.
open new wishes if you need those views supported.

also note that you need to restart Kontact/KOrganizer to see the change;
which is yet-another-bug. (in agendaview, moving the range also works)

M  +1    -1    CMakeLists.txt
M  +7    -0    doc/index.docbook
M  +5    -8    src/datenavigator.cpp
M  +28   -29   src/kodaymatrix.cpp
M  +5    -0    src/koglobals.cpp
M  +1    -1    src/koglobals.h
M  +77   -68   src/prefs/koprefsdialog.cpp
M  +7    -0    src/settings/korganizer.kcfg
M  +2    -2    src/widgets/kdatenavigator.cpp

https://commits.kde.org/korganizer/121b91e503688dc752e32500314eb1c286e15736

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 22aecd7b..f236c010 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,7 +64,7 @@ set(PIMCOMMON_LIB_VERSION_LIB "5.7.80")
 set(LIBKDEPIM_LIB_VERSION_LIB "5.7.80")
 set(LIBINCIDENCEEDITOR_LIB_VERSION_LIB "5.7.80")
 set(CALENDARSUPPORT_LIB_VERSION_LIB "5.7.80")
-set(EVENTVIEW_LIB_VERSION_LIB "5.7.80")
+set(EVENTVIEW_LIB_VERSION_LIB "5.8.41")
 set(KCONTACTS_LIB_VERSION "5.7.80")
 
 find_package(KF5AkonadiSearch "5.7.80" CONFIG REQUIRED)
diff --git a/doc/index.docbook b/doc/index.docbook
index f8dc6132..2f015bce 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -2107,6 +2107,13 @@ prevents &korganizer; from marking the working hours for the holiday days in the
 region defined in the <guilabel>Use holiday region</guilabel> drop down above.</para>
 </listitem>
 </varlistentry>
+
+<varlistentry>
+<term><guilabel>Weekly Start Day</guilabel></term>
+<listitem><para>Select the first day of each week.
+Normally, you can ignore this since it is set in your locale.</para></listitem>
+</varlistentry>
+
 </variablelist>
 </sect3>
 
diff --git a/src/datenavigator.cpp b/src/datenavigator.cpp
index 3bce2f47..d1cc6abf 100644
--- a/src/datenavigator.cpp
+++ b/src/datenavigator.cpp
@@ -27,7 +27,6 @@
 
 #include "datenavigator.h"
 #include "koglobals.h"
-
 #include "korganizer_debug.h"
 
 #include <QDate>
@@ -96,7 +95,7 @@ void DateNavigator::selectDates(const QDate &d, int count, const QDate &preferre
 void DateNavigator::selectWeekByDay(int weekDay, const QDate &d, const QDate &preferredMonth)
 {
     int dateCount = mSelectedDates.count();
-    bool weekStart = (weekDay == QLocale().firstDayOfWeek());
+    bool weekStart = (weekDay == KOGlobals::self()->firstDayOfWeek());
     if (weekStart && dateCount == 7) {
         selectWeek(d, preferredMonth);
     } else {
@@ -112,7 +111,7 @@ void DateNavigator::selectWeek()
 void DateNavigator::selectWeek(const QDate &d, const QDate &preferredMonth)
 {
     const int dayOfWeek = d.dayOfWeek();
-    const int weekStart = QLocale().firstDayOfWeek();
+    const int weekStart = KOGlobals::self()->firstDayOfWeek();
 
     QDate firstDate = d.addDays(weekStart - dayOfWeek);
 
@@ -130,7 +129,7 @@ void DateNavigator::selectWorkWeek()
 
 void DateNavigator::selectWorkWeek(const QDate &d)
 {
-    const int weekStart = QLocale().firstDayOfWeek();
+    const int weekStart = KOGlobals::self()->firstDayOfWeek();
     const int dayOfWeek = d.dayOfWeek();
     QDate currentDate = d.addDays(weekStart - dayOfWeek);
 
@@ -218,11 +217,9 @@ void DateNavigator::shiftMonth(const QDate &currentMonth, const QDate &selection
     /* When firstSelected doesn't belong to currentMonth it can happen
        that the new selection won't be visible on our KDateNavigators
        so we must adjust it */
-    if (selectionLowerLimit.isValid()
-        && firstSelected < selectionLowerLimit) {
+    if (selectionLowerLimit.isValid() && firstSelected < selectionLowerLimit) {
         firstSelected = selectionLowerLimit;
-    } else if (selectionUpperLimit.isValid()
-               && firstSelected > selectionUpperLimit) {
+    } else if (selectionUpperLimit.isValid() && firstSelected > selectionUpperLimit) {
         firstSelected = selectionUpperLimit.addDays(-6);
     }
 
diff --git a/src/kodaymatrix.cpp b/src/kodaymatrix.cpp
index daaf7f83..5b82455d 100644
--- a/src/kodaymatrix.cpp
+++ b/src/kodaymatrix.cpp
@@ -166,9 +166,9 @@ void KODayMatrix::recalculateToday()
         mDayLabels[i] = QString::number(mDays[i].day());
 
         // if today is in the currently displayed month, hilight today
-        if (mDays[i].year() == QDate::currentDate().year()
-            && mDays[i].month() == QDate::currentDate().month()
-            && mDays[i].day() == QDate::currentDate().day()) {
+        if (mDays[i].year() == QDate::currentDate().year() &&
+            mDays[i].month() == QDate::currentDate().month() &&
+            mDays[i].day() == QDate::currentDate().day()) {
             mToday = i;
         }
     }
@@ -280,10 +280,10 @@ void KODayMatrix::updateJournals()
     for (const KCalCore::Incidence::Ptr &inc : incidences) {
         Q_ASSERT(inc);
         QDate d = inc->dtStart().toLocalTime().date();
-        if (inc->type() == KCalCore::Incidence::TypeJournal
-            && d >= mDays[0]
-            && d <= mDays[NUMDAYS - 1]
-            && !mEvents.contains(d)) {
+        if (inc->type() == KCalCore::Incidence::TypeJournal &&
+            d >= mDays[0] &&
+            d <= mDays[NUMDAYS - 1] &&
+            !mEvents.contains(d)) {
             mEvents.append(d);
         }
         if (mEvents.count() == NUMDAYS) {
@@ -315,10 +315,11 @@ void KODayMatrix::updateTodos()
         if (t->hasDueDate()) {
             ushort recurType = t->recurrenceType();
 
-            if (t->recurs()
-                && !(recurType == KCalCore::Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur)
-                && !(recurType == KCalCore::Recurrence::rWeekly
-                     && !KOPrefs::instance()->mWeeklyRecur)) {
+            if (t->recurs() &&
+                !(recurType == KCalCore::Recurrence::rDaily &&
+                  !KOPrefs::instance()->mDailyRecur) &&
+                !(recurType == KCalCore::Recurrence::rWeekly &&
+                  !KOPrefs::instance()->mWeeklyRecur)) {
                 // It's a recurring todo, find out in which days it occurs
                 const auto timeDateList
                     = t->recurrence()->timesInInterval(
@@ -367,9 +368,10 @@ void KODayMatrix::updateEvents()
         const int secsToAdd = event->allDay() ? 0 : -1;
         const QDateTime dtEnd = event->dtEnd().toLocalTime().addSecs(secsToAdd);
 
-        if (!(recurType == KCalCore::Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur)
-            && !(recurType == KCalCore::Recurrence::rWeekly
-                 && !KOPrefs::instance()->mWeeklyRecur)) {
+        if (!(recurType == KCalCore::Recurrence::rDaily &&
+              !KOPrefs::instance()->mDailyRecur) &&
+            !(recurType == KCalCore::Recurrence::rWeekly &&
+              !KOPrefs::instance()->mWeeklyRecur)) {
             KCalCore::SortableList<QDateTime> timeDateList;
             const bool isRecurrent = event->recurs();
             const int eventDuration = dtStart.daysTo(dtEnd);
@@ -429,9 +431,8 @@ QString KODayMatrix::getHolidayLabel(int offset) const
 
 int KODayMatrix::getDayIndexFrom(int x, int y) const
 {
-    return 7 * (y / mDaySize.height())
-           +(KOGlobals::self()->reverseLayout()
-             ? 6 - x / mDaySize.width() : x / mDaySize.width());
+    return 7 * (y / mDaySize.height()) +
+        (KOGlobals::self()->reverseLayout() ? 6 - x / mDaySize.width() : x / mDaySize.width());
 }
 
 void KODayMatrix::calendarIncidenceAdded(const KCalCore::Incidence::Ptr &incidence)
@@ -458,9 +459,9 @@ void KODayMatrix::setHighlightMode(bool highlightEvents, bool highlightTodos,
                                    bool highlightJournals)
 {
     // don't set mPendingChanges to true if nothing changed
-    if (highlightTodos != mHighlightTodos
-        || highlightEvents != mHighlightEvents
-        || highlightJournals != mHighlightJournals) {
+    if (highlightTodos != mHighlightTodos ||
+        highlightEvents != mHighlightEvents ||
+        highlightJournals != mHighlightJournals) {
         mHighlightEvents = highlightEvents;
         mHighlightTodos = highlightTodos;
         mHighlightJournals = highlightJournals;
@@ -751,11 +752,11 @@ void KODayMatrix::paintEvent(QPaintEvent *)
         if (row < 6 && row >= 0) {
             if (row == mSelEnd / 7) {
                 // Single row selection
-                p.fillRect(isRTL
-                           ? (7 - (mSelEnd - mSelStart + 1) - column) * dayWidth
-                           : column * dayWidth,
-                           row * dayHeight,
-                           (mSelEnd - mSelStart + 1) * dayWidth, dayHeight, selectionColor);
+                p.fillRect(
+                    isRTL ?
+                        (7 - (mSelEnd - mSelStart + 1) - column) * dayWidth : column * dayWidth,
+                    row * dayHeight,
+                    (mSelEnd - mSelStart + 1) * dayWidth, dayHeight, selectionColor);
             } else {
                 // draw first row to the right
                 p.fillRect(isRTL ? 0 : column * dayWidth, row * dayHeight,
@@ -772,9 +773,7 @@ void KODayMatrix::paintEvent(QPaintEvent *)
                 // draw last block from left to mSelEnd
                 if (mSelEnd / 7 < 6) {
                     int selectionWidth = mSelEnd - 7 * (mSelEnd / 7) + 1;
-                    p.fillRect(isRTL
-                               ? (7 - selectionWidth) * dayWidth
-                               : 0,
+                    p.fillRect(isRTL ? (7 - selectionWidth) * dayWidth : 0,
                                (row + selectionHeight) * dayHeight,
                                selectionWidth * dayWidth, dayHeight, selectionColor);
                 }
@@ -893,7 +892,7 @@ QPair<QDate, QDate> KODayMatrix::matrixLimits(const QDate &month)
     QDate d(month.year(), month.month(), 1);
 
     const int dayOfWeek = d.dayOfWeek();
-    const int weekstart = QLocale().firstDayOfWeek();
+    const int weekstart = KOGlobals::self()->firstDayOfWeek();
 
     d = d.addDays(-(7 + dayOfWeek - weekstart) % 7);
 
diff --git a/src/koglobals.cpp b/src/koglobals.cpp
index 1e5a0c61..9601e08a 100644
--- a/src/koglobals.cpp
+++ b/src/koglobals.cpp
@@ -79,6 +79,11 @@ QMap<QDate, QStringList> KOGlobals::holiday(const QDate &start, const QDate &end
     return holidaysByDate;
 }
 
+int KOGlobals::firstDayOfWeek() const
+{
+    return KOPrefs::instance()->mWeekStartDay + 1;
+}
+
 QList<QDate> KOGlobals::workDays(const QDate &startDate, const QDate &endDate) const
 {
     QList<QDate> result;
diff --git a/src/koglobals.h b/src/koglobals.h
index 498187f3..7faadb8f 100644
--- a/src/koglobals.h
+++ b/src/koglobals.h
@@ -51,7 +51,7 @@ public:
 
     QMap<QDate, QStringList> holiday(const QDate &start, const QDate &end) const;
 
-    bool isWorkDay(const QDate &qd) const;
+    int firstDayOfWeek() const;
 
     /**
        Returns a list containing work days between @p start and @end.
diff --git a/src/prefs/koprefsdialog.cpp b/src/prefs/koprefsdialog.cpp
index f2b349c5..2db78115 100644
--- a/src/prefs/koprefsdialog.cpp
+++ b/src/prefs/koprefsdialog.cpp
@@ -36,7 +36,7 @@
 
 #include <IncidenceEditor/IncidenceEditorSettings>
 #include <LibkdepimAkonadi/TagSelectionCombo>
-#include <libkdepimakonadi/tagwidgets.h>
+#include <LibkdepimAkonadi/TagWidgets>
 
 #include <AkonadiCore/AgentFilterProxyModel>
 #include <AkonadiCore/AgentInstanceCreateJob>
@@ -44,7 +44,8 @@
 #include <AkonadiCore/EntityTreeModel>
 #include <AkonadiWidgets/AgentTypeDialog>
 #include <AkonadiWidgets/CollectionComboBox>
-#include <akonadi/calendar/calendarsettings.h>
+#include <AkonadiWidgets/ManageAccountWidget>
+#include <akonadi/calendar/calendarsettings.h>  //krazy:exclude=camelcase this is a generated file
 
 #include <KCalCore/Event>
 #include <KCalCore/Journal>
@@ -53,8 +54,6 @@
 
 #include <MailTransport/TransportManagementWidget>
 
-#include "AkonadiWidgets/ManageAccountWidget"
-
 #include <KColorButton>
 #include <KComboBox>
 #include <QHBoxLayout>
@@ -101,13 +100,12 @@ KOPrefsDialogMain::KOPrefsDialogMain(QWidget *parent)
     KPIM::KPrefsWidBool *emailControlCenter
         = addWidBool(CalendarSupport::KCalPrefs::instance()->emailControlCenterItem(),
                      personalFrame);
-    connect(
-        emailControlCenter->checkBox(), &QAbstractButton::toggled, this,
-        &KOPrefsDialogMain::toggleEmailSettings);
+    connect(emailControlCenter->checkBox(), &QAbstractButton::toggled,
+            this, &KOPrefsDialogMain::toggleEmailSettings);
     personalLayout->addWidget(emailControlCenter->checkBox());
 
-    mUserEmailSettings
-        = new QGroupBox(i18nc("@title:group email settings", "Email Settings"), personalFrame);
+    mUserEmailSettings = new QGroupBox(i18nc("@title:group email settings", "Email Settings"),
+                                       personalFrame);
 
     personalLayout->addWidget(mUserEmailSettings);
     QFormLayout *emailSettingsLayout = new QFormLayout(mUserEmailSettings);
@@ -252,14 +250,13 @@ public:
         holidayRegBoxHBoxLayout->setMargin(0);
         holidaysLayout->addWidget(holidayRegBox, 1, 0, 1, 2);
 
-        QLabel *holidayLabel = new QLabel(
-            i18nc("@label", "Use holiday region:"), holidayRegBox);
+        QLabel *holidayLabel = new QLabel(i18nc("@label", "Use holiday region:"), holidayRegBox);
         holidayLabel->setWhatsThis(KOPrefs::instance()->holidaysItem()->whatsThis());
 
         mHolidayCombo = new KComboBox(holidayRegBox);
         holidayRegBoxHBoxLayout->addWidget(mHolidayCombo);
-        connect(mHolidayCombo, QOverload<int>::of(
-                    &KComboBox::activated), this, &KOPrefsDialogMain::slotWidChanged);
+        connect(mHolidayCombo, QOverload<int>::of(&KComboBox::activated),
+                this, &KOPrefsDialogMain::slotWidChanged);
 
         mHolidayCombo->setWhatsThis(KOPrefs::instance()->holidaysItem()->whatsThis());
 
@@ -289,11 +286,11 @@ public:
             mHolidayCombo->setCurrentIndex(
                 mHolidayCombo->findData(KOGlobals::self()->holidays()->regionCode()));
         } else {
-            mHolidayCombo->setCurrentIndex(0);
+            mHolidayCombo->setCurrentIndex(0); //TODO: can we do better with a heuristic?
         }
 
-        QGroupBox *workingHoursGroupBox
-            = new QGroupBox(i18nc("@title:group", "Working Period"), regionalPage);
+        QGroupBox *workingHoursGroupBox = new QGroupBox(i18nc("@title:group", "Working Period"),
+                                                        regionalPage);
         regionalLayout->addWidget(workingHoursGroupBox, 2, 0);
 
         QBoxLayout *workingHoursLayout = new QVBoxLayout(workingHoursGroupBox);
@@ -316,12 +313,29 @@ public:
                       "this box, or the working hours will not be "
                       "marked with color."));
 
-            connect(mWorkDays[ index ], &QCheckBox::stateChanged, this,
-                    &KPIM::KPrefsModule::slotWidChanged);
+            connect(mWorkDays[ index ], &QCheckBox::stateChanged,
+                    this, &KPIM::KPrefsModule::slotWidChanged);
 
             workDaysLayout->addWidget(mWorkDays[ index ]);
         }
 
+        KPIM::KPrefsWidCombo *firstDayCombo = addWidCombo(KOPrefs::instance()->weekStartDayItem(),
+                                                          workingHoursGroupBox);
+        QHBoxLayout *firstDayLayout = new QHBoxLayout;
+        workingHoursLayout->addLayout(firstDayLayout);
+        QStringList days;
+        days << i18nc("@item:inlistbox", "Monday")
+             << i18nc("@item:inlistbox", "Tuesday")
+             << i18nc("@item:inlistbox", "Wednesday")
+             << i18nc("@item:inlistbox", "Thursday")
+             << i18nc("@item:inlistbox", "Friday")
+             << i18nc("@item:inlistbox", "Saturday")
+             << i18nc("@item:inlistbox", "Sunday");
+        firstDayCombo->comboBox()->addItems(days);
+
+        firstDayLayout->addWidget(firstDayCombo->label());
+        firstDayLayout->addWidget(firstDayCombo->comboBox());
+
         KPIM::KPrefsWidTime *workStart
             = addWidTime(KOPrefs::instance()->workingHoursStartItem());
 
@@ -386,8 +400,8 @@ public:
             CalendarSupport::KCalPrefs::instance()->reminderTimeItem()->whatsThis());
         mReminderTimeSpin->setToolTip(
             CalendarSupport::KCalPrefs::instance()->reminderTimeItem()->toolTip());
-        connect(mReminderTimeSpin, QOverload<int>::of(
-                    &QSpinBox::valueChanged), this, &KOPrefsDialogMain::slotWidChanged);
+        connect(mReminderTimeSpin, QOverload<int>::of(&QSpinBox::valueChanged),
+                this, &KOPrefsDialogMain::slotWidChanged);
         remindersLayout->addWidget(mReminderTimeSpin, 0, 1);
 
         mReminderUnitsCombo = new KComboBox(defaultPage);
@@ -395,8 +409,8 @@ public:
             CalendarSupport::KCalPrefs::instance()->reminderTimeUnitsItem()->toolTip());
         mReminderUnitsCombo->setWhatsThis(
             CalendarSupport::KCalPrefs::instance()->reminderTimeUnitsItem()->whatsThis());
-        connect(mReminderUnitsCombo, QOverload<int>::of(
-                    &KComboBox::activated), this, &KOPrefsDialogMain::slotWidChanged);
+        connect(mReminderUnitsCombo, QOverload<int>::of(&KComboBox::activated),
+                this, &KOPrefsDialogMain::slotWidChanged);
         mReminderUnitsCombo->addItem(
             i18nc("@item:inlistbox reminder units in minutes", "minute(s)"));
         mReminderUnitsCombo->addItem(
@@ -410,15 +424,13 @@ public:
             CalendarSupport::KCalPrefs::instance()->defaultAudioFileRemindersItem())->checkBox();
 
         if (CalendarSupport::KCalPrefs::instance()->audioFilePathItem()->value().isEmpty()) {
-            const QString defAudioFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral(
-                                                                    "sound/")
-                                                                + QLatin1String(
-                                                                    "KDE-Sys-Warning.ogg"));
+            const QString defAudioFile =
+                QStandardPaths::locate(QStandardPaths::GenericDataLocation,
+                                       QStringLiteral("sound/") + QLatin1String("KDE-Sys-Warning.ogg"));
             CalendarSupport::KCalPrefs::instance()->audioFilePathItem()->setValue(defAudioFile);
         }
-        QString filter
-            = i18n("*.ogg *.wav *.mp3 *.wma *.flac *.aiff *.raw *.au *.ra|"
-                   "Audio Files (*.ogg *.wav *.mp3 *.wma *.flac *.aiff *.raw *.au *.ra)");
+        QString filter = i18n("*.ogg *.wav *.mp3 *.wma *.flac *.aiff *.raw *.au *.ra|"
+                              "Audio Files (*.ogg *.wav *.mp3 *.wma *.flac *.aiff *.raw *.au *.ra)");
         KUrlRequester *rq = addWidPath(CalendarSupport::KCalPrefs::instance()->audioFilePathItem(),
                                        nullptr, filter)->urlRequester();
         rq->setEnabled(cb->isChecked());
@@ -432,12 +444,10 @@ public:
         remindersLayout->addLayout(audioFileRemindersBox, 1, 0);
         remindersLayout->addWidget(
             addWidBool(
-                CalendarSupport::KCalPrefs::instance()->defaultEventRemindersItem())->checkBox(), 2,
-            0);
+                CalendarSupport::KCalPrefs::instance()->defaultEventRemindersItem())->checkBox(), 2, 0);
         remindersLayout->addWidget(
             addWidBool(
-                CalendarSupport::KCalPrefs::instance()->defaultTodoRemindersItem())->checkBox(), 3,
-            0);
+                CalendarSupport::KCalPrefs::instance()->defaultTodoRemindersItem())->checkBox(), 3, 0);
 
         defaultLayout->setRowStretch(3, 1);
         load();
@@ -799,8 +809,8 @@ KOPrefsDialogColorsAndFonts::KOPrefsDialogColorsAndFonts(QWidget *parent)
               "Select here the event category you want to modify. "
               "You can change the selected category color using "
               "the button below."));
-    connect(mCategoryCombo, QOverload<int>::of(
-                &KComboBox::activated), this, &KOPrefsDialogColorsAndFonts::updateCategoryColor);
+    connect(mCategoryCombo, QOverload<int>::of(&KComboBox::activated),
+            this, &KOPrefsDialogColorsAndFonts::updateCategoryColor);
     categoryLayout->addWidget(mCategoryCombo, 1, 0);
 
     mCategoryButton = new KColorButton(categoryGroup);
@@ -834,9 +844,8 @@ KOPrefsDialogColorsAndFonts::KOPrefsDialogColorsAndFonts(QWidget *parent)
               "Select the calendar you want to modify. "
               "You can change the selected calendar color using "
               "the button below."));
-    connect(mResourceCombo, QOverload<int>::of(
-                &Akonadi::CollectionComboBox::activated), this,
-            &KOPrefsDialogColorsAndFonts::updateResourceColor);
+    connect(mResourceCombo, QOverload<int>::of(&Akonadi::CollectionComboBox::activated),
+            this, &KOPrefsDialogColorsAndFonts::updateResourceColor);
     resourceLayout->addWidget(mResourceCombo);
 
     mResourceButton = new KColorButton(resourceGroup);
@@ -865,8 +874,8 @@ KOPrefsDialogColorsAndFonts::KOPrefsDialogColorsAndFonts(QWidget *parent)
 
     KPIM::KPrefsWidFont *monthViewFont
         = addWidFont(KOPrefs::instance()->monthViewFontItem(), fontFrame,
-                     QLocale().toString(QTime(12, 34), QLocale::ShortFormat) + QLatin1Char(' ')
-                     +i18nc("@label", "Event text"));
+                     QLocale().toString(QTime(12, 34), QLocale::ShortFormat) + QLatin1Char(' ') +
+                     i18nc("@label", "Event text"));
 
     fontLayout->addWidget(monthViewFont->label(), 1, 0);
     fontLayout->addWidget(monthViewFont->preview(), 1, 1);
@@ -1056,32 +1065,32 @@ KOPrefsDialogGroupwareScheduling::KOPrefsDialogGroupwareScheduling(QWidget *pare
 
     // signals and slots connections
 
-    connect(mGroupwarePage->publishDays, QOverload<int>::of(
-                &QSpinBox::valueChanged), this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
-    connect(mGroupwarePage->publishUrl, &QLineEdit::textChanged, this,
-            &KOPrefsDialogGroupwareScheduling::slotWidChanged);
-    connect(mGroupwarePage->publishUser, &QLineEdit::textChanged, this,
-            &KOPrefsDialogGroupwareScheduling::slotWidChanged);
-    connect(mGroupwarePage->publishPassword, &QLineEdit::textChanged, this,
-            &KOPrefsDialogGroupwareScheduling::slotWidChanged);
-    connect(mGroupwarePage->publishSavePassword, &QCheckBox::toggled, this,
-            &KOPrefsDialogGroupwareScheduling::slotWidChanged);
-    connect(mGroupwarePage->retrieveEnable, &QCheckBox::toggled, this,
-            &KOPrefsDialogGroupwareScheduling::slotWidChanged);
-    connect(mGroupwarePage->retrieveUser, &QLineEdit::textChanged, this,
-            &KOPrefsDialogGroupwareScheduling::slotWidChanged);
-    connect(mGroupwarePage->retrievePassword, &QLineEdit::textChanged, this,
-            &KOPrefsDialogGroupwareScheduling::slotWidChanged);
-    connect(mGroupwarePage->retrieveSavePassword, &QCheckBox::toggled, this,
-            &KOPrefsDialogGroupwareScheduling::slotWidChanged);
-    connect(mGroupwarePage->retrieveUrl, &QLineEdit::textChanged, this,
-            &KOPrefsDialogGroupwareScheduling::slotWidChanged);
-    connect(mGroupwarePage->publishDelay, QOverload<int>::of(
-                &QSpinBox::valueChanged), this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
-    connect(mGroupwarePage->fullDomainRetrieval, &QCheckBox::toggled, this,
-            &KOPrefsDialogGroupwareScheduling::slotWidChanged);
-    connect(mGroupwarePage->publishEnable, &QCheckBox::toggled, this,
-            &KOPrefsDialogGroupwareScheduling::slotWidChanged);
+    connect(mGroupwarePage->publishDays, QOverload<int>::of(&QSpinBox::valueChanged),
+            this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
+    connect(mGroupwarePage->publishUrl, &QLineEdit::textChanged,
+            this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
+    connect(mGroupwarePage->publishUser, &QLineEdit::textChanged,
+            this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
+    connect(mGroupwarePage->publishPassword, &QLineEdit::textChanged,
+            this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
+    connect(mGroupwarePage->publishSavePassword, &QCheckBox::toggled,
+            this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
+    connect(mGroupwarePage->retrieveEnable, &QCheckBox::toggled,
+            this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
+    connect(mGroupwarePage->retrieveUser, &QLineEdit::textChanged,
+            this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
+    connect(mGroupwarePage->retrievePassword, &QLineEdit::textChanged,
+            this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
+    connect(mGroupwarePage->retrieveSavePassword, &QCheckBox::toggled,
+            this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
+    connect(mGroupwarePage->retrieveUrl, &QLineEdit::textChanged,
+            this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
+    connect(mGroupwarePage->publishDelay, QOverload<int>::of(&QSpinBox::valueChanged),
+            this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
+    connect(mGroupwarePage->fullDomainRetrieval, &QCheckBox::toggled,
+            this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
+    connect(mGroupwarePage->publishEnable, &QCheckBox::toggled,
+            this, &KOPrefsDialogGroupwareScheduling::slotWidChanged);
 
     (new QVBoxLayout(this))->addWidget(widget);
 
@@ -1491,8 +1500,8 @@ KOPrefsDesignerFields::KOPrefsDesignerFields(QWidget *parent)
 
 QString KOPrefsDesignerFields::localUiDir()
 {
-    const QString dir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
-                        + uiPath();
+    const QString dir =
+        QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + uiPath();
     return dir;
 }
 
diff --git a/src/settings/korganizer.kcfg b/src/settings/korganizer.kcfg
index f9e7487a..3593db7c 100644
--- a/src/settings/korganizer.kcfg
+++ b/src/settings/korganizer.kcfg
@@ -60,6 +60,13 @@
       <whatsthis>Select from which region you want to use the holidays here. Defined holidays are shown as non-working days in the date navigator, the agenda view, etc.</whatsthis>
     </entry>
 
+    <entry type="Enum" name="WeekStartDay">
+      <label>Weekly start day:</label>
+      <tooltip>Select the first day of each week</tooltip>
+      <whatsthis>Select the first day of each week. Normally, you can ignore this since it is set in your locale.</whatsthis>
+      <default>QLocale().firstDayOfWeek()-1</default>
+    </entry>
+
     <entry type="DateTime" name="WorkingHoursStart">
       <label>Daily starting hour</label>
       <whatsthis>Enter the start time for the working hours here. The working hours will be marked with color by KOrganizer.</whatsthis>
diff --git a/src/widgets/kdatenavigator.cpp b/src/widgets/kdatenavigator.cpp
index 44c6477f..c500ad41 100644
--- a/src/widgets/kdatenavigator.cpp
+++ b/src/widgets/kdatenavigator.cpp
@@ -155,7 +155,7 @@ QDate KDateNavigator::startDate() const
     dayone = dayone.addDays(-d2 + 1);
 
     int m_fstDayOfWkCalsys = dayone.dayOfWeek();
-    int weekstart = QLocale().firstDayOfWeek();
+    int weekstart = KOGlobals::self()->firstDayOfWeek();
 
     // If month begins on Monday and Monday is first day of week,
     // month should begin on second line. Sunday doesn't have this problem.
@@ -243,7 +243,7 @@ void KDateNavigator::updateView()
 
 void KDateNavigator::updateConfig()
 {
-    int weekstart = QLocale().firstDayOfWeek();
+    int weekstart = KOGlobals::self()->firstDayOfWeek();
     for (int i = 0; i < 7; ++i) {
         const int day = weekstart + i <= 7 ? weekstart + i : (weekstart + i) % 7;
         QString dayName = QLocale().dayName(day, QLocale::ShortFormat);


More information about the kde-doc-english mailing list