Commit graph

258 commits

Author SHA1 Message Date
Ivailo Monev
969f3e428e kdecore: optimize KMimeType::findByContent()
read once, match until match is found or otherwise. that means less disk
I/O

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-05-18 05:02:20 +03:00
Ivailo Monev
922d02660b kdecore: cache KMimeType pointers
that means less parsing of the xml files overall, trading memory usage for
processing

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-05-17 08:33:57 +03:00
Ivailo Monev
f444caa565 kdecore: adjust KMimeType test case
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-05-12 04:11:04 +03:00
Ivailo Monev
b8d4dc0dc4 generic: call static KStandardDirs methods as such
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-05-05 02:04:03 +03:00
Ivailo Monev
bac4abfd7a kdecore: MIME glob matching optimization
passes tests

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-05-05 00:41:13 +03:00
Ivailo Monev
1ff6f4d2ee kdecore: MIME glob matching optimization
by doing it with a single iteration over the globs a lot less processing
has to be done

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-05-05 00:11:11 +03:00
Ivailo Monev
817b7a4aab kdecore: rework KMimeType
more accurate probing then before, notably by probing the file content
from the file slave (only the name was checked before because the
filepath was not a full path in some cases and the file could not be
open)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-05-04 20:14:53 +03:00
Ivailo Monev
bd9f76451d generic: remove redundant metatype registrations
builtin

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-05-03 02:17:57 +03:00
Ivailo Monev
a5d82b62dd kdecore: stabilize KConfig tests
not relying on the order groups appear in the list

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-04-30 04:29:47 +03:00
Ivailo Monev
713c9394d7 kdecore: drop message box feature of KDebug
tho it can be fixed (by not using queued up message boxes) I am not into
supporting such feature

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-04-20 19:40:13 +03:00
Ivailo Monev
b9c83af23a kdecore: drop support for the deprecated globs file
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-04-17 05:03:19 +03:00
Ivailo Monev
3bbaffe82c kdecore: adjust tests to recent changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-04-17 04:53:13 +03:00
Ivailo Monev
318fa971d3 kdecore: adjust tests to recent changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-03-27 06:20:57 +02:00
Ivailo Monev
84e95ac58c kdecore: remove unused test plugin
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-03-22 10:58:41 +02:00
Ivailo Monev
0c5d00727e generic: remove redundant Q_OS_UNIX definition checks
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-03-15 09:28:30 +02:00
Ivailo Monev
2bee5fa7e2 kdecore: remove redundant KMimeGlobsFileParser::parseGlobFiles() method
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-03-14 22:36:48 +02:00
Ivailo Monev
fbfb374b9c generic: drop scripting and tray support
after changes to multiple sub-projects (Katie, kdelibs, kde-workspace
and kde-extraapps) that finally happened, can write lots about it but I
will keep it short - by rewriting parts that were using js/qml (e.g. the
plasma applets) the desktop startup was reduced to half, also the legacy
tray thing shall be no more (anything that needs tray icon shall be a
plasma applet now) thus some applications and features will be dropped
aswell. see all repositories for the changes done

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-10-21 08:06:58 +03:00
Ivailo Monev
95a8be4470 kdecore: rewrite KLockFile
the PID check was racy, bonus points for not writing data at all to the
lock and not reading it meaning less disk I/O

oh, yes - by using O_CLOEXEC the lock is stale-safe

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-09-09 00:46:42 +03:00
Ivailo Monev
a09cf5455a kdecore: remove references to khotkeys
note the check if khotkeys is automatically started - it was a KDED module
not started because of XDG autostart desktop file

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-30 00:08:53 +03:00
Ivailo Monev
f56c50e41a kdecore: drop redundant "emphasis" markup tag
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-19 23:28:54 +03:00
Ivailo Monev
a50c72de91 generic: drop support for startup notification via D-Bus service
just another way to do what ASN does, the KService::DBusWait mode was
not used too. with this change however all of the process setup code is
moved to a seperate class and the responsibility of KLauncher about ASN
is reduced (ASN now works better for process that fork but if application
claims ASN support and does not send ASN finish then the timeout will be
reached)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-19 19:53:14 +03:00
Ivailo Monev
1c6ce50933 kdecore: drop support for overriding numbers localization via numid tag
fun fact: there is CLDR data for ~1000 languages and only ~50 use different
number system (not "latn")

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-17 22:08:20 +03:00
Ivailo Monev
528f427c67 kdecore: adjust expected results in KLocalizedString tests
text with "&lt;" in it is considered as rich text by Qt::mightBeRichText()
as special case. also entities are not markup and shall not be handled by
KuitSemantics (there is a class for that - KCharsets). entity is used
only in one place (kde-workspace/kate/part/view/kateviewhelpers.cpp) and it
does not even need special handling by KuitSemantics. so, instead of
slowing the whole markup parsing with redundant and unused feature I've
decided to not support it and even improve Katie's Qt::mightBeRichText()
function

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-17 18:16:26 +03:00
Ivailo Monev
3b4c47d967 kdecore: remove bogus test code
checking for directory existing via QFile::exists() is bogus, also Katana
does not install files in such directory

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-11 18:40:38 +03:00
Ivailo Monev
fa51ecdfaf kdecore: remove unused KAboutData methods and redundant constructor arguments
the homepage and the bugs email address shall always be defined in
kglobalsettings header for official Katana applications, libraries, etc.
the option to override them is still a thing

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-10 17:41:54 +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
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
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
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
aa9e5b7066 kdecore: fix and adjust tests
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-27 03:32:39 +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
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
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
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
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
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
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
Ivailo Monev
ee0d50c901 generic: purge most manual tests
long overdue, have no use for them

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-03 07:03:28 +03:00
Ivailo Monev
5290bf44e0 kdecore: deal with KMimeType TODO
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-06-29 19:51:10 +03:00