|
|
|
@ -291,7 +291,6 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
if (!conn) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Disconnected)
|
|
|
|
|
|| (nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Invalid)) {
|
|
|
|
|
continue;
|
|
|
|
@ -324,10 +323,10 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
// offline vs. online mode
|
|
|
|
|
KAction* switch_mode = NULL;
|
|
|
|
|
if (nm->backendStatus() & TDENetworkGlobalManagerFlags::Sleeping) {
|
|
|
|
|
switch_mode = actionCollection ()->action ("offline_mode");
|
|
|
|
|
switch_mode = actionCollection ()->action ("online_mode");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
switch_mode = actionCollection ()->action ("online_mode");
|
|
|
|
|
switch_mode = actionCollection ()->action ("offline_mode");
|
|
|
|
|
}
|
|
|
|
|
disableStuffActionMenu->insert(switch_mode);
|
|
|
|
|
|
|
|
|
@ -373,6 +372,8 @@ Tray::slotStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlag
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("NM state: %d\n\r", nm_state);
|
|
|
|
|
|
|
|
|
|
showActiveDeviceTray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
@ -541,6 +542,9 @@ void Tray::updateDeviceTrays()
|
|
|
|
|
|
|
|
|
|
// add the VPN componenet as it is not associated with a device
|
|
|
|
|
createVPNTrayComponent();
|
|
|
|
|
|
|
|
|
|
// show an active device if one is present
|
|
|
|
|
showActiveDeviceTray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Tray::mousePressEvent( TQMouseEvent *e )
|
|
|
|
@ -670,6 +674,51 @@ void Tray::trayUiChanged()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Tray::showActiveDeviceTray() {
|
|
|
|
|
// If the current foreground tray device is deactivated, find the first active device and use it instead
|
|
|
|
|
bool needsNewDeviceTrayComponent = true;
|
|
|
|
|
if (d->foregroundTrayComponent) {
|
|
|
|
|
TDENetworkDevice* dtc_comp_dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(d->foregroundTrayComponent->device()));
|
|
|
|
|
TDENetworkConnectionManager* deviceConnMan = dtc_comp_dev->connectionManager();
|
|
|
|
|
TDENetworkConnectionStatus::TDENetworkConnectionStatus statusFlags = deviceConnMan->deviceInformation().statusFlags;
|
|
|
|
|
if ((statusFlags & TDENetworkConnectionStatus::Invalid) ||
|
|
|
|
|
(statusFlags & TDENetworkConnectionStatus::Disconnected)
|
|
|
|
|
) {
|
|
|
|
|
needsNewDeviceTrayComponent = true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
needsNewDeviceTrayComponent = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (needsNewDeviceTrayComponent) {
|
|
|
|
|
disconnectTrayDeviceManager();
|
|
|
|
|
|
|
|
|
|
for (TQValueList<TrayComponent*>::Iterator it = d->trayComponents.begin(); it != d->trayComponents.end(); ++it) {
|
|
|
|
|
DeviceTrayComponent* newDtc = dynamic_cast<DeviceTrayComponent*> (*it);
|
|
|
|
|
if (newDtc) {
|
|
|
|
|
TDENetworkDevice* dtc_comp_dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(newDtc->device()));
|
|
|
|
|
TDENetworkConnectionManager* deviceConnMan = dtc_comp_dev->connectionManager();
|
|
|
|
|
TDENetworkConnectionStatus::TDENetworkConnectionStatus statusFlags = deviceConnMan->deviceInformation().statusFlags;
|
|
|
|
|
if ((statusFlags & TDENetworkConnectionStatus::Invalid) ||
|
|
|
|
|
(statusFlags & TDENetworkConnectionStatus::Disconnected)
|
|
|
|
|
) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
d->foregroundTrayComponent = newDtc;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connectTrayDeviceManager();
|
|
|
|
|
updateTrayDeviceManagerState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trayUiChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus state)
|
|
|
|
|
{
|
|
|
|
|
// Get all active connections
|
|
|
|
@ -701,6 +750,8 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nm->loadConnectionInformation();
|
|
|
|
|
|
|
|
|
|
found_any_active_connection = 0;
|
|
|
|
|
// Get all active connections
|
|
|
|
|
allconmap = nm->connections();
|
|
|
|
|