Merge lp:~boiko/history-service/rtm-remove_obsolete_tools into lp:history-service/rtm-14.09
- rtm-remove_obsolete_tools
- Merge into 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 | ||||
Related bugs: |
|
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
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2014-09-09 02:04:48 +0000 | |||
3 | +++ CMakeLists.txt 2015-01-21 17:21:06 +0000 | |||
4 | @@ -45,7 +45,6 @@ | |||
5 | 45 | find_package(PkgConfig REQUIRED) | 45 | find_package(PkgConfig REQUIRED) |
6 | 46 | pkg_check_modules(TP_QT5 REQUIRED TelepathyQt5) | 46 | pkg_check_modules(TP_QT5 REQUIRED TelepathyQt5) |
7 | 47 | pkg_check_modules(SQLITE3 REQUIRED sqlite3) | 47 | pkg_check_modules(SQLITE3 REQUIRED sqlite3) |
8 | 48 | pkg_check_modules(TPL_QT5 TelepathyLoggerQt5) | ||
9 | 49 | pkg_check_modules(QTGLIB QtGLib-2.0) | 48 | pkg_check_modules(QTGLIB QtGLib-2.0) |
10 | 50 | 49 | ||
11 | 51 | find_program(DBUS_RUNNER dbus-test-runner) | 50 | find_program(DBUS_RUNNER dbus-test-runner) |
12 | 52 | 51 | ||
13 | === modified file 'debian/control' | |||
14 | --- debian/control 2014-09-12 21:15:59 +0000 | |||
15 | +++ debian/control 2015-01-21 17:21:06 +0000 | |||
16 | @@ -10,7 +10,6 @@ | |||
17 | 10 | gnome-keyring, | 10 | gnome-keyring, |
18 | 11 | libqt5sql5-sqlite, | 11 | libqt5sql5-sqlite, |
19 | 12 | libsqlite3-dev, | 12 | libsqlite3-dev, |
20 | 13 | libtelepathy-logger-qt5-dev, | ||
21 | 14 | libtelepathy-qt5-dev, | 13 | libtelepathy-qt5-dev, |
22 | 15 | pkg-config, | 14 | pkg-config, |
23 | 16 | python, | 15 | python, |
24 | @@ -54,8 +53,7 @@ | |||
25 | 54 | A service to record the messages that are sent and received and the calls that | 53 | A service to record the messages that are sent and received and the calls that |
26 | 55 | are made in the Ubuntu Touch platform. | 54 | are made in the Ubuntu Touch platform. |
27 | 56 | . | 55 | . |
30 | 57 | This package contains some tools to be used with the history service. Currently | 56 | This package contains some tools to be used with the history service. |
29 | 58 | there is just one tool to import existing logs from Telepathy Logger. | ||
31 | 59 | 57 | ||
32 | 60 | Package: libhistoryservice0 | 58 | Package: libhistoryservice0 |
33 | 61 | Architecture: any | 59 | Architecture: any |
34 | 62 | 60 | ||
35 | === modified file 'debian/history-service-tools.install' | |||
36 | --- debian/history-service-tools.install 2013-07-18 21:58:12 +0000 | |||
37 | +++ debian/history-service-tools.install 2015-01-21 17:21:06 +0000 | |||
38 | @@ -1,1 +0,0 @@ | |||
39 | 1 | usr/bin/history-tplogger-import | ||
40 | 2 | 0 | ||
41 | === modified file 'tools/CMakeLists.txt' | |||
42 | --- tools/CMakeLists.txt 2013-07-10 18:31:03 +0000 | |||
43 | +++ tools/CMakeLists.txt 2015-01-21 17:21:06 +0000 | |||
44 | @@ -1,5 +1,1 @@ | |||
45 | 1 | add_subdirectory(reader) | 1 | add_subdirectory(reader) |
46 | 2 | |||
47 | 3 | if (${TPL_QT5_FOUND} AND ${QTGLIB_FOUND}) | ||
48 | 4 | add_subdirectory(tplogger-import) | ||
49 | 5 | endif (${TPL_QT5_FOUND} AND ${QTGLIB_FOUND}) | ||
50 | 6 | 2 | ||
51 | === removed directory 'tools/qmlclient' | |||
52 | === removed file 'tools/qmlclient/items.qml' | |||
53 | --- tools/qmlclient/items.qml 2013-07-25 23:38:54 +0000 | |||
54 | +++ tools/qmlclient/items.qml 1970-01-01 00:00:00 +0000 | |||
55 | @@ -1,73 +0,0 @@ | |||
56 | 1 | /* | ||
57 | 2 | * Copyright (C) 2013 Canonical, Ltd. | ||
58 | 3 | * | ||
59 | 4 | * Authors: | ||
60 | 5 | * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> | ||
61 | 6 | * | ||
62 | 7 | * This file is part of history-service. | ||
63 | 8 | * | ||
64 | 9 | * history-service is free software; you can redistribute it and/or modify | ||
65 | 10 | * it under the terms of the GNU General Public License as published by | ||
66 | 11 | * the Free Software Foundation; version 3. | ||
67 | 12 | * | ||
68 | 13 | * history-service is distributed in the hope that it will be useful, | ||
69 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
70 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
71 | 16 | * GNU General Public License for more details. | ||
72 | 17 | * | ||
73 | 18 | * You should have received a copy of the GNU General Public License | ||
74 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
75 | 20 | */ | ||
76 | 21 | |||
77 | 22 | import QtQuick 2.0 | ||
78 | 23 | import Ubuntu.History 0.1 | ||
79 | 24 | |||
80 | 25 | ListView { | ||
81 | 26 | id: listView | ||
82 | 27 | |||
83 | 28 | width: 600 | ||
84 | 29 | height: 800 | ||
85 | 30 | |||
86 | 31 | model: HistoryEventModel { | ||
87 | 32 | type: HistoryThreadModel.EventTypeText | ||
88 | 33 | sort: HistorySort { | ||
89 | 34 | sortField: "timestamp" | ||
90 | 35 | sortOrder: HistorySort.DescendingOrder | ||
91 | 36 | } | ||
92 | 37 | } | ||
93 | 38 | |||
94 | 39 | delegate: Rectangle { | ||
95 | 40 | anchors.left: parent.left | ||
96 | 41 | anchors.right: parent.right | ||
97 | 42 | height: 100 | ||
98 | 43 | border.color: "black" | ||
99 | 44 | color: "lightGray" | ||
100 | 45 | |||
101 | 46 | Column { | ||
102 | 47 | anchors.fill: parent | ||
103 | 48 | anchors.margins: 3 | ||
104 | 49 | spacing: 3 | ||
105 | 50 | |||
106 | 51 | Text { | ||
107 | 52 | anchors.left: parent.left | ||
108 | 53 | text: "<b>Participants:</b> " + participants | ||
109 | 54 | } | ||
110 | 55 | Text { | ||
111 | 56 | anchors.left: parent.left | ||
112 | 57 | text: "<b>AccountId:</b> " + accountId | ||
113 | 58 | } | ||
114 | 59 | Text { | ||
115 | 60 | anchors.left: parent.left | ||
116 | 61 | text: "<b>ThreadId:</b> " + threadId | ||
117 | 62 | } | ||
118 | 63 | Text { | ||
119 | 64 | anchors.left: parent.left | ||
120 | 65 | text: "<b>Sender:</b> " + senderId | ||
121 | 66 | } | ||
122 | 67 | Text { | ||
123 | 68 | anchors.left: parent.left | ||
124 | 69 | text: "<b>Message:</b> " + textMessage | ||
125 | 70 | } | ||
126 | 71 | } | ||
127 | 72 | } | ||
128 | 73 | } | ||
129 | 74 | 0 | ||
130 | === removed file 'tools/qmlclient/sample_client.qml' | |||
131 | --- tools/qmlclient/sample_client.qml 2013-07-25 19:20:12 +0000 | |||
132 | +++ tools/qmlclient/sample_client.qml 1970-01-01 00:00:00 +0000 | |||
133 | @@ -1,86 +0,0 @@ | |||
134 | 1 | /* | ||
135 | 2 | * Copyright (C) 2013 Canonical, Ltd. | ||
136 | 3 | * | ||
137 | 4 | * Authors: | ||
138 | 5 | * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> | ||
139 | 6 | * | ||
140 | 7 | * This file is part of history-service. | ||
141 | 8 | * | ||
142 | 9 | * history-service is free software; you can redistribute it and/or modify | ||
143 | 10 | * it under the terms of the GNU General Public License as published by | ||
144 | 11 | * the Free Software Foundation; version 3. | ||
145 | 12 | * | ||
146 | 13 | * history-service is distributed in the hope that it will be useful, | ||
147 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
148 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
149 | 16 | * GNU General Public License for more details. | ||
150 | 17 | * | ||
151 | 18 | * You should have received a copy of the GNU General Public License | ||
152 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
153 | 20 | */ | ||
154 | 21 | |||
155 | 22 | import QtQuick 2.0 | ||
156 | 23 | import Ubuntu.History 0.1 | ||
157 | 24 | |||
158 | 25 | ListView { | ||
159 | 26 | id: listView | ||
160 | 27 | |||
161 | 28 | width: 600 | ||
162 | 29 | height: 800 | ||
163 | 30 | |||
164 | 31 | model: HistoryThreadModel { | ||
165 | 32 | sort: HistorySort { | ||
166 | 33 | sortField: "lastEventTimestamp" | ||
167 | 34 | sortOrder: HistorySort.DescendingOrder | ||
168 | 35 | } | ||
169 | 36 | } | ||
170 | 37 | |||
171 | 38 | Component { | ||
172 | 39 | id: sectionDelegate | ||
173 | 40 | |||
174 | 41 | Text { | ||
175 | 42 | text: section | ||
176 | 43 | } | ||
177 | 44 | } | ||
178 | 45 | |||
179 | 46 | section.property: "eventDate" | ||
180 | 47 | section.delegate: sectionDelegate | ||
181 | 48 | delegate: Rectangle { | ||
182 | 49 | anchors.left: parent.left | ||
183 | 50 | anchors.right: parent.right | ||
184 | 51 | height: childrenRect.height + 5 | ||
185 | 52 | border.color: "black" | ||
186 | 53 | color: "lightGray" | ||
187 | 54 | |||
188 | 55 | Column { | ||
189 | 56 | anchors.top: parent.top | ||
190 | 57 | anchors.left: parent.left | ||
191 | 58 | anchors.right: parent.right | ||
192 | 59 | anchors.margins: 3 | ||
193 | 60 | spacing: 3 | ||
194 | 61 | height: childrenRect.height | ||
195 | 62 | |||
196 | 63 | Text { | ||
197 | 64 | anchors.left: parent.left | ||
198 | 65 | text: "<b>AccountId:</b> " + accountId | ||
199 | 66 | } | ||
200 | 67 | Text { | ||
201 | 68 | anchors.left: parent.left | ||
202 | 69 | text: "<b>ThreadId:</b> " + threadId | ||
203 | 70 | } | ||
204 | 71 | Text { | ||
205 | 72 | anchors.left: parent.left | ||
206 | 73 | text: "<b>Participants:</b> " + participants | ||
207 | 74 | } | ||
208 | 75 | Text { | ||
209 | 76 | anchors.left: parent.left | ||
210 | 77 | text: "<b>Sender:</b> " + eventSenderId | ||
211 | 78 | } | ||
212 | 79 | Text { | ||
213 | 80 | anchors.left: parent.left | ||
214 | 81 | text: "<b>Message:</b> " + eventTextMessage | ||
215 | 82 | } | ||
216 | 83 | |||
217 | 84 | } | ||
218 | 85 | } | ||
219 | 86 | } | ||
220 | 87 | 0 | ||
221 | === removed directory 'tools/tplogger-import' | |||
222 | === removed file 'tools/tplogger-import/CMakeLists.txt' | |||
223 | --- tools/tplogger-import/CMakeLists.txt 2013-07-18 19:44:26 +0000 | |||
224 | +++ tools/tplogger-import/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
225 | @@ -1,24 +0,0 @@ | |||
226 | 1 | set(tplogger_SRCS | ||
227 | 2 | main.cpp | ||
228 | 3 | telepathylogreader.cpp | ||
229 | 4 | telepathylogimporter.cpp | ||
230 | 5 | ) | ||
231 | 6 | |||
232 | 7 | include_directories( | ||
233 | 8 | ${TP_QT5_INCLUDE_DIRS} | ||
234 | 9 | ${TPL_QT5_INCLUDE_DIRS} | ||
235 | 10 | ${QTGLIB_INCLUDE_DIRS} | ||
236 | 11 | ${CMAKE_SOURCE_DIR}/src | ||
237 | 12 | ) | ||
238 | 13 | |||
239 | 14 | add_executable(history-tplogger-import ${tplogger_SRCS}) | ||
240 | 15 | qt5_use_modules(history-tplogger-import Core DBus) | ||
241 | 16 | |||
242 | 17 | target_link_libraries(history-tplogger-import | ||
243 | 18 | ${TP_QT5_LIBRARIES} | ||
244 | 19 | ${TPL_QT5_LIBRARIES} | ||
245 | 20 | ${QTGLIB_LIBRARIES} | ||
246 | 21 | historyservice | ||
247 | 22 | ) | ||
248 | 23 | |||
249 | 24 | install(TARGETS history-tplogger-import RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
250 | 25 | 0 | ||
251 | === removed file 'tools/tplogger-import/main.cpp' | |||
252 | --- tools/tplogger-import/main.cpp 2013-07-12 14:30:18 +0000 | |||
253 | +++ tools/tplogger-import/main.cpp 1970-01-01 00:00:00 +0000 | |||
254 | @@ -1,38 +0,0 @@ | |||
255 | 1 | /* | ||
256 | 2 | * Copyright (C) 2013 Canonical, Ltd. | ||
257 | 3 | * | ||
258 | 4 | * Authors: | ||
259 | 5 | * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> | ||
260 | 6 | * | ||
261 | 7 | * This file is part of history-service. | ||
262 | 8 | * | ||
263 | 9 | * history-service is free software; you can redistribute it and/or modify | ||
264 | 10 | * it under the terms of the GNU General Public License as published by | ||
265 | 11 | * the Free Software Foundation; version 3. | ||
266 | 12 | * | ||
267 | 13 | * history-service is distributed in the hope that it will be useful, | ||
268 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
269 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
270 | 16 | * GNU General Public License for more details. | ||
271 | 17 | * | ||
272 | 18 | * You should have received a copy of the GNU General Public License | ||
273 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
274 | 20 | */ | ||
275 | 21 | |||
276 | 22 | #include <QCoreApplication> | ||
277 | 23 | #include <QDebug> | ||
278 | 24 | #include <TelepathyQt/Types> | ||
279 | 25 | #include <TelepathyLoggerQt/Init> | ||
280 | 26 | #include "telepathylogimporter.h" | ||
281 | 27 | |||
282 | 28 | int main(int argc, char **argv) | ||
283 | 29 | { | ||
284 | 30 | QCoreApplication app(argc, argv); | ||
285 | 31 | |||
286 | 32 | Tp::registerTypes(); | ||
287 | 33 | Tpl::init(); | ||
288 | 34 | TelepathyLogImporter importer; | ||
289 | 35 | Q_UNUSED(importer) | ||
290 | 36 | |||
291 | 37 | return app.exec(); | ||
292 | 38 | } | ||
293 | 39 | 0 | ||
294 | === removed file 'tools/tplogger-import/telepathylogimporter.cpp' | |||
295 | --- tools/tplogger-import/telepathylogimporter.cpp 2013-12-09 21:18:14 +0000 | |||
296 | +++ tools/tplogger-import/telepathylogimporter.cpp 1970-01-01 00:00:00 +0000 | |||
297 | @@ -1,116 +0,0 @@ | |||
298 | 1 | /* | ||
299 | 2 | * Copyright (C) 2013 Canonical, Ltd. | ||
300 | 3 | * | ||
301 | 4 | * Authors: | ||
302 | 5 | * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> | ||
303 | 6 | * | ||
304 | 7 | * This file is part of history-service. | ||
305 | 8 | * | ||
306 | 9 | * history-service is free software; you can redistribute it and/or modify | ||
307 | 10 | * it under the terms of the GNU General Public License as published by | ||
308 | 11 | * the Free Software Foundation; version 3. | ||
309 | 12 | * | ||
310 | 13 | * history-service is distributed in the hope that it will be useful, | ||
311 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
312 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
313 | 16 | * GNU General Public License for more details. | ||
314 | 17 | * | ||
315 | 18 | * You should have received a copy of the GNU General Public License | ||
316 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
317 | 20 | */ | ||
318 | 21 | |||
319 | 22 | #include "telepathylogimporter.h" | ||
320 | 23 | #include "telepathylogreader.h" | ||
321 | 24 | #include "manager.h" | ||
322 | 25 | #include "thread.h" | ||
323 | 26 | #include "textevent.h" | ||
324 | 27 | #include "voiceevent.h" | ||
325 | 28 | #include <TelepathyLoggerQt/Entity> | ||
326 | 29 | |||
327 | 30 | |||
328 | 31 | TelepathyLogImporter::TelepathyLogImporter(QObject *parent) : | ||
329 | 32 | QObject(parent), mTextEventCount(0), mVoiceEventCount(0), mBatchSize(200) | ||
330 | 33 | { | ||
331 | 34 | connect(TelepathyLogReader::instance(), | ||
332 | 35 | SIGNAL(loadedCallEvent(Tpl::CallEventPtr)), | ||
333 | 36 | SLOT(onCallEventLoaded(Tpl::CallEventPtr))); | ||
334 | 37 | connect(TelepathyLogReader::instance(), | ||
335 | 38 | SIGNAL(loadedMessageEvent(Tpl::TextEventPtr)), | ||
336 | 39 | SLOT(onMessageEventLoaded(Tpl::TextEventPtr))); | ||
337 | 40 | connect(TelepathyLogReader::instance(), | ||
338 | 41 | SIGNAL(finished()), | ||
339 | 42 | SLOT(onFinished())); | ||
340 | 43 | |||
341 | 44 | qDebug() << "Starting to import..."; | ||
342 | 45 | } | ||
343 | 46 | |||
344 | 47 | void TelepathyLogImporter::onCallEventLoaded(const Tpl::CallEventPtr &event) | ||
345 | 48 | { | ||
346 | 49 | // FIXME: add support for conf call | ||
347 | 50 | bool incoming = event->receiver()->entityType() == Tpl::EntityTypeSelf; | ||
348 | 51 | Tpl::EntityPtr remote = incoming ? event->sender() : event->receiver(); | ||
349 | 52 | History::Thread thread = History::Manager::instance()->threadForParticipants(event->account()->uniqueIdentifier(), | ||
350 | 53 | History::EventTypeVoice, | ||
351 | 54 | QStringList() << remote->identifier(), | ||
352 | 55 | History::MatchCaseSensitive, | ||
353 | 56 | true); | ||
354 | 57 | QString eventId = QString("%1:%2").arg(thread.threadId()).arg(event->timestamp().toString()); | ||
355 | 58 | History::VoiceEvent historyEvent = History::VoiceEvent(thread.accountId(), | ||
356 | 59 | thread.threadId(), | ||
357 | 60 | eventId, | ||
358 | 61 | incoming ? remote->identifier() : "self", | ||
359 | 62 | event->timestamp(), | ||
360 | 63 | false, | ||
361 | 64 | event->endReason() == Tp::CallStateChangeReasonNoAnswer, | ||
362 | 65 | event->duration()); | ||
363 | 66 | |||
364 | 67 | mEvents << historyEvent; | ||
365 | 68 | if (mEvents.count() >= mBatchSize) { | ||
366 | 69 | History::Manager::instance()->writeEvents(mEvents); | ||
367 | 70 | mEvents.clear(); | ||
368 | 71 | } | ||
369 | 72 | mVoiceEventCount++; | ||
370 | 73 | } | ||
371 | 74 | |||
372 | 75 | void TelepathyLogImporter::onMessageEventLoaded(const Tpl::TextEventPtr &event) | ||
373 | 76 | { | ||
374 | 77 | // FIXME: add support for conf call | ||
375 | 78 | bool incoming = event->receiver()->entityType() == Tpl::EntityTypeSelf; | ||
376 | 79 | Tpl::EntityPtr remote = incoming ? event->sender() : event->receiver(); | ||
377 | 80 | History::Thread thread = History::Manager::instance()->threadForParticipants(event->account()->uniqueIdentifier(), | ||
378 | 81 | History::EventTypeText, | ||
379 | 82 | QStringList() << remote->identifier(), | ||
380 | 83 | History::MatchCaseSensitive, | ||
381 | 84 | true); | ||
382 | 85 | History::TextEvent historyEvent = History::TextEvent(thread.accountId(), | ||
383 | 86 | thread.threadId(), | ||
384 | 87 | event->messageToken(), | ||
385 | 88 | incoming ? remote->identifier() : "self", | ||
386 | 89 | event->timestamp(), | ||
387 | 90 | false, | ||
388 | 91 | event->message(), | ||
389 | 92 | History::MessageTypeText, | ||
390 | 93 | History::MessageStatusUnknown, | ||
391 | 94 | event->timestamp()); | ||
392 | 95 | mEvents << historyEvent; | ||
393 | 96 | if (mEvents.count() >= mBatchSize) { | ||
394 | 97 | History::Manager::instance()->writeEvents(mEvents); | ||
395 | 98 | mEvents.clear(); | ||
396 | 99 | } | ||
397 | 100 | mTextEventCount++; | ||
398 | 101 | } | ||
399 | 102 | |||
400 | 103 | void TelepathyLogImporter::onFinished() | ||
401 | 104 | { | ||
402 | 105 | // write the remaining items | ||
403 | 106 | if (!mEvents.isEmpty()) { | ||
404 | 107 | History::Manager::instance()->writeEvents(mEvents); | ||
405 | 108 | mEvents.clear(); | ||
406 | 109 | } | ||
407 | 110 | |||
408 | 111 | qDebug() << "... finished"; | ||
409 | 112 | qDebug() << "Text events:" << mTextEventCount; | ||
410 | 113 | qDebug() << "Voice events:" << mVoiceEventCount; | ||
411 | 114 | |||
412 | 115 | qApp->quit(); | ||
413 | 116 | } | ||
414 | 117 | 0 | ||
415 | === removed file 'tools/tplogger-import/telepathylogimporter.h' | |||
416 | --- tools/tplogger-import/telepathylogimporter.h 2013-09-17 23:05:35 +0000 | |||
417 | +++ tools/tplogger-import/telepathylogimporter.h 1970-01-01 00:00:00 +0000 | |||
418 | @@ -1,50 +0,0 @@ | |||
419 | 1 | /* | ||
420 | 2 | * Copyright (C) 2013 Canonical, Ltd. | ||
421 | 3 | * | ||
422 | 4 | * Authors: | ||
423 | 5 | * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> | ||
424 | 6 | * | ||
425 | 7 | * This file is part of history-service. | ||
426 | 8 | * | ||
427 | 9 | * history-service is free software; you can redistribute it and/or modify | ||
428 | 10 | * it under the terms of the GNU General Public License as published by | ||
429 | 11 | * the Free Software Foundation; version 3. | ||
430 | 12 | * | ||
431 | 13 | * history-service is distributed in the hope that it will be useful, | ||
432 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
433 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
434 | 16 | * GNU General Public License for more details. | ||
435 | 17 | * | ||
436 | 18 | * You should have received a copy of the GNU General Public License | ||
437 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
438 | 20 | */ | ||
439 | 21 | |||
440 | 22 | #ifndef TELEPATHYLOGIMPORTER_H | ||
441 | 23 | #define TELEPATHYLOGIMPORTER_H | ||
442 | 24 | |||
443 | 25 | #include <QObject> | ||
444 | 26 | #include <TelepathyLoggerQt/Types> | ||
445 | 27 | #include <TelepathyLoggerQt/CallEvent> | ||
446 | 28 | #include <TelepathyLoggerQt/TextEvent> | ||
447 | 29 | #include <Event> | ||
448 | 30 | #include <Types> | ||
449 | 31 | |||
450 | 32 | class TelepathyLogImporter : public QObject | ||
451 | 33 | { | ||
452 | 34 | Q_OBJECT | ||
453 | 35 | public: | ||
454 | 36 | explicit TelepathyLogImporter(QObject *parent = 0); | ||
455 | 37 | |||
456 | 38 | public Q_SLOTS: | ||
457 | 39 | void onCallEventLoaded(const Tpl::CallEventPtr &event); | ||
458 | 40 | void onMessageEventLoaded(const Tpl::TextEventPtr &event); | ||
459 | 41 | void onFinished(); | ||
460 | 42 | private: | ||
461 | 43 | int mTextEventCount; | ||
462 | 44 | int mVoiceEventCount; | ||
463 | 45 | History::Events mEvents; | ||
464 | 46 | int mBatchSize; | ||
465 | 47 | |||
466 | 48 | }; | ||
467 | 49 | |||
468 | 50 | #endif // TELEPATHYLOGIMPORTER_H | ||
469 | 51 | 0 | ||
470 | === removed file 'tools/tplogger-import/telepathylogreader.cpp' | |||
471 | --- tools/tplogger-import/telepathylogreader.cpp 2013-07-12 14:30:18 +0000 | |||
472 | +++ tools/tplogger-import/telepathylogreader.cpp 1970-01-01 00:00:00 +0000 | |||
473 | @@ -1,173 +0,0 @@ | |||
474 | 1 | /* | ||
475 | 2 | * Copyright (C) 2012-2013 Canonical, Ltd. | ||
476 | 3 | * | ||
477 | 4 | * Authors: | ||
478 | 5 | * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> | ||
479 | 6 | * | ||
480 | 7 | * This file is part of history-service. | ||
481 | 8 | * | ||
482 | 9 | * history-service is free software; you can redistribute it and/or modify | ||
483 | 10 | * it under the terms of the GNU General Public License as published by | ||
484 | 11 | * the Free Software Foundation; version 3. | ||
485 | 12 | * | ||
486 | 13 | * history-service is distributed in the hope that it will be useful, | ||
487 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
488 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
489 | 16 | * GNU General Public License for more details. | ||
490 | 17 | * | ||
491 | 18 | * You should have received a copy of the GNU General Public License | ||
492 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
493 | 20 | */ | ||
494 | 21 | |||
495 | 22 | #include "telepathylogreader.h" | ||
496 | 23 | #include <TelepathyLoggerQt/LogManager> | ||
497 | 24 | #include <TelepathyLoggerQt/PendingDates> | ||
498 | 25 | #include <TelepathyLoggerQt/PendingEntities> | ||
499 | 26 | #include <TelepathyLoggerQt/PendingEvents> | ||
500 | 27 | #include <TelepathyLoggerQt/Entity> | ||
501 | 28 | #include <TelepathyLoggerQt/Event> | ||
502 | 29 | #include <TelepathyLoggerQt/CallEvent> | ||
503 | 30 | #include <TelepathyLoggerQt/TextEvent> | ||
504 | 31 | #include <TelepathyQt/PendingReady> | ||
505 | 32 | |||
506 | 33 | TelepathyLogReader::TelepathyLogReader(QObject *parent) : | ||
507 | 34 | QObject(parent), mLogManager(Tpl::LogManager::instance()) | ||
508 | 35 | { | ||
509 | 36 | Tp::Features accountFeatures; | ||
510 | 37 | Tp::Features contactFeatures; | ||
511 | 38 | accountFeatures << Tp::Account::FeatureCore; | ||
512 | 39 | contactFeatures << Tp::Contact::FeatureAlias | ||
513 | 40 | << Tp::Contact::FeatureAvatarData | ||
514 | 41 | << Tp::Contact::FeatureAvatarToken | ||
515 | 42 | << Tp::Contact::FeatureCapabilities | ||
516 | 43 | << Tp::Contact::FeatureSimplePresence; | ||
517 | 44 | |||
518 | 45 | mAccountManager = Tp::AccountManager::create( | ||
519 | 46 | Tp::AccountFactory::create(QDBusConnection::sessionBus(), accountFeatures), | ||
520 | 47 | Tp::ConnectionFactory::create(QDBusConnection::sessionBus()), | ||
521 | 48 | Tp::ChannelFactory::create(QDBusConnection::sessionBus()), | ||
522 | 49 | Tp::ContactFactory::create(contactFeatures)); | ||
523 | 50 | |||
524 | 51 | connect(mAccountManager->becomeReady(Tp::AccountManager::FeatureCore), | ||
525 | 52 | SIGNAL(finished(Tp::PendingOperation*)), | ||
526 | 53 | SLOT(onAccountManagerReady(Tp::PendingOperation*))); | ||
527 | 54 | } | ||
528 | 55 | |||
529 | 56 | TelepathyLogReader *TelepathyLogReader::instance() | ||
530 | 57 | { | ||
531 | 58 | static TelepathyLogReader *self = new TelepathyLogReader(); | ||
532 | 59 | return self; | ||
533 | 60 | } | ||
534 | 61 | |||
535 | 62 | void TelepathyLogReader::fetchLog(const Tp::AccountPtr &account) | ||
536 | 63 | { | ||
537 | 64 | Tpl::PendingEntities *pendingEntities = mLogManager->queryEntities(account); | ||
538 | 65 | |||
539 | 66 | mOperations.append(pendingEntities); | ||
540 | 67 | |||
541 | 68 | /* Fetching the log work like this: | ||
542 | 69 | - Start by fetching the entities from the log | ||
543 | 70 | - Once you get the entities, fetch the available dates | ||
544 | 71 | - After you get the dates, fetch the events themselves | ||
545 | 72 | */ | ||
546 | 73 | |||
547 | 74 | connect(pendingEntities, | ||
548 | 75 | SIGNAL(finished(Tpl::PendingOperation*)), | ||
549 | 76 | SLOT(onPendingEntitiesFinished(Tpl::PendingOperation*))); | ||
550 | 77 | } | ||
551 | 78 | |||
552 | 79 | void TelepathyLogReader::requestDatesForEntities(const Tp::AccountPtr &account, const Tpl::EntityPtrList &entities) | ||
553 | 80 | { | ||
554 | 81 | Q_FOREACH(Tpl::EntityPtr entity, entities) { | ||
555 | 82 | Tpl::PendingDates *pendingDates = mLogManager->queryDates(account, entity, Tpl::EventTypeMaskAny); | ||
556 | 83 | |||
557 | 84 | connect(pendingDates, | ||
558 | 85 | SIGNAL(finished(Tpl::PendingOperation*)), | ||
559 | 86 | SLOT(onPendingDatesFinished(Tpl::PendingOperation*))); | ||
560 | 87 | mOperations.append(pendingDates); | ||
561 | 88 | } | ||
562 | 89 | } | ||
563 | 90 | |||
564 | 91 | void TelepathyLogReader::requestEventsForDates(const Tp::AccountPtr &account, const Tpl::EntityPtr &entity, const Tpl::QDateList &dates) | ||
565 | 92 | { | ||
566 | 93 | Q_FOREACH(QDate date, dates) { | ||
567 | 94 | Tpl::PendingEvents *pendingEvents = mLogManager->queryEvents(account, entity, Tpl::EventTypeMaskAny, date); | ||
568 | 95 | connect(pendingEvents, | ||
569 | 96 | SIGNAL(finished(Tpl::PendingOperation*)), | ||
570 | 97 | SLOT(onPendingEventsFinished(Tpl::PendingOperation*))); | ||
571 | 98 | mOperations.append(pendingEvents); | ||
572 | 99 | } | ||
573 | 100 | } | ||
574 | 101 | |||
575 | 102 | void TelepathyLogReader::onPendingEntitiesFinished(Tpl::PendingOperation *op) | ||
576 | 103 | { | ||
577 | 104 | Tpl::PendingEntities *pe = qobject_cast<Tpl::PendingEntities*>(op); | ||
578 | 105 | if (!pe) { | ||
579 | 106 | return; | ||
580 | 107 | } | ||
581 | 108 | |||
582 | 109 | // request the dates for all the entities | ||
583 | 110 | requestDatesForEntities(pe->account(), pe->entities()); | ||
584 | 111 | |||
585 | 112 | mOperations.removeAll(op); | ||
586 | 113 | if (mOperations.isEmpty()) { | ||
587 | 114 | Q_EMIT finished(); | ||
588 | 115 | } | ||
589 | 116 | } | ||
590 | 117 | |||
591 | 118 | void TelepathyLogReader::onPendingDatesFinished(Tpl::PendingOperation *op) | ||
592 | 119 | { | ||
593 | 120 | Tpl::PendingDates *pd = qobject_cast<Tpl::PendingDates*>(op); | ||
594 | 121 | if (!pd) { | ||
595 | 122 | return; | ||
596 | 123 | } | ||
597 | 124 | |||
598 | 125 | // request all events | ||
599 | 126 | requestEventsForDates(pd->account(), pd->entity(), pd->dates()); | ||
600 | 127 | |||
601 | 128 | mOperations.removeAll(op); | ||
602 | 129 | if (mOperations.isEmpty()) { | ||
603 | 130 | Q_EMIT finished(); | ||
604 | 131 | } | ||
605 | 132 | } | ||
606 | 133 | |||
607 | 134 | void TelepathyLogReader::onPendingEventsFinished(Tpl::PendingOperation *op) | ||
608 | 135 | { | ||
609 | 136 | Tpl::PendingEvents *pe = qobject_cast<Tpl::PendingEvents*>(op); | ||
610 | 137 | if (!pe) { | ||
611 | 138 | return; | ||
612 | 139 | } | ||
613 | 140 | |||
614 | 141 | Q_FOREACH(const Tpl::EventPtr &event, pe->events()) { | ||
615 | 142 | bool incoming = event->receiver()->entityType() == Tpl::EntityTypeSelf; | ||
616 | 143 | Tpl::EntityPtr remoteEntity = incoming ? event->sender() : event->receiver(); | ||
617 | 144 | |||
618 | 145 | QString phoneNumber = remoteEntity->identifier(); | ||
619 | 146 | QDateTime timestamp = event->timestamp(); | ||
620 | 147 | |||
621 | 148 | Tpl::CallEventPtr callEvent = event.dynamicCast<Tpl::CallEvent>(); | ||
622 | 149 | Tpl::TextEventPtr textEvent = event.dynamicCast<Tpl::TextEvent>(); | ||
623 | 150 | |||
624 | 151 | if (!callEvent.isNull()) { | ||
625 | 152 | Q_EMIT loadedCallEvent(callEvent); | ||
626 | 153 | } | ||
627 | 154 | |||
628 | 155 | if (!textEvent.isNull()) { | ||
629 | 156 | Q_EMIT loadedMessageEvent(textEvent); | ||
630 | 157 | } | ||
631 | 158 | } | ||
632 | 159 | |||
633 | 160 | mOperations.removeAll(op); | ||
634 | 161 | if (mOperations.isEmpty()) { | ||
635 | 162 | Q_EMIT finished(); | ||
636 | 163 | } | ||
637 | 164 | } | ||
638 | 165 | |||
639 | 166 | |||
640 | 167 | void TelepathyLogReader::onAccountManagerReady(Tp::PendingOperation *op) | ||
641 | 168 | { | ||
642 | 169 | mLogManager->setAccountManagerPtr(mAccountManager); | ||
643 | 170 | Q_FOREACH(const Tp::AccountPtr account, mAccountManager->allAccounts()) { | ||
644 | 171 | fetchLog(account); | ||
645 | 172 | } | ||
646 | 173 | } | ||
647 | 174 | 0 | ||
648 | === removed file 'tools/tplogger-import/telepathylogreader.h' | |||
649 | --- tools/tplogger-import/telepathylogreader.h 2013-07-12 14:30:18 +0000 | |||
650 | +++ tools/tplogger-import/telepathylogreader.h 1970-01-01 00:00:00 +0000 | |||
651 | @@ -1,71 +0,0 @@ | |||
652 | 1 | /* | ||
653 | 2 | * Copyright (C) 2012-2013 Canonical, Ltd. | ||
654 | 3 | * | ||
655 | 4 | * Authors: | ||
656 | 5 | * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> | ||
657 | 6 | * | ||
658 | 7 | * This file is part of history-service. | ||
659 | 8 | * | ||
660 | 9 | * history-service is free software; you can redistribute it and/or modify | ||
661 | 10 | * it under the terms of the GNU General Public License as published by | ||
662 | 11 | * the Free Software Foundation; version 3. | ||
663 | 12 | * | ||
664 | 13 | * history-service is distributed in the hope that it will be useful, | ||
665 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
666 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
667 | 16 | * GNU General Public License for more details. | ||
668 | 17 | * | ||
669 | 18 | * You should have received a copy of the GNU General Public License | ||
670 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
671 | 20 | */ | ||
672 | 21 | |||
673 | 22 | #ifndef TELEPATHYLOGREADER_H | ||
674 | 23 | #define TELEPATHYLOGREADER_H | ||
675 | 24 | |||
676 | 25 | #include <QObject> | ||
677 | 26 | #include <TelepathyLoggerQt/PendingOperation> | ||
678 | 27 | #include <TelepathyLoggerQt/Types> | ||
679 | 28 | #include <TelepathyLoggerQt/LogManager> | ||
680 | 29 | #include <TelepathyLoggerQt/CallEvent> | ||
681 | 30 | #include <TelepathyLoggerQt/TextEvent> | ||
682 | 31 | #include <TelepathyQt/AccountManager> | ||
683 | 32 | #include <QDateTime> | ||
684 | 33 | #include <QList> | ||
685 | 34 | #include <QMap> | ||
686 | 35 | #include <QUrl> | ||
687 | 36 | |||
688 | 37 | class TelepathyLogReader : public QObject | ||
689 | 38 | { | ||
690 | 39 | Q_OBJECT | ||
691 | 40 | public: | ||
692 | 41 | static TelepathyLogReader *instance(); | ||
693 | 42 | |||
694 | 43 | public Q_SLOTS: | ||
695 | 44 | void fetchLog(const Tp::AccountPtr &account); | ||
696 | 45 | |||
697 | 46 | protected: | ||
698 | 47 | void requestDatesForEntities(const Tp::AccountPtr &account, const Tpl::EntityPtrList &entities); | ||
699 | 48 | void requestEventsForDates(const Tp::AccountPtr &account, const Tpl::EntityPtr &entity, const Tpl::QDateList &dates); | ||
700 | 49 | |||
701 | 50 | Q_SIGNALS: | ||
702 | 51 | void loadedCallEvent(const Tpl::CallEventPtr &event); | ||
703 | 52 | void loadedMessageEvent(const Tpl::TextEventPtr &event); | ||
704 | 53 | void finished(); | ||
705 | 54 | |||
706 | 55 | protected Q_SLOTS: | ||
707 | 56 | void onAccountManagerReady(Tp::PendingOperation *op); | ||
708 | 57 | void onPendingEntitiesFinished(Tpl::PendingOperation *op); | ||
709 | 58 | void onPendingDatesFinished(Tpl::PendingOperation *op); | ||
710 | 59 | void onPendingEventsFinished(Tpl::PendingOperation *op); | ||
711 | 60 | |||
712 | 61 | protected: | ||
713 | 62 | Tpl::LogManagerPtr mLogManager; | ||
714 | 63 | Tp::AccountManagerPtr mAccountManager; | ||
715 | 64 | |||
716 | 65 | private: | ||
717 | 66 | explicit TelepathyLogReader(QObject *parent = 0); | ||
718 | 67 | QList <Tpl::PendingOperation*> mOperations; | ||
719 | 68 | |||
720 | 69 | }; | ||
721 | 70 | |||
722 | 71 | #endif // CALLLOGMODEL_H |