NetworkStatus: show authentication mode in WiFi list. #9666
* now WirelessNetworkMenuItem appends authentication mode to its label Signed-off-by: Matt Madia <[email protected]>
This commit is contained in:
committed by
Matt Madia
parent
f05b8e3873
commit
5bb799c2d3
@@ -14,7 +14,7 @@ resource app_version {
|
|||||||
internal = 0,
|
internal = 0,
|
||||||
|
|
||||||
short_info = "NetworkStatus",
|
short_info = "NetworkStatus",
|
||||||
long_info = "NetworkStatus ©2007-2009 Haiku"
|
long_info = "NetworkStatus ©2007-2013 Haiku"
|
||||||
};
|
};
|
||||||
|
|
||||||
resource vector_icon {
|
resource vector_icon {
|
||||||
|
|||||||
@@ -414,8 +414,7 @@ NetworkStatusView::MouseDown(BPoint point)
|
|||||||
message->AddFlat("address", &network.address);
|
message->AddFlat("address", &network.address);
|
||||||
|
|
||||||
BMenuItem* item = new WirelessNetworkMenuItem(network.name,
|
BMenuItem* item = new WirelessNetworkMenuItem(network.name,
|
||||||
network.signal_strength,
|
network.signal_strength, network.authentication_mode, message);
|
||||||
(network.flags & B_NETWORK_IS_ENCRYPTED) != 0, message);
|
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
if (associated.find(network.address) != associated.end())
|
if (associated.find(network.address) != associated.end())
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
|
|||||||
@@ -6,16 +6,29 @@
|
|||||||
|
|
||||||
#include "WirelessNetworkMenuItem.h"
|
#include "WirelessNetworkMenuItem.h"
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <NetworkDevice.h>
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
#include "RadioView.h"
|
#include "RadioView.h"
|
||||||
|
|
||||||
|
#undef B_TRANSLATION_CONTEXT
|
||||||
|
#define B_TRANSLATION_CONTEXT "WirelessNetworkMenuItem"
|
||||||
|
|
||||||
|
|
||||||
WirelessNetworkMenuItem::WirelessNetworkMenuItem(const char* name,
|
WirelessNetworkMenuItem::WirelessNetworkMenuItem(const char* name,
|
||||||
int32 signalQuality, bool encrypted, BMessage* message)
|
int32 signalQuality, int32 authenticationMode, BMessage* message)
|
||||||
:
|
:
|
||||||
BMenuItem(name, message),
|
BMenuItem(name, message),
|
||||||
fQuality(signalQuality),
|
fQuality(signalQuality)
|
||||||
fIsEncrypted(encrypted)
|
|
||||||
{
|
{
|
||||||
|
// Append authentication mode to label
|
||||||
|
BString label = B_TRANSLATE("%name% (%authenticationMode%)");
|
||||||
|
label.Replace("%name%", name, 1);
|
||||||
|
label.Replace("%authenticationMode%",
|
||||||
|
AuthenticationName(authenticationMode), 1);
|
||||||
|
|
||||||
|
SetLabel(label.String());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -30,6 +43,28 @@ WirelessNetworkMenuItem::SetSignalQuality(int32 quality)
|
|||||||
fQuality = quality;
|
fQuality = quality;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BString
|
||||||
|
WirelessNetworkMenuItem::AuthenticationName(int32 mode)
|
||||||
|
{
|
||||||
|
switch (mode) {
|
||||||
|
default:
|
||||||
|
case B_NETWORK_AUTHENTICATION_NONE:
|
||||||
|
return B_TRANSLATE_CONTEXT("open", "Open network");
|
||||||
|
break;
|
||||||
|
case B_NETWORK_AUTHENTICATION_WEP:
|
||||||
|
return B_TRANSLATE_CONTEXT("WEP", "WEP protected network");
|
||||||
|
break;
|
||||||
|
case B_NETWORK_AUTHENTICATION_WPA:
|
||||||
|
return B_TRANSLATE_CONTEXT("WPA", "WPA protected network");
|
||||||
|
break;
|
||||||
|
case B_NETWORK_AUTHENTICATION_WPA2:
|
||||||
|
return B_TRANSLATE_CONTEXT("WPA2", "WPA2 protected network");
|
||||||
|
break;
|
||||||
|
case B_NETWORK_AUTHENTICATION_EAP:
|
||||||
|
return B_TRANSLATE_CONTEXT("EAP", "EAP protected network");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WirelessNetworkMenuItem::DrawContent()
|
WirelessNetworkMenuItem::DrawContent()
|
||||||
|
|||||||
@@ -12,15 +12,14 @@
|
|||||||
class WirelessNetworkMenuItem : public BMenuItem {
|
class WirelessNetworkMenuItem : public BMenuItem {
|
||||||
public:
|
public:
|
||||||
WirelessNetworkMenuItem(const char* name,
|
WirelessNetworkMenuItem(const char* name,
|
||||||
int32 signalQuality, bool encrypted,
|
int32 signalQuality, int32 authenticationMode,
|
||||||
BMessage* message);
|
BMessage* message);
|
||||||
virtual ~WirelessNetworkMenuItem();
|
virtual ~WirelessNetworkMenuItem();
|
||||||
|
|
||||||
void SetSignalQuality(int32 quality);
|
void SetSignalQuality(int32 quality);
|
||||||
int32 SignalQuality() const
|
int32 SignalQuality() const
|
||||||
{ return fQuality; }
|
{ return fQuality; }
|
||||||
bool IsEncrypted() const
|
BString AuthenticationName(int32 mode);
|
||||||
{ return fIsEncrypted; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DrawContent();
|
virtual void DrawContent();
|
||||||
@@ -30,7 +29,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int32 fQuality;
|
int32 fQuality;
|
||||||
bool fIsEncrypted;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user