Merge lp:~boiko/telephony-service/history_messaging_menu into lp:telephony-service

Proposed by Gustavo Pichorim Boiko
Status: Work in progress
Proposed branch: lp:~boiko/telephony-service/history_messaging_menu
Merge into: lp:telephony-service
Diff against target: 609 lines (+307/-130)
9 files modified
CMakeLists.txt (+1/-0)
indicator/CMakeLists.txt (+4/-1)
indicator/historyloader.cpp (+207/-0)
indicator/historyloader.h (+57/-0)
indicator/main.cpp (+12/-5)
indicator/messagingmenu.h (+1/-0)
indicator/notifications.cpp (+17/-99)
indicator/notifications.h (+7/-23)
libtelephonyservice/chatmanager.h (+1/-2)
To merge this branch: bzr merge lp:~boiko/telephony-service/history_messaging_menu
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+193976@code.launchpad.net

Commit message

Use the history service to populate the messaging menu.

Description of the change

Use the history service to populate the messaging menu.

To post a comment you must log in.
760. By Gustavo Pichorim Boiko

Merge latest changes from trunk.

Unmerged revisions

760. By Gustavo Pichorim Boiko

Merge latest changes from trunk.

759. By Gustavo Pichorim Boiko

Start implementing the messaging menu populating using the history service.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-10-09 21:59:42 +0000
3+++ CMakeLists.txt 2013-12-11 13:06:39 +0000
4@@ -61,6 +61,7 @@
5 pkg_check_modules(MESSAGING_MENU REQUIRED messaging-menu)
6 pkg_check_modules(GSETTINGS REQUIRED gsettings-qt)
7 pkg_check_modules(UserMetrics REQUIRED libusermetricsinput-1)
8+pkg_check_modules(HISTORY REQUIRED history-service)
9
10 add_definitions(-DQT_NO_KEYWORDS)
11
12
13=== modified file 'indicator/CMakeLists.txt'
14--- indicator/CMakeLists.txt 2013-09-25 21:18:46 +0000
15+++ indicator/CMakeLists.txt 2013-12-11 13:06:39 +0000
16@@ -1,9 +1,10 @@
17
18 set(qt_SRCS
19 callchannelobserver.cpp
20+ historyloader.cpp
21 messagingmenu.cpp
22 metrics.cpp
23- textchannelobserver.cpp
24+ notifications.cpp
25 voicemailindicator.cpp
26 )
27
28@@ -17,6 +18,7 @@
29 ${CMAKE_SOURCE_DIR}/libtelephonyservice
30 ${CMAKE_CURRENT_BINARY_DIR}
31 ${UserMetrics_INCLUDE_DIRS}
32+ ${HISTORY_INCLUDE_DIRS}
33 )
34
35 link_directories(${MESSAGING_MENU_LIBRARY_DIRS})
36@@ -30,6 +32,7 @@
37 ${MESSAGING_MENU_LIBRARIES}
38 ${GSETTINGS_LIBRARIES}
39 ${UserMetrics_LIBRARIES}
40+ ${HISTORY_LIBRARIES}
41 telephonyservice
42 )
43
44
45=== added file 'indicator/historyloader.cpp'
46--- indicator/historyloader.cpp 1970-01-01 00:00:00 +0000
47+++ indicator/historyloader.cpp 2013-12-11 13:06:39 +0000
48@@ -0,0 +1,207 @@
49+/*
50+ * Copyright (C) 2013 Canonical, Ltd.
51+ *
52+ * Authors:
53+ * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
54+ *
55+ * This file is part of telephony-service.
56+ *
57+ * telephony-service is free software; you can redistribute it and/or modify
58+ * it under the terms of the GNU General Public License as published by
59+ * the Free Software Foundation; version 3.
60+ *
61+ * telephony-service is distributed in the hope that it will be useful,
62+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
63+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64+ * GNU General Public License for more details.
65+ *
66+ * You should have received a copy of the GNU General Public License
67+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
68+ */
69+
70+#include "historyloader.h"
71+#include "messagingmenu.h"
72+#include "metrics.h"
73+#include "notifications.h"
74+#include <History/EventView>
75+#include <History/IntersectionFilter>
76+#include <History/Manager>
77+#include <History/TextEvent>
78+#include <History/VoiceEvent>
79+
80+HistoryLoader::HistoryLoader(QObject *parent) :
81+ QObject(parent)
82+{
83+ loadMessages();
84+ loadCalls();
85+}
86+
87+HistoryLoader *HistoryLoader::instance()
88+{
89+ static HistoryLoader *self = new HistoryLoader();
90+ return self;
91+}
92+
93+void HistoryLoader::loadMessages()
94+{
95+ if (!mTextEventView.isNull()) {
96+ mTextEventView->deleteLater();
97+ }
98+
99+ if (!mSentTextEventView.isNull()) {
100+ mSentTextEventView->deleteLater();
101+ }
102+
103+ History::IntersectionFilter filter;
104+ // FIXME: maybe we should not hardcode the accountId?
105+ filter.append(History::Filter(History::FieldAccountId, "ofono/ofono/account0"));
106+ filter.append(History::Filter(History::FieldNewEvent, true));
107+
108+ mTextEventView = History::Manager::instance()->queryEvents(History::EventTypeText, History::Sort(), filter);
109+ connect(mTextEventView.data(),
110+ SIGNAL(eventsAdded(History::Events)),
111+ SLOT(onTextEventsAdded(History::Events)));
112+ connect(mTextEventView.data(),
113+ SIGNAL(eventsModified(History::Events)),
114+ SLOT(onTextEventsModified(History::Events)));
115+ connect(mTextEventView.data(),
116+ SIGNAL(eventsRemoved(History::Events)),
117+ SLOT(onTextEventsRemoved(History::Events)));
118+ connect(mTextEventView.data(),
119+ SIGNAL(invalidated()),
120+ SLOT(loadMessages()));
121+
122+ History::Events events = mTextEventView->nextPage();
123+ while (!events.isEmpty()) {
124+ // add the events to the messaging menu
125+ Q_FOREACH(const History::Event &event, events) {
126+ History::TextEvent textEvent(event);
127+
128+ // add the message to the messaging menu (use hex format to avoid invalid characters)
129+ QByteArray token(textEvent.eventId().toUtf8());
130+ MessagingMenu::instance()->addMessage(textEvent.senderId(), token.toHex(), textEvent.timestamp(), textEvent.message());
131+ }
132+ events = mTextEventView->nextPage();
133+ }
134+
135+ // create a view just to get signals of sent messages
136+ filter.clear();
137+ filter.append(History::Filter(History::FieldAccountId, "ofono/ofono/account0"));
138+ filter.append(History::Filter(History::FieldSenderId, "self"));
139+ mSentTextEventView = History::Manager::instance()->queryEvents(History::EventTypeText, History::Sort(), filter);
140+ connect(mSentTextEventView.data(),
141+ SIGNAL(eventsAdded(History::Events)),
142+ SLOT(onTextEventsSent(History::Events)));
143+ connect(mSentTextEventView.data(),
144+ SIGNAL(invalidated()),
145+ SLOT(loadMessages()));
146+}
147+
148+void HistoryLoader::loadCalls()
149+{
150+ if (!mVoiceEventView.isNull()) {
151+ mVoiceEventView->deleteLater();
152+ }
153+
154+ History::IntersectionFilter filter;
155+ // FIXME: maybe we should not hardcode the accountId?
156+ filter.append(History::Filter(History::FieldAccountId, "ofono/ofono/account0"));
157+ filter.append(History::Filter(History::FieldNewEvent, true));
158+ filter.append(History::Filter(History::FieldMissed, true));
159+ mVoiceEventView = History::Manager::instance()->queryEvents(History::EventTypeVoice, History::Sort(), filter);
160+ connect(mVoiceEventView.data(),
161+ SIGNAL(eventsAdded(History::Events)),
162+ SLOT(onVoiceEventsAdded(History::Events)));
163+ connect(mVoiceEventView.data(),
164+ SIGNAL(invalidated()),
165+ SLOT(loadCalls()));
166+
167+ History::Events events = mVoiceEventView->nextPage();
168+ while (!events.isEmpty()) {
169+ Q_FOREACH(const History::Event &event, events) {
170+ History::VoiceEvent voiceEvent(event);
171+ MessagingMenu::instance()->addCall(voiceEvent.senderId(), voiceEvent.timestamp());
172+ }
173+ }
174+}
175+
176+void HistoryLoader::onTextEventsAdded(const History::Events &events)
177+{
178+ Q_FOREACH(const History::Event &event, events) {
179+ History::TextEvent textEvent(event);
180+
181+ // add the message to the messaging menu (use hex format to avoid invalid characters)
182+ QByteArray token(textEvent.eventId().toUtf8());
183+ MessagingMenu::instance()->addMessage(textEvent.senderId(), token.toHex(), textEvent.timestamp(), textEvent.message());
184+
185+ // and show the notify OSD notification
186+ Notifications::instance()->showNotificationForMessage(textEvent.senderId(), textEvent.message());
187+
188+ // update the metrics
189+ Metrics::instance()->increment(Metrics::ReceivedMessages);
190+ }
191+}
192+
193+void HistoryLoader::onTextEventsSent(const History::Events &events)
194+{
195+ // just increase the metrics
196+ Metrics::instance()->increment(Metrics::SentMessages, events.count());
197+}
198+
199+void HistoryLoader::onTextEventsModified(const History::Events &events)
200+{
201+ Q_FOREACH(const History::Event &event, events) {
202+ // we only support removing events from the menu
203+ if (!event.newEvent()) {
204+ MessagingMenu::instance()->removeMessage(event.eventId());
205+ }
206+ }
207+}
208+
209+void HistoryLoader::onTextEventsRemoved(const History::Events &events)
210+{
211+ Q_FOREACH(const History::Event &event, events) {
212+ // we only support removing events from the menu
213+ MessagingMenu::instance()->removeMessage(event.eventId());
214+ }
215+}
216+
217+void HistoryLoader::onVoiceEventsAdded(const History::Events &events)
218+{
219+ Q_FOREACH(const History::Event &event, events) {
220+ History::VoiceEvent voiceEvent(event);
221+ if (voiceEvent.missed()) {
222+ MessagingMenu::instance()->addCall(voiceEvent.senderId(), voiceEvent.timestamp());
223+ } else {
224+ Metrics::instance()->increment(Metrics::CallDurations, QTime(0,0,0).secsTo(voiceEvent.duration()));
225+ }
226+
227+ if (voiceEvent.senderId() != "self") {
228+ Metrics::instance()->increment(Metrics::IncomingCalls);
229+ } else {
230+ Metrics::instance()->increment(Metrics::OutgoingCalls);
231+ }
232+ }
233+}
234+
235+void HistoryLoader::onMessageRead(const QString &phoneNumber, const QString &messageId)
236+{
237+ History::Thread thread = History::Manager::instance()->threadForParticipants("ofono/ofono/account0",
238+ History::EventTypeText,
239+ QStringList() << phoneNumber,
240+ History::MatchPhoneNumber);
241+ if (thread.isNull()) {
242+ return;
243+ }
244+
245+ History::TextEvent event = History::Manager::instance()->getSingleEvent(History::EventTypeText,
246+ "ofono/ofono/account0",
247+ thread.threadId(),
248+ messageId);
249+ if (event.isNull() || !event.newEvent()) {
250+ return;
251+ }
252+
253+ event.setNewEvent(false);
254+ History::Manager::instance()->writeEvents(History::Events() << event);
255+}
256
257=== added file 'indicator/historyloader.h'
258--- indicator/historyloader.h 1970-01-01 00:00:00 +0000
259+++ indicator/historyloader.h 2013-12-11 13:06:39 +0000
260@@ -0,0 +1,57 @@
261+/*
262+ * Copyright (C) 2013 Canonical, Ltd.
263+ *
264+ * Authors:
265+ * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
266+ *
267+ * This file is part of telephony-service.
268+ *
269+ * telephony-service is free software; you can redistribute it and/or modify
270+ * it under the terms of the GNU General Public License as published by
271+ * the Free Software Foundation; version 3.
272+ *
273+ * telephony-service is distributed in the hope that it will be useful,
274+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
275+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
276+ * GNU General Public License for more details.
277+ *
278+ * You should have received a copy of the GNU General Public License
279+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
280+ */
281+
282+#ifndef HISTORYLOADER_H
283+#define HISTORYLOADER_H
284+
285+#include <QObject>
286+#include <History/Types>
287+#include <History/Event>
288+
289+class HistoryLoader : public QObject
290+{
291+ Q_OBJECT
292+public:
293+ static HistoryLoader *instance();
294+
295+public Q_SLOTS:
296+ void loadMessages();
297+ void loadCalls();
298+
299+private Q_SLOTS:
300+ void onTextEventsAdded(const History::Events &events);
301+ void onTextEventsSent(const History::Events &events);
302+ void onTextEventsModified(const History::Events &events);
303+ void onTextEventsRemoved(const History::Events &events);
304+ void onVoiceEventsAdded(const History::Events &events);
305+ void onMessageRead(const QString &phoneNumber, const QString &messageId);
306+
307+private:
308+ explicit HistoryLoader(QObject *parent = 0);
309+
310+ History::EventViewPtr mTextEventView;
311+ History::EventViewPtr mSentTextEventView;
312+ History::EventViewPtr mVoiceEventView;
313+
314+
315+};
316+
317+#endif // HISTORYLOADER_H
318
319=== modified file 'indicator/main.cpp'
320--- indicator/main.cpp 2013-09-25 21:18:46 +0000
321+++ indicator/main.cpp 2013-12-11 13:06:39 +0000
322@@ -23,10 +23,12 @@
323 #include <libnotify/notify.h>
324
325 #include "applicationutils.h"
326+#include "chatmanager.h"
327 #include "callchannelobserver.h"
328+#include "historyloader.h"
329 #include "metrics.h"
330 #include "telepathyhelper.h"
331-#include "textchannelobserver.h"
332+#include "messagingmenu.h"
333 #include "voicemailindicator.h"
334 #include <QCoreApplication>
335 #include <TelepathyQt/ClientRegistrar>
336@@ -60,9 +62,6 @@
337
338 // Connect the textObserver and the callObserver to the channel observer in TelepathyHelper
339 CallChannelObserver *callObserver = new CallChannelObserver();
340- TextChannelObserver *textObserver = new TextChannelObserver();
341- QObject::connect(TelepathyHelper::instance()->channelObserver(), SIGNAL(textChannelAvailable(Tp::TextChannelPtr)),
342- textObserver, SLOT(onTextChannelAvailable(Tp::TextChannelPtr)));
343 QObject::connect(TelepathyHelper::instance()->channelObserver(), SIGNAL(callChannelAvailable(Tp::CallChannelPtr)),
344 callObserver, SLOT(onCallChannelAvailable(Tp::CallChannelPtr)));
345
346@@ -70,8 +69,16 @@
347 VoiceMailIndicator voiceMailIndicator;
348 Q_UNUSED(voiceMailIndicator);
349
350- // instanciate the metrics helper
351+ // instanciate the singletons
352+ HistoryLoader::instance();
353 Metrics::instance();
354
355+ // forward the replies from messaging menu to the chat manager
356+ QObject::connect(MessagingMenu::instance(), SIGNAL(replyReceived(QString,QString)),
357+ ChatManager::instance(), SLOT(sendMessage(QString,QString)));
358+
359+ // just to make sure, ack the message on the telepathy level
360+ QObject::connect(MessagingMenu::instance(), SIGNAL(messageRead(QString,QString)),
361+ ChatManager::instance(), SLOT(acknowledgeMessage(QString,QString)));
362 return app.exec();
363 }
364
365=== modified file 'indicator/messagingmenu.h'
366--- indicator/messagingmenu.h 2013-10-11 21:08:18 +0000
367+++ indicator/messagingmenu.h 2013-12-11 13:06:39 +0000
368@@ -25,6 +25,7 @@
369 #include <QObject>
370 #include <QMap>
371 #include <QDBusInterface>
372+#include <QUrl>
373 #include <messaging-menu.h>
374
375 class Call
376
377=== renamed file 'indicator/textchannelobserver.cpp' => 'indicator/notifications.cpp'
378--- indicator/textchannelobserver.cpp 2013-10-07 19:20:02 +0000
379+++ indicator/notifications.cpp 2013-12-11 13:06:39 +0000
380@@ -21,16 +21,10 @@
381
382 #include <libnotify/notify.h>
383 #include "applicationutils.h"
384-#include "textchannelobserver.h"
385-#include "messagingmenu.h"
386-#include "metrics.h"
387-#include "chatmanager.h"
388+#include "notifications.h"
389 #include "config.h"
390 #include "contactutils.h"
391 #include "ringtone.h"
392-#include <TelepathyQt/AvatarData>
393-#include <TelepathyQt/TextChannel>
394-#include <TelepathyQt/ReceivedMessage>
395 #include <QContactAvatar>
396 #include <QContactFetchRequest>
397 #include <QContactPhoneNumber>
398@@ -69,31 +63,25 @@
399 }
400 }
401
402-TextChannelObserver::TextChannelObserver(QObject *parent) :
403+Notifications::Notifications(QObject *parent) :
404 QObject(parent)
405 {
406- connect(MessagingMenu::instance(),
407- SIGNAL(replyReceived(QString,QString)),
408- SLOT(onReplyReceived(QString,QString)));
409- connect(MessagingMenu::instance(),
410- SIGNAL(messageRead(QString,QString)),
411- SLOT(onMessageRead(QString,QString)));
412-}
413-
414-void TextChannelObserver::showNotificationForMessage(const Tp::ReceivedMessage &message)
415-{
416- Tp::ContactPtr contact = message.sender();
417-
418+}
419+
420+Notifications *Notifications::instance()
421+{
422+ static Notifications *self = new Notifications();
423+ return self;
424+}
425+
426+void Notifications::showNotificationForMessage(const QString &sender, const QString &message)
427+{
428 // try to match the contact info
429 QContactFetchRequest *request = new QContactFetchRequest(this);
430- request->setFilter(QContactPhoneNumber::match(contact->id()));
431-
432- // add the message to the messaging menu (use hex format to avoid invalid characters)
433- QByteArray token(message.messageToken().toUtf8());
434- MessagingMenu::instance()->addMessage(contact->id(), token.toHex(), message.received(), message.text());
435+ request->setFilter(QContactPhoneNumber::match(sender));
436
437 // place the notify-notification item only after the contact fetch request is finished, as we canĀ“t simply update
438- QObject::connect(request, &QContactAbstractRequest::stateChanged, [request, message, contact]() {
439+ QObject::connect(request, &QContactAbstractRequest::stateChanged, [request, message, sender]() {
440 // only process the results after the finished state is reached
441 if (request->state() != QContactAbstractRequest::FinishedState) {
442 return;
443@@ -108,7 +96,7 @@
444 avatar = contact.detail<QContactAvatar>().imageUrl().toEncoded();
445 }
446
447- QString title = QString::fromUtf8(C::gettext("SMS from %1")).arg(displayLabel.isEmpty() ? contact->alias() : displayLabel);
448+ QString title = QString::fromUtf8(C::gettext("SMS from %1")).arg(displayLabel.isEmpty() ? sender : displayLabel);
449
450 if (avatar.isEmpty()) {
451 avatar = QUrl(telephonyServiceDir() + "assets/avatar-default@18.png").toEncoded();
452@@ -117,12 +105,12 @@
453 qDebug() << title << avatar;
454 // show the notification
455 NotifyNotification *notification = notify_notification_new(title.toStdString().c_str(),
456- message.text().toStdString().c_str(),
457+ message.toStdString().c_str(),
458 avatar.toStdString().c_str());
459
460 // add the callback action
461 NotificationData *data = new NotificationData();
462- data->phoneNumber = contact->id();
463+ data->phoneNumber = sender;
464 notify_notification_add_action (notification,
465 "notification_action",
466 C::gettext("View message"),
467@@ -146,73 +134,3 @@
468 request->setManager(ContactUtils::sharedManager());
469 request->start();
470 }
471-
472-Tp::TextChannelPtr TextChannelObserver::channelFromPath(const QString &path)
473-{
474- Q_FOREACH(Tp::TextChannelPtr channel, mChannels) {
475- if (channel->objectPath() == path) {
476- return channel;
477- }
478- }
479-
480- return Tp::TextChannelPtr(0);
481-}
482-
483-void TextChannelObserver::onTextChannelAvailable(Tp::TextChannelPtr textChannel)
484-{
485- connect(textChannel.data(),
486- SIGNAL(invalidated(Tp::DBusProxy*,const QString&, const QString&)),
487- SLOT(onTextChannelInvalidated()));
488- connect(textChannel.data(),
489- SIGNAL(messageReceived(const Tp::ReceivedMessage&)),
490- SLOT(onMessageReceived(const Tp::ReceivedMessage&)));
491- connect(textChannel.data(),
492- SIGNAL(pendingMessageRemoved(const Tp::ReceivedMessage&)),
493- SLOT(onPendingMessageRemoved(const Tp::ReceivedMessage&)));
494- connect(textChannel.data(),
495- SIGNAL(messageSent(Tp::Message,Tp::MessageSendingFlags,QString)),
496- SLOT(onMessageSent(Tp::Message,Tp::MessageSendingFlags,QString)));
497-
498- mChannels.append(textChannel);
499-
500- // notify all the messages from the channel
501- Q_FOREACH(Tp::ReceivedMessage message, textChannel->messageQueue()) {
502- onMessageReceived(message);
503- }
504-}
505-
506-void TextChannelObserver::onTextChannelInvalidated()
507-{
508- Tp::TextChannelPtr textChannel(qobject_cast<Tp::TextChannel*>(sender()));
509- mChannels.removeAll(textChannel);
510-}
511-
512-void TextChannelObserver::onMessageReceived(const Tp::ReceivedMessage &message)
513-{
514- // do not place notification items for scrollback messages
515- if (!message.isScrollback() && !message.isDeliveryReport() && !message.isRescued()) {
516- showNotificationForMessage(message);
517- Metrics::instance()->increment(Metrics::ReceivedMessages);
518- }
519-}
520-
521-void TextChannelObserver::onPendingMessageRemoved(const Tp::ReceivedMessage &message)
522-{
523- MessagingMenu::instance()->removeMessage(message.messageToken());
524-}
525-
526-void TextChannelObserver::onReplyReceived(const QString &phoneNumber, const QString &reply)
527-{
528- ChatManager::instance()->sendMessage(phoneNumber, reply);
529-}
530-
531-void TextChannelObserver::onMessageRead(const QString &phoneNumber, const QString &encodedMessageId)
532-{
533- QString messageId(QByteArray::fromHex(encodedMessageId.toUtf8()));
534- ChatManager::instance()->acknowledgeMessage(phoneNumber, messageId);
535-}
536-
537-void TextChannelObserver::onMessageSent(Tp::Message, Tp::MessageSendingFlags, QString)
538-{
539- Metrics::instance()->increment(Metrics::SentMessages);
540-}
541
542=== renamed file 'indicator/textchannelobserver.h' => 'indicator/notifications.h'
543--- indicator/textchannelobserver.h 2013-09-25 21:18:46 +0000
544+++ indicator/notifications.h 2013-12-11 13:06:39 +0000
545@@ -19,36 +19,20 @@
546 * along with this program. If not, see <http://www.gnu.org/licenses/>.
547 */
548
549-#ifndef TEXTCHANNELOBSERVER_H
550-#define TEXTCHANNELOBSERVER_H
551+#ifndef NOTIFICATIONS_H
552+#define NOTIFICATIONS_H
553
554 #include <QObject>
555-#include <TelepathyQt/TextChannel>
556-#include <TelepathyQt/ReceivedMessage>
557
558-class TextChannelObserver : public QObject
559+class Notifications : public QObject
560 {
561 Q_OBJECT
562 public:
563- explicit TextChannelObserver(QObject *parent = 0);
564-
565-public Q_SLOTS:
566- void onTextChannelAvailable(Tp::TextChannelPtr textChannel);
567-
568-protected:
569- void showNotificationForMessage(const Tp::ReceivedMessage &message);
570- Tp::TextChannelPtr channelFromPath(const QString &path);
571-
572-protected Q_SLOTS:
573- void onTextChannelInvalidated();
574- void onMessageReceived(const Tp::ReceivedMessage &message);
575- void onPendingMessageRemoved(const Tp::ReceivedMessage &message);
576- void onReplyReceived(const QString &phoneNumber, const QString &reply);
577- void onMessageRead(const QString &phoneNumber, const QString &encodedMessageId);
578- void onMessageSent(Tp::Message, Tp::MessageSendingFlags, QString);
579+ static Notifications *instance();
580+ void showNotificationForMessage(const QString &sender, const QString &message);
581
582 private:
583- QList<Tp::TextChannelPtr> mChannels;
584+ explicit Notifications(QObject *parent = 0);
585 };
586
587-#endif // TEXTCHANNELOBSERVER_H
588+#endif // NOTIFICATIONS_H
589
590=== modified file 'libtelephonyservice/chatmanager.h'
591--- libtelephonyservice/chatmanager.h 2013-07-18 17:02:10 +0000
592+++ libtelephonyservice/chatmanager.h 2013-12-11 13:06:39 +0000
593@@ -34,8 +34,6 @@
594 public:
595 static ChatManager *instance();
596
597- Q_INVOKABLE void sendMessage(const QString &phoneNumber, const QString &message);
598-
599 int unreadMessagesCount() const;
600 int unreadMessages(const QString &phoneNumber);
601
602@@ -51,6 +49,7 @@
603 void onMessageSent(const Tp::Message &sentMessage, const Tp::MessageSendingFlags flags, const QString &message);
604
605 void acknowledgeMessage(const QString &phoneNumber, const QString &messageId);
606+ void sendMessage(const QString &phoneNumber, const QString &message);
607
608 protected:
609 Tp::TextChannelPtr existingChat(const QString &phoneNumber);

Subscribers

People subscribed via source and target branches