Unmanaged devices cannot be controlled by TDENetworkManager. This refers to bug 2929.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit de38d1a24d)
r14.0.x
Michele Calgaro 5 years ago
parent 5857ec61c7
commit 74620b9569
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -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();
}

@ -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 )

@ -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));

Loading…
Cancel
Save