summaryrefslogtreecommitdiffstats
path: root/tdecore/networkbackends
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-04 10:25:49 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-04 10:25:49 -0500
commitaaaec8b3f88a53ce2ec3b9295774523b6f2d8c82 (patch)
treefc7b5577502365de25a1b7031060b9661c3e5565 /tdecore/networkbackends
parentadea4c592cd28583a9a8cc24b9ec68bb118d874a (diff)
downloadtdelibs-aaaec8b3f88a53ce2ec3b9295774523b6f2d8c82.tar.gz
tdelibs-aaaec8b3f88a53ce2ec3b9295774523b6f2d8c82.zip
Add global networking state control
Diffstat (limited to 'tdecore/networkbackends')
-rw-r--r--tdecore/networkbackends/network-manager/network-manager.cpp24
-rw-r--r--tdecore/networkbackends/network-manager/network-manager.h1
2 files changed, 25 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();