summaryrefslogtreecommitdiffstats
path: root/tdenetworkmanager
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2020-02-22 21:34:13 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2020-02-22 21:34:13 +0900
commitde38d1a24d766f231642aff903ae3856bc707256 (patch)
treebf1ddd8643b21ec268098a72d1997d03cce777e3 /tdenetworkmanager
parenta2dede9fe65e96ce38a6bc379079c95664c25cf3 (diff)
downloadtdenetworkmanager-de38d1a24d766f231642aff903ae3856bc707256.tar.gz
tdenetworkmanager-de38d1a24d766f231642aff903ae3856bc707256.zip
Unmanaged devices cannot be controlled by TDENetworkManager. This refers to bug 2929.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'tdenetworkmanager')
-rw-r--r--tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp59
-rw-r--r--tdenetworkmanager/src/tdenetman-wired_device_tray.cpp13
-rw-r--r--tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp11
3 files changed, 46 insertions, 37 deletions
diff --git a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp
index 2998228..d62b79f 100644
--- a/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp
+++ b/tdenetworkmanager/src/tdenetman-cellular_device_tray.cpp
@@ -80,42 +80,47 @@ void CellularDeviceTray::addMenuItems(TDEPopupMenu* menu)
Subhead* subhead = new Subhead (menu, "subhead", dev->deviceNode(), SmallIcon("nm_device_wwan", TQIconSet::Automatic));
menu->insertItem (subhead, -1, -1);
- //menu->insertSeparator();
- TDEGlobalNetworkManager* nm = TDEGlobal::networkManager();
TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
- TDENetworkConnection* active_conn = NULL;
- if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected))
- && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) {
- active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID);
+ if (!deviceConnMan->deviceInformation().managed) {
+ // device is not managed by NM -> do not show any connections
+ subhead = new Subhead(menu, "subhead2", i18n("Not managed"), SmallIcon("no", TQIconSet::Automatic));
+ menu->insertItem(subhead, -1, -1);
}
+ else {
+ TDEGlobalNetworkManager* nm = TDEGlobal::networkManager();
+ TDENetworkConnection* active_conn = NULL;
+ if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected))
+ && (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) {
+ active_conn = nm->findConnectionByUUID(deviceConnMan->deviceInformation().activeConnectionUUID);
+ }
- // get all available Connections for cellular devices
+ // get all available Connections for cellular devices
- TDENetworkConnectionList* allconmap = nm->connections();
- for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) {
- TDEModemConnection* conn = dynamic_cast<TDEModemConnection*>(*it);
- if (!conn) {
- continue;
- }
+ TDENetworkConnectionList* allconmap = nm->connections();
+ for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) {
+ TDEModemConnection* conn = dynamic_cast<TDEModemConnection*>(*it);
+ if (!conn) {
+ continue;
+ }
- // lets create a nice name for this connection
- TQString title = conn->friendlyName;
- if (conn->ipConfig.valid) {
- title += TQString(" (%1)").arg((conn->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP) ? i18n("DHCP") : i18n("Manual IP config"));
- }
+ // lets create a nice name for this connection
+ TQString title = conn->friendlyName;
+ if (conn->ipConfig.valid) {
+ title += TQString(" (%1)").arg((conn->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP) ? i18n("DHCP") : i18n("Manual IP config"));
+ }
- NetworkMenuItem* item = new NetworkMenuItem(d->dev, conn->UUID, TQT_TQOBJECT(menu));
+ NetworkMenuItem* item = new NetworkMenuItem(d->dev, conn->UUID, TQT_TQOBJECT(menu));
- int id = menu->insertItem(title, item, TQT_SLOT(slotActivate()));
- menu->setItemChecked(id, ((*it) == active_conn));
- }
+ int id = menu->insertItem(title, item, TQT_SLOT(slotActivate()));
+ menu->setItemChecked(id, ((*it) == active_conn));
+ }
- // bring the device down
- TDEAction* deactivate = tray()->actionCollection()->action("deactivate_device");
- if (deactivate) {
- deactivate->plug(menu);
+ // bring the device down
+ TDEAction* deactivate = tray()->actionCollection()->action("deactivate_device");
+ if (deactivate) {
+ deactivate->plug(menu);
+ }
}
-
menu->insertSeparator();
}
diff --git a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp
index e59b173..3527f92 100644
--- a/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp
+++ b/tdenetworkmanager/src/tdenetman-wired_device_tray.cpp
@@ -80,18 +80,19 @@ void WiredDeviceTray::addMenuItems(TDEPopupMenu* menu)
Subhead* subhead = new Subhead (menu, "subhead", TQString("Wired Connection (%1)").arg(dev->deviceNode()), SmallIcon("wired", TQIconSet::Automatic));
menu->insertItem (subhead, -1, -1);
- // bolding subhead instead
- //menu->insertSeparator();
-
TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
- if (deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::LinkUnavailable) {
+ if (!deviceConnMan->deviceInformation().managed) {
+ // device is not managed by NM -> do not show any connections
+ subhead = new Subhead(menu, "subhead2", i18n("Not managed"), SmallIcon("no", TQIconSet::Automatic));
+ menu->insertItem(subhead, -1, -1);
+ }
+ else if (deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::LinkUnavailable) {
// no carrier -> do not show any connections
subhead = new Subhead(menu, "subhead2", i18n("Cable disconnected"), SmallIcon("no", TQIconSet::Automatic));
menu->insertItem(subhead, -1, -1);
}
else {
TDEGlobalNetworkManager* nm = TDEGlobal::networkManager();
- TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
TDENetworkConnection* active_conn = NULL;
if ((!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Disconnected))
&& (!(deviceConnMan->deviceInformation().statusFlags & TDENetworkConnectionStatus::Invalid))) {
@@ -131,8 +132,8 @@ void WiredDeviceTray::addMenuItems(TDEPopupMenu* menu)
if (deactivate) {
deactivate->plug(menu);
}
-
}
+ menu->insertSeparator();
}
WiredDeviceTray::WiredDeviceTray (TQString dev, KSystemTray * parent, const char * name )
diff --git a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp
index ce2921c..2d4eccb 100644
--- a/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp
+++ b/tdenetworkmanager/src/tdenetman-wireless_device_tray.cpp
@@ -266,10 +266,13 @@ void WirelessDeviceTray::addMenuItems(TDEPopupMenu* menu)
Subhead* subhead = new Subhead (menu, "subhead", TQString("Wireless Connection (%1)").arg(dev->deviceNode()), SmallIcon("wireless", TQIconSet::Automatic));
menu->insertItem (subhead, -1, -1);
- // bolding subhead instead
- //menu->insertSeparator();
-
- if (!nm->wiFiEnabled())
+ TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
+ if (!deviceConnMan->deviceInformation().managed) {
+ // device is not managed by NM -> do not show any connections
+ subhead = new Subhead(menu, "subhead2", i18n("Not managed"), SmallIcon("no", TQIconSet::Automatic));
+ menu->insertItem(subhead, -1, -1);
+ }
+ else if (!nm->wiFiEnabled())
{
// wireless disabled -> do not show any connections
subhead = new Subhead(menu, "subhead2", i18n("Wireless disabled"), SmallIcon("no", TQIconSet::Automatic));