summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/bearer/networkmanager/main.cpp13
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp8
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.h2
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp3
4 files changed, 20 insertions, 6 deletions
diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp
index f62b847..6c97a22 100644
--- a/src/plugins/bearer/networkmanager/main.cpp
+++ b/src/plugins/bearer/networkmanager/main.cpp
@@ -72,10 +72,15 @@ QStringList QNetworkManagerEnginePlugin::keys() const
QBearerEngine *QNetworkManagerEnginePlugin::create(const QString &key) const
{
- if (key == QLatin1String("networkmanager"))
- return new QNetworkManagerEngine;
- else
- return 0;
+ if (key == QLatin1String("networkmanager")) {
+ QNetworkManagerEngine *engine = new QNetworkManagerEngine;
+ if (engine->networkManagerAvailable())
+ return engine;
+ else
+ delete engine;
+ }
+
+ return 0;
}
Q_EXPORT_STATIC_PLUGIN(QNetworkManagerEnginePlugin)
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 3f3e1bd..4c8928c 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -65,6 +65,9 @@ QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent)
systemSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_SYSTEM_SETTINGS, this)),
userSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_USER_SETTINGS, this))
{
+ if (!interface->isValid())
+ return;
+
interface->setConnections();
connect(interface, SIGNAL(deviceAdded(QDBusObjectPath)),
this, SLOT(deviceAdded(QDBusObjectPath)));
@@ -115,6 +118,11 @@ QNetworkManagerEngine::~QNetworkManagerEngine()
{
}
+bool QNetworkManagerEngine::networkManagerAvailable() const
+{
+ return interface->isValid();
+}
+
void QNetworkManagerEngine::doRequestUpdate()
{
emit updateCompleted();
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
index 70efc05..ca1f857 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
@@ -70,6 +70,8 @@ public:
QNetworkManagerEngine(QObject *parent = 0);
~QNetworkManagerEngine();
+ bool networkManagerAvailable() const;
+
QString getInterfaceFromId(const QString &id);
bool hasIdentifier(const QString &id);
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
index 7617e94..5dc0ea4 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
@@ -78,7 +78,6 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
NM_DBUS_INTERFACE,
dbusConnection);
if (!d->connectionInterface->isValid()) {
- qWarning() << "Could not find NetworkManager";
d->valid = false;
return;
}
@@ -321,7 +320,7 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de
dbusConnection);
if (!d->connectionInterface->isValid()) {
d->valid = false;
- qWarning() << "Could not find NetworkManager";
+ qWarning() << "Could not find NetworkManagerInterfaceDevice";
return;
}
d->valid = true;