~phablet-team/telephony-service/trunk

« back to all changes in this revision

Viewing changes to indicator/main.cpp

  • Committer: Gustavo Pichorim Boiko
  • Date: 2013-08-22 17:51:46 UTC
  • mto: This revision was merged to the branch mainline in revision 731.
  • Revision ID: gustavo.boiko@canonical.com-20130822175146-epb7n2dh3nasa173
Create a new daemon to host the indicators and OSD to get that code out of the
approver.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2012-2013 Canonical, Ltd.
 
3
 *
 
4
 * Authors:
 
5
 *  Tiago Salem Herrmann <tiago.herrmann@canonical.com>
 
6
 *  Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
 
7
 *
 
8
 * This file is part of telephony-service.
 
9
 *
 
10
 * telephony-service is free software; you can redistribute it and/or modify
 
11
 * it under the terms of the GNU General Public License as published by
 
12
 * the Free Software Foundation; version 3.
 
13
 *
 
14
 * telephony-service is distributed in the hope that it will be useful,
 
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
 
 
23
#include <libnotify/notify.h>
 
24
 
 
25
#include "applicationutils.h"
 
26
#include "callchannelobserver.h"
 
27
#include "telepathyhelper.h"
 
28
#include "textchannelobserver.h"
 
29
#include "voicemailindicator.h"
 
30
#include <QCoreApplication>
 
31
#include <TelepathyQt/ClientRegistrar>
 
32
#include <TelepathyQt/AbstractClient>
 
33
#include <TelepathyQt/AccountManager>
 
34
#include <TelepathyQt/Contact>
 
35
 
 
36
namespace C {
 
37
#include <libintl.h>
 
38
}
 
39
 
 
40
int main(int argc, char **argv)
 
41
{
 
42
    QCoreApplication app(argc, argv);
 
43
 
 
44
    C::bindtextdomain( "telephony-service", "/usr/share/locale" );
 
45
    C::textdomain("telephony-service");
 
46
 
 
47
    notify_init(C::gettext("Telephony Service Indicator"));
 
48
 
 
49
    Tp::registerTypes();
 
50
 
 
51
    // check if there is already an instance of the approver running
 
52
    if (ApplicationUtils::checkApplicationRunning(TP_QT_IFACE_CLIENT + ".TelephonyServiceIndicator")) {
 
53
        qDebug() << "Found another instance of the indicator. Quitting.";
 
54
        return 1;
 
55
    }
 
56
 
 
57
    // register the observer
 
58
    TelepathyHelper::instance()->registerChannelObserver("TelephonyServiceIndicator");
 
59
 
 
60
    // Connect the textObserver and the callObserver to the channel observer in TelepathyHelper
 
61
    CallChannelObserver *callObserver = new CallChannelObserver();
 
62
    TextChannelObserver *textObserver = new TextChannelObserver();
 
63
    QObject::connect(TelepathyHelper::instance()->channelObserver(), SIGNAL(textChannelAvailable(Tp::TextChannelPtr)),
 
64
                     textObserver, SLOT(onTextChannelAvailable(Tp::TextChannelPtr)));
 
65
    QObject::connect(TelepathyHelper::instance()->channelObserver(), SIGNAL(callChannelAvailable(Tp::CallChannelPtr)),
 
66
                     callObserver, SLOT(onCallChannelAvailable(Tp::CallChannelPtr)));
 
67
 
 
68
    // we don't need to call anything on the indicator, it will work by itself
 
69
    VoiceMailIndicator voiceMailIndicator;
 
70
    Q_UNUSED(voiceMailIndicator);
 
71
 
 
72
    return app.exec();
 
73
}