~renatofilho/telephony-service/fix-phone-number-field-cursor

119.2.10 by Gustavo Pichorim Boiko
Add copyright to new cpp and header files
1
/*
2
 * Copyright (C) 2012 Canonical, Ltd.
3
 *
4
 * Authors:
5
 *  Tiago Salem Herrmann <tiago.herrmann@canonical.com>
6
 *  Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
7
 *
717.2.9 by Gustavo Pichorim Boiko
Replace phone-app in headers and comments.
8
 * This file is part of telephony-service.
561.1.2 by Gustavo Pichorim Boiko
Adapt the license headers to match the good practices listed for GPL.
9
 *
717.2.9 by Gustavo Pichorim Boiko
Replace phone-app in headers and comments.
10
 * telephony-service is free software; you can redistribute it and/or modify
119.2.10 by Gustavo Pichorim Boiko
Add copyright to new cpp and header files
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation; version 3.
13
 *
717.2.9 by Gustavo Pichorim Boiko
Replace phone-app in headers and comments.
14
 * telephony-service is distributed in the hope that it will be useful,
119.2.10 by Gustavo Pichorim Boiko
Add copyright to new cpp and header files
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 */
22
119.2.1 by Tiago Salem Herrmann
add initial plugin directory and a dummy telepathy channel handler class
23
#include "components.h"
119.2.5 by Gustavo Pichorim Boiko
Make it possible to send text messages via telepathy.
24
#include "telepathyhelper.h"
763.3.1 by Gustavo Pichorim Boiko
Improve the support for handling multiple calls by:
25
#include "callentry.h"
625.1.4 by Gustavo Pichorim Boiko
Turn CallManager into a singleton class and use the channel observer from
26
#include "callmanager.h"
765.4.7 by Tiago Salem Herrmann
add ussdManager to the qml plugin
27
#include "ussdmanager.h"
274.3.2 by Gustavo Pichorim Boiko
Add a telepathy channel observer to watch for new calls to be added to the call
28
#include "channelobserver.h"
309.2.5 by Gustavo Pichorim Boiko
Make the ChatManager singleton
29
#include "chatmanager.h"
719.1.1 by Tiago Salem Herrmann
add initial contact watcher implementation
30
#include "contactwatcher.h"
119.2.1 by Tiago Salem Herrmann
add initial plugin directory and a dummy telepathy channel handler class
31
413.6.2 by Gustavo Pichorim Boiko
Finish the initial porting of C++ code to Qt5.
32
#include <QQmlEngine>
33
#include <qqml.h>
119.2.5 by Gustavo Pichorim Boiko
Make it possible to send text messages via telepathy.
34
#include <TelepathyQt/Debug>
649.5.10 by Renato Araujo Oliveira Filho
Translated conversationfeedmodel.cpp
35
413.6.2 by Gustavo Pichorim Boiko
Finish the initial porting of C++ code to Qt5.
36
void Components::initializeEngine(QQmlEngine *engine, const char *uri)
119.2.1 by Tiago Salem Herrmann
add initial plugin directory and a dummy telepathy channel handler class
37
{
38
    Q_ASSERT(engine);
119.2.4 by Tiago Salem Herrmann
add initial telepathy manager class
39
119.2.17 by Gustavo Pichorim Boiko
Mark the uri as unused
40
    Q_UNUSED(uri);
41
119.2.5 by Gustavo Pichorim Boiko
Make it possible to send text messages via telepathy.
42
    // Initialize telepathy types
43
    Tp::registerTypes();
44
    //Tp::enableDebug(true);
45
    Tp::enableWarnings(true);
610.1.4 by Gustavo Pichorim Boiko
Make sure the TelepathyLogReader gets created sooner to avoid race conditions.
46
119.2.4 by Tiago Salem Herrmann
add initial telepathy manager class
47
    mRootContext = engine->rootContext();
48
    Q_ASSERT(mRootContext);
49
143.3.2 by Gustavo Pichorim Boiko
Add basic support for showing the call log from the telepathy logger
50
    connect(TelepathyHelper::instance(),
51
            SIGNAL(accountReady()),
52
            SLOT(onAccountReady()));
53
194.3.7 by Renato Araujo Oliveira Filho
Used telaphyHelper to notify about applicatio ready.
54
    mRootContext->setContextProperty("telepathyHelper", TelepathyHelper::instance());
309.2.5 by Gustavo Pichorim Boiko
Make the ChatManager singleton
55
    mRootContext->setContextProperty("chatManager", ChatManager::instance());
625.1.4 by Gustavo Pichorim Boiko
Turn CallManager into a singleton class and use the channel observer from
56
    mRootContext->setContextProperty("callManager", CallManager::instance());
765.4.7 by Tiago Salem Herrmann
add ussdManager to the qml plugin
57
    mRootContext->setContextProperty("ussdManager", USSDManager::instance());
453.3.3 by Gustavo Pichorim Boiko
Make it possible to start the app using the memory contacts backend to test
58
119.2.1 by Tiago Salem Herrmann
add initial plugin directory and a dummy telepathy channel handler class
59
}
60
61
void Components::registerTypes(const char *uri)
62
{
714 by Gustavo Pichorim Boiko
Rename the QML plugin to not conflict with the one in phone-app.
63
    // @uri Telephony
119.2.16 by Gustavo Pichorim Boiko
Use a better implementation for the singleton class and make its constructor private
64
    qmlRegisterUncreatableType<TelepathyHelper>(uri, 0, 1, "TelepathyHelper", "This is a singleton helper class");
763.3.1 by Gustavo Pichorim Boiko
Improve the support for handling multiple calls by:
65
    qmlRegisterUncreatableType<CallEntry>(uri, 0, 1, "CallEntry", "Objects of this type are created in CallManager and made available to QML for usage");
719.1.1 by Tiago Salem Herrmann
add initial contact watcher implementation
66
    qmlRegisterType<ContactWatcher>(uri, 0, 1, "ContactWatcher");
119.2.5 by Gustavo Pichorim Boiko
Make it possible to send text messages via telepathy.
67
}
68
143.3.2 by Gustavo Pichorim Boiko
Add basic support for showing the call log from the telepathy logger
69
void Components::onAccountReady()
70
{
434.5.73 by Gustavo Pichorim Boiko
Add a comment explaining why QTimer::singleShot was used to populate the logger
71
    // QTimer::singleShot() is used here to make sure the slots are executed in the correct thread. If we call the slots directly
72
    // the items created for those models will be on the wrong thread.
716 by Gustavo Pichorim Boiko
Remove obsolete contact model and wrapper classes and other models that don't
73
    //QTimer::singleShot(0, TelepathyLogReader::instance(), SLOT(fetchLog()));
143.3.2 by Gustavo Pichorim Boiko
Add basic support for showing the call log from the telepathy logger
74
}