Implemented support for default interface. Not tested.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10540 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3,12 +3,6 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
TODO:
|
|
||||||
- finish |[ ] "Default" | interface handling
|
|
||||||
- if no interface is default a newly created one becomes default
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "DialUpView.h"
|
#include "DialUpView.h"
|
||||||
#include "DialUpAddon.h"
|
#include "DialUpAddon.h"
|
||||||
|
|
||||||
@@ -48,6 +42,7 @@ static const uint32 kMsgFinishCreateNew = 'FNEW';
|
|||||||
static const uint32 kMsgDeleteCurrent = 'DELI';
|
static const uint32 kMsgDeleteCurrent = 'DELI';
|
||||||
static const uint32 kMsgSelectInterface = 'SELI';
|
static const uint32 kMsgSelectInterface = 'SELI';
|
||||||
static const uint32 kMsgConnectButton = 'CONI';
|
static const uint32 kMsgConnectButton = 'CONI';
|
||||||
|
static const uint32 kMsgUpdateDefaultInterface = 'UPDT';
|
||||||
|
|
||||||
// labels
|
// labels
|
||||||
#ifdef LANG_GERMAN
|
#ifdef LANG_GERMAN
|
||||||
@@ -158,7 +153,8 @@ DialUpView::DialUpView(BRect frame)
|
|||||||
rect.bottom -= 2;
|
rect.bottom -= 2;
|
||||||
rect.left = rect.right + 5;
|
rect.left = rect.right + 5;
|
||||||
rect.right = bounds.right - 5;
|
rect.right = bounds.right - 5;
|
||||||
fDefaultInterface = new BCheckBox(rect, "Default", kLabelDefaultInterface, NULL);
|
fDefaultInterface = new BCheckBox(rect, "Default", kLabelDefaultInterface,
|
||||||
|
new BMessage(kMsgUpdateDefaultInterface));
|
||||||
rect.left = bounds.left + 5;
|
rect.left = bounds.left + 5;
|
||||||
rect.top = rect.bottom + 12;
|
rect.top = rect.bottom + 12;
|
||||||
rect.bottom = bounds.bottom
|
rect.bottom = bounds.bottom
|
||||||
@@ -266,6 +262,12 @@ DialUpView::MessageReceived(BMessage *message)
|
|||||||
fCurrentItem->SetMarked(true);
|
fCurrentItem->SetMarked(true);
|
||||||
|
|
||||||
UpdateControls();
|
UpdateControls();
|
||||||
|
|
||||||
|
// a newly created interface is set to default if there is no default one
|
||||||
|
if(!fSettings.DefaultInterface()) {
|
||||||
|
fDefaultInterface->SetValue(true);
|
||||||
|
fSettings.SetDefaultInterface(name);
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
|
|
||||||
@@ -273,13 +275,17 @@ DialUpView::MessageReceived(BMessage *message)
|
|||||||
if(!fCurrentItem)
|
if(!fCurrentItem)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const char *name = fCurrentItem->Message()->FindString("name");
|
||||||
|
if(fSettings.DefaultInterface() && !strcmp(fSettings.DefaultInterface(),
|
||||||
|
name))
|
||||||
|
fSettings.SetDefaultInterface(NULL);
|
||||||
fInterfaceMenu->RemoveItem(fCurrentItem);
|
fInterfaceMenu->RemoveItem(fCurrentItem);
|
||||||
BDirectory settings, profile;
|
BDirectory settings, profile;
|
||||||
fSettings.GetPTPDirectories(&settings, &profile);
|
fSettings.GetPTPDirectories(&settings, &profile);
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
settings.FindEntry(fCurrentItem->Label(), &entry);
|
settings.FindEntry(name, &entry);
|
||||||
entry.Remove();
|
entry.Remove();
|
||||||
profile.FindEntry(fCurrentItem->Label(), &entry);
|
profile.FindEntry(name, &entry);
|
||||||
entry.Remove();
|
entry.Remove();
|
||||||
delete fCurrentItem;
|
delete fCurrentItem;
|
||||||
fCurrentItem = NULL;
|
fCurrentItem = NULL;
|
||||||
@@ -308,6 +314,10 @@ DialUpView::MessageReceived(BMessage *message)
|
|||||||
resume_thread(fUpDownThread);
|
resume_thread(fUpDownThread);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case kMsgUpdateDefaultInterface:
|
||||||
|
UpdateDefaultInterface();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BView::MessageReceived(message);
|
BView::MessageReceived(message);
|
||||||
}
|
}
|
||||||
@@ -324,16 +334,18 @@ DialUpView::UpDownThread()
|
|||||||
driver_settings *temporaryProfile = MessageToDriverSettings(profile);
|
driver_settings *temporaryProfile = MessageToDriverSettings(profile);
|
||||||
|
|
||||||
PPPInterface interface;
|
PPPInterface interface;
|
||||||
if(fWatching == PPP_UNDEFINED_INTERFACE_ID) {
|
ppp_interface_info_t info;
|
||||||
interface = fListener.Manager().InterfaceWithName(fCurrentItem->Label());
|
|
||||||
if(interface.InitCheck() != B_OK)
|
|
||||||
interface = fListener.Manager().CreateInterfaceWithName(
|
|
||||||
fCurrentItem->Label(), temporaryProfile);
|
|
||||||
} else {
|
|
||||||
interface = fWatching;
|
|
||||||
interface.SetProfile(temporaryProfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// if going up: delete interface in order for the settings change to take effect
|
||||||
|
interface = fListener.Manager().InterfaceWithName(
|
||||||
|
fCurrentItem->Message()->FindString("name"));
|
||||||
|
interface.GetInterfaceInfo(&info);
|
||||||
|
if(interface.InitCheck() == B_OK && info.info.phase == PPP_DOWN_PHASE)
|
||||||
|
fListener.Manager().DeleteInterface(interface.ID());
|
||||||
|
|
||||||
|
interface = fListener.Manager().CreateInterfaceWithName(
|
||||||
|
fCurrentItem->Message()->FindString("name"));
|
||||||
|
interface.SetProfile(temporaryProfile);
|
||||||
free_driver_settings(temporaryProfile);
|
free_driver_settings(temporaryProfile);
|
||||||
|
|
||||||
if(interface.InitCheck() != B_OK) {
|
if(interface.InitCheck() != B_OK) {
|
||||||
@@ -343,7 +355,6 @@ DialUpView::UpDownThread()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ppp_interface_info_t info;
|
|
||||||
interface.GetInterfaceInfo(&info);
|
interface.GetInterfaceInfo(&info);
|
||||||
if(info.info.phase == PPP_DOWN_PHASE)
|
if(info.info.phase == PPP_DOWN_PHASE)
|
||||||
interface.Up();
|
interface.Up();
|
||||||
@@ -381,7 +392,7 @@ DialUpView::HandleReportMessage(BMessage *message)
|
|||||||
|
|
||||||
ppp_interface_info_t info;
|
ppp_interface_info_t info;
|
||||||
interface.GetInterfaceInfo(&info);
|
interface.GetInterfaceInfo(&info);
|
||||||
if(strcasecmp(info.info.name, fCurrentItem->Label()))
|
if(strcasecmp(info.info.name, fCurrentItem->Message()->FindString("name")))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WatchInterface(id);
|
WatchInterface(id);
|
||||||
@@ -394,7 +405,8 @@ DialUpView::HandleReportMessage(BMessage *message)
|
|||||||
if(fWatching == PPP_UNDEFINED_INTERFACE_ID)
|
if(fWatching == PPP_UNDEFINED_INTERFACE_ID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WatchInterface(fListener.Manager().InterfaceWithName(fCurrentItem->Label()));
|
WatchInterface(fListener.Manager().InterfaceWithName(
|
||||||
|
fCurrentItem->Message()->FindString("name")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -573,13 +585,18 @@ DialUpView::LoadInterfaces()
|
|||||||
void
|
void
|
||||||
DialUpView::AddInterface(const char *name, bool isNew = false)
|
DialUpView::AddInterface(const char *name, bool isNew = false)
|
||||||
{
|
{
|
||||||
if(fInterfaceMenu->FindItem(name)) {
|
if(FindInterface(name)) {
|
||||||
(new BAlert(kErrorTitle, kErrorInterfaceExists, kLabelOK,
|
(new BAlert(kErrorTitle, kErrorInterfaceExists, kLabelOK,
|
||||||
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
|
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BMenuItem *item = new BMenuItem(name, new BMessage(kMsgSelectInterface));
|
BMessage *message = new BMessage(kMsgSelectInterface);
|
||||||
|
message->AddString("name", name);
|
||||||
|
BString label(name);
|
||||||
|
if(fSettings.DefaultInterface() && label == fSettings.DefaultInterface())
|
||||||
|
label << " (" << kLabelDefaultInterface << ")";
|
||||||
|
BMenuItem *item = new BMenuItem(label.String(), message);
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
int32 index = FindNextMenuInsertionIndex(fInterfaceMenu, name);
|
int32 index = FindNextMenuInsertionIndex(fInterfaceMenu, name);
|
||||||
if(index > CountInterfaces())
|
if(index > CountInterfaces())
|
||||||
@@ -617,9 +634,14 @@ DialUpView::SelectInterface(int32 index, bool isNew = false)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *name = fCurrentItem->Message() ?
|
||||||
|
fCurrentItem->Message()->FindString("name") : NULL;
|
||||||
|
fDefaultInterface->SetValue(fSettings.DefaultInterface() && name
|
||||||
|
&& !strcmp(fSettings.DefaultInterface(), name));
|
||||||
fCurrentItem->SetMarked(true);
|
fCurrentItem->SetMarked(true);
|
||||||
fDeleterItem->SetEnabled(true);
|
fDeleterItem->SetEnabled(true);
|
||||||
WatchInterface(fListener.Manager().InterfaceWithName(fCurrentItem->Label()));
|
fInterfaceMenu->Superitem()->SetLabel(name);
|
||||||
|
WatchInterface(fListener.Manager().InterfaceWithName(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateControls();
|
UpdateControls();
|
||||||
@@ -627,11 +649,13 @@ DialUpView::SelectInterface(int32 index, bool isNew = false)
|
|||||||
if(!fCurrentItem)
|
if(!fCurrentItem)
|
||||||
fSettings.LoadSettings(NULL, false);
|
fSettings.LoadSettings(NULL, false);
|
||||||
// tell modules to unload all settings
|
// tell modules to unload all settings
|
||||||
else if(!isNew && !fSettings.LoadSettings(fCurrentItem->Label(), false)) {
|
else if(!isNew && !fSettings.LoadSettings(
|
||||||
|
fCurrentItem->Message()->FindString("name"), false)) {
|
||||||
(new BAlert(kErrorTitle, kErrorLoadingFailed, kLabelOK,
|
(new BAlert(kErrorTitle, kErrorLoadingFailed, kLabelOK,
|
||||||
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
|
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
|
||||||
fSettings.LoadSettings(fCurrentItem->Label(), true);
|
fSettings.LoadSettings(fCurrentItem->Message()->FindString("name"), true);
|
||||||
} else if(isNew && !fSettings.LoadSettings(fCurrentItem->Label(), true))
|
} else if(isNew && !fSettings.LoadSettings(
|
||||||
|
fCurrentItem->Message()->FindString("name"), true))
|
||||||
(new BAlert(kErrorTitle, kErrorLoadingFailed, kLabelOK,
|
(new BAlert(kErrorTitle, kErrorLoadingFailed, kLabelOK,
|
||||||
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
|
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
|
||||||
}
|
}
|
||||||
@@ -644,6 +668,23 @@ DialUpView::CountInterfaces() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BMenuItem*
|
||||||
|
DialUpView::FindInterface(const char *name)
|
||||||
|
{
|
||||||
|
if(!name)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
BMenuItem *item;
|
||||||
|
for(int32 index = 0; index < fInterfaceMenu->CountItems(); index++) {
|
||||||
|
item = fInterfaceMenu->ItemAt(index);
|
||||||
|
if(item && !strcmp(item->Message()->FindString("name"), name))
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DialUpView::UpdateControls()
|
DialUpView::UpdateControls()
|
||||||
{
|
{
|
||||||
@@ -652,17 +693,20 @@ DialUpView::UpdateControls()
|
|||||||
fStringView->Hide();
|
fStringView->Hide();
|
||||||
fCreateNewButton->Hide();
|
fCreateNewButton->Hide();
|
||||||
fTabView->Show();
|
fTabView->Show();
|
||||||
|
fDefaultInterface->Show();
|
||||||
fConnectButton->SetEnabled(true);
|
fConnectButton->SetEnabled(true);
|
||||||
} else if(!fTabView->IsHidden() && CountInterfaces() == 0) {
|
} else if(!fTabView->IsHidden() && CountInterfaces() == 0) {
|
||||||
fDeleterItem->SetEnabled(false);
|
fDeleterItem->SetEnabled(false);
|
||||||
fInterfaceMenu->SetRadioMode(false);
|
fInterfaceMenu->SetRadioMode(false);
|
||||||
fInterfaceMenu->Superitem()->SetLabel(kLabelCreateNew);
|
fInterfaceMenu->Superitem()->SetLabel(kLabelCreateNew);
|
||||||
fTabView->Hide();
|
fTabView->Hide();
|
||||||
|
fDefaultInterface->Hide();
|
||||||
fStringView->Show();
|
fStringView->Show();
|
||||||
fCreateNewButton->Show();
|
fCreateNewButton->Show();
|
||||||
fConnectButton->SetEnabled(false);
|
fConnectButton->SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// move default checkbox next to interface menu (its size might have changed)
|
||||||
float width = fInterfaceMenu->StringWidth(fMenuField->Label())
|
float width = fInterfaceMenu->StringWidth(fMenuField->Label())
|
||||||
+ fInterfaceMenu->StringWidth(fInterfaceMenu->Superitem()->Label()) + 30;
|
+ fInterfaceMenu->StringWidth(fInterfaceMenu->Superitem()->Label()) + 30;
|
||||||
if(width > kInterfaceFieldWidth)
|
if(width > kInterfaceFieldWidth)
|
||||||
@@ -670,3 +714,26 @@ DialUpView::UpdateControls()
|
|||||||
fDefaultInterface->MoveTo(fMenuField->Frame().left + width,
|
fDefaultInterface->MoveTo(fMenuField->Frame().left + width,
|
||||||
fDefaultInterface->Frame().top);
|
fDefaultInterface->Frame().top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DialUpView::UpdateDefaultInterface()
|
||||||
|
{
|
||||||
|
const char *name = fCurrentItem->Message()->FindString("name");
|
||||||
|
BMenuItem *defaultItem = FindInterface(fSettings.DefaultInterface());
|
||||||
|
if(fDefaultInterface->Value()) {
|
||||||
|
if(!fSettings.SetDefaultInterface(name)) {
|
||||||
|
fDefaultInterface->SetValue(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(defaultItem)
|
||||||
|
defaultItem->SetLabel(defaultItem->Message()->FindString("name"));
|
||||||
|
|
||||||
|
BString label(name);
|
||||||
|
label << " (" << kLabelDefaultInterface << ")";
|
||||||
|
fCurrentItem->SetLabel(label.String());
|
||||||
|
} else {
|
||||||
|
fSettings.SetDefaultInterface(NULL);
|
||||||
|
fCurrentItem->SetLabel(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -38,8 +38,10 @@ class DialUpView : public BView {
|
|||||||
void AddInterface(const char *name, bool isNew = false);
|
void AddInterface(const char *name, bool isNew = false);
|
||||||
void SelectInterface(int32 index, bool isNew = false);
|
void SelectInterface(int32 index, bool isNew = false);
|
||||||
int32 CountInterfaces() const;
|
int32 CountInterfaces() const;
|
||||||
|
BMenuItem *FindInterface(const char *name);
|
||||||
|
|
||||||
void UpdateControls();
|
void UpdateControls();
|
||||||
|
void UpdateDefaultInterface();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PPPInterfaceListener fListener;
|
PPPInterfaceListener fListener;
|
||||||
|
|||||||
@@ -17,15 +17,22 @@
|
|||||||
|
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
|
#include <driver_settings.h>
|
||||||
|
|
||||||
|
|
||||||
PTPSettings::PTPSettings()
|
PTPSettings::PTPSettings()
|
||||||
{
|
{
|
||||||
|
void *handle = load_driver_settings("ptpnet.settings");
|
||||||
|
const char *name = get_driver_parameter(handle, "default", NULL, NULL);
|
||||||
|
fDefaultInterface = name ? strdup(name) : NULL;
|
||||||
|
unload_driver_settings(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PTPSettings::~PTPSettings()
|
PTPSettings::~PTPSettings()
|
||||||
{
|
{
|
||||||
|
free(fDefaultInterface);
|
||||||
|
|
||||||
// free known add-on types (these should free their known add-on types, etc.)
|
// free known add-on types (these should free their known add-on types, etc.)
|
||||||
DialUpAddon *addon;
|
DialUpAddon *addon;
|
||||||
for(int32 index = 0;
|
for(int32 index = 0;
|
||||||
@@ -36,15 +43,47 @@ PTPSettings::~PTPSettings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
PTPSettings::SetDefaultInterface(const char *name)
|
||||||
|
{
|
||||||
|
// load current settings and replace value of "default" with <name>
|
||||||
|
BMessage settings;
|
||||||
|
if(!ReadMessageDriverSettings("ptpnet.settings", &settings))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
BMessage parameter;
|
||||||
|
int32 index = 0;
|
||||||
|
if(FindMessageParameter("default", settings, ¶meter, &index))
|
||||||
|
settings.RemoveData(MDSU_PARAMETERS, index);
|
||||||
|
|
||||||
|
parameter.MakeEmpty();
|
||||||
|
if(name) {
|
||||||
|
parameter.AddString(MDSU_VALUES, name);
|
||||||
|
settings.AddMessage(MDSU_PARAMETERS, ¶meter);
|
||||||
|
}
|
||||||
|
|
||||||
|
BFile file(PTP_SETTINGS_PATH, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
|
if(file.InitCheck() != B_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(WriteMessageDriverSettings(file, settings)) {
|
||||||
|
free(fDefaultInterface);
|
||||||
|
fDefaultInterface = name ? strdup(name) : NULL;
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PTPSettings::GetPTPDirectories(BDirectory *settingsDirectory,
|
PTPSettings::GetPTPDirectories(BDirectory *settingsDirectory,
|
||||||
BDirectory *profileDirectory) const
|
BDirectory *profileDirectory) const
|
||||||
{
|
{
|
||||||
if(settingsDirectory) {
|
if(settingsDirectory) {
|
||||||
BDirectory settings(PPP_INTERFACE_SETTINGS_PATH);
|
BDirectory settings(PTP_INTERFACE_SETTINGS_PATH);
|
||||||
if(settings.InitCheck() != B_OK) {
|
if(settings.InitCheck() != B_OK) {
|
||||||
create_directory(PPP_INTERFACE_SETTINGS_PATH, 0750);
|
create_directory(PTP_INTERFACE_SETTINGS_PATH, 0750);
|
||||||
settings.SetTo(PPP_INTERFACE_SETTINGS_PATH);
|
settings.SetTo(PTP_INTERFACE_SETTINGS_PATH);
|
||||||
if(settings.InitCheck() != B_OK)
|
if(settings.InitCheck() != B_OK)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -53,10 +92,10 @@ PTPSettings::GetPTPDirectories(BDirectory *settingsDirectory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(profileDirectory) {
|
if(profileDirectory) {
|
||||||
BDirectory profile(PPP_INTERFACE_SETTINGS_PATH "/profile");
|
BDirectory profile(PTP_INTERFACE_SETTINGS_PATH "/profile");
|
||||||
if(profile.InitCheck() != B_OK) {
|
if(profile.InitCheck() != B_OK) {
|
||||||
create_directory(PPP_INTERFACE_SETTINGS_PATH "/profile", 0750);
|
create_directory(PTP_INTERFACE_SETTINGS_PATH "/profile", 0750);
|
||||||
profile.SetTo(PPP_INTERFACE_SETTINGS_PATH "/profile");
|
profile.SetTo(PTP_INTERFACE_SETTINGS_PATH "/profile");
|
||||||
if(profile.InitCheck() != B_OK)
|
if(profile.InitCheck() != B_OK)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -81,11 +120,11 @@ PTPSettings::LoadSettings(const char *interfaceName, bool isNew)
|
|||||||
*profilePointer = interfaceName ? &fProfile : NULL;
|
*profilePointer = interfaceName ? &fProfile : NULL;
|
||||||
|
|
||||||
if(interfaceName && !isNew) {
|
if(interfaceName && !isNew) {
|
||||||
BString name("pppidf/");
|
BString name("ptpnet/");
|
||||||
name << fCurrent;
|
name << fCurrent;
|
||||||
if(!ReadMessageDriverSettings(name.String(), &fSettings))
|
if(!ReadMessageDriverSettings(name.String(), &fSettings))
|
||||||
return false;
|
return false;
|
||||||
name = "pppidf/profile/";
|
name = "ptpnet/profile/";
|
||||||
name << fCurrent;
|
name << fCurrent;
|
||||||
if(!ReadMessageDriverSettings(name.String(), &fProfile))
|
if(!ReadMessageDriverSettings(name.String(), &fProfile))
|
||||||
profilePointer = settingsPointer;
|
profilePointer = settingsPointer;
|
||||||
@@ -151,6 +190,11 @@ PTPSettings::SaveSettings(BMessage *settings, BMessage *profile, bool saveTempor
|
|||||||
addons.AddItem(addon, insertIndex);
|
addons.AddItem(addon, insertIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// prepare for next release with support different PTP types
|
||||||
|
BMessage parameter;
|
||||||
|
parameter.AddString(MDSU_NAME, "PTPType");
|
||||||
|
parameter.AddString(MDSU_VALUES, "ppp");
|
||||||
|
settings->AddMessage(MDSU_PARAMETERS, ¶meter);
|
||||||
settings->AddString("InterfaceName", fCurrent);
|
settings->AddString("InterfaceName", fCurrent);
|
||||||
|
|
||||||
for(int32 index = 0; index < addons.CountItems(); index++)
|
for(int32 index = 0; index < addons.CountItems(); index++)
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ class PTPSettings {
|
|||||||
const BString& CurrentInterface() const
|
const BString& CurrentInterface() const
|
||||||
{ return fCurrent; }
|
{ return fCurrent; }
|
||||||
|
|
||||||
|
bool SetDefaultInterface(const char *name);
|
||||||
|
const char *DefaultInterface() const
|
||||||
|
{ return fDefaultInterface; }
|
||||||
|
|
||||||
bool GetPTPDirectories(BDirectory *settingsDirectory,
|
bool GetPTPDirectories(BDirectory *settingsDirectory,
|
||||||
BDirectory *profileDirectory) const;
|
BDirectory *profileDirectory) const;
|
||||||
|
|
||||||
@@ -34,6 +38,7 @@ class PTPSettings {
|
|||||||
private:
|
private:
|
||||||
BMessage fAddons, fSettings, fProfile;
|
BMessage fAddons, fSettings, fProfile;
|
||||||
BString fCurrent;
|
BString fCurrent;
|
||||||
|
char *fDefaultInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user