Use ECMGenerateExportHeader to manage deprecated API better

Summary:
Allows
* projects linking to Plasma to hide deprecated API up to a
  given version or silence deprecation warnings after a given version,
  using
  * -DPLASMA_DISABLE_DEPRECATED_BEFORE_AND_AT
  * -DPLASMA_NO_DEPRECATED
  * -DPLASMA_DEPRECATED_WARNINGS_SINCE
  * -DPLASMA_NO_DEPRECATED_WARNINGS
  * -DPLASMAQUICK_DISABLE_DEPRECATED_BEFORE_AND_AT
  * -DPLASMAQUICK_NO_DEPRECATED
  * -DPLASMAQUICK_DEPRECATED_WARNINGS_SINCE
  * -DPLASMAQUICK_NO_DEPRECATED_WARNINGS

  or
  * -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT
  * -DKF_NO_DEPRECATED
  * -DKF_DEPRECATED_WARNINGS_SINCE
  * -DKF_NO_DEPRECATED_WARNINGS

Reviewers: #plasma, mart, davidedmundson, apol, mlaurent

Reviewed By: #plasma, mart, mlaurent

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D24678
This commit is contained in:
Friedrich W. H. Kossebau 2019-10-15 20:23:31 +02:00
parent ab8e63a5a5
commit df7f981890
12 changed files with 177 additions and 109 deletions

View File

@ -16,7 +16,7 @@ include(KDEInstallDirs)
include(KDECMakeSettings) include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(GenerateExportHeader) include(ECMGenerateExportHeader)
include(ECMGenerateHeaders) include(ECMGenerateHeaders)
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
include(ECMSetupVersion) include(ECMSetupVersion)

View File

