File indexing completed on 2024-05-19 16:08:33

0001 /* This file is part of the KDE project
0002    Copyright (C) 1998, 1999 Torben Weis <weis@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 #include "AboutData.h"
0021 #include "DocBase.h"
0022 
0023 #include <KoApplication.h>
0024 #include <Calligra2Migration.h>
0025 
0026 #include <QLoggingCategory>
0027 
0028 using namespace Calligra::Sheets;
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" calligrasheets
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     // QT5TODO: support custom options
0045 //     options.add("scriptfile <scriptfile>", ki18n("Execute the scriptfile after startup."));
0046 
0047     KoApplication app(SHEETS_MIME_TYPE, QStringLiteral("calligrasheets"), newAboutData, argc, argv);
0048 
0049     // Migrate data from kde4 to kf5 locations
0050     Calligra2Migration m("calligrasheets", "sheets");
0051     m.setConfigFiles(QStringList() << QStringLiteral("sheetsrc"));
0052     m.setUiFiles(QStringList() << QStringLiteral("sheets.rc") << QStringLiteral("sheets_readonly.rc"));
0053     m.migrate();
0054 
0055     if (!app.start()) {
0056         return 1;
0057     }
0058 
0059     return app.exec();
0060 }