Commit c267e6e6 authored by Marco Martin's avatar Marco Martin

support call://number as paramenter

parent af40bd64
......@@ -18,3 +18,4 @@ Exec=plasmaphonedialer
X-Plasma-MainScript=ui/main.qml
X-Plasma-RemoteLocation=
MimeType=x-scheme-handler/call
......@@ -57,11 +57,9 @@ int main(int argc, char **argv)
QCommandLineOption daemonOption(QStringList() << QStringLiteral("d") <<
QStringLiteral("daemon"),
i18n("Daemon mode. run without displaying anything."));
QCommandLineOption dialOption(QStringList() << QStringLiteral("c") << QStringLiteral("call"),
i18n("Call the given number"),
QStringLiteral("number"));
parser.addOption(dialOption);
parser.addPositionalArgument("number", i18n("Call the given number"));
parser.addOption(daemonOption);
parser.process(app);
......@@ -109,9 +107,13 @@ int main(int argc, char **argv)
window->setTitle(obj->package().metadata().name());
window->setIcon(QIcon::fromTheme(obj->package().metadata().iconName()));
if (parser.isSet(dialOption)) {
qWarning() << "Calling" << parser.value(dialOption);
obj->rootObject()->metaObject()->invokeMethod(obj->rootObject(), "call", Q_ARG(QVariant, parser.value(dialOption)));
if (!parser.positionalArguments().isEmpty()) {
QString numberArg = parser.positionalArguments().first();
if (numberArg.startsWith("call://")) {
numberArg = numberArg.mid(7);
}
qWarning() << "Calling" << numberArg;
obj->rootObject()->metaObject()->invokeMethod(obj->rootObject(), "call", Q_ARG(QVariant, numberArg));
}
} else {
qWarning() << "Error loading the ApplicationWindow";
......
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