The DbManager class is a singleton class to read and write transfers database. More...
#include <DbManager>
~DbManager () | |
QStringList | callback ( int key ) const |
bool | callbackMethods ( int key, QString & cancelMethod, QString & restartMethod ) const |
bool | clearTransfers () |
int | createCallbackEntry ( int key, const QString & service, const QString & path, const QString & interface, const QString & cancelMethod, const QString & restartMethod ) |
int | createMetadataEntry ( int key, const QString & title, const QString & description ) |
int | createTransferEntry ( MediaItem * mediaItem ) |
MediaItem * | mediaItem ( int key ) const |
bool | removeTransfer ( int key ) |
TransferEngineData::TransferStatus | transferStatus ( int key ) const |
TransferEngineData::TransferType | transferType ( int key ) const |
QList<TransferDBRecord> | transfers () const |
bool | updateProgress ( int key, qreal progress ) |
bool | updateTransferStatus ( int key, TransferEngineData::TransferStatus status ) |
DbManager * | instance () |
The DbManager class is a singleton class to read and write transfers database.
DbManager class takes care of reading and writing transfer database used by Nemo Transfer Engine. It's a singleton class and it can be instantiated using DbManager::instance() method.
Destructor.
Get a DBus callback interface and method for the transfer with key. If there is no callback for the key then an empty QStringList is returned.
In a case there is a DBus callback, then QStringList contains the following items:
Get the callback method names for the transfer with key. The method names are set to the output arguments cancelMethod and restartMethod.
This method returns true on success, false on failure.
Clear all finished, canceled or failed transfers from the database.
This method returns true on success, false on failure.
Create a callback entry to the callback table for the existing transfer with a key.
The callback is a dbus interface so it must contain the following attributes:
This method returns a key of the created callback record in a callback table or -1 on failure.
NOTE: Deleting the record from the transfer which has a key, also deletes related callback entry.
Create a metadata entry for the existing transfer with key. Metadata can contain only title and/or \description
.
Metadata entry will be created to the metadata table. Argument key must point to the existing entry in transfers table.
This method returns a key of the created record in metadata table or -1 on failure.
NOTE: Deleting the record from the transfer which has a key, also deletes related metadata entry.
Create a transfer entry to the transfers table bsaed on mediaItem content.
MediaItem instance contains all the required information for the single Upload, Download or a Sync item. Based on this information, DbManager creates a record to the transfers table, but also to the callback and metadata tables if these are defined.
This method returns a key of the created transfer or -1 on failure.
See also MediaItem.
Return a singleton instance of this DbManager. Note that caller is NOT responsible of deleting the instance. It will be deleted automatically when application stack is cleaned.
Returns a MediaItem instance from the transfer data with a key.
Remove an existing transfer with a key from the transfers table. If this transfer has metadata or callback defined, they will be removed too.
This method returns true on success, false on failure.
Returns the transfer status of the transfer with key. In a case of error the TransferEngineData::Unknown is returned.
Returns the transfer type e.g. Sync, Download or Upload of the transfer with a key.
If there is no transfer record with key or error occurs, this method returns TransferEngineData::Undefined.
Returns all the transfers from the database. This method doesn't fetch all the fields from all the tables, instead it returns what is required to fill fields in TransferDBRecord class.
Update a transfer progress of the existing transfer with key.
This method returns true on success, false on failure.
Update a transfer status of the existing transfer with key. Changing the status updates the timestamp too.
This method returns true on success, false on failure.