KPackage
package.cpp
74 if (metadata().isValid() && metadata().value(QStringLiteral("isHidden"), QStringLiteral("false")) == QLatin1String("true")) {
94 qCWarning(KPACKAGE_LOG) << "Could not find required" << (it.value().directory ? "directory" : "file") << it.key() << "for package" << path()
230 // qCWarning(KPACKAGE_LOG) << "Could not open package file, unsupported archive format:" << filePath << mimeType.name();
282 Q_ASSERT(tempRoot == QStringLiteral("/") || QDir(tempRoot).canonicalPath() + QLatin1Char('/') == tempRoot);
288 qCWarning(KPACKAGE_LOG) << "Path traversal attempt detected:" << canonicalPath << "is not inside" << path;
294 if (!d->valid && d->checkedValid) { // Don't check the validity here, because we'd have infinite recursion
321 // qCDebug(KPACKAGE_LOG) << "no matching path came of it, while looking for" << fileType << filename;
331 // qCDebug(KPACKAGE_LOG) << "prefixes:" << d->contentsPrefixPaths.count() << d->contentsPrefixPaths;
485 paths << QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, p, QStandardPaths::LocateDirectory);
524 const KPackage::Package fp = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Applet"), fallbackPath);
597 const QString metadataPath = QFile::exists(guessedMetaDataJson) ? guessedMetaDataJson : QString();
605 qCWarning(KPACKAGE_LOG) << "could not add" << f.fileName() << "to the hash; file could not be opened for reading.";
801void PackagePrivate::updateHash(const QString &basePath, const QString &subPath, const QDir &dir, QCryptographicHash &hash)
833 qCWarning(KPACKAGE_LOG) << "could not add" << f.fileName() << "to the hash; file could not be opened for reading. "
858 if (const QString jsonPath = path + QLatin1String("/metadata.json"); QFileInfo::exists(jsonPath)) {
891 if ((fastPackage->d->fallbackPackage->metadata().isValid() && fastPackage->d->fallbackPackage->metadata() == slowPackage->metadata())
892 || (fastPackage->d->fallbackPackage->d->fallbackPackage && fastPackage->d->fallbackPackage->d->fallbackPackage->metadata().isValid()
893 && fastPackage->d->fallbackPackage->d->fallbackPackage->metadata() == slowPackage->metadata())) {
894 qCWarning(KPACKAGE_LOG) << "Warning: the fallback chain of " << package.metadata().pluginId() << "contains a cyclical dependency.";
bool copyTo(const QString &dest, bool recursive=true) const
virtual bool open(QIODevice::OpenMode mode)
const KArchiveDirectory * directory() const
Package loadPackage(const QString &packageFormat, const QString &packagePath=QString())
Load a Package plugin.
Definition packageloader.cpp:51
This class is used to define the filesystem structure of a package type.
Definition packagestructure.h:38
void setContentsPrefixPaths(const QStringList &prefixPaths)
Sets the prefixes that all the contents in this package should appear under.
Definition package.cpp:568
QByteArray cryptographicHash(QCryptographicHash::Algorithm algorithm) const
Definition package.cpp:588
void setRequired(const QByteArray &key, bool required)
Sets whether or not a given part of the structure is required or not.
Definition package.cpp:678
void setMimeTypes(const QByteArray &key, const QStringList &mimeTypes)
Define mimeTypes for a given part of the structure The path must already have been added using addDir...
Definition package.cpp:698
void setPath(const QString &path)
Sets the path to the root of this package.
Definition package.cpp:439
QUrl fileUrl(const QByteArray &key, const QString &filename=QString()) const
Get the url to a given file based on the key and an optional filename, is the file:// or qrc:// forma...
Definition package.cpp:372
void addDirectoryDefinition(const QByteArray &key, const QString &path)
Adds a directory to the structure of the package.
Definition package.cpp:625
QStringList entryList(const QByteArray &key) const
Get the list of files of a given type.
Definition package.cpp:383
QList< QByteArray > requiredDirectories() const
Definition package.cpp:719
void setMetadata(const KPluginMetaData &data)
Sets the metadata for the KPackage.
Definition package.cpp:167
void addFileDefinition(const QByteArray &key, const QString &path)
Adds a file to the structure of the package.
Definition package.cpp:645
void setDefaultPackageRoot(const QString &packageRoot)
Sets preferred package root.
Definition package.cpp:133
QString filePath(const QByteArray &key, const QString &filename=QString()) const
Get the path to a given file based on the key and an optional filename.
Definition package.cpp:292
void setAllowExternalPaths(bool allow)
Sets whether or not external paths/symlinks can be followed by a package.
Definition package.cpp:173
KPackage::Package fallbackPackage() const
Definition package.cpp:153
void removeDefinition(const QByteArray &key)
Removes a definition from the structure of the package.
Definition package.cpp:665
QStringList contentsPrefixPaths() const
Definition package.cpp:563
void setFallbackPackage(const KPackage::Package &package)
Sets the fallback package root path If a file won't be found in this package, it will search it in th...
Definition package.cpp:142
QStringList mimeTypes(const QByteArray &key) const
Definition package.cpp:114
void setDefaultMimeTypes(const QStringList &mimeTypes)
Defines the default mimeTypes for any definitions that do not have associated mimeTypes.
Definition package.cpp:692
QString pluginId() const
bool value(QStringView key, bool defaultValue) const
bool isValid() const
static KPluginMetaData fromJsonFile(const QString &jsonFile)
QString path(const QString &relativePath)
KIOCORE_EXPORT QString dir(const QString &fileClass)
bool isEmpty() const const
QByteArray toHex(char separator) const const
Algorithm
bool addData(QIODevice *device)
QByteArray result() const const
Dirs
SortFlags
bool isRelativePath(const QString &path)
QChar separator()
bool exists() const const
virtual QString fileName() const const override
bool open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags)
virtual bool atEnd() const const override
QString canonicalFilePath() const const
bool exists() const const
bool exists(const QString &path)
bool isDir() const const
bool isFile() const const
QByteArray read(qint64 maxSize)
ReadOnly
bool isEmpty() const const
T value(qsizetype i) const const
QMimeType mimeTypeForFile(const QFileInfo &fileInfo, MatchMode mode) const const
LocateDirectory
GenericDataLocation
QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options)
QString & append(QChar ch)
void chop(qsizetype n)
bool endsWith(QChar c, Qt::CaseSensitivity cs) const const
QString fromLatin1(QByteArrayView str)
QString fromUtf8(QByteArrayView str)
bool isEmpty() const const
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
QByteArray toUtf8() const const
QString path() const const
void setAutoRemove(bool b)
QUrl fromLocalFile(const QString &localFile)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:13:38 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:13:38 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.