Unverified Commit 6437967c authored by Yichao Yu's avatar Yichao Yu
Browse files

Handle all Qt command line options (--help-all)

Summary:
This was broken in c5897d0e suggesting
that it might be needed to

> fix --help, --version and option errors not being reported on the
> terminal if another instance of KAlarm is already running.

Testing suggests that this is not the case, especially since
the printing to the terminal was handled directly by `process`
in which case it'll never return. I don't really see how the
printing could be stopped unless `stdout` or `stderr` is overriden,
which doesn't seem to be the case.

This is the same as how KDE builtin options are currently handled.

Also remove now unused EXIT command.

Reviewers: djarvie, lbeltrame

Reviewed By: djarvie

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D28704
parent 2794fc06
......@@ -243,28 +243,12 @@ QStringList CommandOptions::setOptions(QCommandLineParser* parser, const QString
void CommandOptions::parse()
{
if (!mParser->parse(mNonExecArguments))
{
setError(mParser->errorText());
return;
}
if (mParser->isSet(QStringLiteral("help")))
{
mCommand = EXIT;
mError = mParser->helpText();
return;
}
if (mParser->isSet(QStringLiteral("version")))
{
mCommand = EXIT;
mError = QCoreApplication::applicationName() + QLatin1String(" ") + QCoreApplication::applicationVersion();
return;
}
mParser->process(mNonExecArguments);
}
void CommandOptions::process()
{
if (mCommand == CMD_ERROR || mCommand == EXIT)
if (mCommand == CMD_ERROR)
return;
#ifndef NDEBUG
......
......@@ -42,7 +42,6 @@ class CommandOptions
{
CMD_ERROR, // error in command line options
NONE, // no command
EXIT, // print outputText() and exit
TRAY, // --tray
TRIGGER_EVENT, // --triggerEvent
CANCEL_EVENT, // --cancelEvent
......
......@@ -391,15 +391,6 @@ int KAlarmApp::activateInstance(const QStringList& args, const QString& workingD
mReadOnly = true; // don't need write access to calendars
exitCode = 1;
break;
case CommandOptions::EXIT:
if (outputText)
{
*outputText = options->outputText();
delete options;
return 0;
}
exitCode = -1;
break;
default:
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment