KCoreAddons
kpluginmetadata.cpp
37 KPluginMetaDataPrivate(const QJsonObject &obj, const QString &fileName, KPluginMetaData::KPluginMetaDataOptions options = {})
46 // If we want to load a file, but it does not exist we want to keep the requested file name for logging
56 static void forEachPlugin(const QString &directory, std::function<void(const QFileInfo &)> callback)
83 QString prefix(QLatin1String("libplugins_") + QString(directory).replace(QLatin1Char('/'), QLatin1String("_")));
105 ofStaticPlugin(const QString &pluginNamespace, const QString &fileName, KPluginMetaData::KPluginMetaDataOptions options, QStaticPlugin plugin)
108 auto d = new KPluginMetaDataPrivate(plugin.metaData().value(QLatin1String("MetaData")).toObject(), pluginPath, options);
127 static KPluginMetaDataPrivate *ofPath(const QString &path, KPluginMetaData::KPluginMetaDataOptions options)
135 qCDebug(KCOREADDONS_DEBUG) << "no metadata found in" << loader.fileName() << loader.errorString();
172 qCDebug(KCOREADDONS_DEBUG) << "plugin metadata in" << pluginFile << "does not have a valid 'MetaData' object";
177 << "explicitly states an Id in the embedded metadata, which is different from the one derived from the filename"
187 : d(new KPluginMetaDataPrivate(loader.metaData().value(QLatin1String("MetaData")).toObject(), loader.fileName(), options))
206KPluginMetaData KPluginMetaData::findPluginById(const QString &directory, const QString &pluginId, KPluginMetaDataOptions options)
218 KPluginMetaData data = KPluginMetaDataPrivate::ofStaticPlugin(directory, pluginId, options, staticOptional.value());
253KPluginMetaData::findPlugins(const QString &directory, std::function<bool(const KPluginMetaData &)> filter, KPluginMetaDataOptions options)
258 KPluginMetaData metaData = KPluginMetaDataPrivate::ofStaticPlugin(directory, it.key(), options, it.value());
266 const qint64 nowTs = QDateTime::currentMSecsSinceEpoch(); // For the initial load, stating all files is not needed
274 const auto it = std::find_if(cache.begin(), cache.end(), [&pluginFile](const KPluginMetaData &data) {
313 return !pluginId().isEmpty() && (!d->m_metaData.isEmpty() || d->m_options.testFlags(AllowEmptyMetaData));
325 qCWarning(KCOREADDONS_DEBUG) << "Invalid plugin metadata: Attempting to create a KAboutPerson from JSON without 'Name' property:" << obj;
469 qCWarning(KCOREADDONS_DEBUG) << "Expected JSON property" << key << "in" << d->m_fileName << "to be a single string, but it is an array";
531 qCWarning(KCOREADDONS_DEBUG) << "Expected JSON property" << key << "to be a string list, instead an object was specified in" << d->m_fileName;
576 debug.nospace() << "KPluginMetaData(pluginId:" << metaData.pluginId() << ", fileName: " << metaData.fileName() << ')';
static KAboutLicense byKeyword(const QString &keyword)
Fetch a known license by a keyword/spdx ID.
Definition kaboutdata.cpp:372
This class is used to store information about a person or developer.
Definition kaboutdata.h:64
static KAboutPerson fromJSON(const QJsonObject &obj)
Creates a KAboutPerson from a JSON object with the following structure:
Definition kaboutdata.cpp:94
This class allows easily accessing some standardized values from the JSON metadata that can be embedd...
Definition kpluginmetadata.h:82
QString value(QStringView key, const QString &defaultValue=QString()) const
Definition kpluginmetadata.cpp:463
KPluginMetaData & operator=(const KPluginMetaData &)
Copy assignment.
Definition kpluginmetadata.cpp:155
static QList< KPluginMetaData > findPlugins(const QString &directory, std::function< bool(const KPluginMetaData &)> filter={}, KPluginMetaDataOptions options={})
Find all plugins inside directory.
Definition kpluginmetadata.cpp:253
bool operator==(const KPluginMetaData &other) const
Definition kpluginmetadata.cpp:551
static KPluginMetaData fromJsonFile(const QString &jsonFile)
Load a KPluginMetaData instance from a .json file.
Definition kpluginmetadata.cpp:226
static KPluginMetaData findPluginById(const QString &directory, const QString &pluginId, KPluginMetaDataOptions options={})
Definition kpluginmetadata.cpp:206
bool supportsMimeType(const QString &mimeType) const
Definition kpluginmetadata.cpp:423
@ AllowEmptyMetaData
Plugins with empty metaData are considered valid.
Definition kpluginmetadata.h:112
QString path(const QString &relativePath)
Absolute libexec path resolved in relative relation to the current shared object.
Definition klibexec.h:48
const QList< QKeySequence > & replace()
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
QChar fromLatin1(char c)
QString applicationDirPath()
QStringList libraryPaths()
qint64 currentMSecsSinceEpoch()
qint64 toMSecsSinceEpoch() const const
QDebug & nospace()
Files
bool isAbsolutePath(const QString &path)
bool open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags)
QString absoluteFilePath() const const
QDateTime lastModified() const const
bool testFlags(QFlags< T > flags) const const
QByteArray readAll()
ReadOnly
QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error)
QJsonObject object() const const
bool isEmpty() const const
QJsonValue value(QLatin1StringView key) const const
bool isArray() const const
bool isBool() const const
bool isObject() const const
bool isString() const const
QJsonArray toArray() const const
bool toBool(bool defaultValue) const const
QJsonObject toObject() const const
QString toString() const const
bool isLibrary(const QString &fileName)
void append(QList< T > &&value)
iterator begin()
iterator end()
void prepend(parameter_type value)
bool removeOne(const AT &t)
QMimeType mimeTypeForName(const QString &nameOrAlias) const const
bool isValid() const const
QString errorString() const const
void setFileName(const QString &fileName)
bool load()
QJsonObject metaData() const const
bool contains(const QSet< T > &other) const const
QJsonObject metaData() const const
bool isEmpty() const const
bool isNull() const const
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
int toInt(bool *ok, int base) const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.