diff options
author | Friedrich W. H. Kossebau <kossebau@kde.org> | 2019-10-08 15:22:49 +0200 |
---|---|---|
committer | Friedrich W. H. Kossebau <kossebau@kde.org> | 2019-10-18 21:23:32 +0200 |
commit | fb37084b3e7c396cd10bf4d3253fee730320988a (patch) | |
tree | 3c58974a533b9ec963d315481d38671ba8f10613 | |
parent | 3f68be12f87e83b67f9270eb139d894bf65ebef1 (diff) | |
download | kconfig-fb37084b3e7c396cd10bf4d3253fee730320988a.tar.gz kconfig-fb37084b3e7c396cd10bf4d3253fee730320988a.tar.bz2 |
Use ECMGenerateExportHeader to manage deprecated API better
Summary:
Allows
* projects linking to KConfigCore/Gui to hide deprecated API up to a
given version or silence deprecation warnings after a given version,
using
* -DKCONFIGCORE_DISABLE_DEPRECATED_BEFORE_AND_AT
* -DKCONFIGCORE_NO_DEPRECATED
* -DKCONFIGCORE_DEPRECATED_WARNINGS_SINCE
* -DKCONFIGCORE_NO_DEPRECATED_WARNINGS
* -DKCONFIGGUI_DISABLE_DEPRECATED_BEFORE_AND_AT
* -DKCONFIGGUI_NO_DEPRECATED
* -DKCONFIGGUI_DEPRECATED_WARNINGS_SINCE
* -DKCONFIGGUI_NO_DEPRECATED_WARNINGS
or
* -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT
* -DKF_NO_DEPRECATED
* -DKF_DEPRECATED_WARNINGS_SINCE
* -DKF_NO_DEPRECATED_WARNINGS
* to build KConfigCore/Gui optionally with deprecated API excluded from
the build, using "EXCLUDE_DEPRECATED_BEFORE_AND_AT" cmake argument.
Test Plan:
Builds with EXCLUDE_DEPRECATED_BEFORE_AND_AT set to 0, 4.0.0, 5.0.0,
5.11.0, 5.24.0, 5.39.0, 5.42.0, CURRENT.
Reviewers: #frameworks, mlaurent
Reviewed By: mlaurent
Subscribers: mlaurent, kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D24496
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | autotests/kconfigtest.cpp | 4 | ||||
-rw-r--r-- | autotests/kdesktopfiletest.cpp | 2 | ||||
-rw-r--r-- | autotests/kdesktopfiletest.h | 3 | ||||
-rw-r--r-- | src/core/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/core/kauthorized.cpp | 2 | ||||
-rw-r--r-- | src/core/kauthorized.h | 5 | ||||
-rw-r--r-- | src/core/kconfig.cpp | 4 | ||||
-rw-r--r-- | src/core/kconfig.h | 18 | ||||
-rw-r--r-- | src/core/kconfiggroup.cpp | 4 | ||||
-rw-r--r-- | src/core/kconfiggroup.h | 15 | ||||
-rw-r--r-- | src/core/kcoreconfigskeleton.cpp | 28 | ||||
-rw-r--r-- | src/core/kcoreconfigskeleton.h | 44 | ||||
-rw-r--r-- | src/core/kdesktopfile.cpp | 2 | ||||
-rw-r--r-- | src/core/kdesktopfile.h | 5 | ||||
-rw-r--r-- | src/core/kemailsettings.cpp | 20 | ||||
-rw-r--r-- | src/core/kemailsettings.h | 16 | ||||
-rw-r--r-- | src/gui/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/gui/kconfiggui.cpp | 2 | ||||
-rw-r--r-- | src/gui/kconfiggui.h | 5 | ||||
-rw-r--r-- | src/gui/kconfigloader.cpp | 4 | ||||
-rw-r--r-- | src/gui/kconfigloader.h | 4 | ||||
-rw-r--r-- | src/gui/kstandardshortcut.cpp | 5 | ||||
-rw-r--r-- | src/gui/kstandardshortcut.h | 4 |
24 files changed, 144 insertions, 74 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5abeac6a..6949f32e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) -include(GenerateExportHeader) +include(ECMGenerateExportHeader) include(ECMSetupVersion) include(ECMGenerateHeaders) include(ECMMarkNonGuiExecutable) @@ -41,6 +41,8 @@ include(ECMPoQmTools) include(ECMAddQch) include(ECMQtDeclareLoggingCategory) +set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].") + option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") diff --git a/autotests/kconfigtest.cpp b/autotests/kconfigtest.cpp index b915a07a..546568f8 100644 --- a/autotests/kconfigtest.cpp +++ b/autotests/kconfigtest.cpp @@ -748,7 +748,7 @@ void KConfigTest::testChangeGroup() KConfigGroup sc3(&sc, "Hello"); QCOMPARE(sc3.name(), QString("Hello")); KConfigGroup newGroup(sc3); -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) newGroup.changeGroup("FooBar"); // deprecated! QCOMPARE(newGroup.name(), QString("FooBar")); QCOMPARE(sc3.name(), QString("Hello")); // unchanged @@ -764,7 +764,7 @@ void KConfigTest::testChangeGroup() KConfigGroup sc32(rootGroup.group("Hello")); QCOMPARE(sc32.name(), QString("Hello")); KConfigGroup newGroup2(sc32); -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) newGroup2.changeGroup("FooBar"); // deprecated! QCOMPARE(newGroup2.name(), QString("FooBar")); QCOMPARE(sc32.name(), QString("Hello")); // unchanged diff --git a/autotests/kdesktopfiletest.cpp b/autotests/kdesktopfiletest.cpp index 4f8c5deb..ed13be8e 100644 --- a/autotests/kdesktopfiletest.cpp +++ b/autotests/kdesktopfiletest.cpp @@ -62,7 +62,7 @@ void KDesktopFileTest::testRead() QCOMPARE(df.fileName(), QFileInfo(fileName).canonicalFilePath()); } -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) void KDesktopFileTest::testReadDirectory() { QTemporaryFile file("testReadDirectoryXXXXXX.directory"); diff --git a/autotests/kdesktopfiletest.h b/autotests/kdesktopfiletest.h index 12385f4e..621c7934 100644 --- a/autotests/kdesktopfiletest.h +++ b/autotests/kdesktopfiletest.h @@ -20,6 +20,7 @@ #define KDESKTOPFILETEST_H #include <QObject> +#include <kconfigcore_export.h> class KDesktopFileTest : public QObject { @@ -27,7 +28,9 @@ class KDesktopFileTest : public QObject private Q_SLOTS: void initTestCase(); void testRead(); +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) void testReadDirectory(); +#endif void testReadLocalized_data(); void testReadLocalized(); void testUnsuccessfulTryExec(); diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 45f21471..da48ce8f 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -21,8 +21,15 @@ ecm_qt_declare_logging_category(libkconfigcore_SRCS configure_file(config-kconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kconfig.h ) add_library(KF5ConfigCore ${libkconfigcore_SRCS}) -generate_export_header(KF5ConfigCore BASE_NAME KConfigCore) add_library(KF5::ConfigCore ALIAS KF5ConfigCore) +ecm_generate_export_header(KF5ConfigCore + BASE_NAME KConfigCore + # GROUP_BASE_NAME KF <- enable once all of KF modules use ecm_generate_export_header + VERSION ${KF5_VERSION} + DEPRECATED_BASE_VERSION 0 + DEPRECATION_VERSIONS 4.0 5.0 5.24 5.42 + EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} +) target_compile_definitions(KF5ConfigCore PRIVATE diff --git a/src/core/kauthorized.cpp b/src/core/kauthorized.cpp index aefd3faf..bf2142f6 100644 --- a/src/core/kauthorized.cpp +++ b/src/core/kauthorized.cpp @@ -229,7 +229,7 @@ bool KAuthorized::authorizeAction(const QString &action) return authorize(QLatin1String("action/") + action); } -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 24) bool KAuthorized::authorizeKAction(const QString &action) { return authorizeAction(action); diff --git a/src/core/kauthorized.h b/src/core/kauthorized.h index 5ace4db9..5f67b6ec 100644 --- a/src/core/kauthorized.h +++ b/src/core/kauthorized.h @@ -96,6 +96,7 @@ KCONFIGCORE_EXPORT bool authorize(const QString &action); */ KCONFIGCORE_EXPORT bool authorizeAction(const QString &action); +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 24) /** * Returns whether the user is permitted to perform a certain action. * @@ -121,8 +122,8 @@ KCONFIGCORE_EXPORT bool authorizeAction(const QString &action); * @see authorize() * @deprecated since 5.24, use authorizeAction() instead. */ -#ifndef KDE_NO_DEPRECATED -KCONFIGCORE_DEPRECATED_EXPORT bool authorizeKAction(const QString &action); +KCONFIGCORE_DEPRECATED_VERSION(5, 24, "Use KAuthorized::authorizeAction(const QString&)") +KCONFIGCORE_EXPORT bool authorizeKAction(const QString &action); #endif /** diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp index 1b3f082b..6d6a1ac6 100644 --- a/src/core/kconfig.cpp +++ b/src/core/kconfig.cpp @@ -847,7 +847,7 @@ bool KConfig::isGroupImmutableImpl(const QByteArray &aGroup) const return isImmutable() || d->entryMap.getEntryOption(aGroup, nullptr, nullptr, KEntryMap::EntryImmutable); } -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(4, 0) void KConfig::setForceGlobal(bool b) { Q_D(KConfig); @@ -855,7 +855,7 @@ void KConfig::setForceGlobal(bool b) } #endif -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(4, 0) bool KConfig::forceGlobal() const { Q_D(const KConfig); diff --git a/src/core/kconfig.h b/src/core/kconfig.h index b771b881..db4fb905 100644 --- a/src/core/kconfig.h +++ b/src/core/kconfig.h @@ -324,29 +324,29 @@ public: /// @} /// @{ global +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(4, 0) /** - * @deprecated - * * Forces all following write-operations to be performed on @c kdeglobals, * independent of the @c Global flag in writeEntry(). * * @param force true to force writing to kdeglobals * @see forceGlobal + * @deprecated Since 4.0 */ -#ifndef KDE_NO_DEPRECATED - KCONFIGCORE_DEPRECATED void setForceGlobal(bool force); + KCONFIGCORE_DEPRECATED_VERSION(4, 0, "Not recommended") + void setForceGlobal(bool force); #endif + +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(4, 0) /** - * @deprecated - * * Returns whether all entries are being written to @c kdeglobals. * * @return @c true if all entries are being written to @c kdeglobals * @see setForceGlobal - * @deprecated + * @deprecated Since 4.0 */ -#ifndef KDE_NO_DEPRECATED - KCONFIGCORE_DEPRECATED bool forceGlobal() const; + KCONFIGCORE_DEPRECATED_VERSION(4, 0, "Not recommended") + bool forceGlobal() const; #endif /// @} diff --git a/src/core/kconfiggroup.cpp b/src/core/kconfiggroup.cpp index 32dcb458..c9c93d00 100644 --- a/src/core/kconfiggroup.cpp +++ b/src/core/kconfiggroup.cpp @@ -574,7 +574,7 @@ void KConfigGroup::deleteGroup(WriteConfigFlags flags) config()->deleteGroup(d->fullName(), flags); } -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) void KConfigGroup::changeGroup(const QString &group) { Q_ASSERT_X(isValid(), "KConfigGroup::changeGroup", "accessing an invalid group"); @@ -583,7 +583,7 @@ void KConfigGroup::changeGroup(const QString &group) } #endif -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) void KConfigGroup::changeGroup(const char *group) { Q_ASSERT_X(isValid(), "KConfigGroup::changeGroup", "accessing an invalid group"); diff --git a/src/core/kconfiggroup.h b/src/core/kconfiggroup.h index 0f04b1f7..54946b86 100644 --- a/src/core/kconfiggroup.h +++ b/src/core/kconfiggroup.h @@ -141,23 +141,26 @@ public: */ const KConfig *config() const; +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) /** * Changes the group of the object * - * @deprecated + * @deprecated Since 5.0 * Create another KConfigGroup from the parent of this group instead. */ -#ifndef KDE_NO_DEPRECATED - KCONFIGCORE_DEPRECATED void changeGroup(const QString &group); + KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Create another KConfigGroup from the parent of this group") + void changeGroup(const QString &group); #endif + +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) /** * Overload for changeGroup(const QString&) * - * @deprecated + * @deprecated Since 5.0. * Create another KConfigGroup from the parent of this group instead. */ -#ifndef KDE_NO_DEPRECATED - KCONFIGCORE_DEPRECATED void changeGroup(const char *group); + KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Create another KConfigGroup from the parent of this group") + void changeGroup(const char *group); #endif /** diff --git a/src/core/kcoreconfigskeleton.cpp b/src/core/kcoreconfigskeleton.cpp index 34c58ff6..b9c9f2ac 100644 --- a/src/core/kcoreconfigskeleton.cpp +++ b/src/core/kcoreconfigskeleton.cpp @@ -1162,38 +1162,34 @@ void KCoreConfigSkeleton::usrSetDefaults() { } -#ifdef Q_CC_GNU -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif void KCoreConfigSkeleton::usrRead() { +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) usrReadConfig(); -} -#ifdef Q_CC_GNU -#pragma GCC diagnostic pop #endif +} +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) void KCoreConfigSkeleton::usrReadConfig() { } - -#ifdef Q_CC_GNU -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif + bool KCoreConfigSkeleton::usrSave() { +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) return usrWriteConfig(); -} -#ifdef Q_CC_GNU -#pragma GCC diagnostic pop +#else + return true; #endif +} +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) bool KCoreConfigSkeleton::usrWriteConfig() { return true; } +#endif void KCoreConfigSkeleton::addItem(KConfigSkeletonItem *item, const QString &name) { @@ -1315,7 +1311,7 @@ KCoreConfigSkeleton::ItemLongLong *KCoreConfigSkeleton::addItemLongLong(const QS return item; } -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) KCoreConfigSkeleton::ItemLongLong *KCoreConfigSkeleton::addItemInt64( const QString &name, qint64 &reference, @@ -1336,7 +1332,7 @@ KCoreConfigSkeleton::ItemULongLong *KCoreConfigSkeleton::addItemULongLong(const return item; } -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) KCoreConfigSkeleton::ItemULongLong *KCoreConfigSkeleton::addItemUInt64( const QString &name, quint64 &reference, diff --git a/src/core/kcoreconfigskeleton.h b/src/core/kcoreconfigskeleton.h index 16ff0417..76b78a20 100644 --- a/src/core/kcoreconfigskeleton.h +++ b/src/core/kcoreconfigskeleton.h @@ -684,8 +684,8 @@ public: qint64 mMin; qint64 mMax; }; -#ifndef KDE_NO_DEPRECATED - typedef KCONFIGCORE_DEPRECATED ItemLongLong ItemInt64; +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) + typedef KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use ItemLongLong") ItemLongLong ItemInt64; #endif /** @@ -804,8 +804,8 @@ public: quint64 mMin; quint64 mMax; }; -#ifndef KDE_NO_DEPRECATED - typedef KCONFIGCORE_DEPRECATED ItemULongLong ItemUInt64; +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) + typedef KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use ItemULongLong") ItemULongLong ItemUInt64; #endif /** @@ -1076,12 +1076,13 @@ public: */ void load(); -#ifndef KCONFIGCORE_NO_DEPRECATED +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) /** * @deprecated since 5.0, call load() instead (to reload from disk) or just read() * if the underlying KConfig object is already up-to-date. */ - KCONFIGCORE_DEPRECATED void readConfig() + KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use KCoreConfigSkeleton::load() or KCoreConfigSkeleton::read()") + void readConfig() { load(); } @@ -1261,12 +1262,12 @@ public: qint64 defaultValue = 0, const QString &key = QString()); +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) /** - * @deprecated - * Use addItemLongLong(). + * @deprecated Since 5.0, use addItemLongLong(). */ -#ifndef KDE_NO_DEPRECATED - KCONFIGCORE_DEPRECATED ItemLongLong *addItemInt64(const QString &name, qint64 &reference, + KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use KCoreConfigSkeleton::addItemLongLong(...)") + ItemLongLong *addItemInt64(const QString &name, qint64 &reference, qint64 defaultValue = 0, const QString &key = QString()); #endif @@ -1286,12 +1287,12 @@ public: quint64 defaultValue = 0, const QString &key = QString()); +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) /** - * @deprecated - * Use addItemULongLong(). + * @deprecated Since 5.0, use addItemULongLong(). */ -#ifndef KDE_NO_DEPRECATED - KCONFIGCORE_DEPRECATED ItemULongLong *addItemUInt64(const QString &name, quint64 &reference, + KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use KCoreConfigSkeleton::addItemULongLong(...)") + ItemULongLong *addItemUInt64(const QString &name, quint64 &reference, quint64 defaultValue = 0, const QString &key = QString()); #endif @@ -1475,11 +1476,12 @@ public Q_SLOTS: */ bool save(); -#ifndef KCONFIGCORE_NO_DEPRECATED +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) /** * @deprecated since 5.0, call save() instead. */ - KCONFIGCORE_DEPRECATED void writeConfig() + KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Use KCoreConfigSkeleton::save()") + void writeConfig() { save(); } @@ -1523,17 +1525,23 @@ protected: */ virtual bool usrSave(); +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) /** * @deprecated since 5.0, override usrRead instead. This method is still called from usrRead * for compatibility. */ - KCONFIGCORE_DEPRECATED virtual void usrReadConfig(); + KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Override KCoreConfigSkeleton::usrRead()") + virtual void usrReadConfig(); +#endif +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) /** * @deprecated since 5.0, override usrSave instead. This method is still called from usrSave * for compatibility. */ - KCONFIGCORE_DEPRECATED virtual bool usrWriteConfig(); + KCONFIGCORE_DEPRECATED_VERSION(5, 0, "Override KCoreConfigSkeleton::usrSave()") + virtual bool usrWriteConfig(); +#endif private: KCoreConfigSkeletonPrivate *const d; diff --git a/src/core/kdesktopfile.cpp b/src/core/kdesktopfile.cpp index d34400eb..18ef8523 100644 --- a/src/core/kdesktopfile.cpp +++ b/src/core/kdesktopfile.cpp @@ -331,7 +331,7 @@ bool KDesktopFile::tryExec() const //QString //KDesktopFile::resource() const { return backEnd->resource(); } -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 42) QStringList KDesktopFile::sortOrder() const { diff --git a/src/core/kdesktopfile.h b/src/core/kdesktopfile.h index ca21bc85..28343366 100644 --- a/src/core/kdesktopfile.h +++ b/src/core/kdesktopfile.h @@ -214,7 +214,7 @@ public: */ QString readDocPath() const; -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 42) /** * Returns the entry of the "SortOrder=" entry. * @return the value of the "SortOrder=" entry. @@ -222,7 +222,8 @@ public: * SortOrder was used to specify the order of menu items, but * the Desktop Menu Specification defines another mechanism for it. */ - KCONFIGCORE_DEPRECATED QStringList sortOrder() const; + KCONFIGCORE_DEPRECATED_VERSION(5, 42, "Not recommended, Desktop Menu Specification defines another mechanism") + QStringList sortOrder() const; #endif /** diff --git a/src/core/kemailsettings.cpp b/src/core/kemailsettings.cpp index 0d4028df..c6aa5d20 100644 --- a/src/core/kemailsettings.cpp +++ b/src/core/kemailsettings.cpp @@ -78,6 +78,7 @@ QString KEMailSettings::getSetting(KEMailSettings::Setting s) const case OutServerPass: { return cg.readEntry("OutgoingPassword"); } +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) case OutServerType: { return cg.readEntry("OutgoingServerType"); } @@ -87,6 +88,12 @@ QString KEMailSettings::getSetting(KEMailSettings::Setting s) const case OutServerTLS: { return cg.readEntry("OutgoingServerTLS", QVariant(false)).toString(); } +#else + case OutServerType_DEPRECATED_DO_NOT_USE: + case OutServerCommand_DEPRECATED_DO_NOT_USE: + case OutServerTLS_DEPRECATED_DO_NOT_USE: + break; +#endif case InServer: { return cg.readEntry("IncomingServer"); } @@ -96,6 +103,7 @@ QString KEMailSettings::getSetting(KEMailSettings::Setting s) const case InServerPass: { return cg.readEntry("IncomingPassword"); } +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) case InServerType: { return cg.readEntry("IncomingServerType"); } @@ -105,6 +113,7 @@ QString KEMailSettings::getSetting(KEMailSettings::Setting s) const case InServerTLS: { return cg.readEntry("IncomingServerTLS", QVariant(false)).toString(); } +#endif }; return QString(); } @@ -148,6 +157,7 @@ void KEMailSettings::setSetting(KEMailSettings::Setting s, const QString &v) cg.writeEntry("OutgoingPassword", v); break; } +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) case OutServerType: { cg.writeEntry("OutgoingServerType", v); break; @@ -160,6 +170,12 @@ void KEMailSettings::setSetting(KEMailSettings::Setting s, const QString &v) cg.writeEntry("OutgoingServerTLS", (v == QLatin1String("true"))); break; } +#else + case OutServerType_DEPRECATED_DO_NOT_USE: + case OutServerCommand_DEPRECATED_DO_NOT_USE: + case OutServerTLS_DEPRECATED_DO_NOT_USE: + break; +#endif case InServer: { cg.writeEntry("IncomingServer", v); break; @@ -172,6 +188,7 @@ void KEMailSettings::setSetting(KEMailSettings::Setting s, const QString &v) cg.writeEntry("IncomingPassword", v); break; } +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) case InServerType: { cg.writeEntry("IncomingServerType", v); break; @@ -184,6 +201,7 @@ void KEMailSettings::setSetting(KEMailSettings::Setting s, const QString &v) cg.writeEntry("IncomingServerTLS", (v == QLatin1String("true"))); break; } +#endif }; cg.sync(); } @@ -207,7 +225,7 @@ void KEMailSettings::setProfile(const QString &s) } } -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) QString KEMailSettings::currentProfileName() const { return p->m_sCurrentProfile; diff --git a/src/core/kemailsettings.h b/src/core/kemailsettings.h index 7d4fb8cf..801e63b7 100644 --- a/src/core/kemailsettings.h +++ b/src/core/kemailsettings.h @@ -69,7 +69,7 @@ public: OutServer, OutServerLogin, OutServerPass, -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) /** * @deprecated since Frameworks 5.0 */ @@ -82,11 +82,15 @@ public: * @deprecated since Frameworks 5.0 */ OutServerTLS, +#else + OutServerType_DEPRECATED_DO_NOT_USE, + OutServerCommand_DEPRECATED_DO_NOT_USE, + OutServerTLS_DEPRECATED_DO_NOT_USE, #endif InServer, InServerLogin, InServerPass, -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) /** * @deprecated since Frameworks 5.0 */ @@ -131,13 +135,15 @@ public: **/ QStringList profiles() const; -#ifndef KDE_NO_DEPRECATED +#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) /** - * @deprecated since Frameworks 5.0 * Returns the name of the current profile. * @returns what profile we're currently using + * @deprecated Since 5.0 **/ - KCONFIGCORE_DEPRECATED QString currentProfileName() const; + KCONFIGCORE_DEPRECATED_VERSION(5, 0, "API planned to be changed") + QString currentProfileName() const; + // see https://git.reviewboard.kde.org/r/111910/ #endif /** diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 6ae7729c..58afe38a 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -9,8 +9,15 @@ set(libkconfiggui_SRCS ecm_create_qm_loader(libkconfiggui_SRCS kconfig5_qt) add_library(KF5ConfigGui ${libkconfiggui_SRCS}) -generate_export_header(KF5ConfigGui BASE_NAME KConfigGui) add_library(KF5::ConfigGui ALIAS KF5ConfigGui) +ecm_generate_export_header(KF5ConfigGui + BASE_NAME KConfigGui + # GROUP_BASE_NAME KF <- enable once all of KF modules use ecm_generate_export_header + VERSION ${KF5_VERSION} + DEPRECATED_BASE_VERSION 0 + DEPRECATION_VERSIONS 5.11 5.39 + EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} +) target_include_directories(KF5ConfigGui INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/KConfigGui>") diff --git a/src/gui/kconfiggui.cpp b/src/gui/kconfiggui.cpp index 6948b968..f65bba59 100644 --- a/src/gui/kconfiggui.cpp +++ b/src/gui/kconfiggui.cpp @@ -67,7 +67,7 @@ bool KConfigGui::hasSessionConfig() return s_sessionConfig != nullptr; } -#ifndef KDE_NO_DEPRECATED +#if KCONFIGGUI_BUILD_DEPRECATED_SINCE(5, 11) QString KConfigGui::sessionConfigName() { return sessionConfig()->name(); diff --git a/src/gui/kconfiggui.h b/src/gui/kconfiggui.h index 12644658..b9d9cadb 100644 --- a/src/gui/kconfiggui.h +++ b/src/gui/kconfiggui.h @@ -60,14 +60,15 @@ KCONFIGGUI_EXPORT void setSessionConfig(const QString &id, const QString &key); */ KCONFIGGUI_EXPORT bool hasSessionConfig(); +#if KCONFIGGUI_ENABLE_DEPRECATED_SINCE(5, 11) /** * Returns the name of the application session * * @return the application session name * @deprecated since 5.11, use sessionConfig()->name() */ -#ifndef KDE_NO_DEPRECATED -KCONFIGGUI_DEPRECATED_EXPORT QString sessionConfigName(); +KCONFIGGUI_DEPRECATED_VERSION(5, 11, "Use KConfigGui::sessionConfig()->name()") +KCONFIGGUI_EXPORT QString sessionConfigName(); #endif } diff --git a/src/gui/kconfigloader.cpp b/src/gui/kconfigloader.cpp index 63d3ff6e..760b1500 100644 --- a/src/gui/kconfigloader.cpp +++ b/src/gui/kconfigloader.cpp @@ -425,7 +425,11 @@ QStringList KConfigLoader::groupList() const return d->groups; } +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) bool KConfigLoader::usrWriteConfig() +#else +bool KConfigLoader::usrSave() +#endif { if (d->saveDefaults) { const auto listItems = items(); diff --git a/src/gui/kconfigloader.h b/src/gui/kconfigloader.h index 3eb3879d..e46e4c6e 100644 --- a/src/gui/kconfigloader.h +++ b/src/gui/kconfigloader.h @@ -166,10 +166,14 @@ public: QStringList groupList() const; protected: +#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0) /** * Hack used to force writing when no default exists in config file. */ bool usrWriteConfig() override; +#else + bool usrSave() override; +#endif private: ConfigLoaderPrivate *const d; diff --git a/src/gui/kstandardshortcut.cpp b/src/gui/kstandardshortcut.cpp index a8215138..4506be7d 100644 --- a/src/gui/kstandardshortcut.cpp +++ b/src/gui/kstandardshortcut.cpp @@ -154,7 +154,12 @@ static KStandardShortcutInfo g_infoStandardShortcut[] = { { Spelling, "Spelling", QT_TRANSLATE_NOOP3("KStandardShortcut", "Spelling", "@action"), 0, 0, QList<QKeySequence>(), false }, { ShowToolbar, "ShowToolbar", QT_TRANSLATE_NOOP3("KStandardShortcut", "Show Toolbar", "@action"), 0, 0, QList<QKeySequence>(), false }, { ShowStatusbar, "ShowStatusbar", QT_TRANSLATE_NOOP3("KStandardShortcut", "Show Statusbar", "@action"), 0, 0, QList<QKeySequence>(), false }, +#if KCONFIGGUI_BUILD_DEPRECATED_SINCE(5, 39) { SaveOptions, "SaveOptions", QT_TRANSLATE_NOOP3("KStandardShortcut", "Save Options", "@action"), 0, 0, QList<QKeySequence>(), false }, +#else + // dummy entry + { SaveOptions_DEPRECATED_DO_NOT_USE, nullptr, {nullptr, nullptr}, 0, 0, QList<QKeySequence>(), false }, +#endif { KeyBindings, "KeyBindings", QT_TRANSLATE_NOOP3("KStandardShortcut", "Key Bindings", "@action"), 0, 0, QList<QKeySequence>(), false }, { Preferences, "Preferences", QT_TRANSLATE_NOOP3("KStandardShortcut", "Configure Application", "@action"), CTRLSHIFT(Comma), 0, QList<QKeySequence>(), false }, { ConfigureToolbars, "ConfigureToolbars", QT_TRANSLATE_NOOP3("KStandardShortcut", "Configure Toolbars", "@action"), 0, 0, QList<QKeySequence>(), false }, diff --git a/src/gui/kstandardshortcut.h b/src/gui/kstandardshortcut.h index 15cdc1b9..6f673272 100644 --- a/src/gui/kstandardshortcut.h +++ b/src/gui/kstandardshortcut.h @@ -134,7 +134,11 @@ enum StandardShortcut { Spelling, ///< Pop up the spell checker. ShowToolbar, ///< Show/Hide the toolbar. ShowStatusbar, ///< Show/Hide the statusbar. +#if KCONFIGGUI_ENABLE_DEPRECATED_SINCE(5, 39) SaveOptions, ///< @deprecated since 5.39 +#else + SaveOptions_DEPRECATED_DO_NOT_USE, +#endif KeyBindings, ///< Display the configure key bindings dialog. Preferences, ///< Display the preferences/options dialog. ConfigureToolbars, ///< Display the toolbar configuration dialog. |