Summary: | i wish for the option to change the first day of week (sun / mon) | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Michael Gefen <gefenm> |
Component: | Plugin-Generic-Calendar | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | kde, orgads |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.5.0 |
Description
Michael Gefen
2005-08-29 11:18:24 UTC
SVN commit 540657 by toma: Look at the settings to find out the first day of the week and adjust the calendars for that. So if the first day of the week in your country is wednesday, that will work now. CCBUG: 111697 BUG: 117105 M +41 -13 calpainter.cpp --- trunk/extragear/libs/kipi-plugins/calendar/calpainter.cpp #540656:540657 @@ -20,7 +20,7 @@ * ============================================================ */ // Qt includes. - + #include <qpainter.h> #include <qrect.h> #include <qpaintdevice.h> @@ -85,7 +85,8 @@ // -------------------------------------------------- - int days[42]; + int days[42]; + int startDayOffset = KGlobal::locale()->weekStartDay(); for (int i=0; i<42; i++) days[i] = -1; @@ -93,8 +94,11 @@ QDate d(year_, month_, 1); int s = d.dayOfWeek(); + if (s+7-startDayOffset >= 7) + s=s-7; + for (int i=s; i<(s+d.daysInMonth()); i++) { - days[i-1] = i-s+1; + days[i + (7-startDayOffset)] = i-s+1; } // ----------------------------------------------- @@ -227,7 +231,12 @@ painter->setPen(Qt::red); sy = rCal.top(); - for (int i=0; i<7; i++) { + for (int i=0; i<7; i++) + { + int dayname = i + startDayOffset; + if (dayname > 7) + dayname = dayname-7; + sx = cellSize * i + rCal.left(); r.moveTopLeft(QPoint(sx,sy)); rsmall = r; @@ -235,10 +244,10 @@ rsmall.setHeight(r.height() - 2); #if KDE_IS_VERSION(3,2,0) painter->drawText(rsmall, Qt::AlignRight|Qt::AlignBottom, - KGlobal::locale()->calendar()->weekDayName(i+1, true)); + KGlobal::locale()->calendar()->weekDayName(dayname, true)); #else painter->drawText(rsmall, Qt::AlignRight|Qt::AlignBottom, - KGlobal::locale()->weekDayName(i+1, true)); + KGlobal::locale()->weekDayName(dayname, true)); #endif } @@ -302,7 +311,8 @@ // -------------------------------------------------- - int days[42]; + int days[42]; + int startDayOffset = KGlobal::locale()->weekStartDay(); for (int i=0; i<42; i++) days[i] = -1; @@ -310,8 +320,11 @@ QDate d(year, month, 1); int s = d.dayOfWeek(); + if (s+7-startDayOffset >= 7) + s=s-7; + for (int i=s; i<(s+d.daysInMonth()); i++) { - days[i-1] = i-s+1; + days[i+(7-startDayOffset)] = i-s+1; } // ----------------------------------------------- @@ -459,6 +472,11 @@ painter->setPen(Qt::red); sy = rCal.top(); for (int i=0; i<7; i++) { + + int dayname = i + startDayOffset; + if (dayname > 7) + dayname = dayname-7; + sx = cellSize * i + rCal.left(); r.moveTopLeft(QPoint(sx,sy)); rsmall = r; @@ -466,10 +484,10 @@ rsmall.setHeight(r.height() - 2); #if KDE_IS_VERSION(3,2,0) painter->drawText(rsmall, Qt::AlignRight|Qt::AlignBottom, - KGlobal::locale()->calendar()->weekDayName(i+1, true)); + KGlobal::locale()->calendar()->weekDayName(dayname, true)); #else painter->drawText(rsmall, Qt::AlignRight|Qt::AlignBottom, - KGlobal::locale()->weekDayName(i+1, true)); + KGlobal::locale()->weekDayName(dayname, true)); #endif } @@ -526,14 +544,19 @@ // -------------------------------------------------- int days[42]; + int startDayOffset = KGlobal::locale()->weekStartDay(); + for (int i=0; i<42; i++) days[i] = -1; QDate d(year, month, 1); int s = d.dayOfWeek(); + if (s+7-startDayOffset >= 7) + s=s-7; + for (int i=s; i<(s+d.daysInMonth()); i++) { - days[i-1] = i-s+1; + days[i+(7-startDayOffset)] = i-s+1; } // ----------------------------------------------- @@ -666,6 +689,11 @@ painter->setPen(Qt::red); sy = rCal.top(); for (int i=0; i<7; i++) { + + int dayname = i + startDayOffset; + if (dayname > 7) + dayname = dayname-7; + sx = cellSize * i + rCal.left(); r.moveTopLeft(QPoint(sx,sy)); rsmall = r; @@ -673,10 +701,10 @@ rsmall.setHeight(r.height() - 2); #if KDE_IS_VERSION(3,2,0) painter->drawText(rsmall, Qt::AlignRight|Qt::AlignBottom, - KGlobal::locale()->calendar()->weekDayName(i+1, true)); + KGlobal::locale()->calendar()->weekDayName(dayname, true)); #else painter->drawText(rsmall, Qt::AlignRight|Qt::AlignBottom, - KGlobal::locale()->weekDayName(i+1, true)); + KGlobal::locale()->weekDayName(dayname, true)); #endif } I can't find this setting anywhere in version 0.9.2. Is it fixed or not? Yes it is. the calendar plugin was not yet ported completely to KDE4. I hope to finish it soon (not much work left) and upload it to trunk. Orgad, What's news about this file ? It still valid with kipi-plugins 0.2.0 ? Gilles Caulier It is resolved. First day of the week is taken from the locale settings (System Settings -> Regional & Language -> Time & Dates), and prayDay (weekend) is colored in red. as for comment #5 explain, we can close this bug as fixed. Reopen it if needed |