UpdateSourcesInfo Class

(KDUpdater::UpdateSourcesInfo)

The UpdateSourcesInfo class provides access to information about the update sources set for the application. More...

Header: #include <UpdateSourcesInfo>
Inherits: QObject

Public Types

enum Error { NoError, NotYetReadError, CouldNotReadSourceFileError, InvalidXmlError, InvalidContentError, CouldNotSaveChangesError }

Public Functions

void addUpdateSourceInfo(const UpdateSourceInfo &info)
Error error() const
QString errorString() const
QString fileName() const
bool isModified() const
bool isValid() const
void removeUpdateSourceInfo(const UpdateSourceInfo &info)
void setFileName(const QString &fileName)
void setModified(bool modified)
UpdateSourceInfo updateSourceInfo(int index) const
int updateSourceInfoCount() const
  • 31 public functions inherited from QObject

Public Slots

void refresh()
  • 1 public slot inherited from QObject

Signals

void reset()
void updateSourceInfoAdded(const UpdateSourceInfo &info)
void updateSourceInfoRemoved(const UpdateSourceInfo &info)

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The UpdateSourcesInfo class provides access to information about the update sources set for the application.

An update source is a repository that contains updates applicable for the application. Applications can download updates from the update source and install them locally.

Each application can have one or more update sources from which it can download updates. Information about update source is stored in a file called UpdateSources.xml. This class helps access and modify the UpdateSources.xml file.

The complete file name of the UpdateSources.xml file can be specified via the setFileName() method. The class then parses the XML file and makes available information contained in that XML file through an easy to use API. You can:

The class emits appropriate signals to inform listeners about changes in the update application.

Member Type Documentation

enum UpdateSourcesInfo::Error

Error codes related to retrieving update sources.

ConstantValueDescription
KDUpdater::UpdateSourcesInfo::NoError0No error occurred.
KDUpdater::UpdateSourcesInfo::NotYetReadError1The update source information was not parsed yet from the XML file.
KDUpdater::UpdateSourcesInfo::CouldNotReadSourceFileError2The specified update source file could not be read (does not exist or is not readable).
KDUpdater::UpdateSourcesInfo::InvalidXmlError3The source file contains invalid XML.
KDUpdater::UpdateSourcesInfo::InvalidContentError4The source file contains valid XML, but does not match the expected format for source descriptions.
KDUpdater::UpdateSourcesInfo::CouldNotSaveChangesError5Changes made to the object could not be saved back to the source file.

Member Function Documentation

void UpdateSourcesInfo::addUpdateSourceInfo(const UpdateSourceInfo &info)

Adds the given update source info info to this class. Upon successful addition, the class emits an updateSourceInfoAdded() signal.

Error UpdateSourcesInfo::error() const

Returns the error that was found during the processing of the update sources XML file. If no error was found, returns NoError.

QString UpdateSourcesInfo::errorString() const

Returns a human-readable description of the last error that occurred.

QString UpdateSourcesInfo::fileName() const

Returns the name of the update sources XML file that this class refers to.

See also setFileName().

bool UpdateSourcesInfo::isModified() const

Returns the modified state of this object. The modified state defines if there where modifications done to the update-sources that need to be written to the updates XML file that will restore the update-sources on the next run.

bool UpdateSourcesInfo::isValid() const

Returns true if UpdateSourcesInfo is valid; otherwise returns false. You can use the errorString() method to receive a descriptive error message.

[slot] void UpdateSourcesInfo::refresh()

Reloads the update source information from update sources XML file.

void UpdateSourcesInfo::removeUpdateSourceInfo(const UpdateSourceInfo &info)

Removes the given update source info info from this class. Upon successful removal, the class emits an updateSourceInfoRemoved() signal.

[signal] void UpdateSourcesInfo::reset()

This signal is emitted whenever the contents of this UpdateSourcesInfo are refreshed, usually from within the refresh() slot.

void UpdateSourcesInfo::setFileName(const QString &fileName)

Sets the complete file name of the update sources XML file to fileName. The function also issues a call to refresh() to reload update sources from the XML file.

See also fileName() and KDUpdater::Application::setUpdateSourcesXMLFileName().

void UpdateSourcesInfo::setModified(bool modified)

Sets the modified state of the object to modified.

See also isModified().

UpdateSourceInfo UpdateSourcesInfo::updateSourceInfo(int index) const

Returns the update source info structure at index. If an invalid index is passed, the function returns a default-constructed value.

[signal] void UpdateSourcesInfo::updateSourceInfoAdded(const UpdateSourceInfo &info)

This signal is emitted when UpdateSourceInfo info is added.

int UpdateSourcesInfo::updateSourceInfoCount() const

Returns the number of update source info structures contained in this class.

[signal] void UpdateSourcesInfo::updateSourceInfoRemoved(const UpdateSourceInfo &info)

This signal is emitted when UpdateSourceInfo info is removed.

© 2016 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.