summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortg(x) <*@tg-x.net>2016-05-12 03:44:52 +0200
committertg(x) <*@tg-x.net>2016-05-12 03:44:52 +0200
commita295f2792f2a80f10dd3214563aa71ad3562204f (patch)
tree80969aac652617ca0aba05ba9b9863255f87430a
parent6aee7048dedc5c76232b890ec324b8d6c52ce60a (diff)
downloadsecushare-a295f2792f2a80f10dd3214563aa71ad3562204f.tar.gz
secushare-a295f2792f2a80f10dd3214563aa71ad3562204f.zip
API changes: some UI improvements
-rw-r--r--qml/PlaceCreate.qml9
-rw-r--r--qml/PlaceEnter.qml10
-rw-r--r--qml/PlaceThread.qml79
-rw-r--r--qml/main.qml1
-rw-r--r--secushare.pro3
-rw-r--r--src/gnunet/gnunet.cpp11
-rw-r--r--src/gnunet/gnunet.h6
-rw-r--r--src/gnunet/social/guest.cpp2
-rw-r--r--src/gnunet/social/host.cpp22
-rw-r--r--src/gnunet/social/host.h14
-rw-r--r--src/gnunet/social/message.cpp35
-rw-r--r--src/gnunet/social/message.h50
-rw-r--r--src/gnunet/social/place.cpp37
-rw-r--r--src/gnunet/social/place.h23
-rw-r--r--src/gnunet/social/socialapp.cpp9
-rw-r--r--src/gnunet/social/socialapp.h2
-rw-r--r--src/model/ThreadListModel.cpp20
-rw-r--r--src/model/ThreadListModel.h4
18 files changed, 249 insertions, 88 deletions
diff --git a/qml/PlaceCreate.qml b/qml/PlaceCreate.qml
index ce67caa..ad765ce 100644
--- a/qml/PlaceCreate.qml
+++ b/qml/PlaceCreate.qml
@@ -36,7 +36,7 @@ Rectangle {
36 } 36 }
37 37
38 Label { 38 Label {
39 text: "Create Home" 39 text: "Create Place"
40 anchors.left: imageBanner.right 40 anchors.left: imageBanner.right
41 anchors.leftMargin: 5 41 anchors.leftMargin: 5
42 anchors.top: parent.top 42 anchors.top: parent.top
@@ -78,7 +78,8 @@ Rectangle {
78 anchors.left: parent.left 78 anchors.left: parent.left
79 anchors.right: parent.right 79 anchors.right: parent.right
80 wrapMode : Text.Wrap 80 wrapMode : Text.Wrap
81 text: "Please enter the appropriate information about the place you would like to create." 81 text: "Please enter the appropriate information about the place you would like to create.\n" +
82 "The GNS label is added to the GNS zone of the selected ego, which then provides the address of the place."
82 } 83 }
83 } 84 }
84 85
@@ -94,7 +95,7 @@ Rectangle {
94 spacing: 2 95 spacing: 2
95 Label { 96 Label {
96 id: nameLabel 97 id: nameLabel
97 text: "Name:" 98 text: "GNS label:"
98 width: 80 99 width: 80
99 } 100 }
100 101
@@ -107,6 +108,7 @@ Rectangle {
107 } 108 }
108 109
109 Row { 110 Row {
111 visible: false
110 spacing: 2 112 spacing: 2
111 Label { 113 Label {
112 id: expirationLabel 114 id: expirationLabel
@@ -146,6 +148,7 @@ Rectangle {
146 } 148 }
147 149
148 Row { 150 Row {
151 visible: false
149 spacing: 2 152 spacing: 2
150 Label { 153 Label {
151 id: passwordLabel 154 id: passwordLabel
diff --git a/qml/PlaceEnter.qml b/qml/PlaceEnter.qml
index 6a0e8ac..82b0a6c 100644
--- a/qml/PlaceEnter.qml
+++ b/qml/PlaceEnter.qml
@@ -80,7 +80,7 @@ Rectangle {
80 anchors.left: parent.left 80 anchors.left: parent.left
81 anchors.right: parent.right 81 anchors.right: parent.right
82 wrapMode : Text.Wrap 82 wrapMode : Text.Wrap
83 text: "Please enter the appropriate information about the chat you would like to join." 83 text: "Please enter the necessary information about the place you would like to enter."
84 } 84 }
85 85
86 86
@@ -120,7 +120,7 @@ Rectangle {
120 } 120 }
121 121
122 RadioButton { 122 RadioButton {
123 text: qsTr("List of peers") 123 text: qsTr("Manual")
124 exclusiveGroup: group 124 exclusiveGroup: group
125 } 125 }
126 } 126 }
@@ -154,7 +154,7 @@ Rectangle {
154 spacing: 2 154 spacing: 2
155 Label { 155 Label {
156 id: publicKeyLabel 156 id: publicKeyLabel
157 text: "Public Key:" 157 text: "Public key of place:"
158 width: 100 158 width: 100
159 } 159 }
160 160
@@ -170,7 +170,7 @@ Rectangle {
170 spacing: 2 170 spacing: 2
171 Label { 171 Label {
172 id: originLabel 172 id: originLabel
173 text: "Origin (Empty will join local peer):" 173 text: "Origin (Empty will try local peer):"
174 width: 100 174 width: 100
175 } 175 }
176 176
@@ -208,7 +208,7 @@ Rectangle {
208 spacing: 2 208 spacing: 2
209 209
210 Button { 210 Button {
211 text: "Join" 211 text: "Enter"
212 width: 200 212 width: 200
213 213
214 onClicked: { 214 onClicked: {
diff --git a/qml/PlaceThread.qml b/qml/PlaceThread.qml
index ade60d2..ecca45c 100644
--- a/qml/PlaceThread.qml
+++ b/qml/PlaceThread.qml
@@ -8,6 +8,7 @@ import secushare 1.0
8Rectangle { 8Rectangle {
9 color: "white" 9 color: "white"
10 10
11 property var place: null
11 property var thread: null 12 property var thread: null
12 property bool editable: false // FIXME 13 property bool editable: false // FIXME
13 14
@@ -100,6 +101,7 @@ Rectangle {
100 clip: true 101 clip: true
101 102
102 model: messageListModel 103 model: messageListModel
104 //model: thread
103 delegate: messageDelegate 105 delegate: messageDelegate
104 106
105 Component { 107 Component {
@@ -284,5 +286,82 @@ Rectangle {
284 } 286 }
285 } 287 }
286 } 288 }
289
290 Item {
291 id: replyThread
292 height: 70
293 anchors.left: parent.left
294 anchors.right: parent.right
295 anchors.bottom: parent.bottom
296
297 Rectangle {
298 id: userWrapper
299 width: 60
300 height: 60
301 color: "black"
302 opacity: 1.0
303
304 anchors.left: parent.left
305 anchors.leftMargin: 5
306 anchors.top: parent.top
307
308 Image {
309 id: messageMiniImage
310 source: "images/demo/lynX.jpg"
311 fillMode: Image.PreserveAspectCrop
312 height: 40
313 width: 48
314 anchors.left: parent.left
315 anchors.top: parent.top
316 anchors.margins: 3
317 }
318
319 Text {
320 anchors.top: messageMiniImage.bottom
321 id: contactText
322 text: "lynX"
323 font.pointSize: 10
324 width: 55
325 height: 15
326 anchors.left: parent.left
327 anchors.leftMargin: 5
328
329 wrapMode : Text.Wrap
330 elide : Text.ElideRight
331 color: "white"
332
333 font.family: ubuntuBIFont.name
334 font.letterSpacing : -1
335 }
336 }
337
338 TextArea {
339 anchors.left: userWrapper.right
340 anchors.right: parent.right
341 anchors.top: userWrapper.top
342 anchors.bottom: userWrapper.bottom
343 anchors.rightMargin: 10
344 anchors.leftMargin: 10
345
346 Keys.onReturnPressed: {
347 if (Qt.ControlModifier & event.modifiers)
348 {
349 if (thread) {
350 thread.talk(text)
351 }
352 else
353 {
354 place.talk(text)
355 }
356 cursorPosition = 0
357 text = ""
358 event.accepted = true
359 }
360 else event.accepted = false
361 }
362 }
363
364 }
365
287 } 366 }
288} 367}
diff --git a/qml/main.qml b/qml/main.qml
index 2bf9062..7920656 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -264,6 +264,7 @@ ApplicationWindow {
264 Tab { 264 Tab {
265 PlaceThread { 265 PlaceThread {
266 anchors.fill: parent 266 anchors.fill: parent
267 place: selectedPlace
267 thread: selectedThread 268 thread: selectedThread
268 } 269 }
269 } 270 }
diff --git a/secushare.pro b/secushare.pro
index 32d28d0..ac624a8 100644
--- a/secushare.pro
+++ b/secushare.pro
@@ -17,6 +17,9 @@ QT += qml quick widgets
17 17
18LIBS += -lgnunetutil -lgnunetcore -lgnunetidentity -lgnunetsocial -lgnunetpsycutil -lqrencode 18LIBS += -lgnunetutil -lgnunetcore -lgnunetidentity -lgnunetsocial -lgnunetpsycutil -lqrencode
19 19
20QMAKE_CXXFLAGS += -O0 -g
21QMAKE_CFLAGS += -O0 -g
22
20#include(3rdParty/qzxing-master/QZXing.pro) 23#include(3rdParty/qzxing-master/QZXing.pro)
21 24
22SOURCES += src/main.cpp \ 25SOURCES += src/main.cpp \
diff --git a/src/gnunet/gnunet.cpp b/src/gnunet/gnunet.cpp
index b8b2a29..b5a6b51 100644
--- a/src/gnunet/gnunet.cpp
+++ b/src/gnunet/gnunet.cpp
@@ -142,11 +142,8 @@ GnuNet::mainLoopCallback (void *cls, char *const *args, const char *cfgfile,
142 * Static function 142 * Static function
143 */ 143 */
144void 144void
145GnuNet::processQtEventsTask (void *cls, 145GnuNet::processQtEventsTask (void *cls)
146 const struct GNUNET_SCHEDULER_TaskContext *tc)
147{ 146{
148 Q_UNUSED (tc);
149
150 GnuNet *gnunet = (GnuNet *) cls; 147 GnuNet *gnunet = (GnuNet *) cls;
151 Q_ASSERT (NULL != gnunet); 148 Q_ASSERT (NULL != gnunet);
152 149
@@ -167,12 +164,8 @@ GnuNet::processQtEventsTask (void *cls,
167 * Static function 164 * Static function
168 */ 165 */
169void 166void
170GnuNet::shutdownTask (void *cls, 167GnuNet::shutdownTask (void *cls)
171 const struct GNUNET_SCHEDULER_TaskContext *tc)
172{ 168{
173 Q_UNUSED (tc);
174
175 GnuNet *gnunet = (GnuNet *) cls; 169 GnuNet *gnunet = (GnuNet *) cls;
176 Q_ASSERT (NULL != gnunet); 170 Q_ASSERT (NULL != gnunet);
177
178} 171}
diff --git a/src/gnunet/gnunet.h b/src/gnunet/gnunet.h
index 0de079b..0e42d8a 100644
--- a/src/gnunet/gnunet.h
+++ b/src/gnunet/gnunet.h
@@ -121,12 +121,10 @@ class GnuNet : public QObject
121 const struct GNUNET_CONFIGURATION_Handle *cfg); 121 const struct GNUNET_CONFIGURATION_Handle *cfg);
122 122
123 static void 123 static void
124 processQtEventsTask (void *cls, 124 processQtEventsTask (void *cls);
125 const struct GNUNET_SCHEDULER_TaskContext *tc);
126 125
127 static void 126 static void
128 shutdownTask (void *cls, 127 shutdownTask (void *cls);
129 const struct GNUNET_SCHEDULER_TaskContext *tc);
130 128
131 SocialApp *m_social; 129 SocialApp *m_social;
132 130
diff --git a/src/gnunet/social/guest.cpp b/src/gnunet/social/guest.cpp
index 0108598..cc41528 100644
--- a/src/gnunet/social/guest.cpp
+++ b/src/gnunet/social/guest.cpp
@@ -129,7 +129,7 @@ Guest::talkRequest (Message *msg)
129void 129void
130Guest::talkRequest (QString text) 130Guest::talkRequest (QString text)
131{ 131{
132 Message msg ("_converse", QList<Modifier *>(), text, 0); 132 Message msg (0, "_converse", QList<Modifier *>(), text, 0);
133 talkRequest (&msg); 133 talkRequest (&msg);
134} 134}
135 135
diff --git a/src/gnunet/social/host.cpp b/src/gnunet/social/host.cpp
index 94a8dee..fccc186 100644
--- a/src/gnunet/social/host.cpp
+++ b/src/gnunet/social/host.cpp
@@ -50,8 +50,8 @@ Host::~Host ()
50void 50void
51Host::connectSignals () 51Host::connectSignals ()
52{ 52{
53 connect (this, SIGNAL (announceSignal (QString)), 53 connect (this, SIGNAL (talkSignal (QString, QString)),
54 this, SLOT (announce (QString)), 54 this, SLOT (talk (QString, QString)),
55 Qt::QueuedConnection); 55 Qt::QueuedConnection);
56} 56}
57 57
@@ -68,7 +68,7 @@ Host::answerDoorCallback (void *cls, struct GNUNET_SOCIAL_Nym *nym,
68 "%s\n%.*s\n", method_name, data_size, data); 68 "%s\n%.*s\n", method_name, data_size, data);
69 69
70 Host *host = (Host *) cls; 70 Host *host = (Host *) cls;
71 emit host->answerDoorSignal (new Message (method_name, env, data, data_size, 71 emit host->answerDoorSignal (new Message (0, method_name, env, data, data_size,
72 0, nym)); 72 0, nym));
73} 73}
74 74
@@ -112,7 +112,7 @@ Host::farewellCallback (void *cls,
112 112
113 113
114void 114void
115Host::announce (Message *msg) 115Host::talk (Message *msg)
116{ 116{
117 if (m_inTransmit) 117 if (m_inTransmit)
118 { 118 {
@@ -135,19 +135,11 @@ Host::announce (Message *msg)
135 135
136 136
137void 137void
138Host::announce (QString text)
139{
140 qDebug () << "Host.announce: " << text;
141 Message msg ("_converse", QList<Modifier *>(), text);
142 announce (&msg);
143}
144
145
146void
147Host::talk (QString text) 138Host::talk (QString text)
148{ 139{
149 qDebug () << "Host.talk: " << text; 140 qDebug () << "Host.announce: " << text;
150 emit announceSignal (text); 141 Message msg (this, "_converse", QList<Modifier *>(), text);
142 talk (&msg);
151} 143}
152 144
153 145
diff --git a/src/gnunet/social/host.h b/src/gnunet/social/host.h
index ced0000..2e63793 100644
--- a/src/gnunet/social/host.h
+++ b/src/gnunet/social/host.h
@@ -27,24 +27,21 @@ class Host : public Place
27 27
28 ~Host (); 28 ~Host ();
29 29
30 Q_INVOKABLE void
31 talk (QString text);
32
33 int 30 int
34 zoneAddPlace (QString name); 31 zoneAddPlace (QString name);
35 32
36 public slots: 33 public slots:
37 34
38 void 35 Q_INVOKABLE void
39 announce (Message *msg); 36 talk (Message *msg);
40 37
41 void 38 Q_INVOKABLE void
42 announce (QString text); 39 talk (QString text);
43 40
44 signals: 41 signals:
45 42
46 void 43 void
47 announceSignal (QString text); 44 talkSignal (QString body, QString title = "");
48 45
49 void 46 void
50 answerDoorSignal (Message *msg); 47 answerDoorSignal (Message *msg);
@@ -57,6 +54,7 @@ class Host : public Place
57 void 54 void
58 connectSignals (); 55 connectSignals ();
59 56
57
60 void 58 void
61 entryDecision (GNUNET_SOCIAL_Nym *nym, 59 entryDecision (GNUNET_SOCIAL_Nym *nym,
62 bool isAdmitted, 60 bool isAdmitted,
diff --git a/src/gnunet/social/message.cpp b/src/gnunet/social/message.cpp
index abc3f9c..19d9109 100644
--- a/src/gnunet/social/message.cpp
+++ b/src/gnunet/social/message.cpp
@@ -2,7 +2,8 @@
2#include "modifier.h" 2#include "modifier.h"
3 3
4 4
5Message::Message (QString method, 5Message::Message (Place *place,
6 QString method,
6 QList<Modifier *> env, 7 QList<Modifier *> env,
7 QByteArray data, 8 QByteArray data,
8 uint64_t id, 9 uint64_t id,
@@ -10,6 +11,7 @@ Message::Message (QString method,
10 Message *parent) 11 Message *parent)
11 : QObject (parent) 12 : QObject (parent)
12{ 13{
14 m_place = place;
13 m_id = id; 15 m_id = id;
14 m_nym = nym; 16 m_nym = nym;
15 m_method = method; 17 m_method = method;
@@ -19,7 +21,8 @@ Message::Message (QString method,
19} 21}
20 22
21 23
22Message::Message (QString method, 24Message::Message (Place *place,
25 QString method,
23 QList<Modifier *> env, 26 QList<Modifier *> env,
24 QString text, 27 QString text,
25 uint64_t id, 28 uint64_t id,
@@ -27,6 +30,7 @@ Message::Message (QString method,
27 Message *parent) 30 Message *parent)
28 : QObject (parent) 31 : QObject (parent)
29{ 32{
33 m_place = place;
30 m_id = id; 34 m_id = id;
31 m_nym = nym; 35 m_nym = nym;
32 m_method = method; 36 m_method = method;
@@ -36,7 +40,8 @@ Message::Message (QString method,
36} 40}
37 41
38 42
39Message::Message (const char *method, 43Message::Message (Place *place,
44 const char *method,
40 GNUNET_PSYC_Environment *env, 45 GNUNET_PSYC_Environment *env,
41 const void *data, 46 const void *data,
42 size_t data_size, 47 size_t data_size,
@@ -45,6 +50,7 @@ Message::Message (const char *method,
45 Message *parent) 50 Message *parent)
46 : QObject (parent) 51 : QObject (parent)
47{ 52{
53 m_place = place;
48 m_id = id; 54 m_id = id;
49 m_nym = nym; 55 m_nym = nym;
50 m_method = QString::fromLatin1 (method); 56 m_method = QString::fromLatin1 (method);
@@ -87,7 +93,7 @@ Message::appendData (char *data, size_t data_size)
87 93
88 94
89Modifier * 95Modifier *
90Message::findModifier (const QString name) 96Message::findModifier (const QString name) const
91{ 97{
92 QListIterator<Modifier *> it (m_env); 98 QListIterator<Modifier *> it (m_env);
93 while (it.hasNext ()) 99 while (it.hasNext ())
@@ -221,6 +227,27 @@ Message::index () const
221 : -1; 227 : -1;
222} 228}
223 229
230/*** Signals ***/
231
232void
233Message::reply (QString body, QString title)
234{
235 QList<Modifier *> env;
236 Modifier *id_thread = findModifier ("_id_thread");
237 if (id_thread)
238 env += new Modifier (GNUNET_PSYC_OP_SET, "_id_thread", id_thread->text ());
239
240 Modifier *id_reply = findModifier ("_id_reply");
241 if (id_reply)
242 env += new Modifier (GNUNET_PSYC_OP_SET, "_id_reply", id_reply->text ());
243
244 if (!title.isEmpty ())
245 env += new Modifier (GNUNET_PSYC_OP_SET, "_title", title);
246
247 Message *msg = new Message (m_place, "_converse");
248 m_place->talk (msg);
249}
250
224 251
225/*** Operators ***/ 252/*** Operators ***/
226 253
diff --git a/src/gnunet/social/message.h b/src/gnunet/social/message.h
index b3735ef..12269b5 100644
--- a/src/gnunet/social/message.h
+++ b/src/gnunet/social/message.h
@@ -4,8 +4,11 @@
4#include <QObject> 4#include <QObject>
5#include <QHash> 5#include <QHash>
6#include "modifier.h" 6#include "modifier.h"
7#include "place.h"
7#include "gnunet.h" 8#include "gnunet.h"
8 9
10class Place;
11
9class Message : public QObject 12class Message : public QObject
10{ 13{
11 14
@@ -14,6 +17,10 @@ class Message : public QObject
14 Q_PROPERTY (uint64_t id 17 Q_PROPERTY (uint64_t id
15 READ id); 18 READ id);
16 19
20 Q_PROPERTY (Place *place
21 READ place
22 WRITE setPlace);
23
17 Q_PROPERTY (QString method 24 Q_PROPERTY (QString method
18 READ method 25 READ method
19 WRITE setMethod); 26 WRITE setMethod);
@@ -22,10 +29,14 @@ class Message : public QObject
22 READ text 29 READ text
23 WRITE setText); 30 WRITE setText);
24 31
32 Q_PROPERTY (QString title
33 READ title);
34
25 public: 35 public:
26 36
27 explicit 37 explicit
28 Message (QString method, 38 Message (Place *place,
39 QString method,
29 QList<Modifier *> env = QList<Modifier *>(), 40 QList<Modifier *> env = QList<Modifier *>(),
30 QByteArray data = "", 41 QByteArray data = "",
31 uint64_t id = 0, 42 uint64_t id = 0,
@@ -33,7 +44,8 @@ class Message : public QObject
33 Message *parent = 0); 44 Message *parent = 0);
34 45
35 explicit 46 explicit
36 Message (QString method, 47 Message (Place *place,
48 QString method,
37 QList<Modifier *> env, 49 QList<Modifier *> env,
38 QString text, 50 QString text,
39 uint64_t id = 0, 51 uint64_t id = 0,
@@ -41,7 +53,8 @@ class Message : public QObject
41 Message *parent = 0); 53 Message *parent = 0);
42 54
43 explicit 55 explicit
44 Message (const char *method, 56 Message (Place *place,
57 const char *method,
45 GNUNET_PSYC_Environment *env, 58 GNUNET_PSYC_Environment *env,
46 const void *data = 0, 59 const void *data = 0,
47 size_t data_size = 0, 60 size_t data_size = 0,
@@ -63,7 +76,7 @@ class Message : public QObject
63 appendData (char *data, size_t data_size); 76 appendData (char *data, size_t data_size);
64 77
65 Modifier * 78 Modifier *
66 findModifier (const QString name); 79 findModifier (const QString name) const;
67 80
68 GNUNET_PSYC_Message * 81 GNUNET_PSYC_Message *
69 toPsyc (); 82 toPsyc ();
@@ -129,6 +142,19 @@ class Message : public QObject
129 } 142 }
130 143
131 144
145 Place *
146 place () const
147 {
148 return m_place;
149 }
150
151 void
152 setPlace (Place *place)
153 {
154 m_place = place;
155 }
156
157
132 QString 158 QString
133 method () const 159 method () const
134 { 160 {
@@ -180,6 +206,21 @@ class Message : public QObject
180 m_data = text.toUtf8 (); 206 m_data = text.toUtf8 ();
181 } 207 }
182 208
209 QString
210 title () const
211 {
212 Modifier *title = findModifier ("_title");
213 if (title) {
214 return title->text ();
215 }
216 return QString ();
217 }
218
219 public slots:
220
221 void
222 reply (QString body, QString title = "");
223
183 224
184 signals: 225 signals:
185 226
@@ -194,6 +235,7 @@ class Message : public QObject
194 235
195 private: 236 private:
196 237
238 Place *m_place;
197 uint64_t m_id; 239 uint64_t m_id;
198 GNUNET_SOCIAL_Nym *m_nym; 240 GNUNET_SOCIAL_Nym *m_nym;
199 QString m_method; 241 QString m_method;
diff --git a/src/gnunet/social/place.cpp b/src/gnunet/social/place.cpp
index 8b1f4f3..e160378 100644
--- a/src/gnunet/social/place.cpp
+++ b/src/gnunet/social/place.cpp
@@ -34,6 +34,9 @@ Place::init (const GNUNET_CRYPTO_EddsaPublicKey pubKey)
34 34
35 setPubKey (pubKey); 35 setPubKey (pubKey);
36 setName (pubKeyStr); 36 setName (pubKeyStr);
37
38 // FIXME: request state and store it in a hash map
39 // GNUNET_SOCIAL_place_look_for (m_plc, "", ...);
37} 40}
38 41
39/** 42/**
@@ -50,22 +53,28 @@ Place::copyToClipboard ()
50/** 53/**
51 * Send a message to the place. 54 * Send a message to the place.
52 * 55 *
53 * @param text 56 * @param msg
54 * The message. 57 * The message.
55 */ 58 */
56void 59void
57Place::talk (QString text) 60Place::talk (Message *msg)
58{ 61{
59#if FIXME 62 emit talkSignal (msg);
60 if (m_isHost) 63}
61 { 64
62 emit hostTalkSignal (this, text); 65
63 } 66/**
64 else 67 * Send a message to the place.
65 { 68 *
66 emit guestTalkSignal (this, text); 69 * @param body
67 } 70 * Message body.
68#endif 71 * @param title
72 * Message title.
73 */
74void
75Place::talk (QString body, QString title)
76{
77 emit talkSignal (body, title);
69} 78}
70 79
71 80
@@ -106,7 +115,7 @@ Place::recvMethod (const struct GNUNET_PSYC_MessageHeader *msg,
106 message_id, method_name); 115 message_id, method_name);
107 if (m_msg) 116 if (m_msg)
108 delete m_msg; 117 delete m_msg;
109 m_msg = new Message (method_name); 118 m_msg = new Message (this, method_name);
110 m_mod = 0; 119 m_mod = 0;
111} 120}
112 121
@@ -248,7 +257,7 @@ Place::insertMessage (Message *msg)
248 { 257 {
249 // Create a placeholder message that will be replaced 258 // Create a placeholder message that will be replaced
250 // when the missing message arrives (or not if it's not in a thread). 259 // when the missing message arrives (or not if it's not in a thread).
251 thread = new Message ("_INTERNAL_missing"); 260 thread = new Message (this, "_INTERNAL_missing");
252 // methods or variables of the _INTERNAL family must never be sent 261 // methods or variables of the _INTERNAL family must never be sent
253 // over the wire! history replay must ensure that. -lynX 262 // over the wire! history replay must ensure that. -lynX
254 263
diff --git a/src/gnunet/social/place.h b/src/gnunet/social/place.h
index c5445be..7e7f168 100644
--- a/src/gnunet/social/place.h
+++ b/src/gnunet/social/place.h
@@ -5,6 +5,7 @@
5#include "message.h" 5#include "message.h"
6#include "gnunet.h" 6#include "gnunet.h"
7 7
8class Message;
8 9
9class Place : public QObject 10class Place : public QObject
10{ 11{
@@ -97,11 +98,20 @@ class Place : public QObject
97 return m_threads; 98 return m_threads;
98 } 99 }
99 100
100 Q_INVOKABLE void 101 Q_INVOKABLE
102 void
101 copyToClipboard (); 103 copyToClipboard ();
102 104
103 Q_INVOKABLE void 105public slots:
104 talk (QString text); 106
107 Q_INVOKABLE
108 void
109 talk (Message *msg);
110
111 Q_INVOKABLE
112 void
113 talk (QString body, QString title);
114
105 115
106 protected: 116 protected:
107 117
@@ -238,14 +248,13 @@ class Place : public QObject
238 248
239 void threadAdded (Message *msg); 249 void threadAdded (Message *msg);
240 250
241#if FIXME 251 void talkSignal (Message *msg);
242 void talkSignal (QString text); 252 void talkSignal (QString body, QString title);
243 253
254#if FIXME
244 void setTrayMessage (QString place, QString text); 255 void setTrayMessage (QString place, QString text);
245#endif 256#endif
246 257
247public slots:
248
249}; 258};
250 259
251#endif 260#endif
diff --git a/src/gnunet/social/socialapp.cpp b/src/gnunet/social/socialapp.cpp
index e739574..144851b 100644
--- a/src/gnunet/social/socialapp.cpp
+++ b/src/gnunet/social/socialapp.cpp
@@ -15,13 +15,14 @@ SocialApp::SocialApp (struct GNUNET_CONFIGURATION_Handle *config,
15 egoCallback, 15 egoCallback,
16 hostPlaceCallback, 16 hostPlaceCallback,
17 guestPlaceCallback, 17 guestPlaceCallback,
18 appConnectedCallback,
18 this); 19 this);
19} 20}
20 21
21 22
22SocialApp::~SocialApp () 23SocialApp::~SocialApp ()
23{ 24{
24 GNUNET_SOCIAL_app_disconnect (m_app); 25 GNUNET_SOCIAL_app_disconnect (m_app, NULL, NULL);
25} 26}
26 27
27 28
@@ -75,6 +76,12 @@ SocialApp::guestPlaceCallback (void *cls,
75} 76}
76 77
77 78
79void
80SocialApp::appConnectedCallback (void *cls)
81{
82}
83
84
78Ego * 85Ego *
79SocialApp::findEgo (const QString pubKeyStr) 86SocialApp::findEgo (const QString pubKeyStr)
80{ 87{
diff --git a/src/gnunet/social/socialapp.h b/src/gnunet/social/socialapp.h
index 36b4ee4..c8a32a7 100644
--- a/src/gnunet/social/socialapp.h
+++ b/src/gnunet/social/socialapp.h
@@ -90,6 +90,8 @@ class SocialApp : public QObject
90 const struct GNUNET_CRYPTO_EddsaPublicKey *placePubKey, 90 const struct GNUNET_CRYPTO_EddsaPublicKey *placePubKey,
91 enum GNUNET_SOCIAL_AppPlaceState placeState); 91 enum GNUNET_SOCIAL_AppPlaceState placeState);
92 92
93 static void
94 appConnectedCallback (void *cls);
93}; 95};
94 96
95#endif 97#endif
diff --git a/src/model/ThreadListModel.cpp b/src/model/ThreadListModel.cpp
index aec692d..7c6ca0c 100644
--- a/src/model/ThreadListModel.cpp
+++ b/src/model/ThreadListModel.cpp
@@ -36,16 +36,14 @@ ThreadListModel::data (const QModelIndex &index, int role) const
36 36
37 switch (role) 37 switch (role)
38 { 38 {
39#if FIXME 39 case METHOD:
40 case NAME: 40 return msg->method ();
41 return msg->name (); 41 case TEXT:
42 return msg->text ();
43 case TITLE:
44 return msg->title ();
42 case PUBKEY: 45 case PUBKEY:
43 return msg->pubKeyString (); 46 return msg->place ()->pubKeyString ();
44 case TYPE:
45 return msg->type ();
46 case DESC:
47 return msg->desc ();
48#endif
49 default: 47 default:
50 return QVariant(); 48 return QVariant();
51 } 49 }
@@ -57,9 +55,9 @@ ThreadListModel::roleNames () const
57{ 55{
58 QHash<int, QByteArray> roles; 56 QHash<int, QByteArray> roles;
59 57
60 roles[TITLE] = "title"; 58 roles[METHOD] = "method";
61 roles[TEXT] = "text"; 59 roles[TEXT] = "text";
62 roles[TYPE] = "type"; 60 roles[TITLE] = "title";
63 roles[PUBKEY] = "pubKey"; 61 roles[PUBKEY] = "pubKey";
64 62
65 return roles; 63 return roles;
diff --git a/src/model/ThreadListModel.h b/src/model/ThreadListModel.h
index 5c6d94c..57897a4 100644
--- a/src/model/ThreadListModel.h
+++ b/src/model/ThreadListModel.h
@@ -15,9 +15,9 @@ class ThreadListModel : public QAbstractListModel
15 15
16 enum ThreadListRoles 16 enum ThreadListRoles
17 { 17 {
18 TITLE = Qt::UserRole + 1, 18 METHOD = Qt::UserRole + 1,
19 TYPE,
20 TEXT, 19 TEXT,
20 TITLE,
21 PUBKEY, 21 PUBKEY,
22 THREADLIST_ROLE_COUNT 22 THREADLIST_ROLE_COUNT
23 }; 23 };