Some more usability work.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7166 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -17,16 +17,17 @@
|
|||||||
|
|
||||||
|
|
||||||
// message constants
|
// message constants
|
||||||
static const uint32 kMsgUpdateControls = 'UPDC';
|
static const uint32 kMsgUpdateControls = 'UCTL';
|
||||||
|
|
||||||
// labels
|
// labels
|
||||||
#ifdef LANG_GERMAN
|
#ifdef LANG_GERMAN
|
||||||
static const char *kLabelConnectionOptions = "Verbindungs-Optionen";
|
static const char *kLabelConnectionOptions = "Optionen";
|
||||||
static const char *kLabelDialOnDemand = "Bei Bedarf Automatisch Verbinden";
|
static const char *kLabelDialOnDemand = "Automatisch Verbinden Bei Zugriff Auf "
|
||||||
|
"Internet";
|
||||||
static const char *kLabelAskBeforeDialing = "Vor Dem Verbinden Fragen";
|
static const char *kLabelAskBeforeDialing = "Vor Dem Verbinden Fragen";
|
||||||
static const char *kLabelAutoRedial = "Verbindung Automatisch Wiederherstellen";
|
static const char *kLabelAutoRedial = "Verbindung Automatisch Wiederherstellen";
|
||||||
#else
|
#else
|
||||||
static const char *kLabelConnectionOptions = "Connection Options";
|
static const char *kLabelConnectionOptions = "Options";
|
||||||
static const char *kLabelDialOnDemand = "Connect Automatically When Needed";
|
static const char *kLabelDialOnDemand = "Connect Automatically When Needed";
|
||||||
static const char *kLabelAskBeforeDialing = "Ask Before Dialing";
|
static const char *kLabelAskBeforeDialing = "Ask Before Dialing";
|
||||||
static const char *kLabelAutoRedial = "Redial Automatically";
|
static const char *kLabelAutoRedial = "Redial Automatically";
|
||||||
@@ -245,10 +246,6 @@ ConnectionOptionsView::MessageReceived(BMessage *message)
|
|||||||
void
|
void
|
||||||
ConnectionOptionsView::UpdateControls()
|
ConnectionOptionsView::UpdateControls()
|
||||||
{
|
{
|
||||||
if(fDialOnDemand->Value())
|
fAskBeforeDialing->SetEnabled(fDialOnDemand->Value());
|
||||||
fAskBeforeDialing->SetEnabled(true);
|
|
||||||
else
|
|
||||||
fAskBeforeDialing->SetEnabled(false);
|
|
||||||
|
|
||||||
fAskBeforeDialing->SetValue(fDialOnDemand->Value());
|
fAskBeforeDialing->SetValue(fDialOnDemand->Value());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,6 @@
|
|||||||
#include <Point.h>
|
#include <Point.h>
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------
|
|
||||||
// uncomment the language (English by default)
|
|
||||||
// #define LANG_GERMAN
|
|
||||||
// -------------------------------------------
|
|
||||||
|
|
||||||
#define DUN_MAXIMUM_PRIORITY 50
|
#define DUN_MAXIMUM_PRIORITY 50
|
||||||
|
|
||||||
// add-on types
|
// add-on types
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ static const uint32 kMsgConnectButton = 'CONI';
|
|||||||
#ifdef LANG_GERMAN
|
#ifdef LANG_GERMAN
|
||||||
static const char *kLabelInterface = "Verbindung: ";
|
static const char *kLabelInterface = "Verbindung: ";
|
||||||
static const char *kLabelInterfaceName = "Verbindungs-Name: ";
|
static const char *kLabelInterfaceName = "Verbindungs-Name: ";
|
||||||
static const char *kLabelNewInterface = "Neue Verbindung";
|
static const char *kLabelNewInterface = "Neue Verbindung Erstellen";
|
||||||
static const char *kLabelCreateNew = "Neu...";
|
static const char *kLabelCreateNew = "Neu...";
|
||||||
static const char *kLabelDeleteCurrent = "Auswahl Löschen";
|
static const char *kLabelDeleteCurrent = "Auswahl Löschen";
|
||||||
static const char *kLabelConnect = "Verbinden";
|
static const char *kLabelConnect = "Verbinden";
|
||||||
@@ -60,7 +60,7 @@ static const char *kLabelOK = "OK";
|
|||||||
#else
|
#else
|
||||||
static const char *kLabelInterface = "Interface: ";
|
static const char *kLabelInterface = "Interface: ";
|
||||||
static const char *kLabelInterfaceName = "Interface Name: ";
|
static const char *kLabelInterfaceName = "Interface Name: ";
|
||||||
static const char *kLabelNewInterface = "New Interface";
|
static const char *kLabelNewInterface = "Create New Interface";
|
||||||
static const char *kLabelCreateNew = "Create New...";
|
static const char *kLabelCreateNew = "Create New...";
|
||||||
static const char *kLabelDeleteCurrent = "Delete Current";
|
static const char *kLabelDeleteCurrent = "Delete Current";
|
||||||
static const char *kLabelConnect = "Connect";
|
static const char *kLabelConnect = "Connect";
|
||||||
@@ -73,20 +73,27 @@ static const char *kLabelOK = "OK";
|
|||||||
static const char *kTextConnecting = "Verbinde...";
|
static const char *kTextConnecting = "Verbinde...";
|
||||||
static const char *kTextConnectionEstablished = "Verbindung hergestellt.";
|
static const char *kTextConnectionEstablished = "Verbindung hergestellt.";
|
||||||
static const char *kTextNotConnected = "Nicht verbunden.";
|
static const char *kTextNotConnected = "Nicht verbunden.";
|
||||||
|
static const char *kTextDeviceUpFailed = "Konnte Verbindung nicht aufbauen.";
|
||||||
static const char *kTextAuthenticating = "Authentifizierung...";
|
static const char *kTextAuthenticating = "Authentifizierung...";
|
||||||
static const char *kTextAuthenticationFailed = "Authentifizierung fehlgeschlagen!";
|
static const char *kTextAuthenticationFailed = "Authentifizierung fehlgeschlagen!";
|
||||||
static const char *kTextConnectionLost = "Verbindung verloren!";
|
static const char *kTextConnectionLost = "Verbindung verloren!";
|
||||||
static const char *kTextCreationError = "Fehler beim Initialisieren!";
|
static const char *kTextCreationError = "Fehler beim Initialisieren!";
|
||||||
static const char *kTextNoInterfacesFound = "Kein Verbindungen gefunden...";
|
static const char *kTextNoInterfacesFound = "Bitte erstellen Sie eine neue "
|
||||||
|
"Verbindung.";
|
||||||
|
static const char *kTextChooseInterfaceName = "Bitte denken Sie sich einen neuen "
|
||||||
|
"Namen für diese Verbindung aus.";
|
||||||
#else
|
#else
|
||||||
static const char *kTextConnecting = "Connecting...";
|
static const char *kTextConnecting = "Connecting...";
|
||||||
static const char *kTextConnectionEstablished = "Connection established.";
|
static const char *kTextConnectionEstablished = "Connection established.";
|
||||||
static const char *kTextNotConnected = "Not connected.";
|
static const char *kTextNotConnected = "Not connected.";
|
||||||
|
static const char *kTextDeviceUpFailed = "Failed to connect.";
|
||||||
static const char *kTextAuthenticating = "Authenticating...";
|
static const char *kTextAuthenticating = "Authenticating...";
|
||||||
static const char *kTextAuthenticationFailed = "Authentication failed!";
|
static const char *kTextAuthenticationFailed = "Authentication failed!";
|
||||||
static const char *kTextConnectionLost = "Connection lost!";
|
static const char *kTextConnectionLost = "Connection lost!";
|
||||||
static const char *kTextCreationError = "Error creating interface!";
|
static const char *kTextCreationError = "Error creating interface!";
|
||||||
static const char *kTextNoInterfacesFound = "No interfaces found...";
|
static const char *kTextNoInterfacesFound = "Please create a new interface...";
|
||||||
|
static const char *kTextChooseInterfaceName = "Please choose a new name for this "
|
||||||
|
"interface.";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// error strings for alerts
|
// error strings for alerts
|
||||||
@@ -230,7 +237,8 @@ DialUpView::MessageReceived(BMessage *message)
|
|||||||
|
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
case kMsgCreateNew: {
|
case kMsgCreateNew: {
|
||||||
(new TextRequestDialog(kLabelNewInterface, kLabelInterfaceName))->Go(
|
(new TextRequestDialog(kLabelNewInterface, kTextChooseInterfaceName,
|
||||||
|
kLabelInterfaceName))->Go(
|
||||||
new BInvoker(new BMessage(kMsgFinishCreateNew), this));
|
new BInvoker(new BMessage(kMsgFinishCreateNew), this));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@@ -606,6 +614,9 @@ DialUpView::UpdateStatus(int32 code)
|
|||||||
{
|
{
|
||||||
switch(code) {
|
switch(code) {
|
||||||
case PPP_REPORT_UP_ABORTED:
|
case PPP_REPORT_UP_ABORTED:
|
||||||
|
case PPP_REPORT_DEVICE_UP_FAILED:
|
||||||
|
case PPP_REPORT_LOCAL_AUTHENTICATION_FAILED:
|
||||||
|
case PPP_REPORT_PEER_AUTHENTICATION_FAILED:
|
||||||
case PPP_REPORT_DOWN_SUCCESSFUL:
|
case PPP_REPORT_DOWN_SUCCESSFUL:
|
||||||
case PPP_REPORT_CONNECTION_LOST: {
|
case PPP_REPORT_CONNECTION_LOST: {
|
||||||
fConnectButton->SetLabel(kLabelConnect);
|
fConnectButton->SetLabel(kLabelConnect);
|
||||||
@@ -615,7 +626,8 @@ DialUpView::UpdateStatus(int32 code)
|
|||||||
fConnectButton->SetLabel(kLabelDisconnect);
|
fConnectButton->SetLabel(kLabelDisconnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// maybe the information string must stay
|
// maybe the status string must not be changed (codes that set fKeepLabel to false
|
||||||
|
// should still be handled)
|
||||||
if(fKeepLabel && code != PPP_REPORT_GOING_UP && code != PPP_REPORT_UP_SUCCESSFUL)
|
if(fKeepLabel && code != PPP_REPORT_GOING_UP && code != PPP_REPORT_UP_SUCCESSFUL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -624,6 +636,7 @@ DialUpView::UpdateStatus(int32 code)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only errors should set fKeepLabel to true
|
||||||
switch(code) {
|
switch(code) {
|
||||||
case PPP_REPORT_GOING_UP:
|
case PPP_REPORT_GOING_UP:
|
||||||
fKeepLabel = false;
|
fKeepLabel = false;
|
||||||
@@ -640,6 +653,11 @@ DialUpView::UpdateStatus(int32 code)
|
|||||||
fStatusView->SetText(kTextNotConnected);
|
fStatusView->SetText(kTextNotConnected);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PPP_REPORT_DEVICE_UP_FAILED:
|
||||||
|
fKeepLabel = true;
|
||||||
|
fStatusView->SetText(kTextDeviceUpFailed);
|
||||||
|
break;
|
||||||
|
|
||||||
case PPP_REPORT_LOCAL_AUTHENTICATION_REQUESTED:
|
case PPP_REPORT_LOCAL_AUTHENTICATION_REQUESTED:
|
||||||
case PPP_REPORT_PEER_AUTHENTICATION_REQUESTED:
|
case PPP_REPORT_PEER_AUTHENTICATION_REQUESTED:
|
||||||
fStatusView->SetText(kTextAuthenticating);
|
fStatusView->SetText(kTextAuthenticating);
|
||||||
@@ -704,7 +722,7 @@ void
|
|||||||
DialUpView::LoadInterfaces()
|
DialUpView::LoadInterfaces()
|
||||||
{
|
{
|
||||||
fInterfaceMenu->AddSeparatorItem();
|
fInterfaceMenu->AddSeparatorItem();
|
||||||
fInterfaceMenu->AddItem(new BMenuItem(kLabelCreateNew,
|
fInterfaceMenu->AddItem(new BMenuItem(kLabelNewInterface,
|
||||||
new BMessage(kMsgCreateNew)));
|
new BMessage(kMsgCreateNew)));
|
||||||
fDeleterItem = new BMenuItem(kLabelDeleteCurrent,
|
fDeleterItem = new BMenuItem(kLabelDeleteCurrent,
|
||||||
new BMessage(kMsgDeleteCurrent));
|
new BMessage(kMsgDeleteCurrent));
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ static const char *kLabelDevice = "Gerät: ";
|
|||||||
static const char *kLabelNoDevicesFound = "Keine Geräte Gefunden!";
|
static const char *kLabelNoDevicesFound = "Keine Geräte Gefunden!";
|
||||||
static const char *kLabelAuthenticator = "Login: ";
|
static const char *kLabelAuthenticator = "Login: ";
|
||||||
static const char *kLabelNoAuthenticatorsFound = "Keine Login-Methoden gefunden!";
|
static const char *kLabelNoAuthenticatorsFound = "Keine Login-Methoden gefunden!";
|
||||||
static const char *kLabelName = "Name: ";
|
static const char *kLabelName = "Benutzername: ";
|
||||||
static const char *kLabelPassword = "Password: ";
|
static const char *kLabelPassword = "Password: ";
|
||||||
static const char *kLabelSavePassword = "Password Speichern";
|
static const char *kLabelSavePassword = "Passwort Speichern";
|
||||||
static const char *kLabelNone = "Ohne";
|
static const char *kLabelNone = "Ohne";
|
||||||
#else
|
#else
|
||||||
static const char *kLabelGeneral = "General";
|
static const char *kLabelGeneral = "General";
|
||||||
@@ -46,7 +46,7 @@ static const char *kLabelDevice = "Device: ";
|
|||||||
static const char *kLabelNoDevicesFound = "No Devices Found!";
|
static const char *kLabelNoDevicesFound = "No Devices Found!";
|
||||||
static const char *kLabelAuthenticator = "Login: ";
|
static const char *kLabelAuthenticator = "Login: ";
|
||||||
static const char *kLabelNoAuthenticatorsFound = "No Authenticators Found!";
|
static const char *kLabelNoAuthenticatorsFound = "No Authenticators Found!";
|
||||||
static const char *kLabelName = "Name: ";
|
static const char *kLabelName = "Username: ";
|
||||||
static const char *kLabelPassword = "Password: ";
|
static const char *kLabelPassword = "Password: ";
|
||||||
static const char *kLabelSavePassword = "Save Password";
|
static const char *kLabelSavePassword = "Save Password";
|
||||||
static const char *kLabelNone = "None";
|
static const char *kLabelNone = "None";
|
||||||
@@ -473,6 +473,7 @@ GeneralView::Reload()
|
|||||||
item = fDeviceField->Menu()->ItemAt(0);
|
item = fDeviceField->Menu()->ItemAt(0);
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
item->Message()->FindPointer("Addon", reinterpret_cast<void**>(&fDeviceAddon));
|
item->Message()->FindPointer("Addon", reinterpret_cast<void**>(&fDeviceAddon));
|
||||||
|
fDeviceAddon->LoadSettings(Addon()->Settings(), Addon()->Profile(), true);
|
||||||
} else {
|
} else {
|
||||||
fDeviceAddon = NULL;
|
fDeviceAddon = NULL;
|
||||||
item = fDeviceField->Menu()->FindMarked();
|
item = fDeviceField->Menu()->FindMarked();
|
||||||
@@ -480,8 +481,6 @@ GeneralView::Reload()
|
|||||||
item->SetMarked(false);
|
item->SetMarked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReloadDeviceView();
|
|
||||||
|
|
||||||
if(Addon()->CountAuthenticators() > 0) {
|
if(Addon()->CountAuthenticators() > 0) {
|
||||||
BString kernelModule, authenticator;
|
BString kernelModule, authenticator;
|
||||||
BMessage authentication;
|
BMessage authentication;
|
||||||
|
|||||||
@@ -30,18 +30,20 @@ static const uint32 kMsgUpdateControls = 'UCTL';
|
|||||||
// labels
|
// labels
|
||||||
#ifdef LANG_GERMAN
|
#ifdef LANG_GERMAN
|
||||||
static const char *kLabelIPCP = "TCP/IP";
|
static const char *kLabelIPCP = "TCP/IP";
|
||||||
static const char *kLabelEnabled = "Verwenden";
|
|
||||||
static const char *kLabelIPAddress = "IP Adresse: ";
|
static const char *kLabelIPAddress = "IP Adresse: ";
|
||||||
static const char *kLabelPrimaryDNS = "Primärer DNS: ";
|
static const char *kLabelPrimaryDNS = "Primärer DNS: ";
|
||||||
static const char *kLabelSecondaryDNS = "Sekundärer DNS: ";
|
static const char *kLabelSecondaryDNS = "Sekundärer DNS: ";
|
||||||
static const char *kLabelOptional = "(Optional)";
|
static const char *kLabelOptional = "(Optional)";
|
||||||
|
static const char *kLabelExtendedOptions = "Erweiterte Optionen:";
|
||||||
|
static const char *kLabelEnabled = "TCP/IP-Protokoll Verwenden";
|
||||||
#else
|
#else
|
||||||
static const char *kLabelIPCP = "TCP/IP";
|
static const char *kLabelIPCP = "TCP/IP";
|
||||||
static const char *kLabelEnabled = "Enabled";
|
|
||||||
static const char *kLabelIPAddress = "IP Address: ";
|
static const char *kLabelIPAddress = "IP Address: ";
|
||||||
static const char *kLabelPrimaryDNS = "Primary DNS: ";
|
static const char *kLabelPrimaryDNS = "Primary DNS: ";
|
||||||
static const char *kLabelSecondaryDNS = "Secondary DNS: ";
|
static const char *kLabelSecondaryDNS = "Secondary DNS: ";
|
||||||
static const char *kLabelOptional = "(Optional)";
|
static const char *kLabelOptional = "(Optional)";
|
||||||
|
static const char *kLabelExtendedOptions = "Extended Options:";
|
||||||
|
static const char *kLabelEnabled = "Enable TCP/IP Protocol";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// add-on descriptions
|
// add-on descriptions
|
||||||
@@ -277,12 +279,6 @@ IPCPView::IPCPView(IPCPAddon *addon, BRect frame)
|
|||||||
{
|
{
|
||||||
BRect rect = Bounds();
|
BRect rect = Bounds();
|
||||||
rect.InsetBy(10, 10);
|
rect.InsetBy(10, 10);
|
||||||
rect.bottom = rect.top + 15;
|
|
||||||
fIsEnabled = new BCheckBox(rect, "isEnabled", kLabelEnabled,
|
|
||||||
new BMessage(kMsgUpdateControls));
|
|
||||||
rect.left += 15;
|
|
||||||
// indent the other controls to indicate that they depend on this control
|
|
||||||
rect.top = rect.bottom + 5;
|
|
||||||
rect.bottom = rect.top + 20;
|
rect.bottom = rect.top + 20;
|
||||||
BRect optionalRect(rect);
|
BRect optionalRect(rect);
|
||||||
rect.right -= 75;
|
rect.right -= 75;
|
||||||
@@ -303,6 +299,13 @@ IPCPView::IPCPView(IPCPAddon *addon, BRect frame)
|
|||||||
optionalRect.top = rect.top;
|
optionalRect.top = rect.top;
|
||||||
optionalRect.bottom = optionalRect.top + 15;
|
optionalRect.bottom = optionalRect.top + 15;
|
||||||
AddChild(new BStringView(optionalRect, "optional_3", kLabelOptional));
|
AddChild(new BStringView(optionalRect, "optional_3", kLabelOptional));
|
||||||
|
rect.top = rect.bottom + 50;
|
||||||
|
rect.bottom = rect.top + 10;
|
||||||
|
AddChild(new BStringView(rect, "expert", kLabelExtendedOptions));
|
||||||
|
rect.top = rect.bottom + 5;
|
||||||
|
rect.bottom = rect.top + 15;
|
||||||
|
fIsEnabled = new BCheckBox(rect, "isEnabled", kLabelEnabled,
|
||||||
|
new BMessage(kMsgUpdateControls));
|
||||||
|
|
||||||
// set divider of text controls
|
// set divider of text controls
|
||||||
float controlWidth = max(max(StringWidth(fIPAddress->Label()),
|
float controlWidth = max(max(StringWidth(fIPAddress->Label()),
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
SubDir OBOS_TOP src tests kits net DialUpPreflet ;
|
SubDir OBOS_TOP src tests kits net DialUpPreflet ;
|
||||||
|
|
||||||
|
# set some additional defines
|
||||||
|
{
|
||||||
|
local defines ;
|
||||||
|
|
||||||
|
if $(LANG_GERMAN) {
|
||||||
|
defines += LANG_GERMAN ;
|
||||||
|
}
|
||||||
|
|
||||||
|
defines = [ FDefines $(defines) ] ;
|
||||||
|
SubDirCcFlags $(defines) ;
|
||||||
|
SubDirC++Flags $(defines) ;
|
||||||
|
}
|
||||||
|
|
||||||
UsePrivateHeaders net ;
|
UsePrivateHeaders net ;
|
||||||
UseHeaders [ FDirName $(OBOS_TOP) src add-ons kernel network ppp shared libppp headers ] ;
|
UseHeaders [ FDirName $(OBOS_TOP) src add-ons kernel network ppp shared libppp headers ] ;
|
||||||
UseHeaders [ FDirName $(OBOS_TOP) src add-ons kernel network ppp shared libkernelppp headers ] ;
|
UseHeaders [ FDirName $(OBOS_TOP) src add-ons kernel network ppp shared libkernelppp headers ] ;
|
||||||
|
|||||||
@@ -182,10 +182,11 @@ WriteParameter(BFile& file, const BMessage& parameter, int32 level)
|
|||||||
line << word;
|
line << word;
|
||||||
if(needsEscaping)
|
if(needsEscaping)
|
||||||
line << '\"';
|
line << '\"';
|
||||||
line << ' ';
|
|
||||||
|
|
||||||
for(int32 index = 0; parameter.FindString(MDSU_VALUES, index, &name) == B_OK; index++)
|
for(int32 index = 0; parameter.FindString(MDSU_VALUES, index, &name) == B_OK;
|
||||||
|
index++)
|
||||||
if(name) {
|
if(name) {
|
||||||
|
line << ' ';
|
||||||
word = name;
|
word = name;
|
||||||
EscapeWord(word);
|
EscapeWord(word);
|
||||||
needsEscaping = word.FindFirst(' ') >= 0;
|
needsEscaping = word.FindFirst(' ') >= 0;
|
||||||
@@ -194,7 +195,6 @@ WriteParameter(BFile& file, const BMessage& parameter, int32 level)
|
|||||||
line << word;
|
line << word;
|
||||||
if(needsEscaping)
|
if(needsEscaping)
|
||||||
line << '\"';
|
line << '\"';
|
||||||
line << ' ';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type_code type;
|
type_code type;
|
||||||
@@ -202,7 +202,7 @@ WriteParameter(BFile& file, const BMessage& parameter, int32 level)
|
|||||||
parameter.GetInfo(MDSU_PARAMETERS, &type, ¶meterCount);
|
parameter.GetInfo(MDSU_PARAMETERS, &type, ¶meterCount);
|
||||||
|
|
||||||
if(parameterCount > 0)
|
if(parameterCount > 0)
|
||||||
line << '{';
|
line << " {";
|
||||||
|
|
||||||
line << '\n';
|
line << '\n';
|
||||||
file.Write(line.String(), line.Length());
|
file.Write(line.String(), line.Length());
|
||||||
|
|||||||
@@ -117,11 +117,12 @@ PPPoEAddon::LoadSettings(BMessage *settings, BMessage *profile, bool isNew)
|
|||||||
fInterfaceName = fServiceName = "";
|
fInterfaceName = fServiceName = "";
|
||||||
fSettings = settings;
|
fSettings = settings;
|
||||||
fProfile = profile;
|
fProfile = profile;
|
||||||
if(!settings || !profile || isNew) {
|
|
||||||
if(fPPPoEView)
|
if(fPPPoEView)
|
||||||
fPPPoEView->Reload();
|
fPPPoEView->Reload();
|
||||||
|
|
||||||
|
if(!settings || !profile || isNew)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
BMessage device;
|
BMessage device;
|
||||||
int32 deviceIndex = 0;
|
int32 deviceIndex = 0;
|
||||||
@@ -157,6 +158,9 @@ PPPoEAddon::LoadSettings(BMessage *settings, BMessage *profile, bool isNew)
|
|||||||
device.AddBool(MDSU_VALID, true);
|
device.AddBool(MDSU_VALID, true);
|
||||||
fSettings->ReplaceMessage(MDSU_PARAMETERS, deviceIndex, &device);
|
fSettings->ReplaceMessage(MDSU_PARAMETERS, deviceIndex, &device);
|
||||||
|
|
||||||
|
if(fPPPoEView)
|
||||||
|
fPPPoEView->Reload();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,7 +309,7 @@ PPPoEView::MessageReceived(BMessage *message)
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
case kMsgSelectOther:
|
case kMsgSelectOther:
|
||||||
(new TextRequestDialog("InterfaceName", kRequestInterfaceName,
|
(new TextRequestDialog("InterfaceName", NULL, kRequestInterfaceName,
|
||||||
fInterfaceName.String()))->Go(new BInvoker(
|
fInterfaceName.String()))->Go(new BInvoker(
|
||||||
new BMessage(kMsgFinishSelectOther), this));
|
new BMessage(kMsgFinishSelectOther), this));
|
||||||
break;
|
break;
|
||||||
@@ -378,7 +382,7 @@ PPPoEView::ReloadInterfaces()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set interface or some default value if nothing was found
|
// set interface or some default value if nothing was found
|
||||||
if(Addon()->InterfaceName())
|
if(Addon()->InterfaceName() && strlen(Addon()->InterfaceName()) > 0)
|
||||||
fInterfaceName = Addon()->InterfaceName();
|
fInterfaceName = Addon()->InterfaceName();
|
||||||
else if(count > 0)
|
else if(count > 0)
|
||||||
fInterfaceName = interfaces;
|
fInterfaceName = interfaces;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Short-term TODOs:
|
|||||||
- move DEVNOTES into a doxygen file and document the rest of the API
|
- move DEVNOTES into a doxygen file and document the rest of the API
|
||||||
- IPCP: check for incorrect settings (only IP addresses should be entered)
|
- IPCP: check for incorrect settings (only IP addresses should be entered)
|
||||||
- PPPoE: refresh interfaces list every second or so
|
- PPPoE: refresh interfaces list every second or so
|
||||||
- Extras: add field for entering number of dial retries and delay between retries
|
- ConnectionOptions: add field for entering number of dial retries and delay between retries
|
||||||
|
|
||||||
Long-term TODOs:
|
Long-term TODOs:
|
||||||
- (maybe) allow selecting multiple authenticators (in expert-mode)
|
- (maybe) allow selecting multiple authenticators (in expert-mode)
|
||||||
|
|||||||
@@ -10,24 +10,26 @@
|
|||||||
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
|
#include <TextView.h>
|
||||||
|
|
||||||
|
|
||||||
// GUI constants
|
// GUI constants
|
||||||
static const uint32 kWindowWidth = 250;
|
static const uint32 kWindowWidth = 250;
|
||||||
static const uint32 kWindowHeight = 5 + 20 + 10 + 25 + 5;
|
static const uint32 kWindowHeight = 10 + 20 + 10 + 25 + 5;
|
||||||
static const BRect kWindowRect(0, 0, kWindowWidth, kWindowHeight);
|
static const BRect kWindowRect(0, 0, kWindowWidth, kWindowHeight);
|
||||||
static const uint32 kDefaultButtonWidth = 80;
|
static const uint32 kDefaultButtonWidth = 80;
|
||||||
|
|
||||||
// message constants
|
// message constants
|
||||||
static const int32 kMsgButton = 'MBTN';
|
static const uint32 kMsgButton = 'MBTN';
|
||||||
|
static const uint32 kMsgUpdateControls = 'UCTL';
|
||||||
|
|
||||||
// labels
|
// labels
|
||||||
static const char *kLabelOK = "OK";
|
static const char *kLabelOK = "OK";
|
||||||
static const char *kLabelCancel = "Cancel";
|
static const char *kLabelCancel = "Cancel";
|
||||||
|
|
||||||
|
|
||||||
TextRequestDialog::TextRequestDialog(const char *title, const char *request,
|
TextRequestDialog::TextRequestDialog(const char *title, const char *information,
|
||||||
const char *text = NULL)
|
const char *request, const char *text = NULL)
|
||||||
: BWindow(kWindowRect, title, B_MODAL_WINDOW, B_NOT_RESIZABLE | B_NOT_CLOSABLE, 0),
|
: BWindow(kWindowRect, title, B_MODAL_WINDOW, B_NOT_RESIZABLE | B_NOT_CLOSABLE, 0),
|
||||||
fInvoker(NULL)
|
fInvoker(NULL)
|
||||||
{
|
{
|
||||||
@@ -35,8 +37,31 @@ TextRequestDialog::TextRequestDialog(const char *title, const char *request,
|
|||||||
BView *backgroundView = new BView(rect, "background", B_FOLLOW_ALL_SIDES, 0);
|
BView *backgroundView = new BView(rect, "background", B_FOLLOW_ALL_SIDES, 0);
|
||||||
backgroundView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
backgroundView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
rect.InsetBy(5, 5);
|
rect.InsetBy(5, 5);
|
||||||
|
rect.bottom = rect.top;
|
||||||
|
// init
|
||||||
|
|
||||||
|
if(information) {
|
||||||
|
BRect textRect(rect);
|
||||||
|
textRect.OffsetTo(0, 0);
|
||||||
|
fTextView = new BTextView(rect, "TextView", textRect, B_FOLLOW_NONE,
|
||||||
|
B_WILL_DRAW);
|
||||||
|
fTextView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
fTextView->MakeSelectable(false);
|
||||||
|
fTextView->MakeEditable(false);
|
||||||
|
fTextView->SetText(information);
|
||||||
|
float textHeight = fTextView->TextHeight(0, fTextView->CountLines());
|
||||||
|
backgroundView->ResizeBy(0, textHeight + 5);
|
||||||
|
ResizeBy(0, textHeight + 5);
|
||||||
|
fTextView->ResizeBy(0, textHeight - textRect.Height());
|
||||||
|
rect.bottom += textHeight + 5;
|
||||||
|
backgroundView->AddChild(fTextView);
|
||||||
|
} else
|
||||||
|
fTextView = NULL;
|
||||||
|
|
||||||
|
rect.top = rect.bottom + 5;
|
||||||
rect.bottom = rect.top + 20;
|
rect.bottom = rect.top + 20;
|
||||||
fTextControl = new BTextControl(rect, "request", request, text, NULL);
|
fTextControl = new BTextControl(rect, "request", request, text, NULL);
|
||||||
|
fTextControl->SetModificationMessage(new BMessage(kMsgUpdateControls));
|
||||||
fTextControl->SetDivider(fTextControl->StringWidth(fTextControl->Label()) + 5);
|
fTextControl->SetDivider(fTextControl->StringWidth(fTextControl->Label()) + 5);
|
||||||
if(text && strlen(text) > 0)
|
if(text && strlen(text) > 0)
|
||||||
fTextControl->TextView()->SelectAll();
|
fTextControl->TextView()->SelectAll();
|
||||||
@@ -46,19 +71,21 @@ TextRequestDialog::TextRequestDialog(const char *title, const char *request,
|
|||||||
rect.left = rect.right - kDefaultButtonWidth;
|
rect.left = rect.right - kDefaultButtonWidth;
|
||||||
BMessage message(kMsgButton);
|
BMessage message(kMsgButton);
|
||||||
message.AddInt32("which", 1);
|
message.AddInt32("which", 1);
|
||||||
BButton *okButton = new BButton(rect, "okButton", kLabelOK, new BMessage(message));
|
fOKButton = new BButton(rect, "okButton", kLabelOK, new BMessage(message));
|
||||||
rect.right = rect.left - 10;
|
rect.right = rect.left - 10;
|
||||||
rect.left = rect.right - kDefaultButtonWidth;
|
rect.left = rect.right - kDefaultButtonWidth;
|
||||||
message.ReplaceInt32("which", 0);
|
message.ReplaceInt32("which", 0);
|
||||||
BButton *cancelButton = new BButton(rect, "cancelButton", kLabelCancel,
|
BButton *cancelButton = new BButton(rect, "cancelButton", kLabelCancel,
|
||||||
new BMessage(message));
|
new BMessage(message));
|
||||||
backgroundView->AddChild(okButton);
|
|
||||||
backgroundView->AddChild(cancelButton);
|
backgroundView->AddChild(cancelButton);
|
||||||
|
backgroundView->AddChild(fOKButton);
|
||||||
backgroundView->AddChild(fTextControl);
|
backgroundView->AddChild(fTextControl);
|
||||||
AddChild(backgroundView);
|
AddChild(backgroundView);
|
||||||
|
|
||||||
fTextControl->MakeFocus(true);
|
fTextControl->MakeFocus(true);
|
||||||
SetDefaultButton(okButton);
|
SetDefaultButton(fOKButton);
|
||||||
|
|
||||||
|
UpdateControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -87,6 +114,10 @@ TextRequestDialog::MessageReceived(BMessage *message)
|
|||||||
PostMessage(B_QUIT_REQUESTED);
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case kMsgUpdateControls:
|
||||||
|
UpdateControls();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
}
|
}
|
||||||
@@ -109,3 +140,10 @@ TextRequestDialog::Go(BInvoker *invoker)
|
|||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TextRequestDialog::UpdateControls()
|
||||||
|
{
|
||||||
|
fOKButton->SetEnabled(fTextControl->TextView()->TextLength() > 0);
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
class TextRequestDialog : public BWindow {
|
class TextRequestDialog : public BWindow {
|
||||||
public:
|
public:
|
||||||
TextRequestDialog(const char *title, const char *request,
|
TextRequestDialog(const char *title, const char *information,
|
||||||
const char *text = NULL);
|
const char *request, const char *text = NULL);
|
||||||
virtual ~TextRequestDialog();
|
virtual ~TextRequestDialog();
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
@@ -23,6 +23,12 @@ class TextRequestDialog : public BWindow {
|
|||||||
status_t Go(BInvoker *invoker);
|
status_t Go(BInvoker *invoker);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void UpdateControls();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BTextView *fTextView;
|
||||||
|
// displays information text
|
||||||
|
BButton *fOKButton;
|
||||||
BTextControl *fTextControl;
|
BTextControl *fTextControl;
|
||||||
BInvoker *fInvoker;
|
BInvoker *fInvoker;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user