Show VPN status information

pull/1/head
Timothy Pearson 12 years ago
parent 94881634c4
commit 186ceec058

@ -71,7 +71,6 @@
#include <stdio.h>
TDENetworkConnectionStatus::TDENetworkConnectionStatus nm_device_state_global = TDENetworkConnectionStatus::Invalid;
TDENetworkConnectionStatus::TDENetworkConnectionStatus current_vpn_state = TDENetworkConnectionStatus::Invalid;
NewSecretsDialog::NewSecretsDialog(TDENetworkConnection *connection, TQWidget * parent, const char * name, bool modal, TQt::WFlags f)
: TQDialog(parent, name, modal, f)
@ -324,7 +323,7 @@ void Tray::contextMenuAboutToShow (KPopupMenu* menu)
// offline vs. online mode
KAction* switch_mode = NULL;
if (nm->backendStatus() != TDENetworkGlobalManagerFlags::Sleeping) {
if (nm->backendStatus() & TDENetworkGlobalManagerFlags::Sleeping) {
switch_mode = actionCollection ()->action ("offline_mode");
}
else {
@ -725,7 +724,8 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus
// printf("Active connection found\n\r");
// }
if ((current_vpn_state & TDENetworkConnectionStatus::Failed) || (current_vpn_state & TDENetworkConnectionStatus::Disconnected)) {
TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags current_vpn_state = (KGlobal::networkManager()->backendStatus() & TDENetworkGlobalManagerFlags::VPNMask);
if ((current_vpn_state & TDENetworkGlobalManagerFlags::VPNFailed) || (current_vpn_state & TDENetworkGlobalManagerFlags::VPNDisconnected)) {
active_vpn = 0;
}
@ -769,6 +769,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("Activated is: %d\n\r", TDENetworkConnectionStatus::Connected);
// stop the old movie to avoid unnecessary wakups
@ -778,24 +779,24 @@ void Tray::updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus
movie()->pause();
if (dtc) {
if (current_vpn_state & TDENetworkConnectionStatus::Connected) {
if (current_vpn_state & TDENetworkGlobalManagerFlags::VPNConnected) {
setPixmap(loadIcon("nm_device_vpn"));
}
if ((current_vpn_state & TDENetworkConnectionStatus::EstablishingLink)
|| (current_vpn_state & TDENetworkConnectionStatus::NeedAuthorization)
|| (current_vpn_state & TDENetworkConnectionStatus::ConfiguringProtocols)
|| (current_vpn_state & TDENetworkConnectionStatus::VerifyingProtocols)) {
if ((current_vpn_state & TDENetworkGlobalManagerFlags::VPNEstablishingLink)
|| (current_vpn_state & TDENetworkGlobalManagerFlags::VPNNeedAuthorization)
|| (current_vpn_state & TDENetworkGlobalManagerFlags::VPNConfiguringProtocols)
|| (current_vpn_state & TDENetworkGlobalManagerFlags::VPNVerifyingProtocols)) {
int frame = -1;
if (movie())
frame = movie()->frameNumber();
// set the movie
if ((current_vpn_state & TDENetworkConnectionStatus::EstablishingLink)
|| (current_vpn_state & TDENetworkConnectionStatus::NeedAuthorization)) {
if ((current_vpn_state & TDENetworkGlobalManagerFlags::VPNEstablishingLink)
|| (current_vpn_state & TDENetworkGlobalManagerFlags::VPNNeedAuthorization)) {
setMovie(TQMovie(KGlobal::iconLoader()->moviePath("nm_stage02_connecting_vpn", KIcon::Panel)));
}
if ((current_vpn_state & TDENetworkConnectionStatus::ConfiguringProtocols)
|| (current_vpn_state & TDENetworkConnectionStatus::VerifyingProtocols)) {
if ((current_vpn_state & TDENetworkGlobalManagerFlags::VPNConfiguringProtocols)
|| (current_vpn_state & TDENetworkGlobalManagerFlags::VPNVerifyingProtocols)) {
setMovie(TQMovie(KGlobal::iconLoader()->moviePath("nm_stage03_connecting_vpn", KIcon::Panel)));
}
@ -885,6 +886,13 @@ void Tray::slotGenericHardwareEvent(TDEHardwareEvent::TDEHardwareEvent event, TQ
}
}
void Tray::slotVPNEventHandler(TDENetworkVPNEventType::TDENetworkVPNEventType event, TQString message)
{
if (event == TDENetworkVPNEventType::LoginBanner) {
slotVPNBannerShow(message);
}
}
Tray::Tray() : KSystemTray()
{
hwdevices = KGlobal::hardwareDevices();
@ -944,6 +952,7 @@ Tray::Tray() : KSystemTray()
// Notifications
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)));
// initial setup of the device-trays

@ -110,6 +110,7 @@ class Tray : public KSystemTray
void slotGenericDeviceAdded(TDEGenericDevice*);
void slotGenericDeviceRemoved(TDEGenericDevice*);
void slotGenericHardwareEvent(TDEHardwareEvent::TDEHardwareEvent, TQString);
void slotVPNEventHandler(TDENetworkVPNEventType::TDENetworkVPNEventType event, TQString message);
private:
void updateTrayIcon(TDENetworkConnectionStatus::TDENetworkConnectionStatus);

Loading…
Cancel
Save