Commit graph

4464 commits

Author SHA1 Message Date
Ivailo Monev
f04d336bc0 kdecore: more compat bits for KLocale::formatNumber()
one more hack comming right up..

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 15:38:13 +03:00
Ivailo Monev
8d3cf0ad3d kdecore: compat bits for KLocale::formatNumber()
the test case for this is in a KSignalPlotter test, see:
kde-workspace/libs/ksysguard/tests/signalplottertest.cpp

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 14:38:05 +03:00
Ivailo Monev
c4a5205981 kdecore: correct milisecond(s) spelling
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 13:20:53 +03:00
Ivailo Monev
d47978309e kdecore: replace the "ok" argument of KLocale::readDate() and KLocale::readTime() with "format" one
beware that bad things will happen if the input strings are not in one of
the formats KLocale::formatDate() and KLocale::formatTime() output

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 12:54:53 +03:00
Ivailo Monev
de7070d2bb kdecore: return only the language part from KLocale::language()
e.g. "bg" for "bg_BG", the default locale is special case for that method
too because of expectations in other places (such as KConfig, KMimeType
tries to match all of the languages returned by KLocale::languageList()
which is how it should be done but that is for another commit)

that is essentially the last bit to bring it back to a compatible state
with the previous implementation, except now more locales are supported

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 12:28:08 +03:00
Ivailo Monev
476f006aab kdecore: do not insert duplicate catalogs into KLocale
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 11:57:30 +03:00
Ivailo Monev
8da6fa7558 kdeui: preserve the translations order in KSwitchLanguageDialog
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 11:53:06 +03:00
Ivailo Monev
b8c4f73865 kdeui: implement KSwitchLanguageDialog
note that it does not change the locale language (yet), nor does is affect
it. it changes the translation language(s) - two different things!

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 11:16:27 +03:00
Ivailo Monev
c44da5428f kdecore: do not insert and remove catalogs from KPluginFactory
already done by KComponentDataPrivate, when the component is created and
deleted

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 10:04:36 +03:00
Ivailo Monev
95ccbcb31b kdecore: do not insert invalid catalogs into KLocale
to optimize translation lookup, also re-purposed
KCatalog::catalogLocaleDir() for that

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 10:02:57 +03:00
Ivailo Monev
b1ffffeb89 kdecore: preserve manually inserted catalogs on KLocale configuration reparse
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 06:21:00 +03:00
Ivailo Monev
1e3041061a kdecore: fix regression since 0b9281b360
also adjust KLocalizedString test case, "Job" is no longer translated
string in the source code thus not in the french translation

on a side note there are KLocale tests all around - KLocalizedString, KIO
tests, etc. so perhaphs only quircks should be tested by the KLocale
specifiec tests

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 06:02:28 +03:00
Ivailo Monev
eedfed825a kdecore: format and indent
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 05:40:10 +03:00
Ivailo Monev
bc4bff9784 kdecore: adjust the KService test to KLocale changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 05:29:28 +03:00
Ivailo Monev
3f4a16a84e kdecore: stabilize KLocalizedStringTest::testThreads()
while the threads are running the kdelibs4 catalog may or may not get
removed resulting in a race and different results in the functions (if
the catalog is not there there will be no translation but the test
functions expect it to be translated when french translations are
installed)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 05:15:59 +03:00
Ivailo Monev
3e1e82534a kdecore: reduce branches in KLocale::translateRaw()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 05:13:08 +03:00
Ivailo Monev
5143a5895e kdecore: update KLocale documentation
QLocale checks for LC_CTYPE, KLocale may check for LC_MESSAGES in the
future

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 05:10:06 +03:00
Ivailo Monev
69a479047f kdecore: KLocale::translateRaw() and KLocale::translateQt() optimizations
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 05:00:47 +03:00
Ivailo Monev
5e95db910f kdecore: magic bits for numbers formatting
people really messed up the precisions, look at what kcalc does with the
constants:
kde-extraapps/kcalc/kcalcdisplay.cpp

