summaryrefslogtreecommitdiffstats
path: root/tdecore
diff options
context:
space:
mode:
Diffstat (limited to 'tdecore')
-rw-r--r--tdecore/networkbackends/network-manager/network-manager.cpp24
-rw-r--r--tdecore/networkbackends/network-manager/network-manager.h1
-rw-r--r--tdecore/tdenetworkconnections.cpp5
-rw-r--r--tdecore/tdenetworkconnections.h12
4 files changed, 42 insertions, 0 deletions
diff --git a/tdecore/networkbackends/network-manager/network-manager.cpp b/tdecore/networkbackends/network-manager/network-manager.cpp
index b68a8bdb8..3a303237b 100644
--- a/tdecore/networkbackends/network-manager/network-manager.cpp
+++ b/tdecore/networkbackends/network-manager/network-manager.cpp
@@ -4117,6 +4117,30 @@ bool TDENetworkConnectionManager_BackendNM::wiFiHardwareEnabled() {
}
}
+bool TDENetworkConnectionManager_BackendNM::enableNetworking(bool enable) {
+ // FIXME
+ // Yes, this abuses the Sleep command
+ // Is there a better way to do it?
+ if (d->m_networkManagerProxy) {
+ int asynccallid;
+ TQT_DBusError error;
+ d->m_networkManagerProxy->SleepAsync(asynccallid, !enable, error);
+ if (error.isValid()) {
+ // Error!
+ PRINT_ERROR(error.name())
+ return FALSE;
+ }
+ else {
+ // FIXME
+ // Wait for async reply before returning...
+ return TRUE;
+ }
+ }
+ else {
+ return FALSE;
+ }
+}
+
bool TDENetworkConnectionManager_BackendNM::enableWiFi(bool enable) {
if (d->m_networkManagerProxy) {
TQT_DBusError error;
diff --git a/tdecore/networkbackends/network-manager/network-manager.h b/tdecore/networkbackends/network-manager/network-manager.h
index 82e12696a..ef878bb00 100644
--- a/tdecore/networkbackends/network-manager/network-manager.h
+++ b/tdecore/networkbackends/network-manager/network-manager.h
@@ -143,6 +143,7 @@ class TDECORE_EXPORT TDENetworkConnectionManager_BackendNM : public TDENetworkCo
virtual bool networkingEnabled();
virtual bool wiFiHardwareEnabled();
+ virtual bool enableNetworking(bool enable);
virtual bool enableWiFi(bool enable);
virtual bool wiFiEnabled();
diff --git a/tdecore/tdenetworkconnections.cpp b/tdecore/tdenetworkconnections.cpp
index a02f72e64..96da418e7 100644
--- a/tdecore/tdenetworkconnections.cpp
+++ b/tdecore/tdenetworkconnections.cpp
@@ -729,6 +729,11 @@ bool TDEGlobalNetworkManager::networkingEnabled() {
return m_internalConnectionManager->networkingEnabled();
}
+bool TDEGlobalNetworkManager::enableNetworking(bool enable) {
+ if (!m_internalConnectionManager) return false;
+ return m_internalConnectionManager->enableNetworking(enable);
+}
+
bool TDEGlobalNetworkManager::wiFiHardwareEnabled() {
if (!m_internalConnectionManager) return false;
return m_internalConnectionManager->wiFiHardwareEnabled();
diff --git a/tdecore/tdenetworkconnections.h b/tdecore/tdenetworkconnections.h
index ca20f613c..e13484262 100644
--- a/tdecore/tdenetworkconnections.h
+++ b/tdecore/tdenetworkconnections.h
@@ -994,6 +994,12 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
virtual bool networkingEnabled() = 0;
/**
+ * @param enable true to enable networking, false to disable it.
+ * @return true on success, false on failure.
+ */
+ virtual bool enableNetworking(bool enable) = 0;
+
+ /**
* @return true if WiFi hardware is enabled, false if not.
*/
virtual bool wiFiHardwareEnabled() = 0;
@@ -1148,6 +1154,12 @@ class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject
virtual bool networkingEnabled();
/**
+ * @param enable true to enable networking, false to disable it.
+ * @return true on success, false on failure.
+ */
+ virtual bool enableNetworking(bool enable);
+
+ /**
* @return true if WiFi hardware is enabled, false if not.
*/
virtual bool wiFiHardwareEnabled();