|
|
|
@ -297,8 +297,11 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
|
|
|
|
|
if (!conn) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if ((nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Disconnected)
|
|
|
|
|
|| (nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Invalid)) {
|
|
|
|
|
TDENetworkConnectionStatus::TDENetworkConnectionStatus status = nm->checkConnectionStatus(conn->UUID);
|
|
|
|
|
if ((status == TDENetworkConnectionStatus::Disconnected)
|
|
|
|
|
|| (status == (TDENetworkConnectionStatus::Disconnected | TDENetworkConnectionStatus::LinkUnavailable))
|
|
|
|
|
|| (status & TDENetworkConnectionStatus::Invalid)
|
|
|
|
|
) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -377,7 +380,7 @@ Tray::slotStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlag
|
|
|
|
|
setPixmap (loadIcon ("tdenetworkmanager"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("NM state: %d\n\r", nm_state);
|
|
|
|
|
printf("NM state: 0x%08x\n\r", nm_state);
|
|
|
|
|
|
|
|
|
|
showActiveDeviceTray();
|
|
|
|
|
}
|
|
|
|
@ -613,7 +616,6 @@ void Tray::updateTrayDeviceManagerState() {
|
|
|
|
|
TDENetworkConnectionManager* deviceConnMan = foreground_tray_dev->connectionManager();
|
|
|
|
|
if (deviceConnMan) {
|
|
|
|
|
slotUpdateDeviceState(deviceConnMan->deviceInformation().statusFlags, TDENetworkConnectionStatus::Invalid, TQString());
|
|
|
|
|
slotUpdateDeviceState(deviceConnMan->deviceInformation().statusFlags, TDENetworkConnectionStatus::Invalid, TQString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -637,6 +639,7 @@ void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt)
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
disconnectTrayDeviceManager();
|
|
|
|
|
d->foregroundTrayComponent = NULL;
|
|
|
|
|
|
|
|
|
|
// use active default
|
|
|
|
|
TQStringList defaultDevices = nm->defaultNetworkDevices();
|
|
|
|
@ -650,8 +653,10 @@ void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
kdDebug() << " Device " << dtc_comp_dev->deviceNode() << " background, new foreground device: " << device->deviceNode() << endl;
|
|
|
|
|
connectTrayDeviceManager();
|
|
|
|
|
updateTrayDeviceManagerState();
|
|
|
|
|
if (d->foregroundTrayComponent) {
|
|
|
|
|
connectTrayDeviceManager();
|
|
|
|
|
updateTrayDeviceManagerState();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -664,7 +669,7 @@ void Tray::slotUpdateDeviceState()
|
|
|
|
|
|
|
|
|
|
void Tray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus prevState, TQString hwAddress)
|
|
|
|
|
{
|
|
|
|
|
printf("Device state: %d\n\r", newState);
|
|
|
|
|
printf("Device state: 0x%08x\n\r", newState);
|
|
|
|
|
|
|
|
|
|
updateTrayIcon(newState);
|
|
|
|
|
updateActiveConnection(newState);
|
|
|
|
@ -687,8 +692,9 @@ void Tray::showActiveDeviceTray() {
|
|
|
|
|
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)
|
|
|
|
|
if ((statusFlags == TDENetworkConnectionStatus::Disconnected)
|
|
|
|
|
|| (statusFlags == (TDENetworkConnectionStatus::Disconnected | TDENetworkConnectionStatus::LinkUnavailable))
|
|
|
|
|
|| (statusFlags & TDENetworkConnectionStatus::Invalid)
|
|
|
|
|
) {
|
|
|
|
|
needsNewDeviceTrayComponent = true;
|
|
|
|
|
}
|
|
|
|
@ -700,14 +706,17 @@ void Tray::showActiveDeviceTray() {
|
|
|
|
|
if (needsNewDeviceTrayComponent) {
|
|
|
|
|
disconnectTrayDeviceManager();
|
|
|
|
|
|
|
|
|
|
d->foregroundTrayComponent = NULL;
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
if ((statusFlags == TDENetworkConnectionStatus::Disconnected)
|
|
|
|
|
|| (statusFlags == (TDENetworkConnectionStatus::Disconnected | TDENetworkConnectionStatus::LinkUnavailable))
|
|
|
|
|
|| (statusFlags & TDENetworkConnectionStatus::Invalid)
|
|
|
|
|
) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -718,8 +727,10 @@ void Tray::showActiveDeviceTray() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connectTrayDeviceManager();
|
|
|
|
|
updateTrayDeviceManagerState();
|
|
|
|
|
if (d->foregroundTrayComponent != NULL) {
|
|
|
|
|
connectTrayDeviceManager();
|
|
|
|
|
updateTrayDeviceManagerState();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trayUiChanged();
|
|
|
|
@ -736,6 +747,17 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus
|
|
|
|
|
|
|
|
|
|
if (tdenetworkmanager_editor_dialog_count == 0) nm->loadConnectionInformation();
|
|
|
|
|
|
|
|
|
|
// Make sure the current state will be displayed
|
|
|
|
|
if (d->foregroundTrayComponent) {
|
|
|
|
|
TDENetworkDevice* foreground_tray_dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(d->foregroundTrayComponent->device()));
|
|
|
|
|
if (foreground_tray_dev) {
|
|
|
|
|
TDENetworkConnectionManager* deviceConnMan = foreground_tray_dev->connectionManager();
|
|
|
|
|
if (deviceConnMan) {
|
|
|
|
|
state = deviceConnMan->deviceInformation().statusFlags;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get all available VPN Connections
|
|
|
|
|
active_vpn = 0;
|
|
|
|
|
allconmap = nm->connections();
|
|
|
|
@ -768,8 +790,11 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Disconnected)
|
|
|
|
|
|| (nm->checkConnectionStatus(conn->UUID) & TDENetworkConnectionStatus::Invalid)) {
|
|
|
|
|
TDENetworkConnectionStatus::TDENetworkConnectionStatus status = nm->checkConnectionStatus(conn->UUID);
|
|
|
|
|
if ((status == TDENetworkConnectionStatus::Disconnected)
|
|
|
|
|
|| (status == (TDENetworkConnectionStatus::Disconnected | TDENetworkConnectionStatus::LinkUnavailable))
|
|
|
|
|
|| (status & TDENetworkConnectionStatus::Invalid)
|
|
|
|
|
) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -827,7 +852,7 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags current_vpn_state = (KGlobal::networkManager()->backendStatus() & TDENetworkGlobalManagerFlags::VPNMask);
|
|
|
|
|
printf("VPN state: %d\n\r", current_vpn_state);
|
|
|
|
|
printf("VPN state: 0x%08x\n\r", current_vpn_state);
|
|
|
|
|
//printf("Activated is: %d\n\r", TDENetworkConnectionStatus::Connected);
|
|
|
|
|
// stop the old movie to avoid unnecessary wakups
|
|
|
|
|
DeviceTrayComponent * dtc = d->foregroundTrayComponent;
|
|
|
|
@ -868,7 +893,7 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nm_device_state_global = state;
|
|
|
|
|
//printf("Device state: %d\n\r", nm_device_state_global);
|
|
|
|
|
//printf("Device state: 0x%08x\n\r", nm_device_state_global);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Tray::updateActiveConnection(TDENetworkConnectionStatus::TDENetworkConnectionStatus state)
|
|
|
|
@ -1011,6 +1036,11 @@ Tray::Tray() : KSystemTray()
|
|
|
|
|
connect(KGlobal::networkManager(), TQT_SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, TQT_SLOT(slotStateChangedNotify(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)));
|
|
|
|
|
connect(KGlobal::networkManager(), TQT_SIGNAL(vpnEvent(TDENetworkVPNEventType::TDENetworkVPNEventType, TQString)), this, TQT_SLOT(slotVPNEventHandler(TDENetworkVPNEventType::TDENetworkVPNEventType, TQString)));
|
|
|
|
|
|
|
|
|
|
// Get connection list
|
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
|
if (nm) {
|
|
|
|
|
if (tdenetworkmanager_editor_dialog_count == 0) nm->loadConnectionInformation();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// initial setup of the device-trays
|
|
|
|
|
updateDeviceTrays();
|
|
|
|
|