Commit ff6c5eb6 authored by pvuorela's avatar pvuorela

Merge branch 'master' into 'master'

Progress support on notifications

See merge request !4
parents ec3b91ce 2cf8a6d3
TEMPLATE = aux
notification_categories.path = /usr/share/lipstick/notificationcategories
notification_categories.files = notificationcategories/*.conf
INSTALLS += notification_categories
appIcon=icon-lock-transfer
x-nemo-icon=icon-lock-transfer
urgency=1
appIcon=icon-lock-transfer
x-nemo-icon=icon-lock-transfer
transient=true
urgency=1
......@@ -416,7 +416,7 @@ QSqlDatabase TransferModel::database()
TransferDatabase database;
database.setDatabaseName(absDbPath);
database.setConnectOptions(QLatin1String("QSQLITE_OPEN_READONLY")); // sanity check
thread_database.setLocalData(database);
thread_database.setLocalData(database);
}
QSqlDatabase &database = thread_database.localData();
......
......@@ -63,10 +63,10 @@ share functionality implementation depends on the client e.g. if it's HW specifi
such as Facebook. Each plugin must implement or use the following interface:
\list
\o \l {TransferPluginInterface} Share plugin must implement this interface
\o \l {MediaTransferInterface} Share plugin must implement this interface
\o \l {TransferPluginInfo} Share plugin must provide information about plugin using this class
\o \l {TransferMethodInfo} Share plugin must provide information about e.g. accounts using this class
\li \l {TransferPluginInterface} Share plugin must implement this interface
\li \l {MediaTransferInterface} Share plugin must implement this interface
\li \l {TransferPluginInfo} Share plugin must provide information about plugin using this class
\li \l {TransferMethodInfo} Share plugin must provide information about e.g. accounts using this class
\endlist
\section3 Client API
......@@ -77,14 +77,14 @@ example Transfer UI and client side sharing interface on top of it. The Transfer
be used by clients who want to inform Nemo Transfer Engine of ongoing Sync or Downloads.
\list
\o DBus API - see org.nemomobile.transferengine.xml. For the client side it will generate TransferEngineInterface
\li DBus API - see org.nemomobile.transferengine.xml. For the client side it will generate TransferEngineInterface
class which can be used directly.
\o TransferEngineClient - The convenience API to create Sync and Download events.
\li TransferEngineClient - The convenience API to create Sync and Download events.
\endlist
\section3 Reference
\list
\o \l {Nemo Transfer Engine Reference}
\li \l {Nemo Transfer Engine Reference}
\endlist
*/
......@@ -41,9 +41,9 @@
TransferEngine supports C++ share plugins. Each share plugin must implement couple of well defined interfaces:
\list
\o \l TransferPluginInterface Provides interfaces to access required objects to start sharing.
\o \l MediaTransferInterface Implements the actual sharing functionality
\o \l TransferPluginInfo Provides information about plugin status such as is it ready.
\li \l TransferPluginInterface Provides interfaces to access required objects to start sharing.
\li \l MediaTransferInterface Implements the actual sharing functionality
\li \l TransferPluginInfo Provides information about plugin status such as is it ready.
\endlist
TransferPluginInterface provides information to the TransferEngine via this interface.
......
......@@ -38,9 +38,9 @@
This class is meant to be used by share plugins. It can be used for:
\list
\o Removing image metadata
\o Scaling image
\o Create a temp files from the image paths
\li Removing image metadata
\li Scaling image
\li Create a temp files from the image paths
\endlist
*/
......
......@@ -60,10 +60,10 @@ public:
each share plugin. The subclass of this class is resposible of providing:
\list
\o Status information of the sharing
\o Progress of the sharing
\o Information, if cancel and restart actions are supported
\o Starting and/or canceling the sharing
\li Status information of the sharing
\li Progress of the sharing
\li Information, if cancel and restart actions are supported
\li Starting and/or canceling the sharing
\endlist
......
......@@ -53,7 +53,6 @@ public:
MediaItem *mediaItem();
virtual QString displayName() const = 0;
virtual QUrl serviceIcon() const = 0;
virtual bool cancelEnabled() const = 0;
......
......@@ -32,9 +32,7 @@
class TransferDBRecord
{
public:
enum TransferDBRecordField {
TransferID = 0,
TransferType,
......
......@@ -78,11 +78,11 @@ CallbackInterface::CallbackInterface()
Construct CallbackInterface instance to provide callback information to the TransferEngineClient. Setup
arguments as:
\list
\o \a server e.g. "com.jolla.myapp"
\o \a path e.g. "/com/jolla/myapp"
\o \a interface e.g. "com.jolla.myapp"
\o \a cancelMethod Cancel method name e.g. "cancelSync"
\o \a restartMethod Restart method name e.g. "restartSync"
\li \a server e.g. "com.jolla.myapp"
\li \a path e.g. "/com/jolla/myapp"
\li \a interface e.g. "com.jolla.myapp"
\li \a cancelMethod Cancel method name e.g. "cancelSync"
\li \a restartMethod Restart method name e.g. "restartSync"
\endlist
*/
CallbackInterface::CallbackInterface(const QString &server, const QString &path, const QString &interface,
......@@ -222,9 +222,9 @@ TransferEngineClient::~TransferEngineClient()
Create a download event to the TransferEngine. This only creates and entry, and client
needs still call:
\list
\o \l TransferEngineClient::startTransfer()
\o \l TransferEngineClient::updateTransferProgress()
\o \l TransferEngineClient::finishTransfer()
\li \l TransferEngineClient::startTransfer()
\li \l TransferEngineClient::updateTransferProgress()
\li \l TransferEngineClient::finishTransfer()
\endlist
\sa createSyncEvent(), startTransfer(), updateTransferProgress(), finishTransfer()
......@@ -325,9 +325,9 @@ void TransferEngineClient::updateTransferProgress(int transferId, qreal progress
Finalize the transfer with \a transferId. There are three options for finalizing the transfer by setting
the \a status parameter value:
\list
\o \l TransferEngineClient::TransferFinished - success
\o \l TransferEngineClient::TransferCanceled - user cancelation
\o \l TransferEngineClient::TransferInterrupted - an error
\li \l TransferEngineClient::TransferFinished - success
\li \l TransferEngineClient::TransferCanceled - user cancelation
\li \l TransferEngineClient::TransferInterrupted - an error
\endlist
If the client wants to provide reason for finishing the transfer, it's possible to provide \a reason
......@@ -388,7 +388,7 @@ void TransferEngineClient::enableNotifications(bool enable)
/*!
Private method for QML interface.
\returns true if notifications are enabled, otherwise false is returned.
Returns true if notifications are enabled, otherwise false is returned.
*/
bool TransferEngineClient::notificationsEnabled() const
{
......
......@@ -182,7 +182,7 @@ QVariant TransferMethodInfo::value(int index) const
return accountId;
case AccountIcon:
return accountIcon;
default:
default:
return QVariant();
}
}
......
......@@ -36,7 +36,6 @@ Obsoletes: nemo-transferengine <= 0.0.19
%{_bindir}/nemo-transfer-engine
%{_datadir}/dbus-1/services/org.nemo.transferengine.service
%{_datadir}/translations/nemo-transfer-engine_eng_en.qm
%{_datadir}/lipstick/notificationcategories/*
%package -n libnemotransferengine-qt5
Summary: Transfer engine library.
......
......@@ -81,7 +81,8 @@
"strip_metadata INTEGER,\n" \
"scale_percent REAL,\n" \
"cancel_supported INTEGER,\n" \
"restart_supported INTEGER\n" \
"restart_supported INTEGER,\n" \
"notification_id INTEGER\n" \
");\n"
// Cascade trigger i.e. when transfer is removed and it has metadata or callbacks, this
......@@ -95,7 +96,7 @@
"END;\n"
// Update the following version if database schema changes.
#define USER_VERSION 1
#define USER_VERSION 2
#define PRAGMA_USER_VERSION QString("PRAGMA user_version=%1").arg(USER_VERSION)
class DbManagerPrivate {
......@@ -175,7 +176,7 @@ public:
QSqlQuery query;
if (!query.exec(queryStr)) {
qWarning() << "DbManager::callback: Failed to execute SQL query. Couldn't update the progress!"
qWarning() << "DbManager::callback: Failed to execute SQL query for user_version."
<< query.lastError().text() << ": "
<< query.lastError().databaseText();
return -1;
......@@ -242,11 +243,28 @@ DbManager::DbManager():
// Create database schema if db didn't exist
if (!dbExists) {
if(!d->createDatabaseSchema()) {
if (!d->createDatabaseSchema()) {
qCritical("DbManager::DbManager: Failed to create DB schema. Can't continue!");
}
} else {
// Database exists, check the schema version
if (d->userVersion() == 1) {
// For this we get away with DeclarativeTransferModel directly reading database without
// update because notification_id is the last column
QSqlQuery query;
if (query.exec("ALTER TABLE transfers ADD COLUMN notification_id INTEGER")) {
qWarning() << "Extended transfers table";
if (!query.exec(PRAGMA_USER_VERSION)) {
qWarning() << "DbManager pragma user_version update:"
<< query.lastError().text() << ":" << query.lastError().databaseText();
}
} else {
qWarning() << "Failed to extend transfers table!"
<< query.lastError().text() << ":" << query.lastError().databaseText();
}
}
if (d->userVersion() != USER_VERSION) {
d->deleteOldTables();
d->createDatabaseSchema();
......@@ -277,11 +295,11 @@ DbManager::~DbManager()
In a case there is a DBus callback, then QStringList contains the following items:
\list
\o service
\o path
\o interface
\o cancel method name
\o restart method name
\li service
\li path
\li interface
\li cancel method name
\li restart method name
\endlist
*/
QStringList DbManager::callback(int key) const
......@@ -292,7 +310,7 @@ QStringList DbManager::callback(int key) const
QStringList result;
QSqlQuery query;
if (!query.exec(queryStr)) {
qWarning() << "DbManager::callback: Failed to execute SQL query. Couldn't update the progress!"
qWarning() << "DbManager::callback: Failed to execute SQL query. Couldn't get callback!"
<< query.lastError().text() << ": "
<< query.lastError().databaseText();
return result;
......@@ -349,11 +367,11 @@ int DbManager::createMetadataEntry(int key, const QString &title, const QString
The callback is a dbus interface so it must contain the following attributes:
\list
\o \a service e.g. com.jolla.myapp
\o \a path e.g. /com/jolla/myapp
\o \a interface e.g. com.jolla.myapp
\o \a cancelMethod The name of the cancel method
\o \a restartMethod The name of the restart method
\li \a service e.g. com.jolla.myapp
\li \a path e.g. /com/jolla/myapp
\li \a interface e.g. com.jolla.myapp
\li \a cancelMethod The name of the cancel method
\li \a restartMethod The name of the restart method
\endlist
This method returns a key of the created callback record in a callback table or -1 on
......@@ -408,9 +426,11 @@ int DbManager::createTransferEntry(const MediaItem *mediaItem)
Q_D(DbManager);
QSqlQuery query;
query.prepare("INSERT INTO transfers (transfer_type, timestamp, status, progress, display_name, application_icon, thumbnail_icon, "
"service_icon, url, resource_name, mime_type, file_size, plugin_id, account_id, strip_metadata, scale_percent, cancel_supported, restart_supported)"
"VALUES (:transfer_type, :timestamp, :status, :progress, :display_name, :application_icon, :thumbnail_icon, :service_icon, "
":url, :resource_name, :mime_type, :file_size, :plugin_id, :account_id, :strip_metadata, :scale_percent, :cancel_supported, :restart_supported)");
" service_icon, url, resource_name, mime_type, file_size, plugin_id, account_id, strip_metadata, scale_percent, "
" cancel_supported, restart_supported, notification_id)"
"VALUES (:transfer_type, :timestamp, :status, :progress, :display_name, :application_icon, :thumbnail_icon, "
" :service_icon, :url, :resource_name, :mime_type, :file_size, :plugin_id, :account_id, :strip_metadata, :scale_percent, "
" :cancel_supported, :restart_supported, :notification_id)");
query.bindValue(":transfer_type", mediaItem->value(MediaItem::TransferType));
query.bindValue(":status", TransferEngineData::NotStarted);
query.bindValue(":timestamp", d->currentDateTime());
......@@ -429,9 +449,10 @@ int DbManager::createTransferEntry(const MediaItem *mediaItem)
query.bindValue(":scale_percent", mediaItem->value(MediaItem::ScalePercent));
query.bindValue(":cancel_supported", mediaItem->value(MediaItem::CancelSupported));
query.bindValue(":restart_supported", mediaItem->value(MediaItem::RestartSupported));
query.bindValue(":notification_id", 0);
if (!query.exec()) {
qWarning() << "DbManager::createTransfereEntry: Failed to execute SQL query. Couldn't create an entry!"
qWarning() << "DbManager::createTransferEntry: Failed to execute SQL query. Couldn't create an entry!"
<< query.lastError().text() << ": "
<< query.lastError().databaseText();
return -1;
......@@ -730,7 +751,7 @@ TransferEngineData::TransferType DbManager::transferType(int key) const
QSqlQuery query;
if (!query.exec(queryStr)) {
qWarning() << "DbManager::transferType: Failed to execute SQL query. Couldn't update the progress!"
qWarning() << "DbManager::transferType: Failed to execute SQL query. Couldn't get transfer type!"
<< query.lastError().text() << ": "
<< query.lastError().databaseText();
return TransferEngineData::Undefined;
......@@ -757,7 +778,7 @@ TransferEngineData::TransferStatus DbManager::transferStatus(int key) const
QSqlQuery query;
if (!query.exec(queryStr)) {
qWarning() << "DbManager::transferStatus: Failed to execute SQL query. Couldn't update the progress!"
qWarning() << "DbManager::transferStatus: Failed to execute SQL query. Couldn't get transfer status!"
<< query.lastError().text() << ": "
<< query.lastError().databaseText();
return TransferEngineData::Unknown;
......@@ -771,6 +792,66 @@ TransferEngineData::TransferStatus DbManager::transferStatus(int key) const
return TransferEngineData::Unknown;
}
}
/*!
Returns the transfer progress or -1 if unavailable
*/
qreal DbManager::transferProgress(int key) const
{
QString queryStr = QString("SELECT progress FROM transfers WHERE transfer_id='%1';").arg(QString::number(key));
QSqlQuery query;
if (!query.exec(queryStr)) {
qWarning() << "DbManager::transferStatus: Failed to execute SQL query. Couldn't get the progress!"
<< query.lastError().text() << ": "
<< query.lastError().databaseText();
return -1;
}
if (query.isActive() && query.isSelect()) {
query.first();
return static_cast<qreal>(query.value(0).toReal());
} else {
return -1;
}
}
int DbManager::notificationId(int key)
{
QString queryStr = QString("SELECT notification_id FROM transfers WHERE transfer_id='%1';").arg(QString::number(key));
QSqlQuery query;
if (!query.exec(queryStr)) {
qWarning() << "DbManager::transferStatus: Failed to execute SQL query. Couldn't get the notification id!"
<< query.lastError().text() << ": "
<< query.lastError().databaseText();
return 0;
}
if (query.isActive() && query.isSelect()) {
query.first();
return static_cast<qreal>(query.value(0).toReal());
} else {
return 0;
}
}
bool DbManager::setNotificationId(int key, int notificationId)
{
QString queryStr = QString("UPDATE transfers SET notification_id='%1' WHERE transfer_id='%2';")
.arg(QString::number(notificationId)).arg(QString::number(key));
QSqlQuery query;
if (!query.exec(queryStr)) {
qWarning() << "Failed to execute SQL query. Couldn't update the notification id!"
<< query.lastError().text() << ": "
<< query.lastError().databaseText();
return false;
}
query.finish();
return true;
}
/*!
Reads the callback method names from the database for the transfer with \a key. The method names are set to the
output arguments \a cancelMethod and \a restartMethod.
......
......@@ -77,6 +77,11 @@ public:
TransferEngineData::TransferStatus transferStatus(int key) const;
qreal transferProgress(int key) const;
int notificationId(int key);
bool setNotificationId(int key, int notificationId);
bool callbackMethods(int key, QString &cancelMethod, QString &restartMethod) const;
MediaItem * mediaItem(int key) const;
......
......@@ -39,6 +39,7 @@
#include <QDBusMessage>
#include <QFileSystemWatcher>
#include <QTimer>
#include <QSettings>
#include <notification.h>
......@@ -52,9 +53,11 @@
#define ACTIVITY_MONITOR_TIMEOUT 1*60*1000 // 1 minute in ms
#define TRANSFER_EXPIRATION_THRESHOLD 3*60 // 3 minutes in seconds
#define TRANSFER_EVENT_CATEGORY "x-nemo.transfer"
#define TRANSFER_COMPLETE_EVENT_CATEGORY "x-nemo.transfer.complete"
#define TRANSFER_ERROR_EVENT_CATEGORY "x-nemo.transfer.error"
#define TRANSFER_EVENT_CATEGORY "transfer"
#define TRANSFER_COMPLETE_EVENT_CATEGORY "transfer.complete"
#define TRANSFER_ERROR_EVENT_CATEGORY "transfer.error"
#define TRANSFER_PROGRESS_HINT "x-nemo-progress"
TransferEngineSignalHandler * TransferEngineSignalHandler::instance()
{
......@@ -64,7 +67,7 @@ TransferEngineSignalHandler * TransferEngineSignalHandler::instance()
void TransferEngineSignalHandler::signalHandler(int signal)
{
if(signal == SIGUSR1) {
if (signal == SIGUSR1) {
QMetaObject::invokeMethod(TransferEngineSignalHandler::instance(),
"exitSafely",
Qt::AutoConnection);
......@@ -143,7 +146,6 @@ void ClientActivityMonitor::checkActivity()
TransferEnginePrivate::TransferEnginePrivate(TransferEngine *parent):
m_notificationsEnabled(true),
m_settings(CONFIG_PATH, QSettings::IniFormat),
q_ptr(parent)
{
m_fileWatcherTimer = new QTimer(this);
......@@ -173,6 +175,24 @@ TransferEnginePrivate::TransferEnginePrivate(TransferEngine *parent):
// Monitor expired transfers and cleanup them if required
m_activityMonitor = new ClientActivityMonitor(this);
connect(m_activityMonitor, SIGNAL(transfersExpired(QList<int>)), this, SLOT(cleanupExpiredTransfers(QList<int>)));
QSettings settings(CONFIG_PATH, QSettings::IniFormat);
if (settings.status() != QSettings::NoError) {
qWarning() << Q_FUNC_INFO << "Failed to read settings!" << settings.status();
} else {
settings.beginGroup("transfers");
const QString service = settings.value("service").toString();
const QString path = settings.value("path").toString();
const QString iface = settings.value("interface").toString();
const QString method = settings.value("method").toString();
settings.endGroup();
if (!service.isEmpty() && !path.isEmpty() && !iface.isEmpty() && !method.isEmpty()) {
m_defaultActions << Notification::remoteAction("default", "", service, path, iface, method)
<< Notification::remoteAction("app", "", service, path, iface, method);
}
}
}
void TransferEnginePrivate::pluginDirChanged()
......@@ -299,7 +319,9 @@ void TransferEnginePrivate::recoveryCheck()
void TransferEnginePrivate::sendNotification(TransferEngineData::TransferType type,
TransferEngineData::TransferStatus status,
const QString &fileName)
qreal progress,
const QString &fileName,
int transferId)
{
if (!m_notificationsEnabled || fileName.isEmpty()) {
return;
......@@ -310,6 +332,10 @@ void TransferEnginePrivate::sendNotification(TransferEngineData::TransferType ty
QString summary;
QString previewBody;
QString previewSummary;
bool useProgress = false;
Notification::Urgency urgency = Notification::Normal;
QString appIcon = QStringLiteral("icon-lock-information");
QString icon = QStringLiteral("x-nemo-icon=icon-lock-transfer");
// TODO: explicit grouping of transfer notifications is now removed, as grouping
// will now be performed by lipstick. We may need to reinstate group summary
......@@ -325,18 +351,8 @@ void TransferEnginePrivate::sendNotification(TransferEngineData::TransferType ty
// - For downloads
// - For failed uploads, downloads and syncs
QList<QObject *> nList = Notification::notifications();
Notification *existing = 0;
foreach (QObject *obj, nList) {
if (Notification *n = qobject_cast<Notification *>(obj)) {
if (n->summary() == fileName || n->previewSummary() == fileName) {
// This existing notification is for this file
existing = n;
break;
}
}
}
int notificationId = DbManager::instance()->notificationId(transferId);
if (status == TransferEngineData::TransferFinished) {
switch(type) {
......@@ -363,9 +379,11 @@ void TransferEnginePrivate::sendNotification(TransferEngineData::TransferType ty
qWarning() << "TransferEnginePrivate::sendNotification: unknown state";
break;
}
} else {
if (status == TransferEngineData::TransferInterrupted) {
category = TRANSFER_ERROR_EVENT_CATEGORY;
} else if (status == TransferEngineData::TransferInterrupted) {
urgency = Notification::Critical;
appIcon = QStringLiteral("icon-lock-information");
icon.clear();
switch (type) {
case TransferEngineData::Upload:
......@@ -391,38 +409,46 @@ void TransferEnginePrivate::sendNotification(TransferEngineData::TransferType ty
summary = fileName;
previewSummary = summary;
previewBody = body;
} else {
if (status == TransferEngineData::TransferCanceled) {
// Exit, no banners or events when user has canceled a transfer
// Remove any existing notification
if (existing) {
existing->close();
} else if (status == TransferEngineData::TransferStarted) {
if (type == TransferEngineData::Upload || type == TransferEngineData::Download) {
category = TRANSFER_EVENT_CATEGORY;
if (type == TransferEngineData::Upload) {
//: Notification for ongoing upload
//% "File uploading"
body = qtTrId("transferengine-no-file-uploading");
} else {
//: Notification for ongoing file download
//% "File downloading"
body = qtTrId("transferengine-no-file-downloading");
}
summary = fileName;
if (progress > 0)
useProgress = true;
}
}}}
} else if (status == TransferEngineData::TransferCanceled && notificationId > 0) {
// Exit, no banners or events when user has canceled a transfer
// Remove any existing notification
Notification notification;
notification.setReplacesId(notificationId);
notification.close();
DbManager::instance()->setNotificationId(transferId, 0);
notificationId = 0;
}
if (!category.isEmpty()) {
Notification notification;
if (!existing) {
// Create a new notification
if (m_settings.status() != QSettings::NoError) {
qWarning() << Q_FUNC_INFO << "Failed to read settings!" << m_settings.status();
} else {
m_settings.beginGroup("transfers");
const QString service = m_settings.value("service").toString();
const QString path = m_settings.value("path").toString();
const QString iface = m_settings.value("interface").toString();
const QString method = m_settings.value("method").toString();
m_settings.endGroup();
if (!service.isEmpty() && !path.isEmpty() && !iface.isEmpty() && !method.isEmpty()) {
notification.setRemoteActions(QVariantList() << Notification::remoteAction("default", "", service, path, iface, method)
<< Notification::remoteAction("app", "", service, path, iface, method));
}
}
if (notificationId > 0) {
notification.setReplacesId(notificationId);
}
existing = &notification;
if (!m_defaultActions.isEmpty()) {
notification.setRemoteActions(m_defaultActions);
}
//: Group name for notifications of successful transfers
......@@ -432,17 +458,24 @@ void TransferEnginePrivate::sendNotification(TransferEngineData::TransferType ty
//% "Warnings"
const QString errorsGroup(qtTrId("transferengine-notification_errors_group"));
// Update the notification
existing->setCategory(category);
existing->setAppName(category == TRANSFER_ERROR_EVENT_CATEGORY ? errorsGroup : transfersGroup);
existing->setSummary(summary);
existing->setBody(body);
existing->setPreviewSummary(previewSummary);
existing->setPreviewBody(previewBody);
existing->publish();
}
notification.setCategory(category);
notification.setAppName(category == TRANSFER_ERROR_EVENT_CATEGORY ? errorsGroup : transfersGroup);
notification.setSummary(summary);
notification.setBody(body);
notification.setPreviewSummary(previewSummary);
notification.setPreviewBody(previewBody);
notification.setUrgency(urgency);
qDeleteAll(nList);
if (useProgress) {
notification.setHintValue(TRANSFER_PROGRESS_HINT, static_cast<double>(progress));
}
notification.publish();
int newId = notification.replacesId();
if (newId != notificationId) {
DbManager::instance()->setNotificationId(transferId, newId);
}
}
}
int TransferEnginePrivate::uploadMediaItem(MediaItem *mediaItem,
......@@ -451,7 +484,7 @@ int TransferEnginePrivate::uploadMediaItem(MediaItem *mediaItem,
{
Q_Q(TransferEngine);
if (muif == 0) {
if (mediaItem == 0) {
qWarning() << "TransferEngine::uploadMediaItem invalid MediaItem";
return -1;
}
......@@ -588,7 +621,7 @@ void TransferEnginePrivate::uploadItemStatusChanged(MediaTransferInterface::Tran
// If the flow ends up here, we are not interested in any signals the same object
// might emit. Let's just disconnect them.
muif->disconnect();
sendNotification(type, tStatus, mediaFileOrResourceName(muif->mediaItem()));
sendNotification(type, tStatus, muif->progress(), mediaFileOrResourceName(muif->mediaItem()), key);
ok = DbManager::instance()->updateTransferStatus(key, tStatus);
if (m_plugins.remove(muif) == 0) {
qWarning() << "TransferEnginePrivate::uploadItemStatusChanged: Failed to remove media upload object from the map!";
......@@ -625,7 +658,7 @@ void TransferEnginePrivate::updateProgress(qreal progress)
m_activityMonitor->newActivity(key);
Q_Q(TransferEngine);
emit q->progressChanged(key, progress);
q->updateTransferProgress(key, progress);
}
void TransferEnginePrivate::pluginInfoReady()
......@@ -675,7 +708,6 @@ TransferEngineData::TransferType TransferEnginePrivate::transferType(int transfe
}
}
void TransferEnginePrivate::callbackCall(int transferId, CallbackMethodType method)
{
// Get DBus callback information. Callback list must contain at least
......@@ -719,9 +751,9 @@ void TransferEnginePrivate::callbackCall(int transferId, CallbackMethodType meth
TransferEngine is the central place for:
\list
\o Sharing - Provides requires plugin interfaces for share plugins
\o Downloads - Provides an API to create Download entries
\o Syncs - Provides an API to create Sync entries
\li Sharing - Provides requires plugin interfaces for share plugins
\li Downloads - Provides an API to create Download entries
\li Syncs - Provides an API to create Sync entries
\endlist
For Downloads and Syncs, the Transfer Engine acts only a place to keep track of these operations.
......@@ -829,10 +861,10 @@ TransferEngine::~TransferEngine()
TransferEngine handles the following user defined data automatically and stores them to the database:
\list
\o "title" Title for the media
\o "description" Description for the media
\o "accountId" The ID of the account which is used for sharing. See qt-accounts for more details.
\o "scalePercent" The scale percent e.g. downscale image to 50% from original before uploading.
\li "title" Title for the media
\li "description" Description for the media
\li "accountId" The ID of the account which is used for sharing. See qt-accounts for more details.
\li "scalePercent" The scale percent e.g. downscale image to 50% from original before uploading.
\endlist
In practice this method instantiates a share plugin with \a serviceId and passes a MediaItem instance filled
......@@ -914,15 +946,15 @@ int TransferEngine::uploadMediaItemContent(const QVariantMap &content,
of type 'Download'.
\list
\o \a displayName The name for Download which may be used by the UI displaying the download
\o \a applicationIcon The application icon of the application created the download
\o \a serviceIcon The service icon, which provides the file to be downloaded
\o \a filePath The filePath e.g. url to the file to be downloaded
\o \a mimeType the MimeType of the file to be downloaded
\o \a expectedFileSize The file size of the file to be downloaded
\o \a callback QStringList containing DBus callback information such as: service, path and interface
\o \a cancelMethod The name of the cancel callback method, which DBus callback provides
\o \a restartMethod The name of the restart callback method, which DBus callback provides
\li \a displayName The name for Download which may be used by the UI displaying the download
\li \a applicationIcon The application icon of the application created the download
\li \a serviceIcon The service icon, which provides the file to be downloaded
\li \a filePath The filePath e.g. url to the file to be downloaded
\li \a mimeType the MimeType of the file to be downloaded
\li \a expectedFileSize The file size of the file to be downloaded
\li \a callback QStringList containing DBus callback information such as: service, path and interface
\li \a cancelMethod The name of the cancel callback method, which DBus callback provides
\li \a restartMethod The name of the restart callback method, which DBus callback provides
\endlist
This method returns the transfer id of the created Download transfer. Note that this method only
......@@ -974,12 +1006,12 @@ int TransferEngine::createDownload(const QString &displayName,
of type 'Download'.
\list
\o \a displayName The name for download which may be used by the UI displaying the download
\o \a applicationIcon The application icon of the application created the download
\o \a serviceIcon The service icon, which provides the file to be downloaded
\o \a callback QStringList containing DBus callback information such as: service, path and interface
\o \a cancelMethod The name of the cancel callback method, which DBus callback provides
\o \a restartMethod The name of the restart callback method, which DBus callback provides
\li \a displayName The name for download which may be used by the UI displaying the download
\li \a applicationIcon The application icon of the application created the download
\li \a serviceIcon The service icon, which provides the file to be downloaded
\li \a callback QStringList containing DBus callback information such as: service, path and interface
\li \a cancelMethod The name of the cancel callback method, which DBus callback provides
\li \a restartMethod The name of the restart callback method, which DBus callback provides
\endlist