| backend.h | | backend.h | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| */ | | */ | |
| namespace QApt { | | namespace QApt { | |
| | | | |
| class BackendPrivate; | | class BackendPrivate; | |
| | | | |
| /** | | /** | |
| * @brief The main entry point for performing operations with the dpkg data
base | | * @brief The main entry point for performing operations with the dpkg data
base | |
| * | | * | |
| * Backend encapsulates all the needed logic to perform most apt operations
. | | * Backend encapsulates all the needed logic to perform most apt operations
. | |
| * It implements the initializing of the database and all requests to/for t
he | | * It implements the initializing of the database and all requests to/for t
he | |
|
| * database. Please note that you \b _MUST_ call init() before doing any | | * database. Please note that you @e MUST call init() before doing any | |
| * further operations to the backend, or else risk encountering undefined | | * further operations to the backend, or else risk encountering undefined | |
| * behavior. | | * behavior. | |
| * | | * | |
| * @author Jonathan Thomas | | * @author Jonathan Thomas | |
| */ | | */ | |
| class Q_DECL_EXPORT Backend : public QObject | | class Q_DECL_EXPORT Backend : public QObject | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| public: | | public: | |
| /** | | /** | |
| | | | |
| skipping to change at line 137 | | skipping to change at line 137 | |
| * Note that if a package with a given name cannot be found, a null poi
nter | | * Note that if a package with a given name cannot be found, a null poi
nter | |
| * will be returned. Also, please note that certain actions like reload
ing | | * will be returned. Also, please note that certain actions like reload
ing | |
| * the cache may invalidate the pointer. | | * the cache may invalidate the pointer. | |
| * | | * | |
| * @param name name used to specify the package returned | | * @param name name used to specify the package returned | |
| * | | * | |
| * @return A pointer to a @c Package defined by the specified name | | * @return A pointer to a @c Package defined by the specified name | |
| */ | | */ | |
| Package *package(const QString &name) const; | | Package *package(const QString &name) const; | |
| | | | |
|
| | | /** Overload for package(const QString &name) **/ | |
| | | Package *package(const QLatin1String &name) const; | |
| | | | |
| /** | | /** | |
| * Queries the backend for a Package object that installs the specified | | * Queries the backend for a Package object that installs the specified | |
| * file. | | * file. | |
| * | | * | |
| * @b _WARNING_ : | | * @b _WARNING_ : | |
| * Note that if a package with a given name cannot be found, a null poi
nter | | * Note that if a package with a given name cannot be found, a null poi
nter | |
| * will be returned. Also, please note that certain actions like reload
ing | | * will be returned. Also, please note that certain actions like reload
ing | |
| * the cache may invalidate the pointer. | | * the cache may invalidate the pointer. | |
| * | | * | |
| * @param file The file used to search for the package | | * @param file The file used to search for the package | |
| | | | |
| skipping to change at line 289 | | skipping to change at line 292 | |
| */ | | */ | |
| PackageList markedPackages() const; | | PackageList markedPackages() const; | |
| | | | |
| /** | | /** | |
| * A quick search that uses the APT Xapian index to search for packages | | * A quick search that uses the APT Xapian index to search for packages | |
| * that match the given search string. While it is quite fast in 95% of | | * that match the given search string. While it is quite fast in 95% of | |
| * all cases, the relevancy of its results may in some cases not be 100
% | | * all cases, the relevancy of its results may in some cases not be 100
% | |
| * accurate. Irrelevant results may slip in, and some relevant results | | * accurate. Irrelevant results may slip in, and some relevant results | |
| * may be cut. | | * may be cut. | |
| * | | * | |
|
| | | * You @e must call the openXapianIndex() function before search will w | |
| | | ork | |
| | | * | |
| * In the future, a "slow" search that searches by exact matches for | | * In the future, a "slow" search that searches by exact matches for | |
| * certain parameters will be implemented. | | * certain parameters will be implemented. | |
| * | | * | |
| * @param searchString The string to narrow the search by. | | * @param searchString The string to narrow the search by. | |
| * | | * | |
| * \return A @c PackageList of all packages matching the search string. | | * \return A @c PackageList of all packages matching the search string. | |
|
| | | * | |
| | | * @see openXapianIndex() | |
| */ | | */ | |
| PackageList search(const QString &searchString) const; | | PackageList search(const QString &searchString) const; | |
| | | | |
| /** | | /** | |
| * Returns a list of all available groups | | * Returns a list of all available groups | |
| * | | * | |
| * \return A @c GroupList of all available groups in the Apt database | | * \return A @c GroupList of all available groups in the Apt database | |
| */ | | */ | |
| GroupList availableGroups() const; | | GroupList availableGroups() const; | |
| | | | |
| /** | | /** | |
| * Returns whether the search index needs updating | | * Returns whether the search index needs updating | |
|
| | | * | |
| | | * @see updateXapianIndex() | |
| */ | | */ | |
| bool xapianIndexNeedsUpdate() const; | | bool xapianIndexNeedsUpdate() const; | |
| | | | |
| /** | | /** | |
| * Attempts to open the APT Xapian index, needed for searching | | * Attempts to open the APT Xapian index, needed for searching | |
| * | | * | |
| * \returns true if opening was successful | | * \returns true if opening was successful | |
| * \returns false otherwise | | * \returns false otherwise | |
| */ | | */ | |
| bool openXapianIndex(); | | bool openXapianIndex(); | |
| | | | |
|
| | | /** | |
| | | * Returns whether there are packages with marked changes waiting to be | |
| | | * committed | |
| | | */ | |
| | | bool areChangesMarked() const; | |
| | | | |
| /** | | /** | |
| * Returns whether the cache has broken packages or has a null dependen
cy | | * Returns whether the cache has broken packages or has a null dependen
cy | |
| * cache | | * cache | |
| */ | | */ | |
| bool isBroken() const; | | bool isBroken() const; | |
| | | | |
| protected: | | protected: | |
| BackendPrivate *const d_ptr; | | BackendPrivate *const d_ptr; | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 357 | | skipping to change at line 372 | |
| | | | |
| Package *package(pkgCache::PkgIterator &iter) const; | | Package *package(pkgCache::PkgIterator &iter) const; | |
| | | | |
| void throwInitError(); | | void throwInitError(); | |
| | | | |
| Q_SIGNALS: | | Q_SIGNALS: | |
| /** | | /** | |
| * Emitted whenever a backend error occurs. You should listen to this | | * Emitted whenever a backend error occurs. You should listen to this | |
| * signal and present the error/clean up when your app receives it. | | * signal and present the error/clean up when your app receives it. | |
| * | | * | |
|
| * @param error QApt::ErrorCode enum member indicating error type | | * @param error @c ErrorCode enum member indicating error type | |
| * @param details A QVariant map containing info about the error, if | | * @param details A @c QVariantMap containing containing info about th | |
| | | e error, if | |
| * available | | * available | |
| */ | | */ | |
| void errorOccurred(QApt::ErrorCode error, const QVariantMap &details); | | void errorOccurred(QApt::ErrorCode error, const QVariantMap &details); | |
| | | | |
| /** | | /** | |
| * Emitted whenever a backend warning occurs. You should listen to this | | * Emitted whenever a backend warning occurs. You should listen to this | |
| * signal and present the warning when your app receives it. | | * signal and present the warning when your app receives it. | |
| * | | * | |
|
| * @param error QApt::WarningCode enum member indicating error type | | * @param error @c WarningCode enum member indicating error type | |
| * @param details A QVariant map containing info about the warning, if | | * @param details A @c QVariantMap containing info about the warning, | |
| | | if | |
| * available | | * available | |
| */ | | */ | |
| void warningOccurred(QApt::WarningCode warning, const QVariantMap &deta
ils); | | void warningOccurred(QApt::WarningCode warning, const QVariantMap &deta
ils); | |
| | | | |
| /** | | /** | |
| * Emitted whenever the worker asks a question. You should listen to th
is | | * Emitted whenever the worker asks a question. You should listen to th
is | |
| * signal and present the question to the user when your app receives i
t. | | * signal and present the question to the user when your app receives i
t. | |
| * | | * | |
| * You should send the response back to the worker as a QVariantMap | | * You should send the response back to the worker as a QVariantMap | |
| * using the Backend's answerWorkerQuestion() function. | | * using the Backend's answerWorkerQuestion() function. | |
| * | | * | |
|
| * @param question A QApt::WorkerQuestion enum member indicating questi | | * @param question A @c QApt::WorkerQuestion enum member indicating que | |
| on type | | stion type | |
| * @param details A QVariant map containing info about the question, if | | * @param details A @c QVariantMap containing info about the question, | |
| available | | if available | |
| | | * | |
| | | * @see answerWorkerQuestion() | |
| */ | | */ | |
| void questionOccurred(QApt::WorkerQuestion question, const QVariantMap
&details); | | void questionOccurred(QApt::WorkerQuestion question, const QVariantMap
&details); | |
| | | | |
| /** | | /** | |
| * Emitted whenever a package changes state. Useful for knowning when t
o | | * Emitted whenever a package changes state. Useful for knowning when t
o | |
| * react to state changes. | | * react to state changes. | |
| */ | | */ | |
| void packageChanged(); | | void packageChanged(); | |
| | | | |
| /** | | /** | |
| * Emitted whenever a backend event occurs. | | * Emitted whenever a backend event occurs. | |
| * | | * | |
|
| * @param event A QApt::WorkerEvent enum member indicating event type | | * @param event A @c WorkerEvent enum member indicating event type | |
| */ | | */ | |
| void workerEvent(QApt::WorkerEvent event); | | void workerEvent(QApt::WorkerEvent event); | |
| | | | |
| /** | | /** | |
| * Emits total progress information while the QApt Worker is downloadin
g | | * Emits total progress information while the QApt Worker is downloadin
g | |
| * packages. | | * packages. | |
| * | | * | |
| * @param percentage Total percent complete | | * @param percentage Total percent complete | |
| * @param speed Current download speed in bytes | | * @param speed Current download speed in bytes | |
| * @param ETA Current estimated download time | | * @param ETA Current estimated download time | |
| | | | |
| skipping to change at line 521 | | skipping to change at line 538 | |
| | | | |
| /** | | /** | |
| * Marks a package for removal. | | * Marks a package for removal. | |
| * | | * | |
| * @param name The name of the package to be removed | | * @param name The name of the package to be removed | |
| */ | | */ | |
| void markPackageForRemoval(const QString &name); | | void markPackageForRemoval(const QString &name); | |
| | | | |
| /** | | /** | |
| * Commits all pending package state changes that have been made. | | * Commits all pending package state changes that have been made. | |
|
| | | * | |
| | | * This function is asynchronous. Events from the worker that | |
| | | * occur while committing changes can be tracked with the workerEvent() | |
| | | * signal. | |
| | | * | |
| | | * Commit progress can be tracked with the commitProgress() signal | |
| | | * | |
| | | * @see workerEvent() | |
| | | * @see commitProgress() | |
| */ | | */ | |
| void commitChanges(); | | void commitChanges(); | |
| | | | |
| /** | | /** | |
| * A slot that Packages use to tell the backend they've changed. | | * A slot that Packages use to tell the backend they've changed. | |
| * (Used internally by QApt::Package. You likely will never use this) | | * (Used internally by QApt::Package. You likely will never use this) | |
| */ | | */ | |
| void packageChanged(Package *package); | | void packageChanged(Package *package); | |
| | | | |
| /** | | /** | |
| * Checks for and downloads new package source lists. | | * Checks for and downloads new package source lists. | |
|
| | | * | |
| | | * This function is asynchronous. Worker events that occur while | |
| | | * donwloading cache files can be tracked with the workerEvent() signal | |
| | | . | |
| | | * | |
| | | * Overall download progress can be tracked by the downloadProgress() | |
| | | * signal, and per-package download progress can be tracked by the | |
| | | * packageDownloadProgress() signal. | |
| | | * | |
| | | * @see workerEvent() | |
| | | * @see downloadProgress() | |
| | | * @see packageDownloadProgress() | |
| */ | | */ | |
| void updateCache(); | | void updateCache(); | |
| | | | |
| /** | | /** | |
|
| * Cancels download operations initialized by the updateCache() or | | * Cancels download operations in the worker initialized by the | |
| * commitChanges() functions. | | * updateCache() or commitChanges() functions. This function | |
| | | * will only have an effect if a download operation is in progress. | |
| | | * The actual committing of changes cannot be canceled once in progress | |
| | | . | |
| | | * | |
| | | * This function is asynchronous. The backend will report a | |
| | | * \c UserCancelError using the errorOccurred() signal | |
| | | * | |
| | | * @see errorOccurred() | |
| */ | | */ | |
| void cancelDownload(); | | void cancelDownload(); | |
| | | | |
| /** | | /** | |
| * This function should be used to return the answer the user has given | | * This function should be used to return the answer the user has given | |
|
| * to a worker question. | | * to a worker question delivered by the questionOccurred() signal | |
| | | * | |
| | | * @see questionOccurred() | |
| */ | | */ | |
| void answerWorkerQuestion(const QVariantMap &response); | | void answerWorkerQuestion(const QVariantMap &response); | |
| | | | |
| /** | | /** | |
| * Exports a list of all packages currently installed on the system. Th
is | | * Exports a list of all packages currently installed on the system. Th
is | |
| * list can be read by the readSelections() function or by Synaptic. | | * list can be read by the readSelections() function or by Synaptic. | |
| * | | * | |
| * @param path The path to save the selection list to | | * @param path The path to save the selection list to | |
| * | | * | |
| * \return @c true if saving succeeded | | * \return @c true if saving succeeded | |
| * \return @c false if the saving failed | | * \return @c false if the saving failed | |
| * | | * | |
| * @since 1.1 | | * @since 1.1 | |
|
| | | * | |
| | | * @see loadSelections() | |
| | | * @see saveSelections() | |
| */ | | */ | |
| bool saveInstalledPackagesList(const QString &path) const; | | bool saveInstalledPackagesList(const QString &path) const; | |
| | | | |
| /** | | /** | |
| * Writes a list of packages that have been marked for install, removal
or | | * Writes a list of packages that have been marked for install, removal
or | |
| * upgrade. | | * upgrade. | |
| * | | * | |
| * @param path The path to save the selection list to | | * @param path The path to save the selection list to | |
| * | | * | |
| * \return @c true if saving succeeded | | * \return @c true if saving succeeded | |
| * \return @c false if the saving failed | | * \return @c false if the saving failed | |
|
| | | * | |
| | | * @see saveInstalledPackagesList() | |
| | | * @see loadSelections() | |
| */ | | */ | |
| bool saveSelections(const QString &path) const; | | bool saveSelections(const QString &path) const; | |
| | | | |
| /** | | /** | |
| * Reads and applies selections from a text file generated from either | | * Reads and applies selections from a text file generated from either | |
| * saveSelections() or from Synaptic | | * saveSelections() or from Synaptic | |
| * | | * | |
| * @param path The path from which to read the selection list | | * @param path The path from which to read the selection list | |
| * | | * | |
| * \return @c true if reading/marking succeeded | | * \return @c true if reading/marking succeeded | |
| * \return @c false if the reading/marking failed | | * \return @c false if the reading/marking failed | |
|
| | | * | |
| | | * @see saveSelections() | |
| | | * @see saveInstalledPackagesList() | |
| */ | | */ | |
| bool loadSelections(const QString &path); | | bool loadSelections(const QString &path); | |
| | | | |
|
| | | /** | |
| | | * Tells the QApt Worker to initiate a rebuild of the Xapian package sea | |
| | | rch | |
| | | * index. | |
| | | * | |
| | | * This function is asynchronous. The worker will report start and finis | |
| | | h | |
| | | * events using the workerEvent() signal. Progress is reported by the | |
| | | * xapianUpdateProgress() signal. | |
| | | * | |
| | | * @see workerEvent() | |
| | | * @see xapianUpdateProgress() | |
| | | * @see xapianIndexNeedsUpdate() | |
| | | */ | |
| void updateXapianIndex(); | | void updateXapianIndex(); | |
| | | | |
| private Q_SLOTS: | | private Q_SLOTS: | |
| void serviceOwnerChanged(const QString &name, const QString &oldOwner,
const QString &newOwner); | | void serviceOwnerChanged(const QString &name, const QString &oldOwner,
const QString &newOwner); | |
| void workerStarted(); | | void workerStarted(); | |
| void workerFinished(bool result); | | void workerFinished(bool result); | |
| | | | |
| void emitErrorOccurred(int errorCode, const QVariantMap &details); | | void emitErrorOccurred(int errorCode, const QVariantMap &details); | |
| void emitWarningOccurred(int warningCode, const QVariantMap &details); | | void emitWarningOccurred(int warningCode, const QVariantMap &details); | |
| void emitWorkerEvent(int event); | | void emitWorkerEvent(int event); | |
| | | | |
End of changes. 18 change blocks. |
| 13 lines changed or deleted | | 87 lines changed or added | |
|
| package.h | | package.h | |
| | | | |
| skipping to change at line 316 | | skipping to change at line 316 | |
| * Returns whether the Package is installed | | * Returns whether the Package is installed | |
| */ | | */ | |
| bool isInstalled() const; | | bool isInstalled() const; | |
| | | | |
| /** | | /** | |
| * Returns whether the package is supported by Canonical | | * Returns whether the package is supported by Canonical | |
| */ | | */ | |
| bool isSupported() const; | | bool isSupported() const; | |
| | | | |
| /** | | /** | |
|
| * Returns a list of the names of all the dependencies of this package. | | * Returns a display-ready list of the names of all the dependencies of
this package. | |
| * | | * | |
|
| * \return A list of packages that this package depends on | | * \return A \c QStringList of packages that this package depends on | |
| */ | | */ | |
| QStringList dependencyList(bool useCandidateVersion) const; | | QStringList dependencyList(bool useCandidateVersion) const; | |
| | | | |
| /** | | /** | |
| * Returns a list of the names of all the packages that depend on this | | * Returns a list of the names of all the packages that depend on this | |
| * package. (Reverse dependencies) | | * package. (Reverse dependencies) | |
| * | | * | |
|
| * \return A list of packages that depend on this package | | * \return A \c QStringList of packages that depend on this package | |
| */ | | */ | |
| QStringList requiredByList() const; | | QStringList requiredByList() const; | |
| | | | |
| /** | | /** | |
| * Returns a list of the names of all the virtual packages that this pac
kage | | * Returns a list of the names of all the virtual packages that this pac
kage | |
| * provides. | | * provides. | |
| * | | * | |
|
| * \return A list of packages that this package provides | | * \return A \c QStringList of packages that this package provides | |
| */ | | */ | |
| QStringList providesList() const; | | QStringList providesList() const; | |
| | | | |
| /** | | /** | |
|
| | | * Returns a list of the names of all the packages that this package rec | |
| | | ommends. | |
| | | * | |
| | | * \return A \c QStringList of packages that this package recommends | |
| | | */ | |
| | | QStringList recommendsList() const; | |
| | | | |
| | | /** | |
| | | * Returns a list of the names of all the packages that this package sug | |
| | | gests. | |
| | | * | |
| | | * \return A \c QStringList of packages that this package suggests | |
| | | */ | |
| | | QStringList suggestsList() const; | |
| | | | |
| | | /** | |
| | | * Returns a list of the names of all the packages that this package enh | |
| | | ances. | |
| | | * | |
| | | * \return A \c QStringList of packages that this package enhances | |
| | | */ | |
| | | QStringList enhancesList() const; | |
| | | | |
| | | /** | |
| | | * Returns a list of the names of all the packages that enhance this pac | |
| | | kage. | |
| | | * | |
| | | * \return A \c QStringList of packages that enhance this package | |
| | | */ | |
| | | QStringList enhancedByList() const; | |
| | | | |
| | | /** | |
| * If a package is in a broke state, this function returns why the packa
ge | | * If a package is in a broke state, this function returns why the packa
ge | |
| * is broken by showing all errors in the dependency cache that marking
the | | * is broken by showing all errors in the dependency cache that marking
the | |
| * package has caused. | | * package has caused. | |
| * | | * | |
| * The format is a bit complex. The QHash contains a QHash corresponding
to | | * The format is a bit complex. The QHash contains a QHash corresponding
to | |
| * each QApt::BrokenReason. This internal QHash is a QString correspondi
ng to | | * each QApt::BrokenReason. This internal QHash is a QString correspondi
ng to | |
| * a QVariantMap. The QString in this case is a package that is broken b
y this | | * a QVariantMap. The QString in this case is a package that is broken b
y this | |
| * QApt::Package, and the QVariantMap contails details on why the corres
ponding | | * QApt::Package, and the QVariantMap contails details on why the corres
ponding | |
| * package is broken. These details may vary based on what QApt::BrokenS
tate | | * package is broken. These details may vary based on what QApt::BrokenS
tate | |
| * the QHash corresponds to. | | * the QHash corresponds to. | |
| | | | |
End of changes. 5 change blocks. |
| 4 lines changed or deleted | | 36 lines changed or added | |
|