CLI improvements for Qt 5.14+

Qt 5.14 adds a "--help-all" option, so include it in the autocompletion.
Qt 5.14 also warns on multiple additions of the same option, which we
accidently did (KAboutData and we ourselves called it), so don't do
that.
Also fixes device autocompletion, which I accidently broke.
This commit is contained in:
Matthijs Tijink 2020-01-07 20:49:03 +00:00
parent b61cf6b28c
commit c6f83e5c16
2 changed files with 2 additions and 2 deletions

View file

@ -83,7 +83,6 @@ int main(int argc, char** argv)
parser.addOption(deviceAutocomplete);
about.setupCommandLine(&parser);
parser.addHelpOption();
parser.process(app);
about.processCommandLine(&parser);
@ -167,7 +166,7 @@ int main(int argc, char** argv)
}
//Exit with 1 if we didn't find a device
return int(!devices.isEmpty());
return int(devices.isEmpty());
} else if(parser.isSet(QStringLiteral("refresh"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect"), QStringLiteral("org.kde.kdeconnect.daemon"), QStringLiteral("forceOnNetworkChange"));
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));

View file

@ -17,6 +17,7 @@ _kdeconnect_device-ids() {
local blockoperations="(operation sms)"
_arguments -s \
'(-)'{-h,--help}'[display usage information]' \
'(-)--help-all[display usage information, including Qt specific options]' \
+ '(global)' \
$blockoperations{-l,--list-devices}'[list all devices]' \
$blockoperations{-a,--list-available}'[list available (paired and reachable) devices]' \