summaryrefslogtreecommitdiffstats
path: root/src/tdebluezauth/main.cpp
blob: 98ca19ec364b58f786483926f5fceadcf2ac700f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
 *
 *  Adapter config dialog for tdebluez authentication
 *
 *  Copyright (C) 2018  Emanoil Kotsev <[email protected]>
 *
 *
 *  This file is part of tdebluezauth.
 *
 *  tdebluezauth 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.
 *
 *  tdebluezauth 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 kbluetooth; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */


#include <tdecmdlineargs.h>
#include <tdeaboutdata.h>
#include <tdemessagebox.h>
#include <kuniqueapplication.h>
#include <iostream>

#include "application.h"

static const char *description = I18N_NOOP("TDEBluezAuth");
static const char *copy    = I18N_NOOP("Copyright (C) 2018 Emanoil.");

static TDECmdLineOptions options[] =
{
        { 0, 0, 0 }
};

int main(int argc, char *argv[])
{
    TDELocale::setMainCatalogue("tdebluetooth");
    TDEAboutData aboutData("tdebluezauth",
            I18N_NOOP("TDEBluezAuth"),
            0,
            description, TDEAboutData::License_GPL,
            copy,0, "http://trinitydesktop.org");
    aboutData.addAuthor("Tom Patzig", I18N_NOOP("Author"), "[email protected]");
    aboutData.addAuthor("Emanoil Kotsev", I18N_NOOP("Bluez5 and port to TDE"), "[email protected]");
    TDECmdLineArgs::init( argc, argv, &aboutData );
    TDECmdLineArgs::addCmdLineOptions( options );
    KUniqueApplication::addCmdLineOptions();

    if (!KUniqueApplication::start())
    {
        std::cerr << i18n("TDEBluezAuth is already running.\n").local8Bit();
        return 0;
    }

    TDEBluezAuth a;

    if (!a.isConnectedToDBUS())
    {
        KMessageBox::error(NULL,i18n("Can't connect to DBus!\nUnable to start tdebluezauth. \n\n \
							Restart dbus and the bluetooth service"));
        KUniqueApplication::kApplication()->quit();
        return -1;
    }
    else
    {
        return a.exec();
    }

}