UpdateSourcesInfo Class
(KDUpdater::UpdateSourcesInfo)The UpdateSourcesInfo class provides access to information about the update sources set for the application. More...
Header: | #include <UpdateSourcesInfo> |
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 |
Public Slots
void | refresh() |
Signals
void | reset() |
void | updateSourceInfoAdded(const UpdateSourceInfo &info) |
void | updateSourceInfoRemoved(const UpdateSourceInfo &info) |
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:
- Get update sources information via the updateSourceInfoCount() and updateSourceInfo() methods.
- Add or remove update source information via the addUpdateSourceInfo() and removeUpdateSourceInfo() methods.
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.
Constant | Value | Description |
---|---|---|
KDUpdater::UpdateSourcesInfo::NoError | 0 | No error occurred. |
KDUpdater::UpdateSourcesInfo::NotYetReadError | 1 | The update source information was not parsed yet from the XML file. |
KDUpdater::UpdateSourcesInfo::CouldNotReadSourceFileError | 2 | The specified update source file could not be read (does not exist or is not readable). |
KDUpdater::UpdateSourcesInfo::InvalidXmlError | 3 | The source file contains invalid XML. |
KDUpdater::UpdateSourcesInfo::InvalidContentError | 4 | The source file contains valid XML, but does not match the expected format for source descriptions. |
KDUpdater::UpdateSourcesInfo::CouldNotSaveChangesError | 5 | Changes 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.