|
|
@ -291,7 +291,6 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
if (!conn) {
|
|
|
|
if (!conn) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Disconnected)
|
|
|
|
if ((nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Disconnected)
|
|
|
|
|| (nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Invalid)) {
|
|
|
|
|| (nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Invalid)) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
@ -324,10 +323,10 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
// offline vs. online mode
|
|
|
|
// offline vs. online mode
|
|
|
|
KAction* switch_mode = NULL;
|
|
|
|
KAction* switch_mode = NULL;
|
|
|
|
if (nm->backendStatus() & TDENetworkGlobalManagerFlags::Sleeping) {
|
|
|
|
if (nm->backendStatus() & TDENetworkGlobalManagerFlags::Sleeping) {
|
|
|
|
switch_mode = actionCollection ()->action ("offline_mode");
|
|
|
|
switch_mode = actionCollection ()->action ("online_mode");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
switch_mode = actionCollection ()->action ("online_mode");
|
|
|
|
switch_mode = actionCollection ()->action ("offline_mode");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
disableStuffActionMenu->insert(switch_mode);
|
|
|
|
disableStuffActionMenu->insert(switch_mode);
|
|
|
|
|
|
|
|
|
|
|
@ -373,6 +372,8 @@ Tray::slotStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlag
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
printf("NM state: %d\n\r", nm_state);
|
|
|
|
printf("NM state: %d\n\r", nm_state);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showActiveDeviceTray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
@ -541,6 +542,9 @@ void Tray::updateDeviceTrays()
|
|
|
|
|
|
|
|
|
|
|
|
// add the VPN componenet as it is not associated with a device
|
|
|
|
// add the VPN componenet as it is not associated with a device
|
|
|
|
createVPNTrayComponent();
|
|
|
|
createVPNTrayComponent();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// show an active device if one is present
|
|
|
|
|
|
|
|
showActiveDeviceTray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Tray::mousePressEvent( TQMouseEvent *e )
|
|
|
|
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)
|
|
|
|
void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus state)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Get all active connections
|
|
|
|
// Get all active connections
|
|
|
@ -701,6 +750,8 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nm->loadConnectionInformation();
|
|
|
|
|
|
|
|
|
|
|
|
found_any_active_connection = 0;
|
|
|
|
found_any_active_connection = 0;
|
|
|
|
// Get all active connections
|
|
|
|
// Get all active connections
|
|
|
|
allconmap = nm->connections();
|
|
|
|
allconmap = nm->connections();
|
|
|
|