summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/profile
Unidiff
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,9 +1,9 @@
1Package: opie-networksettingsplugin2-profile 1Package: opie-networksettings2plugin-profile
2Files: plugins/networksettings2/libprofile.so* 2Files: plugins/networksettings2/libprofile.so*
3Priority: optional 3Priority: optional
4Section: opie/settings 4Section: opie/settings
5Maintainer: Wim Delvaux <wimpie@handhelds.org> 5Maintainer: Wim Delvaux <wimpie@handhelds.org>
6Architecture: arm 6Architecture: 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,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
4static const char * ProfileNeeds[] = 5static const char * ProfileNeeds[] =
5 { "connection", 6 { "connection",
6 0 7 0
7 }; 8 };
9static 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 */
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}
14 23
15/** 24/**
16 * Delete any interfaces that we own. 25 * Delete any interfaces that we own.
17 */ 26 */
18ProfileNetNode::~ProfileNetNode(){ 27ProfileNetNode::~ProfileNetNode(){
19} 28}
20 29
21const QString ProfileNetNode::nodeDescription(){ 30const 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
29ANetNodeInstance * ProfileNetNode::createInstance( void ) { 38ANetNodeInstance * ProfileNetNode::createInstance( void ) {
30 return new AProfile( this ); 39 return new AProfile( this );
31} 40}
32 41
33const char ** ProfileNetNode::needs( void ) { 42const char ** ProfileNetNode::needs( void ) {
34 return ProfileNeeds; 43 return ProfileNeeds;
35} 44}
36 45
37const char * ProfileNetNode::provides( void ) { 46const char ** ProfileNetNode::provides( void ) {
38 return "fullsetup"; 47 return ProfileProvides;
39} 48}
40 49
41void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { 50void ProfileNetNode::setSpecificAttribute( QString & , QString & ) {
42} 51}
43 52
44void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { 53void ProfileNetNode::saveSpecificAttribute( QTextStream & ) {
45} 54}
46 55
47extern "C" { 56extern "C" {
48void create_plugin( QList<ANetNode> & PNN ) { 57void 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
6class AProfile; 6class AProfile;
7 7
8class ProfileNetNode : public ANetNode{ 8class ProfileNetNode : public ANetNode{
9 9
10 Q_OBJECT 10 Q_OBJECT
11 11
12public: 12public:
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
25private: 25private:
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
31extern "C" 31extern "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
5AProfile::AProfile( ProfileNetNode * PNN ) : ANetNodeInstance( PNN ) { 6AProfile::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
15void AProfile::setSpecificAttribute( QString & Attr, QString & Value ) { 16void 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
30void AProfile::saveSpecificAttribute( QTextStream & TS ) { 31void 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
38QWidget * AProfile::edit( QWidget * parent ) { 39QWidget * 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
44QString AProfile::acceptable( void ) { 45QString AProfile::acceptable( void ) {
45 return ( GUI ) ? GUI->acceptable( ) : QString(); 46 return ( GUI ) ? GUI->acceptable( ) : QString();
46} 47}
47 48
48void AProfile::commit( void ) { 49void 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
53short AProfile::generateFileEmbedded( const QString & ID, 54short 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
8class ProfileNetNode; 8class ProfileNetNode;
9class ProfileEdit; 9class ProfileEdit;
10 10
11class AProfile : public ANetNodeInstance { 11class AProfile : public ANetNodeInstance {
12 12
13public : 13public :
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
37protected : 35protected :
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
42private : 40private :
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>
5typedef struct ProfileData { 5class ProfileData {
6public :
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
13ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : 13ProfileEdit::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
54QString ProfileEdit::acceptable( void ) { 54QString ProfileEdit::acceptable( void ) {
55 return QString(); 55 return QString();
56} 56}
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 );
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
67bool ProfileEdit::commit( ProfileData_t & Data ) { 67bool 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
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 );
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
91void ProfileEdit::SLOT_AutoRefresh( bool ar ) { 91void 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>
5class ANetNodeInstance; 5class ANetNodeInstance;
6class AsDevice; 6class RuntimeInfo;
7 7
8class ProfileEdit : public ProfileGUI { 8class ProfileEdit : public ProfileGUI {
9 9
10 Q_OBJECT 10 Q_OBJECT
11 11
12public : 12public :
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
19public slots : 19public 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
24private : 24private :
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
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 ); 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
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; 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
49bool 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
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
@@ -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
7class ProfileRun : public AsFullSetup { 7class ProfileRun : public RuntimeInfo {
8 8
9public : 9public :
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
24protected :
25
26 QString setMyState( NodeCollection * , Action_t, bool );
27
30private : 28private :
31 29
32 ProfileData * Data; 30 ProfileData * Data;
33 31
34}; 32};
35#endif 33#endif