Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[connectionagent] fix connecting after flight mode work better.
also supress the connection dialog for 5 minutes after
flight mode.
This is because often a request will come through
immediately after turning on flight mode.

[connectionagent] bump version to 0.8.6

fix flight mode suppression
  • Loading branch information
Lorn Potter committed Oct 22, 2013
1 parent 1c8e1da commit 36acddf
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 12 deletions.
34 changes: 26 additions & 8 deletions connd/qconnectionmanager.cpp
Expand Up @@ -56,13 +56,14 @@ QConnectionManager::QConnectionManager(QObject *parent) :
currentNetworkState(QString()),
currentType(QString()),
currentNotification(0),
askForRoaming(0),
isEthernet(0),
connmanAvailable(0),
handoverInProgress(0),
askForRoaming(false),
isEthernet(false),
connmanAvailable(false),
handoverInProgress(false),
oContext(0),
tetheringWifiTech(0),
tetheringEnabled(0)
tetheringEnabled(false),
flightModeSuppression(false)
{
qDebug() << Q_FUNC_INFO;
connect(netman,SIGNAL(availabilityChanged(bool)),this,SLOT(connmanAvailabilityChanged(bool)));
Expand Down Expand Up @@ -96,6 +97,7 @@ QConnectionManager::QConnectionManager(QObject *parent) :
connect(netman,SIGNAL(servicesListChanged(QStringList)),this,SLOT(servicesListChanged(QStringList)));
connect(netman,SIGNAL(stateChanged(QString)),this,SLOT(networkStateChanged(QString)));
connect(netman,SIGNAL(servicesChanged()),this,SLOT(setup()));
connect(netman,SIGNAL(offlineModeChanged(bool)),this,SLOT(offlineModeChanged(bool)));

QFile connmanConf("/etc/connman/main.conf");
if (connmanConf.open(QIODevice::ReadOnly | QIODevice::Text)) {
Expand Down Expand Up @@ -161,8 +163,8 @@ void QConnectionManager::onConnectionRequest()
{
sendConnectReply("Suppress", 15);
bool ok = autoConnect();
qDebug() << serviceInProgress <<ok;
if (!ok && serviceInProgress.isEmpty()) {
qDebug() << serviceInProgress << ok << flightModeSuppression;
if (!ok && serviceInProgress.isEmpty() && !flightModeSuppression) {
Q_EMIT connectionRequest();
}
}
Expand Down Expand Up @@ -269,7 +271,7 @@ bool QConnectionManager::autoConnect()
<< netman->state()
<< tetheringEnabled;

if (tetheringEnabled || !serviceInProgress.isEmpty())
if (tetheringEnabled || !serviceInProgress.isEmpty() || netman->offlineMode())
return false;

if (selectedService.isEmpty()) {
Expand Down Expand Up @@ -585,6 +587,7 @@ void QConnectionManager::setup()

connect(netman,SIGNAL(technologiesChanged()),this,SLOT(techChanged()));
updateServicesMap();
offlineModeChanged(netman->offlineMode());

if (isStateOnline(netman->state())) {
previousConnectedService = netman->defaultRoute()->path();
Expand Down Expand Up @@ -698,3 +701,18 @@ void QConnectionManager::techTetheringChanged(bool b)
qDebug() << b;
tetheringEnabled = b;
}

void QConnectionManager::offlineModeChanged(bool b)
{
flightModeSuppression = b;
if (b) {
previousConnectedService.clear();
QTimer::singleShot(5 * 1000 * 60,this,SLOT(flightModeDialogSuppressionTimeout())); //5 minutes
}
}

void QConnectionManager::flightModeDialogSuppressionTimeout()
{
if (flightModeSuppression)
flightModeSuppression = false;
}
3 changes: 3 additions & 0 deletions connd/qconnectionmanager.h
Expand Up @@ -108,6 +108,7 @@ public Q_SLOTS:
QOfonoConnectionContext *oContext;
NetworkTechnology *tetheringWifiTech;
bool tetheringEnabled;
bool flightModeSuppression;

private slots:
void onScanFinished();
Expand Down Expand Up @@ -135,6 +136,8 @@ private slots:
void serviceRemoved(const QString &);
void serviceAdded(const QString &);
void servicesListChanged(const QStringList &);
void offlineModeChanged(bool);
void flightModeDialogSuppressionTimeout();
};

#endif // QCONNECTIONMANAGER_H
2 changes: 1 addition & 1 deletion rpm/connectionagent-qt5.spec
Expand Up @@ -9,7 +9,7 @@ Name: connectionagent-qt5
# << macros

Summary: User Agent daemon
Version: 0.8.5
Version: 0.8.6
Release: 0
Group: Communications/Connectivity Adaptation
License: LGPLv2
Expand Down
2 changes: 1 addition & 1 deletion rpm/connectionagent-qt5.yaml
@@ -1,6 +1,6 @@
Name: connectionagent-qt5
Summary: User Agent daemon
Version: 0.8.5
Version: 0.8.6
Release: 0
Group: "Communications/Connectivity Adaptation"
License: LGPLv2
Expand Down
2 changes: 1 addition & 1 deletion rpm/connectionagent.spec
Expand Up @@ -9,7 +9,7 @@ Name: connectionagent
# << macros

Summary: User Agent daemon
Version: 0.8.5
Version: 0.8.6
Release: 0
Group: Communications/Connectivity Adaptation
License: LGPLv2
Expand Down
2 changes: 1 addition & 1 deletion rpm/connectionagent.yaml
@@ -1,6 +1,6 @@
Name: connectionagent
Summary: User Agent daemon
Version: 0.8.5
Version: 0.8.6
Release: 0
Group: "Communications/Connectivity Adaptation"
License: LGPLv2
Expand Down

0 comments on commit 36acddf

Please sign in to comment.