summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/profile
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/profile') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/profile/opie-networksettings2plugin-bluetooth.control4
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.cpp13
-rw-r--r--noncore/settings/networksettings2/profile/profile_NN.h2
-rw-r--r--noncore/settings/networksettings2/profile/profile_NNI.cpp13
-rw-r--r--noncore/settings/networksettings2/profile/profile_NNI.h4
-rw-r--r--noncore/settings/networksettings2/profile/profiledata.h5
-rw-r--r--noncore/settings/networksettings2/profile/profileedit.cpp10
-rw-r--r--noncore/settings/networksettings2/profile/profileedit.h8
-rw-r--r--noncore/settings/networksettings2/profile/profilerun.cpp72
-rw-r--r--noncore/settings/networksettings2/profile/profilerun.h24
10 files changed, 60 insertions, 95 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,2 +1,2 @@
-Package: opie-networksettingsplugin2-profile
+Package: opie-networksettings2plugin-profile
Files: plugins/networksettings2/libprofile.so*
@@ -7,3 +7,3 @@ 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 +1,2 @@
+#include <resources.h>
#include "profile_NN.h"
@@ -7,2 +8,6 @@ static const char * ProfileNeeds[] =
};
+static const char * ProfileProvides[] =
+ { "fullsetup",
+ 0
+ };
@@ -12,2 +17,6 @@ static const char * ProfileNeeds[] =
ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) {
+
+ NSResources->addSystemFile(
+ "interfaces", "/etc/network/interfaces", 1 );
+
}
@@ -36,4 +45,4 @@ const char ** ProfileNetNode::needs( void ) {
-const char * ProfileNetNode::provides( void ) {
- return "fullsetup";
+const char ** ProfileNetNode::provides( void ) {
+ return ProfileProvides;
}
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
@@ -22,3 +22,3 @@ public:
virtual const char ** needs( void );
- virtual const char * provides( void );
+ virtual const char ** provides( void );
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 +1,2 @@
+#include <opie2/odebug.h>
#include "profileedit.h"
@@ -52,5 +53,3 @@ void AProfile::commit( void ) {
-short AProfile::generateFileEmbedded( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+short AProfile::generateFileEmbedded( SystemFile & SF,
long DevNr ) {
@@ -61,7 +60,7 @@ short AProfile::generateFileEmbedded( const QString & ID,
- 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;
@@ -70,3 +69,3 @@ short AProfile::generateFileEmbedded( const QString & ID,
}
- rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr );
+ rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr );
return (rvd == 2 || rvl == 2 ) ? 2 :
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
@@ -28,5 +28,3 @@ public :
- virtual short generateFileEmbedded( const QString & ID,
- const QString & Path,
- QTextStream & TS,
+ virtual short generateFileEmbedded( SystemFile & TS,
long DevNr );
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
@@ -4,3 +4,4 @@
#include <qstring.h>
-typedef struct ProfileData {
+class ProfileData {
+public :
QString Description;
@@ -13,3 +14,3 @@ typedef struct ProfileData {
bool TriggerVPN;
-} ProfileData_t;
+} ;
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
@@ -7,3 +7,3 @@
#include <GUIUtils.h>
-#include <asdevice.h>
+#include <netnode.h>
#include <resources.h>
@@ -18,3 +18,3 @@ ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) :
Dev = NNI->runtime()->device();
- if( ( II = Dev->assignedInterface() ) ) {
+ if( ( II = NNI->connection()->assignedInterface() ) ) {
@@ -57,3 +57,3 @@ QString ProfileEdit::acceptable( void ) {
-void ProfileEdit::showData( ProfileData_t & Data ) {
+void ProfileEdit::showData( ProfileData & Data ) {
Description_LE->setText( Data.Description );
@@ -66,3 +66,3 @@ void ProfileEdit::showData( ProfileData_t & Data ) {
-bool ProfileEdit::commit( ProfileData_t & Data ) {
+bool ProfileEdit::commit( ProfileData & Data ) {
bool SM = 0;
@@ -79,3 +79,3 @@ bool ProfileEdit::commit( ProfileData_t & Data ) {
void ProfileEdit::SLOT_Refresh( void ) {
- InterfaceInfo * II = Dev->assignedInterface();
+ InterfaceInfo * II = NNI->connection()->assignedInterface();
NSResources->system().refreshStatistics( *II );
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
@@ -5,3 +5,3 @@
class ANetNodeInstance;
-class AsDevice;
+class RuntimeInfo;
@@ -15,4 +15,4 @@ public :
QString acceptable( void );
- bool commit( ProfileData_t & Data );
- void showData( ProfileData_t & Data );
+ bool commit( ProfileData & Data );
+ void showData( ProfileData & Data );
@@ -27,3 +27,3 @@ private :
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
@@ -4,64 +4,24 @@
-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;
- }
- 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;
+ NC->setModified( 1 );
+ }
+ } 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
@@ -3,6 +3,6 @@
-#include <asfullsetup.h>
+#include <netnode.h>
#include "profiledata.h"
-class ProfileRun : public AsFullSetup {
+class ProfileRun : public RuntimeInfo {
@@ -11,17 +11,9 @@ 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 )
@@ -29,2 +21,8 @@ public :
+ State_t detectState( void );
+
+protected :
+
+ QString setMyState( NodeCollection * , Action_t, bool );
+
private :