<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Aug 3, 2015 at 6:34 PM, Thiago Macieira <span dir="ltr"><<a href="mailto:thiago@kde.org" target="_blank">thiago@kde.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Monday 03 August 2015 08:33:54 Martin Klapetek wrote:<br>
> > If the format you're looking for requires support from translators, please<br>
> > add<br>
> > a new class to QtCore.<br>
><br>
> Suppose there's such QLocale setting as described above, then it would<br>
> be just a matter of some regexp inside the time formatting function which<br>
> would add/remove the "ap"/"AP" strings for the clock. I imagine.<br>
<br>
</span>How would that setting be set? Who would set it? Is that something that the<br>
clock app would use and allow the user to set?<br>
<br>
If so, why not extract the time format and show that to the user? Or, at<br>
least, parse it to set the default of "Use 24-hour clock"? If the user wants<br>
to toggle 24-hour, save the new time format in the config file and use it to<br>
format the time next time.<br></blockquote><div><br></div><div></div></div><div>I may have explained it poorly, so let me try again. tl;dr at the bottom :)</div><div><br></div><div>I can put a checkbox to the Plasma panel clock which would either</div><div>enable or disable 24h clock format. And in fact we do exactly that.</div><div>If the user wants to see 24h clock format in the panel, he can check</div><div>that checkbox. If he wants AM/PM clock, he can uncheck the checkbox.</div><div>Simple as that.</div><div><br></div><div>The implementation takes the Qt.locale().timeFormat(Locale.ShortFormat)</div><div>(it's QML), checks for the 24h clock option and either adds "AP"</div><div>or removes "AP" from the format string returned by Qt.locale().</div><div>The actual clock on the panel is then printed using</div><div>Qt.formatTime(currentTimeObject, thatModifiedTimeFormatString).</div><div><br></div><div>Now, this will affect _only_ the Plasma panel clock. This will _not_</div><div>affect Dolphin's time stamps, Gwenview's picture-taken times,</div><div>this won't affect anything else but the panel clock and the panel clock</div><div>alone. But if I want to have 24h clock format, I want it everywhere,</div><div>in all apps, system-wide, not _only_ in the panel clock. Everything</div><div>else will be however using time formatted by the LC_TIME locale</div><div>default format.</div><div><br></div><div>Currently each and every application would have to implement similar</div><div>code as the Plasma panel clock - get the locale's time format string,</div><div>check for some config, add/remove "AP" from the format string, print</div><div>the time using QDateTime().toString(theModifiedTimeFormatString).</div><div>Or each application would have to read the date/time format string</div><div>from somewhere, some global config in order to have the same time</div><div>format everywhere.</div><div><br></div><div>Is it clear now? Do you see what I'm getting at?</div><div><br></div><div>Setting different LC_TIME values proven to not be feasible, because</div><div>very often users want "just" 24h clock format _and_ their locale's</div><div>date format. Or some date format and their locale's time format.</div><div><br></div><div>Ideally there would be a global setting, set from System Settings,</div><div>perhaps written into ~/.config/QtProject.conf, which QLocale could</div><div>internally read and return the time formatted according to that setting</div><div>already. This would spare every single application doing it on its own.</div><div>Then, calling QDateTime().toString() or QLocale().toString(QDateTime)</div><div>would return the time formatted by user preference already and it would</div><div>return it in all apps, uniformly, same format.</div><div><br></div><div>I guess such feature might not be feasible for QLocale, hence my</div><div>suggestion to bring back KLocale in a limited form, purely for global</div><div>date/time formatting purposes around KDE apps, to have the same</div><div>date/time format everywhere around.</div><div><br></div><div>As a side note, missing global date/time format setting is a regression</div><div>from the kde4 times.</div><div><br></div><div>---</div><div><br></div><div>tl;dr - it'd be nice to be able to set a custom time format for all QDateTime/</div><div>QLocale users without them needing to do anything at all.</div><div><br></div><div>Hope it's clear now :)</div><div><br></div><div>Cheers</div>-- <br><div class="gmail_signature"><div><span style="color:rgb(102,102,102)">Martin Klapetek | KDE Developer</span></div></div>
</div></div>