summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/profile
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/profile') (more/less context) (show 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.cpp66
-rw-r--r--noncore/settings/networksettings2/profile/profilerun.h24
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,2 +1,2 @@
1Package: opie-networksettingsplugin2-profile 1Package: opie-networksettings2plugin-profile
2Files: plugins/networksettings2/libprofile.so* 2Files: plugins/networksettings2/libprofile.so*
@@ -7,3 +7,3 @@ Architecture: arm
7Depends: opie-networksettings2, libopiecore2, libopienet2 7Depends: opie-networksettings2, libopiecore2, libopienet2
8Description: Network settings profile plugin. 8Description: Network settings usage profile plugin.
9Version: $QPE_VERSION$EXTRAVERSION 9Version: $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 @@
1#include <resources.h>
1#include "profile_NN.h" 2#include "profile_NN.h"
@@ -7,2 +8,6 @@ static const char * ProfileNeeds[] =
7 }; 8 };
9static const char * ProfileProvides[] =
10 { "fullsetup",
11 0
12 };
8 13
@@ -12,2 +17,6 @@ static const char * ProfileNeeds[] =
12ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) { 17ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) {
18
19 NSResources->addSystemFile(
20 "interfaces", "/etc/network/interfaces", 1 );
21
13} 22}
@@ -36,4 +45,4 @@ const char ** ProfileNetNode::needs( void ) {
36 45
37const char * ProfileNetNode::provides( void ) { 46const char ** ProfileNetNode::provides( void ) {
38 return "fullsetup"; 47 return ProfileProvides;
39} 48}
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:
22 virtual const char ** needs( void ); 22 virtual const char ** needs( void );
23 virtual const char * provides( void ); 23 virtual const char ** provides( void );
24 24
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 @@
1#include <opie2/odebug.h>
1#include "profileedit.h" 2#include "profileedit.h"
@@ -52,5 +53,3 @@ void AProfile::commit( void ) {
52 53
53short AProfile::generateFileEmbedded( const QString & ID, 54short AProfile::generateFileEmbedded( SystemFile & SF,
54 const QString & Path,
55 QTextStream & TS,
56 long DevNr ) { 55 long DevNr ) {
@@ -61,7 +60,7 @@ short AProfile::generateFileEmbedded( const QString & ID,
61 60
62 if( ID == "interfaces" ) { 61 if( SF.name() == "interfaces" ) {
63 Log(("Generate Profile for %s\n", ID.latin1() )); 62 Log(("Generate Profile for %s\n", SF.name().latin1() ));
64 if( Data.TriggerVPN ) { 63 if( Data.TriggerVPN ) {
65 // this profile triggers VPN -> insert trigger 64 // this profile triggers VPN -> insert trigger
66 TS << " up networksettings2 --triggervpn" 65 SF << " up networksettings2 --triggervpn"
67 << endl; 66 << endl;
@@ -70,3 +69,3 @@ short AProfile::generateFileEmbedded( const QString & ID,
70 } 69 }
71 rvd = ANetNodeInstance::generateFileEmbedded( ID, Path, TS, DevNr ); 70 rvd = ANetNodeInstance::generateFileEmbedded( SF, DevNr );
72 return (rvd == 2 || rvl == 2 ) ? 2 : 71 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 :
28 28
29 virtual short generateFileEmbedded( const QString & ID, 29 virtual short generateFileEmbedded( SystemFile & TS,
30 const QString & Path,
31 QTextStream & TS,
32 long DevNr ); 30 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 @@
4#include <qstring.h> 4#include <qstring.h>
5typedef struct ProfileData { 5class ProfileData {
6public :
6 QString Description; 7 QString Description;
@@ -13,3 +14,3 @@ typedef struct ProfileData {
13 bool TriggerVPN; 14 bool TriggerVPN;
14} ProfileData_t; 15} ;
15 16
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 @@
7#include <GUIUtils.h> 7#include <GUIUtils.h>
8#include <asdevice.h> 8#include <netnode.h>
9#include <resources.h> 9#include <resources.h>
@@ -18,3 +18,3 @@ ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) :
18 Dev = NNI->runtime()->device(); 18 Dev = NNI->runtime()->device();
19 if( ( II = Dev->assignedInterface() ) ) { 19 if( ( II = NNI->connection()->assignedInterface() ) ) {
20 20
@@ -57,3 +57,3 @@ QString ProfileEdit::acceptable( void ) {
57 57
58void ProfileEdit::showData( ProfileData_t & Data ) { 58void ProfileEdit::showData( ProfileData & Data ) {
59 Description_LE->setText( Data.Description ); 59 Description_LE->setText( Data.Description );
@@ -66,3 +66,3 @@ void ProfileEdit::showData( ProfileData_t & Data ) {
66 66
67bool ProfileEdit::commit( ProfileData_t & Data ) { 67bool ProfileEdit::commit( ProfileData & Data ) {
68 bool SM = 0; 68 bool SM = 0;
@@ -79,3 +79,3 @@ bool ProfileEdit::commit( ProfileData_t & Data ) {
79void ProfileEdit::SLOT_Refresh( void ) { 79void ProfileEdit::SLOT_Refresh( void ) {
80 InterfaceInfo * II = Dev->assignedInterface(); 80 InterfaceInfo * II = NNI->connection()->assignedInterface();
81 NSResources->system().refreshStatistics( *II ); 81 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 @@
5class ANetNodeInstance; 5class ANetNodeInstance;
6class AsDevice; 6class RuntimeInfo;
7 7
@@ -15,4 +15,4 @@ public :
15 QString acceptable( void ); 15 QString acceptable( void );
16 bool commit( ProfileData_t & Data ); 16 bool commit( ProfileData & Data );
17 void showData( ProfileData_t & Data ); 17 void showData( ProfileData & Data );
18 18
@@ -27,3 +27,3 @@ private :
27 ANetNodeInstance * NNI; 27 ANetNodeInstance * NNI;
28 AsDevice * Dev; 28 RuntimeInfo * Dev;
29}; 29};
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 @@
4 4
5void ProfileRun::detectState( NodeCollection * NC ) { 5State_t ProfileRun::detectState( void ) {
6 if( Data->Disabled ) { 6 if( Data->Disabled ) {
7 Log(( "%s disabled\n", NC->name().latin1() )); 7 return Disabled;
8 NC->setCurrentState( Disabled );
9 } else {
10 Log(( "%s not disabled\n", NC->name().latin1() ));
11 // find next item in connection
12 // convert to runtime and ask to detect the state
13 netNode()->nextNode()->runtime()->detectState( NC );
14 } 8 }
9 return Unknown;
15} 10}
16 11
17bool ProfileRun::setState( NodeCollection * NC, Action_t A, bool F ) { 12QString ProfileRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
18 ANetNodeInstance * NNNI; 13 owarn << "Profile " << Data->Disabled << oendl;
19 14 if( A == Disable ) {
20 NNNI = netNode()->nextNode(); 15 if( ! Data->Disabled ) {
21 switch ( A ) {
22 case Enable :
23 if( NC->currentState() == Disabled ) {
24 Data->Disabled = 0;
25 NC->setCurrentState( Off ); // at least
26 // ... but request deeper
27 NNNI->runtime()->detectState(NC);
28 }
29 return 1;
30 case Disable :
31 switch( NC->currentState() ) {
32 case IsUp :
33 case Available :
34 // bring Deactivate (will bring down)
35 if( ! NNNI->runtime()->setState(NC, Deactivate) )
36 return 0;
37 default :
38 break;
39 }
40 Data->Disabled = 1; 16 Data->Disabled = 1;
41 NC->setCurrentState( Disabled ); 17 NC->setModified( 1 );
42 return 1;
43 default :
44 break;
45 } 18 }
46 return NNNI->runtime()->setState(NC, A, F ); 19 } else if( A == Enable ) {
47} 20 if( Data->Disabled ) {
48 21 Data->Disabled = 0;
49bool ProfileRun::canSetState( State_t Curr, Action_t A ) { 22 NC->setModified( 1 );
50 RuntimeInfo * RI;
51 switch ( A ) {
52 case Enable :
53 case Disable :
54 // always possible
55 return 1;
56 default :
57 break;
58 } 23 }
59 RI = netNode()->nextNode()->runtime();
60 return ( Curr != Disabled ) ?
61 RI->canSetState(Curr, A) : 0;
62} 24}
63 25
64bool ProfileRun::handlesInterface( const QString & S ) { 26 return QString();
65 // donno -> pass deeper
66 return netNode()->nextNode()->runtime()->handlesInterface(S);
67} 27}
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 @@
3 3
4#include <asfullsetup.h> 4#include <netnode.h>
5#include "profiledata.h" 5#include "profiledata.h"
6 6
7class ProfileRun : public AsFullSetup { 7class ProfileRun : public RuntimeInfo {
8 8
@@ -11,17 +11,9 @@ public :
11 ProfileRun( ANetNodeInstance * NNI, ProfileData & D ) : 11 ProfileRun( ANetNodeInstance * NNI, ProfileData & D ) :
12 AsFullSetup( NNI ) 12 RuntimeInfo( NNI )
13 { Data = &D; } 13 { Data = &D; }
14 14
15 void detectState( NodeCollection * NC ); 15 virtual RuntimeInfo * fullSetup( void )
16 bool setState( NodeCollection * NC, Action_t A, bool ); 16 { return this; }
17 bool canSetState( State_t Curr, Action_t A );
18
19 bool handlesInterface( const QString & I );
20
21 virtual const QString & description( void ) 17 virtual const QString & description( void )
22 { return Data->Description; } 18 { return Data->Description; }
23
24 virtual AsFullSetup * asFullSetup( void )
25 { return (AsFullSetup *)this; }
26
27 virtual bool triggersVPN( void ) 19 virtual bool triggersVPN( void )
@@ -29,2 +21,8 @@ public :
29 21
22 State_t detectState( void );
23
24protected :
25
26 QString setMyState( NodeCollection * , Action_t, bool );
27
30private : 28private :