Diffstat (limited to 'noncore/settings/networksettings2/profile') (more/less context) (ignore whitespace changes)
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,3 +1,3 @@ | |||
1 | Package: opie-networksettingsplugin2-profile | 1 | Package: opie-networksettings2plugin-profile |
2 | Files: plugins/networksettings2/libprofile.so* | 2 | Files: plugins/networksettings2/libprofile.so* |
3 | Priority: optional | 3 | Priority: optional |
@@ -6,4 +6,4 @@ Maintainer: Wim Delvaux <wimpie@handhelds.org> | |||
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: opie-networksettings2, libopiecore2, libopienet2 | 7 | Depends: opie-networksettings2, libopiecore2, libopienet2 |
8 | Description: Network settings profile plugin. | 8 | Description: Network settings usage profile plugin. |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | 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,2 +1,3 @@ | |||
1 | #include <resources.h> | ||
1 | #include "profile_NN.h" | 2 | #include "profile_NN.h" |
2 | #include "profile_NNI.h" | 3 | #include "profile_NNI.h" |
@@ -6,4 +7,8 @@ static const char * ProfileNeeds[] = | |||
6 | 0 | 7 | 0 |
7 | }; | 8 | }; |
9 | static const char * ProfileProvides[] = | ||
10 | { "fullsetup", | ||
11 | 0 | ||
12 | }; | ||
8 | 13 | ||
9 | /** | 14 | /** |
@@ -11,4 +16,8 @@ static const char * ProfileNeeds[] = | |||
11 | */ | 16 | */ |
12 | ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) { | 17 | ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) { |
18 | |||
19 | NSResources->addSystemFile( | ||
20 | "interfaces", "/etc/network/interfaces", 1 ); | ||
21 | |||
13 | } | 22 | } |
14 | 23 | ||
@@ -35,6 +44,6 @@ const char ** ProfileNetNode::needs( void ) { | |||
35 | } | 44 | } |
36 | 45 | ||
37 | const char * ProfileNetNode::provides( void ) { | 46 | const char ** ProfileNetNode::provides( void ) { |
38 | return "fullsetup"; | 47 | return ProfileProvides; |
39 | } | 48 | } |
40 | 49 | ||
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 | |||
@@ -21,5 +21,5 @@ public: | |||
21 | virtual ANetNodeInstance * createInstance( void ); | 21 | virtual ANetNodeInstance * createInstance( void ); |
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 | ||
25 | private: | 25 | 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,2 +1,3 @@ | |||
1 | #include <opie2/odebug.h> | ||
1 | #include "profileedit.h" | 2 | #include "profileedit.h" |
2 | #include "profile_NNI.h" | 3 | #include "profile_NNI.h" |
@@ -51,7 +52,5 @@ void AProfile::commit( void ) { | |||
51 | } | 52 | } |
52 | 53 | ||
53 | short AProfile::generateFileEmbedded( const QString & ID, | 54 | short AProfile::generateFileEmbedded( SystemFile & SF, |
54 | const QString & Path, | ||
55 | QTextStream & TS, | ||
56 | long DevNr ) { | 55 | long DevNr ) { |
57 | 56 | ||
@@ -60,14 +59,14 @@ short AProfile::generateFileEmbedded( const QString & ID, | |||
60 | rvl = 1; | 59 | rvl = 1; |
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; |
68 | rvl = 0; | 67 | rvl = 0; |
69 | } | 68 | } |
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 : |
73 | (rvd == 0 || rvl == 0 ) ? 0 : 1; | 72 | (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 | |||
@@ -27,7 +27,5 @@ public : | |||
27 | { return (void *)&Data; } | 27 | { return (void *)&Data; } |
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 ); |
33 | 31 | ||
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 | |||
@@ -3,5 +3,6 @@ | |||
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | typedef struct ProfileData { | 5 | class ProfileData { |
6 | public : | ||
6 | QString Description; | 7 | QString Description; |
7 | // start up automatically | 8 | // start up automatically |
@@ -12,5 +13,5 @@ typedef struct ProfileData { | |||
12 | bool Disabled; | 13 | bool Disabled; |
13 | bool TriggerVPN; | 14 | bool TriggerVPN; |
14 | } ProfileData_t; | 15 | } ; |
15 | 16 | ||
16 | #endif | 17 | #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 | |||
@@ -6,5 +6,5 @@ | |||
6 | 6 | ||
7 | #include <GUIUtils.h> | 7 | #include <GUIUtils.h> |
8 | #include <asdevice.h> | 8 | #include <netnode.h> |
9 | #include <resources.h> | 9 | #include <resources.h> |
10 | 10 | ||
@@ -17,5 +17,5 @@ ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : | |||
17 | NNI = TNNI; | 17 | NNI = TNNI; |
18 | Dev = NNI->runtime()->device(); | 18 | Dev = NNI->runtime()->device(); |
19 | if( ( II = Dev->assignedInterface() ) ) { | 19 | if( ( II = NNI->connection()->assignedInterface() ) ) { |
20 | 20 | ||
21 | Refresh_CB->setEnabled( TRUE ); | 21 | Refresh_CB->setEnabled( TRUE ); |
@@ -56,5 +56,5 @@ QString ProfileEdit::acceptable( void ) { | |||
56 | } | 56 | } |
57 | 57 | ||
58 | void ProfileEdit::showData( ProfileData_t & Data ) { | 58 | void ProfileEdit::showData( ProfileData & Data ) { |
59 | Description_LE->setText( Data.Description ); | 59 | Description_LE->setText( Data.Description ); |
60 | Automatic_CB->setChecked( Data.Automatic ); | 60 | Automatic_CB->setChecked( Data.Automatic ); |
@@ -65,5 +65,5 @@ void ProfileEdit::showData( ProfileData_t & Data ) { | |||
65 | 65 | ||
66 | 66 | ||
67 | bool ProfileEdit::commit( ProfileData_t & Data ) { | 67 | bool ProfileEdit::commit( ProfileData & Data ) { |
68 | bool SM = 0; | 68 | bool SM = 0; |
69 | TXTM( Data.Description, Description_LE, SM ); | 69 | TXTM( Data.Description, Description_LE, SM ); |
@@ -78,5 +78,5 @@ bool ProfileEdit::commit( ProfileData_t & Data ) { | |||
78 | 78 | ||
79 | void ProfileEdit::SLOT_Refresh( void ) { | 79 | void 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 ); |
82 | RcvBytes_LBL->setText( II->RcvBytes ); | 82 | RcvBytes_LBL->setText( II->RcvBytes ); |
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 | |||
@@ -4,5 +4,5 @@ | |||
4 | #include <qtimer.h> | 4 | #include <qtimer.h> |
5 | class ANetNodeInstance; | 5 | class ANetNodeInstance; |
6 | class AsDevice; | 6 | class RuntimeInfo; |
7 | 7 | ||
8 | class ProfileEdit : public ProfileGUI { | 8 | class ProfileEdit : public ProfileGUI { |
@@ -14,6 +14,6 @@ public : | |||
14 | ProfileEdit( QWidget * parent, ANetNodeInstance * NNI ); | 14 | ProfileEdit( QWidget * parent, ANetNodeInstance * NNI ); |
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 | ||
19 | public slots : | 19 | public slots : |
@@ -26,4 +26,4 @@ private : | |||
26 | QTimer RefreshTimer; | 26 | QTimer RefreshTimer; |
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 | |||
@@ -3,65 +3,25 @@ | |||
3 | #include "profilerun.h" | 3 | #include "profilerun.h" |
4 | 4 | ||
5 | void ProfileRun::detectState( NodeCollection * NC ) { | 5 | State_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 ); | 8 | } |
9 | } else { | 9 | return Unknown; |
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 | } | ||
15 | } | 10 | } |
16 | 11 | ||
17 | bool ProfileRun::setState( NodeCollection * NC, Action_t A, bool F ) { | 12 | QString 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; | 18 | } |
43 | default : | 19 | } else if( A == Enable ) { |
44 | break; | 20 | if( Data->Disabled ) { |
45 | } | 21 | Data->Disabled = 0; |
46 | return NNNI->runtime()->setState(NC, A, F ); | 22 | NC->setModified( 1 ); |
47 | } | 23 | } |
48 | |||
49 | bool ProfileRun::canSetState( State_t Curr, Action_t A ) { | ||
50 | RuntimeInfo * RI; | ||
51 | switch ( A ) { | ||
52 | case Enable : | ||
53 | case Disable : | ||
54 | // always possible | ||
55 | return 1; | ||
56 | default : | ||
57 | break; | ||
58 | } | 24 | } |
59 | RI = netNode()->nextNode()->runtime(); | ||
60 | return ( Curr != Disabled ) ? | ||
61 | RI->canSetState(Curr, A) : 0; | ||
62 | } | ||
63 | 25 | ||
64 | bool 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 | |||
@@ -2,30 +2,28 @@ | |||
2 | #define PROFILERUN_H | 2 | #define PROFILERUN_H |
3 | 3 | ||
4 | #include <asfullsetup.h> | 4 | #include <netnode.h> |
5 | #include "profiledata.h" | 5 | #include "profiledata.h" |
6 | 6 | ||
7 | class ProfileRun : public AsFullSetup { | 7 | class ProfileRun : public RuntimeInfo { |
8 | 8 | ||
9 | public : | 9 | public : |
10 | 10 | ||
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 ) |
28 | { return Data->TriggerVPN; } | 20 | { return Data->TriggerVPN; } |
29 | 21 | ||
22 | State_t detectState( void ); | ||
23 | |||
24 | protected : | ||
25 | |||
26 | QString setMyState( NodeCollection * , Action_t, bool ); | ||
27 | |||
30 | private : | 28 | private : |
31 | 29 | ||