Support getting text data from dbus in PlatformData
This commit is contained in:
parent
29c5bbf62b
commit
d473d23d55
1 changed files with 12 additions and 2 deletions
|
@ -12,11 +12,21 @@ DBusAdaptor::~DBusAdaptor()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBusAdaptor::Open(const QStringList &uris, const QVariantMap &)
|
void DBusAdaptor::Open(const QStringList& uris, const QVariantMap& platformData)
|
||||||
{
|
{
|
||||||
if (!uris.isEmpty()) {
|
qDebug() << platformData;
|
||||||
|
if (!uris.isEmpty() && uris[0] != "") {
|
||||||
QMetaObject::invokeMethod(_view->rootObject(), "openFile", Q_ARG(QVariant, uris.at(0)));
|
QMetaObject::invokeMethod(_view->rootObject(), "openFile", Q_ARG(QVariant, uris.at(0)));
|
||||||
}
|
}
|
||||||
|
else if(platformData.contains("data"))
|
||||||
|
{
|
||||||
|
QTemporaryFile tmpfile(QDir::tempPath() + "/" + (platformData.contains("name") ? platformData["name"].toString() : "seaprint"));
|
||||||
|
tmpfile.setAutoRemove(false);
|
||||||
|
tmpfile.open();
|
||||||
|
tmpfile.write(platformData["data"].toString().toUtf8());
|
||||||
|
tmpfile.close();
|
||||||
|
QMetaObject::invokeMethod(_view->rootObject(), "openFile", Q_ARG(QVariant, tmpfile.fileName()));
|
||||||
|
}
|
||||||
QMetaObject::invokeMethod(_view->rootObject(), "activate");
|
QMetaObject::invokeMethod(_view->rootObject(), "activate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue