KCoreAddons
kpluginmetadata.h
140 * Reads the plugin metadata from a KPluginLoader instance. You must call KPluginLoader::setFileName()
148 * Reads the plugin metadata from a QPluginLoader instance. You must call QPluginLoader::setFileName()
175 * Overload which takes an option parameter that gets used when creating the KPluginMetaData instances
200 KPluginMetaData(const QJsonObject &metaData, const QString &pluginFile, const QString &metaDataFile);
231 * This ensures that a e.g. comma-separated string list field in the .desktop file will correctly
235 * that new applications load JSON files directly instead of using .desktop files for plugin metadata.
239 * will be resolved relative to the "kservicetypes5" subdirectory in QStandardPaths::GenericDataLocation.
240 * If the list is empty only the default set of properties will be treated specially and all other entries
247 static KPluginMetaData fromDesktopFile(const QString &file, const QStringList &serviceTypes = QStringList());
251 * Load a KPluginMetaData instance from a .json file. Unlike the constructor with a single file argument,
260 * @param directory The directory to search for plugins. If a relative path is given for @p directory,
261 * all entries of QCoreApplication::libraryPaths() will be checked with @p directory appended as a
265 * @param pluginId The Id of the plugin. The id should be the same as the filename, see KPluginMetaData::pluginId()
271 * Find all plugins inside @p directory. Only plugins which have JSON metadata will be considered.
273 * @param directory The directory to search for plugins. If a relative path is given for @p directory,
274 * all entries of QCoreApplication::libraryPaths() will be checked with @p directory appended as a
283 static QVector<KPluginMetaData> findPlugins(const QString &directory, std::function<bool(const KPluginMetaData &)> filter = {});
288 static QVector<KPluginMetaData> findPlugins(const QString &directory, std::function<bool(const KPluginMetaData &)> filter, KPluginMetaDataOption option);
334 * @see QPluginLoader::instance(), KPluginFactory::loadFactory, KPluginFactory::instantiatePlugin
335 * @deprecated Since 5.86, use @ref KPluginFactory::loadFactory or @ref KPluginFactory::instantiatePlugin when using
357 * @deprecated Since 5.87, deprecate for lack of usage. Use a meaningful custom key in the json metadata instead
359 KCOREADDONS_DEPRECATED_VERSION(5, 87, "Deprecate for lack of usage, use a meaningful custom key in the json metadata instead")
376 * @return a list of people that contributed to this plugin (other than the authors and translators).
441 KCOREADDONS_DEPRECATED_VERSION(5, 79, "Plugin dependencies are deprecated and will be removed in KF6")
451 * put all plugins of the same type in a subdirectory, that you can pass to findPlugins directly.
452 * No point in opening 20 plugins to pick out only 3, when the filesystem can do that filtering for you.
457 * @dprecated Since 5.89, use dedicated plugin namespaces instead to filter plugins of a specific type
464 * @return a list of MIME types this plugin can handle (e.g. "application/pdf", "image/png", etc.)
501 KCOREADDONS_DEPRECATED_VERSION(5, 104, "This feature is only used in KParts, read the key manually if needed")
506 * Returns @c true if the plugin is enabled in @p config, otherwise returns isEnabledByDefault().
535 KCOREADDONS_DEPRECATED_VERSION(5, 88, "Construct a QString instead of using a char array, otherwise there the bool overload could be chosen by accident")
556 /** @return the value for @p key from the metadata or @p defaultValue if the key does not exist.
565 /** @return the value for @p key inside @p jo as a string list. If the type of @p key is string, a list with containing
566 * just that string will be returned, if it is an array the list will contain one entry for each array member.
568 * @deprecated Since 5.88, use @p value(QString, QStringList) on KPluginMetaData instance instead
570 KCOREADDONS_DEPRECATED_VERSION(5, 88, "Use value(QString, QStringList) on KPluginMetaData instance instead")
576 * Reads a value from @p jo but unlike QJsonObject::value() it allows different entries for each locale
577 * This is done by appending the locale identifier in brackets to the key (e.g. "[de_DE]" or "[es]")
578 * When looking for a key "foo" with German (Germany) locale we will first attempt to read "foo[de_DE]",
584 static QJsonValue readTranslatedValue(const QJsonObject &jo, const QString &key, const QJsonValue &defaultValue = QJsonValue());
589 * @return the translated value of @p key from @p jo as a string or @p defaultValue if @p key was not found
595 static QString readTranslatedString(const QJsonObject &jo, const QString &key, const QString &defaultValue = QString());
622 KCOREADDONS_NO_EXPORT void loadFromDesktopFile(const QString &file, const QStringList &serviceTypes);
635 QExplicitlySharedDataPointer<KPluginMetaDataPrivate> d; // for future binary compatible extensions
Definition: kpluginfactory.h:427
bool operator!=(const KPluginMetaData &other) const
Definition: kpluginmetadata.h:606
KPluginMetaDataOption
Options for creating a KPluginMetaData object.
Definition: kpluginmetadata.h:130
Definition: kpluginloader.h:69
KCALENDARCORE_EXPORT uint qHash(const KCalendarCore::Period &key)
virtual QVariant rootObject()
KSharedConfigPtr config()
This class is used to store information about a person or developer.
Definition: kaboutdata.h:61
@ AllowEmptyMetaData
Plugins with empty metaData are considered valid.
Definition: kpluginmetadata.h:132
unsigned int version()
Returns a numerical version number of KCoreAddons at run-time in the form 0xMMNNPP (MM = major,...
Definition: kcoreaddons.cpp:18
QString fromLatin1(const char *str, int size)
bool isValid(QStringView ifopt)
QString name(StandardShortcut id)
QStringList mimeTypes(Mode mode=Writing)
@ DoNotAllowEmptyMetaData
Plugins with empty metaData are considered invalid.
Definition: kpluginmetadata.h:131
Definition: kpluginmetadata.h:87
Category category(StandardShortcut id)
bool isEnabled(const T &config) const
Returns true if the plugin is enabled in config, otherwise returns isEnabledByDefault().
Definition: kpluginmetadata.h:515
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Nov 28 2023 04:05:52 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Nov 28 2023 04:05:52 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.