Commit graph

4507 commits

Author SHA1 Message Date
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
Ivailo Monev
061a11fd43 kdeui: replace KDatePicker/KDateTable with new KCalendarWidget class
interestingly QLocale is not used for many things but that is about to
change, Katie uses it a lot internally (e.g. for QDateTime formatting
and such) so instead of bolting a calendar system on top of KLocale
perhaps a QLocale wrapped around in KLocale will fit the general idea
of using QLocale in widgets when necessary (as does QCalendarWidget).

that however means no way to specify a calendar system (in general,
other than changing the widgets locale itself) but the QDateTime and
related classes are tied to gregorian calendar already - the system
time itself carries no information about the calendar and any
conversions from one calendar to another are basically made up stuff
(there is the time zone thing ofcourse but that is not a calendar)

another interesting thing to note is that KLocale was written such that
it is read-write - changing the date formats for example is possible
because there are public KLocale methods for that.

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-23 06:16:56 +03:00
Ivailo Monev
e84a04fa67 kdeui: remove forward-declaration of now non-existing KTimeZones class
replaced with KTimeZoneList

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-23 02:50:53 +03:00
Ivailo Monev
000c8af989 kdeui: remove unused date and time related widget classes
some of the classes date back to 2001 and 2002, still unused

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-23 02:48:22 +03:00
Ivailo Monev
645cc4e5cf kdecore: KTimeZone documentation update
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-22 10:53:55 +03:00
Ivailo Monev
c411c09c16 kdecore: KTimeZone review
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-22 10:49:24 +03:00
Ivailo Monev
9af650bb6a kdecore: rewrite KTimeZone to use the transition data
turned out easier than expected

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-22 10:27:21 +03:00
Ivailo Monev
be09f602d2 kdecore: check if the time zone file exists from KTimeZone::isValid()
this was not done in the previous implementation but it is now, it will
allow to detect tzdata changes and fallback to UTC in the plasma time
data engine during system upgrades for example. that ofcourse is only
theoretical and preperation for worst-case-scenario type of situation but
good to have anyway

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-22 06:45:52 +03:00