From 3dee8034d2565400b8f14c2ac7e6371e422770ef Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Fri, 10 Oct 2014 15:25:05 +0300 Subject: [PATCH] [connectionagent] Tweak connection dialog behavior Silently fail the request if no services of the requested type is found. --- connd/qconnectionagent.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/connd/qconnectionagent.cpp b/connd/qconnectionagent.cpp index 3cee542..edd5af8 100644 --- a/connd/qconnectionagent.cpp +++ b/connd/qconnectionagent.cpp @@ -308,6 +308,7 @@ void QConnectionAgent::connectToType(const QString &type) return; } + // Connman is using "cellular" and "wifi" as part of the service path QString convType; if (type.contains("mobile")) { convType="cellular"; @@ -317,16 +318,17 @@ void QConnectionAgent::connectToType(const QString &type) convType=type; } + bool found = false; Q_FOREACH (Service elem, orderedServicesList) { - if (elem.path.contains(type)) { + if (elem.path.contains(convType)) { if (!isStateOnline(elem.service->state())) { if (elem.service->autoConnect()) { qDebug() << "<<<<<<<<<<< requestConnect() >>>>>>>>>>>>"; elem.service->requestConnect(); return; - } else if (elem.path.contains("cellular")) { - // do not continue if cellular is not autoconnect - return; + } else if (!elem.path.contains("cellular")) { + // ignore cellular that are not on autoconnect + found = true; } } else { return; @@ -334,11 +336,13 @@ void QConnectionAgent::connectToType(const QString &type) } } - if (type.contains("cellular")) { - convType="mobile"; - } else if (type.contains("wifi")) { + // Can't connect to the service of a type that doesn't exist + if (!found) + return; + + // Substitute "wifi" with "wlan" for lipstick + if (type.contains("wifi")) convType="wlan"; - } Q_EMIT configurationNeeded(convType); }