2014-11-14 13:51 GMT+02:00 Pekka Vuorela <pekka.vuor...@jolla.com>:

> to, 2014-11-13 kello 23:43 +0200, E.S. Rosenberg kirjoitti:
> > Well I solved it and now it's dependent on the locale (which by
> > default is not set on Jolla) so:
>
> > 1. I am more then happy to submit my patches to Jolla, though you guys
> > claim 'closed source' every file I edited had a BSD license at the
> > top.
>
> I expect you have been checking Silica files. There the QML file side
> does have BSD licenses on files. Rationale being to allow application
> developers taking snippets of code when using provided elements directly
> is not enough for some reason.
>
> I don't think we have a precedent of merging contributions there,
> though. So while it's great you got it working how you like, it could be
> easier for us (or me) right now to implement this separately.
>
> > 2. To actually make this work properly jolla one or all of the
> > following environment variables need to be present LC_TIME, LC_ALL,
> > LANG, by default LANG is present but for people like me who want
> > language A but locale B for dates etc. so some way to set LC_* or at
> > least LC_ALL would be cool.
> > I tried adding to my .bashrc but that had no effect for launching from
> > the launcher, from CLI it helpend of course.
> >
> > I assume I need to add it somewhere in dconf but I'm not knowledgeable
> > enough about dconf for the moment...
>
> User session picks up the locale values (that is, LANG at the moment
> set) from /var/lib/environment/nemo/locale.conf
>
> But having different locale categories working properly is not that
> simple. String translations are also used for date/time patterns, Qt
> knows only one system locale, etc.
>
Are you sure about this, as far as I can tell it's working fine, Qt is one
of those frameworks that handles locales really well....

>
> Acknowledged that some people want this, though.
>
> > Should I publish the patches here or is that considered unacceptable
> > behavior on this list?
>
> I see no reason not to.
>
So here are the patches, they will help you implement it.

/usr/lib/qt5/qml/Sailfish/Silica/DatePickerDialog.qml -- haven't gone over
the whole file.
I am not 100% sure the DatePickerDialog.qml patch is needed for the
calendar fix, but I guess for other uses....
Modified start date of labels and added Qt.locale().firstDayOfWeek into the
calculation.

/usr/lib/qt5/qml/Sailfish/Silica/private/DatePicker.js -- this file does
all the work
removed variable _weekStartsOnMonday
added variable _firstDayOfWeek
added function _setFirstDayOfWeek(dayNo)
modified function _getStartDateForMonthView(year, month) -- modified the
math of the function so that it now always gives the right date (no matter
what the firstDayOfWeeks' value is) and therefor the exception set for
Monday was commented out.

/usr/share/jolla-calendar/pages/MonthPage.qml -- the QML file that
describes the jolla-calendar page that matters
Modified start date of labels and added Qt.locale().firstDayOfWeek into the
calculation.

/usr/lib/qt5/qml/Sailfish/Silica/DatePicker.qml
added property firstDayOfWeek which calls
DatePicker.js._setFirstDayOfWeek() -- this was the only way I know at the
moment to pass the information known to Qt.locale to the javascript, there
may be better ways.

As said everything was checked in locales with the 3 different week starts
that exist according to wikipedia (sat, sun, mon), but it should work for
any day so unless someone decides that s/he observes the calendar of
Discworld (8 days/week) it should be fine.

The order of the files in diff was "diff new orig".

A mention of me in the source would be nice, but not mandatory.
Hope this helps you implement it...
Eli

>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
281c281
<             var dt = new Date(2012, 0, 1 + Qt.locale().firstDayOfWeek)   // Jan 1, 2012 is a Sunday
---
>             var dt = new Date(2012, 0, 2)   // Jan 2, 2012 is a Monday
74,75c74,75
<                         // 2 Jan 2000 was a Sunday
<                         text: Qt.formatDateTime(new Date(2000, 0, 2 + Qt.locale().firstDayOfWeek + index, 12), "ddd")
---
>                         // 3 Jan 2000 was a Monday
>                         text: Qt.formatDateTime(new Date(2000, 0, 3 + index, 12), "ddd")
55,56d54
<     property int firstDayOfWeek: DatePickerScript._setFirstDayOfWeek(Qt.locale().firstDayOfWeek)
< 
39,47c39
< //var _weekStartsOnMonday = true
< var _firstDayOfWeek = 1
< 
< function _setFirstDayOfWeek(dayNo) {
<     if(_firstDayOfWeek != dayNo && dayNo >= 0 && dayNo <= 6) {
< 	_firstDayOfWeek = dayNo;
<     }
<     return _firstDayOfWeek;
< }
---
> var _weekStartsOnMonday = true
74,76c66,67
<     if (start.getDay() != _firstDayOfWeek) {
< 	// Math used to offset  (7 - (firstdayoffset - startDay))%7
<         start.setDate(start.getDate() - ((7 - (_firstDayOfWeek - start.getDay())) % 7))
---
>     if (start.getDay() > 0) {
>         start.setDate(start.getDate() - start.getDay())
78c69
< /*    if (_weekStartsOnMonday) {
---
>     if (_weekStartsOnMonday) {
85c76
<     }*/
---
>     }
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to