Put module and settings handling into libptpnet.a. This is the beginning of the userland part of our PTP (Point-To-Point interfaces) library which is responsible for every kind of connection kind that has exactly two endpoints.
Some other changes I do not remember. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10116 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2003-2004 Waldemar Kornewald, [email protected]
|
* Copyright 2003-2004, Waldemar Kornewald <[email protected]>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// ConnectionOptionsAddon saves the loaded settings.
|
// ConnectionOptionsAddon saves the loaded settings.
|
||||||
@@ -46,8 +29,8 @@ static const char *kLabelAutoRedial = "Verbindung Automatisch Wiederherstellen";
|
|||||||
#else
|
#else
|
||||||
static const char *kLabelConnectionOptions = "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 Connecting";
|
||||||
static const char *kLabelAutoRedial = "Redial Automatically";
|
static const char *kLabelAutoRedial = "Reconnect Automatically";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -57,11 +40,15 @@ ConnectionOptionsAddon::ConnectionOptionsAddon(BMessage *addons)
|
|||||||
fProfile(NULL),
|
fProfile(NULL),
|
||||||
fConnectionOptionsView(NULL)
|
fConnectionOptionsView(NULL)
|
||||||
{
|
{
|
||||||
|
CreateView(BPoint(0,0));
|
||||||
|
fDeleteView = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ConnectionOptionsAddon::~ConnectionOptionsAddon()
|
ConnectionOptionsAddon::~ConnectionOptionsAddon()
|
||||||
{
|
{
|
||||||
|
if(fDeleteView)
|
||||||
|
delete fConnectionOptionsView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -73,9 +60,8 @@ ConnectionOptionsAddon::LoadSettings(BMessage *settings, BMessage *profile, bool
|
|||||||
fSettings = settings;
|
fSettings = settings;
|
||||||
fProfile = profile;
|
fProfile = profile;
|
||||||
|
|
||||||
if(fConnectionOptionsView)
|
fConnectionOptionsView->Reload();
|
||||||
fConnectionOptionsView->Reload();
|
// reset all views (empty settings)
|
||||||
// reset all views (empty settings)
|
|
||||||
|
|
||||||
if(!settings || !profile || isNew)
|
if(!settings || !profile || isNew)
|
||||||
return true;
|
return true;
|
||||||
@@ -112,9 +98,8 @@ ConnectionOptionsAddon::LoadSettings(BMessage *settings, BMessage *profile, bool
|
|||||||
fSettings->ReplaceMessage(MDSU_PARAMETERS, index, ¶meter);
|
fSettings->ReplaceMessage(MDSU_PARAMETERS, index, ¶meter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fConnectionOptionsView)
|
fConnectionOptionsView->Reload();
|
||||||
fConnectionOptionsView->Reload();
|
// reload new settings
|
||||||
// reload new settings
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -135,7 +120,8 @@ ConnectionOptionsAddon::IsModified(bool *settings, bool *profile) const
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ConnectionOptionsAddon::SaveSettings(BMessage *settings, BMessage *profile, bool saveTemporary)
|
ConnectionOptionsAddon::SaveSettings(BMessage *settings, BMessage *profile,
|
||||||
|
bool saveTemporary)
|
||||||
{
|
{
|
||||||
if(!fSettings || !settings)
|
if(!fSettings || !settings)
|
||||||
return false;
|
return false;
|
||||||
@@ -190,10 +176,12 @@ ConnectionOptionsAddon::CreateView(BPoint leftTop)
|
|||||||
BRect rect;
|
BRect rect;
|
||||||
Addons()->FindRect(DUN_TAB_VIEW_RECT, &rect);
|
Addons()->FindRect(DUN_TAB_VIEW_RECT, &rect);
|
||||||
fConnectionOptionsView = new ConnectionOptionsView(this, rect);
|
fConnectionOptionsView = new ConnectionOptionsView(this, rect);
|
||||||
fConnectionOptionsView->Reload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fDeleteView = false;
|
||||||
|
|
||||||
fConnectionOptionsView->MoveTo(leftTop);
|
fConnectionOptionsView->MoveTo(leftTop);
|
||||||
|
fConnectionOptionsView->Reload();
|
||||||
return fConnectionOptionsView;
|
return fConnectionOptionsView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2003-2004 Waldemar Kornewald, [email protected]
|
* Copyright 2003-2004, Waldemar Kornewald <[email protected]>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// ConnectionOptionsAddon saves the loaded settings.
|
// ConnectionOptionsAddon saves the loaded settings.
|
||||||
@@ -66,7 +49,7 @@ class ConnectionOptionsAddon : public DialUpAddon {
|
|||||||
virtual BView *CreateView(BPoint leftTop);
|
virtual BView *CreateView(BPoint leftTop);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool fIsNew;
|
bool fIsNew, fDeleteView;
|
||||||
bool fDoesDialOnDemand, fAskBeforeDialing, fDoesAutoRedial;
|
bool fDoesDialOnDemand, fAskBeforeDialing, fDoesAutoRedial;
|
||||||
BMessage *fSettings, *fProfile;
|
BMessage *fSettings, *fProfile;
|
||||||
// saves last settings state
|
// saves last settings state
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, [email protected]
|
* Copyright 2003-2004, Haiku Inc.
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
/*! \class DialUpAddon
|
/*! \class DialUpAddon
|
||||||
\brief Base class for DialUpPreflet add-ons.
|
\brief Base class for DialUpPreflet add-ons.
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2003-2004 Waldemar Kornewald, [email protected]
|
* Copyright 2003-2004, Waldemar Kornewald <[email protected]>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2003-2004 Waldemar Kornewald, [email protected]
|
* Copyright 2003-2004, Waldemar Kornewald <[email protected]>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#include "DialUpView.h"
|
#include "DialUpView.h"
|
||||||
#include "DialUpAddon.h"
|
#include "DialUpAddon.h"
|
||||||
@@ -28,12 +11,6 @@
|
|||||||
#include "MessageDriverSettingsUtils.h"
|
#include "MessageDriverSettingsUtils.h"
|
||||||
#include "TextRequestDialog.h"
|
#include "TextRequestDialog.h"
|
||||||
|
|
||||||
// built-in add-ons
|
|
||||||
#include "ConnectionOptionsAddon.h"
|
|
||||||
#include "GeneralAddon.h"
|
|
||||||
#include "IPCPAddon.h"
|
|
||||||
#include "PPPoEAddon.h"
|
|
||||||
|
|
||||||
#include <PPPInterface.h>
|
#include <PPPInterface.h>
|
||||||
#include <settings_tools.h>
|
#include <settings_tools.h>
|
||||||
#include <TemplateList.h>
|
#include <TemplateList.h>
|
||||||
@@ -51,7 +28,6 @@
|
|||||||
|
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <File.h>
|
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -145,7 +121,6 @@ DialUpView::DialUpView(BRect frame)
|
|||||||
: BView(frame, "DialUpView", B_FOLLOW_NONE, 0),
|
: BView(frame, "DialUpView", B_FOLLOW_NONE, 0),
|
||||||
fListener(this),
|
fListener(this),
|
||||||
fUpDownThread(-1),
|
fUpDownThread(-1),
|
||||||
fDriverSettings(NULL),
|
|
||||||
fCurrentItem(NULL),
|
fCurrentItem(NULL),
|
||||||
fWatching(PPP_UNDEFINED_INTERFACE_ID),
|
fWatching(PPP_UNDEFINED_INTERFACE_ID),
|
||||||
fKeepLabel(false)
|
fKeepLabel(false)
|
||||||
@@ -156,7 +131,7 @@ DialUpView::DialUpView(BRect frame)
|
|||||||
|
|
||||||
// add messenger to us so add-ons can contact us
|
// add messenger to us so add-ons can contact us
|
||||||
BMessenger messenger(this);
|
BMessenger messenger(this);
|
||||||
fAddons.AddMessenger(DUN_MESSENGER, messenger);
|
fSettings.Addons().AddMessenger(DUN_MESSENGER, messenger);
|
||||||
|
|
||||||
// create pop-up with all interfaces and "New..."/"Delete current" items
|
// create pop-up with all interfaces and "New..."/"Delete current" items
|
||||||
fInterfaceMenu = new BPopUpMenu(kLabelCreateNew);
|
fInterfaceMenu = new BPopUpMenu(kLabelCreateNew);
|
||||||
@@ -173,7 +148,7 @@ DialUpView::DialUpView(BRect frame)
|
|||||||
fTabView = new BTabView(rect, "TabView", B_WIDTH_FROM_LABEL);
|
fTabView = new BTabView(rect, "TabView", B_WIDTH_FROM_LABEL);
|
||||||
BRect tabViewRect(fTabView->Bounds());
|
BRect tabViewRect(fTabView->Bounds());
|
||||||
tabViewRect.bottom -= fTabView->TabHeight();
|
tabViewRect.bottom -= fTabView->TabHeight();
|
||||||
fAddons.AddRect(DUN_TAB_VIEW_RECT, tabViewRect);
|
fSettings.Addons().AddRect(DUN_TAB_VIEW_RECT, tabViewRect);
|
||||||
|
|
||||||
BRect tmpRect(rect);
|
BRect tmpRect(rect);
|
||||||
tmpRect.top += (tmpRect.Height() - 15) / 2;
|
tmpRect.top += (tmpRect.Height() - 15) / 2;
|
||||||
@@ -211,7 +186,7 @@ DialUpView::DialUpView(BRect frame)
|
|||||||
|
|
||||||
// initialize
|
// initialize
|
||||||
LoadInterfaces();
|
LoadInterfaces();
|
||||||
LoadAddons();
|
fSettings.LoadAddons();
|
||||||
CreateTabs();
|
CreateTabs();
|
||||||
fCurrentItem = NULL;
|
fCurrentItem = NULL;
|
||||||
// reset, otherwise SelectInterface will not load the settings
|
// reset, otherwise SelectInterface will not load the settings
|
||||||
@@ -222,18 +197,10 @@ DialUpView::DialUpView(BRect frame)
|
|||||||
|
|
||||||
DialUpView::~DialUpView()
|
DialUpView::~DialUpView()
|
||||||
{
|
{
|
||||||
SaveSettingsToFile();
|
fSettings.SaveSettingsToFile();
|
||||||
|
|
||||||
int32 tmp;
|
int32 tmp;
|
||||||
wait_for_thread(fUpDownThread, &tmp);
|
wait_for_thread(fUpDownThread, &tmp);
|
||||||
|
|
||||||
// free known add-on types (these should free their known add-on types, etc.)
|
|
||||||
DialUpAddon *addon;
|
|
||||||
for(int32 index = 0;
|
|
||||||
fAddons.FindPointer(DUN_DELETE_ON_QUIT, index,
|
|
||||||
reinterpret_cast<void**>(&addon)) == B_OK;
|
|
||||||
index++)
|
|
||||||
delete addon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -285,7 +252,7 @@ DialUpView::MessageReceived(BMessage *message)
|
|||||||
|
|
||||||
fInterfaceMenu->RemoveItem(fCurrentItem);
|
fInterfaceMenu->RemoveItem(fCurrentItem);
|
||||||
BDirectory settings, profile;
|
BDirectory settings, profile;
|
||||||
GetPPPDirectories(&settings, &profile);
|
fSettings.GetPTPDirectories(&settings, &profile);
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
settings.FindEntry(fCurrentItem->Label(), &entry);
|
settings.FindEntry(fCurrentItem->Label(), &entry);
|
||||||
entry.Remove();
|
entry.Remove();
|
||||||
@@ -324,179 +291,12 @@ DialUpView::MessageReceived(BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
DialUpView::SelectInterfaceNamed(const char *name)
|
|
||||||
{
|
|
||||||
BMenuItem *item = fInterfaceMenu->FindItem(name);
|
|
||||||
|
|
||||||
int32 index = fInterfaceMenu->IndexOf(item);
|
|
||||||
if(!item || index >= CountInterfaces())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
SelectInterface(index);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
DialUpView::NeedsRequest() const
|
|
||||||
{
|
|
||||||
return fGeneralAddon ? fGeneralAddon->NeedsAuthenticationRequest() : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BView*
|
|
||||||
DialUpView::AuthenticationView() const
|
|
||||||
{
|
|
||||||
return fGeneralAddon ? fGeneralAddon->AuthenticationView() : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BView*
|
|
||||||
DialUpView::StatusView() const
|
|
||||||
{
|
|
||||||
return fStatusView;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BView*
|
|
||||||
DialUpView::ConnectButton() const
|
|
||||||
{
|
|
||||||
return fConnectButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
DialUpView::LoadSettings(bool isNew)
|
|
||||||
{
|
|
||||||
fSettings.MakeEmpty();
|
|
||||||
fProfile.MakeEmpty();
|
|
||||||
BMessage *settingsPointer = fCurrentItem ? &fSettings : NULL,
|
|
||||||
*profilePointer = fCurrentItem ? &fProfile : NULL;
|
|
||||||
|
|
||||||
if(fCurrentItem && !isNew) {
|
|
||||||
BString name("pppidf/");
|
|
||||||
name << fCurrentItem->Label();
|
|
||||||
if(!ReadMessageDriverSettings(name.String(), &fSettings))
|
|
||||||
return false;
|
|
||||||
name = "pppidf/profile/";
|
|
||||||
name << fCurrentItem->Label();
|
|
||||||
if(!ReadMessageDriverSettings(name.String(), &fProfile))
|
|
||||||
profilePointer = settingsPointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
DialUpAddon *addon;
|
|
||||||
for(int32 index = 0; fAddons.FindPointer(DUN_TAB_ADDON_TYPE, index,
|
|
||||||
reinterpret_cast<void**>(&addon)) == B_OK; index++) {
|
|
||||||
if(!addon)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(!addon->LoadSettings(settingsPointer, profilePointer, isNew))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: check if settings are valid
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
DialUpView::IsModified(bool *settings, bool *profile)
|
|
||||||
{
|
|
||||||
*settings = *profile = false;
|
|
||||||
bool addonSettingsChanged, addonProfileChanged;
|
|
||||||
// for current addon
|
|
||||||
|
|
||||||
DialUpAddon *addon;
|
|
||||||
for(int32 index = 0; fAddons.FindPointer(DUN_TAB_ADDON_TYPE, index,
|
|
||||||
reinterpret_cast<void**>(&addon)) == B_OK; index++) {
|
|
||||||
if(!addon)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
addon->IsModified(&addonSettingsChanged, &addonProfileChanged);
|
|
||||||
if(addonSettingsChanged)
|
|
||||||
*settings = true;
|
|
||||||
if(addonProfileChanged)
|
|
||||||
*profile = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
DialUpView::SaveSettings(BMessage *settings, BMessage *profile, bool saveTemporary)
|
|
||||||
{
|
|
||||||
if(!fCurrentItem || !settings || !profile)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
DialUpAddon *addon;
|
|
||||||
TemplateList<DialUpAddon*> addons;
|
|
||||||
for(int32 index = 0;
|
|
||||||
fAddons.FindPointer(DUN_TAB_ADDON_TYPE, index,
|
|
||||||
reinterpret_cast<void**>(&addon)) == B_OK; index++) {
|
|
||||||
if(!addon)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
int32 insertIndex = 0;
|
|
||||||
for(; insertIndex < addons.CountItems(); insertIndex++)
|
|
||||||
if(addons.ItemAt(insertIndex)->Priority() <= addon->Priority())
|
|
||||||
break;
|
|
||||||
|
|
||||||
addons.AddItem(addon, insertIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
settings->AddInt32("Interface", static_cast<int32>(fWatching));
|
|
||||||
if(fCurrentItem)
|
|
||||||
settings->AddString("InterfaceName", fCurrentItem->Label());
|
|
||||||
|
|
||||||
for(int32 index = 0; index < addons.CountItems(); index++)
|
|
||||||
if(!addons.ItemAt(index)->SaveSettings(settings, profile, saveTemporary))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
DialUpView::SaveSettingsToFile()
|
|
||||||
{
|
|
||||||
bool settingsChanged, profileChanged;
|
|
||||||
IsModified(&settingsChanged, &profileChanged);
|
|
||||||
if(!settingsChanged && !profileChanged)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
BMessage settings, profile;
|
|
||||||
if(!SaveSettings(&settings, &profile, false))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
BDirectory settingsDirectory;
|
|
||||||
BDirectory profileDirectory;
|
|
||||||
GetPPPDirectories(&settingsDirectory, &profileDirectory);
|
|
||||||
if(settingsDirectory.InitCheck() != B_OK || profileDirectory.InitCheck() != B_OK)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
BFile file;
|
|
||||||
if(settingsChanged) {
|
|
||||||
settingsDirectory.CreateFile(fCurrentItem->Label(), &file);
|
|
||||||
WriteMessageDriverSettings(file, settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(profileChanged) {
|
|
||||||
profileDirectory.CreateFile(fCurrentItem->Label(), &file);
|
|
||||||
WriteMessageDriverSettings(file, profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DialUpView::UpDownThread()
|
DialUpView::UpDownThread()
|
||||||
{
|
{
|
||||||
SaveSettingsToFile();
|
fSettings.SaveSettingsToFile();
|
||||||
BMessage settings, profile;
|
BMessage settings, profile;
|
||||||
SaveSettings(&settings, &profile, true);
|
fSettings.SaveSettings(&settings, &profile, true);
|
||||||
// save temporary profile
|
// save temporary profile
|
||||||
driver_settings *temporaryProfile = MessageToDriverSettings(profile);
|
driver_settings *temporaryProfile = MessageToDriverSettings(profile);
|
||||||
|
|
||||||
@@ -531,32 +331,6 @@ DialUpView::UpDownThread()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
DialUpView::GetPPPDirectories(BDirectory *settingsDirectory,
|
|
||||||
BDirectory *profileDirectory) const
|
|
||||||
{
|
|
||||||
if(settingsDirectory) {
|
|
||||||
BDirectory settings(PPP_INTERFACE_SETTINGS_PATH);
|
|
||||||
if(settings.InitCheck() != B_OK) {
|
|
||||||
create_directory(PPP_INTERFACE_SETTINGS_PATH, 0750);
|
|
||||||
settings.SetTo(PPP_INTERFACE_SETTINGS_PATH);
|
|
||||||
}
|
|
||||||
|
|
||||||
*settingsDirectory = settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(profileDirectory) {
|
|
||||||
BDirectory profile(PPP_INTERFACE_SETTINGS_PATH "/profile");
|
|
||||||
if(profile.InitCheck() != B_OK) {
|
|
||||||
create_directory(PPP_INTERFACE_SETTINGS_PATH "/profile", 0750);
|
|
||||||
profile.SetTo(PPP_INTERFACE_SETTINGS_PATH "/profile");
|
|
||||||
}
|
|
||||||
|
|
||||||
*profileDirectory = profile;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DialUpView::HandleReportMessage(BMessage *message)
|
DialUpView::HandleReportMessage(BMessage *message)
|
||||||
{
|
{
|
||||||
@@ -612,7 +386,7 @@ DialUpView::CreateTabs()
|
|||||||
TemplateList<DialUpAddon*> addons;
|
TemplateList<DialUpAddon*> addons;
|
||||||
|
|
||||||
for(int32 index = 0;
|
for(int32 index = 0;
|
||||||
fAddons.FindPointer(DUN_TAB_ADDON_TYPE, index,
|
fSettings.Addons().FindPointer(DUN_TAB_ADDON_TYPE, index,
|
||||||
reinterpret_cast<void**>(&addon)) == B_OK;
|
reinterpret_cast<void**>(&addon)) == B_OK;
|
||||||
index++) {
|
index++) {
|
||||||
if(!addon || addon->Position() < 0)
|
if(!addon || addon->Position() < 0)
|
||||||
@@ -763,7 +537,7 @@ DialUpView::LoadInterfaces()
|
|||||||
BDirectory settingsDirectory;
|
BDirectory settingsDirectory;
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
BPath path;
|
BPath path;
|
||||||
GetPPPDirectories(&settingsDirectory, NULL);
|
fSettings.GetPTPDirectories(&settingsDirectory, NULL);
|
||||||
while(settingsDirectory.GetNextEntry(&entry) == B_OK) {
|
while(settingsDirectory.GetNextEntry(&entry) == B_OK) {
|
||||||
if(entry.IsFile()) {
|
if(entry.IsFile()) {
|
||||||
entry.GetPath(&path);
|
entry.GetPath(&path);
|
||||||
@@ -774,47 +548,7 @@ DialUpView::LoadInterfaces()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DialUpView::LoadAddons()
|
DialUpView::AddInterface(const char *name, bool isNew = false)
|
||||||
{
|
|
||||||
// Load integrated add-ons:
|
|
||||||
// "Connection Options" tab
|
|
||||||
ConnectionOptionsAddon *connectionOptionsAddon =
|
|
||||||
new ConnectionOptionsAddon(&fAddons);
|
|
||||||
fAddons.AddPointer(DUN_TAB_ADDON_TYPE, connectionOptionsAddon);
|
|
||||||
fAddons.AddPointer(DUN_DELETE_ON_QUIT, connectionOptionsAddon);
|
|
||||||
// "General" tab
|
|
||||||
GeneralAddon *fGeneralAddon = new GeneralAddon(&fAddons);
|
|
||||||
fAddons.AddPointer(DUN_TAB_ADDON_TYPE, fGeneralAddon);
|
|
||||||
fAddons.AddPointer(DUN_DELETE_ON_QUIT, fGeneralAddon);
|
|
||||||
|
|
||||||
// "IPCP" protocol
|
|
||||||
IPCPAddon *ipcpAddon = new IPCPAddon(&fAddons);
|
|
||||||
fAddons.AddPointer(DUN_TAB_ADDON_TYPE, ipcpAddon);
|
|
||||||
fAddons.AddPointer(DUN_DELETE_ON_QUIT, ipcpAddon);
|
|
||||||
// "PPPoE" device
|
|
||||||
PPPoEAddon *pppoeAddon = new PPPoEAddon(&fAddons);
|
|
||||||
fAddons.AddPointer(DUN_DEVICE_ADDON_TYPE, pppoeAddon);
|
|
||||||
fAddons.AddPointer(DUN_DELETE_ON_QUIT, pppoeAddon);
|
|
||||||
|
|
||||||
// "PAP" authenticator
|
|
||||||
BMessage addon;
|
|
||||||
#ifdef LANG_GERMAN
|
|
||||||
addon.AddString("FriendlyName", "Unverschlüsselt");
|
|
||||||
#else
|
|
||||||
addon.AddString("FriendlyName", "Plain-text Authentication");
|
|
||||||
#endif
|
|
||||||
addon.AddString("TechnicalName", "PAP");
|
|
||||||
addon.AddString("KernelModuleName", "pap");
|
|
||||||
fAddons.AddMessage(DUN_AUTHENTICATOR_ADDON_TYPE, &addon);
|
|
||||||
// addon.MakeEmpty(); // for next authenticator
|
|
||||||
|
|
||||||
// TODO:
|
|
||||||
// load all add-ons from the add-ons folder
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
DialUpView::AddInterface(const char *name, bool isNew)
|
|
||||||
{
|
{
|
||||||
if(fInterfaceMenu->FindItem(name)) {
|
if(fInterfaceMenu->FindItem(name)) {
|
||||||
(new BAlert(kErrorTitle, kErrorInterfaceExists, kLabelOK,
|
(new BAlert(kErrorTitle, kErrorInterfaceExists, kLabelOK,
|
||||||
@@ -836,13 +570,13 @@ DialUpView::AddInterface(const char *name, bool isNew)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DialUpView::SelectInterface(int32 index, bool isNew)
|
DialUpView::SelectInterface(int32 index, bool isNew = false)
|
||||||
{
|
{
|
||||||
BMenuItem *item = fInterfaceMenu->FindMarked();
|
BMenuItem *item = fInterfaceMenu->FindMarked();
|
||||||
if(fCurrentItem && item == fCurrentItem)
|
if(fCurrentItem && item == fCurrentItem)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(fCurrentItem && !SaveSettingsToFile())
|
if(fCurrentItem && !fSettings.SaveSettingsToFile())
|
||||||
(new BAlert(kErrorTitle, kErrorSavingFailed, kLabelOK,
|
(new BAlert(kErrorTitle, kErrorSavingFailed, kLabelOK,
|
||||||
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
|
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
|
||||||
|
|
||||||
@@ -866,13 +600,13 @@ DialUpView::SelectInterface(int32 index, bool isNew)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!fCurrentItem)
|
if(!fCurrentItem)
|
||||||
LoadSettings(false);
|
fSettings.LoadSettings(NULL, false);
|
||||||
// tell modules to unload all settings
|
// tell modules to unload all settings
|
||||||
else if(!isNew && !LoadSettings(false)) {
|
else if(!isNew && !fSettings.LoadSettings(fCurrentItem->Label(), 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);
|
||||||
LoadSettings(true);
|
fSettings.LoadSettings(fCurrentItem->Label(), true);
|
||||||
} else if(isNew && !LoadSettings(true))
|
} else if(isNew && !fSettings.LoadSettings(fCurrentItem->Label(), 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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2003-2004 Waldemar Kornewald, [email protected]
|
* Copyright 2003-2004, Waldemar Kornewald <[email protected]>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifndef _DIAL_UP_VIEW__H
|
#ifndef _DIAL_UP_VIEW__H
|
||||||
#define _DIAL_UP_VIEW__H
|
#define _DIAL_UP_VIEW__H
|
||||||
@@ -27,8 +10,7 @@
|
|||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
#include <PPPInterfaceListener.h>
|
#include <PPPInterfaceListener.h>
|
||||||
|
#include <PTPSettings.h>
|
||||||
class GeneralAddon;
|
|
||||||
|
|
||||||
|
|
||||||
class DialUpView : public BView {
|
class DialUpView : public BView {
|
||||||
@@ -41,15 +23,6 @@ class DialUpView : public BView {
|
|||||||
|
|
||||||
void UpDownThread();
|
void UpDownThread();
|
||||||
|
|
||||||
// used by ppp_up application
|
|
||||||
bool SelectInterfaceNamed(const char *name);
|
|
||||||
bool NeedsRequest() const;
|
|
||||||
BView *AuthenticationView() const;
|
|
||||||
BView *StatusView() const;
|
|
||||||
BView *ConnectButton() const;
|
|
||||||
bool SaveSettings(BMessage *settings, BMessage *profile, bool saveTemporary);
|
|
||||||
bool SaveSettingsToFile();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void GetPPPDirectories(BDirectory *settingsDirectory,
|
void GetPPPDirectories(BDirectory *settingsDirectory,
|
||||||
BDirectory *profileDirectory) const;
|
BDirectory *profileDirectory) const;
|
||||||
@@ -60,11 +33,7 @@ class DialUpView : public BView {
|
|||||||
void UpdateStatus(int32 code);
|
void UpdateStatus(int32 code);
|
||||||
void WatchInterface(ppp_interface_id ID);
|
void WatchInterface(ppp_interface_id ID);
|
||||||
|
|
||||||
bool LoadSettings(bool isNew);
|
|
||||||
void IsModified(bool *settings, bool *profile);
|
|
||||||
|
|
||||||
void LoadInterfaces();
|
void LoadInterfaces();
|
||||||
void LoadAddons();
|
|
||||||
|
|
||||||
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);
|
||||||
@@ -74,15 +43,13 @@ class DialUpView : public BView {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
PPPInterfaceListener fListener;
|
PPPInterfaceListener fListener;
|
||||||
|
PTPSettings fSettings;
|
||||||
|
|
||||||
thread_id fUpDownThread;
|
thread_id fUpDownThread;
|
||||||
|
|
||||||
BMessage fAddons, fSettings, fProfile;
|
|
||||||
driver_settings *fDriverSettings;
|
|
||||||
BMenuItem *fCurrentItem, *fDeleterItem;
|
BMenuItem *fCurrentItem, *fDeleterItem;
|
||||||
ppp_interface_id fWatching;
|
ppp_interface_id fWatching;
|
||||||
|
|
||||||
GeneralAddon *fGeneralAddon;
|
|
||||||
bool fKeepLabel;
|
bool fKeepLabel;
|
||||||
BStringView *fStatusView;
|
BStringView *fStatusView;
|
||||||
BButton *fConnectButton, *fCreateNewButton;
|
BButton *fConnectButton, *fCreateNewButton;
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2003-2004 Waldemar Kornewald, [email protected]
|
* Copyright 2003-2004, Waldemar Kornewald <[email protected]>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// GeneralAddon saves the loaded settings.
|
// GeneralAddon saves the loaded settings.
|
||||||
@@ -81,6 +64,7 @@ static const char *kGeneralTabAuthenticators = "Authenticators";
|
|||||||
GeneralAddon::GeneralAddon(BMessage *addons)
|
GeneralAddon::GeneralAddon(BMessage *addons)
|
||||||
: DialUpAddon(addons),
|
: DialUpAddon(addons),
|
||||||
fHasPassword(false),
|
fHasPassword(false),
|
||||||
|
fDeleteView(false),
|
||||||
fAuthenticatorsCount(0),
|
fAuthenticatorsCount(0),
|
||||||
fSettings(NULL),
|
fSettings(NULL),
|
||||||
fProfile(NULL),
|
fProfile(NULL),
|
||||||
@@ -91,13 +75,8 @@ GeneralAddon::GeneralAddon(BMessage *addons)
|
|||||||
|
|
||||||
GeneralAddon::~GeneralAddon()
|
GeneralAddon::~GeneralAddon()
|
||||||
{
|
{
|
||||||
}
|
if(fDeleteView)
|
||||||
|
delete fGeneralView;
|
||||||
|
|
||||||
bool
|
|
||||||
GeneralAddon::NeedsAuthenticationRequest() const
|
|
||||||
{
|
|
||||||
return fGeneralView->AuthenticatorName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -125,9 +104,13 @@ GeneralAddon::LoadSettings(BMessage *settings, BMessage *profile, bool isNew)
|
|||||||
fSettings = settings;
|
fSettings = settings;
|
||||||
fProfile = profile;
|
fProfile = profile;
|
||||||
|
|
||||||
if(fGeneralView)
|
if(!fGeneralView) {
|
||||||
fGeneralView->Reload();
|
CreateView(BPoint(0,0));
|
||||||
// reset all views (empty settings)
|
fDeleteView = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
fGeneralView->Reload();
|
||||||
|
// reset all views (empty settings)
|
||||||
|
|
||||||
if(!settings || !profile || isNew)
|
if(!settings || !profile || isNew)
|
||||||
return true;
|
return true;
|
||||||
@@ -138,9 +121,8 @@ GeneralAddon::LoadSettings(BMessage *settings, BMessage *profile, bool isNew)
|
|||||||
if(!LoadAuthenticationSettings())
|
if(!LoadAuthenticationSettings())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(fGeneralView)
|
fGeneralView->Reload();
|
||||||
fGeneralView->Reload();
|
// reload new settings
|
||||||
// reload new settings
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -351,21 +333,16 @@ GeneralAddon::CreateView(BPoint leftTop)
|
|||||||
BRect rect;
|
BRect rect;
|
||||||
Addons()->FindRect(DUN_TAB_VIEW_RECT, &rect);
|
Addons()->FindRect(DUN_TAB_VIEW_RECT, &rect);
|
||||||
fGeneralView = new GeneralView(this, rect);
|
fGeneralView = new GeneralView(this, rect);
|
||||||
fGeneralView->Reload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fDeleteView = false;
|
||||||
|
|
||||||
fGeneralView->MoveTo(leftTop);
|
fGeneralView->MoveTo(leftTop);
|
||||||
|
fGeneralView->Reload();
|
||||||
return fGeneralView;
|
return fGeneralView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BView*
|
|
||||||
GeneralAddon::AuthenticationView() const
|
|
||||||
{
|
|
||||||
return fGeneralView ? fGeneralView->AuthenticationView() : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
GeneralAddon::GetAuthenticator(const BString& moduleName, BMessage *entry) const
|
GeneralAddon::GetAuthenticator(const BString& moduleName, BMessage *entry) const
|
||||||
{
|
{
|
||||||
@@ -439,12 +416,10 @@ GeneralView::GeneralView(GeneralAddon *addon, BRect frame)
|
|||||||
rect = fAuthenticationBox->Bounds();
|
rect = fAuthenticationBox->Bounds();
|
||||||
rect.InsetBy(10, 5);
|
rect.InsetBy(10, 5);
|
||||||
rect.top = 25;
|
rect.top = 25;
|
||||||
// fAuthenticationView = new BControl(rect, "authenticationView", NULL, NULL,
|
BView *authenticationView = new BView(rect, "authenticationView",
|
||||||
// B_FOLLOW_NONE, 0);
|
B_FOLLOW_NONE, 0);
|
||||||
// BControl automatically sets the view color when attached (we want that)
|
authenticationView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
fAuthenticationView = new BView(rect, "authenticationView", B_FOLLOW_NONE, 0);
|
rect = authenticationView->Bounds();
|
||||||
fAuthenticationView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
||||||
rect = fAuthenticationView->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;
|
||||||
@@ -462,10 +437,10 @@ 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);
|
||||||
|
|
||||||
fAuthenticationView->AddChild(fUsername);
|
authenticationView->AddChild(fUsername);
|
||||||
fAuthenticationView->AddChild(fPassword);
|
authenticationView->AddChild(fPassword);
|
||||||
fAuthenticationView->AddChild(fSavePassword);
|
authenticationView->AddChild(fSavePassword);
|
||||||
fAuthenticationBox->AddChild(fAuthenticationView);
|
fAuthenticationBox->AddChild(authenticationView);
|
||||||
|
|
||||||
AddChild(fDeviceBox);
|
AddChild(fDeviceBox);
|
||||||
AddChild(fAuthenticationBox);
|
AddChild(fAuthenticationBox);
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2003-2004 Waldemar Kornewald, [email protected]
|
* Copyright 2003-2004, Waldemar Kornewald <[email protected]>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// GeneralAddon saves the loaded settings.
|
// GeneralAddon saves the loaded settings.
|
||||||
@@ -54,8 +37,6 @@ class GeneralAddon : public DialUpAddon {
|
|||||||
bool HasPassword() const
|
bool HasPassword() const
|
||||||
{ return fHasPassword; }
|
{ return fHasPassword; }
|
||||||
|
|
||||||
bool NeedsAuthenticationRequest() const;
|
|
||||||
|
|
||||||
DialUpAddon *FindDevice(const BString& moduleName) const;
|
DialUpAddon *FindDevice(const BString& moduleName) const;
|
||||||
DialUpAddon *DeviceAddon() const
|
DialUpAddon *DeviceAddon() const
|
||||||
{ return fDeviceAddon; }
|
{ return fDeviceAddon; }
|
||||||
@@ -84,15 +65,12 @@ class GeneralAddon : public DialUpAddon {
|
|||||||
virtual bool GetPreferredSize(float *width, float *height) const;
|
virtual bool GetPreferredSize(float *width, float *height) const;
|
||||||
virtual BView *CreateView(BPoint leftTop);
|
virtual BView *CreateView(BPoint leftTop);
|
||||||
|
|
||||||
// used by ppp_up application
|
|
||||||
BView *AuthenticationView() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool GetAuthenticator(const BString& moduleName, BMessage *entry) const;
|
bool GetAuthenticator(const BString& moduleName, BMessage *entry) const;
|
||||||
bool MarkAuthenticatorAsValid(const BString& moduleName);
|
bool MarkAuthenticatorAsValid(const BString& moduleName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool fIsNew, fHasPassword;
|
bool fIsNew, fHasPassword, fDeleteView;
|
||||||
BString fDeviceName, fUsername, fPassword;
|
BString fDeviceName, fUsername, fPassword;
|
||||||
DialUpAddon *fDeviceAddon;
|
DialUpAddon *fDeviceAddon;
|
||||||
int32 fAuthenticatorsCount;
|
int32 fAuthenticatorsCount;
|
||||||
@@ -131,10 +109,6 @@ class GeneralView : public BView {
|
|||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
|
||||||
// used by ppp_up application
|
|
||||||
BView *AuthenticationView() const
|
|
||||||
{ return fAuthenticationView; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ReloadDeviceView();
|
void ReloadDeviceView();
|
||||||
void UpdateControls();
|
void UpdateControls();
|
||||||
@@ -146,7 +120,6 @@ class GeneralView : public BView {
|
|||||||
GeneralAddon *fAddon;
|
GeneralAddon *fAddon;
|
||||||
DialUpAddon *fDeviceAddon;
|
DialUpAddon *fDeviceAddon;
|
||||||
BBox *fDeviceBox, *fAuthenticationBox;
|
BBox *fDeviceBox, *fAuthenticationBox;
|
||||||
BView *fAuthenticationView;
|
|
||||||
BMenuField *fDeviceField, *fAuthenticatorField;
|
BMenuField *fDeviceField, *fAuthenticatorField;
|
||||||
BMenuItem *fAuthenticatorNone, *fAuthenticatorDefault;
|
BMenuItem *fAuthenticatorNone, *fAuthenticatorDefault;
|
||||||
BTextControl *fUsername, *fPassword;
|
BTextControl *fUsername, *fPassword;
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2003-2004 Waldemar Kornewald, [email protected]
|
* Copyright 2003-2004, Waldemar Kornewald <[email protected]>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// IPCPAddon saves the loaded settings.
|
// IPCPAddon saves the loaded settings.
|
||||||
@@ -70,13 +53,18 @@ static const char *kKernelModuleName = "ipcp";
|
|||||||
IPCPAddon::IPCPAddon(BMessage *addons)
|
IPCPAddon::IPCPAddon(BMessage *addons)
|
||||||
: DialUpAddon(addons),
|
: DialUpAddon(addons),
|
||||||
fSettings(NULL),
|
fSettings(NULL),
|
||||||
fProfile(NULL)
|
fProfile(NULL),
|
||||||
|
fIPCPView(NULL)
|
||||||
{
|
{
|
||||||
|
CreateView(BPoint(0,0));
|
||||||
|
fDeleteView = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IPCPAddon::~IPCPAddon()
|
IPCPAddon::~IPCPAddon()
|
||||||
{
|
{
|
||||||
|
if(fDeleteView)
|
||||||
|
delete fIPCPView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -89,9 +77,8 @@ IPCPAddon::LoadSettings(BMessage *settings, BMessage *profile, bool isNew)
|
|||||||
fSettings = settings;
|
fSettings = settings;
|
||||||
fProfile = profile;
|
fProfile = profile;
|
||||||
|
|
||||||
if(fIPCPView)
|
fIPCPView->Reload();
|
||||||
fIPCPView->Reload();
|
// reset all views (empty settings)
|
||||||
// reset all views (empty settings)
|
|
||||||
|
|
||||||
if(!settings || !profile || isNew)
|
if(!settings || !profile || isNew)
|
||||||
return true;
|
return true;
|
||||||
@@ -164,8 +151,7 @@ IPCPAddon::LoadSettings(BMessage *settings, BMessage *profile, bool isNew)
|
|||||||
protocol.AddBool(MDSU_VALID, true);
|
protocol.AddBool(MDSU_VALID, true);
|
||||||
fProfile->ReplaceMessage(MDSU_PARAMETERS, protocolIndex, &protocol);
|
fProfile->ReplaceMessage(MDSU_PARAMETERS, protocolIndex, &protocol);
|
||||||
|
|
||||||
if(fIPCPView)
|
fIPCPView->Reload();
|
||||||
fIPCPView->Reload();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -265,10 +251,12 @@ IPCPAddon::CreateView(BPoint leftTop)
|
|||||||
BRect rect;
|
BRect rect;
|
||||||
Addons()->FindRect(DUN_TAB_VIEW_RECT, &rect);
|
Addons()->FindRect(DUN_TAB_VIEW_RECT, &rect);
|
||||||
fIPCPView = new IPCPView(this, rect);
|
fIPCPView = new IPCPView(this, rect);
|
||||||
fIPCPView->Reload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fDeleteView = false;
|
||||||
|
|
||||||
fIPCPView->MoveTo(leftTop);
|
fIPCPView->MoveTo(leftTop);
|
||||||
|
fIPCPView->Reload();
|
||||||
return fIPCPView;
|
return fIPCPView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2003-2004 Waldemar Kornewald, [email protected]
|
* Copyright 2003-2004, Waldemar Kornewald <[email protected]>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// IPCPAddon saves the loaded settings.
|
// IPCPAddon saves the loaded settings.
|
||||||
@@ -73,7 +56,7 @@ class IPCPAddon : public DialUpAddon {
|
|||||||
int32 FindIPCPProtocol(const BMessage& message, BMessage *protocol) const;
|
int32 FindIPCPProtocol(const BMessage& message, BMessage *protocol) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool fIsNew, fIsEnabled;
|
bool fIsNew, fIsEnabled, fDeleteView;
|
||||||
BString fIPAddress, fPrimaryDNS, fSecondaryDNS;
|
BString fIPAddress, fPrimaryDNS, fSecondaryDNS;
|
||||||
BMessage *fSettings, *fProfile;
|
BMessage *fSettings, *fProfile;
|
||||||
// saves last settings state
|
// saves last settings state
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, [email protected]
|
* Copyright 2004, Waldemar Kornewald <[email protected]>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#include "InterfaceUtils.h"
|
#include "InterfaceUtils.h"
|
||||||
|
|
||||||
@@ -28,12 +11,13 @@
|
|||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <ListItem.h> // Contains StringItem class declaration
|
#include <ListItem.h>
|
||||||
|
// contains StringItem class declaration
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
|
||||||
BPoint
|
BPoint
|
||||||
center_on_screen(BRect rect, BWindow *window)
|
center_on_screen(BRect rect, BWindow *window = NULL)
|
||||||
{
|
{
|
||||||
BRect screenFrame = (BScreen(window).Frame());
|
BRect screenFrame = (BScreen(window).Frame());
|
||||||
BPoint point((screenFrame.Width() - rect.Width()) / 2.0,
|
BPoint point((screenFrame.Width() - rect.Width()) / 2.0,
|
||||||
@@ -46,7 +30,7 @@ center_on_screen(BRect rect, BWindow *window)
|
|||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
FindNextMenuInsertionIndex(BMenu *menu, const char *name, int32 index)
|
FindNextMenuInsertionIndex(BMenu *menu, const char *name, int32 index = 0)
|
||||||
{
|
{
|
||||||
BMenuItem *item;
|
BMenuItem *item;
|
||||||
for(; index < menu->CountItems(); index++) {
|
for(; index < menu->CountItems(); index++) {
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifndef _INTERFACE_UTILS__H
|
#ifndef _INTERFACE_UTILS__H
|
||||||
#define _INTERFACE_UTILS__H
|
#define _INTERFACE_UTILS__H
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ UseHeaders [ FDirName $(OBOS_TOP) src add-ons kernel network ppp ipcp ] ; # IPCP
|
|||||||
|
|
||||||
AddResources DialUpPreflet : DialUpPreflet.rdef ;
|
AddResources DialUpPreflet : DialUpPreflet.rdef ;
|
||||||
|
|
||||||
StaticLibrary dunview :
|
StaticLibrary ptpnet :
|
||||||
DialUpView.cpp
|
PTPSettings.cpp
|
||||||
|
|
||||||
# utils
|
# utils (TODO: move into their own library)
|
||||||
InterfaceUtils.cpp
|
InterfaceUtils.cpp
|
||||||
MessageDriverSettingsUtils.cpp
|
MessageDriverSettingsUtils.cpp
|
||||||
TextRequestDialog.cpp
|
TextRequestDialog.cpp
|
||||||
@@ -40,6 +40,7 @@ StaticLibrary dunview :
|
|||||||
|
|
||||||
SimpleTest DialUpPreflet :
|
SimpleTest DialUpPreflet :
|
||||||
DialUpApplication.cpp
|
DialUpApplication.cpp
|
||||||
|
DialUpView.cpp
|
||||||
;
|
;
|
||||||
|
|
||||||
LinkSharedOSLibs DialUpPreflet : libdunview.a libppp.a be ;
|
LinkSharedOSLibs DialUpPreflet : libptpnet.a libppp.a be ;
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#include "MessageDriverSettingsUtils.h"
|
#include "MessageDriverSettingsUtils.h"
|
||||||
|
|
||||||
@@ -36,7 +19,7 @@ static bool AddParameters(const BMessage& message, driver_settings *to);
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
FindMessageParameter(const char *name, const BMessage& message, BMessage *save,
|
FindMessageParameter(const char *name, const BMessage& message, BMessage *save,
|
||||||
int32 *startIndex)
|
int32 *startIndex = NULL)
|
||||||
{
|
{
|
||||||
// XXX: this should be removed when we can replace BMessage with something better
|
// XXX: this should be removed when we can replace BMessage with something better
|
||||||
BString string;
|
BString string;
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifndef _MESSAGE_DRIVER_SETTINGS_UTILS__H
|
#ifndef _MESSAGE_DRIVER_SETTINGS_UTILS__H
|
||||||
#define _MESSAGE_DRIVER_SETTINGS_UTILS__H
|
#define _MESSAGE_DRIVER_SETTINGS_UTILS__H
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2003-2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// PPPoEAddon saves the loaded settings.
|
// PPPoEAddon saves the loaded settings.
|
||||||
@@ -96,13 +79,13 @@ PPPoEAddon::PPPoEAddon(BMessage *addons)
|
|||||||
fHeight = 20 // interface name control
|
fHeight = 20 // interface name control
|
||||||
+ 20 // service control
|
+ 20 // service control
|
||||||
+ 5 + 2; // space between controls and bottom
|
+ 5 + 2; // space between controls and bottom
|
||||||
|
CreateView(BPoint(0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PPPoEAddon::~PPPoEAddon()
|
PPPoEAddon::~PPPoEAddon()
|
||||||
{
|
{
|
||||||
delete fPPPoEView;
|
delete fPPPoEView;
|
||||||
// this may have been set to NULL from the view's destructor!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -135,8 +118,7 @@ PPPoEAddon::LoadSettings(BMessage *settings, BMessage *profile, bool isNew)
|
|||||||
fSettings = settings;
|
fSettings = settings;
|
||||||
fProfile = profile;
|
fProfile = profile;
|
||||||
|
|
||||||
if(fPPPoEView)
|
fPPPoEView->Reload();
|
||||||
fPPPoEView->Reload();
|
|
||||||
|
|
||||||
if(!settings || !profile || isNew)
|
if(!settings || !profile || isNew)
|
||||||
return true;
|
return true;
|
||||||
@@ -175,8 +157,7 @@ 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();
|
||||||
fPPPoEView->Reload();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -249,16 +230,16 @@ PPPoEAddon::CreateView(BPoint leftTop)
|
|||||||
{
|
{
|
||||||
if(!fPPPoEView) {
|
if(!fPPPoEView) {
|
||||||
float width;
|
float width;
|
||||||
if(!Addons()->FindFloat(DUN_DEVICE_VIEW_WIDTH, &width))
|
if(Addons()->FindFloat(DUN_DEVICE_VIEW_WIDTH, &width) != B_OK)
|
||||||
width = 270;
|
width = 270;
|
||||||
// default value
|
// default value
|
||||||
|
|
||||||
BRect rect(0, 0, width, fHeight);
|
BRect rect(0, 0, width, fHeight);
|
||||||
fPPPoEView = new PPPoEView(this, rect);
|
fPPPoEView = new PPPoEView(this, rect);
|
||||||
fPPPoEView->Reload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fPPPoEView->MoveTo(leftTop);
|
fPPPoEView->MoveTo(leftTop);
|
||||||
|
fPPPoEView->Reload();
|
||||||
return fPPPoEView;
|
return fPPPoEView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2003-2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// PPPoEAddon saves the loaded settings.
|
// PPPoEAddon saves the loaded settings.
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#include "TextRequestDialog.h"
|
#include "TextRequestDialog.h"
|
||||||
#include "InterfaceUtils.h"
|
#include "InterfaceUtils.h"
|
||||||
@@ -44,7 +27,7 @@ static const char *kLabelCancel = "Cancel";
|
|||||||
|
|
||||||
|
|
||||||
TextRequestDialog::TextRequestDialog(const char *title, const char *information,
|
TextRequestDialog::TextRequestDialog(const char *title, const char *information,
|
||||||
const char *request, const char *text)
|
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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,24 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/*
|
||||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
* Copyright 2004, Waldemar Kornewald <Waldemar.Kornewald@web.de>
|
||||||
*
|
* Distributed under the terms of the MIT License.
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
*/
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
|
||||||
* to deal in the Software without restriction, including without limitation
|
|
||||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
* DEALINGS IN THE SOFTWARE.
|
|
||||||
* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifndef _TEXT_REQUEST_DIALOG__H
|
#ifndef _TEXT_REQUEST_DIALOG__H
|
||||||
#define _TEXT_REQUEST_DIALOG__H
|
#define _TEXT_REQUEST_DIALOG__H
|
||||||
|
|||||||
Reference in New Issue
Block a user