Changeset View
Changeset View
Standalone View
Standalone View
app/main.cpp
Show All 20 Lines | |||||
21 | * | 21 | * | ||
22 | */ | 22 | */ | ||
23 | 23 | | |||
24 | #include "ark_version.h" | 24 | #include "ark_version.h" | ||
25 | #include "ark_debug.h" | 25 | #include "ark_debug.h" | ||
26 | #include "mainwindow.h" | 26 | #include "mainwindow.h" | ||
27 | #include "batchextract.h" | 27 | #include "batchextract.h" | ||
28 | #include "addtoarchive.h" | 28 | #include "addtoarchive.h" | ||
29 | #include "pluginmanager.h" | ||||
29 | 30 | | |||
30 | #include <QApplication> | 31 | #include <QApplication> | ||
31 | #include <QCommandLineParser> | 32 | #include <QCommandLineParser> | ||
32 | #include <QByteArray> | 33 | #include <QByteArray> | ||
33 | #include <QFileInfo> | 34 | #include <QFileInfo> | ||
34 | #include <QFileOpenEvent> | 35 | #include <QFileOpenEvent> | ||
35 | 36 | | |||
36 | #include <KAboutData> | 37 | #include <KAboutData> | ||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Line(s) | 188 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("b") << QStringLiteral("batch"), | |||
188 | i18n("Use the batch interface instead of the usual dialog. This option is implied if more than one url is specified."))); | 189 | i18n("Use the batch interface instead of the usual dialog. This option is implied if more than one url is specified."))); | ||
189 | 190 | | |||
190 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("e") << QStringLiteral("autodestination"), | 191 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("e") << QStringLiteral("autodestination"), | ||
191 | i18n("The destination argument will be set to the path of the first file supplied."))); | 192 | i18n("The destination argument will be set to the path of the first file supplied."))); | ||
192 | 193 | | |||
193 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("a") << QStringLiteral("autosubfolder"), | 194 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("a") << QStringLiteral("autosubfolder"), | ||
194 | i18n("Archive contents will be read, and if detected to not be a single folder archive, a subfolder with the name of the archive will be created."))); | 195 | i18n("Archive contents will be read, and if detected to not be a single folder archive, a subfolder with the name of the archive will be created."))); | ||
195 | 196 | | |||
197 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("m") << QStringLiteral("mimetypes"), | ||||
elvisangelaccio: Please add also the short version, i.e. `QStringLiteral("m")` | |||||
198 | i18n("List supported MIME types."))); | ||||
199 | | ||||
196 | aboutData.setupCommandLine(&parser); | 200 | aboutData.setupCommandLine(&parser); | ||
197 | 201 | | |||
198 | // Do the command line parsing. | 202 | // Do the command line parsing. | ||
199 | parser.process(application); | 203 | parser.process(application); | ||
200 | 204 | | |||
201 | // Handle standard options. | 205 | // Handle standard options. | ||
202 | aboutData.processCommandLine(&parser); | 206 | aboutData.processCommandLine(&parser); | ||
203 | 207 | | |||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 299 | if (parser.isSet(QStringLiteral("dialog"))) { | |||
296 | qCDebug(ARK) << "Opening extraction dialog"; | 300 | qCDebug(ARK) << "Opening extraction dialog"; | ||
297 | if (!batchJob->showExtractDialog()) { | 301 | if (!batchJob->showExtractDialog()) { | ||
298 | return 0; | 302 | return 0; | ||
299 | } | 303 | } | ||
300 | } | 304 | } | ||
301 | 305 | | |||
302 | batchJob->start(); | 306 | batchJob->start(); | ||
303 | 307 | | |||
308 | } else if (parser.isSet(QStringLiteral("mimetypes"))) { | ||||
309 | | ||||
310 | Kerfuffle::PluginManager pluginManager; | ||||
311 | const auto mimeTypes = pluginManager.supportedMimeTypes(); | ||||
312 | QTextStream cout(stdout); | ||||
313 | for (const auto &mimeType : mimeTypes) { | ||||
elvisangelaccio: Please add a space before `:` | |||||
314 | cout << mimeType << '\n'; | ||||
315 | } | ||||
316 | return 0; | ||||
317 | | ||||
304 | } else { | 318 | } else { | ||
305 | 319 | | |||
306 | MainWindow *window = new MainWindow; | 320 | MainWindow *window = new MainWindow; | ||
307 | if (!window->loadPart()) { // if loading the part fails | 321 | if (!window->loadPart()) { // if loading the part fails | ||
308 | delete window; | 322 | delete window; | ||
309 | return -1; | 323 | return -1; | ||
310 | } | 324 | } | ||
311 | 325 | | |||
Show All 18 Lines |
Please add also the short version, i.e. QStringLiteral("m")