Commit graph

1124 commits

Author SHA1 Message Date
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
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
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
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
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
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
Ivailo Monev
34c7498702 kdecore: minor KTimeZone parsing optimization
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-22 06:33:18 +03:00
Ivailo Monev
89ca9c774d kdecore: copyright KSystemTimeZones, KTimeZone and the tests for the classes to me
rewritten by me

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-22 04:00:09 +03:00
Ivailo Monev
f2f37377e3 kdecore: reimplement KTimeZone
simpler, cleaner and most importantly - thread-safe (more than the
previous implementation anyway).

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-22 03:53:20 +03:00
Ivailo Monev
199278af4a kdecore: document the two important methods of KDateTime
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-22 00:51:24 +03:00
Ivailo Monev
798a73eb0b kdecore: de-virtualize KDateTimeFormatter, KDateTimeParser and KDayPeriod
the classes are private and the methods are no reimplemented

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-21 10:55:09 +03:00
Ivailo Monev
f452e2e50b kdecore: reimplement KDateTime via QDateTime
KDateTime shall be used only for storing date and time while KLocale
shall be used to display such, not even going to test what KDateTime
does because it is basically a few methods on top of QDateTime now.

and because QDateTime knows not much about calendar systems while
KLocale supports several it makes sense for KDateTime to not be used for
displaying date and time thus the TODOs for KLocale are simply removed

note that KLocale still uses its own parser and formatter which means
that the change affects only KDateTime and its uses, not KLocale

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-21 07:51:13 +03:00
Ivailo Monev
3795893cdf kdecore: remove code for always true condition
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-21 02:14:32 +03:00
Ivailo Monev
e00c726455 kdecore: remove unused KTimeZoneBackend::type() method
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-21 02:14:17 +03:00
Ivailo Monev
382fd80484 kdecore: fix KStandardDirs thread-safety issues
managed to bust it with some proper threading (see KFilePreviewJob on the
kfilepreview branch)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-19 09:06:47 +03:00
Ivailo Monev
8ead339f6d kdecore: call QBuffer constructor in KSycocaBufferDevice
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-16 19:55:11 +03:00
Ivailo Monev
63ae1f5ade kdecore: re-parse MIME data files on ksycoca database change
was not done before (was done once lazily), is now

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-16 19:05:24 +03:00
Ivailo Monev
6bd6633da5 kdecore: remove redundant lookup in KMimeTypeRepository::defaultMimeTypePtr()
if KMimeTypeRepository::findMimeTypeByName() did not find the default MIME
then another lookup that does the same as
KMimeTypeRepository::findMimeTypeByName() will not find it either

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-16 18:30:51 +03:00
Ivailo Monev
8cf2ae7bc2 generic: drop floppy support
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-14 06:30:29 +03:00
Ivailo Monev
cd8ab8d93e kdeui: do not fork from KUniqueApplication
simplifies startup notification for example, external applications that
pass the "nofork" argument may fail (not uncommon to be passed to
konsole)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-13 17:32:37 +03:00
Ivailo Monev
3b14da4dd0 kdecore: unlock KMimeTypeRepository
it is singleton and essentially the parsing of aliases, subclasses and
magic files has to be done only once during the entire program lifetime so
rathern then locking and blocking from getters do it in a fire and forget
fashion

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-12 23:50:23 +03:00
Ivailo Monev
f90c94dae7 kdecore: strip the trailing slash when passing the URL path to kPathDirectory() from KUrl::upUrl()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-10 06:52:30 +03:00
Ivailo Monev
c4d7fcfaa8 kdecore: drop reliance on wheel group for KAuthorization helpers
groups are obsolete thing (e.g. disk, optical, power, etc.)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-10 02:54:21 +03:00
Ivailo Monev
ca3641818e kdecore: remove kcfg resource reference in kde-config
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-09 06:00:13 +03:00
Ivailo Monev
ee1aa40904 kdecore: drop support for KStandardDirs kcfg resource
kcfg files are resources much like .ui files - not ment to be installed,
used only to generate .cpp and .h files from them. they are not used at
runtime altough Plasma::ConfigLoader does use its format to load files
for configuration purposes (files named main.xml shipped by plasmoids)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-09 05:48:31 +03:00
Ivailo Monev
268b2cc053 kdecore: remove redundant locks in KMimeTypeRepository
once the globs and magic rules are parsed locking is redundant

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-09 05:05:00 +03:00
Ivailo Monev
68e226a0b1 kdecore: remove debug area for the now gone networkstatus
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-08 21:43:53 +03:00
Ivailo Monev
355bca1289 kutils: new knetworkmanager library
to replace the status notifier (in the kde-workspace repo) and
eventually manage network connections aswell as move network status
notifier out of solid

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-08 07:48:38 +03:00
Ivailo Monev
e512f4af70 kdecore: remove unused qtextstream header inclusion in qtest_kde header
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-06 09:06:18 +03:00
Ivailo Monev
9767ce8fc4 kio: watch the sub-directories when listing recursively
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-05 00:00:14 +03:00
Ivailo Monev
12ebcb3268 kdecore: remove redundant KUrl::List::size() calls
these are constructors, initial size is zero

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-04 19:30:35 +03:00
Ivailo Monev
bce72b0b24 kdecore: safety-net for KUrl::upUrl(), also append trailing slash from KUrl::directory()
relative paths are tricky

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-03 20:39:14 +03:00
Ivailo Monev
a051b1b284 kdecore: append trailing slash from kPathDirectory() function
while it does not matter for comparison, for KUrl::setFileName() to produce
correct results it has to be there after KUrl::upUrl()

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-03 17:09:54 +03:00