aboutsummaryrefslogtreecommitdiff
path: root/src/core
AgeCommit message (Collapse)Author
2021-08-03KConfig: sort keys in keyListImpl() so unittests can rely on itDavid Faure
The code was using a QSet (hash-based), use a std::set instead for unicity, it gives us sorting for free. We probably want to do the same in groupList(), but that's separate.
2021-08-03KConfig: fix deletion of an entry that is also in kdeglobalsDavid Faure
This is the case where we expected to see Key[$d] in the config file, and it was somehow broken. When saving, the key was omitted, so when reloading the kdeglobals key was present again. Detected when trying to write a unittest for a different patch... I had to reshuffle the unittest a bit because testThreads calls testSimple which didn't expect that the "[AAA]" group would actually be deleted now.
2021-07-13Fix typos found by codespellChristophe Giboudeaux
GIT_SILENT
2021-07-05Do not create a vector and a QByteArray just to discard it immediatelyAleix Pol
2021-07-05Only query for existing config file when it's necessaryAleix Pol
We are only interested in whether the file doesn't exist when it fails to open. This saves a stat on every successful config file parse.
2021-07-05Use specific API to compare QByteArraysAleix Pol
At the moment we are taking a bit of a detour by converting to char*. Not a bit deal but reads better and ends up being less calls.
2021-07-04Cache global config filesAleix Pol
Whenever we read a config file, we are first parsing kdeglobalsrc. This caches the parsed entries so that they can be reused as long as it hasn't changed. This reduces the parseConfig calls (which is mostly prominent at early process startup) from 18 to 12 (33%) ksmserver-logout-greeter. This also means there's better cache locality as well as less memory allocated as a lot of objects are shared but I have not measured this.
2021-05-27Use more target-centric cmake codeFriedrich W. H. Kossebau
NO_CHANGELOG
2021-05-25Revert "fix deleted group is in listGroups"Nate Graham
This reverts commit b3dc879e8b108c26c929bfbe551bcdf77f140e94. This change breaks plasmashell startup and possible other apps as well. Reverting so the root cause can be investigated without time pressure.
2021-05-25fix deleted group is in listGroupsLieven Hey
calling deleteGroup only deletes all entries but the group does still exists in listGroups this is somewhat irritating since calling exists on that group will return false with this patch the group does no longer exists in listGroup
2021-05-11Docs: make a complete reference to reparseConfiguration() from KSharedConfigAdriaan de Groot
NO_CHANGELOG
2021-05-09Revert QStringView portAhmad Samir
QStringView has some bits of API that were only added in 5.15.2, whereas KF requires 5.15.0. This reverts commit 1780fb2a237af80ddc1f9cfb70cb892b53b91990.
2021-05-07Order macro for attribute for symbol export before that for deprecatedFriedrich W. H. Kossebau
The symbol export/visibility attribute is not standardized so far and needs to be set by language extension attribute declaration at least with clang & MSVC, who both support that when it appears before the standard attribute declaration. NO_CHANGELOG
2021-05-02Port away from ECMSetupVersion's deprecated *_VERSION_STRING CMake variableFriedrich W. H. Kossebau
NO_CHANGELOG
2021-05-02Minor code refactoringAhmad Samir
Some methods in ConfigLoaderHandler always returned true, change them to return void instead. Also port them to take a QStringView instead of QStringRef, this doesn't require a lot of changes because a QStringView can be constructed from a QStringRef. QXmlStreamAttribute methods like value() and name() return QStringRef in Qt5 and QStringView in Qt6, "fix" the issue by using auto keyword, which works in both cases. QStringView::toInt() isn't efficient in Qt5 so make the build conditional. NO_CHANGELOG
2021-04-28Make the docs state that KConfig::reparseConfiguration() calls sync() if neededAhmad Samir
This matches the method actually does, and makes it clearer that you don't need to do config->sync() followed by config()->reparseConfiguration(), the latter should suffice.
2021-04-26Use new version-controlled enumerator deprecation warning macrosFriedrich W. H. Kossebau
2021-04-18Deprecate KDesktopFile::readDevice()Ahmad Samir
Since the FSDevice .desktop template hasn't been installed for a long time, this method in KDesktopFile hasn't been useful. The whole FSDesktop concept seems to be redundant nowadays, since CDRom and Floppy drives have been replaced by USB sticks. See this KF6 taks for more details: https://phabricator.kde.org/T14295#253759
2021-04-15KConfig: rename kconfigdata.h to kconfigdata_p.hDavid Faure
It's internal, the symbols are not exported, the header is not installed. The _p.h naming makes this more obvious, when grepping for stuff in public API.
2021-03-06Minor code optimisationAhmad Samir
- Use more range-for loops where appropriate - Use auto instead of the usually-long iterator type names - Use cbegin/cend(), to match the std:: containers, less confusion - Use qDeleteAll instead of a for loop - Make a QRE with a long-ish pattern static NO_CHANGELOG
2021-03-06Optimise string operations a bitAhmad Samir
- Use QString::arg(Args...) instead of .arg().arg() - Use QLatin1String for string comparisons, should be faster - Use QLatin1String::arg() for better readability - Add the comment dfaure suggested in the MR, to explain why it's '2%' then '%1' in a QString().arg().arg() NO_CHANGELOG
2021-02-28Make QByteArray -> char* conversion explicitNicolas Fella
The implicit conversion fails in Qt6
2021-02-24Use KEntryMapIterator/KEntryMapConstIterator typedef's everywhereAhmad Samir
NO_CHANGELOG
2021-02-24Add KEntryMap::constFindEntry() methodAhmad Samir
- This has the same logic as QMap::constFind(); less detaching and now we can use auto keyword when creating iterators and always get a const_iterator even when calling constFindEntry() on a non-const map. - Use QCOMPARE() where appropriate in the unit tests.
2021-02-22Fix formatting in a couple of places after running clang-formatAhmad Samir
NO_CHANGELOG
2021-02-22Run clang-format on all cpp/h filesAhmad Samir
NO_CHANGELOG
2021-02-22Add a trailing comma to last member in enumAhmad Samir
GIT_SILENT
2021-02-06Minor code optimisationsAhmad Samir
- Use a global var for a QString that's used many times - Break up long-all-cap variable names, it makes it harder to read (and I've fixed one typo in one of those ALLCAPS) - Fix some clazy warnings, make global QString objects in unit tests static (so that the compiler doesn't create symbols for them, it doesn't matter in a unit test but KF code acts as a reference sometimes that others copy from, tip from dfaure) - Add TODO note about changing kconfig_compiler to generate C++ code that uses multi-arg QString::arg(QString, QString, QString) instead of QString::arg().arg() - More const; more QString::at() instead of operator[] where appropriate - Use a ternary where it makes the code more readable (and uses less lines :)) NO_CHANGELOG
2021-02-06Preincerment/predecrement operator where the post ones aren't neededAhmad Samir
NO_CHANGELOG
2021-02-06General code cleanupAhmad Samir
Fix some clazy warnings, and some other minor code optimisations. NO_CHANGELOG
2021-02-04SVN_SILENT made messages (.desktop file) - always resolve oursl10n daemon script
In case of conflict in i18n, keep the version of the branch "ours" To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-01-29Replace KF5_VERSION with KF_VERSIONNicolas Fella
Frameworks will be Frameworks 6 at some point and there is no good reason to have the major version in the variable name. Given this is purely internal we can to this now, making it a bit more future-proof GIT_SILENT NO_CHANGELOG
2021-01-27Remove dead cmake codeNicolas Fella
KDEWIN_LIBRARIES is never defined
2021-01-26KConfig: preserve the milliseconds component of QDateTimeDavid Faure
I stored a file's lastModified() into KConfig, to compare with it again on next start, and the loss of milliseconds made the code think the timestamps didn't match, even when they did.
2021-01-18Use Q_EMIT instead of emitAhmad Samir
In C++20 there are new classes that have member functions named emit(). c.f.: https://lists.qt-project.org/pipermail/development/2020-February/038812.html https://en.cppreference.com/w/cpp/io/basic_osyncstream/emit GIT_SILENT
2021-01-12Port to QRecursiveMutexNicolas Fella
Using QMutex in recursive mode is deprecated.
2020-12-18Remove ifdefs, we require Qt 5.14 nowAlbert Astals Cid
2020-12-12Properly include QStringListNicolas Fella
Forward declaring it breaks with Qt6
2020-12-03Fix commentAhmad Samir
GIT_SILENT
2020-11-07Add KF6 TODO to use the just-approved (*) XDG_STATE_HOME env var.David Faure
See https://gitlab.freedesktop.org/xdg/xdg-specs/-/merge_requests/4 (*) by me :-)
2020-11-07Fix KConfigGroup::copyTo with KConfigBase::NotifyFabian Vogt
Without this, bNotify was not set on copies, making Notify a noop. CCBUG: 428771
2020-10-23If include is define in .h remove it if it's defined in .cpp too (scripted)Laurent Montel
2020-09-21SVN_SILENT made messages (.desktop file) - always resolve oursl10n daemon script
In case of conflict in i18n, keep the version of the branch "ours" To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-09-14Use reverse order in KDesktopFile::locateLocal to iterate over generic ↵Jeremy Whiting
config paths. Since windows has some generic config paths that are parents of other generic config paths e.g. c:/CraftRoot/build/_/<hash>/build/bin followed by c:/CraftRoot/build/_/<hash>/build/bin/data we need to search for locations from the last location to the first.
2020-08-29API dox: consistently use version number without product name for @deprecatedFriedrich W. H. Kossebau
GIT_SILENT
2020-08-28Introduce method to query KConfigSkeletonItem default valueDavid Edmundson
5.64 added an isDefault method however this doesn't suffice for usage in KConfigDialogManager which compares a current value to the default. KConfigDialogManager currently uses a hack with side effects. Exposing the value directly solves that.
2020-08-24Fix qt warning:Laurent Montel
"QtPrivate::DeprecatedRefClassBehavior::warn|?libKF5ConfigCore.so.5?|?libKF5ConfigCore.so.5? Using QCharRef with an index pointing outside the valid range of a QString. The corresponding behavior is deprecated, and will be changed in a future version of Qt." We try to access to an invalid index.
2020-07-25Update sGlobalFileName when QStandardPaths TestMode is toggledAhmad Samir
When running unit tests, usually QStandardPaths TestMode is enabled so as not to mess up the config files in the home dir of the dev running the unit tests; sGlobalFileName, a global static, was defined only once, which meant that if KSharedConfig::openConfig() is called before the unit test has had a chance to call QStandardPaths::setTestModeEnabled(true), then sGlobalFileName will go on referring to the wrong kdeglobals file (as can be seen in dfaure's debugging of the issue at [1]). Change the code so as to detect QStandardPaths TestMode status and change sGlobalFileName as needed. All unit tests still pass. [1] https://invent.kde.org/frameworks/kio/-/merge_requests/77#note_74124
2020-07-25API dox: state explicitly expected encoding for KConfig key & group namesFriedrich W. H. Kossebau
While the API might have been once designed to allow random byte strings to be used as ids and only converted QString to UTF-8, the current implementation in many places assumes the byte strings passed via const char* or QByteArray are also in of UTF-8 encoding (or at least ASCII7-only). See e.g. KConfigGroup::entryMap() or KConfigGroup::name(). Stating the supported encoding explicitly should avoid any misassumptions.
2020-07-14SVN_SILENT made messages (.desktop file) - always resolve oursl10n daemon script
In case of conflict in i18n, keep the version of the branch "ours" To resolve a particular conflict, "git checkout --ours path/to/file.desktop"