Warning, file /plasma/bluedevil/src/sendfile/main.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *  SPDX-FileCopyrightText: 2010-2012 Alejandro Fiestas Olivares <afiestas@kde.org>
0003  *  SPDX-FileCopyrightText: 2010 UFO Coders <info@ufocoders.com>
0004  *
0005  *  SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #include "sendfilewizard.h"
0009 #include "version.h"
0010 
0011 #include <QApplication>
0012 #include <QCommandLineOption>
0013 #include <QCommandLineParser>
0014 
0015 #include <KAboutData>
0016 #include <KDBusService>
0017 #include <KLocalizedString>
0018 #include <KWindowSystem>
0019 
0020 int main(int argc, char *argv[])
0021 {
0022     QApplication app(argc, argv);
0023 
0024     KAboutData aboutData(QStringLiteral("bluedevilsendfile"),
0025                          i18n("Bluetooth File Transfer"),
0026                          QStringLiteral(BLUEDEVIL_VERSION_STRING),
0027                          i18n("Bluetooth File Transfer"),
0028                          KAboutLicense::GPL,
0029                          i18n("(c) 2010, UFO Coders"));
0030 
0031     aboutData.addAuthor(QStringLiteral("David Rosca"), //
0032                         i18n("Maintainer"),
0033                         QStringLiteral("nowrep@gmail.com"),
0034                         QStringLiteral("http://david.rosca.cz"));
0035 
0036     aboutData.addAuthor(QStringLiteral("Alejandro Fiestas Olivares"),
0037                         i18n("Previous Maintainer"),
0038                         QStringLiteral("afiestas@kde.org"),
0039                         QStringLiteral("http://www.afiestas.org/"));
0040     app.setWindowIcon(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")));
0041     app.setQuitOnLastWindowClosed(false);
0042 
0043     KAboutData::setApplicationData(aboutData);
0044     KDBusService service;
0045 
0046     QCommandLineOption kioOption(QStringList() << QStringLiteral("kio") << QStringLiteral("k"));
0047     kioOption.setDescription(i18n("Specify receiving device by MAC address."));
0048     kioOption.setValueName(QStringLiteral("bluetooth://address"));
0049 
0050     QCommandLineOption ubiOption(QStringList() << QStringLiteral("ubi") << QStringLiteral("u"));
0051     ubiOption.setDescription(i18n("Specify receiving device by UBI path."));
0052     ubiOption.setValueName(QStringLiteral("ubi"));
0053 
0054     QCommandLineOption filesOption(QStringList() << QStringLiteral("files") << QStringLiteral("f"));
0055     filesOption.setDescription(i18n("Files to be sent."));
0056     filesOption.setValueName(QStringLiteral("files"));
0057 
0058     QCommandLineParser parser;
0059     parser.addOption(kioOption);
0060     parser.addOption(ubiOption);
0061     parser.addOption(filesOption);
0062     aboutData.setupCommandLine(&parser);
0063 
0064     parser.process(app);
0065     aboutData.processCommandLine(&parser);
0066 
0067     QString deviceInfo = parser.value(ubiOption);
0068     if (deviceInfo.isEmpty()) {
0069         deviceInfo = parser.value(kioOption);
0070     }
0071 
0072     SendFileWizard *wizard = new SendFileWizard(deviceInfo, parser.values(filesOption));
0073 
0074     QObject::connect(&service, &KDBusService::activateRequested, wizard, [wizard]() {
0075         KWindowSystem::updateStartupId(wizard->windowHandle());
0076         KWindowSystem::activateWindow(wizard->windowHandle());
0077     });
0078 
0079     return app.exec();
0080 }