zero precision is essentially rounding the constants! also setlocale() no
longer has effect on Katie and thus Katana so updated the method to
override locale in KLocalizedString test while at it (tests pass after one
adjustment for the french locale case)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 04:59:57 +03:00
Ivailo Monev
b7e54f8e21 kdeui: stub KSwitchLanguageDialog
to be rewritten. date, time, days, etc. translation and conversion work
like a charm tho (when translated and supported by the locale classes
ofcourse):
https://ibb.co/hcW0dL3

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 00:40:39 +03:00
Ivailo Monev
e5b48177a6 kdecore: add missing QMutableListIterator template argument in KLocale::removeCatalog()
how did that compile again?

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 23:07:44 +03:00
Ivailo Monev
762f01a33a kdecore: use std::array<T,T> for the date and time formats in KLocale
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 23:05:25 +03:00
Ivailo Monev
5513e53f36 includes: remove headers for gone classes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 22:13:30 +03:00
Ivailo Monev
5a1aa5568e kdecore: fix KLocale thread-safety issues
it was locked before too but the mutex was recursive, now it is not

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 22:05:29 +03:00
Ivailo Monev
ed04fb1b13 kdecore: set the locale of the configuration files from KLocale::languageCodeToName() and KLocale::countryCodeToName()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 21:41:34 +03:00
Ivailo Monev
12f3ffd120 kdecore: remove redundant KLocale::translateRaw() methods
context can be null now

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 21:21:57 +03:00
Ivailo Monev
20e92c8398 kdecore: remove duplicates from the result of KLocale::allLanguagesList()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 07:48:02 +03:00
Ivailo Monev
e413cbc41f kdecore: reimplement KLocale::formatDuration()
much like the old (and now gone) KLocale::prettyFormatDuration() except
with miliseconds precision instead of days

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 07:12:53 +03:00
Ivailo Monev
aa9e5b7066 kdecore: fix and adjust tests
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 03:32:39 +03:00
Ivailo Monev
e37fa06874 Merge branch 'master' of https://scm.osdn.net/gitroot/kde/kdelibs 2023-07-27 03:01:34 +03:00
Ivailo Monev
938d0dd7e0 generic: remove KCalendarSystem leftovers
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 03:01:17 +03:00
Ivailo Monev
26258999ed cmake: correct kde4_translate() macro documentation
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 01:36:14 +03:00
Ivailo Monev
fc4c832b3d kdecore: KLocale::translateRaw() methods optimization
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 00:07:52 +03:00
Ivailo Monev
1a45508306 kdecore: reimplement KLocale
by using QLocale in KLocale and separating the date, time and numbers
conversion from translation KLocale actually gets extended locale
support from QLocale (which uses CLDR data v43 currently). translation
remains unaffected. for comparison here is the result of two function
calls the result of which should explain the whole change:
KLocale::allLanguagesList().size() = 669
KLocale::installedLanguages().size() = 68

the first number is locales Katie supports, the second being the
number of languages Katana is translated into

KSwitchLanguageDialog needs a rewrite but that is on the TODO

also copyrighting KCatalog to me because I rewrote it, for reference:
881b47b8ea

KCalendarSystem gets the middle finger - batteries not included for date
and time. extra calendar systems can, but are unlikely to be, supported
in the future

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-26 23:50:18 +03:00
Ivailo Monev
cd7162688c Merge branch 'master' of https://scm.osdn.net/gitroot/kde/kdelibs 2023-07-24 22:39:14 +03:00
Ivailo Monev
0fa46d60db kdecore: remove declaration of non-existing KLocale::setEncoding() method
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-24 21:44:30 +03:00
Ivailo Monev
b7d67374be plasma: focus hack for Plasma::CalendarWidget
as is done by Plasma::LineEdit

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-24 20:51:50 +03:00
Ivailo Monev
6cb0ae1239 plasma: call Plasma::ThemedWidgetInterface::initTheming() from Plasma::CalendarWidget constructor
to apply palette and font instantly instead of relying on it to happen due
to external events

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-24 08:39:14 +03:00
Ivailo Monev
97372f70af plasma: Plasma::CalendarWidget documentation correction
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-24 06:38:43 +03:00
Ivailo Monev
ffa856e1b8 kdecore: test KTimeZone from and to UTC conversion
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-24 01:24:08 +03:00
Ivailo Monev
de31c50479 kdecore: drop support for all but gregorian and julian calendars
additional calendar systems can be supported via ICU in the future but
for now that will be more than enough considering other things such as
QDateTime and QCalendarWidget, the gregorian and julian calendars being
common, etc.

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-23 22:58:43 +03:00
Ivailo Monev
ce03856f54 plasma: theme the Plasma::CalendarWidget via the internal Plasma::ThemedWidgetInterface class
what that does - the general application color scheme applies to the native
widget and any Plasma::Theme overrides are applied on top of that making it
slightly less native looking and more plasma-themed.

also that allows to not just hide the calendar month button but disable it,
the colors for disabled widget as slightly lighter than the usual color
scheme so its not a big difference visually with that change

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-23 20:55:55 +03:00
Ivailo Monev
0560ab5550 plasma: sligthly better workaround for Plasma::CalendarWidget navigation bar
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-23 13:06:57 +03:00
Ivailo Monev
6d3811054d kdeui: adapt KCalendarWidget to locale and language changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-23 12:02:13 +03:00
Ivailo Monev
7e78f97d61 plasma: new Plasma::CalendarWidget class
to be used by the clock and calendar applets

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-23 11:30:15 +03:00
Ivailo Monev
3c697cf8ce kdeui: implement setter and getter for KCalendarWidget to use a specifiec KCalendarSystem
maybe temporary tho but for now the minimum and maximum date will be that
of the KCalendarSystem

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-23 11:29:06 +03:00
Ivailo Monev
8f8865db62 kdeui: do not warn from setupCalendarWidget() if the system locale name is "C"
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-23 08:21:55 +03:00
Ivailo Monev
2cf411e2ed kdecore: remove unused and deprecated KLocale/KCalendarSystem setters and getters
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-23 08:04:44 +03:00
Ivailo Monev
714b6f2021 kdecore: remove unused KLocalizedDate class
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-23 06:54:53 +03:00
Ivailo Monev
6c2c0efda8 kdeui: remove unused klocale header inclusion in kcalendarwidget header
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-23 06:20:32 +03:00