Commit graph

69 commits

Author SHA1 Message Date
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
938d0dd7e0 generic: remove KCalendarSystem leftovers
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 03:01:17 +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
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
e978590acd generic: define KDE_DEFAULT_DEBUG_AREA in the main build file for each library
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-06-09 23:43:20 +03:00
Ivailo Monev
636f533297 kdecore: discard leap second adjustments, standard/wall and UTC/local time indicators timezone data
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-06-01 00:49:15 +03:00
Ivailo Monev
25fb60bac6 kdecore: remove KTimeZone code for always false condition
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-06-01 00:27:06 +03:00
Ivailo Monev
9b41127ecb generic: prepare for Katie changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-11-13 00:40:18 +02:00
Ivailo Monev
92816d2320 kdecore: set the byte order of the QDataStream object used to parse tzdata files
eventually QDataStream byte order will default to QDataStream::HostEndian
so this change is preperation for that

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-30 19:05:17 +02:00
Ivailo Monev
6bee91f902 kdecore: compiler warning fix
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-24 16:35:29 +03:00
Ivailo Monev
8f3bf2166c kdecore: clear result if BZip2 compression fails
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-17 18:51:33 +03:00
Ivailo Monev
25f748a009 kdecore: tune the buffer sizes in KSystemTimeZonesPrivate::update()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-04 08:35:18 +03:00
Ivailo Monev
ec1a9d532f kdecore: typo
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-04 08:31:24 +03:00
Ivailo Monev
df6025d743 kdecore: add code for printing the time it takes to update the zones cache
takes ~15ms when plasma-desktop is started for the first time here,
followup updates take 3-4ms

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-04 01:06:13 +03:00
Ivailo Monev
fb21ef07e8 kdecore: use sscanf() for parsing zone.tab
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-03 20:16:55 +03:00
Ivailo Monev
35f5796e18 kdecore: scoop timezones
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-03 04:44:16 +03:00
Ivailo Monev
c9dfc0f13a kdecore: avoid temporaries while parsing zone.tab
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-03 03:43:37 +03:00
Ivailo Monev
47dd5145e3 kdecore: minor zone.tab parsing optimizations
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-02 16:51:05 +03:00
Ivailo Monev
63decfbc2c kdecore: remove redundant qobject header inclusion in ksystemtimezone header
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-02 11:53:45 +03:00
Ivailo Monev
c8da57185f kdecore: optimize zoneinfoDir() function by using KDE::stat()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-01 22:24:44 +03:00
Ivailo Monev
af34fced45 kdecore: mark QByteArray object as const in KSystemTimeZones::local()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-01 19:54:39 +03:00
Ivailo Monev
bf9e83491f kdecore: a bit more strict zone.tab line validation
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-01 19:53:43 +03:00
Ivailo Monev
86083f700b kdecore: check if the watcher pointer is null before posting delete event for it
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-01 19:52:59 +03:00
Ivailo Monev
c00faabcb7 kdecore: use QFileSystemWatcher instead of KDirWatch in KSystemTimeZones
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-01 18:48:13 +03:00
Ivailo Monev
21089d5032 kdecore: minor KSystemTimeZones::local() optimization
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-01 16:34:55 +03:00
Ivailo Monev
6f0b3eda3b kdecore: merge KTzfileTimeZone and other tzdata related classes into the base classes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-01 16:08:05 +03:00
Ivailo Monev
049d05d3c2 kdecore: simplify zone.tab line splitting
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-01 13:17:20 +03:00
Ivailo Monev
33a4458cc3 kdecore: cache the timezone that is not from TZ environment variable
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-01 13:07:16 +03:00
Ivailo Monev
d30fc8d22a kdecore: KSystemTimeZones rewrite to not require daemon
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-10-01 12:20:38 +03:00
Ivailo Monev
bb883b346d generic: remove unused CMake module file inclusions
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-09-27 11:09:26 +03:00
Ivailo Monev
9ea95e5e2e kdecore: reuse ENABLE_TESTING config definition
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-09-24 18:21:20 +03:00
Ivailo Monev
29a8459798 generic: remove checks for system headers that should be present
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-09-23 15:42:09 +03:00
Ivailo Monev
2468138e99 kdecore: do not assume kdeinit or klauncher start the kded service
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-05-23 11:05:00 +03:00