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,9 +1,9 @@ | |||
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 |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Wim Delvaux <wimpie@handhelds.org> | 5 | 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,51 +1,60 @@ | |||
1 | #include <resources.h> | ||
1 | #include "profile_NN.h" | 2 | #include "profile_NN.h" |
2 | #include "profile_NNI.h" | 3 | #include "profile_NNI.h" |
3 | 4 | ||
4 | static const char * ProfileNeeds[] = | 5 | static const char * ProfileNeeds[] = |
5 | { "connection", | 6 | { "connection", |
6 | 0 | 7 | 0 |
7 | }; | 8 | }; |
9 | static const char * ProfileProvides[] = | ||
10 | { "fullsetup", | ||
11 | 0 | ||
12 | }; | ||
8 | 13 | ||
9 | /** | 14 | /** |
10 | * Constructor, find all of the possible interfaces | 15 | * Constructor, find all of the possible interfaces |
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 | ||
15 | /** | 24 | /** |
16 | * Delete any interfaces that we own. | 25 | * Delete any interfaces that we own. |
17 | */ | 26 | */ |
18 | ProfileNetNode::~ProfileNetNode(){ | 27 | ProfileNetNode::~ProfileNetNode(){ |
19 | } | 28 | } |
20 | 29 | ||
21 | const QString ProfileNetNode::nodeDescription(){ | 30 | const QString ProfileNetNode::nodeDescription(){ |
22 | return tr("\ | 31 | return tr("\ |
23 | <p>Define use of an IP connection.</p>\ | 32 | <p>Define use of an IP connection.</p>\ |
24 | <p>Configure if and when this connection needs to be established</p>\ | 33 | <p>Configure if and when this connection needs to be established</p>\ |
25 | " | 34 | " |
26 | ); | 35 | ); |
27 | } | 36 | } |
28 | 37 | ||
29 | ANetNodeInstance * ProfileNetNode::createInstance( void ) { | 38 | ANetNodeInstance * ProfileNetNode::createInstance( void ) { |
30 | return new AProfile( this ); | 39 | return new AProfile( this ); |
31 | } | 40 | } |
32 | 41 | ||
33 | const char ** ProfileNetNode::needs( void ) { | 42 | const char ** ProfileNetNode::needs( void ) { |
34 | return ProfileNeeds; | 43 | return ProfileNeeds; |
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 | ||
41 | void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { | 50 | void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { |
42 | } | 51 | } |
43 | 52 | ||
44 | void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { | 53 | void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { |
45 | } | 54 | } |
46 | 55 | ||
47 | extern "C" { | 56 | extern "C" { |
48 | void create_plugin( QList<ANetNode> & PNN ) { | 57 | void create_plugin( QList<ANetNode> & PNN ) { |
49 | PNN.append( new ProfileNetNode() ); | 58 | PNN.append( new ProfileNetNode() ); |
50 | } | 59 | } |
51 | } | 60 | } |
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 | |||
@@ -1,36 +1,36 @@ | |||
1 | #ifndef PROFILE_NETNODE_H | 1 | #ifndef PROFILE_NETNODE_H |
2 | #define PROFILE_NETNODE_H | 2 | #define PROFILE_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AProfile; | 6 | class AProfile; |
7 | 7 | ||
8 | class ProfileNetNode : public ANetNode{ | 8 | class ProfileNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | ProfileNetNode(); | 14 | ProfileNetNode(); |
15 | virtual ~ProfileNetNode(); | 15 | virtual ~ProfileNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/commprofile"; } | 18 | { return "Devices/commprofile"; } |
19 | 19 | ||
20 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
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: |
26 | 26 | ||
27 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 27 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
28 | virtual void saveSpecificAttribute( QTextStream & TS ); | 28 | virtual void saveSpecificAttribute( QTextStream & TS ); |
29 | }; | 29 | }; |
30 | 30 | ||
31 | extern "C" | 31 | extern "C" |
32 | { | 32 | { |
33 | void create_plugin( QList<ANetNode> & PNN ); | 33 | void create_plugin( QList<ANetNode> & PNN ); |
34 | }; | 34 | }; |
35 | 35 | ||
36 | #endif | 36 | #endif |
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,77 +1,76 @@ | |||
1 | #include <opie2/odebug.h> | ||
1 | #include "profileedit.h" | 2 | #include "profileedit.h" |
2 | #include "profile_NNI.h" | 3 | #include "profile_NNI.h" |
3 | #include "profile_NN.h" | 4 | #include "profile_NN.h" |
4 | 5 | ||
5 | AProfile::AProfile( ProfileNetNode * PNN ) : ANetNodeInstance( PNN ) { | 6 | AProfile::AProfile( ProfileNetNode * PNN ) : ANetNodeInstance( PNN ) { |
6 | Data.Automatic = 1; | 7 | Data.Automatic = 1; |
7 | Data.Confirm = 0; | 8 | Data.Confirm = 0; |
8 | Data.Description = ""; | 9 | Data.Description = ""; |
9 | Data.Disabled = 0; | 10 | Data.Disabled = 0; |
10 | Data.TriggerVPN = 0; | 11 | Data.TriggerVPN = 0; |
11 | GUI = 0; | 12 | GUI = 0; |
12 | RT = 0; | 13 | RT = 0; |
13 | } | 14 | } |
14 | 15 | ||
15 | void AProfile::setSpecificAttribute( QString & Attr, QString & Value ) { | 16 | void AProfile::setSpecificAttribute( QString & Attr, QString & Value ) { |
16 | 17 | ||
17 | if ( Attr == "automatic" ) { | 18 | if ( Attr == "automatic" ) { |
18 | Data.Automatic = (Value=="yes"); | 19 | Data.Automatic = (Value=="yes"); |
19 | } else if ( Attr == "preconfirm" ) { | 20 | } else if ( Attr == "preconfirm" ) { |
20 | Data.Confirm = (Value=="yes"); | 21 | Data.Confirm = (Value=="yes"); |
21 | } else if ( Attr == "disabled" ) { | 22 | } else if ( Attr == "disabled" ) { |
22 | Data.Disabled = (Value=="yes"); | 23 | Data.Disabled = (Value=="yes"); |
23 | } else if ( Attr == "triggervpn" ) { | 24 | } else if ( Attr == "triggervpn" ) { |
24 | Data.TriggerVPN = (Value=="yes"); | 25 | Data.TriggerVPN = (Value=="yes"); |
25 | } else if ( Attr == "description" ) { | 26 | } else if ( Attr == "description" ) { |
26 | Data.Description = Value; | 27 | Data.Description = Value; |
27 | } | 28 | } |
28 | } | 29 | } |
29 | 30 | ||
30 | void AProfile::saveSpecificAttribute( QTextStream & TS ) { | 31 | void AProfile::saveSpecificAttribute( QTextStream & TS ) { |
31 | TS << "automatic=" << ((Data.Automatic) ? "yes" : "no") << endl; | 32 | TS << "automatic=" << ((Data.Automatic) ? "yes" : "no") << endl; |
32 | TS << "preconfirm=" << ((Data.Confirm) ? "yes" : "no") << endl; | 33 | TS << "preconfirm=" << ((Data.Confirm) ? "yes" : "no") << endl; |
33 | TS << "disabled=" << ((Data.Disabled) ? "yes" : "no") << endl; | 34 | TS << "disabled=" << ((Data.Disabled) ? "yes" : "no") << endl; |
34 | TS << "triggervpn=" << ((Data.TriggerVPN) ? "yes" : "no") << endl; | 35 | TS << "triggervpn=" << ((Data.TriggerVPN) ? "yes" : "no") << endl; |
35 | TS << "description=" << Data.Description << endl; | 36 | TS << "description=" << Data.Description << endl; |
36 | } | 37 | } |
37 | 38 | ||
38 | QWidget * AProfile::edit( QWidget * parent ) { | 39 | QWidget * AProfile::edit( QWidget * parent ) { |
39 | GUI = new ProfileEdit( parent, this ); | 40 | GUI = new ProfileEdit( parent, this ); |
40 | GUI->showData( Data ); | 41 | GUI->showData( Data ); |
41 | return GUI; | 42 | return GUI; |
42 | } | 43 | } |
43 | 44 | ||
44 | QString AProfile::acceptable( void ) { | 45 | QString AProfile::acceptable( void ) { |
45 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 46 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
46 | } | 47 | } |
47 | 48 | ||
48 | void AProfile::commit( void ) { | 49 | void AProfile::commit( void ) { |
49 | if( GUI && GUI->commit( Data ) ) | 50 | if( GUI && GUI->commit( Data ) ) |
50 | setModified( 1 ); | 51 | setModified( 1 ); |
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 | ||
58 | short rvl, rvd; | 57 | short rvl, rvd; |
59 | 58 | ||
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; |
74 | } | 73 | } |
75 | 74 | ||
76 | 75 | ||
77 | 76 | ||
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 | |||
@@ -1,50 +1,48 @@ | |||
1 | #ifndef PROFILE_H | 1 | #ifndef PROFILE_H |
2 | #define PROFILE_H | 2 | #define PROFILE_H |
3 | 3 | ||
4 | #include <netnode.h> | 4 | #include <netnode.h> |
5 | #include "profiledata.h" | 5 | #include "profiledata.h" |
6 | #include "profilerun.h" | 6 | #include "profilerun.h" |
7 | 7 | ||
8 | class ProfileNetNode; | 8 | class ProfileNetNode; |
9 | class ProfileEdit; | 9 | class ProfileEdit; |
10 | 10 | ||
11 | class AProfile : public ANetNodeInstance { | 11 | class AProfile : public ANetNodeInstance { |
12 | 12 | ||
13 | public : | 13 | public : |
14 | 14 | ||
15 | AProfile( ProfileNetNode * PNN ); | 15 | AProfile( ProfileNetNode * PNN ); |
16 | 16 | ||
17 | RuntimeInfo * runtime( void ) | 17 | RuntimeInfo * runtime( void ) |
18 | { return | 18 | { return |
19 | ( RT ) ? RT : ( RT = new ProfileRun( this, Data ) ); | 19 | ( RT ) ? RT : ( RT = new ProfileRun( this, Data ) ); |
20 | } | 20 | } |
21 | 21 | ||
22 | QWidget * edit( QWidget * parent ); | 22 | QWidget * edit( QWidget * parent ); |
23 | QString acceptable( void ); | 23 | QString acceptable( void ); |
24 | void commit( void ); | 24 | void commit( void ); |
25 | 25 | ||
26 | virtual void * data( void ) | 26 | virtual void * data( void ) |
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 | ||
34 | const QString & description( void ) | 32 | const QString & description( void ) |
35 | { return Data.Description; } | 33 | { return Data.Description; } |
36 | 34 | ||
37 | protected : | 35 | protected : |
38 | 36 | ||
39 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 37 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
40 | virtual void saveSpecificAttribute( QTextStream & TS ); | 38 | virtual void saveSpecificAttribute( QTextStream & TS ); |
41 | 39 | ||
42 | private : | 40 | private : |
43 | 41 | ||
44 | ProfileEdit * GUI; | 42 | ProfileEdit * GUI; |
45 | ProfileData Data; | 43 | ProfileData Data; |
46 | ProfileRun * RT; | 44 | ProfileRun * RT; |
47 | 45 | ||
48 | }; | 46 | }; |
49 | 47 | ||
50 | #endif | 48 | #endif |
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 | |||
@@ -1,16 +1,17 @@ | |||
1 | #ifndef PROFILE_DATA_H | 1 | #ifndef PROFILE_DATA_H |
2 | #define PROFILE_DATA_H | 2 | #define PROFILE_DATA_H |
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 |
8 | bool Automatic; | 9 | bool Automatic; |
9 | // if started up automatically, ask user for confirmation | 10 | // if started up automatically, ask user for confirmation |
10 | bool Confirm; | 11 | bool Confirm; |
11 | // Do not bring this connection up | 12 | // Do not bring this connection up |
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 | |||
@@ -1,98 +1,98 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qframe.h> | 2 | #include <qframe.h> |
3 | #include <qcheckbox.h> | 3 | #include <qcheckbox.h> |
4 | #include <qmultilineedit.h> | 4 | #include <qmultilineedit.h> |
5 | #include <qcheckbox.h> | 5 | #include <qcheckbox.h> |
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 | ||
11 | #include "profileedit.h" | 11 | #include "profileedit.h" |
12 | 12 | ||
13 | ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : | 13 | ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : |
14 | ProfileGUI( Parent ), RefreshTimer(this) { | 14 | ProfileGUI( Parent ), RefreshTimer(this) { |
15 | InterfaceInfo * II; | 15 | InterfaceInfo * II; |
16 | 16 | ||
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 ); |
22 | Snd_GB->setEnabled( TRUE ); | 22 | Snd_GB->setEnabled( TRUE ); |
23 | Rcv_GB->setEnabled( TRUE ); | 23 | Rcv_GB->setEnabled( TRUE ); |
24 | Collisions_FRM->setEnabled( TRUE ); | 24 | Collisions_FRM->setEnabled( TRUE ); |
25 | 25 | ||
26 | // show current content | 26 | // show current content |
27 | SLOT_Refresh(); | 27 | SLOT_Refresh(); |
28 | 28 | ||
29 | // fill in static data | 29 | // fill in static data |
30 | InterfaceName_LBL->setText( II->Name ); | 30 | InterfaceName_LBL->setText( II->Name ); |
31 | IPAddress_LBL->setText( II->Address ); | 31 | IPAddress_LBL->setText( II->Address ); |
32 | SubnetMask_LBL->setText( II->Netmask ); | 32 | SubnetMask_LBL->setText( II->Netmask ); |
33 | Broadcast_LBL->setText( II->BCastAddress ); | 33 | Broadcast_LBL->setText( II->BCastAddress ); |
34 | MACAddress_LBL->setText( II->MACAddress ); | 34 | MACAddress_LBL->setText( II->MACAddress ); |
35 | if( II->IsPointToPoint ) { | 35 | if( II->IsPointToPoint ) { |
36 | PointToPoint_LBL->setText( II->DstAddress ); | 36 | PointToPoint_LBL->setText( II->DstAddress ); |
37 | } | 37 | } |
38 | QString S; | 38 | QString S; |
39 | InterfaceName_LBL->setText( II->Name ); | 39 | InterfaceName_LBL->setText( II->Name ); |
40 | if( II->HasMulticast ) { | 40 | if( II->HasMulticast ) { |
41 | S += "Multicast"; | 41 | S += "Multicast"; |
42 | } | 42 | } |
43 | if( ! S.isEmpty() ) { | 43 | if( ! S.isEmpty() ) { |
44 | S.prepend( " : " ); | 44 | S.prepend( " : " ); |
45 | } | 45 | } |
46 | InterfaceOptions_LBL->setText( S ); | 46 | InterfaceOptions_LBL->setText( S ); |
47 | 47 | ||
48 | connect( &RefreshTimer, SIGNAL( timeout() ), | 48 | connect( &RefreshTimer, SIGNAL( timeout() ), |
49 | this, SLOT( SLOT_Refresh() ) ); | 49 | this, SLOT( SLOT_Refresh() ) ); |
50 | } | 50 | } |
51 | 51 | ||
52 | } | 52 | } |
53 | 53 | ||
54 | QString ProfileEdit::acceptable( void ) { | 54 | QString ProfileEdit::acceptable( void ) { |
55 | return QString(); | 55 | return QString(); |
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 ); |
61 | TriggersVPN_CB->setChecked( Data.TriggerVPN ); | 61 | TriggersVPN_CB->setChecked( Data.TriggerVPN ); |
62 | Confirm_CB->setChecked( Data.Confirm ); | 62 | Confirm_CB->setChecked( Data.Confirm ); |
63 | Disabled_CB->setChecked( Data.Disabled ); | 63 | Disabled_CB->setChecked( Data.Disabled ); |
64 | } | 64 | } |
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 ); |
70 | 70 | ||
71 | CBM( Data.Automatic, Automatic_CB, SM ); | 71 | CBM( Data.Automatic, Automatic_CB, SM ); |
72 | CBM( Data.TriggerVPN, TriggersVPN_CB, SM ); | 72 | CBM( Data.TriggerVPN, TriggersVPN_CB, SM ); |
73 | CBM( Data.Disabled, Disabled_CB, SM ); | 73 | CBM( Data.Disabled, Disabled_CB, SM ); |
74 | CBM( Data.Confirm, Confirm_CB, SM ); | 74 | CBM( Data.Confirm, Confirm_CB, SM ); |
75 | 75 | ||
76 | return SM; | 76 | return SM; |
77 | } | 77 | } |
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 ); |
83 | SndBytes_LBL->setText( II->SndBytes ); | 83 | SndBytes_LBL->setText( II->SndBytes ); |
84 | RcvErrors_LBL->setText( II->RcvErrors ); | 84 | RcvErrors_LBL->setText( II->RcvErrors ); |
85 | SndErrors_LBL->setText( II->SndErrors ); | 85 | SndErrors_LBL->setText( II->SndErrors ); |
86 | RcvDropped_LBL->setText( II->RcvDropped ); | 86 | RcvDropped_LBL->setText( II->RcvDropped ); |
87 | SndDropped_LBL->setText( II->SndDropped ); | 87 | SndDropped_LBL->setText( II->SndDropped ); |
88 | Collisions_LBL->setText( II->Collisions ); | 88 | Collisions_LBL->setText( II->Collisions ); |
89 | } | 89 | } |
90 | 90 | ||
91 | void ProfileEdit::SLOT_AutoRefresh( bool ar ) { | 91 | void ProfileEdit::SLOT_AutoRefresh( bool ar ) { |
92 | if( ar ) { | 92 | if( ar ) { |
93 | RefreshTimer.start( 1000 ); | 93 | RefreshTimer.start( 1000 ); |
94 | SLOT_Refresh(); | 94 | SLOT_Refresh(); |
95 | } else { | 95 | } else { |
96 | RefreshTimer.stop(); | 96 | RefreshTimer.stop(); |
97 | } | 97 | } |
98 | } | 98 | } |
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 | |||
@@ -1,29 +1,29 @@ | |||
1 | #include "profiledata.h" | 1 | #include "profiledata.h" |
2 | #include "profileGUI.h" | 2 | #include "profileGUI.h" |
3 | 3 | ||
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 { |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public : | 12 | public : |
13 | 13 | ||
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 : |
20 | 20 | ||
21 | void SLOT_AutoRefresh( bool ); | 21 | void SLOT_AutoRefresh( bool ); |
22 | void SLOT_Refresh( void ); | 22 | void SLOT_Refresh( void ); |
23 | 23 | ||
24 | private : | 24 | private : |
25 | 25 | ||
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 | |||
@@ -1,67 +1,27 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | 2 | ||
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 | |||
@@ -1,35 +1,33 @@ | |||
1 | #ifndef PROFILERUN_H | 1 | #ifndef PROFILERUN_H |
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 | ||
32 | ProfileData * Data; | 30 | ProfileData * Data; |
33 | 31 | ||
34 | }; | 32 | }; |
35 | #endif | 33 | #endif |