diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,10 +18,12 @@ include(KDEPackageAppTemplates) include(ECMAddQch) -include(GenerateExportHeader) +include(ECMGenerateExportHeader) include(ECMSetupVersion) +set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control how much of deprecated API is 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/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -74,8 +74,16 @@ COMPONENT Devel) add_library(KF5Parts ${KParts_LIB_SRCS}) -generate_export_header(KF5Parts EXPORT_FILE_NAME ${KParts_BINARY_DIR}/kparts/kparts_export.h BASE_NAME KParts) add_library(KF5::Parts ALIAS KF5Parts) +ecm_generate_export_header(KF5Parts + EXPORT_FILE_NAME ${KParts_BINARY_DIR}/kparts/kparts_export.h + BASE_NAME KParts + # 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.0 + EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} +) set(KParts_BUILD_INCLUDE_DIRS ${KParts_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}) target_include_directories(KF5Parts PUBLIC "$") diff --git a/src/browserextension.h b/src/browserextension.h --- a/src/browserextension.h +++ b/src/browserextension.h @@ -111,9 +111,11 @@ */ enum PopupFlag { DefaultPopupItems = 0x0000, /**< default value, no additional menu item */ +#if KPARTS_ENABLE_DEPRECATED_SINCE(5, 27) ShowNavigationItems = 0x0001, /**< @deprecated since 5.27, no effect anymore */ ShowUp = 0x0002, /**< @deprecated since 5.27, no effect anymore */ ShowReload = 0x0004, /**< @deprecated since 5.27, no effect anymore */ +#endif ShowBookmark = 0x0008, /**< show "add to bookmarks" (usually not done on the local filesystem) */ ShowCreateDirectory = 0x0010, /**< show "create directory" (usually only done on the background of the view, or * in hierarchical views like directory trees, where the new dir would be visible) */ diff --git a/src/browserrun.h b/src/browserrun.h --- a/src/browserrun.h +++ b/src/browserrun.h @@ -79,42 +79,45 @@ */ bool serverSuggestsSave() const; +#if KPARTS_ENABLE_DEPRECATED_SINCE(5, 0) enum AskSaveResult { Save, Open, Cancel }; /** * Ask the user whether to save or open a url in another application. * @param url the URL in question * @param offer the application that will be used to open the URL * @param mimeType the mimetype of the URL * @param suggestedFileName optional file name suggested by the server * @return Save, Open or Cancel. - * @deprecated use BrowserOpenOrSaveQuestion + * @deprecated Since 5.0, use BrowserOpenOrSaveQuestion * @code * BrowserOpenOrSaveQuestion dlg(parent, url, mimeType, suggestedFileName); * const BrowserOpenOrSaveQuestion::Result res = dlg.askOpenOrSave(); * @endcode */ -#ifndef KPARTS_NO_DEPRECATED - static KPARTS_DEPRECATED AskSaveResult askSave(const QUrl &url, KService::Ptr offer, const QString &mimeType, const QString &suggestedFileName = QString()); + KPARTS_DEPRECATED_VERSION(5, 0, "Use KParts::BrowserOpenOrSaveQuestion") + static AskSaveResult askSave(const QUrl &url, KService::Ptr offer, const QString &mimeType, const QString &suggestedFileName = QString()); #endif enum AskEmbedOrSaveFlags { InlineDisposition = 0, AttachmentDisposition = 1 }; + +#if KPARTS_ENABLE_DEPRECATED_SINCE(5, 0) /** * Similar to askSave but for the case where the current application is * able to embed the url itself (instead of passing it to another app). * @param url the URL in question * @param mimeType the mimetype of the URL * @param suggestedFileName optional filename suggested by the server * @param flags set to AttachmentDisposition if suggested by the server * @return Save, Open or Cancel. - * @deprecated use BrowserOpenOrSaveQuestion + * @deprecated Since 5.0, use BrowserOpenOrSaveQuestion * @code * BrowserOpenOrSaveQuestion dlg(parent, url, mimeType, suggestedFileName); * const BrowserOpenOrSaveQuestion::Result res = dlg.askEmbedOrSave(flags); * // Important: returns Embed now, not Open! * @endcode */ -#ifndef KPARTS_NO_DEPRECATED - static KPARTS_DEPRECATED AskSaveResult askEmbedOrSave(const QUrl &url, const QString &mimeType, const QString &suggestedFileName = QString(), int flags = 0); + KPARTS_DEPRECATED_VERSION(5, 0, "Use KParts::BrowserOpenOrSaveQuestion") + static AskSaveResult askEmbedOrSave(const QUrl &url, const QString &mimeType, const QString &suggestedFileName = QString(), int flags = 0); #endif // virtual so that KHTML can implement differently (HTML cache) diff --git a/src/browserrun.cpp b/src/browserrun.cpp --- a/src/browserrun.cpp +++ b/src/browserrun.cpp @@ -348,7 +348,7 @@ } //static, deprecated -#ifndef KPARTS_NO_DEPRECATED +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 0) BrowserRun::AskSaveResult BrowserRun::askSave(const QUrl &url, KService::Ptr offer, const QString &mimeType, const QString &suggestedFileName) { Q_UNUSED(offer); @@ -362,7 +362,7 @@ #endif //static, deprecated -#ifndef KPARTS_NO_DEPRECATED +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 0) BrowserRun::AskSaveResult BrowserRun::askEmbedOrSave(const QUrl &url, const QString &mimeType, const QString &suggestedFileName, int flags) { BrowserOpenOrSaveQuestion question(nullptr, url, mimeType); diff --git a/src/readonlypart.h b/src/readonlypart.h --- a/src/readonlypart.h +++ b/src/readonlypart.h @@ -282,18 +282,18 @@ */ void guiActivateEvent(GUIActivateEvent *event) override; +#if KPARTS_ENABLE_DEPRECATED_SINCE(5, 0) /** * @internal */ -#ifndef KPARTS_NO_DEPRECATED - KPARTS_DEPRECATED bool isLocalFileTemporary() const; -#endif + KPARTS_DEPRECATED_VERSION(5, 0, "Do not use feature") + bool isLocalFileTemporary() const; /** * @internal */ -#ifndef KPARTS_NO_DEPRECATED - KPARTS_DEPRECATED void setLocalFileTemporary(bool temp); + KPARTS_DEPRECATED_VERSION(5, 0, "Do not use feature") + void setLocalFileTemporary(bool temp); #endif /** diff --git a/src/readonlypart.cpp b/src/readonlypart.cpp --- a/src/readonlypart.cpp +++ b/src/readonlypart.cpp @@ -84,16 +84,16 @@ d->m_file = localFilePath; } -#ifndef KPARTS_NO_DEPRECATED +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 0) bool ReadOnlyPart::isLocalFileTemporary() const { Q_D(const ReadOnlyPart); return d->m_bTemp; } #endif -#ifndef KPARTS_NO_DEPRECATED +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 0) void ReadOnlyPart::setLocalFileTemporary(bool temp) { Q_D(ReadOnlyPart);