Review Request 111413: Plan - Set First Day of Week to Monday if using ISO Week for week numbering

Friedrich W. H. Kossebau kossebau at kde.org
Sat Nov 23 23:04:38 GMT 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111413/#review36515
-----------------------------------------------------------

Ship it!


Hi Alvaro!
Oh well, this review request really stayed to long without an answer, hopefully you are still behind it!

But finally I managed to spare away enough time and a free mind to grasp completely what this patch is about and why you want to overwrite the firstWeekDay in case of weekNumberSystem being the ISO one. Makes now sense to me, good work!

So all for letting it in, hopefully at least in time for 2.8. Just some code style issues, and the need to adapt the current linking of libkdgantt.


3rdparty/kdgantt/kdganttdatetimegrid.cpp
<http://git.reviewboard.kde.org/r/111413/#comment26958>

    Hm. libkdgantt is a copy of an external lib that is just not packaged anywhere (and in the next weeks will be hopefully updated with a newer version)
    
    And so far it is a Qt-only lib.
    
    But I see the need to change it to use KCalendarsystem, as QDate::weekNumber() seems hardcoded to ISO 8601, ignoring any settings done in the KDElibs layer.
    
    And as Plan is the only one using libkdgantt in Calligra, no one else is hurt by also linking libkdecore, okay.
    
    Seems you did this patch when libkdgantt was still (accidentally) linked to libkdecore, so that has to be added again.
    
    For that change 3rdparty/kdgantt/CMakeLists.txt to also link to ${KDE4_KDECORE_LIBS}, so it has lines like:
    target_link_libraries(calligrakdgantt ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY})
    target_link_libraries(calligrakdgantt LINK_INTERFACE_LIBRARIES ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY})
    
    And please also create a separate patch for this change to libkdgantt, which then is added to 3rdparty/kdganttpatches/ (hm, actually with git that might not be really needed anymore, but let's just do it for the tradition).



plan/libs/models/kptaccountsmodel.cpp
<http://git.reviewboard.kde.org/r/111413/#comment31692>

    Please rewrite this and similar places to
    
    // ISO Week numbering always uses Monday as first day of week
    const int firstWeekDay = (KGlobal::locale()->weekNumberSystem() == KLocale::IsoWeekNumber)
        ? Qt::Monday
        : KGlobal::locale()->weekStartDay();



plan/libs/ui/kptganttview.cpp
<http://git.reviewboard.kde.org/r/111413/#comment31691>

    Please rewrite like this, to get a const value and for easier to read code:
    
    // ISO Week numbering always uses Monday as first day of week
    const Qt::DayOfWeek firstWeekDay = (locale->weekNumberSystem() == Locale::IsoWeekNumber)
        ? Qt::Monday
        : static_cast<Qt::DayOfWeek>(locale->weekStartDay());
    
    g->setWeekStart( firstWeekDay );


- Friedrich W. H. Kossebau


On July 6, 2013, 12:51 a.m., Alvaro Soliverez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/111413/
> -----------------------------------------------------------
> 
> (Updated July 6, 2013, 12:51 a.m.)
> 
> 
> Review request for Calligra.
> 
> 
> Bugs: 321290
>     http://bugs.kde.org/show_bug.cgi?id=321290
> 
> 
> Repository: calligra
> 
> 
> Description
> -------
> 
> Plan uses week numbering extensively. The default week numbering in KDE is ISO Week, which uses Monday as first day of the week, regardless of other locale settings.
> 
> To make it consistent through the application, if week numbering format is ISO Week, set the first day of the week to Monday, and display it accordingly in charts and graphs.
> 
> Without this patch, the week could be set to start on Sunday, and week would be shown on graphs as ranging from Sunday to Saturday, but the week number of working days would be off by one.
> 
> Example: 
> 
> - Week numbering: ISO Week
> - First day of week: Sunday
> 
> Without patch:
> - Week displayed: 2013-07-07 to 2013-07-13
> - Week number shown on charts: 27
> 
> - Expected week number: 28 (Week 27 ends on Sunday 2013-07-07)
> 
> With patch:
> - Week displayed: 2013-07-08 to 2013-07-14
> - Week number shown on charts: 28
> 
> 
> Additionally, there were a few calls to QDate::week() to get the week number, instead of using KGlobalCalendar.
> 
> 
> Diffs
> -----
> 
>   plan/libs/ui/kptganttview.cpp 81073a3 
>   plan/libs/models/kptaccountsmodel.cpp 71c3100 
>   plan/libs/models/kcalendar/kdatetable.cpp b389345 
>   3rdparty/kdgantt/kdganttdatetimegrid.cpp 79c405c 
> 
> Diff: http://git.reviewboard.kde.org/r/111413/diff/
> 
> 
> Testing
> -------
> 
> Tested on a live file. It displays calendars and gantt charts correctly.
> 
> 
> Thanks,
> 
> Alvaro Soliverez
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20131123/a4246f49/attachment.htm>


More information about the calligra-devel mailing list