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