main.cpp 2.17 KB
Newer Older
1
/*
Laurent Montel's avatar
Laurent Montel committed
2
   Copyright (C) 2012-2019 Montel Laurent <montel@kde.org>
3

Laurent Montel's avatar
Laurent Montel committed
4
5
6
7
   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.
8

Laurent Montel's avatar
Laurent Montel committed
9
10
11
12
   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.
13

Laurent Montel's avatar
Laurent Montel committed
14
15
16
17
   You should have received a copy of the GNU General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
18
19
*/

Laurent Montel's avatar
Laurent Montel committed
20
21
#include "pimdataexporterwindow.h"
#include "pimdatacommandlineoption.h"
22

Laurent Montel's avatar
Laurent Montel committed
23
#include <KLocalizedString>
Laurent Montel's avatar
Laurent Montel committed
24
#include <KDBusService>
Laurent Montel's avatar
Laurent Montel committed
25
#include <QApplication>
Laurent Montel's avatar
Laurent Montel committed
26
#include <kdelibs4configmigrator.h>
Laurent Montel's avatar
Laurent Montel committed
27
#include <KCrash>
28
29
30

int main(int argc, char *argv[])
{
31
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
Laurent Montel's avatar
Laurent Montel committed
32
    QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
33
    QApplication app(argc, argv);
34

Laurent Montel's avatar
Laurent Montel committed
35
    KLocalizedString::setApplicationDomain("pimdataexporter");
36

Laurent Montel's avatar
Laurent Montel committed
37
    KCrash::initialize();
Laurent Montel's avatar
Laurent Montel committed
38
39
40
    app.setDesktopFileName(QStringLiteral("org.kde.pimdataexporter"));
    Kdelibs4ConfigMigrator migrate(QStringLiteral("pimdataexporter"));
    //old migration. Don't change it
Laurent Montel's avatar
Laurent Montel committed
41
42
    migrate.setConfigFiles(QStringList() << QStringLiteral("pimsettingexporterrc"));
    migrate.setUiFiles(QStringList() << QStringLiteral("pimsettingexporter.rc"));
Laurent Montel's avatar
Laurent Montel committed
43
    migrate.migrate();
Laurent Montel's avatar
Laurent Montel committed
44
    QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("kontact")));
Laurent Montel's avatar
Laurent Montel committed
45

Laurent Montel's avatar
Laurent Montel committed
46
    PimDataCommandLineOption parser;
Laurent Montel's avatar
Laurent Montel committed
47
    parser.createParser(app);
Laurent Montel's avatar
Laurent Montel committed
48
49

    KDBusService service(KDBusService::Unique);
Laurent Montel's avatar
Laurent Montel committed
50

Laurent Montel's avatar
Laurent Montel committed
51
    PimDataExporterWindow *backupMailWin = new PimDataExporterWindow();
Laurent Montel's avatar
Laurent Montel committed
52
    parser.setExportWindow(backupMailWin);
53
    QObject::connect(&service, &KDBusService::activateRequested,
Laurent Montel's avatar
Laurent Montel committed
54
                     &parser, &PimDataCommandLineOption::slotActivateRequested);
Laurent Montel's avatar
Laurent Montel committed
55
    backupMailWin->show();
Laurent Montel's avatar
Laurent Montel committed
56
    parser.handleCommandLine();
Laurent Montel's avatar
Laurent Montel committed
57

Laurent Montel's avatar
Laurent Montel committed
58
    return app.exec();
59
}