@ -70,11 +70,15 @@ TQStringList WirelessDeviceTray::getToolTipText()
TQStringList tooltip = DeviceTrayComponent : : getToolTipText ( ) ;
TDENetworkConnectionManager * deviceConnMan = dev - > connectionManager ( ) ;
TDENetworkWiFiAPInfo * ap = deviceConnMan - > findAccessPointByBSSID ( deviceConnMan - > deviceInformation ( ) . wiFiInfo . activeAccessPointBSSID ) ;
if ( ap ) {
tooltip . append ( i18n ( " Network: %1 " ) . arg ( ap - > friendlySSID ( ) ) ) ;
int strength = ( ap - > signalQuality * 100.0 ) ;
tooltip . append ( i18n ( " Signal Strength: %1% " ) . arg ( strength ) ) ;
if ( deviceConnMan )
{
TDENetworkWiFiAPInfo * ap = deviceConnMan - > findAccessPointByBSSID ( deviceConnMan - > deviceInformation ( ) . wiFiInfo . activeAccessPointBSSID ) ;
if ( ap )
{
tooltip . append ( i18n ( " Network: %1 " ) . arg ( ap - > friendlySSID ( ) ) ) ;
int strength = ( ap - > signalQuality * 100.0 ) ;
tooltip . append ( i18n ( " Signal Strength: %1% " ) . arg ( strength ) ) ;
}
}
return tooltip ;
@ -88,6 +92,10 @@ void WirelessDeviceTray::newConnection()
void WirelessDeviceTray : : newConnection ( int id )
{
TDEGlobalNetworkManager * nm = TDEGlobal : : networkManager ( ) ;
if ( ! nm )
{
return ;
}
// create a new wireless connection
TDENetworkConnection * conn = new TDEWiFiConnection ( ) ;
@ -156,10 +164,14 @@ void WirelessDeviceTray::addWirelessNetworks(TDEPopupMenu* menu)
// get the currently active connection
TDENetworkConnectionManager * deviceConnMan = dev - > connectionManager ( ) ;
TDENetworkConnection * active_conn = NULL ;
TDENetworkDeviceInformation devInfo = deviceConnMan - > deviceStatus ( ) ;
if ( ( ! ( devInfo . statusFlags & TDENetworkConnectionStatus : : Disconnected ) )
& & ( ! ( devInfo . statusFlags & TDENetworkConnectionStatus : : Invalid ) ) ) {
active_conn = nm - > findConnectionByUUID ( devInfo . activeConnectionUUID ) ;
if ( nm & & deviceConnMan )
{
TDENetworkDeviceInformation devInfo = deviceConnMan - > deviceStatus ( ) ;
if ( ( ! ( devInfo . statusFlags & TDENetworkConnectionStatus : : Disconnected ) )
& & ( ! ( devInfo . statusFlags & TDENetworkConnectionStatus : : Invalid ) ) )
{
active_conn = nm - > findConnectionByUUID ( devInfo . activeConnectionUUID ) ;
}
}
// add all wireless connections in range
@ -267,7 +279,8 @@ void WirelessDeviceTray::addMenuItems(TDEPopupMenu* menu)
menu - > insertItem ( subhead , - 1 , - 1 ) ;
TDENetworkConnectionManager * deviceConnMan = dev - > connectionManager ( ) ;
if ( ! deviceConnMan - > deviceInformation ( ) . managed ) {
if ( ! nm | | ! deviceConnMan | | ! 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 ) ;
@ -326,24 +339,33 @@ void WirelessDeviceTray::slotUpdateDeviceState(TDENetworkConnectionStatus::TDENe
if ( newState = = TDENetworkConnectionStatus : : Connected ) {
// trigger an update of the connections seen bssids property
TDENetworkConnectionManager * deviceConnMan = dev - > connectionManager ( ) ;
TDENetworkWiFiAPInfo * ap = deviceConnMan - > findAccessPointByBSSID ( deviceConnMan - > deviceInformation ( ) . wiFiInfo . activeAccessPointBSSID ) ;
if ( ap ) {
int strength = ( ap - > signalQuality * 100.0 ) ;
if ( strength > 80 ) {
setPixmapForStates ( newState , " nm_signal_100 " ) ;
}
else if ( strength > 55 ) {
setPixmapForStates ( newState , " nm_signal_75 " ) ;
}
else if ( strength > 30 ) {
setPixmapForStates ( newState , " nm_signal_50 " ) ;
}
else if ( strength > 5 ) {
setPixmapForStates ( newState , " nm_signal_25 " ) ;
}
else {
setPixmapForStates ( newState , " nm_signal_00 " ) ;
if ( deviceConnMan )
{
TDENetworkWiFiAPInfo * ap = deviceConnMan - > findAccessPointByBSSID ( deviceConnMan - > deviceInformation ( ) . wiFiInfo . activeAccessPointBSSID ) ;
if ( ap )
{
int strength = ( ap - > signalQuality * 100.0 ) ;
if ( strength > 80 )
{
setPixmapForStates ( newState , " nm_signal_100 " ) ;
}
else if ( strength > 55 )
{
setPixmapForStates ( newState , " nm_signal_75 " ) ;
}
else if ( strength > 30 )
{
setPixmapForStates ( newState , " nm_signal_50 " ) ;
}
else if ( strength > 5 )
{
setPixmapForStates ( newState , " nm_signal_25 " ) ;
}
else
{
setPixmapForStates ( newState , " nm_signal_00 " ) ;
}
}
}
}
@ -364,22 +386,31 @@ void WirelessDeviceTray::slotCheckActiveAccessPoint()
TDENetworkConnectionManager * deviceConnMan = dev - > connectionManager ( ) ;
TDENetworkConnection * active_conn = NULL ;
TDENetworkDeviceInformation devInfo = deviceConnMan - > deviceStatus ( ) ;
if ( ( ! ( devInfo . statusFlags & TDENetworkConnectionStatus : : Disconnected ) )
& & ( ! ( devInfo . statusFlags & TDENetworkConnectionStatus : : Invalid ) ) ) {
active_conn = nm - > findConnectionByUUID ( devInfo . activeConnectionUUID ) ;
}
if ( nm & & deviceConnMan )
{
TDENetworkDeviceInformation devInfo = deviceConnMan - > deviceStatus ( ) ;
if ( ( ! ( devInfo . statusFlags & TDENetworkConnectionStatus : : Disconnected ) )
& & ( ! ( devInfo . statusFlags & TDENetworkConnectionStatus : : Invalid ) ) )
{
active_conn = nm - > findConnectionByUUID ( devInfo . activeConnectionUUID ) ;
}
if ( active_conn & & devInfo . statusFlags = = TDENetworkConnectionStatus : : Connected ) {
TDENetworkDeviceInformation devInfo = deviceConnMan - > deviceInformation ( ) ;
TDENetworkWiFiAPInfo * activeap = deviceConnMan - > findAccessPointByBSSID ( devInfo . wiFiInfo . activeAccessPointBSSID ) ;
if ( activeap ! = d - > activeAccessPoint ) {
d - > activeAccessPoint = activeap ;
if ( d - > activeAccessPoint ) {
TDEWiFiConnection * wireless = dynamic_cast < TDEWiFiConnection * > ( active_conn ) ;
if ( wireless ) {
if ( ! ( wireless - > heardBSSIDs . contains ( d - > activeAccessPoint - > BSSID ) ) ) {
wireless - > heardBSSIDs . append ( d - > activeAccessPoint - > BSSID ) ;
if ( active_conn & & devInfo . statusFlags = = TDENetworkConnectionStatus : : Connected )
{
TDENetworkDeviceInformation devInfo = deviceConnMan - > deviceInformation ( ) ;
TDENetworkWiFiAPInfo * activeap = deviceConnMan - > findAccessPointByBSSID ( devInfo . wiFiInfo . activeAccessPointBSSID ) ;
if ( activeap ! = d - > activeAccessPoint )
{
d - > activeAccessPoint = activeap ;
if ( d - > activeAccessPoint )
{
TDEWiFiConnection * wireless = dynamic_cast < TDEWiFiConnection * > ( active_conn ) ;
if ( wireless )
{
if ( ! ( wireless - > heardBSSIDs . contains ( d - > activeAccessPoint - > BSSID ) ) )
{
wireless - > heardBSSIDs . append ( d - > activeAccessPoint - > BSSID ) ;
}
}
}
}
@ -393,27 +424,36 @@ void WirelessDeviceTray::apPropertyChanged(TDEMACAddress BSSID, TDENetworkAPEven
if ( event = = TDENetworkAPEventType : : SignalStrengthChanged ) {
TDENetworkConnectionManager * deviceConnMan = dev - > connectionManager ( ) ;
TDENetworkWiFiAPInfo * ap = deviceConnMan - > findAccessPointByBSSID ( BSSID ) ;
if ( ap ) {
TQ_UINT32 strength = ( ap - > signalQuality * 100.0 ) ;
kdDebug ( ) < < k_funcinfo < < strength < < endl ;
TDENetworkConnectionStatus : : TDENetworkConnectionStatus state = deviceConnMan - > deviceInformation ( ) . statusFlags ;
if ( strength > 80 ) {
setPixmapForStates ( state , " nm_signal_100 " ) ;
}
else if ( strength > 55 ) {
setPixmapForStates ( state , " nm_signal_75 " ) ;
}
else if ( strength > 30 ) {
setPixmapForStates ( state , " nm_signal_50 " ) ;
}
else if ( strength > 5 ) {
setPixmapForStates ( state , " nm_signal_25 " ) ;
}
else {
setPixmapForStates ( state , " nm_signal_00 " ) ;
if ( deviceConnMan )
{
TDENetworkWiFiAPInfo * ap = deviceConnMan - > findAccessPointByBSSID ( BSSID ) ;
if ( ap )
{
TQ_UINT32 strength = ( ap - > signalQuality * 100.0 ) ;
kdDebug ( ) < < k_funcinfo < < strength < < endl ;
TDENetworkConnectionStatus : : TDENetworkConnectionStatus state = deviceConnMan - > deviceInformation ( ) . statusFlags ;
if ( strength > 80 )
{
setPixmapForStates ( state , " nm_signal_100 " ) ;
}
else if ( strength > 55 )
{
setPixmapForStates ( state , " nm_signal_75 " ) ;
}
else if ( strength > 30 )
{
setPixmapForStates ( state , " nm_signal_50 " ) ;
}
else if ( strength > 5 )
{
setPixmapForStates ( state , " nm_signal_25 " ) ;
}
else
{
setPixmapForStates ( state , " nm_signal_00 " ) ;
}
TQTimer : : singleShot ( 0 , this , TQT_SLOT ( sendUpdateUI ( ) ) ) ;
}
TQTimer : : singleShot ( 0 , this , TQT_SLOT ( sendUpdateUI ( ) ) ) ;
}
}
}
@ -433,14 +473,19 @@ void WirelessDeviceTray::tdeAccessPointStatusChangedHandler(TDEMACAddress BSSID,
TDENetworkConnectionManager * deviceConnMan = dev - > connectionManager ( ) ;
if ( event = = TDENetworkAPEventType : : Discovered ) {
TDENetworkWiFiAPInfo * apinfo = deviceConnMan - > findAccessPointByBSSID ( BSSID ) ;
slotAccessPointAdded ( apinfo ) ;
if ( deviceConnMan )
{
TDENetworkWiFiAPInfo * apinfo = deviceConnMan - > findAccessPointByBSSID ( BSSID ) ;
slotAccessPointAdded ( apinfo ) ;
}
}
else if ( event = = TDENetworkAPEventType : : Lost ) {
slotAccessPointRemoved ( BSSID ) ;
}
else if ( event = = TDENetworkAPEventType : : SignalStrengthChanged ) {
if ( deviceConnMan - > deviceInformation ( ) . wiFiInfo . activeAccessPointBSSID = = BSSID ) {
if ( deviceConnMan & &
deviceConnMan - > deviceInformation ( ) . wiFiInfo . activeAccessPointBSSID = = BSSID )
{
apPropertyChanged ( BSSID , event ) ;
}
}