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:
Augustin Cavalier
2017-04-18 15:40:10 -04:00
parent 0a694375a9
commit 9390158822
12 changed files with 498 additions and 396 deletions
+111 -31
View File
@@ -2,7 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/dirent.h> #include <dirent.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <String.h> #include <String.h>
@@ -10,36 +10,116 @@
#include <ListItem.h> #include <ListItem.h>
#include <ScrollView.h> #include <ScrollView.h>
#include <Box.h> #include <Box.h>
#include <Button.h> #include <Button.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Alert.h> #include <Alert.h>
#include <NetworkSetupAddOn.h> #include <NetworkSettings.h>
#include <NetworkSettingsAddOn.h>
#include "InterfaceListItem.h"
#include "DialUpView.h" #include "DialUpView.h"
class AddOn : public NetworkSetupAddOn
{ using namespace BNetworkKit;
class AddOn : public BNetworkSettingsAddOn {
public: public:
AddOn(image_id addon_image); AddOn(image_id addon_image, BNetworkSettings& settings);
~AddOn(); virtual ~AddOn();
const char * Name(); virtual BNetworkSettingsItem*
BView * CreateView(BRect *bounds); CreateNextItem(uint32& cookie);
}; };
NetworkSetupAddOn * get_nth_addon(image_id image, int index) class DialUpInterfaceItem : public BNetworkSettingsItem {
{ public:
if (index == 0) DialUpInterfaceItem(BNetworkSettings& settings);
return new AddOn(image); virtual ~DialUpInterfaceItem();
return NULL;
} 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 - // #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; return new AddOn(image, settings);
if (r.Width() < 200 || r.Height() < 400)
r.Set(0, 0, 200, 400);
BView *view = new DialUpView(r);
*bounds = view->Bounds();
return view;
} }
@@ -1,22 +1,22 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* Copyright (c) 2003-2004 Waldemar Kornewald, [email protected] * Copyright (c) 2003-2004 Waldemar Kornewald, [email protected]
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * 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. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * 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 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
@@ -64,50 +64,52 @@ ConnectionOptionsAddon::LoadSettings(BMessage *settings, BMessage *profile, bool
fDoesDialOnDemand = fAskBeforeDialing = fDoesAutoRedial = false; fDoesDialOnDemand = fAskBeforeDialing = fDoesAutoRedial = false;
fSettings = settings; fSettings = settings;
fProfile = profile; fProfile = profile;
if(fConnectionOptionsView) 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;
BMessage parameter; BMessage parameter;
int32 index = 0; int32 index = 0;
const char *value; const char *value;
/* FIXME!
if(FindMessageParameter(PPP_DIAL_ON_DEMAND_KEY, *fSettings, &parameter, &index) if(FindMessageParameter(PPP_DIAL_ON_DEMAND_KEY, *fSettings, &parameter, &index)
&& parameter.FindString(MDSU_VALUES, &value) == B_OK) { && parameter.FindString(MDSU_VALUES, &value) == B_OK) {
if(get_boolean_value(value, false)) if(get_boolean_value(value, false))
fDoesDialOnDemand = true; fDoesDialOnDemand = true;
parameter.AddBool(MDSU_VALID, true); parameter.AddBool(MDSU_VALID, true);
fSettings->ReplaceMessage(MDSU_PARAMETERS, index, &parameter); fSettings->ReplaceMessage(MDSU_PARAMETERS, index, &parameter);
} }
index = 0; index = 0;
if(FindMessageParameter(PPP_ASK_BEFORE_DIALING_KEY, *fSettings, &parameter, &index) if(FindMessageParameter(PPP_ASK_BEFORE_DIALING_KEY, *fSettings, &parameter, &index)
&& parameter.FindString(MDSU_VALUES, &value) == B_OK) { && parameter.FindString(MDSU_VALUES, &value) == B_OK) {
if(get_boolean_value(value, false)) if(get_boolean_value(value, false))
fAskBeforeDialing = true; fAskBeforeDialing = true;
parameter.AddBool(MDSU_VALID, true); parameter.AddBool(MDSU_VALID, true);
fSettings->ReplaceMessage(MDSU_PARAMETERS, index, &parameter); fSettings->ReplaceMessage(MDSU_PARAMETERS, index, &parameter);
} }
index = 0; index = 0;
if(FindMessageParameter(PPP_AUTO_REDIAL_KEY, *fSettings, &parameter, &index) if(FindMessageParameter(PPP_AUTO_REDIAL_KEY, *fSettings, &parameter, &index)
&& parameter.FindString(MDSU_VALUES, &value) == B_OK) { && parameter.FindString(MDSU_VALUES, &value) == B_OK) {
if(get_boolean_value(value, false)) if(get_boolean_value(value, false))
fDoesAutoRedial = true; fDoesAutoRedial = true;
parameter.AddBool(MDSU_VALID, true); parameter.AddBool(MDSU_VALID, true);
fSettings->ReplaceMessage(MDSU_PARAMETERS, index, &parameter); fSettings->ReplaceMessage(MDSU_PARAMETERS, index, &parameter);
} }
*/
if(fConnectionOptionsView) if(fConnectionOptionsView)
fConnectionOptionsView->Reload(); fConnectionOptionsView->Reload();
// reload new settings // reload new settings
return true; return true;
} }
@@ -116,10 +118,10 @@ void
ConnectionOptionsAddon::IsModified(bool *settings, bool *profile) const ConnectionOptionsAddon::IsModified(bool *settings, bool *profile) const
{ {
*settings = *profile = false; *settings = *profile = false;
if(!fSettings || !fConnectionOptionsView) if(!fSettings || !fConnectionOptionsView)
return; return;
*settings = DoesDialOnDemand() != fConnectionOptionsView->DoesDialOnDemand() *settings = DoesDialOnDemand() != fConnectionOptionsView->DoesDialOnDemand()
|| AskBeforeDialing() != fConnectionOptionsView->AskBeforeDialing() || AskBeforeDialing() != fConnectionOptionsView->AskBeforeDialing()
|| DoesAutoRedial() != fConnectionOptionsView->DoesAutoRedial(); || DoesAutoRedial() != fConnectionOptionsView->DoesAutoRedial();
@@ -131,29 +133,29 @@ ConnectionOptionsAddon::SaveSettings(BMessage *settings, BMessage *profile, bool
{ {
if(!fSettings || !settings) if(!fSettings || !settings)
return false; return false;
BMessage parameter; BMessage parameter;
if(fConnectionOptionsView->DoesDialOnDemand()) { if(fConnectionOptionsView->DoesDialOnDemand()) {
parameter.MakeEmpty(); 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"); parameter.AddString(MDSU_VALUES, "enabled");
settings->AddMessage(MDSU_PARAMETERS, &parameter); settings->AddMessage(MDSU_PARAMETERS, &parameter);
if(fConnectionOptionsView->AskBeforeDialing()) { if(fConnectionOptionsView->AskBeforeDialing()) {
parameter.MakeEmpty(); 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"); parameter.AddString(MDSU_VALUES, "enabled");
settings->AddMessage(MDSU_PARAMETERS, &parameter); settings->AddMessage(MDSU_PARAMETERS, &parameter);
} }
} }
if(fConnectionOptionsView->DoesAutoRedial()) { if(fConnectionOptionsView->DoesAutoRedial()) {
parameter.MakeEmpty(); parameter.MakeEmpty();
parameter.AddString(MDSU_NAME, PPP_AUTO_REDIAL_KEY); // parameter.AddString(MDSU_NAME, PPP_AUTO_REDIAL_KEY); // FIXME
parameter.AddString(MDSU_VALUES, "enabled"); parameter.AddString(MDSU_VALUES, "enabled");
settings->AddMessage(MDSU_PARAMETERS, &parameter); settings->AddMessage(MDSU_PARAMETERS, &parameter);
} }
return true; return true;
} }
@@ -165,12 +167,12 @@ ConnectionOptionsAddon::GetPreferredSize(float *width, float *height) const
if(Addons()->FindRect(DUN_TAB_VIEW_RECT, &rect) != B_OK) if(Addons()->FindRect(DUN_TAB_VIEW_RECT, &rect) != B_OK)
rect.Set(0, 0, 200, 300); rect.Set(0, 0, 200, 300);
// set default values // set default values
if(width) if(width)
*width = rect.Width(); *width = rect.Width();
if(height) if(height)
*height = rect.Height(); *height = rect.Height();
return true; return true;
} }
@@ -184,7 +186,7 @@ ConnectionOptionsAddon::CreateView(BPoint leftTop)
fConnectionOptionsView = new ConnectionOptionsView(this, rect); fConnectionOptionsView = new ConnectionOptionsView(this, rect);
fConnectionOptionsView->Reload(); fConnectionOptionsView->Reload();
} }
fConnectionOptionsView->MoveTo(leftTop); fConnectionOptionsView->MoveTo(leftTop);
return fConnectionOptionsView; return fConnectionOptionsView;
} }
@@ -208,7 +210,7 @@ ConnectionOptionsView::ConnectionOptionsView(ConnectionOptionsAddon *addon, BRec
rect.top = rect.bottom + 20; rect.top = rect.bottom + 20;
rect.bottom = rect.top + 15; rect.bottom = rect.top + 15;
fAutoRedial = new BCheckBox(rect, "AutoRedial", kLabelAutoRedial, NULL); fAutoRedial = new BCheckBox(rect, "AutoRedial", kLabelAutoRedial, NULL);
AddChild(fDialOnDemand); AddChild(fDialOnDemand);
AddChild(fAskBeforeDialing); AddChild(fAskBeforeDialing);
AddChild(fAutoRedial); AddChild(fAutoRedial);
@@ -222,10 +224,10 @@ ConnectionOptionsView::Reload()
// this is enabled by default // this is enabled by default
fAskBeforeDialing->SetValue(Addon()->AskBeforeDialing()); fAskBeforeDialing->SetValue(Addon()->AskBeforeDialing());
fAutoRedial->SetValue(Addon()->DoesAutoRedial()); fAutoRedial->SetValue(Addon()->DoesAutoRedial());
if(!Addon()->Settings()) if(!Addon()->Settings())
return; return;
UpdateControls(); UpdateControls();
} }
@@ -245,7 +247,7 @@ ConnectionOptionsView::MessageReceived(BMessage *message)
case kMsgUpdateControls: case kMsgUpdateControls:
UpdateControls(); UpdateControls();
break; break;
default: default:
BView::MessageReceived(message); BView::MessageReceived(message);
} }
@@ -1,22 +1,22 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* Copyright (c) 2003-2004 Waldemar Kornewald, [email protected] * Copyright (c) 2003-2004 Waldemar Kornewald, [email protected]
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * 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. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * 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 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
@@ -28,7 +28,7 @@
#ifndef _CONNECTION_OPTIONS_ADDON__H #ifndef _CONNECTION_OPTIONS_ADDON__H
#define _CONNECTION_OPTIONS_ADDON__H #define _CONNECTION_OPTIONS_ADDON__H
#include <DialUpAddon.h> #include "DialUpAddon.h"
#include <CheckBox.h> #include <CheckBox.h>
#include <RadioButton.h> #include <RadioButton.h>
@@ -40,22 +40,22 @@ class ConnectionOptionsAddon : public DialUpAddon {
public: public:
ConnectionOptionsAddon(BMessage *addons); ConnectionOptionsAddon(BMessage *addons);
virtual ~ConnectionOptionsAddon(); virtual ~ConnectionOptionsAddon();
bool IsNew() const bool IsNew() const
{ return fIsNew; } { return fIsNew; }
bool DoesDialOnDemand() const bool DoesDialOnDemand() const
{ return fDoesDialOnDemand; } { return fDoesDialOnDemand; }
bool AskBeforeDialing() const bool AskBeforeDialing() const
{ return fAskBeforeDialing; } { return fAskBeforeDialing; }
bool DoesAutoRedial() const bool DoesAutoRedial() const
{ return fDoesAutoRedial; } { return fDoesAutoRedial; }
BMessage *Settings() const BMessage *Settings() const
{ return fSettings; } { return fSettings; }
BMessage *Profile() const BMessage *Profile() const
{ return fProfile; } { return fProfile; }
virtual int32 Position() const virtual int32 Position() const
{ return 50; } { return 50; }
virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew); virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew);
@@ -77,18 +77,18 @@ class ConnectionOptionsAddon : public DialUpAddon {
class ConnectionOptionsView : public BView { class ConnectionOptionsView : public BView {
public: public:
ConnectionOptionsView(ConnectionOptionsAddon *addon, BRect frame); ConnectionOptionsView(ConnectionOptionsAddon *addon, BRect frame);
ConnectionOptionsAddon *Addon() const ConnectionOptionsAddon *Addon() const
{ return fAddon; } { return fAddon; }
void Reload(); void Reload();
bool DoesDialOnDemand() const bool DoesDialOnDemand() const
{ return fDialOnDemand->Value(); } { return fDialOnDemand->Value(); }
bool AskBeforeDialing() const bool AskBeforeDialing() const
{ return fAskBeforeDialing->Value(); } { return fAskBeforeDialing->Value(); }
bool DoesAutoRedial() const bool DoesAutoRedial() const
{ return fAutoRedial->Value(); } { return fAutoRedial->Value(); }
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
@@ -1,28 +1,28 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* Copyright (c) 2004 Waldemar Kornewald, [email protected] * Copyright (c) 2004 Waldemar Kornewald, [email protected]
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * 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. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * 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 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
/*! \class DialUpAddon /*! \class DialUpAddon
\brief Base class for DialUpPreflet add-ons. \brief Base class for DialUpPreflet add-ons.
Dial-Up add-ons must export the following function: \n Dial-Up add-ons must export the following function: \n
bool register(BMessage *addons) \n bool register(BMessage *addons) \n
You should add your DialUpAddon object to the given BMessage. \n You should add your DialUpAddon object to the given BMessage. \n
@@ -39,6 +39,10 @@
#include <SupportDefs.h> #include <SupportDefs.h>
#include <Point.h> #include <Point.h>
class BMessage;
class BView;
class DialUpView;
#define DUN_MAXIMUM_PRIORITY 50 #define DUN_MAXIMUM_PRIORITY 50
@@ -57,18 +61,18 @@
class DialUpAddon { class DialUpAddon {
friend class DialUpView; friend class DialUpView;
public: public:
//! Constructor. The BMessage is the one passed to the \c register() function. //! Constructor. The BMessage is the one passed to the \c register() function.
DialUpAddon(BMessage *addons) : fAddons(addons) {} DialUpAddon(BMessage *addons) : fAddons(addons) {}
//! Destructor. Does nothing. //! Destructor. Does nothing.
virtual ~DialUpAddon() {} virtual ~DialUpAddon() {}
//! Returns the BMessage object holding all add-ons. //! Returns the BMessage object holding all add-ons.
BMessage *Addons() const BMessage *Addons() const
{ return fAddons; } { return fAddons; }
//! Returns a name readable by humans without much technical knowledge. //! Returns a name readable by humans without much technical knowledge.
virtual const char *FriendlyName() const virtual const char *FriendlyName() const
{ return NULL; } { return NULL; }
@@ -84,17 +88,17 @@ class DialUpAddon {
//! Allows setting an order in which modules are asked to add the settings. //! Allows setting an order in which modules are asked to add the settings.
virtual int32 Priority() const virtual int32 Priority() const
{ return 0; } { return 0; }
/*! \brief Load the given settings and profile. /*! \brief Load the given settings and profile.
\param isNew Specifies if this is a newly created interface. \param isNew Specifies if this is a newly created interface.
\return \c true if loading was successful or \c false otherwise. \return \c true if loading was successful or \c false otherwise.
*/ */
virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew) virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew)
{ return false; } { return false; }
/*! \brief Returns if this module has a temporary profile. /*! \brief Returns if this module has a temporary profile.
A temporary profile is never stored on the hard-disk, but only passed A temporary profile is never stored on the hard-disk, but only passed
to the interface on connection. This can include passwords, for example. 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 virtual void IsModified(bool *settings, bool *profile) const
{ *settings = *profile = false; } { *settings = *profile = false; }
/*! \brief Save the given settings and profile. /*! \brief Save the given settings and profile.
\param saveTemporary Specifies if the temporary profile should be written. \param saveTemporary Specifies if the temporary profile should be written.
\return \c true if saving was successful or \c false otherwise. \return \c true if saving was successful or \c false otherwise.
*/ */
virtual bool SaveSettings(BMessage *settings, BMessage *profile, virtual bool SaveSettings(BMessage *settings, BMessage *profile,
bool saveTemporary) bool saveTemporary)
{ return false; } { return false; }
/*! \brief Get the preferred view size. /*! \brief Get the preferred view size.
\return \c false if this module does not export a BView object. \return \c false if this module does not export a BView object.
*/ */
virtual bool GetPreferredSize(float *width, float *height) const virtual bool GetPreferredSize(float *width, float *height) const
{ return false; } { return false; }
/*! \brief Returns the module's BView object. /*! \brief Returns the module's BView object.
\param leftTop Specifies the view's left-top coordinates. \param leftTop Specifies the view's left-top coordinates.
*/ */
virtual BView *CreateView(BPoint leftTop) virtual BView *CreateView(BPoint leftTop)
@@ -133,7 +137,7 @@ class DialUpAddon {
private: private:
BMessage *fAddons; BMessage *fAddons;
int32 _reserved[7]; int32 _reserved[7];
}; };
+119 -123
View File
@@ -1,22 +1,22 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* Copyright (c) 2003-2004 Waldemar Kornewald, [email protected] * Copyright (c) 2003-2004 Waldemar Kornewald, [email protected]
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * 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. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * 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 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
@@ -116,11 +116,11 @@ DialUpView::DialUpView(BRect frame)
BRect bounds = Bounds(); BRect bounds = Bounds();
// for caching // for caching
SetViewUIColor(B_PANEL_BACKGROUND_COLOR); SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
// 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); fAddons.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);
BRect rect = bounds; BRect rect = bounds;
@@ -128,7 +128,7 @@ DialUpView::DialUpView(BRect frame)
rect.bottom = rect.top + 20; rect.bottom = rect.top + 20;
fMenuField = new BMenuField(rect, "Interfaces", kLabelInterface, fInterfaceMenu); fMenuField = new BMenuField(rect, "Interfaces", kLabelInterface, fInterfaceMenu);
fMenuField->SetDivider(StringWidth(fMenuField->Label()) + 5); fMenuField->SetDivider(StringWidth(fMenuField->Label()) + 5);
rect.top = rect.bottom + 10; rect.top = rect.bottom + 10;
rect.bottom = bounds.bottom rect.bottom = bounds.bottom
- 20 // height of bottom controls - 20 // height of bottom controls
@@ -137,7 +137,7 @@ DialUpView::DialUpView(BRect frame)
BRect tabViewRect(fTabView->Bounds()); BRect tabViewRect(fTabView->Bounds());
tabViewRect.bottom -= fTabView->TabHeight(); tabViewRect.bottom -= fTabView->TabHeight();
fAddons.AddRect(DUN_TAB_VIEW_RECT, tabViewRect); fAddons.AddRect(DUN_TAB_VIEW_RECT, tabViewRect);
BRect tmpRect(rect); BRect tmpRect(rect);
tmpRect.top += (tmpRect.Height() - 15) / 2; tmpRect.top += (tmpRect.Height() - 15) / 2;
tmpRect.bottom = tmpRect.top + 15; tmpRect.bottom = tmpRect.top + 15;
@@ -153,25 +153,25 @@ DialUpView::DialUpView(BRect frame)
tmpRect.left = (rect.Width() - fCreateNewButton->Bounds().Width()) / 2 + rect.left; tmpRect.left = (rect.Width() - fCreateNewButton->Bounds().Width()) / 2 + rect.left;
fCreateNewButton->MoveTo(tmpRect.left, tmpRect.top); fCreateNewButton->MoveTo(tmpRect.left, tmpRect.top);
fCreateNewButton->Hide(); fCreateNewButton->Hide();
rect.top = rect.bottom + 15; rect.top = rect.bottom + 15;
rect.bottom = rect.top + 15; rect.bottom = rect.top + 15;
rect.right = rect.left + 200; rect.right = rect.left + 200;
fStatusView = new BStringView(rect, "StatusView", kTextNotConnected, B_FOLLOW_BOTTOM); fStatusView = new BStringView(rect, "StatusView", kTextNotConnected, B_FOLLOW_BOTTOM);
rect.InsetBy(0, -5); rect.InsetBy(0, -5);
rect.left = rect.right + 5; rect.left = rect.right + 5;
rect.right = bounds.right - 5; rect.right = bounds.right - 5;
fConnectButton = new BButton(rect, "ConnectButton", kLabelConnect, fConnectButton = new BButton(rect, "ConnectButton", kLabelConnect,
new BMessage(kMsgConnectButton), B_FOLLOW_BOTTOM); new BMessage(kMsgConnectButton), B_FOLLOW_BOTTOM);
AddChild(fMenuField); AddChild(fMenuField);
AddChild(fTabView); AddChild(fTabView);
AddChild(fStringView); AddChild(fStringView);
AddChild(fCreateNewButton); AddChild(fCreateNewButton);
AddChild(fStatusView); AddChild(fStatusView);
AddChild(fConnectButton); AddChild(fConnectButton);
// initialize // initialize
LoadInterfaces(); LoadInterfaces();
LoadAddons(); LoadAddons();
@@ -186,10 +186,10 @@ DialUpView::DialUpView(BRect frame)
DialUpView::~DialUpView() DialUpView::~DialUpView()
{ {
SaveSettingsToFile(); 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.) // free known add-on types (these should free their known add-on types, etc.)
DialUpAddon *addon; DialUpAddon *addon;
for(int32 index = 0; for(int32 index = 0;
@@ -206,7 +206,7 @@ DialUpView::AttachedToWindow()
fInterfaceMenu->SetTargetForItems(this); fInterfaceMenu->SetTargetForItems(this);
fCreateNewButton->SetTarget(this); fCreateNewButton->SetTarget(this);
fConnectButton->SetTarget(this); fConnectButton->SetTarget(this);
if(fListener.InitCheck() != B_OK) { if(fListener.InitCheck() != B_OK) {
(new BAlert(kErrorTitle, kErrorNoPPPStack, kLabelOK, (new BAlert(kErrorTitle, kErrorNoPPPStack, kLabelOK,
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL); NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
@@ -222,30 +222,30 @@ DialUpView::MessageReceived(BMessage *message)
case PPP_REPORT_MESSAGE: case PPP_REPORT_MESSAGE:
HandleReportMessage(message); HandleReportMessage(message);
break; break;
// ------------------------------------------------- // -------------------------------------------------
case kMsgCreateNew: { case kMsgCreateNew: {
(new TextRequestDialog(kLabelCreateNewInterface, kTextChooseInterfaceName, (new TextRequestDialog(kLabelCreateNewInterface, kTextChooseInterfaceName,
kLabelInterfaceName))->Go( kLabelInterfaceName))->Go(
new BInvoker(new BMessage(kMsgFinishCreateNew), this)); new BInvoker(new BMessage(kMsgFinishCreateNew), this));
} break; } break;
case kMsgFinishCreateNew: { case kMsgFinishCreateNew: {
int32 which; int32 which;
message->FindInt32("which", &which); message->FindInt32("which", &which);
const char *name = message->FindString("text"); const char *name = message->FindString("text");
if(which == 1 && name && strlen(name) > 0) if(which == 1 && name && strlen(name) > 0)
AddInterface(name, true); AddInterface(name, true);
if(fCurrentItem) if(fCurrentItem)
fCurrentItem->SetMarked(true); fCurrentItem->SetMarked(true);
} break; } break;
// ------------------------------------------------- // -------------------------------------------------
case kMsgDeleteCurrent: { case kMsgDeleteCurrent: {
if(!fCurrentItem) if(!fCurrentItem)
return; return;
fInterfaceMenu->RemoveItem(fCurrentItem); fInterfaceMenu->RemoveItem(fCurrentItem);
BDirectory settings, profile; BDirectory settings, profile;
GetPPPDirectories(&settings, &profile); GetPPPDirectories(&settings, &profile);
@@ -256,31 +256,31 @@ DialUpView::MessageReceived(BMessage *message)
entry.Remove(); entry.Remove();
delete fCurrentItem; delete fCurrentItem;
fCurrentItem = NULL; fCurrentItem = NULL;
BMenuItem *marked = fInterfaceMenu->FindMarked(); BMenuItem *marked = fInterfaceMenu->FindMarked();
if(marked) if(marked)
marked->SetMarked(false); marked->SetMarked(false);
UpdateControls(); UpdateControls();
SelectInterface(0); SelectInterface(0);
// this stops watching the deleted interface // this stops watching the deleted interface
} break; } break;
case kMsgSelectInterface: { case kMsgSelectInterface: {
int32 index; int32 index;
message->FindInt32("index", &index); message->FindInt32("index", &index);
SelectInterface(index); SelectInterface(index);
} break; } break;
case kMsgConnectButton: { case kMsgConnectButton: {
if(!fCurrentItem || fUpDownThread != -1) if(!fCurrentItem || fUpDownThread != -1)
return; return;
fUpDownThread = spawn_thread(up_down_thread, "up_down_thread", fUpDownThread = spawn_thread(up_down_thread, "up_down_thread",
B_NORMAL_PRIORITY, this); B_NORMAL_PRIORITY, this);
resume_thread(fUpDownThread); resume_thread(fUpDownThread);
} break; } break;
default: default:
BView::MessageReceived(message); BView::MessageReceived(message);
} }
@@ -291,13 +291,13 @@ bool
DialUpView::SelectInterfaceNamed(const char *name) DialUpView::SelectInterfaceNamed(const char *name)
{ {
BMenuItem *item = fInterfaceMenu->FindItem(name); BMenuItem *item = fInterfaceMenu->FindItem(name);
int32 index = fInterfaceMenu->IndexOf(item); int32 index = fInterfaceMenu->IndexOf(item);
if(!item || index >= CountInterfaces()) if(!item || index >= CountInterfaces())
return false; return false;
SelectInterface(index); SelectInterface(index);
return true; return true;
} }
@@ -337,7 +337,7 @@ DialUpView::LoadSettings(bool isNew)
fProfile.MakeEmpty(); fProfile.MakeEmpty();
BMessage *settingsPointer = fCurrentItem ? &fSettings : NULL, BMessage *settingsPointer = fCurrentItem ? &fSettings : NULL,
*profilePointer = fCurrentItem ? &fProfile : NULL; *profilePointer = fCurrentItem ? &fProfile : NULL;
if(fCurrentItem && !isNew) { if(fCurrentItem && !isNew) {
BString name("pppidf/"); BString name("pppidf/");
name << fCurrentItem->Label(); name << fCurrentItem->Label();
@@ -348,19 +348,19 @@ DialUpView::LoadSettings(bool isNew)
if(!ReadMessageDriverSettings(name.String(), &fProfile)) if(!ReadMessageDriverSettings(name.String(), &fProfile))
profilePointer = settingsPointer; profilePointer = settingsPointer;
} }
DialUpAddon *addon; DialUpAddon *addon;
for(int32 index = 0; fAddons.FindPointer(DUN_TAB_ADDON_TYPE, index, for(int32 index = 0; fAddons.FindPointer(DUN_TAB_ADDON_TYPE, index,
reinterpret_cast<void**>(&addon)) == B_OK; index++) { reinterpret_cast<void**>(&addon)) == B_OK; index++) {
if(!addon) if(!addon)
continue; continue;
if(!addon->LoadSettings(settingsPointer, profilePointer, isNew)) if(!addon->LoadSettings(settingsPointer, profilePointer, isNew))
return false; return false;
} }
// TODO: check if settings are valid // TODO: check if settings are valid
return true; return true;
} }
@@ -371,13 +371,13 @@ DialUpView::IsModified(bool *settings, bool *profile)
*settings = *profile = false; *settings = *profile = false;
bool addonSettingsChanged, addonProfileChanged; bool addonSettingsChanged, addonProfileChanged;
// for current addon // for current addon
DialUpAddon *addon; DialUpAddon *addon;
for(int32 index = 0; fAddons.FindPointer(DUN_TAB_ADDON_TYPE, index, for(int32 index = 0; fAddons.FindPointer(DUN_TAB_ADDON_TYPE, index,
reinterpret_cast<void**>(&addon)) == B_OK; index++) { reinterpret_cast<void**>(&addon)) == B_OK; index++) {
if(!addon) if(!addon)
continue; continue;
addon->IsModified(&addonSettingsChanged, &addonProfileChanged); addon->IsModified(&addonSettingsChanged, &addonProfileChanged);
if(addonSettingsChanged) if(addonSettingsChanged)
*settings = true; *settings = true;
@@ -392,7 +392,7 @@ DialUpView::SaveSettings(BMessage *settings, BMessage *profile, bool saveTempora
{ {
if(!fCurrentItem || !settings || !profile) if(!fCurrentItem || !settings || !profile)
return false; return false;
DialUpAddon *addon; DialUpAddon *addon;
TemplateList<DialUpAddon*> addons; TemplateList<DialUpAddon*> addons;
for(int32 index = 0; for(int32 index = 0;
@@ -400,23 +400,23 @@ DialUpView::SaveSettings(BMessage *settings, BMessage *profile, bool saveTempora
reinterpret_cast<void**>(&addon)) == B_OK; index++) { reinterpret_cast<void**>(&addon)) == B_OK; index++) {
if(!addon) if(!addon)
continue; continue;
int32 insertIndex = 0; int32 insertIndex = 0;
for(; insertIndex < addons.CountItems(); insertIndex++) for(; insertIndex < addons.CountItems(); insertIndex++)
if(addons.ItemAt(insertIndex)->Priority() <= addon->Priority()) if(addons.ItemAt(insertIndex)->Priority() <= addon->Priority())
break; break;
addons.AddItem(addon, insertIndex); addons.AddItem(addon, insertIndex);
} }
settings->AddInt32("Interface", static_cast<int32>(fWatching)); settings->AddInt32("Interface", static_cast<int32>(fWatching));
if(fCurrentItem) if(fCurrentItem)
settings->AddString("InterfaceName", fCurrentItem->Label()); settings->AddString("InterfaceName", fCurrentItem->Label());
for(int32 index = 0; index < addons.CountItems(); index++) for(int32 index = 0; index < addons.CountItems(); index++)
if(!addons.ItemAt(index)->SaveSettings(settings, profile, saveTemporary)) if(!addons.ItemAt(index)->SaveSettings(settings, profile, saveTemporary))
return false; return false;
return true; return true;
} }
@@ -428,28 +428,28 @@ DialUpView::SaveSettingsToFile()
IsModified(&settingsChanged, &profileChanged); IsModified(&settingsChanged, &profileChanged);
if(!settingsChanged && !profileChanged) if(!settingsChanged && !profileChanged)
return true; return true;
BMessage settings, profile; BMessage settings, profile;
if(!SaveSettings(&settings, &profile, false)) if(!SaveSettings(&settings, &profile, false))
return false; return false;
BDirectory settingsDirectory; BDirectory settingsDirectory;
BDirectory profileDirectory; BDirectory profileDirectory;
GetPPPDirectories(&settingsDirectory, &profileDirectory); GetPPPDirectories(&settingsDirectory, &profileDirectory);
if(settingsDirectory.InitCheck() != B_OK || profileDirectory.InitCheck() != B_OK) if(settingsDirectory.InitCheck() != B_OK || profileDirectory.InitCheck() != B_OK)
return false; return false;
BFile file; BFile file;
if(settingsChanged) { if(settingsChanged) {
settingsDirectory.CreateFile(fCurrentItem->Label(), &file); settingsDirectory.CreateFile(fCurrentItem->Label(), &file);
WriteMessageDriverSettings(file, settings); WriteMessageDriverSettings(file, settings);
} }
if(profileChanged) { if(profileChanged) {
profileDirectory.CreateFile(fCurrentItem->Label(), &file); profileDirectory.CreateFile(fCurrentItem->Label(), &file);
WriteMessageDriverSettings(file, profile); WriteMessageDriverSettings(file, profile);
} }
return true; return true;
} }
@@ -461,39 +461,40 @@ DialUpView::UpDownThread()
BMessage settings, profile; BMessage settings, profile;
SaveSettings(&settings, &profile, true); SaveSettings(&settings, &profile, true);
// save temporary profile // save temporary profile
driver_settings *temporaryProfile = MessageToDriverSettings(profile); //driver_settings *temporaryProfile = MessageToDriverSettings(profile);
PPPInterface interface; PPPInterface interface;
if(fWatching == PPP_UNDEFINED_INTERFACE_ID) { if (fWatching == PPP_UNDEFINED_INTERFACE_ID) {
interface = fListener.Manager().InterfaceWithName(fCurrentItem->Label()); interface = fListener.Manager().InterfaceWithName(fCurrentItem->Label());
if(interface.InitCheck() != B_OK) if(interface.InitCheck() != B_OK)
interface = fListener.Manager().CreateInterfaceWithName( interface = fListener.Manager().CreateInterfaceWithName(
fCurrentItem->Label(), temporaryProfile); fCurrentItem->Label());
} else { } else {
interface = fWatching; interface = fWatching;
interface.SetProfile(temporaryProfile); //interface.SetProfile(temporaryProfile);
} }
free_driver_settings(temporaryProfile); //free_driver_settings(temporaryProfile);
if(interface.InitCheck() != B_OK) { if(interface.InitCheck() != B_OK) {
Window()->Lock(); Window()->Lock();
fStatusView->SetText(kTextCreationError); fStatusView->SetText(kTextCreationError);
Window()->Unlock(); Window()->Unlock();
return; return;
} }
ppp_interface_info_t info; ppp_interface_info_t info;
interface.GetInterfaceInfo(&info); interface.GetInterfaceInfo(&info);
if(info.info.phase == PPP_DOWN_PHASE) if(info.info.phase == PPP_DOWN_PHASE)
interface.Up(); interface.Up();
else else
interface.Down(); interface.Down();
fUpDownThread = -1; fUpDownThread = -1;
} }
#define PPP_INTERFACE_SETTINGS_PATH "" // FIXME!
void void
DialUpView::GetPPPDirectories(BDirectory *settingsDirectory, DialUpView::GetPPPDirectories(BDirectory *settingsDirectory,
BDirectory *profileDirectory) const BDirectory *profileDirectory) const
@@ -504,17 +505,17 @@ DialUpView::GetPPPDirectories(BDirectory *settingsDirectory,
create_directory(PPP_INTERFACE_SETTINGS_PATH, 0750); create_directory(PPP_INTERFACE_SETTINGS_PATH, 0750);
settings.SetTo(PPP_INTERFACE_SETTINGS_PATH); settings.SetTo(PPP_INTERFACE_SETTINGS_PATH);
} }
*settingsDirectory = settings; *settingsDirectory = settings;
} }
if(profileDirectory) { if(profileDirectory) {
BDirectory profile(PPP_INTERFACE_SETTINGS_PATH "/profile"); BDirectory profile(PPP_INTERFACE_SETTINGS_PATH "/profile");
if(profile.InitCheck() != B_OK) { if(profile.InitCheck() != B_OK) {
create_directory(PPP_INTERFACE_SETTINGS_PATH "/profile", 0750); create_directory(PPP_INTERFACE_SETTINGS_PATH "/profile", 0750);
profile.SetTo(PPP_INTERFACE_SETTINGS_PATH "/profile"); profile.SetTo(PPP_INTERFACE_SETTINGS_PATH "/profile");
} }
*profileDirectory = profile; *profileDirectory = profile;
} }
} }
@@ -525,41 +526,41 @@ DialUpView::HandleReportMessage(BMessage *message)
{ {
thread_id sender; thread_id sender;
message->FindInt32("sender", &sender); message->FindInt32("sender", &sender);
send_data(sender, B_OK, NULL, 0); send_data(sender, B_OK, NULL, 0);
if(!fCurrentItem) if(!fCurrentItem)
return; return;
ppp_interface_id id; ppp_interface_id id;
if(message->FindInt32("interface", reinterpret_cast<int32*>(&id)) != B_OK if(message->FindInt32("interface", reinterpret_cast<int32*>(&id)) != B_OK
|| (fWatching != PPP_UNDEFINED_INTERFACE_ID && id != fWatching)) || (fWatching != PPP_UNDEFINED_INTERFACE_ID && id != fWatching))
return; return;
int32 type, code; int32 type, code;
message->FindInt32("type", &type); message->FindInt32("type", &type);
message->FindInt32("code", &code); message->FindInt32("code", &code);
if(type == PPP_MANAGER_REPORT && code == PPP_REPORT_INTERFACE_CREATED) { if(type == PPP_MANAGER_REPORT && code == PPP_REPORT_INTERFACE_CREATED) {
PPPInterface interface(id); PPPInterface interface(id);
if(interface.InitCheck() != B_OK) if(interface.InitCheck() != B_OK)
return; return;
ppp_interface_info_t info; ppp_interface_info_t info;
interface.GetInterfaceInfo(&info); interface.GetInterfaceInfo(&info);
if(strcasecmp(info.info.name, fCurrentItem->Label())) if(strcasecmp(info.info.name, fCurrentItem->Label()))
return; return;
WatchInterface(id); WatchInterface(id);
} else if(type == PPP_CONNECTION_REPORT) { } else if(type == PPP_CONNECTION_REPORT) {
if(fWatching == PPP_UNDEFINED_INTERFACE_ID) if(fWatching == PPP_UNDEFINED_INTERFACE_ID)
return; return;
UpdateStatus(code); UpdateStatus(code);
} else if(type == PPP_DESTRUCTION_REPORT) { } else if(type == PPP_DESTRUCTION_REPORT) {
if(fWatching == PPP_UNDEFINED_INTERFACE_ID) if(fWatching == PPP_UNDEFINED_INTERFACE_ID)
return; return;
WatchInterface(fListener.Manager().InterfaceWithName(fCurrentItem->Label())); WatchInterface(fListener.Manager().InterfaceWithName(fCurrentItem->Label()));
} }
} }
@@ -573,32 +574,32 @@ DialUpView::CreateTabs()
BView *target; BView *target;
float width, height; float width, height;
TemplateList<DialUpAddon*> addons; TemplateList<DialUpAddon*> addons;
for(int32 index = 0; for(int32 index = 0;
fAddons.FindPointer(DUN_TAB_ADDON_TYPE, index, fAddons.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)
continue; continue;
int32 insertIndex = 0; int32 insertIndex = 0;
for(; insertIndex < addons.CountItems(); insertIndex++) for(; insertIndex < addons.CountItems(); insertIndex++)
if(addons.ItemAt(insertIndex)->Position() > addon->Position()) if(addons.ItemAt(insertIndex)->Position() > addon->Position())
break; break;
addons.AddItem(addon, insertIndex); addons.AddItem(addon, insertIndex);
} }
for(int32 index = 0; index < addons.CountItems(); index++) { for(int32 index = 0; index < addons.CountItems(); index++) {
addon = addons.ItemAt(index); addon = addons.ItemAt(index);
if(!addon->GetPreferredSize(&width, &height)) if(!addon->GetPreferredSize(&width, &height))
continue; continue;
target = addon->CreateView(BPoint(0, 0)); target = addon->CreateView(BPoint(0, 0));
if(!target) if(!target)
continue; continue;
fTabView->AddTab(target, NULL); fTabView->AddTab(target, NULL);
} }
} }
@@ -608,62 +609,57 @@ void
DialUpView::UpdateStatus(int32 code) DialUpView::UpdateStatus(int32 code)
{ {
switch(code) { switch(code) {
case PPP_REPORT_UP_ABORTED:
case PPP_REPORT_DEVICE_UP_FAILED: case PPP_REPORT_DEVICE_UP_FAILED:
case PPP_REPORT_LOCAL_AUTHENTICATION_FAILED: case PPP_REPORT_AUTHENTICATION_FAILED:
case PPP_REPORT_PEER_AUTHENTICATION_FAILED:
case PPP_REPORT_DOWN_SUCCESSFUL: case PPP_REPORT_DOWN_SUCCESSFUL:
case PPP_REPORT_CONNECTION_LOST: { case PPP_REPORT_CONNECTION_LOST: {
fConnectButton->SetLabel(kLabelConnect); fConnectButton->SetLabel(kLabelConnect);
} break; } break;
default: default:
fConnectButton->SetLabel(kLabelDisconnect); fConnectButton->SetLabel(kLabelDisconnect);
} }
// maybe the status string must not be changed (codes that set fKeepLabel to false // maybe the status string must not be changed (codes that set fKeepLabel to false
// should still be handled) // should still be handled)
if(fKeepLabel && code != PPP_REPORT_GOING_UP && code != PPP_REPORT_UP_SUCCESSFUL) if(fKeepLabel && code != PPP_REPORT_GOING_UP && code != PPP_REPORT_UP_SUCCESSFUL)
return; return;
if(fListener.InitCheck() != B_OK) { if(fListener.InitCheck() != B_OK) {
fStatusView->SetText(kErrorNoPPPStack); fStatusView->SetText(kErrorNoPPPStack);
return; return;
} }
// only errors should set fKeepLabel to true // only errors should set fKeepLabel to true
switch(code) { switch(code) {
case PPP_REPORT_GOING_UP: case PPP_REPORT_GOING_UP:
fKeepLabel = false; fKeepLabel = false;
fStatusView->SetText(kTextConnecting); fStatusView->SetText(kTextConnecting);
break; break;
case PPP_REPORT_UP_SUCCESSFUL: case PPP_REPORT_UP_SUCCESSFUL:
fKeepLabel = false; fKeepLabel = false;
fStatusView->SetText(kTextConnectionEstablished); fStatusView->SetText(kTextConnectionEstablished);
break; break;
case PPP_REPORT_UP_ABORTED:
case PPP_REPORT_DOWN_SUCCESSFUL: case PPP_REPORT_DOWN_SUCCESSFUL:
fStatusView->SetText(kTextNotConnected); fStatusView->SetText(kTextNotConnected);
break; break;
case PPP_REPORT_DEVICE_UP_FAILED: case PPP_REPORT_DEVICE_UP_FAILED:
fKeepLabel = true; fKeepLabel = true;
fStatusView->SetText(kTextDeviceUpFailed); fStatusView->SetText(kTextDeviceUpFailed);
break; break;
case PPP_REPORT_LOCAL_AUTHENTICATION_REQUESTED: case PPP_REPORT_AUTHENTICATION_REQUESTED:
case PPP_REPORT_PEER_AUTHENTICATION_REQUESTED:
fStatusView->SetText(kTextAuthenticating); fStatusView->SetText(kTextAuthenticating);
break; break;
case PPP_REPORT_LOCAL_AUTHENTICATION_FAILED: case PPP_REPORT_AUTHENTICATION_FAILED:
case PPP_REPORT_PEER_AUTHENTICATION_FAILED:
fKeepLabel = true; fKeepLabel = true;
fStatusView->SetText(kTextAuthenticationFailed); fStatusView->SetText(kTextAuthenticationFailed);
break; break;
case PPP_REPORT_CONNECTION_LOST: case PPP_REPORT_CONNECTION_LOST:
fKeepLabel = true; fKeepLabel = true;
fStatusView->SetText(kTextConnectionLost); fStatusView->SetText(kTextConnectionLost);
@@ -676,37 +672,37 @@ void
DialUpView::WatchInterface(ppp_interface_id ID) DialUpView::WatchInterface(ppp_interface_id ID)
{ {
// This method can be used to update the interface's connection status. // This method can be used to update the interface's connection status.
if(fWatching != ID) { if(fWatching != ID) {
fListener.StopWatchingInterfaces(); //fListener.StopWatchingInterfaces(); // FIXME
if(ID == PPP_UNDEFINED_INTERFACE_ID || fListener.WatchInterface(ID)) if(ID == PPP_UNDEFINED_INTERFACE_ID || fListener.WatchInterface(ID))
fWatching = ID; fWatching = ID;
} }
// update status // update status
PPPInterface interface(fWatching); PPPInterface interface(fWatching);
if(interface.InitCheck() != B_OK) { if(interface.InitCheck() != B_OK) {
UpdateStatus(PPP_REPORT_DOWN_SUCCESSFUL); UpdateStatus(PPP_REPORT_DOWN_SUCCESSFUL);
return; return;
} }
ppp_interface_info_t info; ppp_interface_info_t info;
interface.GetInterfaceInfo(&info); interface.GetInterfaceInfo(&info);
// transform phase into status // transform phase into status
switch(info.info.phase) { switch(info.info.phase) {
case PPP_DOWN_PHASE: case PPP_DOWN_PHASE:
UpdateStatus(PPP_REPORT_DOWN_SUCCESSFUL); UpdateStatus(PPP_REPORT_DOWN_SUCCESSFUL);
break; break;
case PPP_TERMINATION_PHASE: case PPP_TERMINATION_PHASE:
break; break;
case PPP_ESTABLISHED_PHASE: case PPP_ESTABLISHED_PHASE:
UpdateStatus(PPP_REPORT_UP_SUCCESSFUL); UpdateStatus(PPP_REPORT_UP_SUCCESSFUL);
break; break;
default: default:
UpdateStatus(PPP_REPORT_GOING_UP); UpdateStatus(PPP_REPORT_GOING_UP);
} }
@@ -722,7 +718,7 @@ DialUpView::LoadInterfaces()
fDeleterItem = new BMenuItem(kLabelDeleteCurrent, fDeleterItem = new BMenuItem(kLabelDeleteCurrent,
new BMessage(kMsgDeleteCurrent)); new BMessage(kMsgDeleteCurrent));
fInterfaceMenu->AddItem(fDeleterItem); fInterfaceMenu->AddItem(fDeleterItem);
BDirectory settingsDirectory; BDirectory settingsDirectory;
BEntry entry; BEntry entry;
BPath path; BPath path;
@@ -758,7 +754,7 @@ DialUpView::LoadAddons()
PPPoEAddon *pppoeAddon = new PPPoEAddon(&fAddons); PPPoEAddon *pppoeAddon = new PPPoEAddon(&fAddons);
fAddons.AddPointer(DUN_DEVICE_ADDON_TYPE, pppoeAddon); fAddons.AddPointer(DUN_DEVICE_ADDON_TYPE, pppoeAddon);
fAddons.AddPointer(DUN_DELETE_ON_QUIT, pppoeAddon); fAddons.AddPointer(DUN_DELETE_ON_QUIT, pppoeAddon);
*/ */
// "PAP" authenticator // "PAP" authenticator
BMessage addon; BMessage addon;
addon.AddString("FriendlyName", "Plain-text Authentication"); addon.AddString("FriendlyName", "Plain-text Authentication");
@@ -766,7 +762,7 @@ DialUpView::LoadAddons()
addon.AddString("KernelModuleName", "pap"); addon.AddString("KernelModuleName", "pap");
fAddons.AddMessage(DUN_AUTHENTICATOR_ADDON_TYPE, &addon); fAddons.AddMessage(DUN_AUTHENTICATOR_ADDON_TYPE, &addon);
// addon.MakeEmpty(); // for next authenticator // addon.MakeEmpty(); // for next authenticator
// TODO: // TODO:
// load all add-ons from the add-ons folder // load all add-ons from the add-ons folder
} }
@@ -780,7 +776,7 @@ DialUpView::AddInterface(const char *name, bool isNew)
NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL); NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(NULL);
return; return;
} }
BMenuItem *item = new BMenuItem(name, new BMessage(kMsgSelectInterface)); BMenuItem *item = new BMenuItem(name, new BMessage(kMsgSelectInterface));
item->SetTarget(this); item->SetTarget(this);
int32 index = FindNextMenuInsertionIndex(fInterfaceMenu, name); int32 index = FindNextMenuInsertionIndex(fInterfaceMenu, name);
@@ -788,7 +784,7 @@ DialUpView::AddInterface(const char *name, bool isNew)
index = CountInterfaces(); index = CountInterfaces();
fInterfaceMenu->AddItem(item, index); fInterfaceMenu->AddItem(item, index);
UpdateControls(); UpdateControls();
item->SetMarked(true); item->SetMarked(true);
SelectInterface(index, isNew); SelectInterface(index, isNew);
} }
@@ -800,11 +796,11 @@ DialUpView::SelectInterface(int32 index, bool isNew)
BMenuItem *item = fInterfaceMenu->FindMarked(); BMenuItem *item = fInterfaceMenu->FindMarked();
if(fCurrentItem && item == fCurrentItem) if(fCurrentItem && item == fCurrentItem)
return; return;
if(fCurrentItem && !SaveSettingsToFile()) if(fCurrentItem && !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);
if(index >= CountInterfaces() || index < 0) { if(index >= CountInterfaces() || index < 0) {
if(CountInterfaces() > 0) if(CountInterfaces() > 0)
SelectInterface(0); SelectInterface(0);
@@ -818,12 +814,12 @@ DialUpView::SelectInterface(int32 index, bool isNew)
SelectInterface(0); SelectInterface(0);
return; return;
} }
fCurrentItem->SetMarked(true); fCurrentItem->SetMarked(true);
fDeleterItem->SetEnabled(true); fDeleterItem->SetEnabled(true);
WatchInterface(fListener.Manager().InterfaceWithName(fCurrentItem->Label())); WatchInterface(fListener.Manager().InterfaceWithName(fCurrentItem->Label()));
} }
if(!fCurrentItem) if(!fCurrentItem)
LoadSettings(false); LoadSettings(false);
// tell modules to unload all settings // tell modules to unload all settings
@@ -1,22 +1,22 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de * Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * 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. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * 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 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
@@ -28,6 +28,12 @@
#include <PPPInterfaceListener.h> #include <PPPInterfaceListener.h>
class BMenuItem;
class BStringView;
class BButton;
class BPopUpMenu;
class BMenuField;
class BTabView;
class GeneralAddon; class GeneralAddon;
@@ -35,12 +41,12 @@ class DialUpView : public BView {
public: public:
DialUpView(BRect frame); DialUpView(BRect frame);
virtual ~DialUpView(); virtual ~DialUpView();
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
void UpDownThread(); void UpDownThread();
// used by ppp_up application // used by ppp_up application
bool SelectInterfaceNamed(const char *name); bool SelectInterfaceNamed(const char *name);
bool NeedsRequest() const; bool NeedsRequest() const;
@@ -53,35 +59,35 @@ class DialUpView : public BView {
private: private:
void GetPPPDirectories(BDirectory *settingsDirectory, void GetPPPDirectories(BDirectory *settingsDirectory,
BDirectory *profileDirectory) const; BDirectory *profileDirectory) const;
void HandleReportMessage(BMessage *message); void HandleReportMessage(BMessage *message);
void CreateTabs(); void CreateTabs();
void UpdateStatus(int32 code); void UpdateStatus(int32 code);
void WatchInterface(ppp_interface_id ID); void WatchInterface(ppp_interface_id ID);
bool LoadSettings(bool isNew); bool LoadSettings(bool isNew);
void IsModified(bool *settings, bool *profile); void IsModified(bool *settings, bool *profile);
void LoadInterfaces(); void LoadInterfaces();
void LoadAddons(); 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);
int32 CountInterfaces() const; int32 CountInterfaces() const;
void UpdateControls(); void UpdateControls();
private: private:
PPPInterfaceListener fListener; PPPInterfaceListener fListener;
thread_id fUpDownThread; thread_id fUpDownThread;
BMessage fAddons, fSettings, fProfile; BMessage fAddons, fSettings, fProfile;
driver_settings *fDriverSettings; driver_settings *fDriverSettings;
BMenuItem *fCurrentItem, *fDeleterItem; BMenuItem *fCurrentItem, *fDeleterItem;
ppp_interface_id fWatching; ppp_interface_id fWatching;
GeneralAddon *fGeneralAddon; GeneralAddon *fGeneralAddon;
bool fKeepLabel; bool fKeepLabel;
BStringView *fStatusView; BStringView *fStatusView;
@@ -1,22 +1,22 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de * Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * 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. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * 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 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
@@ -28,12 +28,15 @@
#ifndef _GENERAL_ADDON__H #ifndef _GENERAL_ADDON__H
#define _GENERAL_ADDON__H #define _GENERAL_ADDON__H
#include <DialUpAddon.h> #include "DialUpAddon.h"
#include <CheckBox.h> #include <CheckBox.h>
#include <String.h> #include <String.h>
#include <TextControl.h> #include <TextControl.h>
class BBox;
class BMenuField;
class BMenuItem;
class GeneralView; class GeneralView;
@@ -41,10 +44,10 @@ class GeneralAddon : public DialUpAddon {
public: public:
GeneralAddon(BMessage *addons); GeneralAddon(BMessage *addons);
virtual ~GeneralAddon(); virtual ~GeneralAddon();
bool IsNew() const bool IsNew() const
{ return fIsNew; } { return fIsNew; }
const char *DeviceName() const const char *DeviceName() const
{ return fDeviceName.String(); } { return fDeviceName.String(); }
const char *Username() const const char *Username() const
@@ -53,37 +56,37 @@ class GeneralAddon : public DialUpAddon {
{ return fPassword.String(); } { return fPassword.String(); }
bool HasPassword() const bool HasPassword() const
{ return fHasPassword; } { return fHasPassword; }
bool NeedsAuthenticationRequest() const; 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; }
int32 CountAuthenticators() const int32 CountAuthenticators() const
{ return fAuthenticatorsCount; } { return fAuthenticatorsCount; }
BMessage *Settings() const BMessage *Settings() const
{ return fSettings; } { return fSettings; }
BMessage *Profile() const BMessage *Profile() const
{ return fProfile; } { return fProfile; }
virtual int32 Position() const virtual int32 Position() const
{ return 0; } { return 0; }
virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew); virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew);
bool LoadDeviceSettings(); bool LoadDeviceSettings();
bool LoadAuthenticationSettings(); bool LoadAuthenticationSettings();
virtual bool HasTemporaryProfile() const; virtual bool HasTemporaryProfile() const;
virtual void IsModified(bool *settings, bool *profile) const; virtual void IsModified(bool *settings, bool *profile) const;
void IsDeviceModified(bool *settings, bool *profile) const; void IsDeviceModified(bool *settings, bool *profile) const;
void IsAuthenticationModified(bool *settings, bool *profile) const; void IsAuthenticationModified(bool *settings, bool *profile) const;
virtual bool SaveSettings(BMessage *settings, BMessage *profile, virtual bool SaveSettings(BMessage *settings, BMessage *profile,
bool saveTemporary); bool saveTemporary);
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 // used by ppp_up application
BView *AuthenticationView() const; BView *AuthenticationView() const;
@@ -106,31 +109,31 @@ class GeneralView : public BView {
public: public:
GeneralView(GeneralAddon *addon, BRect frame); GeneralView(GeneralAddon *addon, BRect frame);
virtual ~GeneralView(); virtual ~GeneralView();
GeneralAddon *Addon() const GeneralAddon *Addon() const
{ return fAddon; } { return fAddon; }
void Reload(); void Reload();
const char *Username() const const char *Username() const
{ return fUsername->Text(); } { return fUsername->Text(); }
const char *Password() const const char *Password() const
{ return fPassword->Text(); } { return fPassword->Text(); }
bool DoesSavePassword() const bool DoesSavePassword() const
{ return fSavePassword->Value(); } { return fSavePassword->Value(); }
bool HasTemporaryProfile() const bool HasTemporaryProfile() const
{ return !DoesSavePassword() || (fDeviceAddon && { return !DoesSavePassword() || (fDeviceAddon &&
fDeviceAddon->HasTemporaryProfile()); } fDeviceAddon->HasTemporaryProfile()); }
DialUpAddon *DeviceAddon() const DialUpAddon *DeviceAddon() const
{ return fDeviceAddon; } { return fDeviceAddon; }
const char *DeviceName() const; const char *DeviceName() const;
const char *AuthenticatorName() const; const char *AuthenticatorName() const;
void IsDeviceModified(bool *settings, bool *profile) const; void IsDeviceModified(bool *settings, bool *profile) const;
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
// used by ppp_up application // used by ppp_up application
BView *AuthenticationView() const BView *AuthenticationView() const
{ return fAuthenticationView; } { return fAuthenticationView; }
@@ -138,7 +141,7 @@ class GeneralView : public BView {
private: private:
void ReloadDeviceView(); void ReloadDeviceView();
void UpdateControls(); void UpdateControls();
void AddDevices(); void AddDevices();
void AddAuthenticators(); void AddAuthenticators();
+25 -24
View File
@@ -1,22 +1,22 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de * Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * 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. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * 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 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
@@ -28,12 +28,13 @@
#ifndef _IPCP_ADDON__H #ifndef _IPCP_ADDON__H
#define _IPCP_ADDON__H #define _IPCP_ADDON__H
#include <DialUpAddon.h> #include "DialUpAddon.h"
#include <CheckBox.h> #include <CheckBox.h>
#include <String.h> #include <String.h>
#include <TextControl.h> #include <TextControl.h>
class BButton;
class IPCPView; class IPCPView;
@@ -41,10 +42,10 @@ class IPCPAddon : public DialUpAddon {
public: public:
IPCPAddon(BMessage *addons); IPCPAddon(BMessage *addons);
virtual ~IPCPAddon(); virtual ~IPCPAddon();
bool IsNew() const bool IsNew() const
{ return fIsNew; } { return fIsNew; }
bool IsEnabled() const bool IsEnabled() const
{ return fIsEnabled; } { return fIsEnabled; }
const char *IPAddress() const const char *IPAddress() const
@@ -53,15 +54,15 @@ class IPCPAddon : public DialUpAddon {
{ return fPrimaryDNS.String(); } { return fPrimaryDNS.String(); }
const char *SecondaryDNS() const const char *SecondaryDNS() const
{ return fSecondaryDNS.String(); } { return fSecondaryDNS.String(); }
BMessage *Settings() const BMessage *Settings() const
{ return fSettings; } { return fSettings; }
BMessage *Profile() const BMessage *Profile() const
{ return fProfile; } { return fProfile; }
virtual int32 Position() const virtual int32 Position() const
{ return 10; } { return 10; }
virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew); virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew);
virtual void IsModified(bool *settings, bool *profile) const; virtual void IsModified(bool *settings, bool *profile) const;
virtual bool SaveSettings(BMessage *settings, BMessage *profile, virtual bool SaveSettings(BMessage *settings, BMessage *profile,
@@ -84,11 +85,11 @@ class IPCPAddon : public DialUpAddon {
class IPCPView : public BView { class IPCPView : public BView {
public: public:
IPCPView(IPCPAddon *addon, BRect frame); IPCPView(IPCPAddon *addon, BRect frame);
IPCPAddon *Addon() const IPCPAddon *Addon() const
{ return fAddon; } { return fAddon; }
void Reload(); void Reload();
bool IsEnabled() const bool IsEnabled() const
{ return fIsEnabled->Value(); } { return fIsEnabled->Value(); }
const char *IPAddress() const const char *IPAddress() const
@@ -97,7 +98,7 @@ class IPCPView : public BView {
{ return fPrimaryDNS->Text(); } { return fPrimaryDNS->Text(); }
const char *SecondaryDNS() const const char *SecondaryDNS() const
{ return fSecondaryDNS->Text(); } { return fSecondaryDNS->Text(); }
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
@@ -1,22 +1,22 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de * Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * 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. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * 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 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
@@ -24,12 +24,15 @@
#define _INTERFACE_UTILS__H #define _INTERFACE_UTILS__H
#include <SupportDefs.h> #include <SupportDefs.h>
#include <Point.h>
class DialUpAddon; class DialUpAddon;
class BListView; class BListView;
class BMenu; class BMenu;
class BString; class BString;
class BMenu;
class BWindow; class BWindow;
class BMessage;
extern BPoint center_on_screen(BRect rect, BWindow *window = NULL); extern BPoint center_on_screen(BRect rect, BWindow *window = NULL);
+7 -7
View File
@@ -2,14 +2,16 @@ SubDir HAIKU_TOP src add-ons network_settings dialup ;
UsePublicHeaders [ FDirName add-ons network_settings ] ; UsePublicHeaders [ FDirName add-ons network_settings ] ;
UsePrivateHeaders app libroot kernel net shared ; 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 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 libppp headers ] : true ;
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp shared libkernelppp headers ] ; UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp shared libkernelppp headers ] : true ;
# additonal headers for built-in add-ons: # 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 pppoe ] : true ; # PPPoE
UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp ipcp ] ; # IPCP UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel network ppp ipcp ] : true ; # IPCP
AddResources DialUp : DialUpPreflet.rdef ; AddResources DialUp : DialUpPreflet.rdef ;
@@ -29,12 +31,10 @@ Addon DialUpInterface :
PPPoEAddon.cpp PPPoEAddon.cpp
: be shared <nogrist>Network [ TargetLibsupc++ ] : be shared <nogrist>Network [ TargetLibsupc++ ]
[ TargetLibstdc++ ] localestub [ TargetLibstdc++ ] localestub libppp.a
; ;
DoCatalogs DialUpInterface : x-vnd.Haiku-DialUpInterface : DoCatalogs DialUpInterface : x-vnd.Haiku-DialUpInterface :
DialUpView.cpp DialUpView.cpp
; ;
#LinkSharedOSLibs DialUp : libppp.a be ;
@@ -1,22 +1,22 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de * Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * 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. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * 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 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
@@ -28,11 +28,13 @@
#ifndef _PPPoE_ADDON__H #ifndef _PPPoE_ADDON__H
#define _PPPoE_ADDON__H #define _PPPoE_ADDON__H
#include <DialUpAddon.h> #include "DialUpAddon.h"
#include <String.h> #include <String.h>
#include <TextControl.h> #include <TextControl.h>
class BMenuField;
class BMenuItem;
class PPPoEView; class PPPoEView;
@@ -40,33 +42,33 @@ class PPPoEAddon : public DialUpAddon {
public: public:
PPPoEAddon(BMessage *addons); PPPoEAddon(BMessage *addons);
virtual ~PPPoEAddon(); virtual ~PPPoEAddon();
bool IsNew() const bool IsNew() const
{ return fIsNew; } { return fIsNew; }
const char *InterfaceName() const const char *InterfaceName() const
{ return fInterfaceName.String(); } { return fInterfaceName.String(); }
const char *ServiceName() const const char *ServiceName() const
{ return fServiceName.String(); } { return fServiceName.String(); }
BMessage *Settings() const BMessage *Settings() const
{ return fSettings; } { return fSettings; }
BMessage *Profile() const BMessage *Profile() const
{ return fProfile; } { return fProfile; }
virtual const char *FriendlyName() const; virtual const char *FriendlyName() const;
virtual const char *TechnicalName() const; virtual const char *TechnicalName() const;
virtual const char *KernelModuleName() const; virtual const char *KernelModuleName() const;
virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew); virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew);
virtual void IsModified(bool *settings, bool *profile) const; virtual void IsModified(bool *settings, bool *profile) const;
virtual bool SaveSettings(BMessage *settings, BMessage *profile, virtual bool SaveSettings(BMessage *settings, BMessage *profile,
bool saveTemporary); bool saveTemporary);
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);
void UnregisterView() void UnregisterView()
{ fPPPoEView = NULL; } { fPPPoEView = NULL; }
@@ -85,16 +87,16 @@ class PPPoEView : public BView {
public: public:
PPPoEView(PPPoEAddon *addon, BRect frame); PPPoEView(PPPoEAddon *addon, BRect frame);
virtual ~PPPoEView(); virtual ~PPPoEView();
PPPoEAddon *Addon() const PPPoEAddon *Addon() const
{ return fAddon; } { return fAddon; }
void Reload(); void Reload();
const char *InterfaceName() const const char *InterfaceName() const
{ return fInterfaceName.String(); } { return fInterfaceName.String(); }
const char *ServiceName() const const char *ServiceName() const
{ return fServiceName->Text(); } { return fServiceName->Text(); }
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
@@ -1,22 +1,22 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de * Copyright (c) 2004 Waldemar Kornewald, Waldemar.Kornewald@web.de
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * 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. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * 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 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
@@ -25,16 +25,21 @@
#include <Window.h> #include <Window.h>
class BInvoker;
class BTextView;
class BTextControl;
class BButton;
class TextRequestDialog : public BWindow { class TextRequestDialog : public BWindow {
public: public:
TextRequestDialog(const char *title, const char *information, TextRequestDialog(const char *title, const char *information,
const char *request, const char *text = NULL); const char *request, const char *text = NULL);
virtual ~TextRequestDialog(); virtual ~TextRequestDialog();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
virtual bool QuitRequested(); virtual bool QuitRequested();
status_t Go(BInvoker *invoker); status_t Go(BInvoker *invoker);
private: private: