diff --git a/src/apps/widget/main.cpp b/src/apps/widget/main.cpp index c62fa47d..013fc4da 100644 --- a/src/apps/widget/main.cpp +++ b/src/apps/widget/main.cpp @@ -1,124 +1,127 @@ /* * Copyright (c) 2020 Laurent Montel * * 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) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * 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. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #include #include #include #include #include "config-ruqola.h" #include "ruqola.h" #include "managerdatapaths.h" #include "ruqolamainwindow.h" + +#if HAVE_KUSERFEEDBACK #include "userfeedback/ruqolauserfeedbackprovider.h" +#endif #include #include #include #include #include int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication app(argc, argv); app.setWindowIcon(QIcon::fromTheme(QStringLiteral("ruqola"))); KCrash::initialize(); KLocalizedString::setApplicationDomain("ruqola"); QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org")); KAboutData aboutData(QStringLiteral("ruqola"), i18n("Ruqola"), QStringLiteral(RUQOLA_VERSION), i18n("Rocket Chat Client"), KAboutLicense::GPL_V2, i18n("Copyright © 2020 Ruqola authors")); aboutData.addAuthor(i18n("Laurent Montel"), i18n("Maintainer"), QStringLiteral("montel@kde.org")); aboutData.setOrganizationDomain(QByteArrayLiteral("kde.org")); aboutData.setProductName(QByteArrayLiteral("ruqola")); aboutData.addCredit(i18n("David Faure"), i18n("Bug fixing, delegates etc."), QStringLiteral("faure@kde.org")); aboutData.addCredit(i18n("Kevin Funk"), i18n("Bug fixing"), QStringLiteral("kfunk@kde.org")); aboutData.addCredit(i18n("Olivier JG"), i18n("Bug fixing"), QStringLiteral("olivier.de.gaalon@kdab.com")); aboutData.addCredit(i18n("Milian Wolff"), i18n("Bug fixing"), QStringLiteral("mail@milianw.de")); KAboutData::setApplicationData(aboutData); QCommandLineParser parser; parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("list-accounts"), i18n("Return lists of accounts"))); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("account"), i18n("Start with specific account"), QStringLiteral("accountname"))); #if HAVE_KUSERFEEDBACK parser.addOption(QCommandLineOption(QStringLiteral("feedback"), i18n("Lists the available options for user feedback"))); #endif aboutData.setupCommandLine(&parser); parser.process(app); aboutData.processCommandLine(&parser); #if HAVE_KUSERFEEDBACK if (parser.isSet(QStringLiteral("feedback"))) { RuqolaUserFeedbackProvider *userFeedback = new RuqolaUserFeedbackProvider(nullptr); QTextStream(stdout) << userFeedback->describeDataSources() << '\n'; delete userFeedback; return 0; } #endif if (parser.isSet(QStringLiteral("list-accounts"))) { const QString configPath = ManagerDataPaths::self()->path(ManagerDataPaths::Config, QString()); QDirIterator it(configPath, QStringList() << QStringLiteral( "ruqola.conf"), QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); std::cout << qPrintable(i18n("The following accounts are available:")) << std::endl; while (it.hasNext()) { QString result = it.next(); result.remove(configPath + QLatin1Char('/')); result.remove(QStringLiteral("/ruqola.conf")); std::cout << " " << result.toLocal8Bit().data() << std::endl; } return 0; } QString loadAccount; if (parser.isSet(QStringLiteral("account"))) { loadAccount = parser.value(QStringLiteral("account")); } (void)Ruqola::self(); #if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) // Create systray to show notifications on Desktop (void)Ruqola::self()->notification(); #endif if (!loadAccount.isEmpty()) { Ruqola::self()->setCurrentAccount(loadAccount); } KDBusService service(KDBusService::Unique); auto *mw = new RuqolaMainWindow(); mw->show(); const int val = app.exec(); return val; }