@ -87,6 +87,16 @@ ecm_qt_declare_logging_category(Plasma_LIB_SRCS HEADER debug_p.h IDENTIFIER LOG_
add_library(KF5Plasma ${Plasma_LIB_SRCS}) add_library(KF5Plasma ${Plasma_LIB_SRCS})
add_library(KF5::Plasma ALIAS KF5Plasma) add_library(KF5::Plasma ALIAS KF5Plasma)
ecm_generate_export_header(KF5Plasma
EXPORT_FILE_NAME plasma/plasma_export.h
BASE_NAME Plasma
# 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.6 5.19 5.28 5.30 5.36 5.46
)
# TODO: add support for EXCLUDE_DEPRECATED_BEFORE_AND_AT to all Plasma libs
# needs fixing of undeprecated API being still implemented using own deprecated API
if(HAVE_X11) if(HAVE_X11)
set(PLASMA_EXTRA_LIBS ${PLASMA_EXTRA_LIBS} Qt5::X11Extras ${X11_LIBRARIES} XCB::XCB) set(PLASMA_EXTRA_LIBS ${PLASMA_EXTRA_LIBS} Qt5::X11Extras ${X11_LIBRARIES} XCB::XCB)
@ -138,9 +148,6 @@ set_target_properties(KF5Plasma PROPERTIES
) )
########### install files ############### ########### install files ###############
generate_export_header(KF5Plasma
BASE_NAME Plasma
EXPORT_FILE_NAME plasma/plasma_export.h)
ecm_generate_headers(Plasma_CamelCase_HEADERS ecm_generate_headers(Plasma_CamelCase_HEADERS
HEADER_NAMES HEADER_NAMES
Applet Applet

View File

@ -86,6 +86,7 @@ public:
*/ */
explicit Applet(QObject *parent = nullptr, const QString &serviceId = QString(), uint appletId = 0); explicit Applet(QObject *parent = nullptr, const QString &serviceId = QString(), uint appletId = 0);
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 28)
/** /**
* @param parent the QObject this applet is parented to * @param parent the QObject this applet is parented to
* @param info the plugin information object for this Applet * @param info the plugin information object for this Applet
@ -93,9 +94,11 @@ public:
* instances of the same Applet type * instances of the same Applet type
* @since 4.6 * @since 4.6
* *
* @deprecated prefer using KPluginMetaData * @deprecated Since 5.28, prefer using KPluginMetaData
*/ */
PLASMA_DEPRECATED explicit Applet(const KPluginInfo &info, QObject *parent = nullptr, uint appletId = 0); PLASMA_DEPRECATED_VERSION(5, 28, "Use Applet(const KPluginMetaData &, QObject *, uint")
explicit Applet(const KPluginInfo &info, QObject *parent = nullptr, uint appletId = 0);
#endif
/** /**
* @param parent the QObject this applet is parented to * @param parent the QObject this applet is parented to
@ -248,15 +251,16 @@ public:
void setUserConfiguring(bool configuring); void setUserConfiguring(bool configuring);
//UTILS //UTILS
#ifndef PLASMA_NO_DEPRECATED #if PLASMA_ENABLE_DEPRECATED_SINCE(5, 6)
/** /**
* Accessor for the associated Package object if any. * Accessor for the associated Package object if any.
* Generally, only Plasmoids come in a Package. * Generally, only Plasmoids come in a Package.
* *
* @deprecated use kPackage() instead
* @return the Package object, or an invalid one if none * @return the Package object, or an invalid one if none
* @deprecated Since 5.6, use kPackage() instead
**/ **/
PLASMA_DEPRECATED Package package() const; PLASMA_DEPRECATED_VERSION(5, 6, "Use Applet::kPackage()")
Package package() const;
#endif #endif
/** /**
@ -278,13 +282,16 @@ public:
void updateConstraints(Plasma::Types::Constraints constraints = Plasma::Types::AllConstraints); void updateConstraints(Plasma::Types::Constraints constraints = Plasma::Types::AllConstraints);
//METADATA //METADATA
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 28)
/** /**
* @return metadata information about this plugin * @return metadata information about this plugin
* @see KPluginInfo, pluginMetaData * @see KPluginInfo, pluginMetaData
* @since 5.0 * @since 5.0
* @deprecated use pluginMetaData instead * @deprecated Since 5.28, use pluginMetaData instead
*/ */
PLASMA_DEPRECATED KPluginInfo pluginInfo() const; PLASMA_DEPRECATED_VERSION(5, 28, "Use Applet::pluginMetaData()")
KPluginInfo pluginInfo() const;
#endif
/** /**
* @return metadata information about this plugin * @return metadata information about this plugin
@ -311,6 +318,7 @@ public:
*/ */
void setTitle(const QString &title); void setTitle(const QString &title);
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 19)
/** /**
* Attempts to load an applet from a package * Attempts to load an applet from a package
* *
@ -326,10 +334,12 @@ public:
* @return a pointer to the loaded applet, or 0 on load failure * @return a pointer to the loaded applet, or 0 on load failure
* @since 4.3 * @since 4.3
* *
* @deprecated use Containment::createApplet() instead, you are not * @deprecated Since 5.19, use Containment::createApplet() instead, you are not
* supposed to have applets without containments * supposed to have applets without containments
**/ **/
PLASMA_DEPRECATED static Applet *loadPlasmoid(const QString &path, uint appletId = 0); PLASMA_DEPRECATED_VERSION(5, 19, "Use Containment::createApplet(...)")
static Applet *loadPlasmoid(const QString &path, uint appletId = 0);
#endif
/** /**
* @returns The icon name related to this applet * @returns The icon name related to this applet

View File

@ -49,7 +49,7 @@ public:
explicit Corona(QObject *parent = nullptr); explicit Corona(QObject *parent = nullptr);
~Corona(); ~Corona();
#ifndef PLASMA_NO_DEPRECATED #if PLASMA_ENABLE_DEPRECATED_SINCE(5, 6)
/** /**
* Accessor for the associated Package object if any. * Accessor for the associated Package object if any.
* A Corona package defines how Containments are laid out in a View, * A Corona package defines how Containments are laid out in a View,
@ -57,17 +57,21 @@ public:
* and in genelal all the furniture specific of a particular * and in genelal all the furniture specific of a particular
* device form factor. * device form factor.
* *
* @deprecated use kPackage instead
* @return the Package object, or an invalid one if none * @return the Package object, or an invalid one if none
* @since 5.0 * @since 5.0
* @deprecated Since 5.6, use kPackage instead
**/ **/
PLASMA_DEPRECATED Plasma::Package package() const; PLASMA_DEPRECATED_VERSION(5, 6, "Use Corona::kPackage()")
Plasma::Package package() const;
#endif
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 6)
/** /**
* Setting the package name * Setting the package name
* @deprecated use setKPackage instead * @deprecated Since 5.6, use setKPackage instead
*/ */
PLASMA_DEPRECATED void setPackage(const Plasma::Package &package); PLASMA_DEPRECATED_VERSION(5, 6, "Use Corona::setKPackage(const KPackage::Package &)")
void setPackage(const Plasma::Package &package);
#endif #endif
/** /**
@ -139,13 +143,18 @@ public:
const QVariantList &defaultArgs = QVariantList()); const QVariantList &defaultArgs = QVariantList());
//TODO KF6: add activity here, can't be done now as the overload would get confused //TODO KF6: add activity here, can't be done now as the overload would get confused
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 46)
/** /**
* Returns the Containment, if any, for a given physical screen * Returns the Containment, if any, for a given physical screen
* *
* @param screen number of the physical screen to locate * @param screen number of the physical screen to locate
* @deprecated Since 5.46, use containmentForScreen(int, const QString &, const QString &, const QVariantList &)
*/ */
PLASMA_DEPRECATED Containment *containmentForScreen(int screen) const; PLASMA_DEPRECATED_VERSION(5, 46, "Use Corona::containmentForScreen(int, const QString &, const QString &, const QVariantList &)")
Containment *containmentForScreen(int screen) const;
#endif
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 46)
/** /**
* Returns the Containment for a given physical screen and desktop, creating one * Returns the Containment for a given physical screen and desktop, creating one
* if none exists * if none exists
@ -154,10 +163,13 @@ public:
* @param defaultPluginIfNonExistent the plugin to load by default; "null" is an empty * @param defaultPluginIfNonExistent the plugin to load by default; "null" is an empty
* Containment and "default" creates the default plugin * Containment and "default" creates the default plugin
* @param defaultArgs optional arguments to pass in when creating a Containment if needed * @param defaultArgs optional arguments to pass in when creating a Containment if needed
* @deprecated Since 5.46, use containmentForScreen(int, const QString &, const QString &, const QVariantList &)
*/ */
PLASMA_DEPRECATED PLASMA_DEPRECATED Containment *containmentForScreen(int screen, PLASMA_DEPRECATED_VERSION(5, 46, "Use Corona::containmentForScreen(int, const QString &, const QString &, const QVariantList &)")
Containment *containmentForScreen(int screen,
const QString &defaultPluginIfNonExistent, const QString &defaultPluginIfNonExistent,
const QVariantList &defaultArgs = QVariantList()); const QVariantList &defaultArgs = QVariantList());
#endif
/** /**
* Returns all containments which match a particular activity, for any screen * Returns all containments which match a particular activity, for any screen
@ -380,15 +392,16 @@ Q_SIGNALS:
*/ */
void editModeChanged(); void editModeChanged();
#ifndef PLASMA_NO_DEPRECATED #if PLASMA_ENABLE_DEPRECATED_SINCE(5, 6)
/** /**
* Emitted when the package for this corona has been changed. * Emitted when the package for this corona has been changed.
* Shells must support changing the shell package on the fly (for instance due to device form factor changing) * Shells must support changing the shell package on the fly (for instance due to device form factor changing)
* *
* @deprecated use kPackageChanged instead
* @param package the new package that defines the Corona furniture and behavior * @param package the new package that defines the Corona furniture and behavior
* @deprecated Since 5.6, use kPackageChanged instead
*/ */
PLASMA_DEPRECATED void packageChanged(const Plasma::Package &package); PLASMA_DEPRECATED_VERSION(5, 6, "Use Corona::kPackageChanged(const KPackage::Package &)")
void packageChanged(const Plasma::Package &package);
#endif #endif
/** /**

View File

@ -29,7 +29,8 @@
class KJob; class KJob;
#ifndef PLASMA_NO_DEPRECATED // not 5.6, as last Plasma API using this class only got removed later
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 28)
namespace KPackage { namespace KPackage {
class Package; class Package;
@ -43,7 +44,6 @@ namespace Plasma
* *
* @short object representing an installed Plasma package * @short object representing an installed Plasma package
* *
* @deprecated USe KPackage::Package instead
* Package defines what is in a package and provides easy access to the contents. * Package defines what is in a package and provides easy access to the contents.
* *
* To define a package, one might write the following code: * To define a package, one might write the following code:
@ -76,6 +76,8 @@ namespace Plasma
* * the subclass may implement mechanisms to install and remove packages using the * * the subclass may implement mechanisms to install and remove packages using the
* virtual install and uninstall methods * virtual install and uninstall methods
* * subclasses can be compiled as plugins for easy re-use * * subclasses can be compiled as plugins for easy re-use
*
* @deprecated Since 5.6, use KPackage::Package instead
**/ **/
//TODO: write documentation on USING a package //TODO: write documentation on USING a package
@ -92,19 +94,22 @@ public:
* otherwise the structure is allowed to set up the Package's initial layout * otherwise the structure is allowed to set up the Package's initial layout
* @since 4.6 * @since 4.6
*/ */
PLASMA_DEPRECATED explicit Package(PackageStructure *structure = nullptr); PLASMA_DEPRECATED_VERSION(5, 6, "Use KPackage API")
explicit Package(PackageStructure *structure = nullptr);
/** /**
* Copy constructore * Copy constructore
* @since 4.6 * @since 4.6
*/ */
PLASMA_DEPRECATED Package(const KPackage::Package &other); PLASMA_DEPRECATED_VERSION(5, 6, "Use KPackage API")
Package(const KPackage::Package &other);
/** /**
* Copy constructore * Copy constructore
* @since 4.6 * @since 4.6
*/ */
PLASMA_DEPRECATED Package(const Package &other); PLASMA_DEPRECATED_VERSION(5, 6, "Use KPackage API")
Package(const Package &other);
~Package(); ~Package();
@ -112,7 +117,7 @@ public:
* Assignment operator * Assignment operator
* @since 4.6 * @since 4.6
*/ */
PLASMA_DEPRECATED Package &operator=(const Package &rhs); Package &operator=(const Package &rhs);
/** /**
* @return true if this package has a valid PackageStructure associatedw it with it. * @return true if this package has a valid PackageStructure associatedw it with it.
@ -120,24 +125,24 @@ public:
* Package objects in a semi-initialized state (e.g. before calling setPath()) * Package objects in a semi-initialized state (e.g. before calling setPath())
* @since 5.1 * @since 5.1
*/ */
PLASMA_DEPRECATED bool hasValidStructure() const; bool hasValidStructure() const;
/** /**
* @return true if all the required components exist * @return true if all the required components exist
**/ **/
PLASMA_DEPRECATED bool isValid() const; bool isValid() const;
/** /**
* Sets the path to the root of this package * Sets the path to the root of this package
* @param path an absolute path, or a relative path to the default package root * @param path an absolute path, or a relative path to the default package root
* @since 4.3 * @since 4.3
*/ */
PLASMA_DEPRECATED void setPath(const QString &path); void setPath(const QString &path);
/** /**
* @return the path to the root of this particular package * @return the path to the root of this particular package
*/ */
PLASMA_DEPRECATED const QString path() const; const QString path() const;
/** /**
* Get the path to a given file based on the key and an optional filename. * Get the path to a given file based on the key and an optional filename.
@ -151,7 +156,7 @@ public:
* @param filename optional name of the file to locate within the package * @param filename optional name of the file to locate within the package
* @return path to the file on disk. QString() if not found. * @return path to the file on disk. QString() if not found.
**/ **/
PLASMA_DEPRECATED QString filePath(const char *key, const QString &filename = QString()) const; QString filePath(const char *key, const QString &filename = QString()) const;
/** /**
* Get the list of files of a given type. * Get the list of files of a given type.
@ -160,56 +165,56 @@ public:
* package structure. * package structure.
* @return list of files by name, suitable for passing to filePath * @return list of files by name, suitable for passing to filePath
**/ **/
PLASMA_DEPRECATED QStringList entryList(const char *key) const; QStringList entryList(const char *key) const;
/** /**
* @return user visible name for the given entry * @return user visible name for the given entry
**/ **/
PLASMA_DEPRECATED QString name(const char *key) const; QString name(const char *key) const;
/** /**
* @return true if the item at path exists and is required * @return true if the item at path exists and is required
**/ **/
PLASMA_DEPRECATED bool isRequired(const char *key) const; bool isRequired(const char *key) const;
/** /**
* @return the mimeTypes associated with the path, if any * @return the mimeTypes associated with the path, if any
**/ **/
PLASMA_DEPRECATED QStringList mimeTypes(const char *key) const; QStringList mimeTypes(const char *key) const;
/** /**
* @return the prefix paths inserted between the base path and content entries, in order of priority. * @return the prefix paths inserted between the base path and content entries, in order of priority.
* When searching for a file, all paths will be tried in order. * When searching for a file, all paths will be tried in order.
* @since 4.6 * @since 4.6
*/ */
PLASMA_DEPRECATED QStringList contentsPrefixPaths() const; QStringList contentsPrefixPaths() const;
/** /**
* @return preferred package root. This defaults to plasma/plasmoids/ * @return preferred package root. This defaults to plasma/plasmoids/
*/ */
PLASMA_DEPRECATED QString defaultPackageRoot() const; QString defaultPackageRoot() const;
/** /**
* @return service prefix used in desktop files. This defaults to plasma-applet- * @return service prefix used in desktop files. This defaults to plasma-applet-
*/ */
PLASMA_DEPRECATED QString servicePrefix() const; QString servicePrefix() const;
/** /**
* @return true if paths/symlinks outside the package itself should be followed. * @return true if paths/symlinks outside the package itself should be followed.
* By default this is set to false for security reasons. * By default this is set to false for security reasons.
*/ */
PLASMA_DEPRECATED bool allowExternalPaths() const; bool allowExternalPaths() const;
/** /**
* @return the package metadata object. * @return the package metadata object.
*/ */
PLASMA_DEPRECATED KPluginInfo metadata() const; KPluginInfo metadata() const;
/** /**
* @return a SHA1 hash digest of the contents of the package in hexadecimal form * @return a SHA1 hash digest of the contents of the package in hexadecimal form
* @since 4.4 * @since 4.4
*/ */
PLASMA_DEPRECATED QString contentsHash() const; QString contentsHash() const;
/** /**
* Adds a directory to the structure of the package. It is added as * Adds a directory to the structure of the package. It is added as
@ -222,7 +227,7 @@ public:
* @param path the path within the package for this directory * @param path the path within the package for this directory
* @param name the user visible (translated) name for the directory * @param name the user visible (translated) name for the directory
**/ **/
PLASMA_DEPRECATED void addDirectoryDefinition(const char *key, const QString &path, const QString &name); void addDirectoryDefinition(const char *key, const QString &path, const QString &name);
/** /**
* Adds a file to the structure of the package. It is added as * Adds a file to the structure of the package. It is added as
@ -235,14 +240,14 @@ public:
* @param path the path within the package for this file * @param path the path within the package for this file
* @param name the user visible (translated) name for the file * @param name the user visible (translated) name for the file
**/ **/
PLASMA_DEPRECATED void addFileDefinition(const char *key, const QString &path, const QString &name); void addFileDefinition(const char *key, const QString &path, const QString &name);
/** /**
* Removes a definition from the structure of the package. * Removes a definition from the structure of the package.
* @since 4.6 * @since 4.6
* @param key the internal label of the file or directory to remove * @param key the internal label of the file or directory to remove
*/ */
PLASMA_DEPRECATED void removeDefinition(const char *key); void removeDefinition(const char *key);
/** /**
* Sets whether or not a given part of the structure is required or not. * Sets whether or not a given part of the structure is required or not.
@ -252,7 +257,7 @@ public:
* @param key the entry within the package * @param key the entry within the package
* @param required true if this entry is required, false if not * @param required true if this entry is required, false if not
*/ */
PLASMA_DEPRECATED void setRequired(const char *key, bool required); void setRequired(const char *key, bool required);
/** /**
* Defines the default mimeTypes for any definitions that do not have * Defines the default mimeTypes for any definitions that do not have
@ -261,7 +266,7 @@ public:
* *
* @param mimeTypes a list of mimeTypes * @param mimeTypes a list of mimeTypes
**/ **/
PLASMA_DEPRECATED void setDefaultMimeTypes(QStringList mimeTypes); void setDefaultMimeTypes(QStringList mimeTypes);
/** /**
* Define mimeTypes for a given part of the structure * Define mimeTypes for a given part of the structure
@ -271,7 +276,7 @@ public:
* @param key the entry within the package * @param key the entry within the package
* @param mimeTypes a list of mimeTypes * @param mimeTypes a list of mimeTypes
**/ **/
PLASMA_DEPRECATED void setMimeTypes(const char *key, QStringList mimeTypes); void setMimeTypes(const char *key, QStringList mimeTypes);
/** /**
* Sets the prefixes that all the contents in this package should * Sets the prefixes that all the contents in this package should
@ -284,24 +289,24 @@ public:
* @param prefix paths the directory prefix to use * @param prefix paths the directory prefix to use
* @since 4.6 * @since 4.6
*/ */
PLASMA_DEPRECATED void setContentsPrefixPaths(const QStringList &prefixPaths); void setContentsPrefixPaths(const QStringList &prefixPaths);
/** /**
* Sets service prefix. * Sets service prefix.
*/ */
PLASMA_DEPRECATED void setServicePrefix(const QString &servicePrefix); void setServicePrefix(const QString &servicePrefix);
/** /**
* Sets whether or not external paths/symlinks can be followed by a package * Sets whether or not external paths/symlinks can be followed by a package
* @param allow true if paths/symlinks outside of the package should be followed, * @param allow true if paths/symlinks outside of the package should be followed,
* false if they should be rejected. * false if they should be rejected.
*/ */
PLASMA_DEPRECATED void setAllowExternalPaths(bool allow); void setAllowExternalPaths(bool allow);
/** /**
* Sets preferred package root. * Sets preferred package root.
*/ */
PLASMA_DEPRECATED void setDefaultPackageRoot(const QString &packageRoot); void setDefaultPackageRoot(const QString &packageRoot);
/** /**
* Sets the fallback package root path * Sets the fallback package root path
@ -310,33 +315,33 @@ public:
* It is intended to be used by the packageStructure * It is intended to be used by the packageStructure
* @param path package root path @see setPath * @param path package root path @see setPath
*/ */
PLASMA_DEPRECATED void setFallbackPackage(const Plasma::Package &package); void setFallbackPackage(const Plasma::Package &package);
/** /**
* @return The fallback package root path * @return The fallback package root path
*/ */
PLASMA_DEPRECATED Plasma::Package fallbackPackage() const; Plasma::Package fallbackPackage() const;
// Content structure description methods // Content structure description methods
/** /**
* @return all directories registered as part of this Package's structure * @return all directories registered as part of this Package's structure
*/ */
PLASMA_DEPRECATED QList<const char *> directories() const; QList<const char *> directories() const;
/** /**
* @return all directories registered as part of this Package's required structure * @return all directories registered as part of this Package's required structure
*/ */
PLASMA_DEPRECATED QList<const char *> requiredDirectories() const; QList<const char *> requiredDirectories() const;
/** /**
* @return all files registered as part of this Package's structure * @return all files registered as part of this Package's structure
*/ */
PLASMA_DEPRECATED QList<const char *> files() const; QList<const char *> files() const;
/** /**
* @return all files registered as part of this Package's required structure * @return all files registered as part of this Package's required structure
*/ */
PLASMA_DEPRECATED QList<const char *> requiredFiles() const; QList<const char *> requiredFiles() const;
/** /**
* Installs a package matching this package structure. By default installs a * Installs a package matching this package structure. By default installs a
@ -344,14 +349,14 @@ public:
* *
* @return KJob to track installation progress and result * @return KJob to track installation progress and result
**/ **/
PLASMA_DEPRECATED KJob *install(const QString &sourcePackage, const QString &packageRoot = QString()); KJob *install(const QString &sourcePackage, const QString &packageRoot = QString());
/** /**
* Uninstalls a package matching this package structure. * Uninstalls a package matching this package structure.
* *
* @return KJob to track removal progress and result * @return KJob to track removal progress and result
*/ */
PLASMA_DEPRECATED KJob *uninstall(const QString &packageName, const QString &packageRoot); KJob *uninstall(const QString &packageName, const QString &packageRoot);
/** /**
* @returns the wrapped KPackage::Package instance, which deprecated this class * @returns the wrapped KPackage::Package instance, which deprecated this class
@ -370,7 +375,10 @@ private:
}; };
} }
#endif
Q_DECLARE_METATYPE(Plasma::Package) Q_DECLARE_METATYPE(Plasma::Package)
#endif // PLASMA_ENABLE_DEPRECATED_SINCE(5, 28)
#endif #endif

View File

@ -29,7 +29,7 @@
#include <plasma/package.h> #include <plasma/package.h>
#include <plasma/version.h> #include <plasma/version.h>
#ifndef PLASMA_NO_DEPRECATED #if PLASMA_ENABLE_DEPRECATED_SINCE(5, 6)
namespace Plasma namespace Plasma
{ {
@ -42,7 +42,8 @@ class PLASMA_EXPORT PackageStructure : public QObject
public: public:
PLASMA_DEPRECATED explicit PackageStructure(QObject *parent = nullptr, const QVariantList &args = QVariantList()); PLASMA_DEPRECATED_VERSION(5, 6, "Use KPackage API")
explicit PackageStructure(QObject *parent = nullptr, const QVariantList &args = QVariantList());
~PackageStructure(); ~PackageStructure();
@ -57,13 +58,13 @@ public:
* @param package the Package to set up. The object is empty of all definition when * @param package the Package to set up. The object is empty of all definition when
* first passed in. * first passed in.
*/ */
PLASMA_DEPRECATED virtual void initPackage(Package *package); virtual void initPackage(Package *package);
/** /**
* Called whenever the path changes so that subclasses may take * Called whenever the path changes so that subclasses may take
* package specific actions. * package specific actions.
*/ */
PLASMA_DEPRECATED virtual void pathChanged(Package *package); virtual void pathChanged(Package *package);
/** /**
* Installs a package matching this package structure. By default installs a * Installs a package matching this package structure. By default installs a
@ -76,7 +77,7 @@ public:
* installed to * installed to
* @return KJob* to track the installation status * @return KJob* to track the installation status
**/ **/
PLASMA_DEPRECATED virtual KJob *install(Package *package, const QString &archivePath, const QString &packageRoot); virtual KJob *install(Package *package, const QString &archivePath, const QString &packageRoot);
/** /**
* Uninstalls a package matching this package structure. * Uninstalls a package matching this package structure.
@ -87,7 +88,7 @@ public:
* @param packageRoot path to the directory where the package should be installed to * @param packageRoot path to the directory where the package should be installed to
* @return KJob* to track the installation status * @return KJob* to track the installation status
*/ */
PLASMA_DEPRECATED virtual KJob *uninstall(Package *package, const QString &packageRoot); virtual KJob *uninstall(Package *package, const QString &packageRoot);
private: private:
PackageStructurePrivate *d; PackageStructurePrivate *d;
@ -111,6 +112,6 @@ private:
K_PLUGIN_FACTORY_WITH_JSON(factory, jsonFile, registerPlugin<classname>();) \ K_PLUGIN_FACTORY_WITH_JSON(factory, jsonFile, registerPlugin<classname>();) \
K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION) K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
#endif #endif // PLASMA_ENABLE_DEPRECATED_SINCE(5, 6)
#endif #endif

