File indexing completed on 2024-04-28 16:24:41

0001 /* This file is part of the KDE project
0002    Copyright (C) 2001 Thomas zander <zander@kde.org>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018 */
0019 
0020 // clazy:excludeall=qstring-arg
0021 #include "kptaboutdata.h"
0022 #include "kptmaindocument.h"
0023 
0024 #include <KoApplication.h>
0025 #include <Calligra2Migration.h>
0026 
0027 #include <QApplication>
0028 #include <QLoggingCategory>
0029 
0030 extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
0031 {
0032     /**
0033      * Disable debug output by default, only log warnings.
0034      * Debug logs can be controlled by the environment variable QT_LOGGING_RULES.
0035      *
0036      * For example, to get full debug output, run the following:
0037      * QT_LOGGING_RULES="calligra.*=true" calligraplan
0038      *
0039      * See: http://doc.qt.io/qt-5/qloggingcategory.html
0040      */
0041     QLoggingCategory::setFilterRules("calligra.*.debug=false\n"
0042                                      "calligra.*.warning=true");
0043 
0044     QApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
0045     KoApplication app(PLAN_MIME_TYPE, QStringLiteral("calligraplan"), KPlato::newAboutData, argc, argv);
0046 
0047     // Migrate data from kde4 to kf5 locations
0048     Calligra2Migration m("calligraplan", "plan");
0049     m.setConfigFiles(QStringList() << QStringLiteral("planrc"));
0050     m.setUiFiles(QStringList() << QStringLiteral("plan.rc") << QStringLiteral("plan_readonly.rc"));
0051     m.migrate();
0052     
0053     if (!app.start()) {
0054     return 1;
0055     }
0056 
0057     return app.exec();
0058 }