Commit graph

1361 commits

Author SHA1 Message Date
Ivailo Monev
31cd95338f kdecore: remove redundant private KMimeTypeRepository::aliases() method
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-06 19:53:47 +03:00
Ivailo Monev
65587af47d kdecore: probe all languages from KLocale::languageCodeToName() and KLocale::countryCodeToName()
for that to work what KConfig expects (the language only) has to be first
in the list, otherwise KConfig returns entries that are actually not in the
set locale (go figure)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-06 18:55:59 +03:00
Ivailo Monev
c7dc966f67 kdecore: deep-copy the patterns in KMimeTypeRepository::findFromOtherPatternList()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-06 08:09:51 +03:00
Ivailo Monev
8eb0c751b8 kutils: log kidletime messages to special area
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-05 21:36:22 +03:00
Ivailo Monev
0f7d9f8ea3 kdecore: setup KCrash to log to the system log, update its documentation
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-04 11:51:35 +03:00
Ivailo Monev
6bf6169caf kdecore: return QByteArray from kBacktrace()
to avoid conversion from QString to QByteArray when possible, the trace is
handled as array of latin1-encoded strings anyway

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-04 08:14:53 +03:00
Ivailo Monev
2647be1ab2 kdeui: KCrash rewrite
a crashed program trying to restart itself is very unreliable,
especially program that uses KUniqueApplication instance. so, instead
all the information about the crash shall be written to a file on the
disk (in the temporary directory) and read by external kcrash KDED
module that will report the crash (possibily even upload the crash
details somewhere) and restart the program as necessarry.

this also opens up possibility for per-application configuration for
things such as the automatic restart feature but that shall be done by the
kcrash KDED module instead (parsing a config from a crashed program is
not a good idea)

KCrash::NoRestart will be unused but kept for future expansion

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-03 11:21:41 +03:00
Ivailo Monev
8bea5c9837 kdecore: set the config locale to the highest priority language from KLocale::languageCodeToName() and KLocale::countryCodeToName()
as noted in de7070d2bb having multiple
languages and matching the correct one for each use case will have to be
tuned

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-02 07:11:08 +03:00
Ivailo Monev
5e51868194 kdecore: const-ify variables in KLocale::translateRaw() methods
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-01 05:18:47 +00:00
Ivailo Monev
886187c647 kdecore: remove unused kdatetime header inclusion
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-01 03:55:47 +00:00
Ivailo Monev
3e6c5f88ba kdecore: remove redundant KDateTime class forward-declration in klocale header
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-01 03:53:47 +00:00
Ivailo Monev
295e41b936 kdecore: scoop timezones
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-31 21:52:28 +00:00
Ivailo Monev
9de2672f31 kdecore: python3 compatible scoop-tzones.py script
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-31 21:51:47 +00:00
Ivailo Monev
17b82b3fd4 kdecore: PCI IDs database update
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-31 21:36:33 +00:00
Ivailo Monev
5545cb7e2f kio: remove unused KProtocolManager::supportsOpening() method
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-31 20:35:46 +00:00
Ivailo Monev
899f789b07 kdecore: move KToolInvocation to kdeui
to get rid of the KApplication signal which is a hack really

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-31 08:09:02 +00:00
Ivailo Monev
73e5c1ad96 kdecore: compiler warnings fix
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-30 11:31:25 +03:00
Ivailo Monev
acd77cb495 kdecore: replace authors of KLocale
rewritten and improved!

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-30 06:14:31 +03:00
Ivailo Monev
4dc549635a kdecore: update KCatalog documentation
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-29 08:30:50 +03:00
Ivailo Monev
2ffa34c16a kdecore: update KLocale::defaultLanguage() documentation
deffinetly not internal

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-29 08:20:50 +03:00
Ivailo Monev
ecc721b59c kdecore: change locale language from KLocale::reparseConfiguration() of default KLocale objects
default as in no explicit language has been passed as argument to KLocale
and the language comes either from config or the environemnt variables

with this change KCalendarWidget properly adapts to KLocale config change,
however other applications and widgets may not which is something that has
to be looked into. note that logout is (and was before the KLocale rewrite
even) recommended by the locale KCM for the change to fully take effect

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-29 08:08:13 +03:00
Ivailo Monev
d02d2b3fa4 kdecore: implement precision field for KuitSemantics
otherwise KLocale::formatNumber() has to guess the precision that was
passed to KLocalizedString::subs() and make up a localized integer string
with a magic wand, the precision for precise number types (e.g. ulong,
qlonglong, etc.) remains -1

fixes KSignalPlotter test case failure

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 15:45:04 +03:00
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
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
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
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
938d0dd7e0 generic: remove KCalendarSystem leftovers
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 03:01:17 +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