1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

CommandLineOptions: Don't exit on unknown option

Makes it possible to pass options to Chromium
This commit is contained in:
David Rosca 2016-04-23 09:46:49 +02:00
parent 06087a943e
commit 9497013197

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - QtWebEngine based browser
* Copyright (C) 2010-2015 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* 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
@ -78,8 +78,8 @@ void CommandLineOptions::parseActions()
// Parser
QCommandLineParser parser;
parser.setApplicationDescription(QSL("QtWebEngine based browser"));
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption helpOption = parser.addHelpOption();
QCommandLineOption versionOption = parser.addVersionOption();
parser.addOption(authorsOption);
parser.addOption(profileOption);
parser.addOption(noExtensionsOption);
@ -93,7 +93,17 @@ void CommandLineOptions::parseActions()
parser.addOption(openWindowOption);
parser.addOption(fullscreenOption);
parser.addPositionalArgument(QSL("URL"), QSL("URLs to open"), QSL("[URL...]"));
parser.process(QCoreApplication::arguments());
// parse() and not process() so we can pass arbitrary options to Chromium
parser.parse(QCoreApplication::arguments());
if (parser.isSet(helpOption)) {
parser.showHelp();
}
if (parser.isSet(versionOption)) {
parser.showVersion();
}
if (parser.isSet(authorsOption)) {
std::cout << "David Rosca <nowrep@gmail.com>" << std::endl;