diff --git a/dbus/org.nemo.transferengine.xml b/dbus/org.nemo.transferengine.xml
index 2f21b30..814e3c6 100644
--- a/dbus/org.nemo.transferengine.xml
+++ b/dbus/org.nemo.transferengine.xml
@@ -97,6 +97,12 @@
+ # Get a list of plugin metadata
+
+
+
+
+
# clear all unfinished transfers
diff --git a/lib/lib.pro b/lib/lib.pro
index 1a00c50..b8ca33e 100644
--- a/lib/lib.pro
+++ b/lib/lib.pro
@@ -25,6 +25,7 @@ SOURCES += \
mediatransferinterface.cpp \
mediaitem.cpp \
transfermethodinfo.cpp \
+ transferplugininfo.cpp \
transferengineclient.cpp \
imageoperation.cpp
diff --git a/lib/transfermethodinfo.cpp b/lib/transfermethodinfo.cpp
index 65bc44b..c6d8132 100644
--- a/lib/transfermethodinfo.cpp
+++ b/lib/transfermethodinfo.cpp
@@ -70,6 +70,7 @@
Creates an instance of TransferMethodInfo.
*/
TransferMethodInfo::TransferMethodInfo()
+ : accountId(0)
{
}
diff --git a/lib/transferplugininfo.cpp b/lib/transferplugininfo.cpp
new file mode 100644
index 0000000..eb78a2e
--- /dev/null
+++ b/lib/transferplugininfo.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2019 Open Mobile Platform LLC.
+ *
+ * All rights reserved.
+ *
+ * This file is part of Sailfish Transfer Engine package.
+ *
+ * You may use this file under the terms of the GNU Lesser General
+ * Public License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file license.lgpl included in the packaging
+ * of this file.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * and appearing in the file license.lgpl included in the packaging
+ * of this file.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ */
+
+#include "transferplugininfo.h"
+
+QVariantMap TransferPluginInfo::metaData() const
+{
+ return property("_nemo_transferplugininfo_capabilities").toMap();
+}
+
+void TransferPluginInfo::setMetaData(const QVariantMap &metaData)
+{
+ setProperty("_nemo_transferplugininfo_capabilities", metaData);
+}
+
+void TransferPluginInfo::registerType()
+{
+ qDBusRegisterMetaType >();
+}
diff --git a/lib/transferplugininfo.h b/lib/transferplugininfo.h
index 6f21b31..4da40c0 100644
--- a/lib/transferplugininfo.h
+++ b/lib/transferplugininfo.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2013 - 2019 Jolla Ltd.
+ * Copyright (c) 2019 Open Mobile Platform LLC.
*
* All rights reserved.
*
@@ -25,6 +26,7 @@
#ifndef TRANSFERPLUGININFO_H
#define TRANSFERPLUGININFO_H
#include
+#include
#include "transfermethodinfo.h"
class TransferPluginInfo: public QObject
@@ -35,6 +37,13 @@ class TransferPluginInfo: public QObject
virtual void query() = 0;
virtual bool ready() const = 0;
+ QVariantMap metaData() const;
+
+ static void registerType();
+
+protected:
+ void setMetaData(const QVariantMap &metaData);
+
Q_SIGNALS:
void infoReady();
void infoError(const QString &msg);
diff --git a/src/transferengine.cpp b/src/transferengine.cpp
index a00ed8d..a95b36b 100644
--- a/src/transferengine.cpp
+++ b/src/transferengine.cpp
@@ -237,6 +237,7 @@ void TransferEnginePrivate::enabledPluginsCheck()
// First clear old data
m_enabledPlugins.clear();
+ m_pluginMetaData.clear();
qDeleteAll(m_infoObjects);
m_infoObjects.clear();
@@ -268,6 +269,7 @@ void TransferEnginePrivate::enabledPluginsCheck()
if (info->info().count() > 0) {
m_enabledPlugins << info->info();
}
+ m_pluginMetaData << info->metaData();
delete info;
} else {
// These object will be cleaned in pluginInfoReady() slot.
@@ -564,6 +566,11 @@ QList TransferEnginePrivate::enabledPlugins() const
return m_enabledPlugins;
}
+QList TransferEnginePrivate::pluginMetaData() const
+{
+ return m_pluginMetaData;
+}
+
MediaTransferInterface *TransferEnginePrivate::loadPlugin(const QString &pluginId) const
{
QPluginLoader loader;
@@ -674,6 +681,7 @@ void TransferEnginePrivate::pluginInfoReady()
if (!infoList.isEmpty()) {
m_enabledPlugins << infoList;
}
+ m_pluginMetaData << infoObj->metaData();
if (m_infoObjects.removeOne(infoObj)) {
delete infoObj;
@@ -815,6 +823,7 @@ TransferEngine::TransferEngine(QObject *parent) :
TransferMethodInfoDeprecated::registerType();
TransferMethodInfo::registerType();
TransferDBRecord::registerType();
+ TransferPluginInfo::registerType();
QDBusConnection connection = QDBusConnection::sessionBus();
if (!connection.registerObject("/org/nemo/transferengine", this)) {
@@ -1298,6 +1307,18 @@ QList TransferEngine::transferMethods2()
return d->enabledPlugins();
}
+/*!
+ DBus adaptor calls this method to fetch a list of the share plugin metadata.
+
+ This method returns QList.
+ */
+QList TransferEngine::pluginMetaData()
+{
+ Q_D(TransferEngine);
+ d->exitSafely();
+ return d->pluginMetaData();
+}
+
/*!
DBus adaptor calls this method to clear all the finished, canceled or interrupted transfers in the database.
*/
diff --git a/src/transferengine.h b/src/transferengine.h
index 4ded924..cbe53da 100644
--- a/src/transferengine.h
+++ b/src/transferengine.h
@@ -86,6 +86,8 @@ public Q_SLOTS:
QList transferMethods();
QList transferMethods2();
+ QList pluginMetaData();
+
void clearTransfers();
void clearTransfer(int transferId);
diff --git a/src/transferengine_p.h b/src/transferengine_p.h
index bcbd61b..b3ad143 100644
--- a/src/transferengine_p.h
+++ b/src/transferengine_p.h
@@ -126,6 +126,7 @@ public Q_SLOTS:
public:
QStringList pluginList() const;
QList enabledPlugins() const;
+ QList pluginMetaData() const;
MediaTransferInterface *loadPlugin(const QString &pluginId) const;
QString mediaFileOrResourceName(MediaItem *mediaItem) const;
@@ -135,6 +136,7 @@ public Q_SLOTS:
bool m_notificationsEnabled;
QList m_infoObjects;
QList m_enabledPlugins;
+ QList m_pluginMetaData;
Accounts::Manager *m_accountManager;
QFileSystemWatcher *m_fileWatcher;
QTimer *m_fileWatcherTimer;