Fixed some bugs. Setting a default interface now actually works, but the functionality is hidden because we do not yet have kernel-side IPCP support for ConnectOnDemand (COD).

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10690 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Waldemar Kornewald
2005-01-12 09:42:57 +00:00
parent 625ffa198e
commit 29dcffdf80
3 changed files with 15 additions and 17 deletions
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004, Waldemar Kornewald <[email protected]> * Copyright 2003-2005, Waldemar Kornewald <[email protected]>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -226,6 +226,9 @@ DialUpView::AttachedToWindow()
fInterfaceMenu->SetTargetForItems(this); fInterfaceMenu->SetTargetForItems(this);
fCreateNewButton->SetTarget(this); fCreateNewButton->SetTarget(this);
fConnectButton->SetTarget(this); fConnectButton->SetTarget(this);
fDefaultInterface->SetTarget(this);
fDefaultInterface->Hide();
// TODO: remove this when we have full COD support
if(fListener.InitCheck() != B_OK) { if(fListener.InitCheck() != B_OK) {
(new BAlert(kErrorTitle, kErrorNoPPPStack, kLabelOK, (new BAlert(kErrorTitle, kErrorNoPPPStack, kLabelOK,
@@ -675,9 +678,10 @@ DialUpView::FindInterface(const char *name)
return NULL; return NULL;
BMenuItem *item; BMenuItem *item;
for(int32 index = 0; index < fInterfaceMenu->CountItems(); index++) { for(int32 index = 0; index < CountInterfaces(); index++) {
item = fInterfaceMenu->ItemAt(index); item = fInterfaceMenu->ItemAt(index);
if(item && !strcmp(item->Message()->FindString("name"), name)) if(item && item->Message() && item->Message()->HasString("name")
&& !strcmp(item->Message()->FindString("name"), name))
return item; return item;
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004, Waldemar Kornewald <[email protected]> * Copyright 2003-2005, Waldemar Kornewald <[email protected]>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -414,12 +414,7 @@ GeneralView::GeneralView(GeneralAddon *addon, BRect frame)
fAuthenticationBox->SetLabel(fAuthenticatorField); fAuthenticationBox->SetLabel(fAuthenticatorField);
rect = fAuthenticationBox->Bounds(); rect = fAuthenticationBox->Bounds();
rect.InsetBy(10, 5); rect.InsetBy(10, 25);
rect.top = 25;
BView *authenticationView = new BView(rect, "authenticationView",
B_FOLLOW_NONE, 0);
authenticationView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
rect = authenticationView->Bounds();
rect.bottom = rect.top + 20; rect.bottom = rect.top + 20;
fUsername = new BTextControl(rect, "username", kLabelName, NULL, NULL); fUsername = new BTextControl(rect, "username", kLabelName, NULL, NULL);
rect.top = rect.bottom + 5; rect.top = rect.bottom + 5;
@@ -437,10 +432,9 @@ GeneralView::GeneralView(GeneralAddon *addon, BRect frame)
rect.bottom = rect.top + 20; rect.bottom = rect.top + 20;
fSavePassword = new BCheckBox(rect, "SavePassword", kLabelSavePassword, NULL); fSavePassword = new BCheckBox(rect, "SavePassword", kLabelSavePassword, NULL);
authenticationView->AddChild(fUsername); fAuthenticationBox->AddChild(fUsername);
authenticationView->AddChild(fPassword); fAuthenticationBox->AddChild(fPassword);
authenticationView->AddChild(fSavePassword); fAuthenticationBox->AddChild(fSavePassword);
fAuthenticationBox->AddChild(authenticationView);
AddChild(fDeviceBox); AddChild(fDeviceBox);
AddChild(fAuthenticationBox); AddChild(fAuthenticationBox);
@@ -49,7 +49,7 @@ PTPSettings::SetDefaultInterface(const char *name)
// load current settings and replace value of "default" with <name> // load current settings and replace value of "default" with <name>
BMessage settings; BMessage settings;
if(!ReadMessageDriverSettings("ptpnet.settings", &settings)) if(!ReadMessageDriverSettings("ptpnet.settings", &settings))
return false; settings.MakeEmpty();
BMessage parameter; BMessage parameter;
int32 index = 0; int32 index = 0;
@@ -58,6 +58,7 @@ PTPSettings::SetDefaultInterface(const char *name)
parameter.MakeEmpty(); parameter.MakeEmpty();
if(name) { if(name) {
parameter.AddString(MDSU_NAME, "default");
parameter.AddString(MDSU_VALUES, name); parameter.AddString(MDSU_VALUES, name);
settings.AddMessage(MDSU_PARAMETERS, &parameter); settings.AddMessage(MDSU_PARAMETERS, &parameter);
} }
@@ -273,6 +274,5 @@ PTPSettings::LoadAddons(bool loadGeneralAddon = true)
fAddons.AddMessage(DUN_AUTHENTICATOR_ADDON_TYPE, &addon); fAddons.AddMessage(DUN_AUTHENTICATOR_ADDON_TYPE, &addon);
// addon.MakeEmpty(); // for next authenticator // addon.MakeEmpty(); // for next authenticator
// TODO: // TODO: load all add-ons from the add-ons folder
// load all add-ons from the add-ons folder
} }