author | wimpie <wimpie> | 2005-01-04 01:35:26 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-04 01:35:26 (UTC) |
commit | a9c188235c97e07b0eb96b13adbcdfd4bad64767 (patch) (side-by-side diff) | |
tree | 13f6ae5c499dc0c1d1bd4b763a1973a0fa8635cf /noncore/settings/networksettings2/profile | |
parent | 48b6cd5966ec6cc0b968edf10ba1a1ad96ef165f (diff) | |
download | opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.zip opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.tar.gz opie-a9c188235c97e07b0eb96b13adbcdfd4bad64767.tar.bz2 |
CONTROL files : changed version string
NS2 many changes and first release of OT2
Diffstat (limited to 'noncore/settings/networksettings2/profile') (more/less context) (show whitespace changes)
10 files changed, 57 insertions, 92 deletions
diff --git a/noncore/settings/networksettings2/profile/opie-networksettings2plugin-bluetooth.control b/noncore/settings/networksettings2/profile/opie-networksettings2plugin-bluetooth.control index c76f9b8..40c8b48 100644 --- a/noncore/settings/networksettings2/profile/opie-networksettings2plugin-bluetooth.control +++ b/noncore/settings/networksettings2/profile/opie-networksettings2plugin-bluetooth.control @@ -1,9 +1,9 @@ -Package: opie-networksettingsplugin2-profile +Package: opie-networksettings2plugin-profile Files: plugins/networksettings2/libprofile.so* Priority: optional Section: opie/settings Maintainer: Wim Delvaux <wimpie@handhelds.org> Architecture: arm Depends: opie-networksettings2, libopiecore2, libopienet2 -Description: Network settings profile plugin. +Description: Network settings usage profile plugin. Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp index 945b48d..b7d8aa0 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.cpp +++ b/noncore/settings/networksettings2/profile/profile_NN.cpp @@ -1,3 +1,4 @@ +#include <resources.h> #include "profile_NN.h" #include "profile_NNI.h" @@ -5,11 +6,19 @@ static const char * ProfileNeeds[] = { "connection", 0 }; +static const char * ProfileProvides[] = + { "fullsetup", + 0 + }; /** * Constructor, find all of the possible interfaces */ ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) { + + NSResources->addSystemFile( + "interfaces", "/etc/network/interfaces", 1 ); + } /** @@ -34,8 +43,8 @@ const char ** ProfileNetNode::needs( void ) { return ProfileNeeds; } -const char * ProfileNetNode::provides( void ) { - return "fullsetup"; +const char ** ProfileNetNode::provides( void ) { + return ProfileProvides; } void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { diff --git a/noncore/settings/networksettings2/profile/profile_NN.h b/noncore/settings/networksettings2/profile/profile_NN.h index 1f1ee2c..f1648f9 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.h +++ b/noncore/settings/networksettings2/profile/profile_NN.h @@ -20,7 +20,7 @@ public: virtual const QString nodeDescription() ; virtual ANetNodeInstance * createInstance( void ); virtual const char ** needs( void ); - virtual const char * provides( void ); + virtual const char ** provides( void ); private: diff --git a/noncore/settings/networksettings2/profile/profile_NNI.cpp b/noncore/settings/networksettings2/profile/profile_NNI.cpp index f0f0b97..a1e1254 100644 --- a/noncore/settings/networksettings2/profile/profile_NNI.cpp +++ b/noncore/settings/networksettings2/profile/profile_NNI.cpp @@ -1,3 +1,4 @@ +#include <opie2/odebug.h> #include "profileedit.h" #include "profile_NNI.h" #include "profile_NN.h" @@ -50,25 +51,23 @@ void AProfile::commit( void ) { setModified( 1 ); } -short AProfile::generateFileEmbedded( const QString & ID, - const QString & Path, - QTextStream & TS, +short AProfile::generateFileEmbedded( SystemFile & SF, long DevNr ) { short rvl, rvd; rvl = 1; - if( ID == "interfaces" ) { - Log(("Generate Profile for %s\n", ID.latin1() )); + if( SF.name() == "interfaces" ) { + Log(("Generate Profile for %s\n", SF.name().latin1() )); if( Data.TriggerVPN ) { // this profile triggers VPN -> insert trigger - TS << " up networksettings2 --triggervpn" + SF << " up networksettings2 --triggervpn" << endl; rvl = 0; } } - rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr ); + rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr ); return (rvd == 2 || rvl == 2 ) ? 2 : (rvd == 0 || rvl == 0 ) ? 0 : 1; } diff --git a/noncore/settings/networksettings2/profile/profile_NNI.h b/noncore/settings/networksettings2/profile/profile_NNI.h index 957f4af..ccd746c 100644 --- a/noncore/settings/networksettings2/profile/profile_NNI.h +++ b/noncore/settings/networksettings2/profile/profile_NNI.h @@ -26,9 +26,7 @@ public : virtual void * data( void ) { return (void *)&Data; } - virtual short generateFileEmbedded( const QString & ID, - const QString & Path, - QTextStream & TS, + virtual short generateFileEmbedded( SystemFile & TS, long DevNr ); const QString & description( void ) diff --git a/noncore/settings/networksettings2/profile/profiledata.h b/noncore/settings/networksettings2/profile/profiledata.h index 246d50c..c9577e5 100644 --- a/noncore/settings/networksettings2/profile/profiledata.h +++ b/noncore/settings/networksettings2/profile/profiledata.h @@ -2,7 +2,8 @@ #define PROFILE_DATA_H #include <qstring.h> -typedef struct ProfileData { +class ProfileData { +public : QString Description; // start up automatically bool Automatic; @@ -11,6 +12,6 @@ typedef struct ProfileData { // Do not bring this connection up bool Disabled; bool TriggerVPN; -} ProfileData_t; +} ; #endif diff --git a/noncore/settings/networksettings2/profile/profileedit.cpp b/noncore/settings/networksettings2/profile/profileedit.cpp index 87e503e..88aab15 100644 --- a/noncore/settings/networksettings2/profile/profileedit.cpp +++ b/noncore/settings/networksettings2/profile/profileedit.cpp @@ -5,7 +5,7 @@ #include <qcheckbox.h> #include <GUIUtils.h> -#include <asdevice.h> +#include <netnode.h> #include <resources.h> #include "profileedit.h" @@ -16,7 +16,7 @@ ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : NNI = TNNI; Dev = NNI->runtime()->device(); - if( ( II = Dev->assignedInterface() ) ) { + if( ( II = NNI->connection()->assignedInterface() ) ) { Refresh_CB->setEnabled( TRUE ); Snd_GB->setEnabled( TRUE ); @@ -55,7 +55,7 @@ QString ProfileEdit::acceptable( void ) { return QString(); } -void ProfileEdit::showData( ProfileData_t & Data ) { +void ProfileEdit::showData( ProfileData & Data ) { Description_LE->setText( Data.Description ); Automatic_CB->setChecked( Data.Automatic ); TriggersVPN_CB->setChecked( Data.TriggerVPN ); @@ -64,7 +64,7 @@ void ProfileEdit::showData( ProfileData_t & Data ) { } -bool ProfileEdit::commit( ProfileData_t & Data ) { +bool ProfileEdit::commit( ProfileData & Data ) { bool SM = 0; TXTM( Data.Description, Description_LE, SM ); @@ -77,7 +77,7 @@ bool ProfileEdit::commit( ProfileData_t & Data ) { } void ProfileEdit::SLOT_Refresh( void ) { - InterfaceInfo * II = Dev->assignedInterface(); + InterfaceInfo * II = NNI->connection()->assignedInterface(); NSResources->system().refreshStatistics( *II ); RcvBytes_LBL->setText( II->RcvBytes ); SndBytes_LBL->setText( II->SndBytes ); diff --git a/noncore/settings/networksettings2/profile/profileedit.h b/noncore/settings/networksettings2/profile/profileedit.h index b186b58..9cde845 100644 --- a/noncore/settings/networksettings2/profile/profileedit.h +++ b/noncore/settings/networksettings2/profile/profileedit.h @@ -3,7 +3,7 @@ #include <qtimer.h> class ANetNodeInstance; -class AsDevice; +class RuntimeInfo; class ProfileEdit : public ProfileGUI { @@ -13,8 +13,8 @@ public : ProfileEdit( QWidget * parent, ANetNodeInstance * NNI ); QString acceptable( void ); - bool commit( ProfileData_t & Data ); - void showData( ProfileData_t & Data ); + bool commit( ProfileData & Data ); + void showData( ProfileData & Data ); public slots : @@ -25,5 +25,5 @@ private : QTimer RefreshTimer; ANetNodeInstance * NNI; - AsDevice * Dev; + RuntimeInfo * Dev; }; diff --git a/noncore/settings/networksettings2/profile/profilerun.cpp b/noncore/settings/networksettings2/profile/profilerun.cpp index 1a5b15b..ab57a00 100644 --- a/noncore/settings/networksettings2/profile/profilerun.cpp +++ b/noncore/settings/networksettings2/profile/profilerun.cpp @@ -2,66 +2,26 @@ #include "profilerun.h" -void ProfileRun::detectState( NodeCollection * NC ) { +State_t ProfileRun::detectState( void ) { if( Data->Disabled ) { - Log(( "%s disabled\n", NC->name().latin1() )); - NC->setCurrentState( Disabled ); - } else { - Log(( "%s not disabled\n", NC->name().latin1() )); - // find next item in connection - // convert to runtime and ask to detect the state - netNode()->nextNode()->runtime()->detectState( NC ); + return Disabled; } + return Unknown; } -bool ProfileRun::setState( NodeCollection * NC, Action_t A, bool F ) { - ANetNodeInstance * NNNI; - - NNNI = netNode()->nextNode(); - switch ( A ) { - case Enable : - if( NC->currentState() == Disabled ) { - Data->Disabled = 0; - NC->setCurrentState( Off ); // at least - // ... but request deeper - NNNI->runtime()->detectState(NC); - } - return 1; - case Disable : - switch( NC->currentState() ) { - case IsUp : - case Available : - // bring Deactivate (will bring down) - if( ! NNNI->runtime()->setState(NC, Deactivate) ) - return 0; - default : - break; - } +QString ProfileRun::setMyState( NodeCollection * NC, Action_t A, bool ) { + owarn << "Profile " << Data->Disabled << oendl; + if( A == Disable ) { + if( ! Data->Disabled ) { Data->Disabled = 1; - NC->setCurrentState( Disabled ); - return 1; - default : - break; + NC->setModified( 1 ); } - return NNNI->runtime()->setState(NC, A, F ); -} - -bool ProfileRun::canSetState( State_t Curr, Action_t A ) { - RuntimeInfo * RI; - switch ( A ) { - case Enable : - case Disable : - // always possible - return 1; - default : - break; + } else if( A == Enable ) { + if( Data->Disabled ) { + Data->Disabled = 0; + NC->setModified( 1 ); } - RI = netNode()->nextNode()->runtime(); - return ( Curr != Disabled ) ? - RI->canSetState(Curr, A) : 0; } -bool ProfileRun::handlesInterface( const QString & S ) { - // donno -> pass deeper - return netNode()->nextNode()->runtime()->handlesInterface(S); + return QString(); } diff --git a/noncore/settings/networksettings2/profile/profilerun.h b/noncore/settings/networksettings2/profile/profilerun.h index 400b56c..2d48b15 100644 --- a/noncore/settings/networksettings2/profile/profilerun.h +++ b/noncore/settings/networksettings2/profile/profilerun.h @@ -1,32 +1,30 @@ #ifndef PROFILERUN_H #define PROFILERUN_H -#include <asfullsetup.h> +#include <netnode.h> #include "profiledata.h" -class ProfileRun : public AsFullSetup { +class ProfileRun : public RuntimeInfo { public : ProfileRun( ANetNodeInstance * NNI, ProfileData & D ) : - AsFullSetup( NNI ) + RuntimeInfo( NNI ) { Data = &D; } - void detectState( NodeCollection * NC ); - bool setState( NodeCollection * NC, Action_t A, bool ); - bool canSetState( State_t Curr, Action_t A ); - - bool handlesInterface( const QString & I ); - + virtual RuntimeInfo * fullSetup( void ) + { return this; } virtual const QString & description( void ) { return Data->Description; } - - virtual AsFullSetup * asFullSetup( void ) - { return (AsFullSetup *)this; } - virtual bool triggersVPN( void ) { return Data->TriggerVPN; } + State_t detectState( void ); + +protected : + + QString setMyState( NodeCollection * , Action_t, bool ); + private : ProfileData * Data; |