/
sharecommand.cpp
64 lines (38 loc) · 1.19 KB
/
sharecommand.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "sharecommand.h"
#include <QString>
#include <QDebug>
#include <MDataUri>
#include <maemo-meegotouch-interfaces/shareuiinterface.h>
ShareCommand::ShareCommand(QObject *parent) : QObject(parent) { }
void ShareCommand::share () {
QString link = "http://forum.nokia.com";
QString title = "Forum Nokia";
QString desc = "Support for Nokia Developers";
/*
qDebug() << "Make data URI from"
<< link << title << desc;
*/
MDataUri duri;
duri.setMimeType ("text/x-url");
duri.setTextData (link);
duri.setAttribute ("title", title);
duri.setAttribute ("description", desc);
if (duri.isValid() == false) {
qCritical() << "Invalid URI";
return;
}
QStringList items;
items << duri.toString();
//qDebug() << "URI:" << items.join (" ");
// Create a interface object
ShareUiInterface shareIf("com.nokia.ShareUi");
// Check if interface is valid
if (shareIf.isValid()) {
// Start ShareUI application with selected files.
//qDebug() << "Signalling share-ui daemon...";
shareIf.share (items);
} else {
qCritical() << "Invalid interface";
return;
}
}