Merge lp:~boiko/history-service/rtm-remove_obsolete_tools into lp:history-service/rtm-14.09

Proposed by Gustavo Pichorim Boiko
Status: Merged
Approved by: Bill Filler
Approved revision: 171
Merged at revision: 177
Proposed branch: lp:~boiko/history-service/rtm-remove_obsolete_tools
Merge into: lp:history-service/rtm-14.09
Diff against target: 722 lines (+1/-640)
12 files modified
CMakeLists.txt (+0/-1)
debian/control (+1/-3)
debian/history-service-tools.install (+0/-1)
tools/CMakeLists.txt (+0/-4)
tools/qmlclient/items.qml (+0/-73)
tools/qmlclient/sample_client.qml (+0/-86)
tools/tplogger-import/CMakeLists.txt (+0/-24)
tools/tplogger-import/main.cpp (+0/-38)
tools/tplogger-import/telepathylogimporter.cpp (+0/-116)
tools/tplogger-import/telepathylogimporter.h (+0/-50)
tools/tplogger-import/telepathylogreader.cpp (+0/-173)
tools/tplogger-import/telepathylogreader.h (+0/-71)
To merge this branch: bzr merge lp:~boiko/history-service/rtm-remove_obsolete_tools
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+247179@code.launchpad.net

Commit message

Remove the tools and their dependencies: they are obsolete and not useful anymore.

Description of the change

