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