Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[connectionagent] Tweak connection dialog behavior
Silently fail the request if no services of the requested type is found.
  • Loading branch information
monich committed Oct 10, 2014
1 parent fd5262e commit 3dee803
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions connd/qconnectionagent.cpp
Expand Up @@ -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";
Expand All @@ -317,28 +318,31 @@ 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;
}
}
}

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);
}
Expand Down

0 comments on commit 3dee803

Please sign in to comment.