Remove the tools and their dependencies: they are obsolete and not useful anymore.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-09-09 02:04:48 +0000
+++ CMakeLists.txt 2015-01-21 17:21:06 +0000
@@ -45,7 +45,6 @@
45find_package(PkgConfig REQUIRED)45find_package(PkgConfig REQUIRED)
46pkg_check_modules(TP_QT5 REQUIRED TelepathyQt5)46pkg_check_modules(TP_QT5 REQUIRED TelepathyQt5)
47pkg_check_modules(SQLITE3 REQUIRED sqlite3)47pkg_check_modules(SQLITE3 REQUIRED sqlite3)
48pkg_check_modules(TPL_QT5 TelepathyLoggerQt5)
49pkg_check_modules(QTGLIB QtGLib-2.0)48pkg_check_modules(QTGLIB QtGLib-2.0)
5049
51find_program(DBUS_RUNNER dbus-test-runner)50find_program(DBUS_RUNNER dbus-test-runner)
5251
=== modified file 'debian/control'
--- debian/control 2014-09-12 21:15:59 +0000
+++ debian/control 2015-01-21 17:21:06 +0000
@@ -10,7 +10,6 @@
10 gnome-keyring,10 gnome-keyring,
11 libqt5sql5-sqlite,11 libqt5sql5-sqlite,
12 libsqlite3-dev,12 libsqlite3-dev,
13 libtelepathy-logger-qt5-dev,
14 libtelepathy-qt5-dev,13 libtelepathy-qt5-dev,
15 pkg-config,14 pkg-config,
16 python,15 python,
@@ -54,8 +53,7 @@
54 A service to record the messages that are sent and received and the calls that53 A service to record the messages that are sent and received and the calls that
55 are made in the Ubuntu Touch platform.54 are made in the Ubuntu Touch platform.
56 .55 .
57 This package contains some tools to be used with the history service. Currently56 This package contains some tools to be used with the history service.
58 there is just one tool to import existing logs from Telepathy Logger.
5957
60Package: libhistoryservice058Package: libhistoryservice0
61Architecture: any59Architecture: any
6260
=== modified file 'debian/history-service-tools.install'
--- debian/history-service-tools.install 2013-07-18 21:58:12 +0000
+++ debian/history-service-tools.install 2015-01-21 17:21:06 +0000
@@ -1,1 +0,0 @@
1usr/bin/history-tplogger-import
20
=== modified file 'tools/CMakeLists.txt'
--- tools/CMakeLists.txt 2013-07-10 18:31:03 +0000
+++ tools/CMakeLists.txt 2015-01-21 17:21:06 +0000
@@ -1,5 +1,1 @@
1add_subdirectory(reader)1add_subdirectory(reader)
2
3if (${TPL_QT5_FOUND} AND ${QTGLIB_FOUND})
4 add_subdirectory(tplogger-import)
5endif (${TPL_QT5_FOUND} AND ${QTGLIB_FOUND})
62
=== removed directory 'tools/qmlclient'
=== removed file 'tools/qmlclient/items.qml'
--- tools/qmlclient/items.qml 2013-07-25 23:38:54 +0000
+++ tools/qmlclient/items.qml 1970-01-01 00:00:00 +0000
@@ -1,73 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * Authors:
5 * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
6 *
7 * This file is part of history-service.
8 *
9 * history-service is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * history-service is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22import QtQuick 2.0
23import Ubuntu.History 0.1
24
25ListView {
26 id: listView
27
28 width: 600
29 height: 800
30
31 model: HistoryEventModel {
32 type: HistoryThreadModel.EventTypeText
33 sort: HistorySort {
34 sortField: "timestamp"
35 sortOrder: HistorySort.DescendingOrder
36 }
37 }
38
39 delegate: Rectangle {
40 anchors.left: parent.left
41 anchors.right: parent.right
42 height: 100
43 border.color: "black"
44 color: "lightGray"
45
46 Column {
47 anchors.fill: parent
48 anchors.margins: 3
49 spacing: 3
50
51 Text {
52 anchors.left: parent.left
53 text: "<b>Participants:</b> " + participants
54 }
55 Text {
56 anchors.left: parent.left
57 text: "<b>AccountId:</b> " + accountId
58 }
59 Text {
60 anchors.left: parent.left
61 text: "<b>ThreadId:</b> " + threadId
62 }
63 Text {
64 anchors.left: parent.left
65 text: "<b>Sender:</b> " + senderId
66 }
67 Text {
68 anchors.left: parent.left
69 text: "<b>Message:</b> " + textMessage
70 }
71 }
72 }
73}
740
=== removed file 'tools/qmlclient/sample_client.qml'
--- tools/qmlclient/sample_client.qml 2013-07-25 19:20:12 +0000
+++ tools/qmlclient/sample_client.qml 1970-01-01 00:00:00 +0000
@@ -1,86 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * Authors:
5 * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
6 *
7 * This file is part of history-service.
8 *
9 * history-service is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * history-service is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22import QtQuick 2.0
23import Ubuntu.History 0.1
24
25ListView {
26 id: listView
27
28 width: 600
29 height: 800
30
31 model: HistoryThreadModel {
32 sort: HistorySort {
33 sortField: "lastEventTimestamp"
34 sortOrder: HistorySort.DescendingOrder
35 }
36 }
37
38 Component {
39 id: sectionDelegate
40
41 Text {
42 text: section
43 }
44 }
45
46 section.property: "eventDate"
47 section.delegate: sectionDelegate
48 delegate: Rectangle {
49 anchors.left: parent.left
50 anchors.right: parent.right
51 height: childrenRect.height + 5
52 border.color: "black"
53 color: "lightGray"
54
55 Column {
56 anchors.top: parent.top
57 anchors.left: parent.left
58 anchors.right: parent.right
59 anchors.margins: 3
60 spacing: 3
61 height: childrenRect.height
62
63 Text {
64 anchors.left: parent.left
65 text: "<b>AccountId:</b> " + accountId
66 }
67 Text {
68 anchors.left: parent.left
69 text: "<b>ThreadId:</b> " + threadId
70 }
71 Text {
72 anchors.left: parent.left
73 text: "<b>Participants:</b> " + participants
74 }
75 Text {
76 anchors.left: parent.left
77 text: "<b>Sender:</b> " + eventSenderId
78 }
79 Text {
80 anchors.left: parent.left
81 text: "<b>Message:</b> " + eventTextMessage
82 }
83
84 }
85 }
86}
870
=== removed directory 'tools/tplogger-import'
=== removed file 'tools/tplogger-import/CMakeLists.txt'
--- tools/tplogger-import/CMakeLists.txt 2013-07-18 19:44:26 +0000
+++ tools/tplogger-import/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
1set(tplogger_SRCS
2 main.cpp
3 telepathylogreader.cpp
4 telepathylogimporter.cpp
5 )
6
7include_directories(
8 ${TP_QT5_INCLUDE_DIRS}
9 ${TPL_QT5_INCLUDE_DIRS}
10 ${QTGLIB_INCLUDE_DIRS}
11 ${CMAKE_SOURCE_DIR}/src
12 )
13
14add_executable(history-tplogger-import ${tplogger_SRCS})
15qt5_use_modules(history-tplogger-import Core DBus)
16
17target_link_libraries(history-tplogger-import
18 ${TP_QT5_LIBRARIES}
19 ${TPL_QT5_LIBRARIES}
20 ${QTGLIB_LIBRARIES}
21 historyservice
22 )
23
24install(TARGETS history-tplogger-import RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
250
=== removed file 'tools/tplogger-import/main.cpp'
--- tools/tplogger-import/main.cpp 2013-07-12 14:30:18 +0000
+++ tools/tplogger-import/main.cpp 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * Authors:
5 * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
6 *
7 * This file is part of history-service.
8 *
9 * history-service is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * history-service is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include <QCoreApplication>
23#include <QDebug>
24#include <TelepathyQt/Types>
25#include <TelepathyLoggerQt/Init>
26#include "telepathylogimporter.h"
27
28int main(int argc, char **argv)
29{
30 QCoreApplication app(argc, argv);
31
32 Tp::registerTypes();
33 Tpl::init();
34 TelepathyLogImporter importer;
35 Q_UNUSED(importer)
36
37 return app.exec();
38}
390
=== removed file 'tools/tplogger-import/telepathylogimporter.cpp'
--- tools/tplogger-import/telepathylogimporter.cpp 2013-12-09 21:18:14 +0000
+++ tools/tplogger-import/telepathylogimporter.cpp 1970-01-01 00:00:00 +0000
@@ -1,116 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * Authors:
5 * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
6 *
7 * This file is part of history-service.
8 *
9 * history-service is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * history-service is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include "telepathylogimporter.h"
23#include "telepathylogreader.h"
24#include "manager.h"
25#include "thread.h"
26#include "textevent.h"
27#include "voiceevent.h"
28#include <TelepathyLoggerQt/Entity>
29
30
31TelepathyLogImporter::TelepathyLogImporter(QObject *parent) :
32 QObject(parent), mTextEventCount(0), mVoiceEventCount(0), mBatchSize(200)
33{
34 connect(TelepathyLogReader::instance(),
35 SIGNAL(loadedCallEvent(Tpl::CallEventPtr)),
36 SLOT(onCallEventLoaded(Tpl::CallEventPtr)));
37 connect(TelepathyLogReader::instance(),
38 SIGNAL(loadedMessageEvent(Tpl::TextEventPtr)),
39 SLOT(onMessageEventLoaded(Tpl::TextEventPtr)));
40 connect(TelepathyLogReader::instance(),
41 SIGNAL(finished()),
42 SLOT(onFinished()));
43
44 qDebug() << "Starting to import...";
45}
46
47void TelepathyLogImporter::onCallEventLoaded(const Tpl::CallEventPtr &event)
48{
49 // FIXME: add support for conf call
50 bool incoming = event->receiver()->entityType() == Tpl::EntityTypeSelf;
51 Tpl::EntityPtr remote = incoming ? event->sender() : event->receiver();
52 History::Thread thread = History::Manager::instance()->threadForParticipants(event->account()->uniqueIdentifier(),
53 History::EventTypeVoice,
54 QStringList() << remote->identifier(),
55 History::MatchCaseSensitive,
56 true);
57 QString eventId = QString("%1:%2").arg(thread.threadId()).arg(event->timestamp().toString());
58 History::VoiceEvent historyEvent = History::VoiceEvent(thread.accountId(),
59 thread.threadId(),
60 eventId,
61 incoming ? remote->identifier() : "self",
62 event->timestamp(),
63 false,
64 event->endReason() == Tp::CallStateChangeReasonNoAnswer,
65 event->duration());
66
67 mEvents << historyEvent;
68 if (mEvents.count() >= mBatchSize) {
69 History::Manager::instance()->writeEvents(mEvents);
70 mEvents.clear();
71 }
72 mVoiceEventCount++;
73}
74
75void TelepathyLogImporter::onMessageEventLoaded(const Tpl::TextEventPtr &event)
76{
77 // FIXME: add support for conf call
78 bool incoming = event->receiver()->entityType() == Tpl::EntityTypeSelf;
79 Tpl::EntityPtr remote = incoming ? event->sender() : event->receiver();
80 History::Thread thread = History::Manager::instance()->threadForParticipants(event->account()->uniqueIdentifier(),
81 History::EventTypeText,
82 QStringList() << remote->identifier(),
83 History::MatchCaseSensitive,
84 true);
85 History::TextEvent historyEvent = History::TextEvent(thread.accountId(),
86 thread.threadId(),
87 event->messageToken(),
88 incoming ? remote->identifier() : "self",
89 event->timestamp(),
90 false,
91 event->message(),
92 History::MessageTypeText,
93 History::MessageStatusUnknown,
94 event->timestamp());
95 mEvents << historyEvent;
96 if (mEvents.count() >= mBatchSize) {
97 History::Manager::instance()->writeEvents(mEvents);
98 mEvents.clear();
99 }
100 mTextEventCount++;
101}
102
103void TelepathyLogImporter::onFinished()
104{
105 // write the remaining items
106 if (!mEvents.isEmpty()) {
107 History::Manager::instance()->writeEvents(mEvents);
108 mEvents.clear();
109 }
110
111 qDebug() << "... finished";
112 qDebug() << "Text events:" << mTextEventCount;
113 qDebug() << "Voice events:" << mVoiceEventCount;
114
115 qApp->quit();
116}
1170
=== removed file 'tools/tplogger-import/telepathylogimporter.h'
--- tools/tplogger-import/telepathylogimporter.h 2013-09-17 23:05:35 +0000
+++ tools/tplogger-import/telepathylogimporter.h 1970-01-01 00:00:00 +0000
@@ -1,50 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * Authors:
5 * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
6 *
7 * This file is part of history-service.
8 *
9 * history-service is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * history-service is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef TELEPATHYLOGIMPORTER_H
23#define TELEPATHYLOGIMPORTER_H
24
25#include <QObject>
26#include <TelepathyLoggerQt/Types>
27#include <TelepathyLoggerQt/CallEvent>
28#include <TelepathyLoggerQt/TextEvent>
29#include <Event>
30#include <Types>
31
32class TelepathyLogImporter : public QObject
33{
34 Q_OBJECT
35public:
36 explicit TelepathyLogImporter(QObject *parent = 0);
37
38public Q_SLOTS:
39 void onCallEventLoaded(const Tpl::CallEventPtr &event);
40 void onMessageEventLoaded(const Tpl::TextEventPtr &event);
41 void onFinished();
42private:
43 int mTextEventCount;
44 int mVoiceEventCount;
45 History::Events mEvents;
46 int mBatchSize;
47
48};
49
50#endif // TELEPATHYLOGIMPORTER_H
510
=== removed file 'tools/tplogger-import/telepathylogreader.cpp'
--- tools/tplogger-import/telepathylogreader.cpp 2013-07-12 14:30:18 +0000
+++ tools/tplogger-import/telepathylogreader.cpp 1970-01-01 00:00:00 +0000
@@ -1,173 +0,0 @@
1/*
2 * Copyright (C) 2012-2013 Canonical, Ltd.
3 *
4 * Authors:
5 * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
6 *
7 * This file is part of history-service.
8 *
9 * history-service is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * history-service is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include "telepathylogreader.h"
23#include <TelepathyLoggerQt/LogManager>
24#include <TelepathyLoggerQt/PendingDates>
25#include <TelepathyLoggerQt/PendingEntities>
26#include <TelepathyLoggerQt/PendingEvents>
27#include <TelepathyLoggerQt/Entity>
28#include <TelepathyLoggerQt/Event>
29#include <TelepathyLoggerQt/CallEvent>
30#include <TelepathyLoggerQt/TextEvent>
31#include <TelepathyQt/PendingReady>
32
33TelepathyLogReader::TelepathyLogReader(QObject *parent) :
34 QObject(parent), mLogManager(Tpl::LogManager::instance())
35{
36 Tp::Features accountFeatures;
37 Tp::Features contactFeatures;
38 accountFeatures << Tp::Account::FeatureCore;
39 contactFeatures << Tp::Contact::FeatureAlias
40 << Tp::Contact::FeatureAvatarData
41 << Tp::Contact::FeatureAvatarToken
42 << Tp::Contact::FeatureCapabilities
43 << Tp::Contact::FeatureSimplePresence;
44
45 mAccountManager = Tp::AccountManager::create(
46 Tp::AccountFactory::create(QDBusConnection::sessionBus(), accountFeatures),
47 Tp::ConnectionFactory::create(QDBusConnection::sessionBus()),
48 Tp::ChannelFactory::create(QDBusConnection::sessionBus()),
49 Tp::ContactFactory::create(contactFeatures));
50
51 connect(mAccountManager->becomeReady(Tp::AccountManager::FeatureCore),
52 SIGNAL(finished(Tp::PendingOperation*)),
53 SLOT(onAccountManagerReady(Tp::PendingOperation*)));
54}
55
56TelepathyLogReader *TelepathyLogReader::instance()
57{
58 static TelepathyLogReader *self = new TelepathyLogReader();
59 return self;
60}
61
62void TelepathyLogReader::fetchLog(const Tp::AccountPtr &account)
63{
64 Tpl::PendingEntities *pendingEntities = mLogManager->queryEntities(account);
65
66 mOperations.append(pendingEntities);
67
68 /* Fetching the log work like this:
69 - Start by fetching the entities from the log
70 - Once you get the entities, fetch the available dates
71 - After you get the dates, fetch the events themselves
72 */
73
74 connect(pendingEntities,
75 SIGNAL(finished(Tpl::PendingOperation*)),
76 SLOT(onPendingEntitiesFinished(Tpl::PendingOperation*)));
77}
78
79void TelepathyLogReader::requestDatesForEntities(const Tp::AccountPtr &account, const Tpl::EntityPtrList &entities)
80{
81 Q_FOREACH(Tpl::EntityPtr entity, entities) {
82 Tpl::PendingDates *pendingDates = mLogManager->queryDates(account, entity, Tpl::EventTypeMaskAny);
83
84 connect(pendingDates,
85 SIGNAL(finished(Tpl::PendingOperation*)),
86 SLOT(onPendingDatesFinished(Tpl::PendingOperation*)));
87 mOperations.append(pendingDates);
88 }
89}
90
91void TelepathyLogReader::requestEventsForDates(const Tp::AccountPtr &account, const Tpl::EntityPtr &entity, const Tpl::QDateList &dates)
92{
93 Q_FOREACH(QDate date, dates) {
94 Tpl::PendingEvents *pendingEvents = mLogManager->queryEvents(account, entity, Tpl::EventTypeMaskAny, date);
95 connect(pendingEvents,
96 SIGNAL(finished(Tpl::PendingOperation*)),
97 SLOT(onPendingEventsFinished(Tpl::PendingOperation*)));
98 mOperations.append(pendingEvents);
99 }
100}
101
102void TelepathyLogReader::onPendingEntitiesFinished(Tpl::PendingOperation *op)
103{
104 Tpl::PendingEntities *pe = qobject_cast<Tpl::PendingEntities*>(op);
105 if (!pe) {
106 return;
107 }
108
109 // request the dates for all the entities
110 requestDatesForEntities(pe->account(), pe->entities());
111
112 mOperations.removeAll(op);
113 if (mOperations.isEmpty()) {
114 Q_EMIT finished();
115 }
116}
117
118void TelepathyLogReader::onPendingDatesFinished(Tpl::PendingOperation *op)
119{
120 Tpl::PendingDates *pd = qobject_cast<Tpl::PendingDates*>(op);
121 if (!pd) {
122 return;
123 }
124
125 // request all events
126 requestEventsForDates(pd->account(), pd->entity(), pd->dates());
127
128 mOperations.removeAll(op);
129 if (mOperations.isEmpty()) {
130 Q_EMIT finished();
131 }
132}
133
134void TelepathyLogReader::onPendingEventsFinished(Tpl::PendingOperation *op)
135{
136 Tpl::PendingEvents *pe = qobject_cast<Tpl::PendingEvents*>(op);
137 if (!pe) {
138 return;
139 }
140
141 Q_FOREACH(const Tpl::EventPtr &event, pe->events()) {
142 bool incoming = event->receiver()->entityType() == Tpl::EntityTypeSelf;
143 Tpl::EntityPtr remoteEntity = incoming ? event->sender() : event->receiver();
144
145 QString phoneNumber = remoteEntity->identifier();
146 QDateTime timestamp = event->timestamp();
147
148 Tpl::CallEventPtr callEvent = event.dynamicCast<Tpl::CallEvent>();
149 Tpl::TextEventPtr textEvent = event.dynamicCast<Tpl::TextEvent>();
150
151 if (!callEvent.isNull()) {
152 Q_EMIT loadedCallEvent(callEvent);
153 }
154
155 if (!textEvent.isNull()) {
156 Q_EMIT loadedMessageEvent(textEvent);
157 }
158 }
159
160 mOperations.removeAll(op);
161 if (mOperations.isEmpty()) {
162 Q_EMIT finished();
163 }
164}
165
166
167void TelepathyLogReader::onAccountManagerReady(Tp::PendingOperation *op)
168{
169 mLogManager->setAccountManagerPtr(mAccountManager);
170 Q_FOREACH(const Tp::AccountPtr account, mAccountManager->allAccounts()) {
171 fetchLog(account);
172 }
173}
1740
=== removed file 'tools/tplogger-import/telepathylogreader.h'
--- tools/tplogger-import/telepathylogreader.h 2013-07-12 14:30:18 +0000
+++ tools/tplogger-import/telepathylogreader.h 1970-01-01 00:00:00 +0000
@@ -1,71 +0,0 @@
1/*
2 * Copyright (C) 2012-2013 Canonical, Ltd.
3 *
4 * Authors:
5 * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
6 *
7 * This file is part of history-service.
8 *
9 * history-service is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 3.
12 *
13 * history-service is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef TELEPATHYLOGREADER_H
23#define TELEPATHYLOGREADER_H
24
25#include <QObject>
26#include <TelepathyLoggerQt/PendingOperation>
27#include <TelepathyLoggerQt/Types>
28#include <TelepathyLoggerQt/LogManager>
29#include <TelepathyLoggerQt/CallEvent>
30#include <TelepathyLoggerQt/TextEvent>
31#include <TelepathyQt/AccountManager>
32#include <QDateTime>
33#include <QList>
34#include <QMap>
35#include <QUrl>
36
37class TelepathyLogReader : public QObject
38{
39 Q_OBJECT
40public:
41 static TelepathyLogReader *instance();
42
43public Q_SLOTS:
44 void fetchLog(const Tp::AccountPtr &account);
45
46protected:
47 void requestDatesForEntities(const Tp::AccountPtr &account, const Tpl::EntityPtrList &entities);
48 void requestEventsForDates(const Tp::AccountPtr &account, const Tpl::EntityPtr &entity, const Tpl::QDateList &dates);
49
50Q_SIGNALS:
51 void loadedCallEvent(const Tpl::CallEventPtr &event);
52 void loadedMessageEvent(const Tpl::TextEventPtr &event);
53 void finished();
54
55protected Q_SLOTS:
56 void onAccountManagerReady(Tp::PendingOperation *op);
57 void onPendingEntitiesFinished(Tpl::PendingOperation *op);
58 void onPendingDatesFinished(Tpl::PendingOperation *op);
59 void onPendingEventsFinished(Tpl::PendingOperation *op);
60
61protected:
62 Tpl::LogManagerPtr mLogManager;
63 Tp::AccountManagerPtr mAccountManager;
64
65private:
66 explicit TelepathyLogReader(QObject *parent = 0);
67 QList <Tpl::PendingOperation*> mOperations;
68
69};
70
71#endif // CALLLOGMODEL_H

Subscribers

People subscribed via source and target branches