summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@jollamobile.com>2014-08-22 20:08:15 +1000
committerRobin Burchell <robin.burchell@viroteck.net>2014-08-23 16:35:12 +0200
commit38621713150b663355ebeb799a5a50d8e39a3c38 (patch)
treef6412ad223d14a5ae64c7f323d4fe4a04047ca44 /src
parent4a6772a587c8fe86f3f674a1d1164ad6659fbfca (diff)
remove always ask option.
Jolla removed the always ask option in the UI, which is the reason for all this code. Now, if mobile data is autoconnectable, whether roaming or home, it will be connected. Change-Id: I6a86315262e8c4c5551b2b2097389559096f14d5 Reviewed-by: Pasi Sjöholm <pasi.sjoholm@jolla.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/bearer/connman/connman.pro1
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp56
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.h5
3 files changed, 5 insertions, 57 deletions
diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro
index 0da2dfacf6..bc4efe8b62 100644
--- a/src/plugins/bearer/connman/connman.pro
+++ b/src/plugins/bearer/connman/connman.pro
@@ -6,7 +6,6 @@ load(qt_plugin)
QT = core network-private dbus
CONFIG += link_pkgconfig
-packagesExist(connectionagent) { DEFINES += QT_HAS_CONNECTIONAGENT }
HEADERS += qconnmanservice_linux_p.h \
qofonoservice_linux_p.h \
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index 797c30c7c6..ee219f00ac 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -54,11 +54,6 @@
#include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusMessage>
#include <QtDBus/QDBusReply>
-#ifdef QT_HAS_CONNECTIONAGENT
-#include <sys/inotify.h>
-#include <fcntl.h>
-#include <qcore_unix_p.h>
-#endif
#ifndef QT_NO_BEARERMANAGEMENT
#ifndef QT_NO_DBUS
@@ -78,9 +73,6 @@ QConnmanEngine::QConnmanEngine(QObject *parent)
QConnmanEngine::~QConnmanEngine()
{
-#ifdef QT_HAS_CONNECTIONAGENT
- qt_safe_close(inotifyFileDescriptor);
-#endif
}
bool QConnmanEngine::connmanAvailable() const
@@ -108,16 +100,6 @@ void QConnmanEngine::initialize()
addServiceConfiguration(servPath);
}
Q_EMIT updateCompleted();
-#ifdef QT_HAS_CONNECTIONAGENT
- QSettings confFile(QStringLiteral("nemomobile"),QStringLiteral("connectionagent"));
-
- inotifyFileDescriptor = ::inotify_init();
- inotifyWatcher = ::inotify_add_watch(inotifyFileDescriptor, QFile::encodeName(confFile.fileName()), IN_MODIFY);
- if (inotifyWatcher > 0) {
- QSocketNotifier *notifier = new QSocketNotifier(inotifyFileDescriptor, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), this, SLOT(inotifyActivated()));
- }
-#endif
}
void QConnmanEngine::changedModem()
@@ -257,12 +239,11 @@ QNetworkSession::State QConnmanEngine::sessionStateForId(const QString &id)
return QNetworkSession::Disconnected;
}
- if (servState == QLatin1String("association") || servState == QLatin1String("configuration")
- || servState == QLatin1String("ready")) {
+ if (servState == QLatin1String("association") || servState == QLatin1String("configuration")) {
return QNetworkSession::Connecting;
}
- if (servState == QLatin1String("online")) {
+ if (servState == QLatin1String("online") || servState == QLatin1String("ready")) {
return QNetworkSession::Connected;
}
@@ -402,9 +383,8 @@ QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QStri
if (serv->type() == QLatin1String("cellular")) {
- if (!serv->autoConnect()
- || (serv->roaming()
- && (isAlwaysAskRoaming() || !isRoamingAllowed(serv->path())))) {
+ if (!serv->autoConnect()|| (serv->roaming()
+ && !isRoamingAllowed(serv->path()))) {
flag = (flag | QNetworkConfiguration::Defined);
} else {
flag = (flag | QNetworkConfiguration::Discovered);
@@ -418,7 +398,7 @@ QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QStri
flag = QNetworkConfiguration::Undefined;
}
}
- if (state == QLatin1String("online")) {
+ if (state == QLatin1String("online") || state == QLatin1String("ready")) {
flag = (flag | QNetworkConfiguration::Active);
}
@@ -557,17 +537,6 @@ bool QConnmanEngine::requiresPolling() const
return false;
}
-bool QConnmanEngine::isAlwaysAskRoaming()
-{
-#ifdef QT_HAS_CONNECTIONAGENT
- QSettings confFile(QStringLiteral("nemomobile"),QStringLiteral("connectionagent"));
- confFile.beginGroup(QStringLiteral("Connectionagent"));
- return confFile.value(QStringLiteral("askForRoaming")).toBool();
-#else
- return false;
-#endif
-}
-
void QConnmanEngine::reEvaluateCellular()
{
Q_FOREACH (const QString &servicePath, connmanManager->getServices()) {
@@ -577,21 +546,6 @@ void QConnmanEngine::reEvaluateCellular()
}
}
-void QConnmanEngine::inotifyActivated()
-{
-#ifdef QT_HAS_CONNECTIONAGENT
-
- char buffer[1024];
- int len = qt_safe_read(inotifyFileDescriptor, (void *)buffer, sizeof(buffer));
- if (len > 0) {
- struct inotify_event *event = (struct inotify_event *)buffer;
- if (event->wd == inotifyWatcher && (event->mask & IN_MODIFY) == 0) {
- QTimer::singleShot(1000, this, SLOT(reEvaluateCellular())); //give this time to finish write
- }
- }
-#endif
-}
-
QT_END_NAMESPACE
#endif // QT_NO_DBUS
diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h
index 4a4e91659b..4d5495ae86 100644
--- a/src/plugins/bearer/connman/qconnmanengine.h
+++ b/src/plugins/bearer/connman/qconnmanengine.h
@@ -108,7 +108,6 @@ private Q_SLOTS:
void serviceStateChanged(const QString &state);
void configurationChange(QConnmanServiceInterface * service);
void reEvaluateCellular();
- void inotifyActivated();
private:
QConnmanManagerInterface *connmanManager;
@@ -134,12 +133,8 @@ private:
QNetworkConfiguration::BearerType ofonoTechToBearerType(const QString &type);
bool isRoamingAllowed(const QString &context);
- bool isAlwaysAskRoaming();
QMap <QString,QConnmanServiceInterface *> connmanServiceInterfaces;
- int inotifyWatcher;
- int inotifyFileDescriptor;
-
protected:
bool requiresPolling() const;
};