LocalPackageHub Class
class KDUpdater::LocalPackageHubThe LocalPackageHub class provides access to information about packages installed on the application side. More...
Header: | #include <LocalPackageHub> |
Public Functions
LocalPackageHub() | |
~LocalPackageHub() | |
void | addPackage(const QString &name, const QString &version, const QString &title, const QPair<QString, bool> &treeName, const QString &description, const int sortingPriority, const QStringList &dependencies, const QStringList &autoDependencies, bool forcedInstallation, bool virtualComp, quint64 uncompressedSize, const QString &inheritVersionFrom, bool checkable, bool expandedByDefault, const QString &contentSha1) |
QString | applicationName() const |
QString | applicationVersion() const |
void | clearPackageInfos() |
KDUpdater::LocalPackageHub::Error | error() const |
QString | errorString() const |
QString | fileName() const |
bool | isValid() const |
QMap<QString, KDUpdater::LocalPackage> | localPackages() const |
KDUpdater::LocalPackage | packageInfo(const QString &pkgName) const |
int | packageInfoCount() const |
QList<KDUpdater::LocalPackage> | packageInfos() const |
QStringList | packageNames() const |
void | refresh() |
bool | removePackage(const QString &name) |
void | setApplicationName(const QString &name) |
void | setApplicationVersion(const QString &version) |
void | setFileName(const QString &fileName) |
void | writeToDisk() |
Detailed Description
This class parses the installation information XML file specified via the setFileName() method and provides access to the information defined within the file through an API. You can:
- Get the application name via the applicationName() method.
- Get the application version via the applicationVersion() method.
- Get information about the number of packages installed and their meta-data via the packageInfoCount() and packageInfo() methods.
Member Function Documentation
LocalPackageHub::LocalPackageHub()
Constructs a local package hub. To fully setup the class you have to call setFileName().
See also setFileName.
[noexcept]
LocalPackageHub::~LocalPackageHub()
Destructor
void LocalPackageHub::addPackage(const QString &name, const QString &version, const QString &title, const QPair<QString, bool> &treeName, const QString &description, const int sortingPriority, const QStringList &dependencies, const QStringList &autoDependencies, bool forcedInstallation, bool virtualComp, quint64 uncompressedSize, const QString &inheritVersionFrom, bool checkable, bool expandedByDefault, const QString &contentSha1)
Marks the package specified by name as installed. Sets the values of version, title, treeName, description, sortingPriority, dependencies, autoDependencies, forcedInstallation, virtualComp, uncompressedSize, inheritVersionFrom, checkable, expandedByDefault, and contentSha1 for the package.
QString LocalPackageHub::applicationName() const
Returns the application name.
See also setApplicationName().
QString LocalPackageHub::applicationVersion() const
Returns the application version.
See also setApplicationVersion().
void LocalPackageHub::clearPackageInfos()
Clears the installed package list.
KDUpdater::LocalPackageHub::Error LocalPackageHub::error() const
Returns the error that was found during the processing of the installation information XML file. If no error was found, returns NoError.
QString LocalPackageHub::errorString() const
Returns a human-readable description of the last error that occurred.
QString LocalPackageHub::fileName() const
Returns the name of the installation information XML file that this class refers to.
See also setFileName().
bool LocalPackageHub::isValid() const
Returns true
if LocalPackageHub is valid; otherwise returns false
. You can use the errorString() method to receive a descriptive error message.
QMap<QString, KDUpdater::LocalPackage> LocalPackageHub::localPackages() const
Returns a map of all local installed packages. Map key is the package name.
KDUpdater::LocalPackage LocalPackageHub::packageInfo(const QString &pkgName) const
Returns the package info structure whose name is pkgName. If no such package was found, this function returns a default-constructed value.
int LocalPackageHub::packageInfoCount() const
Returns the number of KDUpdater::LocalPackage objects contained in this class.
QList<KDUpdater::LocalPackage> LocalPackageHub::packageInfos() const
Returns all package info structures.
QStringList LocalPackageHub::packageNames() const
Returns a list of all local installed packages.
void LocalPackageHub::refresh()
Re-reads the installation information XML file and updates itself. Changes to applicationName() and applicationVersion() are lost after this function returns. The function emits a reset() signal after completion.
bool LocalPackageHub::removePackage(const QString &name)
Removes the package specified by name. Returns false
if the package is not found.
void LocalPackageHub::setApplicationName(const QString &name)
Sets the application name to name. By default, this is the name specified in the <ApplicationName>
element of the installation information XML file.
See also applicationName().
void LocalPackageHub::setApplicationVersion(const QString &version)
Sets the application version to version. By default, this is the version specified in the <ApplicationVersion>
element of the installation information XML file.
See also applicationVersion().
void LocalPackageHub::setFileName(const QString &fileName)
Sets the complete file name of the installation information XML file to fileName. The function also issues a call to refresh() to reload installation information from the XML file.
See also fileName().
void LocalPackageHub::writeToDisk()
Writes the installation information file to disk.
© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. The Qt Company, Qt and their respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.