main.cpp 4.42 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/***************************************************************************
 *   Copyright (C) 2012 by David Edmundson <kde@davidedmundson.co.uk>      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
 ***************************************************************************/

20
21
22
23
24
#include <QApplication>
#include <QCommandLineParser>

#include <KAboutData>
#include <KLocalizedString>
25

David Edmundson's avatar
David Edmundson committed
26
#include "log-viewer.h"
27
#include "../ktptextui_version.h"
28
#include "debug.h"
David Edmundson's avatar
David Edmundson committed
29

30
31
#include <TelepathyQt/AccountManager>

32
33
#include <KTp/contact-factory.h>

34
35
Q_LOGGING_CATEGORY(KTP_LOGVIEWER, "ktp-logviewer")

David Edmundson's avatar
David Edmundson committed
36
37
int main(int argc, char *argv[])
{
38
    QApplication app(argc, argv);
39
    KLocalizedString::setApplicationDomain("ktp-log-viewer");
40
41
42
43
44
45
46

    KAboutData aboutData("ktp-log-viewer",
                         i18n("KDE IM Log Viewer"),
                         QStringLiteral(KTP_TEXT_UI_VERSION_STRING));
    aboutData.addAuthor(i18n("David Edmundson"), i18n("Developer"), "kde@davidedmundson.co.uk");
    aboutData.addAuthor(i18n("Daniele E. Domenichelli"), i18n("Developer"), "daniele.domenichelli@gmail.com");
    aboutData.addAuthor(i18n("Dan Vrátil"), i18n("Developer"), "dvratil@redhat.com");
47
    aboutData.setProductName("telepathy/log-viewer"); //set the correct name for bug reporting
48
49
50
51
    aboutData.setLicense(KAboutLicense::GPL_V2);

    KAboutData::setApplicationData(aboutData);
    QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("documentation")));
52

53
54
55
    QCommandLineParser parser;
    parser.addHelpOption();
    parser.addVersionOption();
56

57
58
    QCommandLineOption accountId(QStringLiteral("accountID"), i18n("The UID of the account to preselect"));
    QCommandLineOption contactId(QStringLiteral("contactID"), i18n("The UID of the contact to preselect"));
59

60
61
    parser.addOption(accountId);
    parser.addOption(contactId);
62

63
    parser.process(app);
64
65
66
67
68
69

    Tp::registerTypes();

    Tp::AccountFactoryPtr  accountFactory = Tp::AccountFactory::create(
                                                QDBusConnection::sessionBus(),
                                                Tp::Features() << Tp::Account::FeatureCore
70
                                                    << Tp::Account::FeatureAvatar
Daniele E. Domenichelli's avatar
Daniele E. Domenichelli committed
71
                                                    << Tp::Account::FeatureProfile);
72
73
74
75
76
77
78

    Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(
                                                QDBusConnection::sessionBus(),
                                                Tp::Features() << Tp::Connection::FeatureCore
                                                    << Tp::Connection::FeatureSelfContact
                                                    << Tp::Connection::FeatureRoster);

79
    Tp::ContactFactoryPtr contactFactory = KTp::ContactFactory::create(
80
81
82
83
84
85
86
87
88
                                                Tp::Features()  << Tp::Contact::FeatureAlias
                                                    << Tp::Contact::FeatureAvatarData
                                                    << Tp::Contact::FeatureSimplePresence
                                                    << Tp::Contact::FeatureCapabilities);

    Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());

    LogViewer *logViewer = new LogViewer(accountFactory, connectionFactory, channelFactory, contactFactory);
    logViewer->show();
David Edmundson's avatar
David Edmundson committed
89

90
    return app.exec();
David Edmundson's avatar
David Edmundson committed
91
}