network_settings/dialup: Fix the build.
Badly needs layouting and a lot of other fixes to get it working with the new PPP stack. But it's a start.
This commit is contained in:
parent
0a694375a9
commit
9390158822
@ -2,7 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/dirent.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <String.h>
|
||||
@ -10,36 +10,116 @@
|
||||
#include <ListItem.h>
|
||||
#include <ScrollView.h>
|
||||
#include <Box.h>
|
||||
#include <Button.h>
|
||||
#include <Button.h>
|
||||
#include <Bitmap.h>
|
||||
#include <Alert.h>
|
||||
|
||||
#include <NetworkSetupAddOn.h>
|
||||
#include <NetworkSettings.h>
|
||||
#include <NetworkSettingsAddOn.h>
|
||||
#include "InterfaceListItem.h"
|
||||
|
||||
#include "DialUpView.h"
|
||||
|
||||
class AddOn : public NetworkSetupAddOn
|
||||
{
|
||||
|
||||
using namespace BNetworkKit;
|
||||
|
||||
|
||||
class AddOn : public BNetworkSettingsAddOn {
|
||||
public:
|
||||
AddOn(image_id addon_image);
|
||||
~AddOn();
|
||||
|
||||
const char * Name();
|
||||
BView * CreateView(BRect *bounds);
|
||||
AddOn(image_id addon_image, BNetworkSettings& settings);
|
||||
virtual ~AddOn();
|
||||
|
||||
virtual BNetworkSettingsItem*
|
||||
CreateNextItem(uint32& cookie);
|
||||
};
|
||||
|
||||
|
||||
NetworkSetupAddOn * get_nth_addon(image_id image, int index)
|
||||
{
|
||||
if (index == 0)
|
||||
return new AddOn(image);
|
||||
return NULL;
|
||||
}
|
||||
class DialUpInterfaceItem : public BNetworkSettingsItem {
|
||||
public:
|
||||
DialUpInterfaceItem(BNetworkSettings& settings);
|
||||
virtual ~DialUpInterfaceItem();
|
||||
|
||||
virtual BNetworkSettingsType
|
||||
Type() const;
|
||||
|
||||
virtual BListItem* ListItem();
|
||||
virtual BView* View();
|
||||
|
||||
virtual status_t Revert();
|
||||
virtual bool IsRevertable();
|
||||
|
||||
private:
|
||||
BNetworkSettings& fSettings;
|
||||
BListItem* fItem;
|
||||
BView* fView;
|
||||
};
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
AddOn::AddOn(image_id image)
|
||||
: NetworkSetupAddOn(image)
|
||||
|
||||
DialUpInterfaceItem::DialUpInterfaceItem(BNetworkSettings& settings)
|
||||
:
|
||||
fSettings(settings),
|
||||
fItem(new InterfaceListItem("Dialup",
|
||||
B_NETWORK_INTERFACE_TYPE_DIAL_UP)),
|
||||
fView(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DialUpInterfaceItem::~DialUpInterfaceItem()
|
||||
{
|
||||
if (fView->Parent() == NULL)
|
||||
delete fView;
|
||||
|
||||
delete fItem;
|
||||
}
|
||||
|
||||
|
||||
BNetworkSettingsType
|
||||
DialUpInterfaceItem::Type() const
|
||||
{
|
||||
return B_NETWORK_SETTINGS_TYPE_DIAL_UP;
|
||||
}
|
||||
|
||||
|
||||
BListItem*
|
||||
DialUpInterfaceItem::ListItem()
|
||||
{
|
||||
return fItem;
|
||||
}
|
||||
|
||||
|
||||
BView*
|
||||
DialUpInterfaceItem::View()
|
||||
{
|
||||
if (fView == NULL)
|
||||
fView = new DialUpView(BRect(0, 0, 100, 100)/*, fSettings*/);
|
||||
|
||||
return fView;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
DialUpInterfaceItem::Revert()
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
DialUpInterfaceItem::IsRevertable()
|
||||
{
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
AddOn::AddOn(image_id image, BNetworkSettings& settings)
|
||||
: BNetworkSettingsAddOn(image, settings)
|
||||
{
|
||||
}
|
||||
|
||||
@ -49,22 +129,22 @@ AddOn::~AddOn()
|
||||
}
|
||||
|
||||
|
||||
const char * AddOn::Name()
|
||||
BNetworkSettingsItem*
|
||||
AddOn::CreateNextItem(uint32& cookie)
|
||||
{
|
||||
return "DialUp";
|
||||
if (cookie++ == 0)
|
||||
return new DialUpInterfaceItem(Settings());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
BView * AddOn::CreateView(BRect *bounds)
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
extern "C"
|
||||
BNetworkSettingsAddOn*
|
||||
instantiate_network_settings_add_on(image_id image, BNetworkSettings& settings)
|
||||
{
|
||||
BRect r = *bounds;
|
||||
|
||||
if (r.Width() < 200 || r.Height() < 400)
|
||||
r.Set(0, 0, 200, 400);
|
||||
|
||||
BView *view = new DialUpView(r);
|
||||
*bounds = view->Bounds();
|
||||
|
||||
return view;
|
||||
return new AddOn(image, settings);
|
||||
}
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
@ -64,50 +64,52 @@ ConnectionOptionsAddon::LoadSettings(BMessage *settings, BMessage *profile, bool
|
||||
fDoesDialOnDemand = fAskBeforeDialing = fDoesAutoRedial = false;
|
||||
fSettings = settings;
|
||||
fProfile = profile;
|
||||
|
||||
|
||||
if(fConnectionOptionsView)
|
||||
fConnectionOptionsView->Reload();
|
||||
// reset all views (empty settings)
|
||||
|
||||
|
||||
if(!settings || !profile || isNew)
|
||||
return true;
|
||||
|
||||
|
||||
BMessage parameter;
|
||||
int32 index = 0;
|
||||
const char *value;
|
||||
/* FIXME!
|
||||
if(FindMessageParameter(PPP_DIAL_ON_DEMAND_KEY, *fSettings, ¶meter, &index)
|
||||
&& parameter.FindString(MDSU_VALUES, &value) == B_OK) {
|
||||
if(get_boolean_value(value, false))
|
||||
fDoesDialOnDemand = true;
|
||||
|
||||
|
||||
parameter.AddBool(MDSU_VALID, true);
|
||||
fSettings->ReplaceMessage(MDSU_PARAMETERS, index, ¶meter);
|
||||
}
|
||||
|
||||
|
||||
index = 0;
|
||||
if(FindMessageParameter(PPP_ASK_BEFORE_DIALING_KEY, *fSettings, ¶meter, &index)
|
||||
&& parameter.FindString(MDSU_VALUES, &value) == B_OK) {
|
||||
if(get_boolean_value(value, false))
|
||||
fAskBeforeDialing = true;
|
||||
|
||||
|
||||
parameter.AddBool(MDSU_VALID, true);
|
||||
fSettings->ReplaceMessage(MDSU_PARAMETERS, index, ¶meter);
|
||||
}
|
||||
|
||||
|
||||
index = 0;
|
||||
if(FindMessageParameter(PPP_AUTO_REDIAL_KEY, *fSettings, ¶meter, &index)
|
||||
&& parameter.FindString(MDSU_VALUES, &value) == B_OK) {
|
||||
if(get_boolean_value(value, false))
|
||||
fDoesAutoRedial = true;
|
||||
|
||||
|
||||
parameter.AddBool(MDSU_VALID, true);
|
||||
fSettings->ReplaceMessage(MDSU_PARAMETERS, index, ¶meter);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
if(fConnectionOptionsView)
|
||||
fConnectionOptionsView->Reload();
|
||||
// reload new settings
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -116,10 +118,10 @@ void
|
||||
ConnectionOptionsAddon::IsModified(bool *settings, bool *profile) const
|
||||
{
|
||||
*settings = *profile = false;
|
||||
|
||||
|
||||
if(!fSettings || !fConnectionOptionsView)
|
||||
return;
|
||||
|
||||
|
||||
*settings = DoesDialOnDemand() != fConnectionOptionsView->DoesDialOnDemand()
|
||||
|| AskBeforeDialing() != fConnectionOptionsView->AskBeforeDialing()
|
||||
|| DoesAutoRedial() != fConnectionOptionsView->DoesAutoRedial();
|
||||
@ -131,29 +133,29 @@ ConnectionOptionsAddon::SaveSettings(BMessage *settings, BMessage *profile, bool
|
||||
{
|
||||
if(!fSettings || !settings)
|
||||
return false;
|
||||
|
||||
|
||||
BMessage parameter;
|
||||
if(fConnectionOptionsView->DoesDialOnDemand()) {
|
||||
parameter.MakeEmpty();
|
||||
parameter.AddString(MDSU_NAME, PPP_DIAL_ON_DEMAND_KEY);
|
||||
// parameter.AddString(MDSU_NAME, PPP_DIAL_ON_DEMAND_KEY); // FIXME
|
||||
parameter.AddString(MDSU_VALUES, "enabled");
|
||||
settings->AddMessage(MDSU_PARAMETERS, ¶meter);
|
||||
|
||||
|
||||
if(fConnectionOptionsView->AskBeforeDialing()) {
|
||||
parameter.MakeEmpty();
|
||||
parameter.AddString(MDSU_NAME, PPP_ASK_BEFORE_DIALING_KEY);
|
||||
// parameter.AddString(MDSU_NAME, PPP_ASK_BEFORE_DIALING_KEY); // FIXME
|
||||
parameter.AddString(MDSU_VALUES, "enabled");
|
||||
settings->AddMessage(MDSU_PARAMETERS, ¶meter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(fConnectionOptionsView->DoesAutoRedial()) {
|
||||
parameter.MakeEmpty();
|
||||
parameter.AddString(MDSU_NAME, PPP_AUTO_REDIAL_KEY);
|
||||
// parameter.AddString(MDSU_NAME, PPP_AUTO_REDIAL_KEY); // FIXME
|
||||
parameter.AddString(MDSU_VALUES, "enabled");
|
||||
settings->AddMessage(MDSU_PARAMETERS, ¶meter);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -165,12 +167,12 @@ ConnectionOptionsAddon::GetPreferredSize(float *width, float *height) const
|
||||
if(Addons()->FindRect(DUN_TAB_VIEW_RECT, &rect) != B_OK)
|
||||
rect.Set(0, 0, 200, 300);
|
||||
// set default values
|
||||
|
||||
|
||||
if(width)
|
||||
*width = rect.Width();
|
||||
if(height)
|
||||
*height = rect.Height();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -184,7 +186,7 @@ ConnectionOptionsAddon::CreateView(BPoint leftTop)
|
||||
fConnectionOptionsView = new ConnectionOptionsView(this, rect);
|
||||
fConnectionOptionsView->Reload();
|
||||
}
|
||||
|
||||
|
||||
fConnectionOptionsView->MoveTo(leftTop);
|
||||
return fConnectionOptionsView;
|
||||
}
|
||||
@ -208,7 +210,7 @@ ConnectionOptionsView::ConnectionOptionsView(ConnectionOptionsAddon *addon, BRec
|
||||
rect.top = rect.bottom + 20;
|
||||
rect.bottom = rect.top + 15;
|
||||
fAutoRedial = new BCheckBox(rect, "AutoRedial", kLabelAutoRedial, NULL);
|
||||
|
||||
|
||||
AddChild(fDialOnDemand);
|
||||
AddChild(fAskBeforeDialing);
|
||||
AddChild(fAutoRedial);
|
||||
@ -222,10 +224,10 @@ ConnectionOptionsView::Reload()
|
||||
// this is enabled by default
|
||||
fAskBeforeDialing->SetValue(Addon()->AskBeforeDialing());
|
||||
fAutoRedial->SetValue(Addon()->DoesAutoRedial());
|
||||
|
||||
|
||||
if(!Addon()->Settings())
|
||||
return;
|
||||
|
||||
|
||||
UpdateControls();
|
||||
}
|
||||
|
||||
@ -245,7 +247,7 @@ ConnectionOptionsView::MessageReceived(BMessage *message)
|
||||
case kMsgUpdateControls:
|
||||
UpdateControls();
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
|
@ -1,22 +1,22 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
#ifndef _CONNECTION_OPTIONS_ADDON__H
|
||||
#define _CONNECTION_OPTIONS_ADDON__H
|
||||
|
||||
#include <DialUpAddon.h>
|
||||
#include "DialUpAddon.h"
|
||||
|
||||
#include <CheckBox.h>
|
||||
#include <RadioButton.h>
|
||||
@ -40,22 +40,22 @@ class ConnectionOptionsAddon : public DialUpAddon {
|
||||
public:
|
||||
ConnectionOptionsAddon(BMessage *addons);
|
||||
virtual ~ConnectionOptionsAddon();
|
||||
|
||||
|
||||
bool IsNew() const
|
||||
{ return fIsNew; }
|
||||
|
||||
|
||||
bool DoesDialOnDemand() const
|
||||
{ return fDoesDialOnDemand; }
|
||||
bool AskBeforeDialing() const
|
||||
{ return fAskBeforeDialing; }
|
||||
bool DoesAutoRedial() const
|
||||
{ return fDoesAutoRedial; }
|
||||
|
||||
|
||||
BMessage *Settings() const
|
||||
{ return fSettings; }
|
||||
BMessage *Profile() const
|
||||
{ return fProfile; }
|
||||
|
||||
|
||||
virtual int32 Position() const
|
||||
{ return 50; }
|
||||
virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew);
|
||||
@ -77,18 +77,18 @@ class ConnectionOptionsAddon : public DialUpAddon {
|
||||
class ConnectionOptionsView : public BView {
|
||||
public:
|
||||
ConnectionOptionsView(ConnectionOptionsAddon *addon, BRect frame);
|
||||
|
||||
|
||||
ConnectionOptionsAddon *Addon() const
|
||||
{ return fAddon; }
|
||||
void Reload();
|
||||
|
||||
|
||||
bool DoesDialOnDemand() const
|
||||
{ return fDialOnDemand->Value(); }
|
||||
bool AskBeforeDialing() const
|
||||
{ return fAskBeforeDialing->Value(); }
|
||||
bool DoesAutoRedial() const
|
||||
{ return fAutoRedial->Value(); }
|
||||
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
|
||||
|
@ -1,28 +1,28 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
\brief Base class for DialUpPreflet add-ons.
|
||||
|
||||
|
||||
Dial-Up add-ons must export the following function: \n
|
||||
bool register(BMessage *addons) \n
|
||||
You should add your DialUpAddon object to the given BMessage. \n
|
||||
@ -39,6 +39,10 @@
|
||||
#include <SupportDefs.h>
|
||||
#include <Point.h>
|
||||
|
||||
class BMessage;
|
||||
class BView;
|
||||
class DialUpView;
|
||||
|
||||
|
||||
#define DUN_MAXIMUM_PRIORITY 50
|
||||
|
||||
@ -57,18 +61,18 @@
|
||||
|
||||
|
||||
class DialUpAddon {
|
||||
friend class DialUpView;
|
||||
friend class DialUpView;
|
||||
|
||||
public:
|
||||
//! Constructor. The BMessage is the one passed to the \c register() function.
|
||||
DialUpAddon(BMessage *addons) : fAddons(addons) {}
|
||||
//! Destructor. Does nothing.
|
||||
virtual ~DialUpAddon() {}
|
||||
|
||||
|
||||
//! Returns the BMessage object holding all add-ons.
|
||||
BMessage *Addons() const
|
||||
{ return fAddons; }
|
||||
|
||||
|
||||
//! Returns a name readable by humans without much technical knowledge.
|
||||
virtual const char *FriendlyName() const
|
||||
{ return NULL; }
|
||||
@ -84,17 +88,17 @@ class DialUpAddon {
|
||||
//! Allows setting an order in which modules are asked to add the settings.
|
||||
virtual int32 Priority() const
|
||||
{ return 0; }
|
||||
|
||||
|
||||
/*! \brief Load the given settings and profile.
|
||||
|
||||
|
||||
\param isNew Specifies if this is a newly created interface.
|
||||
|
||||
|
||||
\return \c true if loading was successful or \c false otherwise.
|
||||
*/
|
||||
virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew)
|
||||
{ return false; }
|
||||
/*! \brief Returns if this module has a temporary profile.
|
||||
|
||||
|
||||
A temporary profile is never stored on the hard-disk, but only passed
|
||||
to the interface on connection. This can include passwords, for example.
|
||||
*/
|
||||
@ -104,22 +108,22 @@ class DialUpAddon {
|
||||
virtual void IsModified(bool *settings, bool *profile) const
|
||||
{ *settings = *profile = false; }
|
||||
/*! \brief Save the given settings and profile.
|
||||
|
||||
|
||||
\param saveTemporary Specifies if the temporary profile should be written.
|
||||
|
||||
|
||||
\return \c true if saving was successful or \c false otherwise.
|
||||
*/
|
||||
virtual bool SaveSettings(BMessage *settings, BMessage *profile,
|
||||
bool saveTemporary)
|
||||
{ return false; }
|
||||
/*! \brief Get the preferred view size.
|
||||
|
||||
|
||||
\return \c false if this module does not export a BView object.
|
||||
*/
|
||||
virtual bool GetPreferredSize(float *width, float *height) const
|
||||
{ return false; }
|
||||
/*! \brief Returns the module's BView object.
|
||||
|
||||
|
||||
\param leftTop Specifies the view's left-top coordinates.
|
||||
*/
|
||||
virtual BView *CreateView(BPoint leftTop)
|
||||
@ -133,7 +137,7 @@ class DialUpAddon {
|
||||
|
||||
private:
|
||||
BMessage *fAddons;
|
||||
|
||||
|
||||
int32 _reserved[7];
|
||||
};
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
@ -116,11 +116,11 @@ DialUpView::DialUpView(BRect frame)
|
||||
BRect bounds = Bounds();
|
||||
// for caching
|
||||
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
|
||||
|
||||
|
||||
// add messenger to us so add-ons can contact us
|
||||
BMessenger messenger(this);
|
||||
fAddons.AddMessenger(DUN_MESSENGER, messenger);
|
||||
|
||||
|
||||
// create pop-up with all interfaces and "New..."/"Delete current" items
|
||||
fInterfaceMenu = new BPopUpMenu(kLabelCreateNew);
|
||||
BRect rect = bounds;
|
||||
@ -128,7 +128,7 @@ DialUpView::DialUpView(BRect frame)
|
||||
rect.bottom = rect.top + 20;
|
||||
fMenuField = new BMenuField(rect, "Interfaces", kLabelInterface, fInterfaceMenu);
|
||||
fMenuField->SetDivider(StringWidth(fMenuField->Label()) + 5);
|
||||
|
||||
|
||||
rect.top = rect.bottom + 10;
|
||||
rect.bottom = bounds.bottom
|
||||
- 20 // height of bottom controls
|
||||
@ -137,7 +137,7 @@ DialUpView::DialUpView(BRect frame)
|
||||
BRect tabViewRect(fTabView->Bounds());
|
||||
tabViewRect.bottom -= fTabView->TabHeight();
|
||||
fAddons.AddRect(DUN_TAB_VIEW_RECT, tabViewRect);
|
||||
|
||||
|
||||
BRect tmpRect(rect);
|
||||
tmpRect.top += (tmpRect.Height() - 15) / 2;
|
||||
tmpRect.bottom = tmpRect.top + 15;
|
||||
@ -153,25 +153,25 @@ DialUpView::DialUpView(BRect frame)
|
||||
tmpRect.left = (rect.Width() - fCreateNewButton->Bounds().Width()) / 2 + rect.left;
|
||||
fCreateNewButton->MoveTo(tmpRect.left, tmpRect.top);
|
||||
fCreateNewButton->Hide();
|
||||
|
||||
|
||||
rect.top = rect.bottom + 15;
|
||||
rect.bottom = rect.top + 15;
|
||||
rect.right = rect.left + 200;
|
||||
fStatusView = new BStringView(rect, "StatusView", kTextNotConnected, B_FOLLOW_BOTTOM);
|
||||
|
||||
|
||||
rect.InsetBy(0, -5);
|
||||
rect.left = rect.right + 5;
|
||||
rect.right = bounds.right - 5;
|
||||
fConnectButton = new BButton(rect, "ConnectButton", kLabelConnect,
|
||||
new BMessage(kMsgConnectButton), B_FOLLOW_BOTTOM);
|
||||
|
||||
|
||||
AddChild(fMenuField);
|
||||
AddChild(fTabView);
|
||||
AddChild(fStringView);
|
||||
AddChild(fCreateNewButton);
|
||||
AddChild(fStatusView);
|
||||
AddChild(fConnectButton);
|
||||
|
||||
|
||||
// initialize
|
||||
LoadInterfaces();
|
||||
LoadAddons();
|
||||
@ -186,10 +186,10 @@ DialUpView::DialUpView(BRect frame)
|
||||
DialUpView::~DialUpView()
|
||||
{
|
||||
SaveSettingsToFile();
|
||||
|
||||
|
||||
int32 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;
|
||||
@ -206,7 +206,7 @@ DialUpView::AttachedToWindow()
|
||||
fInterfaceMenu->SetTargetForItems(this);
|
||||
fCreateNewButton->SetTarget(this);
|
||||
fConnectButton->SetTarget(this);
|
||||
|
||||
|
||||
if(fListener.InitCheck() != B_OK) {
|
||||
(new BAlert(kErrorTitle, kErrorNoPPPStack, kLabelOK,
|
||||
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
|
||||
@ -222,30 +222,30 @@ DialUpView::MessageReceived(BMessage *message)
|
||||
case PPP_REPORT_MESSAGE:
|
||||
HandleReportMessage(message);
|
||||
break;
|
||||
|
||||
|
||||
// -------------------------------------------------
|
||||
case kMsgCreateNew: {
|
||||
(new TextRequestDialog(kLabelCreateNewInterface, kTextChooseInterfaceName,
|
||||
kLabelInterfaceName))->Go(
|
||||
new BInvoker(new BMessage(kMsgFinishCreateNew), this));
|
||||
} break;
|
||||
|
||||
|
||||
case kMsgFinishCreateNew: {
|
||||
int32 which;
|
||||
message->FindInt32("which", &which);
|
||||
const char *name = message->FindString("text");
|
||||
if(which == 1 && name && strlen(name) > 0)
|
||||
AddInterface(name, true);
|
||||
|
||||
|
||||
if(fCurrentItem)
|
||||
fCurrentItem->SetMarked(true);
|
||||
} break;
|
||||
// -------------------------------------------------
|
||||
|
||||
|
||||
case kMsgDeleteCurrent: {
|
||||
if(!fCurrentItem)
|
||||
return;
|
||||
|
||||
|
||||
fInterfaceMenu->RemoveItem(fCurrentItem);
|
||||
BDirectory settings, profile;
|
||||
GetPPPDirectories(&settings, &profile);
|
||||
@ -256,31 +256,31 @@ DialUpView::MessageReceived(BMessage *message)
|
||||
entry.Remove();
|
||||
delete fCurrentItem;
|
||||
fCurrentItem = NULL;
|
||||
|
||||
|
||||
BMenuItem *marked = fInterfaceMenu->FindMarked();
|
||||
if(marked)
|
||||
marked->SetMarked(false);
|
||||
|
||||
|
||||
UpdateControls();
|
||||
SelectInterface(0);
|
||||
// this stops watching the deleted interface
|
||||
} break;
|
||||
|
||||
|
||||
case kMsgSelectInterface: {
|
||||
int32 index;
|
||||
message->FindInt32("index", &index);
|
||||
SelectInterface(index);
|
||||
} break;
|
||||
|
||||
|
||||
case kMsgConnectButton: {
|
||||
if(!fCurrentItem || fUpDownThread != -1)
|
||||
return;
|
||||
|
||||
|
||||
fUpDownThread = spawn_thread(up_down_thread, "up_down_thread",
|
||||
B_NORMAL_PRIORITY, this);
|
||||
resume_thread(fUpDownThread);
|
||||
} break;
|
||||
|
||||
|
||||
default:
|
||||
BView::MessageReceived(message);
|
||||
}
|
||||
@ -291,13 +291,13 @@ 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;
|
||||
}
|
||||
|
||||
@ -337,7 +337,7 @@ DialUpView::LoadSettings(bool isNew)
|
||||
fProfile.MakeEmpty();
|
||||
BMessage *settingsPointer = fCurrentItem ? &fSettings : NULL,
|
||||
*profilePointer = fCurrentItem ? &fProfile : NULL;
|
||||
|
||||
|
||||
if(fCurrentItem && !isNew) {
|
||||
BString name("pppidf/");
|
||||
name << fCurrentItem->Label();
|
||||
@ -348,19 +348,19 @@ DialUpView::LoadSettings(bool isNew)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -371,13 +371,13 @@ 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;
|
||||
@ -392,7 +392,7 @@ DialUpView::SaveSettings(BMessage *settings, BMessage *profile, bool saveTempora
|
||||
{
|
||||
if(!fCurrentItem || !settings || !profile)
|
||||
return false;
|
||||
|
||||
|
||||
DialUpAddon *addon;
|
||||
TemplateList<DialUpAddon*> addons;
|
||||
for(int32 index = 0;
|
||||
@ -400,23 +400,23 @@ DialUpView::SaveSettings(BMessage *settings, BMessage *profile, bool saveTempora
|
||||
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;
|
||||
}
|
||||
|
||||
@ -428,28 +428,28 @@ DialUpView::SaveSettingsToFile()
|
||||
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;
|
||||
}
|
||||
|
||||
@ -461,39 +461,40 @@ DialUpView::UpDownThread()
|
||||
BMessage settings, profile;
|
||||
SaveSettings(&settings, &profile, true);
|
||||
// save temporary profile
|
||||
driver_settings *temporaryProfile = MessageToDriverSettings(profile);
|
||||
|
||||
//driver_settings *temporaryProfile = MessageToDriverSettings(profile);
|
||||
|
||||
PPPInterface interface;
|
||||
if(fWatching == PPP_UNDEFINED_INTERFACE_ID) {
|
||||
if (fWatching == PPP_UNDEFINED_INTERFACE_ID) {
|
||||
interface = fListener.Manager().InterfaceWithName(fCurrentItem->Label());
|
||||
if(interface.InitCheck() != B_OK)
|
||||
interface = fListener.Manager().CreateInterfaceWithName(
|
||||
fCurrentItem->Label(), temporaryProfile);
|
||||
fCurrentItem->Label());
|
||||
} else {
|
||||
interface = fWatching;
|
||||
interface.SetProfile(temporaryProfile);
|
||||
//interface.SetProfile(temporaryProfile);
|
||||
}
|
||||
|
||||
free_driver_settings(temporaryProfile);
|
||||
|
||||
|
||||
//free_driver_settings(temporaryProfile);
|
||||
|
||||
if(interface.InitCheck() != B_OK) {
|
||||
Window()->Lock();
|
||||
fStatusView->SetText(kTextCreationError);
|
||||
Window()->Unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ppp_interface_info_t info;
|
||||
interface.GetInterfaceInfo(&info);
|
||||
if(info.info.phase == PPP_DOWN_PHASE)
|
||||
interface.Up();
|
||||
else
|
||||
interface.Down();
|
||||
|
||||
|
||||
fUpDownThread = -1;
|
||||
}
|
||||
|
||||
|
||||
#define PPP_INTERFACE_SETTINGS_PATH "" // FIXME!
|
||||
void
|
||||
DialUpView::GetPPPDirectories(BDirectory *settingsDirectory,
|
||||
BDirectory *profileDirectory) const
|
||||
@ -504,17 +505,17 @@ DialUpView::GetPPPDirectories(BDirectory *settingsDirectory,
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -525,41 +526,41 @@ DialUpView::HandleReportMessage(BMessage *message)
|
||||
{
|
||||
thread_id sender;
|
||||
message->FindInt32("sender", &sender);
|
||||
|
||||
|
||||
send_data(sender, B_OK, NULL, 0);
|
||||
|
||||
|
||||
if(!fCurrentItem)
|
||||
return;
|
||||
|
||||
|
||||
ppp_interface_id id;
|
||||
if(message->FindInt32("interface", reinterpret_cast<int32*>(&id)) != B_OK
|
||||
|| (fWatching != PPP_UNDEFINED_INTERFACE_ID && id != fWatching))
|
||||
return;
|
||||
|
||||
|
||||
int32 type, code;
|
||||
message->FindInt32("type", &type);
|
||||
message->FindInt32("code", &code);
|
||||
|
||||
|
||||
if(type == PPP_MANAGER_REPORT && code == PPP_REPORT_INTERFACE_CREATED) {
|
||||
PPPInterface interface(id);
|
||||
if(interface.InitCheck() != B_OK)
|
||||
return;
|
||||
|
||||
|
||||
ppp_interface_info_t info;
|
||||
interface.GetInterfaceInfo(&info);
|
||||
if(strcasecmp(info.info.name, fCurrentItem->Label()))
|
||||
return;
|
||||
|
||||
|
||||
WatchInterface(id);
|
||||
} else if(type == PPP_CONNECTION_REPORT) {
|
||||
if(fWatching == PPP_UNDEFINED_INTERFACE_ID)
|
||||
return;
|
||||
|
||||
|
||||
UpdateStatus(code);
|
||||
} else if(type == PPP_DESTRUCTION_REPORT) {
|
||||
if(fWatching == PPP_UNDEFINED_INTERFACE_ID)
|
||||
return;
|
||||
|
||||
|
||||
WatchInterface(fListener.Manager().InterfaceWithName(fCurrentItem->Label()));
|
||||
}
|
||||
}
|
||||
@ -573,32 +574,32 @@ DialUpView::CreateTabs()
|
||||
BView *target;
|
||||
float width, height;
|
||||
TemplateList<DialUpAddon*> addons;
|
||||
|
||||
|
||||
for(int32 index = 0;
|
||||
fAddons.FindPointer(DUN_TAB_ADDON_TYPE, index,
|
||||
reinterpret_cast<void**>(&addon)) == B_OK;
|
||||
index++) {
|
||||
if(!addon || addon->Position() < 0)
|
||||
continue;
|
||||
|
||||
|
||||
int32 insertIndex = 0;
|
||||
for(; insertIndex < addons.CountItems(); insertIndex++)
|
||||
if(addons.ItemAt(insertIndex)->Position() > addon->Position())
|
||||
break;
|
||||
|
||||
|
||||
addons.AddItem(addon, insertIndex);
|
||||
}
|
||||
|
||||
|
||||
for(int32 index = 0; index < addons.CountItems(); index++) {
|
||||
addon = addons.ItemAt(index);
|
||||
|
||||
|
||||
if(!addon->GetPreferredSize(&width, &height))
|
||||
continue;
|
||||
|
||||
|
||||
target = addon->CreateView(BPoint(0, 0));
|
||||
if(!target)
|
||||
continue;
|
||||
|
||||
|
||||
fTabView->AddTab(target, NULL);
|
||||
}
|
||||
}
|
||||
@ -608,62 +609,57 @@ void
|
||||
DialUpView::UpdateStatus(int32 code)
|
||||
{
|
||||
switch(code) {
|
||||
case PPP_REPORT_UP_ABORTED:
|
||||
case PPP_REPORT_DEVICE_UP_FAILED:
|
||||
case PPP_REPORT_LOCAL_AUTHENTICATION_FAILED:
|
||||
case PPP_REPORT_PEER_AUTHENTICATION_FAILED:
|
||||
case PPP_REPORT_AUTHENTICATION_FAILED:
|
||||
case PPP_REPORT_DOWN_SUCCESSFUL:
|
||||
case PPP_REPORT_CONNECTION_LOST: {
|
||||
fConnectButton->SetLabel(kLabelConnect);
|
||||
} break;
|
||||
|
||||
|
||||
default:
|
||||
fConnectButton->SetLabel(kLabelDisconnect);
|
||||
}
|
||||
|
||||
|
||||
// maybe the status string must not be changed (codes that set fKeepLabel to false
|
||||
// should still be handled)
|
||||
if(fKeepLabel && code != PPP_REPORT_GOING_UP && code != PPP_REPORT_UP_SUCCESSFUL)
|
||||
return;
|
||||
|
||||
|
||||
if(fListener.InitCheck() != B_OK) {
|
||||
fStatusView->SetText(kErrorNoPPPStack);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// only errors should set fKeepLabel to true
|
||||
switch(code) {
|
||||
case PPP_REPORT_GOING_UP:
|
||||
fKeepLabel = false;
|
||||
fStatusView->SetText(kTextConnecting);
|
||||
break;
|
||||
|
||||
|
||||
case PPP_REPORT_UP_SUCCESSFUL:
|
||||
fKeepLabel = false;
|
||||
fStatusView->SetText(kTextConnectionEstablished);
|
||||
break;
|
||||
|
||||
case PPP_REPORT_UP_ABORTED:
|
||||
|
||||
case PPP_REPORT_DOWN_SUCCESSFUL:
|
||||
fStatusView->SetText(kTextNotConnected);
|
||||
break;
|
||||
|
||||
|
||||
case PPP_REPORT_DEVICE_UP_FAILED:
|
||||
fKeepLabel = true;
|
||||
fStatusView->SetText(kTextDeviceUpFailed);
|
||||
break;
|
||||
|
||||
case PPP_REPORT_LOCAL_AUTHENTICATION_REQUESTED:
|
||||
case PPP_REPORT_PEER_AUTHENTICATION_REQUESTED:
|
||||
|
||||
case PPP_REPORT_AUTHENTICATION_REQUESTED:
|
||||
fStatusView->SetText(kTextAuthenticating);
|
||||
break;
|
||||
|
||||
case PPP_REPORT_LOCAL_AUTHENTICATION_FAILED:
|
||||
case PPP_REPORT_PEER_AUTHENTICATION_FAILED:
|
||||
|
||||
case PPP_REPORT_AUTHENTICATION_FAILED:
|
||||
fKeepLabel = true;
|
||||
fStatusView->SetText(kTextAuthenticationFailed);
|
||||
break;
|
||||
|
||||
|
||||
case PPP_REPORT_CONNECTION_LOST:
|
||||
fKeepLabel = true;
|
||||
fStatusView->SetText(kTextConnectionLost);
|
||||
@ -676,37 +672,37 @@ void
|
||||
DialUpView::WatchInterface(ppp_interface_id ID)
|
||||
{
|
||||
// This method can be used to update the interface's connection status.
|
||||
|
||||
|
||||
if(fWatching != ID) {
|
||||
fListener.StopWatchingInterfaces();
|
||||
|
||||
//fListener.StopWatchingInterfaces(); // FIXME
|
||||
|
||||
if(ID == PPP_UNDEFINED_INTERFACE_ID || fListener.WatchInterface(ID))
|
||||
fWatching = ID;
|
||||
}
|
||||
|
||||
|
||||
// update status
|
||||
PPPInterface interface(fWatching);
|
||||
if(interface.InitCheck() != B_OK) {
|
||||
UpdateStatus(PPP_REPORT_DOWN_SUCCESSFUL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ppp_interface_info_t info;
|
||||
interface.GetInterfaceInfo(&info);
|
||||
|
||||
|
||||
// transform phase into status
|
||||
switch(info.info.phase) {
|
||||
case PPP_DOWN_PHASE:
|
||||
UpdateStatus(PPP_REPORT_DOWN_SUCCESSFUL);
|
||||
break;
|
||||
|
||||
|
||||
case PPP_TERMINATION_PHASE:
|
||||
break;
|
||||
|
||||
|
||||
case PPP_ESTABLISHED_PHASE:
|
||||
UpdateStatus(PPP_REPORT_UP_SUCCESSFUL);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
UpdateStatus(PPP_REPORT_GOING_UP);
|
||||
}
|
||||
@ -722,7 +718,7 @@ DialUpView::LoadInterfaces()
|
||||
fDeleterItem = new BMenuItem(kLabelDeleteCurrent,
|
||||
new BMessage(kMsgDeleteCurrent));
|
||||
fInterfaceMenu->AddItem(fDeleterItem);
|
||||
|
||||
|
||||
BDirectory settingsDirectory;
|
||||
BEntry entry;
|
||||
BPath path;
|
||||
@ -758,7 +754,7 @@ DialUpView::LoadAddons()
|
||||
PPPoEAddon *pppoeAddon = new PPPoEAddon(&fAddons);
|
||||
fAddons.AddPointer(DUN_DEVICE_ADDON_TYPE, pppoeAddon);
|
||||
fAddons.AddPointer(DUN_DELETE_ON_QUIT, pppoeAddon);
|
||||
*/
|
||||
*/
|
||||
// "PAP" authenticator
|
||||
BMessage addon;
|
||||
addon.AddString("FriendlyName", "Plain-text Authentication");
|
||||
@ -766,7 +762,7 @@ DialUpView::LoadAddons()
|
||||
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
|
||||
}
|
||||
@ -780,7 +776,7 @@ DialUpView::AddInterface(const char *name, bool isNew)
|
||||
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
BMenuItem *item = new BMenuItem(name, new BMessage(kMsgSelectInterface));
|
||||
item->SetTarget(this);
|
||||
int32 index = FindNextMenuInsertionIndex(fInterfaceMenu, name);
|
||||
@ -788,7 +784,7 @@ DialUpView::AddInterface(const char *name, bool isNew)
|
||||
index = CountInterfaces();
|
||||
fInterfaceMenu->AddItem(item, index);
|
||||
UpdateControls();
|
||||
|
||||
|
||||
item->SetMarked(true);
|
||||
SelectInterface(index, isNew);
|
||||
}
|
||||
@ -800,11 +796,11 @@ DialUpView::SelectInterface(int32 index, bool isNew)
|
||||
BMenuItem *item = fInterfaceMenu->FindMarked();
|
||||
if(fCurrentItem && item == fCurrentItem)
|
||||
return;
|
||||
|
||||
|
||||
if(fCurrentItem && !SaveSettingsToFile())
|
||||
(new BAlert(kErrorTitle, kErrorSavingFailed, kLabelOK,
|
||||
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
|
||||
|
||||
|
||||
if(index >= CountInterfaces() || index < 0) {
|
||||
if(CountInterfaces() > 0)
|
||||
SelectInterface(0);
|
||||
@ -818,12 +814,12 @@ DialUpView::SelectInterface(int32 index, bool isNew)
|
||||
SelectInterface(0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
fCurrentItem->SetMarked(true);
|
||||
fDeleterItem->SetEnabled(true);
|
||||
WatchInterface(fListener.Manager().InterfaceWithName(fCurrentItem->Label()));
|
||||
}
|
||||
|
||||
|
||||
if(!fCurrentItem)
|
||||
LoadSettings(false);
|
||||
// tell modules to unload all settings
|
||||
|
@ -1,22 +1,22 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
@ -28,6 +28,12 @@
|
||||
|
||||
#include <PPPInterfaceListener.h>
|
||||
|
||||
class BMenuItem;
|
||||
class BStringView;
|
||||
class BButton;
|
||||
class BPopUpMenu;
|
||||
class BMenuField;
|
||||
class BTabView;
|
||||
class GeneralAddon;
|
||||
|
||||
|
||||
@ -35,12 +41,12 @@ class DialUpView : public BView {
|
||||
public:
|
||||
DialUpView(BRect frame);
|
||||
virtual ~DialUpView();
|
||||
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
|
||||
|
||||
void UpDownThread();
|
||||
|
||||
|
||||
// used by ppp_up application
|
||||
bool SelectInterfaceNamed(const char *name);
|
||||
bool NeedsRequest() const;
|
||||
@ -53,35 +59,35 @@ class DialUpView : public BView {
|
||||
private:
|
||||
void GetPPPDirectories(BDirectory *settingsDirectory,
|
||||
BDirectory *profileDirectory) const;
|
||||
|
||||
|
||||
void HandleReportMessage(BMessage *message);
|
||||
void CreateTabs();
|
||||
|
||||
|
||||
void UpdateStatus(int32 code);
|
||||
void WatchInterface(ppp_interface_id ID);
|
||||
|
||||
|
||||
bool LoadSettings(bool isNew);
|
||||
void IsModified(bool *settings, bool *profile);
|
||||
|
||||
|
||||
void LoadInterfaces();
|
||||
void LoadAddons();
|
||||
|
||||
|
||||
void AddInterface(const char *name, bool isNew = false);
|
||||
void SelectInterface(int32 index, bool isNew = false);
|
||||
int32 CountInterfaces() const;
|
||||
|
||||
|
||||
void UpdateControls();
|
||||
|
||||
private:
|
||||
PPPInterfaceListener fListener;
|
||||
|
||||
|
||||
thread_id fUpDownThread;
|
||||
|
||||
|
||||
BMessage fAddons, fSettings, fProfile;
|
||||
driver_settings *fDriverSettings;
|
||||
BMenuItem *fCurrentItem, *fDeleterItem;
|
||||
ppp_interface_id fWatching;
|
||||
|
||||
|
||||
GeneralAddon *fGeneralAddon;
|
||||
bool fKeepLabel;
|
||||
BStringView *fStatusView;
|
||||
|
@ -1,22 +1,22 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
@ -28,12 +28,15 @@
|
||||
#ifndef _GENERAL_ADDON__H
|
||||
#define _GENERAL_ADDON__H
|
||||
|
||||
#include <DialUpAddon.h>
|
||||
#include "DialUpAddon.h"
|
||||
|
||||
#include <CheckBox.h>
|
||||
#include <String.h>
|
||||
#include <TextControl.h>
|
||||
|
||||
class BBox;
|
||||
class BMenuField;
|
||||
class BMenuItem;
|
||||
class GeneralView;
|
||||
|
||||
|
||||
@ -41,10 +44,10 @@ class GeneralAddon : public DialUpAddon {
|
||||
public:
|
||||
GeneralAddon(BMessage *addons);
|
||||
virtual ~GeneralAddon();
|
||||
|
||||
|
||||
bool IsNew() const
|
||||
{ return fIsNew; }
|
||||
|
||||
|
||||
const char *DeviceName() const
|
||||
{ return fDeviceName.String(); }
|
||||
const char *Username() const
|
||||
@ -53,37 +56,37 @@ class GeneralAddon : public DialUpAddon {
|
||||
{ return fPassword.String(); }
|
||||
bool HasPassword() const
|
||||
{ return fHasPassword; }
|
||||
|
||||
|
||||
bool NeedsAuthenticationRequest() const;
|
||||
|
||||
|
||||
DialUpAddon *FindDevice(const BString& moduleName) const;
|
||||
DialUpAddon *DeviceAddon() const
|
||||
{ return fDeviceAddon; }
|
||||
|
||||
|
||||
int32 CountAuthenticators() const
|
||||
{ return fAuthenticatorsCount; }
|
||||
|
||||
|
||||
BMessage *Settings() const
|
||||
{ return fSettings; }
|
||||
BMessage *Profile() const
|
||||
{ return fProfile; }
|
||||
|
||||
|
||||
virtual int32 Position() const
|
||||
{ return 0; }
|
||||
virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew);
|
||||
bool LoadDeviceSettings();
|
||||
bool LoadAuthenticationSettings();
|
||||
|
||||
|
||||
virtual bool HasTemporaryProfile() const;
|
||||
virtual void IsModified(bool *settings, bool *profile) const;
|
||||
void IsDeviceModified(bool *settings, bool *profile) const;
|
||||
void IsAuthenticationModified(bool *settings, bool *profile) const;
|
||||
|
||||
|
||||
virtual bool SaveSettings(BMessage *settings, BMessage *profile,
|
||||
bool saveTemporary);
|
||||
virtual bool GetPreferredSize(float *width, float *height) const;
|
||||
virtual BView *CreateView(BPoint leftTop);
|
||||
|
||||
|
||||
// used by ppp_up application
|
||||
BView *AuthenticationView() const;
|
||||
|
||||
@ -106,31 +109,31 @@ class GeneralView : public BView {
|
||||
public:
|
||||
GeneralView(GeneralAddon *addon, BRect frame);
|
||||
virtual ~GeneralView();
|
||||
|
||||
|
||||
GeneralAddon *Addon() const
|
||||
{ return fAddon; }
|
||||
void Reload();
|
||||
|
||||
|
||||
const char *Username() const
|
||||
{ return fUsername->Text(); }
|
||||
const char *Password() const
|
||||
{ return fPassword->Text(); }
|
||||
bool DoesSavePassword() const
|
||||
{ return fSavePassword->Value(); }
|
||||
|
||||
|
||||
bool HasTemporaryProfile() const
|
||||
{ return !DoesSavePassword() || (fDeviceAddon &&
|
||||
fDeviceAddon->HasTemporaryProfile()); }
|
||||
|
||||
|
||||
DialUpAddon *DeviceAddon() const
|
||||
{ return fDeviceAddon; }
|
||||
const char *DeviceName() const;
|
||||
const char *AuthenticatorName() const;
|
||||
void IsDeviceModified(bool *settings, bool *profile) const;
|
||||
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
|
||||
|
||||
// used by ppp_up application
|
||||
BView *AuthenticationView() const
|
||||
{ return fAuthenticationView; }
|
||||
@ -138,7 +141,7 @@ class GeneralView : public BView {
|
||||
private:
|
||||
void ReloadDeviceView();
|
||||
void UpdateControls();
|
||||
|
||||
|
||||
void AddDevices();
|
||||
void AddAuthenticators();
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
@ -28,12 +28,13 @@
|
||||
#ifndef _IPCP_ADDON__H
|
||||
#define _IPCP_ADDON__H
|
||||
|
||||
#include <DialUpAddon.h>
|
||||
#include "DialUpAddon.h"
|
||||
|
||||
#include <CheckBox.h>
|
||||
#include <String.h>
|
||||
#include <TextControl.h>
|
||||
|
||||
class BButton;
|
||||
class IPCPView;
|
||||
|
||||
|
||||
@ -41,10 +42,10 @@ class IPCPAddon : public DialUpAddon {
|
||||
public:
|
||||
IPCPAddon(BMessage *addons);
|
||||
virtual ~IPCPAddon();
|
||||
|
||||
|
||||
bool IsNew() const
|
||||
{ return fIsNew; }
|
||||
|
||||
|
||||
bool IsEnabled() const
|
||||
{ return fIsEnabled; }
|
||||
const char *IPAddress() const
|
||||
@ -53,15 +54,15 @@ class IPCPAddon : public DialUpAddon {
|
||||
{ return fPrimaryDNS.String(); }
|
||||
const char *SecondaryDNS() const
|
||||
{ return fSecondaryDNS.String(); }
|
||||
|
||||
|
||||
BMessage *Settings() const
|
||||
{ return fSettings; }
|
||||
BMessage *Profile() const
|
||||
{ return fProfile; }
|
||||
|
||||
|
||||
virtual int32 Position() const
|
||||
{ return 10; }
|
||||
|
||||
|
||||
virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew);
|
||||
virtual void IsModified(bool *settings, bool *profile) const;
|
||||
virtual bool SaveSettings(BMessage *settings, BMessage *profile,
|
||||
@ -84,11 +85,11 @@ class IPCPAddon : public DialUpAddon {
|
||||
class IPCPView : public BView {
|
||||
public:
|
||||
IPCPView(IPCPAddon *addon, BRect frame);
|
||||
|
||||
|
||||
IPCPAddon *Addon() const
|
||||
{ return fAddon; }
|
||||
void Reload();
|
||||
|
||||
|
||||
bool IsEnabled() const
|
||||
{ return fIsEnabled->Value(); }
|
||||
const char *IPAddress() const
|
||||
@ -97,7 +98,7 @@ class IPCPView : public BView {
|
||||
{ return fPrimaryDNS->Text(); }
|
||||
const char *SecondaryDNS() const
|
||||
{ return fSecondaryDNS->Text(); }
|
||||
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
@ -24,12 +24,15 @@
|
||||
#define _INTERFACE_UTILS__H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <Point.h>
|
||||
|
||||
class DialUpAddon;
|
||||
class BListView;
|
||||
class BMenu;
|
||||
class BString;
|
||||
class BMenu;
|
||||
class BWindow;
|
||||
class BMessage;
|
||||
|
||||
|
||||
extern BPoint center_on_screen(BRect rect, BWindow *window = NULL);
|
||||
|
@ -2,14 +2,16 @@ SubDir HAIKU_TOP src add-ons network_settings dialup ;
|
||||
|
||||
UsePublicHeaders [ FDirName add-ons network_settings ] ;
|
||||
UsePrivateHeaders app libroot kernel net shared ;
|
||||
UsePrivateSystemHeaders ;
|
||||
UsePrivateKernelHeaders ; # FIXME: shouldn't be needed
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src preferences network ] : false ;
|
||||
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp shared libppp headers ] ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp shared libkernelppp headers ] ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp shared libppp headers ] : true ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp shared libkernelppp headers ] : true ;
|
||||
|
||||
# additonal headers for built-in add-ons:
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp pppoe ] ; # PPPoE
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp ipcp ] ; # IPCP
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp pppoe ] : true ; # PPPoE
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp ipcp ] : true ; # IPCP
|
||||
|
||||
AddResources DialUp : DialUpPreflet.rdef ;
|
||||
|
||||
@ -29,12 +31,10 @@ Addon DialUpInterface :
|
||||
PPPoEAddon.cpp
|
||||
|
||||
: be shared <nogrist>Network [ TargetLibsupc++ ]
|
||||
[ TargetLibstdc++ ] localestub
|
||||
[ TargetLibstdc++ ] localestub libppp.a
|
||||
;
|
||||
|
||||
|
||||
DoCatalogs DialUpInterface : x-vnd.Haiku-DialUpInterface :
|
||||
DialUpView.cpp
|
||||
;
|
||||
|
||||
#LinkSharedOSLibs DialUp : libppp.a be ;
|
||||
|
@ -1,22 +1,22 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
@ -28,11 +28,13 @@
|
||||
#ifndef _PPPoE_ADDON__H
|
||||
#define _PPPoE_ADDON__H
|
||||
|
||||
#include <DialUpAddon.h>
|
||||
#include "DialUpAddon.h"
|
||||
|
||||
#include <String.h>
|
||||
#include <TextControl.h>
|
||||
|
||||
class BMenuField;
|
||||
class BMenuItem;
|
||||
class PPPoEView;
|
||||
|
||||
|
||||
@ -40,33 +42,33 @@ class PPPoEAddon : public DialUpAddon {
|
||||
public:
|
||||
PPPoEAddon(BMessage *addons);
|
||||
virtual ~PPPoEAddon();
|
||||
|
||||
|
||||
bool IsNew() const
|
||||
{ return fIsNew; }
|
||||
|
||||
|
||||
const char *InterfaceName() const
|
||||
{ return fInterfaceName.String(); }
|
||||
const char *ServiceName() const
|
||||
{ return fServiceName.String(); }
|
||||
|
||||
|
||||
BMessage *Settings() const
|
||||
{ return fSettings; }
|
||||
BMessage *Profile() const
|
||||
{ return fProfile; }
|
||||
|
||||
|
||||
virtual const char *FriendlyName() const;
|
||||
virtual const char *TechnicalName() const;
|
||||
virtual const char *KernelModuleName() const;
|
||||
|
||||
|
||||
virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew);
|
||||
|
||||
|
||||
virtual void IsModified(bool *settings, bool *profile) const;
|
||||
|
||||
|
||||
virtual bool SaveSettings(BMessage *settings, BMessage *profile,
|
||||
bool saveTemporary);
|
||||
virtual bool GetPreferredSize(float *width, float *height) const;
|
||||
virtual BView *CreateView(BPoint leftTop);
|
||||
|
||||
|
||||
void UnregisterView()
|
||||
{ fPPPoEView = NULL; }
|
||||
|
||||
@ -85,16 +87,16 @@ class PPPoEView : public BView {
|
||||
public:
|
||||
PPPoEView(PPPoEAddon *addon, BRect frame);
|
||||
virtual ~PPPoEView();
|
||||
|
||||
|
||||
PPPoEAddon *Addon() const
|
||||
{ return fAddon; }
|
||||
void Reload();
|
||||
|
||||
|
||||
const char *InterfaceName() const
|
||||
{ return fInterfaceName.String(); }
|
||||
const char *ServiceName() const
|
||||
{ return fServiceName->Text(); }
|
||||
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
@ -25,16 +25,21 @@
|
||||
|
||||
#include <Window.h>
|
||||
|
||||
class BInvoker;
|
||||
class BTextView;
|
||||
class BTextControl;
|
||||
class BButton;
|
||||
|
||||
|
||||
class TextRequestDialog : public BWindow {
|
||||
public:
|
||||
TextRequestDialog(const char *title, const char *information,
|
||||
const char *request, const char *text = NULL);
|
||||
virtual ~TextRequestDialog();
|
||||
|
||||
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual bool QuitRequested();
|
||||
|
||||
|
||||
status_t Go(BInvoker *invoker);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user