diff --git a/dbus/org.nemo.transferengine.xml b/dbus/org.nemo.transferengine.xml
index 76e35b6..2f21b30 100644
--- a/dbus/org.nemo.transferengine.xml
+++ b/dbus/org.nemo.transferengine.xml
@@ -88,7 +88,13 @@
# Get a list of transfer methods such as FB, Twitter, BT, NFC, etc
-
+
+
+
+ # Get a list of transfer methods such as FB, Twitter, BT, NFC, etc
+
+
+
# clear all unfinished transfers
diff --git a/lib/metatypedeclarations.h b/lib/metatypedeclarations.h
index 5abb866..08454c4 100644
--- a/lib/metatypedeclarations.h
+++ b/lib/metatypedeclarations.h
@@ -33,6 +33,8 @@
Q_DECLARE_METATYPE(TransferDBRecord)
Q_DECLARE_METATYPE(QList)
+Q_DECLARE_METATYPE(TransferMethodInfoDeprecated)
+Q_DECLARE_METATYPE(QList)
Q_DECLARE_METATYPE(TransferMethodInfo)
Q_DECLARE_METATYPE(QList)
diff --git a/lib/transfermethodinfo.cpp b/lib/transfermethodinfo.cpp
index 564159c..e2396d7 100644
--- a/lib/transfermethodinfo.cpp
+++ b/lib/transfermethodinfo.cpp
@@ -46,6 +46,7 @@
info.displayName = QLatin1String("Bluetooth");
info.userName = "";
info.accountId = "";
+ info.accountIcon = QLatin1String("image://theme/icon-m-bluetooth");
info.methodId = QLatin1String("bluetooth");
info.shareUIPath = SHARE_UI_PATH + QLatin1String("/BluetoothShareUI.qml");
info.capabilitities = capabilities;
@@ -62,6 +63,7 @@
\value UserName User name e.g. mike.myers@gmail.com
\value MethodId The plugin Id of the share plugin e.g. "bluetooth"
\value AccountId The Id the account, needed in a case of multiple accounts
+ \value AccountIcon The url of the icon representing the account
\value ShareUIPath The path to the share ui QML plugin. This QML file will be loaded by the share UI
\value Capabilities A list of supported mimetypes
*/
@@ -69,13 +71,7 @@
/*!
Creates an instance of TransferMethodInfo.
*/
-TransferMethodInfo::TransferMethodInfo():
- displayName(),
- userName(),
- methodId(),
- shareUIPath(),
- capabilitities(),
- accountId()
+TransferMethodInfo::TransferMethodInfo()
{
}
@@ -90,6 +86,8 @@ TransferMethodInfo &TransferMethodInfo::operator=(const TransferMethodInfo &othe
shareUIPath = other.shareUIPath;
capabilitities = other.capabilitities;
accountId = other.accountId;
+ accountIcon = other.accountIcon;
+ hints = other.hints;
return *this;
}
@@ -102,7 +100,9 @@ TransferMethodInfo::TransferMethodInfo(const TransferMethodInfo &other):
methodId(other.methodId),
shareUIPath(other.shareUIPath),
capabilitities(other.capabilitities),
- accountId(other.accountId)
+ accountId(other.accountId),
+ accountIcon(other.accountIcon),
+ hints(other.hints)
{
}
@@ -126,7 +126,9 @@ QDBusArgument &operator<<(QDBusArgument &argument, const TransferMethodInfo &inf
<< info.methodId
<< info.shareUIPath
<< info.capabilitities
- << info.accountId;
+ << info.accountId
+ << info.accountIcon
+ << info.hints;
argument.endStructure();
return argument;
@@ -143,7 +145,9 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, TransferMethodInf
>> info.methodId
>> info.shareUIPath
>> info.capabilitities
- >> info.accountId;
+ >> info.accountId
+ >> info.accountIcon
+ >> info.hints;
argument.endStructure();
return argument;
@@ -176,7 +180,41 @@ QVariant TransferMethodInfo::value(int index) const
return capabilitities;
case AccountId:
return accountId;
+ case AccountIcon:
+ return accountIcon;
default:
return QVariant();
}
}
+
+QDBusArgument &operator<<(QDBusArgument &argument, const TransferMethodInfoDeprecated &info)
+{
+ argument.beginStructure();
+ argument << info.displayName
+ << info.userName
+ << info.methodId
+ << info.shareUIPath
+ << info.capabilitities
+ << info.accountId;
+ argument.endStructure();
+ return argument;
+}
+const QDBusArgument &operator>>(const QDBusArgument &argument, TransferMethodInfoDeprecated &info)
+{
+ argument.beginStructure();
+ argument >> info.displayName
+ >> info.userName
+ >> info.methodId
+ >> info.shareUIPath
+ >> info.capabilitities
+ >> info.accountId;
+
+ argument.endStructure();
+ return argument;
+}
+
+void TransferMethodInfoDeprecated::registerType()
+{
+ qDBusRegisterMetaType();
+ qDBusRegisterMetaType >();
+}
diff --git a/lib/transfermethodinfo.h b/lib/transfermethodinfo.h
index dbc96ee..3bfdac9 100644
--- a/lib/transfermethodinfo.h
+++ b/lib/transfermethodinfo.h
@@ -30,6 +30,21 @@
#include
#include
+class TransferMethodInfoDeprecated
+{
+public:
+ friend QDBusArgument &operator<<(QDBusArgument &argument, const TransferMethodInfoDeprecated &record);
+ friend const QDBusArgument &operator>>(const QDBusArgument &argument, TransferMethodInfoDeprecated &record);
+
+ static void registerType();
+
+ QString displayName;
+ QString userName;
+ QString methodId;
+ QString shareUIPath;
+ QStringList capabilitities;
+ quint32 accountId;
+};
class TransferMethodInfo
{
@@ -39,8 +54,9 @@ class TransferMethodInfo
enum TransferMethodInfoField {
DisplayName, // e.g. Facebook
UserName, // e.g. mike.myers@gmail.com
- MethodId, // Id of the plugin
- AccountId, // Id the account, needed in a case of multiple accounts
+ MethodId, // id of the plugin
+ AccountId, // id the account, needed in a case of multiple accounts
+ AccountIcon, // account icon source url
ShareUIPath, // path to the share ui QML plugin
Capabilities // list of supported mimetypes
};
@@ -57,13 +73,15 @@ class TransferMethodInfo
QVariant value(int index) const;
-
QString displayName;
QString userName;
QString methodId;
QString shareUIPath;
QStringList capabilitities;
quint32 accountId;
+ QString accountIcon;
+ QVariantHash hints;
+
};
#endif // TRANSFERMETHODINFO_H
diff --git a/src/transferengine.cpp b/src/transferengine.cpp
index dbd1e9c..28cd04f 100644
--- a/src/transferengine.cpp
+++ b/src/transferengine.cpp
@@ -526,7 +526,6 @@ QList TransferEnginePrivate::enabledPlugins() const
return m_enabledPlugins;
}
-
MediaTransferInterface *TransferEnginePrivate::loadPlugin(const QString &pluginId) const
{
QPluginLoader loader;
@@ -776,6 +775,7 @@ TransferEngine::TransferEngine(QObject *parent) :
QObject(parent),
d_ptr(new TransferEnginePrivate(this))
{
+ TransferMethodInfoDeprecated::registerType();
TransferMethodInfo::registerType();
TransferDBRecord::registerType();
@@ -1222,7 +1222,27 @@ QList TransferEngine::activeTransfers()
Transfer methods are basically a list of share plugins installed to the system.
*/
-QList TransferEngine::transferMethods()
+QList TransferEngine::transferMethods()
+{
+ Q_D(TransferEngine);
+ d->exitSafely();
+
+ QList newPlugins = d->enabledPlugins();
+ QList oldPlugins;
+ for (auto info : newPlugins) {
+ TransferMethodInfoDeprecated oldInfo;
+ oldInfo.displayName = info.displayName;
+ oldInfo.userName = info.userName;
+ oldInfo.methodId = info.methodId;
+ oldInfo.shareUIPath = info.shareUIPath;
+ oldInfo.capabilitities = info.capabilitities;
+ oldInfo.accountId = info.accountId;
+ oldPlugins << oldInfo;
+ }
+ return oldPlugins;
+}
+
+QList TransferEngine::transferMethods2()
{
Q_D(TransferEngine);
d->exitSafely();
diff --git a/src/transferengine.h b/src/transferengine.h
index b8349d0..8c9cc26 100644
--- a/src/transferengine.h
+++ b/src/transferengine.h
@@ -85,7 +85,8 @@ public Q_SLOTS:
QList activeTransfers();
- QList transferMethods();
+ QList transferMethods();
+ QList transferMethods2();
void clearTransfers();