Add AA_EnableHighDpiScaling
[kdepim.git] / ktnef / main.cpp
blobff5f20c01e2b356e75e6ab8ab51d2b3533b5aa3b
1 /*
2 This file is part of KTnef.
4 Copyright (C) 2002 Michael Goffioul <kdeprint@swing.be>
5 Copyright (c) 2012 Allen Winter <winter@kde.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software Foundation,
14 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17 #include "ktnefmain.h"
18 #include "kdepim-version.h"
20 #include <Kdelibs4ConfigMigrator>
21 #include <kaboutdata.h>
22 #include <KLocalizedString>
23 #include <QCommandLineParser>
24 #include <QApplication>
25 #include <KDBusService>
27 int main(int argc, char *argv[])
29 QApplication app(argc, argv);
30 KLocalizedString::setApplicationDomain("ktnef");
31 app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
32 #if QT_VERSION >= 0x050600
33 app.setAttribute(Qt::AA_EnableHighDpiScaling);
34 #endif
35 Kdelibs4ConfigMigrator migrate(QStringLiteral("ktnef"));
36 migrate.setConfigFiles(QStringList() << QStringLiteral("ktnefrc"));
37 migrate.setUiFiles(QStringList() << QStringLiteral("ktnefui.rc"));
38 migrate.migrate();
40 KAboutData aboutData(QStringLiteral("ktnef"),
41 i18n("KTnef"),
42 QStringLiteral(KDEPIM_VERSION),
43 i18n("Viewer for mail attachments using TNEF format"),
44 KAboutLicense::GPL,
45 i18n("Copyright 2000 Michael Goffioul\nCopyright 2012 Allen Winter"));
47 aboutData.addAuthor(
48 i18n("Michael Goffioul"),
49 i18n("Author"),
50 QStringLiteral("kdeprint@swing.be"));
52 aboutData.addAuthor(
53 i18n("Allen Winter"),
54 i18n("Author, Ported to Qt4/KDE4"),
55 QStringLiteral("winter@kde.org"));
57 KAboutData::setApplicationData(aboutData);
59 QCommandLineParser parser;
60 parser.setApplicationDescription(QApplication::applicationDisplayName());
61 parser.addVersionOption();
62 parser.addHelpOption();
63 parser.addPositionalArgument(QStringLiteral("file"), i18n("An optional argument 'file' "), QStringLiteral("[file]"));
65 aboutData.setupCommandLine(&parser);
66 parser.process(app);
67 aboutData.processCommandLine(&parser);
69 KDBusService service;
71 KTNEFMain *tnef = new KTNEFMain();
72 tnef->show();
73 const QStringList &args = parser.positionalArguments();
75 if (!args.isEmpty()) {
76 tnef->loadFile(args.first());
79 return app.exec();