File indexing completed on 2024-05-12 16:39:24
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 0021 // clazy:excludeall=qstring-arg 0022 #include "commandlineparser.h" 0023 0024 #include <KDBusService> 0025 0026 #include <QApplication> 0027 #include <QLoggingCategory> 0028 #include <QDir> 0029 0030 #include <Calligra2Migration.h> 0031 0032 extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) 0033 { 0034 QApplication app(argc, argv); 0035 #ifdef Q_OS_MACOS 0036 // app.applicationName() will return "Plan Work" because of the nice name 0037 // set in the Info.plist. DBus doesn't like the resulting space in the 0038 // service name, so reset the application name: 0039 app.setApplicationName("calligraplanwork"); 0040 #endif 0041 KDBusService service(KDBusService::Unique); 0042 // we come here only once... 0043 0044 /** 0045 * Disable debug output by default, only log warnings. 0046 * Debug logs can be controlled by the environment variable QT_LOGGING_RULES. 0047 * 0048 * For example, to get full debug output, run the following: 0049 * QT_LOGGING_RULES="calligra.planwork=true" calligraplan 0050 * 0051 * See: http://doc.qt.io/qt-5/qloggingcategory.html 0052 */ 0053 QLoggingCategory::setFilterRules("calligra.plan*.debug=false\n" 0054 "calligra.plan*.warning=true"); 0055 0056 // Migrate data from kde4 to kf5 locations 0057 Calligra2Migration m("calligraplanwork", "planwork"); 0058 m.setConfigFiles(QStringList() << QStringLiteral("planworkrc")); 0059 m.setUiFiles(QStringList() << QStringLiteral("planwork.rc") << QStringLiteral("planwork_readonly.rc") << QStringLiteral("planworkui.rc")); 0060 m.migrate(); 0061 0062 CommandLineParser cmd; 0063 QObject::connect(&service, &KDBusService::activateRequested, &cmd, &CommandLineParser::handleActivateRequest); 0064 cmd.handleCommandLine(QDir::current()); 0065 return app.exec(); 0066 }