Commit 91089ee4 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Revert the NetworkManager online detection feature

Turns out the 'connectivity' detection (i.e. whether we are behind a
captive portal) does not always work reliably, making resources to
stay offline sometimes even when full connectivity is available.

This feature never reached any stable release.

Revert "Make NMQT dependency optional"
This reverts commit a5adf445.

Revert "Fix "Session destroyed while still in pool" assertions"
This reverts commit e48a4dac.

Revert "Enable NetworkManager support conditionally"
This reverts commit ca3a5f33.

Revert "Use NetworkManager to detect online status"
This reverts commit 0158097a.
parent e536c713
......@@ -62,10 +62,6 @@ find_package(KF5WindowSystem ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5XmlGui ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Crash ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5NetworkManagerQt ${KF5_VERSION} CONFIG)
set_package_properties(KF5NetworkManagerQt PROPERTIES TYPE OPTIONAL)
set(HAVE_NMQT ${KF5NetworkManagerQt_FOUND})
find_package(Qt5Designer NO_MODULE)
set_package_properties(Qt5Designer PROPERTIES
PURPOSE "Required to build the Qt Designer plugins"
......
......@@ -3,5 +3,3 @@
#cmakedefine HAVE_MALLOC_TRIM 1
#define AKONADI_DATABASE_BACKEND "@AKONADI_DATABASE_BACKEND@"
#cmakedefine HAVE_NMQT 1
......@@ -63,13 +63,6 @@ PRIVATE
Qt5::Network
)
if (HAVE_NMQT)
target_link_libraries(KF5AkonadiAgentBase
PRIVATE
KF5::NetworkManagerQt
)
endif()
set_target_properties(KF5AkonadiAgentBase PROPERTIES
VERSION ${AKONADI_VERSION_STRING}
SOVERSION ${AKONADI_SOVERSION}
......
......@@ -23,7 +23,6 @@
#include "agentbase.h"
#include "agentbase_p.h"
#include "config-akonadi.h"
#include "akonadi_version.h"
#include "agentmanager.h"
#include "changerecorder.h"
......@@ -47,14 +46,10 @@
#include <QSettings>
#include <QTimer>
#include <QDBusConnection>
#include <QDBusConnectionInterface>
#include <QApplication>
#include <QCommandLineParser>
#include <QNetworkConfiguration>
#include <QNetworkConfigurationManager>
#ifdef HAVE_NMQT
#include <NetworkManagerQt/NetworkManagerQt/Manager>
#endif
#include <signal.h>
#include <stdlib.h>
......@@ -839,29 +834,10 @@ void AgentBasePrivate::slotNetworkStatusChange(bool isOnline)
q->setOnlineInternal(mDesiredOnlineState);
}
#ifdef HAVE_NMQT
void AgentBasePrivate::slotConnectivityChanged(NetworkManager::Connectivity connectivity)
{
Q_Q(AgentBase);
qCDebug(AKONADIAGENTBASE_LOG) << "NM Connectivity changed:" << connectivity;
if (connectivity == NetworkManager::Full) {
q->setOnlineInternal(mDesiredOnlineState);
} else {
q->setOnlineInternal(false);
}
}
#endif
void AgentBasePrivate::slotResumedFromSuspend()
{
if (mNeedsNetwork) {
if (mNetworkManager) {
slotNetworkStatusChange(mNetworkManager->isOnline());
} else {
#ifdef HAVE_NMQT
slotConnectivityChanged(NetworkManager::connectivity());
#endif
}
slotNetworkStatusChange(mNetworkManager->isOnline());
}
}
......@@ -1023,36 +999,15 @@ void AgentBase::setNeedsNetwork(bool needsNetwork)
d->mNeedsNetwork = needsNetwork;
if (d->mNeedsNetwork) {
#ifdef HAVE_NMQT
if (QDBusConnection::systemBus().interface()->isServiceRegistered(QStringLiteral("org.freedesktop.NetworkManager"))) {
connect(NetworkManager::notifier(), &NetworkManager::Notifier::connectivityChanged,
d, &AgentBasePrivate::slotConnectivityChanged, Qt::UniqueConnection);
if (d->mDesiredOnlineState && NetworkManager::connectivity() == NetworkManager::Full) {
setOnlineInternal(d->mDesiredOnlineState);
}
} else
#endif
{
d->mNetworkManager = new QNetworkConfigurationManager(this);
connect(d->mNetworkManager, SIGNAL(onlineStateChanged(bool)),
this, SLOT(slotNetworkStatusChange(bool)));
if (d->mDesiredOnlineState && d->mNetworkManager->isOnline()) {
setOnlineInternal(d->mDesiredOnlineState);
}
}
d->mNetworkManager = new QNetworkConfigurationManager(this);
connect(d->mNetworkManager, SIGNAL(onlineStateChanged(bool)),
this, SLOT(slotNetworkStatusChange(bool)),
Qt::UniqueConnection);
} else {
if (d->mNetworkManager) {
delete d->mNetworkManager;
d->mNetworkManager = nullptr;
}
#ifdef HAVE_NMQT
else {
disconnect(NetworkManager::notifier(), &NetworkManager::Notifier::connectivityChanged,
d, &AgentBasePrivate::slotConnectivityChanged);
}
#endif
delete d->mNetworkManager;
d->mNetworkManager = nullptr;
setOnlineInternal(d->mDesiredOnlineState);
}
}
......@@ -1089,11 +1044,7 @@ void AgentBase::setOnlineInternal(bool state)
{
Q_D(AgentBase);
if (state && d->mNeedsNetwork) {
if ((d->mNetworkManager && !d->mNetworkManager->isOnline())
#ifdef HAVE_NMQT
|| (!d->mNetworkManager && NetworkManager::connectivity() != NetworkManager::Full)
#endif
) {
if (!d->mNetworkManager->isOnline()) {
//Don't go online if the resource needs network but there is none
state = false;
}
......
......@@ -23,11 +23,6 @@
#include "agentbase.h"
#include "tracerinterface.h"
#include "config-akonadi.h"
#ifdef HAVE_NMQT
#include <NetworkManagerQt/Manager>
#endif
#include <klocalizedstring.h>
......@@ -59,9 +54,6 @@ public:
void slotNetworkStatusChange(bool isOnline);
void slotResumedFromSuspend();
void slotTemporaryOfflineTimeout();
#ifdef HAVE_NMQT
void slotConnectivityChanged(NetworkManager::Connectivity connectivity);
#endif
virtual void changeProcessed();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment