aboutsummaryrefslogtreecommitdiff
path: root/autotests
AgeCommit message (Collapse)Author
2022-05-21remove unused includesXaver Hugl
2022-05-04KConfigGroup: fix writePathEntry/readPathEntry roundtrip for symlinksDavid Faure
If $HOME isn't canonical (e.g. on FreeBSD it's /home/user while the canonical path is /usr/home/user), replacing the canonical version of $HOME with $HOME means that we'll read back a different value than we wrote in. It might seem "equivalent" but it leads to surprises like KRecentDocuments showing duplicates because /usr/home/user became /home/user in the KConfig roundtrip (but not in the XBEL roundtrip). This commit loses the replacement of /usr/home/user with $HOME on FreeBSD, but I think an exact roundtrip is what we expect, rather than stuff being modified under our feet. The alternative would be to canonicalize everything in KRecentDocuments but users don't want to see the /usr in front, I assume (so we would have to use a cache of canonicalized path, for the removal of duplicates, awful performance wise).
2022-05-03autotests: skip KStandardShortcutWatcherTest on WindowsDavid Faure
This is a followup to commit 3c861a6c3860d516
2022-02-25Remove broken Python bindings generationFriedrich W. H. Kossebau
pyqt broke sip4 compatibility in 5.15.6, and there is no more maintainer of the KF Python bindings to fix things. Future support might need different code, so no advantage in keeping the old code around.
2022-02-24Add KWindowStateSaverVolker Krause
This is basically the C++ counter-part to https://invent.kde.org/frameworks/kconfig/-/merge_requests/94 and allows to easily retrofit window size persistence on existing windows/ dialogs, replacing e.g. code like https://invent.kde.org/pim/pimcommon/-/blob/master/src/pimcommon/widgets/kpimprintpreviewdialog.cpp. This is a bit more complicated than one might expect, as KWindowConfig works with QWindows, but that's something freshly created QWidget windows/ dialogs don't have yet. Additionally, we are in a library here that doesn't depend on Qt::Widgets. To overcome this we move the widget-dependent code (basically just a call to QWidget::windowHandle()) to inline template code (and thus into the consumer), use std::function's type erasure to pass it into the library code, and an event filter on the widget to wait for the QWindow to become available.
2022-02-18KConfigCompiler: support ItemAccessors=true with signalling itemsFriedrich W. H. Kossebau
2022-02-04Fix build on WindowsDavid Redondo
Since we are not building the library but the source files we don't want the macro to expand to __declspec(dllimport).
2022-02-01Don't use saveShortcut for setting up testsDavid Redondo
It will trigger side effects like triggering the dbus signal which depending on the timing may be delivered only in the next test case causing an unexpected change signal emission.
2022-01-24Introduce StandardShortcutWatcher to watch for runtime changesDavid Redondo
Currently an application needs to be restarted before it can see any changes made to the standard shortcut configuration. To notify about changes a new class is introduced that looks for those changes using KConfigWatcher and also updates the global map. CCBUG:426656
2022-01-22Make singleton teardown work with Qt6 as wellVolker Krause
In Qt6 the Q_GLOBAL_STATIC will already report to be null while it is in the process of being deleted, we therefore cannot access it anymore from destruction code path as we did before. This problem is hit for example by the Breeze style, making all 6 based widgets applications crash on exit without this.
2022-01-02Exclude deleted groups from groupList()Igor Kushnir
This commit is an alternative to the earlier incorrect and reverted b3dc879e8b108c26c929bfbe551bcdf77f140e94. That commit contained several mistakes and an algorithmic complexity increase: 1) the added conditions were inverted: should have been `hasNonDeletedEntries` (without `!`); 2) KConfigPrivate::groupList() passed group instead of key.mGroup to hasNonDeletedEntries(); 3) The complexity of hasNonDeletedEntries() is O(entryMap.size()). Calls to this function were added into loops that iterated entryMap.size() times. So the overall complexity of groupList() increased from linear to quadratic. This fix collects `mGroup`s of non-deleted key entries instead of `mGroup`s of group entries. The number of key entries can be much greater than the number of group entries, so this fix hurts performance. But at least the algorithmic complexity of groupList() stays linear. Future commits can optimize the loops and make them almost as fast or even faster than before this fix. The `!key.mKey.isNull() && !entryMapIt->bDeleted` checks added in this commit are consistent with the check in KConfigPrivate::hasNonDeletedEntries(). KConfig::hasGroupImpl() forwards its argument to hasNonDeletedEntries() with the following comment: // No need to look for the actual group entry anymore, or for subgroups: // a group exists if it contains any non-deleted entry. BUG: 384039 FIXED-IN: 5.90
2021-12-16WIP: Change the build system to enable building with Qt 6Ahmad Samir
This was built with: -DQT_MAJOR_VERSION=6 \ -DEXCLUDE_DEPRECATED_BEFORE_AND_AT=5.90.0 \ -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055a00 Move the include(KDEInstallDirs) call before the first find_package(Qt*, the former is what auto-detects the Qt version, and defaults to 5. This is needed to be able to build against Qt5 by default. All unit tests still pass.
2021-12-03Fix KDesktopFileTest::testIsAuthorizedDesktopFile running on gitlab CIAlbert Astals Cid
2021-11-23Add the enum group test to the kconfigcompiler_testTomaz Canabrava
Making sure that it runs and not segfaults
2021-11-23Add a proper test for the enumms within groupsTomaz Canabrava
2021-11-23Add missing changesTomaz Canabrava
2021-11-23unbreak kconfig with enums, mutators and properties.Tomaz Canabrava
2021-11-23Demonstrate build failure with kconfig generated codeTomaz Canabrava
2021-10-13Enforce KAuthorized enums being not 0Alexander Lohnau
This will output a warning if an invalid value is requested. The goal is to avoid implicit conversion which might result in a zero-int value.
2021-10-13Create enum to to authorize common keysAlexander Lohnau
By using an enum we have a central place to provide docs for the most common actions/restrictions. Also consumers can pass in type-safe enum values instead of potentially undocumented strings that might contain typos. Also it is better documents is a value is supposed to be authorized using KAuthorized::authorize or KAuthorized::authorizeAction, in the case of "shell_access" this was mixed up from time to time. Considering that we do not want the parameter for the methods to become too long I have deliberately decided against using `enum class`. Also we don't have and usecases for the binary operators in combination with the newly added enums. Task: https://phabricator.kde.org/T11948
2021-10-11Create utility method for moving entries from one group to anotherAlexander Lohnau
This will become especially useful when moving state data from the config file to a dedicated state data file. Task: https://phabricator.kde.org/T12549
2021-09-19Allow KConfigXT to use KSharedConfig::openStateConfigAlexander Lohnau
Otherwise we force consumers to use the config location for state data, which is what we are trying to avoid. Task: https://phabricator.kde.org/T12549
2021-08-28GIT_SILENT: we can use std::as_const directlyLaurent Montel
2021-08-13clang-tidy: one declaration per line; braces around statementsAhmad Samir
clang-tidy checks: readability-isolate-declaration and readability-braces-around-statements KF task: https://phabricator.kde.org/T14729 GIT_SILENT
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-06-21kconfigtest: save/restore XDG_CONFIG_DIRSDavid Faure
No impact on the rest of the test, but I was wondering if it might break anything, better restore it just in case.
2021-05-27Avoid cmake variables and pass sources directly to macroFriedrich 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-16GIT_SILENT: use qt_ macroLaurent Montel
2021-05-04Fix cmake warningLaurent Montel
"Policy CMP0115 is not set: Source file extensions must be explicit. Run "cmake --help-policy CMP0115" for policy details. Use the cmake_policy command to set the policy and suppress this warning. " We need to add file extension
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-04-05kconfig_compiler: add override to generated destructorsDavid Faure
This fixes the clang warning globalsettings_kmail.h:58:5: warning: '~GlobalSettingsBase' overrides a destructor but is not marked 'override' [-Wsuggest-destructor-override]
2021-04-04autotests: look for cmd, not bash, on WindowsDavid Faure
2021-03-28Relicense file to LGPL-2.0-or-laterAndreas Cord-Landwehr
Relicense approved by relicensecheck except: - lgplv2+: a.volkov@rusbitech.ru a.volkov@rusbitech.ru ( 1 LOC): d328dd6 Which is a non-copyrightible trivial change.
2021-03-06kconfig_compiler: change how paramString() creates stringsAhmad Samir
Now it creates C++ code that uses QString::arg(Args...) instead of arg().arg(). AFAICS, the type of the "Args" is QString, so this should work.
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-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-06Fix build on windows on the CI, againAhmad Samir
It's a QByteArray not a QString. GIT_SILENT
2021-02-06Fix windows build on the CIAhmad Samir
I didn't consider the '#ifdef Q_OS_WIN' code paths (since that compiles just fine locally). 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-06Compile without implicit cast from ASCIIAhmad Samir
NO_CHANGELOG
2021-02-06kconfigtest: less implicit cast from ASCIIAhmad Samir
NO_CHANGELOG
2021-02-06Less implicit cast from ASCIIAhmad Samir
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-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-17Adapt to Qt6 text codec changesNicolas Fella
In Qt6 QTextCodec/QTextStream::setCodec is replaced with QTextStream::setEncoding(QStringConverter::Encoding) Also UTF-8 is the new default for QTextStream.