Commit fb174b23 authored by Matthijs Tijink's avatar Matthijs Tijink

Make the cli's --photo option take arguments

Also update the related zsh autocompletion.
parent 342e572d
Pipeline #7795 passed with stage
in 11 minutes and 50 seconds
......@@ -73,7 +73,7 @@ int main(int argc, char** argv)
parser.addOption(QCommandLineOption(QStringLiteral("execute-command"), i18n("Executes a remote command by id"), QStringLiteral("id")));
parser.addOption(QCommandLineOption(QStringList{QStringLiteral("k"), QStringLiteral("send-keys")}, i18n("Sends keys to a said device"), QStringLiteral("key")));
parser.addOption(QCommandLineOption(QStringLiteral("my-id"), i18n("Display this device's id and exit")));
parser.addOption(QCommandLineOption(QStringLiteral("photo"), i18n("Open the connected device's camera and transfer the photo")));
parser.addOption(QCommandLineOption(QStringLiteral("photo"), i18n("Open the connected device's camera and transfer the photo"), QStringLiteral("path")));
//Hidden because it's an implementation detail
QCommandLineOption deviceAutocomplete(QStringLiteral("shell-device-autocompletion"));
......@@ -270,13 +270,13 @@ int main(int argc, char** argv)
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/findmyphone"), QStringLiteral("org.kde.kdeconnect.device.findmyphone"), QStringLiteral("ring"));
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} else if(parser.isSet(QStringLiteral("photo"))) {
if (parser.positionalArguments().size() == 1) {
const QString fileName = parser.positionalArguments()[0];
const QString fileName = parser.value(QStringLiteral("photo"));
if (!fileName.isEmpty()) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/photo"), QStringLiteral("org.kde.kdeconnect.device.photo"), QStringLiteral("requestPhoto"));
msg.setArguments({fileName});
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} else {
QTextStream(stderr) << i18n("Please give exactly 1 file name") << endl;
QTextStream(stderr) << i18n("Please specify a filename for the photo") << endl;
}
} else if(parser.isSet(QStringLiteral("send-keys"))) {
QString seq = parser.value(QStringLiteral("send-keys"));
......
......@@ -26,7 +26,7 @@ _arguments \
'--execute-command[execute a remote command]:command id' \
'(-k --send-keys)'{-k,--send-keys}'[send keys to the specified device]' \
"--my-id[display this device's id]" \
"--photo[open the connected device's camera and transfer the photo]" \
"--photo[open the connected device's camera and transfer the photo]:file:_files" \
'(-)'{-h,--help}'[display usage information]' \
'(-)'{-v,--version}'[display version information]' \
'(-)--author[show author information and exit]' \
......
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