View File

@ -420,7 +420,6 @@ ContainmentActions *PluginLoader::loadContainmentActions(Containment *parent, co
return actions; return actions;
} }
#ifndef PLASMA_NO_DEPRECATED
Package PluginLoader::loadPackage(const QString &packageFormat, const QString &specialization) Package PluginLoader::loadPackage(const QString &packageFormat, const QString &specialization)
{ {
if (!d->isDefaultLoader) { if (!d->isDefaultLoader) {
@ -467,7 +466,6 @@ Package PluginLoader::loadPackage(const QString &packageFormat, const QString &s
return Package(); return Package();
} }
#endif
QList<KPluginMetaData> PluginLoader::listAppletMetaData(const QString &category, const QString &parentApp) QList<KPluginMetaData> PluginLoader::listAppletMetaData(const QString &category, const QString &parentApp)
{ {
@ -763,14 +761,12 @@ Service *PluginLoader::internalLoadService(const QString &name, const QVariantLi
} }
#ifndef PLASMA_NO_DEPRECATED
Package PluginLoader::internalLoadPackage(const QString &name, const QString &specialization) Package PluginLoader::internalLoadPackage(const QString &name, const QString &specialization)
{ {
Q_UNUSED(name); Q_UNUSED(name);
Q_UNUSED(specialization); Q_UNUSED(specialization);
return Package(); return Package();
} }
#endif
KPluginInfo::List PluginLoader::internalAppletInfo(const QString &category) const KPluginInfo::List PluginLoader::internalAppletInfo(const QString &category) const
{ {

View File

@ -140,6 +140,7 @@ public:
ContainmentActions *loadContainmentActions(Containment *parent, const QString &containmentActionsName, ContainmentActions *loadContainmentActions(Containment *parent, const QString &containmentActionsName,
const QVariantList &args = QVariantList()); const QVariantList &args = QVariantList());
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 30)
/** /**
* Load a Package plugin. * Load a Package plugin.
* *
@ -147,12 +148,13 @@ public:
* @param specialization used to find script extensions for the given format, e.g. "QML" for "Plasma/Applet" * @param specialization used to find script extensions for the given format, e.g. "QML" for "Plasma/Applet"
* *
* @return a Package object matching name, or an invalid package on failure * @return a Package object matching name, or an invalid package on failure
* @deprecated Since 5.29, use KPackage::PackageLoader::loadPackage(const QString& packageFormat, const QString& packagePath) instead. * @deprecated Since 5.30, use KPackage::PackageLoader::loadPackage(const QString& packageFormat, const QString& packagePath) instead.
**/ **/
#ifndef PLASMA_NO_DEPRECATED PLASMA_DEPRECATED_VERSION(5, 30, "Use KPackage::PackageLoader::loadPackage(const QString&, const QString&")
PLASMA_DEPRECATED Package loadPackage(const QString &packageFormat, const QString &specialization = QString()); Package loadPackage(const QString &packageFormat, const QString &specialization = QString());
#endif #endif
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 28)
/** /**
* Returns a list of all known applets. * Returns a list of all known applets.
* This may skip applets based on security settings and ExcludeCategories in the application's config. * This may skip applets based on security settings and ExcludeCategories in the application's config.
@ -169,10 +171,12 @@ public:
* list of all applets in specified category. * list of all applets in specified category.
* @return list of applets * @return list of applets
* *
* @deprecated Doesn't support metadata.json packages. * @deprecated Since 5.28. Doesn't support metadata.json packages.
* Since 5.28, use listAppletMetaData(const QString &category, const QString &parentApp) instead. * Use listAppletMetaData(const QString &category, const QString &parentApp) instead.
**/ **/
PLASMA_DEPRECATED KPluginInfo::List listAppletInfo(const QString &category, const QString &parentApp = QString()); PLASMA_DEPRECATED_VERSION(5, 28, "Use PluginLoader::listAppletMetaData(const QString &, const QString &)")
KPluginInfo::List listAppletInfo(const QString &category, const QString &parentApp = QString());
#endif
/** /**
* Returns a list of all known applets. * Returns a list of all known applets.
@ -194,6 +198,7 @@ public:
**/ **/
QList<KPluginMetaData> listAppletMetaData(const QString &category, const QString &parentApp = QString()); QList<KPluginMetaData> listAppletMetaData(const QString &category, const QString &parentApp = QString());
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 36)
/** /**
* Returns a list of all known applets associated with a certain mimetype. * Returns a list of all known applets associated with a certain mimetype.
* *
@ -201,7 +206,9 @@ public:
* *
* @deprecated Since 5.36, use listAppletMetaDataForMimeType(const QString &mimetype) instead. * @deprecated Since 5.36, use listAppletMetaDataForMimeType(const QString &mimetype) instead.
**/ **/
PLASMA_DEPRECATED KPluginInfo::List listAppletInfoForMimeType(const QString &mimetype); PLASMA_DEPRECATED_VERSION(5, 36, "Use PluginLoader::listAppletMetaDataForMimeType(const QString &)")
KPluginInfo::List listAppletInfoForMimeType(const QString &mimetype);
#endif
/** /**
* Returns a list of all known applets associated with a certain mimetype. * Returns a list of all known applets associated with a certain mimetype.
@ -211,6 +218,7 @@ public:
**/ **/
QList<KPluginMetaData> listAppletMetaDataForMimeType(const QString &mimetype); QList<KPluginMetaData> listAppletMetaDataForMimeType(const QString &mimetype);
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 36)
/** /**
* Returns a list of all known applets associated with a certain URL. * Returns a list of all known applets associated with a certain URL.
* *
@ -218,7 +226,9 @@ public:
* *
* @deprecated Since 5.36, use listAppletMetaDataForUrl(const QUrl &url) instead. * @deprecated Since 5.36, use listAppletMetaDataForUrl(const QUrl &url) instead.
**/ **/
PLASMA_DEPRECATED KPluginInfo::List listAppletInfoForUrl(const QUrl &url); PLASMA_DEPRECATED_VERSION(5, 36, "Use PluginLoader::listAppletMetaDataForUrl(const QUrl &)")
KPluginInfo::List listAppletInfoForUrl(const QUrl &url);
#endif
/** /**
* Returns a list of all known applets associated with a certain URL. * Returns a list of all known applets associated with a certain URL.
@ -423,11 +433,10 @@ protected:
* @param parent the parent object, if any, for the service * @param parent the parent object, if any, for the service
* *
* @return a Service object, unlike Plasma::Service::loadService, this can return null. * @return a Service object, unlike Plasma::Service::loadService, this can return null.
* @deprecated since 5.29 * @deprecated since 5.30, use KPackage API
**/ **/
#ifndef PLASMA_NO_DEPRECATED PLASMA_DEPRECATED_VERSION(5, 30, "Use KPackage API")
virtual PLASMA_DEPRECATED Package internalLoadPackage(const QString &name, const QString &specialization); virtual Package internalLoadPackage(const QString &name, const QString &specialization);
#endif
/** /**
* A re-implementable method that allows subclasses to provide additional applets * A re-implementable method that allows subclasses to provide additional applets

View File

@ -73,7 +73,15 @@ set_target_properties(KF5PlasmaQuick PROPERTIES
install(TARGETS KF5PlasmaQuick EXPORT KF5PlasmaQuickTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS KF5PlasmaQuick EXPORT KF5PlasmaQuickTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
generate_export_header(KF5PlasmaQuick BASE_NAME PlasmaQuick) ecm_generate_export_header(KF5PlasmaQuick
BASE_NAME PlasmaQuick
# 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.12 5.25 5.36
)
# TODO: add support for EXCLUDE_DEPRECATED_BEFORE_AND_AT to all Plasma libs
# needs fixing of undeprecated API being still implemented using own deprecated API
set(plasmaquick_LIB_INCLUDES set(plasmaquick_LIB_INCLUDES
${CMAKE_CURRENT_BINARY_DIR}/plasmaquick_export.h ${CMAKE_CURRENT_BINARY_DIR}/plasmaquick_export.h

View File

@ -101,11 +101,17 @@ public:
//Make the constructor lighter and delay the actual instantiation of the qml in the applet //Make the constructor lighter and delay the actual instantiation of the qml in the applet
virtual void init(); virtual void init();
PLASMA_DEPRECATED Plasma::Package appletPackage() const; #if PLASMAQUICK_ENABLE_DEPRECATED_SINCE(5, 36)
PLASMA_DEPRECATED void setAppletPackage(const Plasma::Package &package); PLASMAQUICK_DEPRECATED_VERSION(5, 36, "No longer use")
Plasma::Package appletPackage() const;
PLASMAQUICK_DEPRECATED_VERSION(5, 36, "No longer use")
void setAppletPackage(const Plasma::Package &package);
PLASMA_DEPRECATED Plasma::Package coronaPackage() const; PLASMAQUICK_DEPRECATED_VERSION(5, 36, "No longer use")
PLASMA_DEPRECATED void setCoronaPackage(const Plasma::Package &package); Plasma::Package coronaPackage() const;
PLASMAQUICK_DEPRECATED_VERSION(5, 36, "No longer use")
void setCoronaPackage(const Plasma::Package &package);
#endif
QQuickItem *compactRepresentationItem(); QQuickItem *compactRepresentationItem();
QQuickItem *fullRepresentationItem(); QQuickItem *fullRepresentationItem();

View File

@ -24,12 +24,15 @@
#include <plasmaquick/plasmaquick_export.h> #include <plasmaquick/plasmaquick_export.h>
#if PLASMAQUICK_ENABLE_DEPRECATED_SINCE(5, 25)
/** /**
* @deprecated, don't use * @deprecated Since 5.25, use Plasma::PluginLoader
*/ */
class PLASMAQUICK_DEPRECATED_EXPORT ShellPluginLoader : public Plasma::PluginLoader class PLASMAQUICK_EXPORT ShellPluginLoader : public Plasma::PluginLoader
{ {
public: public:
PLASMAQUICK_DEPRECATED_VERSION(5, 25, "Use PluginLoader")
ShellPluginLoader(); ShellPluginLoader();
~ShellPluginLoader() override; ~ShellPluginLoader() override;
@ -39,4 +42,6 @@ protected:
Plasma::Package internalLoadPackage(const QString &packageFormat, const QString &specialization) override; Plasma::Package internalLoadPackage(const QString &packageFormat, const QString &specialization) override;
}; };
#endif // PLASMAQUICK_ENABLE_DEPRECATED_SINCE(5, 25)
#endif #endif

View File

@ -36,13 +36,15 @@
// We mean it. // We mean it.
// //
#if PLASMAQUICK_ENABLE_DEPRECATED_SINCE(5, 12)
namespace PlasmaQuick namespace PlasmaQuick
{ {
class ViewPrivate; class ViewPrivate;
/** /**
* Deprecated, use ContainmentView instead. * @deprecated Since 5.12, use ContainmentView instead.
*/ */
class PLASMAQUICK_EXPORT View : public QQuickView class PLASMAQUICK_EXPORT View : public QQuickView
{ {
@ -56,77 +58,78 @@ public:
* @param corona the corona of this view * @param corona the corona of this view
* @param parent the QWindow this View is parented to * @param parent the QWindow this View is parented to
**/ **/
PLASMA_DEPRECATED explicit View(Plasma::Corona *corona, QWindow *parent = nullptr); PLASMAQUICK_DEPRECATED_VERSION(5, 12, "Use ContainmentView")
PLASMA_DEPRECATED virtual ~View(); explicit View(Plasma::Corona *corona, QWindow *parent = nullptr);
virtual ~View();
/** /**
* @return the corona of this view * @return the corona of this view
**/ **/
PLASMA_DEPRECATED Plasma::Corona *corona() const; Plasma::Corona *corona() const;
/** /**
* @return the KConfigGroup of this view * @return the KConfigGroup of this view
**/ **/
PLASMA_DEPRECATED virtual KConfigGroup config() const; virtual KConfigGroup config() const;
/** /**
* sets the containment for this view * sets the containment for this view
* @param cont the containment of this view * @param cont the containment of this view
**/ **/
PLASMA_DEPRECATED void setContainment(Plasma::Containment *cont); void setContainment(Plasma::Containment *cont);
/** /**
* @return the containment of this View * @return the containment of this View
**/ **/
PLASMA_DEPRECATED Plasma::Containment *containment() const; Plasma::Containment *containment() const;
/** /**
* @return the location of this View * @return the location of this View
**/ **/
PLASMA_DEPRECATED Plasma::Types::Location location() const; Plasma::Types::Location location() const;
/** /**
* Sets the location of the View * Sets the location of the View
* @param location the location of the View * @param location the location of the View
**/ **/
PLASMA_DEPRECATED void setLocation(Plasma::Types::Location location); void setLocation(Plasma::Types::Location location);
/** /**
* @return the formfactor of the View * @return the formfactor of the View
**/ **/
PLASMA_DEPRECATED Plasma::Types::FormFactor formFactor() const; Plasma::Types::FormFactor formFactor() const;
/** /**
* @return the screenGeometry of the View * @return the screenGeometry of the View
**/ **/
PLASMA_DEPRECATED QRectF screenGeometry(); QRectF screenGeometry();
protected Q_SLOTS: protected Q_SLOTS:
/** /**
* It will be called when the configuration is requested * It will be called when the configuration is requested
*/ */
PLASMA_DEPRECATED virtual void showConfigurationInterface(Plasma::Applet *applet); virtual void showConfigurationInterface(Plasma::Applet *applet);
Q_SIGNALS: Q_SIGNALS:
/** /**
* emitted when the location is changed * emitted when the location is changed
**/ **/
PLASMA_DEPRECATED void locationChanged(Plasma::Types::Location location); void locationChanged(Plasma::Types::Location location);
/** /**
* emitted when the formfactor is changed * emitted when the formfactor is changed
**/ **/
PLASMA_DEPRECATED void formFactorChanged(Plasma::Types::FormFactor formFactor); void formFactorChanged(Plasma::Types::FormFactor formFactor);
/** /**
* emitted when the containment is changed * emitted when the containment is changed
**/ **/
PLASMA_DEPRECATED void containmentChanged(); void containmentChanged();
/** /**
* emitted when the screenGeometry is changed * emitted when the screenGeometry is changed
**/ **/
PLASMA_DEPRECATED void screenGeometryChanged(); void screenGeometryChanged();
private: private:
ViewPrivate *const d; ViewPrivate *const d;
@ -136,4 +139,6 @@ private:
} }
#endif // PLASMAQUICK_ENABLE_DEPRECATED_SINCE(5, 12)
#endif // View_H #endif // View_H