author | wimpie <wimpie> | 2005-01-11 21:42:31 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-11 21:42:31 (UTC) |
commit | 96678694f8952f60d0a895cede2b621404b4bfb8 (patch) (unidiff) | |
tree | 7138e554e5ba200b8f9ca8b51c89b47531dc34f2 /noncore/settings | |
parent | f89120a7a1a3d0bf9c0805456490906ca914e560 (diff) | |
download | opie-96678694f8952f60d0a895cede2b621404b4bfb8.zip opie-96678694f8952f60d0a895cede2b621404b4bfb8.tar.gz opie-96678694f8952f60d0a895cede2b621404b4bfb8.tar.bz2 |
Major rename of NodeCollection to NetworkSetup
this commit is broken (missing symbols)
58 files changed, 393 insertions, 373 deletions
diff --git a/noncore/settings/networksettings2/activateprofile.cpp b/noncore/settings/networksettings2/activateprofile.cpp index e4064e3..fe98fc4 100644 --- a/noncore/settings/networksettings2/activateprofile.cpp +++ b/noncore/settings/networksettings2/activateprofile.cpp | |||
@@ -4,17 +4,17 @@ | |||
4 | 4 | ||
5 | ActivateProfile::ActivateProfile( const char * Interface ) : | 5 | ActivateProfile::ActivateProfile( const char * Interface ) : |
6 | ActivateProfileGUI( 0, 0, TRUE ), NSD() { | 6 | ActivateProfileGUI( 0, 0, TRUE ), NSD() { |
7 | 7 | ||
8 | Possible = NSD.collectPossible( Interface ); | 8 | Possible = NSD.collectPossible( Interface ); |
9 | 9 | ||
10 | DeviceName_LBL->setText( Interface ); | 10 | DeviceName_LBL->setText( Interface ); |
11 | Profiles_LB->clear(); | 11 | Profiles_LB->clear(); |
12 | for( NodeCollection * NC = Possible.first(); | 12 | for( NetworkSetup * NC = Possible.first(); |
13 | NC; | 13 | NC; |
14 | NC = Possible.next() ) { | 14 | NC = Possible.next() ) { |
15 | Profiles_LB->insertItem( NC->devicePixmap(), | 15 | Profiles_LB->insertItem( NC->devicePixmap(), |
16 | NC->name() ); | 16 | NC->name() ); |
17 | } | 17 | } |
18 | } | 18 | } |
19 | 19 | ||
20 | ActivateProfile::~ActivateProfile( void ) { | 20 | ActivateProfile::~ActivateProfile( void ) { |
diff --git a/noncore/settings/networksettings2/activateprofile.h b/noncore/settings/networksettings2/activateprofile.h index dedeb51..385c665 100644 --- a/noncore/settings/networksettings2/activateprofile.h +++ b/noncore/settings/networksettings2/activateprofile.h | |||
@@ -10,10 +10,10 @@ public : | |||
10 | ActivateProfile( const char * interface ); | 10 | ActivateProfile( const char * interface ); |
11 | ~ActivateProfile( void ); | 11 | ~ActivateProfile( void ); |
12 | 12 | ||
13 | long selectedProfile( void ); | 13 | long selectedProfile( void ); |
14 | 14 | ||
15 | private : | 15 | private : |
16 | 16 | ||
17 | NetworkSettingsData NSD; | 17 | NetworkSettingsData NSD; |
18 | QList<NodeCollection> Possible; | 18 | QList<NetworkSetup> Possible; |
19 | }; | 19 | }; |
diff --git a/noncore/settings/networksettings2/activatevpn.cpp b/noncore/settings/networksettings2/activatevpn.cpp index 768a031..35a881b 100644 --- a/noncore/settings/networksettings2/activatevpn.cpp +++ b/noncore/settings/networksettings2/activatevpn.cpp | |||
@@ -2,36 +2,36 @@ | |||
2 | #include <qheader.h> | 2 | #include <qheader.h> |
3 | #include <resources.h> | 3 | #include <resources.h> |
4 | #include "activatevpn.h" | 4 | #include "activatevpn.h" |
5 | 5 | ||
6 | class MyCheckListItem : public QCheckListItem { | 6 | class MyCheckListItem : public QCheckListItem { |
7 | 7 | ||
8 | public : | 8 | public : |
9 | 9 | ||
10 | MyCheckListItem( NodeCollection * N, QListView * V ); | 10 | MyCheckListItem( NetworkSetup * N, QListView * V ); |
11 | 11 | ||
12 | NodeCollection * NC; | 12 | NetworkSetup * NC; |
13 | 13 | ||
14 | }; | 14 | }; |
15 | 15 | ||
16 | MyCheckListItem::MyCheckListItem( NodeCollection * N, QListView * V ): | 16 | MyCheckListItem::MyCheckListItem( NetworkSetup * N, QListView * V ): |
17 | QCheckListItem( V, N->name() ) { | 17 | QCheckListItem( V, N->name() ) { |
18 | NC = N; | 18 | NC = N; |
19 | } | 19 | } |
20 | 20 | ||
21 | ActivateVPN::ActivateVPN( const QString & I ) : | 21 | ActivateVPN::ActivateVPN( const QString & I ) : |
22 | ActivateVPNGUI( 0, 0, TRUE ), NSD() { | 22 | ActivateVPNGUI( 0, 0, TRUE ), NSD() { |
23 | 23 | ||
24 | QCheckListItem * CI; | 24 | QCheckListItem * CI; |
25 | VPN_LV->clear(); | 25 | VPN_LV->clear(); |
26 | VPN_LV->header()->hide(); | 26 | VPN_LV->header()->hide(); |
27 | 27 | ||
28 | // find all connections that want to be triggered by this interface | 28 | // find all NetworkSetups that want to be triggered by this interface |
29 | for( QDictIterator<NodeCollection> it(NSResources->connections()); | 29 | for( QDictIterator<NetworkSetup> it(NSResources->networkSetups()); |
30 | it.current(); | 30 | it.current(); |
31 | ++it ) { | 31 | ++it ) { |
32 | if( it.current()->triggeredBy( I ) ) { | 32 | if( it.current()->triggeredBy( I ) ) { |
33 | CI = new MyCheckListItem( it.current(), VPN_LV ); | 33 | CI = new MyCheckListItem( it.current(), VPN_LV ); |
34 | } | 34 | } |
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp index 5c937a1..5c71a0a 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.cpp | |||
@@ -1,17 +1,17 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <qfileinfo.h> | 2 | #include <qfileinfo.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <resources.h> | 4 | #include <resources.h> |
5 | #include "bluetoothBNEPrun.h" | 5 | #include "bluetoothBNEPrun.h" |
6 | 6 | ||
7 | using Opietooth2::OTGateway; | 7 | using Opietooth2::OTGateway; |
8 | using Opietooth2::OTPANConnection; | 8 | using Opietooth2::OTPANNetworkSetup; |
9 | using Opietooth2::PANConnectionVector; | 9 | using Opietooth2::PANNetworkSetupVector; |
10 | 10 | ||
11 | BluetoothBNEPRun::BluetoothBNEPRun( ANetNodeInstance * NNI, | 11 | BluetoothBNEPRun::BluetoothBNEPRun( ANetNodeInstance * NNI, |
12 | BluetoothBNEPData & D ) : | 12 | BluetoothBNEPData & D ) : |
13 | RuntimeInfo( NNI ), | 13 | RuntimeInfo( NNI ), |
14 | Data( D), | 14 | Data( D), |
15 | Pat( "bnep[0-6]" ) { | 15 | Pat( "bnep[0-6]" ) { |
16 | OT = 0; | 16 | OT = 0; |
17 | } | 17 | } |
@@ -23,50 +23,50 @@ BluetoothBNEPRun::~BluetoothBNEPRun( void ) { | |||
23 | } | 23 | } |
24 | 24 | ||
25 | State_t BluetoothBNEPRun::detectState( void ) { | 25 | State_t BluetoothBNEPRun::detectState( void ) { |
26 | 26 | ||
27 | /* | 27 | /* |
28 | 28 | ||
29 | need to detect | 29 | need to detect |
30 | 30 | ||
31 | 1. for any PAN connection that is found if that | 31 | 1. for any PAN NetworkSetup that is found if that |
32 | PAN is connected. | 32 | PAN is connected. |
33 | 33 | ||
34 | if it is connected it is not available (since we do | 34 | if it is connected it is not available (since we do |
35 | not manage IP settings and we are called to detect | 35 | not manage IP settings and we are called to detect |
36 | the state we knwo that we do not have an UP connection) | 36 | the state we knwo that we do not have an UP NetworkSetup) |
37 | 37 | ||
38 | 2. if it not connected and we allow any connection we | 38 | 2. if it not connected and we allow any NetworkSetup we |
39 | are available or if that PAN connection is to a device | 39 | are available or if that PAN NetworkSetup is to a device |
40 | with a correct address | 40 | with a correct address |
41 | 41 | ||
42 | 3. if it is not connected and the address do not match or | 42 | 3. if it is not connected and the address do not match or |
43 | we do not accept any address, we are Unavailable but | 43 | we do not accept any address, we are Unavailable but |
44 | not DOWN. I.e a new connection could perhaps be created | 44 | not DOWN. I.e a new NetworkSetup could perhaps be created |
45 | 45 | ||
46 | */ | 46 | */ |
47 | 47 | ||
48 | if( ! OT ) { | 48 | if( ! OT ) { |
49 | OT = OTGateway::getOTGateway(); | 49 | OT = OTGateway::getOTGateway(); |
50 | } | 50 | } |
51 | 51 | ||
52 | if( ! OT->isEnabled() ) { | 52 | if( ! OT->isEnabled() ) { |
53 | return Unavailable; | 53 | return Unavailable; |
54 | } | 54 | } |
55 | 55 | ||
56 | // if there is a PAN connection that is UP but not | 56 | // if there is a PAN NetworkSetup that is UP but not |
57 | // yet configured (no ifup) the we are available | 57 | // yet configured (no ifup) the we are available |
58 | return ( hasFreePANConnection() ) ? Available : Unknown; | 58 | return ( hasFreePANNetworkSetup() ) ? Available : Unknown; |
59 | } | 59 | } |
60 | 60 | ||
61 | QString BluetoothBNEPRun::setMyState( NodeCollection * NC, Action_t A, bool ) { | 61 | QString BluetoothBNEPRun::setMyState( NetworkSetup * NC, Action_t A, bool ) { |
62 | 62 | ||
63 | if( A == Activate ) { | 63 | if( A == Activate ) { |
64 | if( hasFreePANConnection( 1 ) ) { | 64 | if( hasFreePANNetworkSetup( 1 ) ) { |
65 | // we have now an assignedinterface | 65 | // we have now an assignedinterface |
66 | } else { | 66 | } else { |
67 | return QString("TODO : Start PAND"); | 67 | return QString("TODO : Start PAND"); |
68 | } | 68 | } |
69 | 69 | ||
70 | Log(( "Assigned interface" )); | 70 | Log(( "Assigned interface" )); |
71 | NC->setCurrentState( Available ); | 71 | NC->setCurrentState( Available ); |
72 | 72 | ||
@@ -84,82 +84,82 @@ QString BluetoothBNEPRun::setMyState( NodeCollection * NC, Action_t A, bool ) { | |||
84 | bool BluetoothBNEPRun::handlesInterface( const QString & S ) { | 84 | bool BluetoothBNEPRun::handlesInterface( const QString & S ) { |
85 | return Pat.match( S ) >= 0; | 85 | return Pat.match( S ) >= 0; |
86 | } | 86 | } |
87 | 87 | ||
88 | bool BluetoothBNEPRun::handlesInterface( InterfaceInfo * I ) { | 88 | bool BluetoothBNEPRun::handlesInterface( InterfaceInfo * I ) { |
89 | return handlesInterface( I->Name ); | 89 | return handlesInterface( I->Name ); |
90 | } | 90 | } |
91 | 91 | ||
92 | bool BluetoothBNEPRun::hasFreePANConnection( bool Grab ) { | 92 | bool BluetoothBNEPRun::hasFreePANNetworkSetup( bool Grab ) { |
93 | 93 | ||
94 | if( ! OT ) { | 94 | if( ! OT ) { |
95 | OT = OTGateway::getOTGateway(); | 95 | OT = OTGateway::getOTGateway(); |
96 | } | 96 | } |
97 | 97 | ||
98 | // load PAN connections | 98 | // load PAN NetworkSetups |
99 | OTPANConnection * C; | 99 | OTPANNetworkSetup * C; |
100 | InterfaceInfo * Run; | 100 | InterfaceInfo * Run; |
101 | InterfaceInfo * Candidate = 0; // reuse this interface | 101 | InterfaceInfo * Candidate = 0; // reuse this interface |
102 | PANConnectionVector Conns = OT->getPANConnections(); | 102 | PANNetworkSetupVector Conns = OT->getPANNetworkSetups(); |
103 | System & Sys = NSResources->system(); | 103 | System & Sys = NSResources->system(); |
104 | bool IsValid; | 104 | bool IsValid; |
105 | 105 | ||
106 | for( unsigned int i = 0; | 106 | for( unsigned int i = 0; |
107 | i < Conns.count(); | 107 | i < Conns.count(); |
108 | i ++ ) { | 108 | i ++ ) { |
109 | C = Conns[i]; | 109 | C = Conns[i]; |
110 | 110 | ||
111 | if( Data.AllowAll ) { | 111 | if( Data.AllowAll ) { |
112 | // we allow all | 112 | // we allow all |
113 | IsValid = 1; | 113 | IsValid = 1; |
114 | } else { | 114 | } else { |
115 | // is this PAN connection connecting to a Peer | 115 | // is this PAN NetworkSetup connecting to a Peer |
116 | // we allow ? | 116 | // we allow ? |
117 | IsValid = 0; | 117 | IsValid = 0; |
118 | for ( QStringList::Iterator it = Data.BDAddress.begin(); | 118 | for ( QStringList::Iterator it = Data.BDAddress.begin(); |
119 | it != Data.BDAddress.end(); | 119 | it != Data.BDAddress.end(); |
120 | ++ it ) { | 120 | ++ it ) { |
121 | if( C->ConnectedTo == (*it) ) { | 121 | if( C->ConnectedTo == (*it) ) { |
122 | // this is a connection we could accept | 122 | // this is a NetworkSetup we could accept |
123 | IsValid = 1; | 123 | IsValid = 1; |
124 | break; | 124 | break; |
125 | } | 125 | } |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | if( ! IsValid ) { | 129 | if( ! IsValid ) { |
130 | Log(("%s to %s not acceptable\n", | 130 | Log(("%s to %s not acceptable\n", |
131 | C->Device.latin1(), | 131 | C->Device.latin1(), |
132 | C->ConnectedTo.latin1() )); | 132 | C->ConnectedTo.latin1() )); |
133 | // don't bother checking this address | 133 | // don't bother checking this address |
134 | // it is not acceptable | 134 | // it is not acceptable |
135 | continue; | 135 | continue; |
136 | } | 136 | } |
137 | 137 | ||
138 | // is this PAN connection available to us ? | 138 | // is this PAN NetworkSetup available to us ? |
139 | Run = Sys.findInterface( C->Device ); | 139 | Run = Sys.findInterface( C->Device ); |
140 | 140 | ||
141 | if( Run && Run->IsUp ) { | 141 | if( Run && Run->IsUp ) { |
142 | // this PAN connection is up | 142 | // this PAN NetworkSetup is up |
143 | Log(("%s acceptable but unavailable\n", | 143 | Log(("%s acceptable but unavailable\n", |
144 | C->Device.latin1() )); | 144 | C->Device.latin1() )); |
145 | // find others | 145 | // find others |
146 | continue; | 146 | continue; |
147 | } | 147 | } |
148 | 148 | ||
149 | // we at least have a possible interface | 149 | // we at least have a possible interface |
150 | if( ! Candidate ) { | 150 | if( ! Candidate ) { |
151 | Candidate = Run; | 151 | Candidate = Run; |
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | if( Candidate ) { | 155 | if( Candidate ) { |
156 | if ( Grab ) { | 156 | if ( Grab ) { |
157 | netNode()->connection()->assignInterface( Candidate ); | 157 | netNode()->networkSetup()->assignInterface( Candidate ); |
158 | } | 158 | } |
159 | return 1; | 159 | return 1; |
160 | } | 160 | } |
161 | 161 | ||
162 | // no free PAN | 162 | // no free PAN |
163 | return 0; | 163 | return 0; |
164 | } | 164 | } |
165 | 165 | ||
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h index 8551a2e..7346a8d 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h | |||
@@ -17,18 +17,18 @@ public : | |||
17 | 17 | ||
18 | bool handlesInterface( const QString & ); | 18 | bool handlesInterface( const QString & ); |
19 | bool handlesInterface( InterfaceInfo * ); | 19 | bool handlesInterface( InterfaceInfo * ); |
20 | 20 | ||
21 | State_t detectState( void ); | 21 | State_t detectState( void ); |
22 | 22 | ||
23 | protected : | 23 | protected : |
24 | 24 | ||
25 | QString setMyState( NodeCollection * , Action_t, bool ); | 25 | QString setMyState( NetworkSetup * , Action_t, bool ); |
26 | 26 | ||
27 | private : | 27 | private : |
28 | 28 | ||
29 | bool hasFreePANConnection( bool Grab = 0 ); | 29 | bool hasFreePANNetworkSetup( bool Grab = 0 ); |
30 | 30 | ||
31 | BluetoothBNEPData & Data; | 31 | BluetoothBNEPData & Data; |
32 | Opietooth2::OTGateway * OT; | 32 | Opietooth2::OTGateway * OT; |
33 | QRegExp Pat; | 33 | QRegExp Pat; |
34 | }; | 34 | }; |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp index 3df7f5c..cd7bb4a 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp | |||
@@ -15,28 +15,28 @@ BluetoothRFCOMMRun::~BluetoothRFCOMMRun( void ) { | |||
15 | } | 15 | } |
16 | 16 | ||
17 | State_t BluetoothRFCOMMRun::detectState( void ) { | 17 | State_t BluetoothRFCOMMRun::detectState( void ) { |
18 | 18 | ||
19 | if( ! OT ) { | 19 | if( ! OT ) { |
20 | OT = OTGateway::getOTGateway(); | 20 | OT = OTGateway::getOTGateway(); |
21 | } | 21 | } |
22 | 22 | ||
23 | if( deviceNrOfConnection() >= 0 ) { | 23 | if( deviceNrOfNetworkSetup() >= 0 ) { |
24 | return Available; | 24 | return Available; |
25 | } | 25 | } |
26 | 26 | ||
27 | odebug << "Bluetooth " | 27 | odebug << "Bluetooth " |
28 | << OT->isEnabled() | 28 | << OT->isEnabled() |
29 | << oendl; | 29 | << oendl; |
30 | 30 | ||
31 | return ( OT->isEnabled() ) ? Off : Unavailable; | 31 | return ( OT->isEnabled() ) ? Off : Unavailable; |
32 | } | 32 | } |
33 | 33 | ||
34 | QString BluetoothRFCOMMRun::setMyState( NodeCollection *, | 34 | QString BluetoothRFCOMMRun::setMyState( NetworkSetup *, |
35 | Action_t A, | 35 | Action_t A, |
36 | bool ) { | 36 | bool ) { |
37 | 37 | ||
38 | if( OT ) { | 38 | if( OT ) { |
39 | OTGateway::getOTGateway(); | 39 | OTGateway::getOTGateway(); |
40 | } | 40 | } |
41 | 41 | ||
42 | if( A == Activate ) { | 42 | if( A == Activate ) { |
@@ -65,17 +65,17 @@ QString BluetoothRFCOMMRun::setMyState( NodeCollection *, | |||
65 | Log(( "No channel selected -> cancel\n" )); | 65 | Log(( "No channel selected -> cancel\n" )); |
66 | return QString( "No channel selected. Operation cancelled" ); | 66 | return QString( "No channel selected. Operation cancelled" ); |
67 | } | 67 | } |
68 | } | 68 | } |
69 | 69 | ||
70 | if( A == Deactivate ) { | 70 | if( A == Deactivate ) { |
71 | if( DeviceNr >= 0 ) { | 71 | if( DeviceNr >= 0 ) { |
72 | if( OT->releaseRFCommDevice( DeviceNr ) ) { | 72 | if( OT->releaseRFCommDevice( DeviceNr ) ) { |
73 | return QString( "Cannot release RFCOMM connection" ); | 73 | return QString( "Cannot release RFCOMM NetworkSetup" ); |
74 | } | 74 | } |
75 | DeviceNr = -1; | 75 | DeviceNr = -1; |
76 | } | 76 | } |
77 | } | 77 | } |
78 | return QString(); | 78 | return QString(); |
79 | } | 79 | } |
80 | 80 | ||
81 | #include <qlistbox.h> | 81 | #include <qlistbox.h> |
@@ -126,25 +126,25 @@ RFCOMMChannel * BluetoothRFCOMMRun::getChannel( void ) { | |||
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | delete Dlg; | 129 | delete Dlg; |
130 | return Ch; | 130 | return Ch; |
131 | } | 131 | } |
132 | 132 | ||
133 | QString BluetoothRFCOMMRun::deviceFile( void ) { | 133 | QString BluetoothRFCOMMRun::deviceFile( void ) { |
134 | if( deviceNrOfConnection() >= 0 ) { | 134 | if( deviceNrOfNetworkSetup() >= 0 ) { |
135 | OTDevice * OTD = OT->getOTDevice(); | 135 | OTDevice * OTD = OT->getOTDevice(); |
136 | // there is a connection | 136 | // there is a NetworkSetup |
137 | return OTD->getRFCommDevicePattern().arg(DeviceNr); | 137 | return OTD->getRFCommDevicePattern().arg(DeviceNr); |
138 | } | 138 | } |
139 | return QString(); | 139 | return QString(); |
140 | } | 140 | } |
141 | 141 | ||
142 | int BluetoothRFCOMMRun::deviceNrOfConnection( void ) { | 142 | int BluetoothRFCOMMRun::deviceNrOfNetworkSetup( void ) { |
143 | 143 | ||
144 | if( ! OT ) { | 144 | if( ! OT ) { |
145 | OT = OTGateway::getOTGateway(); | 145 | OT = OTGateway::getOTGateway(); |
146 | } | 146 | } |
147 | 147 | ||
148 | DeviceNr = -1; | 148 | DeviceNr = -1; |
149 | for( unsigned int i = 0; i < Data->Devices.count(); i ++ ) { | 149 | for( unsigned int i = 0; i < Data->Devices.count(); i ++ ) { |
150 | odebug << "Check for rfcomm on " | 150 | odebug << "Check for rfcomm on " |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h index 5a31a94..32986d3 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h | |||
@@ -15,18 +15,18 @@ public : | |||
15 | virtual RuntimeInfo * line( void ) | 15 | virtual RuntimeInfo * line( void ) |
16 | { return this; } | 16 | { return this; } |
17 | virtual QString deviceFile( void ); | 17 | virtual QString deviceFile( void ); |
18 | 18 | ||
19 | State_t detectState( void ); | 19 | State_t detectState( void ); |
20 | 20 | ||
21 | protected : | 21 | protected : |
22 | 22 | ||
23 | QString setMyState( NodeCollection * , Action_t, bool ); | 23 | QString setMyState( NetworkSetup * , Action_t, bool ); |
24 | 24 | ||
25 | private : | 25 | private : |
26 | 26 | ||
27 | int deviceNrOfConnection( void ); | 27 | int deviceNrOfNetworkSetup( void ); |
28 | RFCOMMChannel * getChannel( void ); | 28 | RFCOMMChannel * getChannel( void ); |
29 | BluetoothRFCOMMData * Data; | 29 | BluetoothRFCOMMData * Data; |
30 | Opietooth2::OTGateway * OT; | 30 | Opietooth2::OTGateway * OT; |
31 | int DeviceNr; // cached from detection | 31 | int DeviceNr; // cached from detection |
32 | }; | 32 | }; |
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp index 58237a1..3f34bb2 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.cpp +++ b/noncore/settings/networksettings2/cable/cable_NN.cpp | |||
@@ -10,17 +10,17 @@ static const char * CableNeeds[] = | |||
10 | static const char * CableProvides[] = | 10 | static const char * CableProvides[] = |
11 | { "line", | 11 | { "line", |
12 | 0 | 12 | 0 |
13 | }; | 13 | }; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Constructor, find all of the possible interfaces | 16 | * Constructor, find all of the possible interfaces |
17 | */ | 17 | */ |
18 | CableNetNode::CableNetNode() : ANetNode(tr("Cable Connection")) { | 18 | CableNetNode::CableNetNode() : ANetNode(tr("Cable NetworkSetup")) { |
19 | } | 19 | } |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Delete any interfaces that we own. | 22 | * Delete any interfaces that we own. |
23 | */ | 23 | */ |
24 | CableNetNode::~CableNetNode(){ | 24 | CableNetNode::~CableNetNode(){ |
25 | } | 25 | } |
26 | 26 | ||
diff --git a/noncore/settings/networksettings2/cable/cablerun.cpp b/noncore/settings/networksettings2/cable/cablerun.cpp index 7a8deb9..edbeb89 100644 --- a/noncore/settings/networksettings2/cable/cablerun.cpp +++ b/noncore/settings/networksettings2/cable/cablerun.cpp | |||
@@ -8,15 +8,15 @@ State_t CableRun::detectState( void ) { | |||
8 | 8 | ||
9 | if( fd < 0 ) { | 9 | if( fd < 0 ) { |
10 | return Unavailable; | 10 | return Unavailable; |
11 | } | 11 | } |
12 | close( fd ); | 12 | close( fd ); |
13 | return Available; | 13 | return Available; |
14 | } | 14 | } |
15 | 15 | ||
16 | QString CableRun::setMyState( NodeCollection *, Action_t , bool ) { | 16 | QString CableRun::setMyState( NetworkSetup *, Action_t , bool ) { |
17 | return QString(); | 17 | return QString(); |
18 | } | 18 | } |
19 | 19 | ||
20 | QString CableRun::deviceFile( void ) { | 20 | QString CableRun::deviceFile( void ) { |
21 | return Data->Device; | 21 | return Data->Device; |
22 | } | 22 | } |
diff --git a/noncore/settings/networksettings2/cable/cablerun.h b/noncore/settings/networksettings2/cable/cablerun.h index 41aea01..6a457c4 100644 --- a/noncore/settings/networksettings2/cable/cablerun.h +++ b/noncore/settings/networksettings2/cable/cablerun.h | |||
@@ -13,14 +13,14 @@ public : | |||
13 | { return this; } | 13 | { return this; } |
14 | 14 | ||
15 | virtual QString deviceFile( void ); | 15 | virtual QString deviceFile( void ); |
16 | 16 | ||
17 | State_t detectState( void ); | 17 | State_t detectState( void ); |
18 | 18 | ||
19 | protected : | 19 | protected : |
20 | 20 | ||
21 | QString setMyState( NodeCollection * , Action_t, bool ); | 21 | QString setMyState( NetworkSetup * , Action_t, bool ); |
22 | 22 | ||
23 | private : | 23 | private : |
24 | 24 | ||
25 | CableData * Data; | 25 | CableData * Data; |
26 | }; | 26 | }; |
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp index 717d9e9..6ab2dd6 100644 --- a/noncore/settings/networksettings2/editconnection.cpp +++ b/noncore/settings/networksettings2/editconnection.cpp | |||
@@ -80,51 +80,53 @@ void MyQListViewItem::paintCell( QPainter *p, const QColorGroup &cg, | |||
80 | } | 80 | } |
81 | 81 | ||
82 | // | 82 | // |
83 | // | 83 | // |
84 | // REAL GUI | 84 | // REAL GUI |
85 | // | 85 | // |
86 | // | 86 | // |
87 | 87 | ||
88 | bool EditConnection::AutoCollapse = 1; | 88 | bool EditNetworkSetup::AutoCollapse = 1; |
89 | 89 | ||
90 | EditConnection::EditConnection( QWidget* parent ) : | 90 | EditNetworkSetup::EditNetworkSetup( QWidget* parent ) : |
91 | EditConnectionGUI( parent, 0, TRUE ), TmpCollection() { | 91 | EditNetworkSetupGUI( parent, 0, TRUE ), TmpCollection() { |
92 | 92 | ||
93 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); | 93 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); |
94 | Setup_FRM->setEnabled( FALSE ); | 94 | Setup_FRM->setEnabled( FALSE ); |
95 | 95 | ||
96 | TmpIsValid = 0; | 96 | TmpIsValid = 0; |
97 | SelectedNodes = 0; | 97 | SelectedNodes = 0; |
98 | 98 | ||
99 | AutoCollapse_CB->setChecked( AutoCollapse ); | 99 | AutoCollapse_CB->setChecked( AutoCollapse ); |
100 | 100 | ||
101 | Mapping = new QPtrDict<ANetNode>; | 101 | Mapping = new QPtrDict<ANetNode>; |
102 | Mapping->setAutoDelete( FALSE ); | 102 | Mapping->setAutoDelete( FALSE ); |
103 | Nodes_LV->header()->hide(); | 103 | Nodes_LV->header()->hide(); |
104 | // popluate tree with all NetNodes | 104 | // popluate tree with all NetNodes |
105 | buildFullTree(); | 105 | buildFullTree(); |
106 | } | 106 | } |
107 | 107 | ||
108 | NodeCollection * EditConnection::getTmpCollection( void ) { | 108 | NetworkSetup * EditNetworkSetup::getTmpCollection( void ) { |
109 | 109 | ||
110 | if( TmpIsValid ) | 110 | if( TmpIsValid ) |
111 | // content is stil OK | 111 | // content is stil OK |
112 | return &(TmpCollection); | 112 | return &(TmpCollection); |
113 | 113 | ||
114 | // reset collection -> delete all NEW NetNodes | 114 | // reset collection -> delete all NEW NetNodes |
115 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 115 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
116 | it.current(); | 116 | it.current(); |
117 | ++it ) { | 117 | ++it ) { |
118 | if( it.current()->isNew() ) { | 118 | if( it.current()->isNew() ) { |
119 | delete it.current(); | 119 | delete it.current(); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | |||
122 | TmpCollection.clear(); | 123 | TmpCollection.clear(); |
124 | TmpCollection.copyFrom( *SelectedNodes ); | ||
123 | 125 | ||
124 | // update content | 126 | // update content |
125 | QListViewItem * it = Nodes_LV->firstChild(); | 127 | QListViewItem * it = Nodes_LV->firstChild(); |
126 | ANetNode * NN; | 128 | ANetNode * NN; |
127 | 129 | ||
128 | // start iter (if there is a collection) | 130 | // start iter (if there is a collection) |
129 | /* | 131 | /* |
130 | 132 | ||
@@ -188,18 +190,18 @@ NodeCollection * EditConnection::getTmpCollection( void ) { | |||
188 | // or an item | 190 | // or an item |
189 | it = it->firstChild(); | 191 | it = it->firstChild(); |
190 | } | 192 | } |
191 | 193 | ||
192 | TmpIsValid = 1; | 194 | TmpIsValid = 1; |
193 | return &(TmpCollection); | 195 | return &(TmpCollection); |
194 | } | 196 | } |
195 | 197 | ||
196 | // pass a connection NodeCollection to be edited | 198 | // pass a NetworkSetup NetworkSetup to be edited |
197 | void EditConnection::setConnection( NodeCollection * NC ) { | 199 | void EditNetworkSetup::setNetworkSetup( NetworkSetup * NC ) { |
198 | ANetNodeInstance * NNI; | 200 | ANetNodeInstance * NNI; |
199 | ANetNode * NN; | 201 | ANetNode * NN; |
200 | 202 | ||
201 | SelectedNodes = NC; | 203 | SelectedNodes = NC; |
202 | Name_LE->setText( NC->name() ); | 204 | Name_LE->setText( NC->name() ); |
203 | NNI = NC->first(); | 205 | NNI = NC->first(); |
204 | 206 | ||
205 | // show configure tabl | 207 | // show configure tabl |
@@ -238,54 +240,54 @@ void EditConnection::setConnection( NodeCollection * NC ) { | |||
238 | it = it->nextSibling(); | 240 | it = it->nextSibling(); |
239 | } | 241 | } |
240 | 242 | ||
241 | if( ! Found ) { | 243 | if( ! Found ) { |
242 | // this means that this level is NOT present in collection | 244 | // this means that this level is NOT present in collection |
243 | // probably INCOMPATIBEL collection OR Missing plugin | 245 | // probably INCOMPATIBEL collection OR Missing plugin |
244 | QMessageBox::warning( | 246 | QMessageBox::warning( |
245 | 0, | 247 | 0, |
246 | tr( "Error presentig Connection" ), | 248 | tr( "Error presentig NetworkSetup" ), |
247 | tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ). | 249 | tr( "<p>Old NetworkSetup or missing plugin \"<i>%1</i>\"</p>" ). |
248 | arg(NNI->nodeClass()->name()) ); | 250 | arg(NNI->nodeClass()->name()) ); |
249 | return; | 251 | return; |
250 | } | 252 | } |
251 | 253 | ||
252 | // it now contains selected radio | 254 | // it now contains selected radio |
253 | NN = (*Mapping)[it]; | 255 | NN = (*Mapping)[it]; |
254 | } else { | 256 | } else { |
255 | // automatic selection | 257 | // automatic selection |
256 | if( NNI == 0 || it->text(0) != NNI->nodeClass()->name() ) { | 258 | if( NNI == 0 || it->text(0) != NNI->nodeClass()->name() ) { |
257 | // should exist and be the same | 259 | // should exist and be the same |
258 | if( NNI ) { | 260 | if( NNI ) { |
259 | QMessageBox::warning( | 261 | QMessageBox::warning( |
260 | 0, | 262 | 0, |
261 | tr( "Error presentig Connection" ), | 263 | tr( "Error presentig NetworkSetup" ), |
262 | tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ). | 264 | tr( "<p>Old NetworkSetup or missing plugin \"<i>%1</i>\"</p>" ). |
263 | arg(NNI->nodeClass()->name()) ); | 265 | arg(NNI->nodeClass()->name()) ); |
264 | } else { | 266 | } else { |
265 | QMessageBox::warning( | 267 | QMessageBox::warning( |
266 | 0, | 268 | 0, |
267 | tr( "Error presentig Connection" ), | 269 | tr( "Error presentig NetworkSetup" ), |
268 | tr( "<p>Missing connection\"<i>%1</i>\"</p>" ). | 270 | tr( "<p>Missing NetworkSetup\"<i>%1</i>\"</p>" ). |
269 | arg(it->text(0)) ); | 271 | arg(it->text(0)) ); |
270 | } | 272 | } |
271 | return; | 273 | return; |
272 | } | 274 | } |
273 | it = it->firstChild(); | 275 | it = it->firstChild(); |
274 | } | 276 | } |
275 | } | 277 | } |
276 | } | 278 | } |
277 | 279 | ||
278 | // get result of editing (either new OR updated collection | 280 | // get result of editing (either new OR updated collection |
279 | NodeCollection * EditConnection::connection( void ) { | 281 | NetworkSetup * EditNetworkSetup::networkSetup( void ) { |
280 | 282 | ||
281 | if( SelectedNodes == 0 ) { | 283 | if( SelectedNodes == 0 ) { |
282 | // new collection | 284 | // new collection |
283 | SelectedNodes = new NodeCollection; | 285 | SelectedNodes = new NetworkSetup; |
284 | } | 286 | } |
285 | 287 | ||
286 | // clean out old entries | 288 | // clean out old entries |
287 | SelectedNodes->clear(); | 289 | SelectedNodes->clear(); |
288 | 290 | ||
289 | // transfer | 291 | // transfer |
290 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 292 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
291 | it.current(); | 293 | it.current(); |
@@ -300,31 +302,31 @@ NodeCollection * EditConnection::connection( void ) { | |||
300 | SelectedNodes->setName( Name_LE->text() ); | 302 | SelectedNodes->setName( Name_LE->text() ); |
301 | SelectedNodes->setModified( 1 ); | 303 | SelectedNodes->setModified( 1 ); |
302 | } | 304 | } |
303 | 305 | ||
304 | return SelectedNodes; | 306 | return SelectedNodes; |
305 | } | 307 | } |
306 | 308 | ||
307 | // Build device tree -> start | 309 | // Build device tree -> start |
308 | void EditConnection::buildFullTree( void ) { | 310 | void EditNetworkSetup::buildFullTree( void ) { |
309 | ANetNode * NN; | 311 | ANetNode * NN; |
310 | 312 | ||
311 | // toplevel item | 313 | // toplevel item |
312 | MyQCheckListItem * TheTop = new MyQCheckListItem( | 314 | MyQCheckListItem * TheTop = new MyQCheckListItem( |
313 | Nodes_LV, | 315 | Nodes_LV, |
314 | NSResources->netNode2Name("fullsetup"), | 316 | NSResources->netNode2Name("fullsetup"), |
315 | QCheckListItem::Controller ); | 317 | QCheckListItem::Controller ); |
316 | TheTop->setOpen( TRUE ); | 318 | TheTop->setOpen( TRUE ); |
317 | Description_LBL->setText( | 319 | Description_LBL->setText( |
318 | NSResources->netNode2Description( "fullsetup" ) ); | 320 | NSResources->netNode2Description( "fullsetup" ) ); |
319 | Nodes_LV->setSelected( TheTop, TRUE ); | 321 | Nodes_LV->setSelected( TheTop, TRUE ); |
320 | 322 | ||
321 | // find all Nodes that are toplevel nodes -> ie provide | 323 | // find all Nodes that are toplevel nodes -> ie provide |
322 | // TCP/IP Connection | 324 | // TCP/IP NetworkSetup |
323 | for( QDictIterator<ANetNode> Iter(NSResources->netNodes()); | 325 | for( QDictIterator<ANetNode> Iter(NSResources->netNodes()); |
324 | Iter.current(); | 326 | Iter.current(); |
325 | ++Iter ) { | 327 | ++Iter ) { |
326 | NN = Iter.current(); | 328 | NN = Iter.current(); |
327 | 329 | ||
328 | if( ! NN->isToplevel() ) { | 330 | if( ! NN->isToplevel() ) { |
329 | continue; | 331 | continue; |
330 | } | 332 | } |
@@ -337,17 +339,17 @@ void EditConnection::buildFullTree( void ) { | |||
337 | ); | 339 | ); |
338 | // remember that this node maps to this listitem | 340 | // remember that this node maps to this listitem |
339 | Mapping->insert( it, NN ); | 341 | Mapping->insert( it, NN ); |
340 | buildSubTree( it, NN ); | 342 | buildSubTree( it, NN ); |
341 | } | 343 | } |
342 | } | 344 | } |
343 | 345 | ||
344 | // Build device tree -> help function | 346 | // Build device tree -> help function |
345 | void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { | 347 | void EditNetworkSetup::buildSubTree( QListViewItem * it, ANetNode *NN ) { |
346 | ANetNode::NetNodeList & NNL = NN->alternatives(); | 348 | ANetNode::NetNodeList & NNL = NN->alternatives(); |
347 | 349 | ||
348 | if( NNL.size() > 1 ) { | 350 | if( NNL.size() > 1 ) { |
349 | // this node has alternatives -> needs radio buttons | 351 | // this node has alternatives -> needs radio buttons |
350 | it = new MyQCheckListItem( | 352 | it = new MyQCheckListItem( |
351 | it, | 353 | it, |
352 | NSResources->netNode2Name(NN->needs()[0]), | 354 | NSResources->netNode2Name(NN->needs()[0]), |
353 | QCheckListItem::Controller ); | 355 | QCheckListItem::Controller ); |
@@ -373,21 +375,21 @@ void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { | |||
373 | CI->setSelectable( FALSE ); | 375 | CI->setSelectable( FALSE ); |
374 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); | 376 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); |
375 | } | 377 | } |
376 | buildSubTree( CI, NNL[i] ); | 378 | buildSubTree( CI, NNL[i] ); |
377 | } | 379 | } |
378 | } | 380 | } |
379 | 381 | ||
380 | // Clicked ok OK button | 382 | // Clicked ok OK button |
381 | void EditConnection::accept( void ) { | 383 | void EditNetworkSetup::accept( void ) { |
382 | if( ! haveCompleteConfig( 0 ) || Name_LE->text().isEmpty() ) { | 384 | if( ! haveCompleteConfig( 0 ) || Name_LE->text().isEmpty() ) { |
383 | QMessageBox::warning( | 385 | QMessageBox::warning( |
384 | 0, | 386 | 0, |
385 | tr( "Closing Connection Setup" ), | 387 | tr( "Closing NetworkSetup Setup" ), |
386 | tr( "Definition not complete or no name" ) ); | 388 | tr( "Definition not complete or no name" ) ); |
387 | return; | 389 | return; |
388 | } | 390 | } |
389 | 391 | ||
390 | // check if all devices have acceptable input | 392 | // check if all devices have acceptable input |
391 | getTmpCollection(); | 393 | getTmpCollection(); |
392 | { ANetNodeInstance * NNI; | 394 | { ANetNodeInstance * NNI; |
393 | QString S; | 395 | QString S; |
@@ -413,22 +415,22 @@ void EditConnection::accept( void ) { | |||
413 | } | 415 | } |
414 | } | 416 | } |
415 | } | 417 | } |
416 | 418 | ||
417 | QDialog::accept(); | 419 | QDialog::accept(); |
418 | } | 420 | } |
419 | 421 | ||
420 | // triggered by CB | 422 | // triggered by CB |
421 | void EditConnection::SLOT_AutoCollapse( bool b ) { | 423 | void EditNetworkSetup::SLOT_AutoCollapse( bool b ) { |
422 | AutoCollapse = b; | 424 | AutoCollapse = b; |
423 | } | 425 | } |
424 | 426 | ||
425 | // clicked on node in tree -> update GUI | 427 | // clicked on node in tree -> update GUI |
426 | void EditConnection::SLOT_SelectNode( QListViewItem * it ) { | 428 | void EditNetworkSetup::SLOT_SelectNode( QListViewItem * it ) { |
427 | ANetNode * NN; | 429 | ANetNode * NN; |
428 | if( it == 0 || it->depth() == 0 ) { | 430 | if( it == 0 || it->depth() == 0 ) { |
429 | Description_LBL->setText( | 431 | Description_LBL->setText( |
430 | NSResources->netNode2Description( "fullsetup" ) ); | 432 | NSResources->netNode2Description( "fullsetup" ) ); |
431 | // topevel or no selection | 433 | // topevel or no selection |
432 | return; | 434 | return; |
433 | } | 435 | } |
434 | 436 | ||
@@ -460,17 +462,17 @@ void EditConnection::SLOT_SelectNode( QListViewItem * it ) { | |||
460 | } | 462 | } |
461 | 463 | ||
462 | // item has really changed -> update | 464 | // item has really changed -> update |
463 | TmpIsValid = 0; | 465 | TmpIsValid = 0; |
464 | updateGUI( it, NN ); | 466 | updateGUI( it, NN ); |
465 | } | 467 | } |
466 | 468 | ||
467 | // cliecked on TAB to go to setup | 469 | // cliecked on TAB to go to setup |
468 | void EditConnection::SLOT_AlterTab( const QString & S ) { | 470 | void EditNetworkSetup::SLOT_AlterTab( const QString & S ) { |
469 | if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) { | 471 | if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) { |
470 | // switched to setup -> update CB and populate ws with | 472 | // switched to setup -> update CB and populate ws with |
471 | // forms for devices | 473 | // forms for devices |
472 | 474 | ||
473 | if( ! TmpIsValid ) { | 475 | if( ! TmpIsValid ) { |
474 | getTmpCollection(); | 476 | getTmpCollection(); |
475 | 477 | ||
476 | // clear CB and Ws | 478 | // clear CB and Ws |
@@ -509,17 +511,17 @@ void EditConnection::SLOT_AlterTab( const QString & S ) { | |||
509 | } | 511 | } |
510 | } | 512 | } |
511 | Setup_WS->raiseWidget( 0 ); | 513 | Setup_WS->raiseWidget( 0 ); |
512 | } // still valid | 514 | } // still valid |
513 | } | 515 | } |
514 | } | 516 | } |
515 | 517 | ||
516 | // update visual feedback of selection state | 518 | // update visual feedback of selection state |
517 | void EditConnection::updateGUI( QListViewItem * it, ANetNode * NN ) { | 519 | void EditNetworkSetup::updateGUI( QListViewItem * it, ANetNode * NN ) { |
518 | 520 | ||
519 | bool HCC = haveCompleteConfig( it ); | 521 | bool HCC = haveCompleteConfig( it ); |
520 | Tab_TB->setTabEnabled( Setup_FRM, HCC ); | 522 | Tab_TB->setTabEnabled( Setup_FRM, HCC ); |
521 | Setup_FRM->setEnabled( HCC ); | 523 | Setup_FRM->setEnabled( HCC ); |
522 | 524 | ||
523 | // disable children of all siblings at same level | 525 | // disable children of all siblings at same level |
524 | QListViewItem * Sbl = it->parent()->firstChild(); | 526 | QListViewItem * Sbl = it->parent()->firstChild(); |
525 | while( Sbl ) { | 527 | while( Sbl ) { |
@@ -535,29 +537,29 @@ void EditConnection::updateGUI( QListViewItem * it, ANetNode * NN ) { | |||
535 | // enable selected path (as deep as it goes | 537 | // enable selected path (as deep as it goes |
536 | it->setOpen( TRUE ); | 538 | it->setOpen( TRUE ); |
537 | enablePath( it->firstChild(), | 539 | enablePath( it->firstChild(), |
538 | (it->depth()==1) ? | 540 | (it->depth()==1) ? |
539 | 1 : // toplevel always alternatives | 541 | 1 : // toplevel always alternatives |
540 | (NN->alternatives().size() > 1) ); | 542 | (NN->alternatives().size() > 1) ); |
541 | } | 543 | } |
542 | 544 | ||
543 | void EditConnection::disableTree( QListViewItem * it, bool Mode ) { | 545 | void EditNetworkSetup::disableTree( QListViewItem * it, bool Mode ) { |
544 | while( it ) { | 546 | while( it ) { |
545 | // disable sbl's chidren | 547 | // disable sbl's chidren |
546 | it->setSelectable( Mode ); | 548 | it->setSelectable( Mode ); |
547 | if( AutoCollapse ) | 549 | if( AutoCollapse ) |
548 | it->setOpen( Mode ); | 550 | it->setOpen( Mode ); |
549 | disableTree( it->firstChild(), Mode ); | 551 | disableTree( it->firstChild(), Mode ); |
550 | it = it->nextSibling(); | 552 | it = it->nextSibling(); |
551 | } | 553 | } |
552 | } | 554 | } |
553 | 555 | ||
554 | // pah : ParentHasAlternatives | 556 | // pah : ParentHasAlternatives |
555 | void EditConnection::enablePath( QListViewItem * it, bool pha ) { | 557 | void EditNetworkSetup::enablePath( QListViewItem * it, bool pha ) { |
556 | while( it ) { | 558 | while( it ) { |
557 | ANetNode * NN; | 559 | ANetNode * NN; |
558 | NN = (*Mapping)[it]; | 560 | NN = (*Mapping)[it]; |
559 | if( NN ) { | 561 | if( NN ) { |
560 | if( pha ) { | 562 | if( pha ) { |
561 | bool doOn = ((QCheckListItem *)it)->isOn(); | 563 | bool doOn = ((QCheckListItem *)it)->isOn(); |
562 | // we are a checklistitem for sure | 564 | // we are a checklistitem for sure |
563 | it->setSelectable( TRUE ); | 565 | it->setSelectable( TRUE ); |
@@ -584,17 +586,17 @@ void EditConnection::enablePath( QListViewItem * it, bool pha ) { | |||
584 | it->setOpen( TRUE ); | 586 | it->setOpen( TRUE ); |
585 | enablePath( it->firstChild(), pha ); | 587 | enablePath( it->firstChild(), pha ); |
586 | } | 588 | } |
587 | it = it->nextSibling(); | 589 | it = it->nextSibling(); |
588 | } | 590 | } |
589 | } | 591 | } |
590 | 592 | ||
591 | // do we have a complete configuration (all needs are provided for ?) | 593 | // do we have a complete configuration (all needs are provided for ?) |
592 | bool EditConnection::haveCompleteConfig( QListViewItem * it ) { | 594 | bool EditNetworkSetup::haveCompleteConfig( QListViewItem * it ) { |
593 | 595 | ||
594 | // check if all below this level is selected | 596 | // check if all below this level is selected |
595 | it = ( it ) ?it : Nodes_LV->firstChild(); | 597 | it = ( it ) ?it : Nodes_LV->firstChild(); |
596 | ANetNode *NN; | 598 | ANetNode *NN; |
597 | bool Found; | 599 | bool Found; |
598 | 600 | ||
599 | while ( it ) { | 601 | while ( it ) { |
600 | NN = (*Mapping)[it]; | 602 | NN = (*Mapping)[it]; |
diff --git a/noncore/settings/networksettings2/editconnection.h b/noncore/settings/networksettings2/editconnection.h index e8d7a2c..c2fc643 100644 --- a/noncore/settings/networksettings2/editconnection.h +++ b/noncore/settings/networksettings2/editconnection.h | |||
@@ -5,45 +5,45 @@ | |||
5 | #include "netnode.h" | 5 | #include "netnode.h" |
6 | 6 | ||
7 | class ANetNodeInstance; | 7 | class ANetNodeInstance; |
8 | class ANetNode; | 8 | class ANetNode; |
9 | class QListViewItem; | 9 | class QListViewItem; |
10 | class NetNodeLVI; | 10 | class NetNodeLVI; |
11 | class QCloseEvent; | 11 | class QCloseEvent; |
12 | 12 | ||
13 | class EditConnection : public EditConnectionGUI { | 13 | class EditNetworkSetup : public EditNetworkSetupGUI { |
14 | 14 | ||
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | 16 | ||
17 | public : | 17 | public : |
18 | 18 | ||
19 | EditConnection( QWidget * P ); | 19 | EditNetworkSetup( QWidget * P ); |
20 | 20 | ||
21 | ANetNodeInstance * netNodeInstance( void ); | 21 | ANetNodeInstance * netNodeInstance( void ); |
22 | void setConnection( NodeCollection * NC ); | 22 | void setNetworkSetup( NetworkSetup * NC ); |
23 | NodeCollection * connection( void ); | 23 | NetworkSetup * networkSetup( void ); |
24 | 24 | ||
25 | public slots : | 25 | public slots : |
26 | 26 | ||
27 | void SLOT_AutoCollapse( bool ); | 27 | void SLOT_AutoCollapse( bool ); |
28 | void SLOT_SelectNode( QListViewItem * it ); | 28 | void SLOT_SelectNode( QListViewItem * it ); |
29 | void SLOT_AlterTab( const QString & S ); | 29 | void SLOT_AlterTab( const QString & S ); |
30 | virtual void accept( void ); | 30 | virtual void accept( void ); |
31 | 31 | ||
32 | private : | 32 | private : |
33 | 33 | ||
34 | NodeCollection * getTmpCollection( void ); | 34 | NetworkSetup * getTmpCollection( void ); |
35 | void updateGUI( QListViewItem * it, ANetNode * NN ); | 35 | void updateGUI( QListViewItem * it, ANetNode * NN ); |
36 | void buildFullTree( void ); | 36 | void buildFullTree( void ); |
37 | void buildSubTree( QListViewItem * Parent, ANetNode * NN ); | 37 | void buildSubTree( QListViewItem * Parent, ANetNode * NN ); |
38 | void disableTree( QListViewItem * it, bool Mode); | 38 | void disableTree( QListViewItem * it, bool Mode); |
39 | void enablePath( QListViewItem * it, bool pha); | 39 | void enablePath( QListViewItem * it, bool pha); |
40 | 40 | ||
41 | bool haveCompleteConfig( QListViewItem * it ); | 41 | bool haveCompleteConfig( QListViewItem * it ); |
42 | QPtrDict<ANetNode> * Mapping; | 42 | QPtrDict<ANetNode> * Mapping; |
43 | NodeCollection * SelectedNodes; | 43 | NetworkSetup * SelectedNodes; |
44 | bool TmpIsValid; | 44 | bool TmpIsValid; |
45 | NodeCollection TmpCollection; | 45 | NetworkSetup TmpCollection; |
46 | 46 | ||
47 | static bool AutoCollapse; | 47 | static bool AutoCollapse; |
48 | 48 | ||
49 | }; | 49 | }; |
diff --git a/noncore/settings/networksettings2/editconnectionGUI.ui b/noncore/settings/networksettings2/editconnectionGUI.ui index dfb2596..5e50490 100644 --- a/noncore/settings/networksettings2/editconnectionGUI.ui +++ b/noncore/settings/networksettings2/editconnectionGUI.ui | |||
@@ -1,15 +1,15 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>EditConnectionGUI</class> | 2 | <class>EditNetworkSetupGUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>EditConnectionGUI</cstring> | 7 | <cstring>EditNetworkSetupGUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>427</width> | 14 | <width>427</width> |
15 | <height>523</height> | 15 | <height>523</height> |
@@ -112,17 +112,17 @@ | |||
112 | <enum>MShape</enum> | 112 | <enum>MShape</enum> |
113 | </property> | 113 | </property> |
114 | <property stdset="1"> | 114 | <property stdset="1"> |
115 | <name>frameShadow</name> | 115 | <name>frameShadow</name> |
116 | <enum>MShadow</enum> | 116 | <enum>MShadow</enum> |
117 | </property> | 117 | </property> |
118 | <property stdset="1"> | 118 | <property stdset="1"> |
119 | <name>text</name> | 119 | <name>text</name> |
120 | <string>Connection profile</string> | 120 | <string>NetworkSetup profile</string> |
121 | </property> | 121 | </property> |
122 | <property stdset="1"> | 122 | <property stdset="1"> |
123 | <name>alignment</name> | 123 | <name>alignment</name> |
124 | <set>AlignVCenter|AlignLeft</set> | 124 | <set>AlignVCenter|AlignLeft</set> |
125 | </property> | 125 | </property> |
126 | <property> | 126 | <property> |
127 | <name>vAlign</name> | 127 | <name>vAlign</name> |
128 | </property> | 128 | </property> |
@@ -373,34 +373,34 @@ | |||
373 | <name>image0</name> | 373 | <name>image0</name> |
374 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> | 374 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> |
375 | </image> | 375 | </image> |
376 | </images> | 376 | </images> |
377 | <connections> | 377 | <connections> |
378 | <connection> | 378 | <connection> |
379 | <sender>Nodes_LV</sender> | 379 | <sender>Nodes_LV</sender> |
380 | <signal>clicked(QListViewItem*)</signal> | 380 | <signal>clicked(QListViewItem*)</signal> |
381 | <receiver>EditConnectionGUI</receiver> | 381 | <receiver>EditNetworkSetupGUI</receiver> |
382 | <slot>SLOT_SelectNode( QListViewItem *)</slot> | 382 | <slot>SLOT_SelectNode( QListViewItem *)</slot> |
383 | </connection> | 383 | </connection> |
384 | <connection> | 384 | <connection> |
385 | <sender>AutoCollapse_CB</sender> | 385 | <sender>AutoCollapse_CB</sender> |
386 | <signal>toggled(bool)</signal> | 386 | <signal>toggled(bool)</signal> |
387 | <receiver>EditConnectionGUI</receiver> | 387 | <receiver>EditNetworkSetupGUI</receiver> |
388 | <slot>SLOT_AutoCollapse( bool)</slot> | 388 | <slot>SLOT_AutoCollapse( bool)</slot> |
389 | </connection> | 389 | </connection> |
390 | <connection> | 390 | <connection> |
391 | <sender>Devices_CB</sender> | 391 | <sender>Devices_CB</sender> |
392 | <signal>activated(int)</signal> | 392 | <signal>activated(int)</signal> |
393 | <receiver>Setup_WS</receiver> | 393 | <receiver>Setup_WS</receiver> |
394 | <slot>raiseWidget( int )</slot> | 394 | <slot>raiseWidget( int )</slot> |
395 | </connection> | 395 | </connection> |
396 | <connection> | 396 | <connection> |
397 | <sender>Tab_TB</sender> | 397 | <sender>Tab_TB</sender> |
398 | <signal>selected(const QString&)</signal> | 398 | <signal>selected(const QString&)</signal> |
399 | <receiver>EditConnectionGUI</receiver> | 399 | <receiver>EditNetworkSetupGUI</receiver> |
400 | <slot>SLOT_AlterTab( const QString & )</slot> | 400 | <slot>SLOT_AlterTab( const QString & )</slot> |
401 | </connection> | 401 | </connection> |
402 | <slot access="public">SLOT_AlterTab( const QString & )</slot> | 402 | <slot access="public">SLOT_AlterTab( const QString & )</slot> |
403 | <slot access="public">SLOT_AutoCollapse( bool)</slot> | 403 | <slot access="public">SLOT_AutoCollapse( bool)</slot> |
404 | <slot access="public">SLOT_SelectNode( QListViewItem *)</slot> | 404 | <slot access="public">SLOT_SelectNode( QListViewItem *)</slot> |
405 | </connections> | 405 | </connections> |
406 | </UI> | 406 | </UI> |
diff --git a/noncore/settings/networksettings2/gprs/GPRS_NN.cpp b/noncore/settings/networksettings2/gprs/GPRS_NN.cpp index e9553a6..374cf5a 100644 --- a/noncore/settings/networksettings2/gprs/GPRS_NN.cpp +++ b/noncore/settings/networksettings2/gprs/GPRS_NN.cpp | |||
@@ -7,17 +7,17 @@ | |||
7 | #include "netnodeinterface.h" | 7 | #include "netnodeinterface.h" |
8 | 8 | ||
9 | static const char * GPRSNeeds[] = | 9 | static const char * GPRSNeeds[] = |
10 | { "GPRS", | 10 | { "GPRS", |
11 | 0 | 11 | 0 |
12 | }; | 12 | }; |
13 | 13 | ||
14 | static const char * GPRSProvides[] = | 14 | static const char * GPRSProvides[] = |
15 | { "connection", | 15 | { "NetworkSetup", |
16 | 0 | 16 | 0 |
17 | }; | 17 | }; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Constructor, find all of the possible interfaces | 20 | * Constructor, find all of the possible interfaces |
21 | */ | 21 | */ |
22 | GPRSNetNode::GPRSNetNode() : ANetNode(tr("GPRS capable device")) { | 22 | GPRSNetNode::GPRSNetNode() : ANetNode(tr("GPRS capable device")) { |
23 | NSResources->addSystemFile( | 23 | NSResources->addSystemFile( |
diff --git a/noncore/settings/networksettings2/gprs/GPRS_NNI.cpp b/noncore/settings/networksettings2/gprs/GPRS_NNI.cpp index 2f61cba..bf8cc59 100644 --- a/noncore/settings/networksettings2/gprs/GPRS_NNI.cpp +++ b/noncore/settings/networksettings2/gprs/GPRS_NNI.cpp | |||
@@ -117,43 +117,43 @@ short AGPRSDevice::generateFile( SystemFile & SF, | |||
117 | SF << "TIMEOUT 10" << oendl; | 117 | SF << "TIMEOUT 10" << oendl; |
118 | SF << "CONNECT \"\"" << oendl; | 118 | SF << "CONNECT \"\"" << oendl; |
119 | SF << "SAY \"READY\\n\"" << oendl; | 119 | SF << "SAY \"READY\\n\"" << oendl; |
120 | return 0; | 120 | return 0; |
121 | } else if( SF.name() == "peers" ) { | 121 | } else if( SF.name() == "peers" ) { |
122 | SF << "noauth" << oendl; | 122 | SF << "noauth" << oendl; |
123 | SF << "user " << Data.User << oendl; | 123 | SF << "user " << Data.User << oendl; |
124 | SF << "connect \"/usr/sbin/chat -s -v -f /etc/chatscripts/" | 124 | SF << "connect \"/usr/sbin/chat -s -v -f /etc/chatscripts/" |
125 | << removeSpaces( connection()->name() ) | 125 | << removeSpaces( networkSetup()->name() ) |
126 | << "\"" | 126 | << "\"" |
127 | << oendl; | 127 | << oendl; |
128 | SF << "ipcp-accept-local" << oendl; | 128 | SF << "ipcp-accept-local" << oendl; |
129 | SF << "ipcp-accept-remote" << oendl; | 129 | SF << "ipcp-accept-remote" << oendl; |
130 | if( Data.DefaultGateway ) { | 130 | if( Data.DefaultGateway ) { |
131 | SF << "defaultroute" << oendl; | 131 | SF << "defaultroute" << oendl; |
132 | if( Data.SetIfSet ) { | 132 | if( Data.SetIfSet ) { |
133 | SF << "replacedefaultroute" << oendl; | 133 | SF << "replacedefaultroute" << oendl; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | if( Data.Debug ) { | 136 | if( Data.Debug ) { |
137 | SF << "logfile /tmp/" | 137 | SF << "logfile /tmp/" |
138 | << removeSpaces( connection()->name() ) | 138 | << removeSpaces( networkSetup()->name() ) |
139 | << oendl; | 139 | << oendl; |
140 | for( int i = 0; i < Data.Debug; i ++ ) { | 140 | for( int i = 0; i < Data.Debug; i ++ ) { |
141 | SF << "debug" << oendl; | 141 | SF << "debug" << oendl; |
142 | } | 142 | } |
143 | } | 143 | } |
144 | SF << "nocrtscts" << oendl; | 144 | SF << "nocrtscts" << oendl; |
145 | SF << "local" << oendl; | 145 | SF << "local" << oendl; |
146 | SF << "lcp-echo-interval 0" << oendl; | 146 | SF << "lcp-echo-interval 0" << oendl; |
147 | SF << "lcp-echo-failure 0" << oendl; | 147 | SF << "lcp-echo-failure 0" << oendl; |
148 | SF << "usepeerdns" << oendl; | 148 | SF << "usepeerdns" << oendl; |
149 | SF << "linkname " << removeSpaces( connection()->name() ) << oendl; | 149 | SF << "linkname " << removeSpaces( networkSetup()->name() ) << oendl; |
150 | SF << "nopersist" << oendl; | 150 | SF << "nopersist" << oendl; |
151 | SF << "ipparam " << removeSpaces( connection()->name() ) <<oendl; | 151 | SF << "ipparam " << removeSpaces( networkSetup()->name() ) <<oendl; |
152 | SF << "maxfail 1" << oendl; | 152 | SF << "maxfail 1" << oendl; |
153 | return 0; | 153 | return 0; |
154 | } else if( SF.name() == "extra" ) { | 154 | } else if( SF.name() == "extra" ) { |
155 | unsigned long Bits; | 155 | unsigned long Bits; |
156 | // generate 'fixed' settings | 156 | // generate 'fixed' settings |
157 | for( unsigned int i = 0 ; | 157 | for( unsigned int i = 0 ; |
158 | i < Data.Routing.count(); | 158 | i < Data.Routing.count(); |
159 | i ++ ) { | 159 | i ++ ) { |
@@ -187,45 +187,45 @@ short AGPRSDevice::generateFile( SystemFile & SF, | |||
187 | << " gw $PPP_REMOTE" | 187 | << " gw $PPP_REMOTE" |
188 | << oendl; | 188 | << oendl; |
189 | } | 189 | } |
190 | 190 | ||
191 | if( ! Data.DNS1.isEmpty() ) { | 191 | if( ! Data.DNS1.isEmpty() ) { |
192 | SF << "nameserver " | 192 | SF << "nameserver " |
193 | << Data.DNS1 | 193 | << Data.DNS1 |
194 | << " # profile " | 194 | << " # profile " |
195 | << removeSpaces( connection()->name() ) | 195 | << removeSpaces( networkSetup()->name() ) |
196 | <<oendl; | 196 | <<oendl; |
197 | } | 197 | } |
198 | 198 | ||
199 | if( ! Data.DNS2.isEmpty() ) { | 199 | if( ! Data.DNS2.isEmpty() ) { |
200 | SF << "nameserver " | 200 | SF << "nameserver " |
201 | << Data.DNS2 | 201 | << Data.DNS2 |
202 | << " # profile " | 202 | << " # profile " |
203 | << removeSpaces( connection()->name() ) | 203 | << removeSpaces( networkSetup()->name() ) |
204 | <<oendl; | 204 | <<oendl; |
205 | } | 205 | } |
206 | } | 206 | } |
207 | return 1; | 207 | return 1; |
208 | } | 208 | } |
209 | 209 | ||
210 | bool AGPRSDevice::openFile( SystemFile & SF ) { | 210 | bool AGPRSDevice::openFile( SystemFile & SF ) { |
211 | if( SF.name() == "peers" ) { | 211 | if( SF.name() == "peers" ) { |
212 | SF.setPath( | 212 | SF.setPath( |
213 | QString( "/etc/ppp/peers/" ) + | 213 | QString( "/etc/ppp/peers/" ) + |
214 | removeSpaces( connection()->name() ) | 214 | removeSpaces( networkSetup()->name() ) |
215 | ); | 215 | ); |
216 | return 1; | 216 | return 1; |
217 | } else if ( SF.name() == "chatscripts" ) { | 217 | } else if ( SF.name() == "chatscripts" ) { |
218 | SF.setPath( | 218 | SF.setPath( |
219 | QString( "/etc/chatscripts/" ) + | 219 | QString( "/etc/chatscripts/" ) + |
220 | removeSpaces( connection()->name() ) | 220 | removeSpaces( networkSetup()->name() ) |
221 | ); | 221 | ); |
222 | return 1; | 222 | return 1; |
223 | } else if ( SF.name() == "extra" ) { | 223 | } else if ( SF.name() == "extra" ) { |
224 | SF.setPath( | 224 | SF.setPath( |
225 | QString( "/etc/ppp/" ) + | 225 | QString( "/etc/ppp/" ) + |
226 | removeSpaces( connection()->name() ) + ".fixed" | 226 | removeSpaces( networkSetup()->name() ) + ".fixed" |
227 | ); | 227 | ); |
228 | return 1; | 228 | return 1; |
229 | } | 229 | } |
230 | return 0; | 230 | return 0; |
231 | } | 231 | } |
diff --git a/noncore/settings/networksettings2/gprs/GPRSrun.cpp b/noncore/settings/networksettings2/gprs/GPRSrun.cpp index cccc71a..fd61f3a 100644 --- a/noncore/settings/networksettings2/gprs/GPRSrun.cpp +++ b/noncore/settings/networksettings2/gprs/GPRSrun.cpp | |||
@@ -6,17 +6,17 @@ | |||
6 | #include <resources.h> | 6 | #include <resources.h> |
7 | #include <netnode.h> | 7 | #include <netnode.h> |
8 | #include "GPRSrun.h" | 8 | #include "GPRSrun.h" |
9 | 9 | ||
10 | State_t GPRSRun::detectState( void ) { | 10 | State_t GPRSRun::detectState( void ) { |
11 | 11 | ||
12 | // is pppd still running ? | 12 | // is pppd still running ? |
13 | // is rfcomm still active | 13 | // is rfcomm still active |
14 | NodeCollection * NC = nodeCollection(); | 14 | NetworkSetup * NC = networkSetup(); |
15 | InterfaceInfo * I = NC->assignedInterface(); | 15 | InterfaceInfo * I = NC->assignedInterface(); |
16 | 16 | ||
17 | QDir D("/var/run"); | 17 | QDir D("/var/run"); |
18 | 18 | ||
19 | if( I ) { | 19 | if( I ) { |
20 | // has some pppx attached | 20 | // has some pppx attached |
21 | return ( I->IsUp ) ? IsUp : Available; | 21 | return ( I->IsUp ) ? IsUp : Available; |
22 | } | 22 | } |
@@ -57,17 +57,17 @@ State_t GPRSRun::detectState( void ) { | |||
57 | PPPPid = 0; | 57 | PPPPid = 0; |
58 | } | 58 | } |
59 | } // else pppd is down | 59 | } // else pppd is down |
60 | } | 60 | } |
61 | NC->assignInterface( 0 ); | 61 | NC->assignInterface( 0 ); |
62 | return Unknown; | 62 | return Unknown; |
63 | } | 63 | } |
64 | 64 | ||
65 | QString GPRSRun::setMyState( NodeCollection * NC, Action_t A , bool ) { | 65 | QString GPRSRun::setMyState( NetworkSetup * NC, Action_t A , bool ) { |
66 | 66 | ||
67 | if( A == Up ) { | 67 | if( A == Up ) { |
68 | // start ppp on deviceFile | 68 | // start ppp on deviceFile |
69 | QStringList SL; | 69 | QStringList SL; |
70 | SL << "pon" | 70 | SL << "pon" |
71 | << removeSpaces( NC->name() ) | 71 | << removeSpaces( NC->name() ) |
72 | << NC->device()->deviceFile(); | 72 | << NC->device()->deviceFile(); |
73 | 73 | ||
diff --git a/noncore/settings/networksettings2/gprs/GPRSrun.h b/noncore/settings/networksettings2/gprs/GPRSrun.h index 817f8a9..c3c2015 100644 --- a/noncore/settings/networksettings2/gprs/GPRSrun.h +++ b/noncore/settings/networksettings2/gprs/GPRSrun.h | |||
@@ -19,16 +19,16 @@ public : | |||
19 | { return this; } | 19 | { return this; } |
20 | virtual RuntimeInfo * connection( void ) | 20 | virtual RuntimeInfo * connection( void ) |
21 | { return this; } | 21 | { return this; } |
22 | 22 | ||
23 | State_t detectState( void ); | 23 | State_t detectState( void ); |
24 | 24 | ||
25 | protected : | 25 | protected : |
26 | 26 | ||
27 | QString setMyState( NodeCollection * , Action_t, bool ); | 27 | QString setMyState( NetworkSetup * , Action_t, bool ); |
28 | 28 | ||
29 | private : | 29 | private : |
30 | 30 | ||
31 | QRegExp Pat; | 31 | QRegExp Pat; |
32 | size_t PPPPid; | 32 | size_t PPPPid; |
33 | 33 | ||
34 | }; | 34 | }; |
diff --git a/noncore/settings/networksettings2/irda/irdarun.h b/noncore/settings/networksettings2/irda/irdarun.h index d3b714b..e5ba79a 100644 --- a/noncore/settings/networksettings2/irda/irdarun.h +++ b/noncore/settings/networksettings2/irda/irdarun.h | |||
@@ -15,11 +15,11 @@ public : | |||
15 | virtual QString deviceFile( void ) | 15 | virtual QString deviceFile( void ) |
16 | { return QString( "/dev/irda" ); } | 16 | { return QString( "/dev/irda" ); } |
17 | 17 | ||
18 | State_t detectState( void ) | 18 | State_t detectState( void ) |
19 | { return Unknown; } | 19 | { return Unknown; } |
20 | 20 | ||
21 | protected : | 21 | protected : |
22 | 22 | ||
23 | QString setMyState( NodeCollection * , Action_t, bool ) | 23 | QString setMyState( NetworkSetup * , Action_t, bool ) |
24 | { return QString(); } | 24 | { return QString(); } |
25 | }; | 25 | }; |
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.cpp b/noncore/settings/networksettings2/lancard/lancardrun.cpp index 8157dce..8a71aa9 100644 --- a/noncore/settings/networksettings2/lancard/lancardrun.cpp +++ b/noncore/settings/networksettings2/lancard/lancardrun.cpp | |||
@@ -5,17 +5,17 @@ | |||
5 | #include "lancardrun.h" | 5 | #include "lancardrun.h" |
6 | 6 | ||
7 | State_t LanCardRun::detectState( void ) { | 7 | State_t LanCardRun::detectState( void ) { |
8 | 8 | ||
9 | // unavailable : no card found | 9 | // unavailable : no card found |
10 | // available : card found and assigned to us or free | 10 | // available : card found and assigned to us or free |
11 | // up : card found and assigned to us and up | 11 | // up : card found and assigned to us and up |
12 | 12 | ||
13 | NodeCollection * NC = nodeCollection(); | 13 | NetworkSetup * NC = networkSetup(); |
14 | QString S = QString( "/tmp/profile-%1.up" ). | 14 | QString S = QString( "/tmp/profile-%1.up" ). |
15 | arg( NC->number()); | 15 | arg( NC->number()); |
16 | System & Sys = NSResources->system(); | 16 | System & Sys = NSResources->system(); |
17 | InterfaceInfo * Run; | 17 | InterfaceInfo * Run; |
18 | 18 | ||
19 | QFile F( S ); | 19 | QFile F( S ); |
20 | 20 | ||
21 | if( F.open( IO_ReadOnly ) ) { | 21 | if( F.open( IO_ReadOnly ) ) { |
@@ -65,17 +65,17 @@ State_t LanCardRun::detectState( void ) { | |||
65 | return Off; | 65 | return Off; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | // no free found | 68 | // no free found |
69 | 69 | ||
70 | return Unavailable; | 70 | return Unavailable; |
71 | } | 71 | } |
72 | 72 | ||
73 | QString LanCardRun::setMyState( NodeCollection * NC, Action_t A, bool ) { | 73 | QString LanCardRun::setMyState( NetworkSetup * NC, Action_t A, bool ) { |
74 | 74 | ||
75 | if( A == Activate ) { | 75 | if( A == Activate ) { |
76 | InterfaceInfo * N = getInterface(); | 76 | InterfaceInfo * N = getInterface(); |
77 | 77 | ||
78 | if( ! N ) { | 78 | if( ! N ) { |
79 | // no interface available | 79 | // no interface available |
80 | NC->setCurrentState( Unavailable ); | 80 | NC->setCurrentState( Unavailable ); |
81 | return tr("No interface found"); | 81 | return tr("No interface found"); |
@@ -109,20 +109,20 @@ InterfaceInfo * LanCardRun::getInterface( void ) { | |||
109 | if( handlesInterface( *Run ) && | 109 | if( handlesInterface( *Run ) && |
110 | ( Run->CardType == ARPHRD_ETHER | 110 | ( Run->CardType == ARPHRD_ETHER |
111 | #ifdef ARPHRD_IEEE1394 | 111 | #ifdef ARPHRD_IEEE1394 |
112 | || Run->CardType == ARPHRD_IEEE1394 | 112 | || Run->CardType == ARPHRD_IEEE1394 |
113 | #endif | 113 | #endif |
114 | ) | 114 | ) |
115 | ) { | 115 | ) { |
116 | // this is a LAN card | 116 | // this is a LAN card |
117 | if( Run->assignedConnection() == netNode()->connection() ) { | 117 | if( Run->assignedToNetworkSetup() == netNode()->networkSetup() ) { |
118 | // assigned to us | 118 | // assigned to us |
119 | return Run; | 119 | return Run; |
120 | } else if( Run->assignedConnection() == 0 ) { | 120 | } else if( Run->assignedToNetworkSetup() == 0 ) { |
121 | // free | 121 | // free |
122 | best = Run; | 122 | best = Run; |
123 | } | 123 | } |
124 | } | 124 | } |
125 | } | 125 | } |
126 | return best; // can be 0 | 126 | return best; // can be 0 |
127 | } | 127 | } |
128 | 128 | ||
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.h b/noncore/settings/networksettings2/lancard/lancardrun.h index 57ef3fb..dfd3d62 100644 --- a/noncore/settings/networksettings2/lancard/lancardrun.h +++ b/noncore/settings/networksettings2/lancard/lancardrun.h | |||
@@ -20,17 +20,17 @@ public : | |||
20 | 20 | ||
21 | bool handlesInterface( const QString & I ); | 21 | bool handlesInterface( const QString & I ); |
22 | bool handlesInterface( const InterfaceInfo & II ); | 22 | bool handlesInterface( const InterfaceInfo & II ); |
23 | 23 | ||
24 | State_t detectState( void ); | 24 | State_t detectState( void ); |
25 | 25 | ||
26 | protected : | 26 | protected : |
27 | 27 | ||
28 | QString setMyState( NodeCollection * , Action_t, bool ); | 28 | QString setMyState( NetworkSetup * , Action_t, bool ); |
29 | 29 | ||
30 | private : | 30 | private : |
31 | 31 | ||
32 | InterfaceInfo * getInterface( void ); | 32 | InterfaceInfo * getInterface( void ); |
33 | QRegExp Pat; | 33 | QRegExp Pat; |
34 | LanCardData * Data; | 34 | LanCardData * Data; |
35 | 35 | ||
36 | }; | 36 | }; |
diff --git a/noncore/settings/networksettings2/modem/modemrun.h b/noncore/settings/networksettings2/modem/modemrun.h index eb3a193..df6b370 100644 --- a/noncore/settings/networksettings2/modem/modemrun.h +++ b/noncore/settings/networksettings2/modem/modemrun.h | |||
@@ -15,11 +15,11 @@ public : | |||
15 | virtual QString deviceFile( void ) | 15 | virtual QString deviceFile( void ) |
16 | { return QString("/dev/modem"); } | 16 | { return QString("/dev/modem"); } |
17 | 17 | ||
18 | State_t detectState( void ) | 18 | State_t detectState( void ) |
19 | { return Unknown;} | 19 | { return Unknown;} |
20 | 20 | ||
21 | protected : | 21 | protected : |
22 | 22 | ||
23 | QString setMyState( NodeCollection * , Action_t, bool ) | 23 | QString setMyState( NetworkSetup * , Action_t, bool ) |
24 | { return QString(); } | 24 | { return QString(); } |
25 | }; | 25 | }; |
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp index 2fa31bd..80a7fac 100644 --- a/noncore/settings/networksettings2/network/network_NN.cpp +++ b/noncore/settings/networksettings2/network/network_NN.cpp | |||
@@ -7,17 +7,17 @@ | |||
7 | #include "netnodeinterface.h" | 7 | #include "netnodeinterface.h" |
8 | 8 | ||
9 | static const char * NetworkNeeds[] = | 9 | static const char * NetworkNeeds[] = |
10 | { "device", | 10 | { "device", |
11 | 0 | 11 | 0 |
12 | }; | 12 | }; |
13 | 13 | ||
14 | static const char * NetworkProvides[] = | 14 | static const char * NetworkProvides[] = |
15 | { "connection", | 15 | { "NetworkSetup", |
16 | 0 | 16 | 0 |
17 | }; | 17 | }; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Constructor, find all of the possible interfaces | 20 | * Constructor, find all of the possible interfaces |
21 | */ | 21 | */ |
22 | NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { | 22 | NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { |
23 | 23 | ||
diff --git a/noncore/settings/networksettings2/network/network_NNI.cpp b/noncore/settings/networksettings2/network/network_NNI.cpp index 34dac54..c183d5e 100644 --- a/noncore/settings/networksettings2/network/network_NNI.cpp +++ b/noncore/settings/networksettings2/network/network_NNI.cpp | |||
@@ -112,51 +112,51 @@ short ANetwork::generateFile( SystemFile &SF, | |||
112 | 112 | ||
113 | rvl = 1; | 113 | rvl = 1; |
114 | if( SF.name() == "interfaces" ) { | 114 | if( SF.name() == "interfaces" ) { |
115 | Log(("Generate Network for %s\n", SF.name().latin1() )); | 115 | Log(("Generate Network for %s\n", SF.name().latin1() )); |
116 | // we can safely call from here since device item is deeper | 116 | // we can safely call from here since device item is deeper |
117 | if( Data.UseDHCP ) { | 117 | if( Data.UseDHCP ) { |
118 | SF << "iface " | 118 | SF << "iface " |
119 | << "A" | 119 | << "A" |
120 | << connection()->number() | 120 | << networkSetup()->number() |
121 | << NIC | 121 | << NIC |
122 | << " inet dhcp" | 122 | << " inet dhcp" |
123 | << endl; | 123 | << endl; |
124 | SF << " up echo \"" | 124 | SF << " up echo \"" |
125 | << NIC | 125 | << NIC |
126 | << "\" > /tmp/profile-" | 126 | << "\" > /tmp/profile-" |
127 | << connection()->number() | 127 | << networkSetup()->number() |
128 | << ".up" | 128 | << ".up" |
129 | << endl; | 129 | << endl; |
130 | if( Data.SendHostname ) { | 130 | if( Data.SendHostname ) { |
131 | SF << " hostname " | 131 | SF << " hostname " |
132 | << Data.Hostname | 132 | << Data.Hostname |
133 | << endl; | 133 | << endl; |
134 | } | 134 | } |
135 | 135 | ||
136 | SF << " down rm -f /tmp/profile-" | 136 | SF << " down rm -f /tmp/profile-" |
137 | << connection()->number() | 137 | << networkSetup()->number() |
138 | << ".up" | 138 | << ".up" |
139 | << endl; | 139 | << endl; |
140 | } else { | 140 | } else { |
141 | SF << "iface " | 141 | SF << "iface " |
142 | << "A" | 142 | << "A" |
143 | << connection()->number() | 143 | << networkSetup()->number() |
144 | << NIC | 144 | << NIC |
145 | << " inet static" | 145 | << " inet static" |
146 | << endl; | 146 | << endl; |
147 | SF << " up echo \"" | 147 | SF << " up echo \"" |
148 | << NIC | 148 | << NIC |
149 | << "\" > /tmp/profile-" | 149 | << "\" > /tmp/profile-" |
150 | << connection()->number() | 150 | << networkSetup()->number() |
151 | << ".up" | 151 | << ".up" |
152 | << endl; | 152 | << endl; |
153 | SF << " down rm -f /tmp/profile-" | 153 | SF << " down rm -f /tmp/profile-" |
154 | << connection()->number() | 154 | << networkSetup()->number() |
155 | << ".up" | 155 | << ".up" |
156 | << endl; | 156 | << endl; |
157 | SF << " address " | 157 | SF << " address " |
158 | << Data.IPAddress | 158 | << Data.IPAddress |
159 | << endl; | 159 | << endl; |
160 | SF << " broadcast " | 160 | SF << " broadcast " |
161 | << Data.Broadcast | 161 | << Data.Broadcast |
162 | << endl; | 162 | << endl; |
@@ -206,13 +206,13 @@ short ANetwork::generateFile( SystemFile &SF, | |||
206 | SF << " post-down " | 206 | SF << " post-down " |
207 | << (*it) | 207 | << (*it) |
208 | << endl; | 208 | << endl; |
209 | } | 209 | } |
210 | rvl = 0; | 210 | rvl = 0; |
211 | } | 211 | } |
212 | 212 | ||
213 | // embed other info in it | 213 | // embed other info in it |
214 | rvd = connection()->getToplevel()->generateFileEmbedded( SF, DevNr ); | 214 | rvd = networkSetup()->getToplevel()->generateFileEmbedded( SF, DevNr ); |
215 | 215 | ||
216 | return (rvd == 2 || rvl == 2 ) ? 2 : | 216 | return (rvd == 2 || rvl == 2 ) ? 2 : |
217 | (rvd == 0 || rvl == 0 ) ? 0 : 1; | 217 | (rvd == 0 || rvl == 0 ) ? 0 : 1; |
218 | } | 218 | } |
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp index 74467ad..7039a36 100644 --- a/noncore/settings/networksettings2/network/networkrun.cpp +++ b/noncore/settings/networksettings2/network/networkrun.cpp | |||
@@ -1,29 +1,28 @@ | |||
1 | #include <system.h> | 1 | #include <system.h> |
2 | #include <netnode.h> | 2 | #include <netnode.h> |
3 | #include <resources.h> | 3 | #include <resources.h> |
4 | #include "networkrun.h" | 4 | #include "networkrun.h" |
5 | 5 | ||
6 | State_t NetworkRun::detectState( void ) { | 6 | State_t NetworkRun::detectState( void ) { |
7 | InterfaceInfo * II = nodeCollection()->assignedInterface(); | 7 | InterfaceInfo * II = networkSetup()->assignedInterface(); |
8 | 8 | ||
9 | Log(( "Interface %p %p : %d\n", II, nodeCollection(), (II) ? II->IsUp : 0 )); | ||
10 | if( II && II->IsUp ) { | 9 | if( II && II->IsUp ) { |
11 | // device has assigned interface | 10 | // device has assigned interface |
12 | return IsUp; | 11 | return IsUp; |
13 | } | 12 | } |
14 | 13 | ||
15 | // had no interface or interface is no longer up -> release | 14 | // had no interface or interface is no longer up -> release |
16 | nodeCollection()->assignInterface( 0 ); | 15 | networkSetup()->assignInterface( 0 ); |
17 | 16 | ||
18 | return Unknown; | 17 | return Unknown; |
19 | } | 18 | } |
20 | 19 | ||
21 | QString NetworkRun::setMyState( NodeCollection * NC, Action_t A, bool ) { | 20 | QString NetworkRun::setMyState( NetworkSetup * NC, Action_t A, bool ) { |
22 | // we handle UP and DOWN | 21 | // we handle UP and DOWN |
23 | InterfaceInfo * II = NC->assignedInterface(); | 22 | InterfaceInfo * II = NC->assignedInterface(); |
24 | 23 | ||
25 | if( ! II ) { | 24 | if( ! II ) { |
26 | Log(( "no interface assigned." )); | 25 | Log(( "no interface assigned." )); |
27 | return QString(); | 26 | return QString(); |
28 | } | 27 | } |
29 | 28 | ||
@@ -35,17 +34,17 @@ QString NetworkRun::setMyState( NodeCollection * NC, Action_t A, bool ) { | |||
35 | } else if( A == Down ) { | 34 | } else if( A == Down ) { |
36 | SL << "ifdown"; | 35 | SL << "ifdown"; |
37 | } else { | 36 | } else { |
38 | return QString(); | 37 | return QString(); |
39 | } | 38 | } |
40 | 39 | ||
41 | SL << QString().sprintf( "%s=A%ld%s", | 40 | SL << QString().sprintf( "%s=A%ld%s", |
42 | II->Name.latin1(), | 41 | II->Name.latin1(), |
43 | nodeCollection()->number(), | 42 | networkSetup()->number(), |
44 | II->Name.latin1() ); | 43 | II->Name.latin1() ); |
45 | 44 | ||
46 | if( ! NSResources->system().runAsRoot( SL ) ) { | 45 | if( ! NSResources->system().runAsRoot( SL ) ) { |
47 | return QString("Cannot call %1").arg(SL.join(" ")); | 46 | return QString("Cannot call %1").arg(SL.join(" ")); |
48 | } | 47 | } |
49 | 48 | ||
50 | return QString(); | 49 | return QString(); |
51 | } | 50 | } |
diff --git a/noncore/settings/networksettings2/network/networkrun.h b/noncore/settings/networksettings2/network/networkrun.h index 78a1694..ac186e7 100644 --- a/noncore/settings/networksettings2/network/networkrun.h +++ b/noncore/settings/networksettings2/network/networkrun.h | |||
@@ -11,10 +11,10 @@ public : | |||
11 | 11 | ||
12 | virtual RuntimeInfo * connection( void ) | 12 | virtual RuntimeInfo * connection( void ) |
13 | { return this; } | 13 | { return this; } |
14 | 14 | ||
15 | State_t detectState( void ); | 15 | State_t detectState( void ); |
16 | 16 | ||
17 | protected : | 17 | protected : |
18 | 18 | ||
19 | QString setMyState( NodeCollection * , Action_t, bool ); | 19 | QString setMyState( NetworkSetup * , Action_t, bool ); |
20 | }; | 20 | }; |
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp index 78b6cce..80dcb3d 100644 --- a/noncore/settings/networksettings2/networksettings.cpp +++ b/noncore/settings/networksettings2/networksettings.cpp | |||
@@ -59,34 +59,34 @@ NetworkSettings::NetworkSettings( QWidget *parent, | |||
59 | Profiles_LB->clear(); | 59 | Profiles_LB->clear(); |
60 | QPEApplication::setStylusOperation( | 60 | QPEApplication::setStylusOperation( |
61 | Profiles_LB->viewport(), QPEApplication::RightOnHold ); | 61 | Profiles_LB->viewport(), QPEApplication::RightOnHold ); |
62 | 62 | ||
63 | connect( Profiles_LB, | 63 | connect( Profiles_LB, |
64 | SIGNAL(rightButtonPressed(QListBoxItem*,const QPoint&)), | 64 | SIGNAL(rightButtonPressed(QListBoxItem*,const QPoint&)), |
65 | this, SLOT(SLOT_EditNode(QListBoxItem*)) ); | 65 | this, SLOT(SLOT_EditNode(QListBoxItem*)) ); |
66 | 66 | ||
67 | { Name2Connection_t & M = NSResources->connections(); | 67 | { Name2NetworkSetup_t & M = NSResources->networkSetups(); |
68 | NodeCollection * NC; | 68 | NetworkSetup * NC; |
69 | // for all connections | 69 | // for all NetworkSetups |
70 | for( QDictIterator<NodeCollection> it(M); | 70 | for( QDictIterator<NetworkSetup> it(M); |
71 | it.current(); | 71 | it.current(); |
72 | ++it ) { | 72 | ++it ) { |
73 | NC = it.current(); | 73 | NC = it.current(); |
74 | Profiles_LB->insertItem( NC->devicePixmap(), | 74 | Profiles_LB->insertItem( NC->devicePixmap(), |
75 | NC->name() ); | 75 | NC->name() ); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | if( Profiles_LB->count() ) { | 79 | if( Profiles_LB->count() ) { |
80 | Profiles_LB->setSelected( 0, TRUE ); | 80 | Profiles_LB->setSelected( 0, TRUE ); |
81 | } | 81 | } |
82 | 82 | ||
83 | // if no profiles -> auto popup editing | 83 | // if no profiles -> auto popup editing |
84 | if( NSResources->connections().count() == 0 ) { | 84 | if( NSResources->networkSetups().count() == 0 ) { |
85 | QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) ); | 85 | QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) ); |
86 | } | 86 | } |
87 | 87 | ||
88 | connect( &(NSResources->system()), | 88 | connect( &(NSResources->system()), |
89 | SIGNAL( stdoutLine(const QString &) ), | 89 | SIGNAL( stdoutLine(const QString &) ), |
90 | this, SLOT( SLOT_CmdMessage(const QString &) ) ); | 90 | this, SLOT( SLOT_CmdMessage(const QString &) ) ); |
91 | 91 | ||
92 | connect( &(NSResources->system()), | 92 | connect( &(NSResources->system()), |
@@ -131,36 +131,36 @@ void NetworkSettings::SLOT_CmdMessage( const QString & S ) { | |||
131 | Messages_LB->setCurrentItem( Messages_LB->count()-1 ); | 131 | Messages_LB->setCurrentItem( Messages_LB->count()-1 ); |
132 | Messages_LB->ensureCurrentVisible(); | 132 | Messages_LB->ensureCurrentVisible(); |
133 | } | 133 | } |
134 | 134 | ||
135 | void NetworkSettings::SLOT_RefreshStates( void ) { | 135 | void NetworkSettings::SLOT_RefreshStates( void ) { |
136 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember | 136 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember |
137 | 137 | ||
138 | if( LBI ) { | 138 | if( LBI ) { |
139 | NodeCollection * NC; | 139 | NetworkSetup * NC; |
140 | NSResources->system().probeInterfaces(); | 140 | NSResources->system().probeInterfaces(); |
141 | // update current selection only | 141 | // update current selection only |
142 | NC = NSResources->findConnection( LBI->text() ); | 142 | NC = NSResources->findNetworkSetup( LBI->text() ); |
143 | if( NC ) { | 143 | if( NC ) { |
144 | State_t OldS = NC->state(); | 144 | State_t OldS = NC->state(); |
145 | State_t NewS = NC->state(1); | 145 | State_t NewS = NC->state(1); |
146 | if( OldS != NewS ) { | 146 | if( OldS != NewS ) { |
147 | updateProfileState( LBI ); | 147 | updateProfileState( LBI ); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
152 | 152 | ||
153 | /* -> LATER !! | 153 | /* -> LATER !! |
154 | bool is; | 154 | bool is; |
155 | NodeCollection * NC; | 155 | NetworkSetup * NC; |
156 | 156 | ||
157 | for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) { | 157 | for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) { |
158 | NC = NSResources->findConnection( Profiles_LB->text(i) ); | 158 | NC = NSResources->findNetworkSetup( Profiles_LB->text(i) ); |
159 | if( NC ) { | 159 | if( NC ) { |
160 | State_t OldS = NC->state(); | 160 | State_t OldS = NC->state(); |
161 | State_t NewS = NC->state(1); | 161 | State_t NewS = NC->state(1); |
162 | if( OldS != NewS ) { | 162 | if( OldS != NewS ) { |
163 | is = Profiles_LB->isSelected(i); | 163 | is = Profiles_LB->isSelected(i); |
164 | Profiles_LB->changeItem( NC->statePixmap(NewS), | 164 | Profiles_LB->changeItem( NC->statePixmap(NewS), |
165 | NC->name(), | 165 | NC->name(), |
166 | i ); | 166 | i ); |
@@ -185,97 +185,97 @@ void NetworkSettings::SLOT_DeleteNode( void ) { | |||
185 | if ( ! LBI ) | 185 | if ( ! LBI ) |
186 | return; | 186 | return; |
187 | 187 | ||
188 | if( QMessageBox::warning( | 188 | if( QMessageBox::warning( |
189 | 0, | 189 | 0, |
190 | tr( "Removing profile" ), | 190 | tr( "Removing profile" ), |
191 | tr( "Remove selected profile ?" ), | 191 | tr( "Remove selected profile ?" ), |
192 | 1, 0 ) == 1 ) { | 192 | 1, 0 ) == 1 ) { |
193 | NSResources->removeConnection( LBI->text() ); | 193 | NSResources->removeNetworkSetup( LBI->text() ); |
194 | delete LBI; | 194 | delete LBI; |
195 | NSD.setModified( 1 ); | 195 | NSD.setModified( 1 ); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | 199 | void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { |
200 | QString OldName = ""; | 200 | QString OldName = ""; |
201 | 201 | ||
202 | EditConnection EC( this ); | 202 | EditNetworkSetup EC( this ); |
203 | 203 | ||
204 | if( LBI ) { | 204 | if( LBI ) { |
205 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 205 | NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); |
206 | if( ! NC ) { | 206 | if( ! NC ) { |
207 | return; | 207 | return; |
208 | } | 208 | } |
209 | OldName = NC->name(); | 209 | OldName = NC->name(); |
210 | EC.setConnection( NC ); | 210 | EC.setNetworkSetup( NC ); |
211 | } | 211 | } |
212 | 212 | ||
213 | EC.showMaximized(); | 213 | EC.showMaximized(); |
214 | // disable refresh timer | 214 | // disable refresh timer |
215 | UpdateTimer->stop(); | 215 | UpdateTimer->stop(); |
216 | 216 | ||
217 | // we need to retry | 217 | // we need to retry |
218 | while( 1 ) { | 218 | while( 1 ) { |
219 | if( EC.exec() == QDialog::Accepted ) { | 219 | if( EC.exec() == QDialog::Accepted ) { |
220 | // toplevel item -> store | 220 | // toplevel item -> store |
221 | NodeCollection * NC = EC.connection(); | 221 | NetworkSetup * NC = EC.networkSetup(); |
222 | if( NC->isModified() ) { | 222 | if( NC->isModified() ) { |
223 | if( LBI ) { | 223 | if( LBI ) { |
224 | if( NC->name() != OldName ) { | 224 | if( NC->name() != OldName ) { |
225 | // find if new name is free | 225 | // find if new name is free |
226 | NodeCollection * LCN = NSResources->findConnection( | 226 | NetworkSetup * LCN = NSResources->findNetworkSetup( |
227 | NC->name() ); | 227 | NC->name() ); |
228 | if( LCN ) { | 228 | if( LCN ) { |
229 | QMessageBox::warning( | 229 | QMessageBox::warning( |
230 | 0, | 230 | 0, |
231 | tr( "In System Config" ), | 231 | tr( "In System Config" ), |
232 | tr( "Name %1 already exists" ).arg(NC->name()) | 232 | tr( "Name %1 already exists" ).arg(NC->name()) |
233 | ); | 233 | ); |
234 | continue; // restart exec | 234 | continue; // restart exec |
235 | } // else new name | 235 | } // else new name |
236 | // new name -> remove item | 236 | // new name -> remove item |
237 | NSResources->removeConnection( OldName ); | 237 | NSResources->removeNetworkSetup( OldName ); |
238 | NSResources->addConnection( NC, 0 ); | 238 | NSResources->addNetworkSetup( NC, 0 ); |
239 | } // else not changed | 239 | } // else not changed |
240 | 240 | ||
241 | // must add it here since change will trigger event | 241 | // must add it here since change will trigger event |
242 | Profiles_LB->changeItem( NC->devicePixmap(), | 242 | Profiles_LB->changeItem( NC->devicePixmap(), |
243 | NC->name(), | 243 | NC->name(), |
244 | Profiles_LB->index( LBI ) | 244 | Profiles_LB->index( LBI ) |
245 | ); | 245 | ); |
246 | } else { | 246 | } else { |
247 | // new item | 247 | // new item |
248 | int ci = Profiles_LB->count(); | 248 | int ci = Profiles_LB->count(); |
249 | NSResources->addConnection( NC, 0 ); | 249 | NSResources->addNetworkSetup( NC, 0 ); |
250 | NC->setNumber( NSResources->assignConnectionNumber() ); | 250 | NC->setNumber( NSResources->assignNetworkSetupNumber() ); |
251 | Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); | 251 | Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); |
252 | Profiles_LB->setSelected( ci, TRUE ); | 252 | Profiles_LB->setSelected( ci, TRUE ); |
253 | } | 253 | } |
254 | updateProfileState( LBI ); | 254 | updateProfileState( LBI ); |
255 | } | 255 | } |
256 | } else { | 256 | } else { |
257 | // cancelled : reset connection | 257 | // cancelled : reset NetworkSetup |
258 | if( LBI ) { | 258 | if( LBI ) { |
259 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 259 | NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); |
260 | NC->reassign(); | 260 | NC->reassign(); |
261 | } | 261 | } |
262 | } | 262 | } |
263 | break; | 263 | break; |
264 | } | 264 | } |
265 | // reenable | 265 | // reenable |
266 | UpdateTimer->start( 5000 ); | 266 | UpdateTimer->start( 5000 ); |
267 | } | 267 | } |
268 | 268 | ||
269 | void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { | 269 | void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { |
270 | if( LBI == 0 ) | 270 | if( LBI == 0 ) |
271 | return; | 271 | return; |
272 | 272 | ||
273 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 273 | NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); |
274 | 274 | ||
275 | if( NC->description().isEmpty() ) { | 275 | if( NC->description().isEmpty() ) { |
276 | Description_LBL->setText( tr( "<<No description>>" ) ); | 276 | Description_LBL->setText( tr( "<<No description>>" ) ); |
277 | } else { | 277 | } else { |
278 | Description_LBL->setText( NC->description() ); | 278 | Description_LBL->setText( NC->description() ); |
279 | } | 279 | } |
280 | 280 | ||
281 | Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() ); | 281 | Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() ); |
@@ -348,17 +348,17 @@ void NetworkSettings::SLOT_GenerateConfig( void ) { | |||
348 | 348 | ||
349 | void NetworkSettings::SLOT_Disable( bool T ) { | 349 | void NetworkSettings::SLOT_Disable( bool T ) { |
350 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 350 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
351 | QString Msg; | 351 | QString Msg; |
352 | 352 | ||
353 | if ( ! LBI ) | 353 | if ( ! LBI ) |
354 | return; | 354 | return; |
355 | 355 | ||
356 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 356 | NetworkSetup * NC = NSResources->findNetworkSetup( LBI->text() ); |
357 | 357 | ||
358 | Log(( "Prepare to %sable\n", (T) ? "en" : "dis" )); | 358 | Log(( "Prepare to %sable\n", (T) ? "en" : "dis" )); |
359 | Msg = NC->setState( (T) ? Disable : Enable ); | 359 | Msg = NC->setState( (T) ? Disable : Enable ); |
360 | if( ! Msg.isEmpty() ) { | 360 | if( ! Msg.isEmpty() ) { |
361 | Msg.insert( 0, "<p>" ); | 361 | Msg.insert( 0, "<p>" ); |
362 | Msg.append( "</p>" ); | 362 | Msg.append( "</p>" ); |
363 | QMessageBox::warning( | 363 | QMessageBox::warning( |
364 | 0, | 364 | 0, |
@@ -377,18 +377,18 @@ void NetworkSettings::SLOT_Up( void ) { | |||
377 | 377 | ||
378 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 378 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
379 | QString Msg; | 379 | QString Msg; |
380 | int led = -1; | 380 | int led = -1; |
381 | 381 | ||
382 | if ( ! LBI ) | 382 | if ( ! LBI ) |
383 | return; | 383 | return; |
384 | 384 | ||
385 | NodeCollection * NC = | 385 | NetworkSetup * NC = |
386 | NSResources->findConnection( LBI->text() ); | 386 | NSResources->findNetworkSetup( LBI->text() ); |
387 | 387 | ||
388 | switch( NC->state() ) { | 388 | switch( NC->state() ) { |
389 | case Disabled : // cannot modify this state | 389 | case Disabled : // cannot modify this state |
390 | case Unknown : // cannot modify this state | 390 | case Unknown : // cannot modify this state |
391 | case Unchecked : // cannot modify this state | 391 | case Unchecked : // cannot modify this state |
392 | case Unavailable : // cannot modify this state | 392 | case Unavailable : // cannot modify this state |
393 | case IsUp : // highest UP state | 393 | case IsUp : // highest UP state |
394 | return; | 394 | return; |
@@ -433,18 +433,18 @@ void NetworkSettings::SLOT_Down( void ) { | |||
433 | 433 | ||
434 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 434 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
435 | int led = -1; | 435 | int led = -1; |
436 | QString Msg; | 436 | QString Msg; |
437 | 437 | ||
438 | if ( ! LBI ) | 438 | if ( ! LBI ) |
439 | return; | 439 | return; |
440 | 440 | ||
441 | NodeCollection * NC = | 441 | NetworkSetup * NC = |
442 | NSResources->findConnection( LBI->text() ); | 442 | NSResources->findNetworkSetup( LBI->text() ); |
443 | 443 | ||
444 | switch( NC->state() ) { | 444 | switch( NC->state() ) { |
445 | case Disabled : // cannot modify this state | 445 | case Disabled : // cannot modify this state |
446 | case Unknown : // cannot modify this state | 446 | case Unknown : // cannot modify this state |
447 | case Unchecked : // cannot modify this state | 447 | case Unchecked : // cannot modify this state |
448 | case Unavailable : // cannot modify this state | 448 | case Unavailable : // cannot modify this state |
449 | case Off : // highest DOWN state | 449 | case Off : // highest DOWN state |
450 | break; | 450 | break; |
diff --git a/noncore/settings/networksettings2/networksettings2/asconnection.h b/noncore/settings/networksettings2/networksettings2/asconnection.h index 1ed7e74..eeb0939 100644 --- a/noncore/settings/networksettings2/networksettings2/asconnection.h +++ b/noncore/settings/networksettings2/networksettings2/asconnection.h | |||
@@ -1,18 +1,18 @@ | |||
1 | #ifndef ASCONNECTION_H | 1 | #ifndef ASCONNECTION_H |
2 | #define ASCONNECTION_H | 2 | #define ASCONNECTION_H |
3 | 3 | ||
4 | #include <resources.h> | 4 | #include <resources.h> |
5 | 5 | ||
6 | // pure virtual (component oriented) interface of any | 6 | // pure virtual (component oriented) interface of any |
7 | // plugin that offers a connection | 7 | // plugin that offers a networkSetup |
8 | class AsConnection : public RuntimeInfo { | 8 | class AsNetworkSetup : public RuntimeInfo { |
9 | 9 | ||
10 | public : | 10 | public : |
11 | 11 | ||
12 | AsConnection( ANetNodeInstance * NNI ) : | 12 | AsNetworkSetup( ANetNodeInstance * NNI ) : |
13 | RuntimeInfo( NNI ) { | 13 | RuntimeInfo( NNI ) { |
14 | } | 14 | } |
15 | 15 | ||
16 | }; | 16 | }; |
17 | 17 | ||
18 | #endif | 18 | #endif |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp index f00e0b3..0ab0e5b 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.cpp +++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp | |||
@@ -120,37 +120,37 @@ void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){ | |||
120 | } | 120 | } |
121 | 121 | ||
122 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { | 122 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { |
123 | TS << "__name=" << name() << endl; | 123 | TS << "__name=" << name() << endl; |
124 | saveSpecificAttribute( TS ); | 124 | saveSpecificAttribute( TS ); |
125 | } | 125 | } |
126 | 126 | ||
127 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { | 127 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { |
128 | return connection()->findNext( this ); | 128 | return networkSetup()->findNext( this ); |
129 | } | 129 | } |
130 | 130 | ||
131 | // | 131 | // |
132 | // | 132 | // |
133 | // NODECOLLECTION | 133 | // NODECOLLECTION |
134 | // | 134 | // |
135 | // | 135 | // |
136 | 136 | ||
137 | NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { | 137 | NetworkSetup::NetworkSetup( void ) : QList<ANetNodeInstance>() { |
138 | IsModified = 0; | 138 | IsModified = 0; |
139 | Index = -1; | 139 | Index = -1; |
140 | Name=""; | 140 | Name=""; |
141 | IsNew = 1; | 141 | IsNew = 1; |
142 | CurrentState = Unchecked; | 142 | CurrentState = Unchecked; |
143 | AssignedInterface = 0; | 143 | AssignedInterface = 0; |
144 | Number = -1; | 144 | Number = -1; |
145 | Done = 0; | 145 | Done = 0; |
146 | } | 146 | } |
147 | 147 | ||
148 | NodeCollection::NodeCollection( QTextStream & TS, bool & Dangling ) : | 148 | NetworkSetup::NetworkSetup( QTextStream & TS, bool & Dangling ) : |
149 | QList<ANetNodeInstance>() { | 149 | QList<ANetNodeInstance>() { |
150 | long idx; | 150 | long idx; |
151 | QString S, A, N; | 151 | QString S, A, N; |
152 | 152 | ||
153 | Number = -1; | 153 | Number = -1; |
154 | Done = 0; | 154 | Done = 0; |
155 | IsModified = 0; | 155 | IsModified = 0; |
156 | Index = -1; | 156 | Index = -1; |
@@ -182,84 +182,84 @@ NodeCollection::NodeCollection( QTextStream & TS, bool & Dangling ) : | |||
182 | setNumber( N.toLong() ); | 182 | setNumber( N.toLong() ); |
183 | } else if( A == "node" ) { | 183 | } else if( A == "node" ) { |
184 | ANetNodeInstance * NNI = NSResources->findNodeInstance( N ); | 184 | ANetNodeInstance * NNI = NSResources->findNodeInstance( N ); |
185 | Log(( "Find node %s : %p\n", N.latin1(), NNI )); | 185 | Log(( "Find node %s : %p\n", N.latin1(), NNI )); |
186 | if( NNI ) { | 186 | if( NNI ) { |
187 | append( NNI ); | 187 | append( NNI ); |
188 | } else { | 188 | } else { |
189 | // could not find a node type -> collection invalid | 189 | // could not find a node type -> collection invalid |
190 | Log(( "Node %s missing -> connection dangling\n", | 190 | Log(( "Node %s missing -> NetworkSetup dangling\n", |
191 | N.latin1() )); | 191 | N.latin1() )); |
192 | // create placeholder for this dangling NNI | 192 | // create placeholder for this dangling NNI |
193 | NNI = new ErrorNNI( N ); | 193 | NNI = new ErrorNNI( N ); |
194 | Dangling = 1; | 194 | Dangling = 1; |
195 | } | 195 | } |
196 | } | 196 | } |
197 | } while( 1 ); | 197 | } while( 1 ); |
198 | 198 | ||
199 | Log(( "Profile number %s : %d nodes\n", | 199 | Log(( "Profile number %s : %d nodes\n", |
200 | Name.latin1(), count() )); | 200 | Name.latin1(), count() )); |
201 | } | 201 | } |
202 | 202 | ||
203 | NodeCollection::~NodeCollection( void ) { | 203 | NetworkSetup::~NetworkSetup( void ) { |
204 | } | 204 | } |
205 | 205 | ||
206 | const QString & NodeCollection::description( void ) { | 206 | const QString & NetworkSetup::description( void ) { |
207 | ANetNodeInstance * NNI = getToplevel(); | 207 | ANetNodeInstance * NNI = getToplevel(); |
208 | return (NNI) ? NNI->runtime()->description() : Name; | 208 | return (NNI) ? NNI->runtime()->description() : Name; |
209 | } | 209 | } |
210 | 210 | ||
211 | void NodeCollection::append( ANetNodeInstance * NNI ) { | 211 | void NetworkSetup::append( ANetNodeInstance * NNI ) { |
212 | NNI->setConnection( this ); | 212 | NNI->setNetworkSetup( this ); |
213 | QList<ANetNodeInstance>::append( NNI ); | 213 | QList<ANetNodeInstance>::append( NNI ); |
214 | } | 214 | } |
215 | 215 | ||
216 | void NodeCollection::save( QTextStream & TS ) { | 216 | void NetworkSetup::save( QTextStream & TS ) { |
217 | 217 | ||
218 | TS << "name=" << quote( Name ) << endl; | 218 | TS << "name=" << quote( Name ) << endl; |
219 | TS << "number=" << number() << endl; | 219 | TS << "number=" << number() << endl; |
220 | ANetNodeInstance * NNI; | 220 | ANetNodeInstance * NNI; |
221 | for( QListIterator<ANetNodeInstance> it(*this); | 221 | for( QListIterator<ANetNodeInstance> it(*this); |
222 | it.current(); | 222 | it.current(); |
223 | ++it ) { | 223 | ++it ) { |
224 | NNI = it.current(); | 224 | NNI = it.current(); |
225 | TS << "node=" << NNI->name() << endl; | 225 | TS << "node=" << NNI->name() << endl; |
226 | } | 226 | } |
227 | TS << endl; | 227 | TS << endl; |
228 | IsNew = 0; | 228 | IsNew = 0; |
229 | } | 229 | } |
230 | 230 | ||
231 | ANetNodeInstance * NodeCollection::getToplevel( void ) { | 231 | ANetNodeInstance * NetworkSetup::getToplevel( void ) { |
232 | ANetNodeInstance * NNI = 0; | 232 | ANetNodeInstance * NNI = 0; |
233 | for( QListIterator<ANetNodeInstance> it(*this); | 233 | for( QListIterator<ANetNodeInstance> it(*this); |
234 | it.current(); | 234 | it.current(); |
235 | ++it ) { | 235 | ++it ) { |
236 | NNI = it.current(); | 236 | NNI = it.current(); |
237 | if( NNI->nodeClass()->isToplevel() ) { | 237 | if( NNI->nodeClass()->isToplevel() ) { |
238 | return NNI; | 238 | return NNI; |
239 | } | 239 | } |
240 | } | 240 | } |
241 | return 0; | 241 | return 0; |
242 | } | 242 | } |
243 | 243 | ||
244 | ANetNodeInstance * NodeCollection::findByName( const QString & S ) { | 244 | ANetNodeInstance * NetworkSetup::findByName( const QString & S ) { |
245 | ANetNodeInstance * NNI = 0; | 245 | ANetNodeInstance * NNI = 0; |
246 | for( QListIterator<ANetNodeInstance> it(*this); | 246 | for( QListIterator<ANetNodeInstance> it(*this); |
247 | it.current(); | 247 | it.current(); |
248 | ++it ) { | 248 | ++it ) { |
249 | NNI = it.current(); | 249 | NNI = it.current(); |
250 | if( NNI->name() == S ) { | 250 | if( NNI->name() == S ) { |
251 | return NNI; | 251 | return NNI; |
252 | } | 252 | } |
253 | } | 253 | } |
254 | return 0; | 254 | return 0; |
255 | } | 255 | } |
256 | 256 | ||
257 | ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { | 257 | ANetNodeInstance * NetworkSetup::findNext( ANetNodeInstance * NNI ) { |
258 | ANetNodeInstance * NNNI; | 258 | ANetNodeInstance * NNNI; |
259 | 259 | ||
260 | if( ! NNI ) | 260 | if( ! NNI ) |
261 | getToplevel(); | 261 | getToplevel(); |
262 | 262 | ||
263 | for( QListIterator<ANetNodeInstance> it(*this); | 263 | for( QListIterator<ANetNodeInstance> it(*this); |
264 | it.current(); | 264 | it.current(); |
265 | ++it ) { | 265 | ++it ) { |
@@ -267,17 +267,17 @@ ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { | |||
267 | if( NNNI == NNI ) { | 267 | if( NNNI == NNI ) { |
268 | ++it; | 268 | ++it; |
269 | return it.current(); | 269 | return it.current(); |
270 | } | 270 | } |
271 | } | 271 | } |
272 | return 0; // no more next | 272 | return 0; // no more next |
273 | } | 273 | } |
274 | 274 | ||
275 | int NodeCollection::compareItems( QCollection::Item I1, | 275 | int NetworkSetup::compareItems( QCollection::Item I1, |
276 | QCollection::Item I2 ) { | 276 | QCollection::Item I2 ) { |
277 | ANetNodeInstance * NNI1, * NNI2; | 277 | ANetNodeInstance * NNI1, * NNI2; |
278 | NNI1 = (ANetNodeInstance *)I1; | 278 | NNI1 = (ANetNodeInstance *)I1; |
279 | NNI2 = (ANetNodeInstance *)I2; | 279 | NNI2 = (ANetNodeInstance *)I2; |
280 | return strcmp( NNI1->name(), NNI2->name() ); | 280 | return strcmp( NNI1->name(), NNI2->name() ); |
281 | } | 281 | } |
282 | 282 | ||
283 | static char * State2PixmapTbl[] = { | 283 | static char * State2PixmapTbl[] = { |
@@ -285,17 +285,17 @@ static char * State2PixmapTbl[] = { | |||
285 | "check", // Unknown | 285 | "check", // Unknown |
286 | "delete", // unavailable | 286 | "delete", // unavailable |
287 | "disabled", // disabled | 287 | "disabled", // disabled |
288 | "off", // off | 288 | "off", // off |
289 | "disconnected", // available | 289 | "disconnected", // available |
290 | "connected" // up | 290 | "connected" // up |
291 | }; | 291 | }; |
292 | 292 | ||
293 | QPixmap NodeCollection::devicePixmap( void ) { | 293 | QPixmap NetworkSetup::devicePixmap( void ) { |
294 | QPixmap pm = NSResources->getPixmap( | 294 | QPixmap pm = NSResources->getPixmap( |
295 | getToplevel()->nextNode()->pixmapName()+"-large"); | 295 | getToplevel()->nextNode()->pixmapName()+"-large"); |
296 | 296 | ||
297 | QPixmap Mini = NSResources->getPixmap( | 297 | QPixmap Mini = NSResources->getPixmap( |
298 | device()->netNode()->pixmapName() ); | 298 | device()->netNode()->pixmapName() ); |
299 | 299 | ||
300 | if( pm.isNull() || Mini.isNull() ) | 300 | if( pm.isNull() || Mini.isNull() ) |
301 | return Resource::loadPixmap("Unknown"); | 301 | return Resource::loadPixmap("Unknown"); |
@@ -303,21 +303,21 @@ QPixmap NodeCollection::devicePixmap( void ) { | |||
303 | QPainter painter( &pm ); | 303 | QPainter painter( &pm ); |
304 | painter.drawPixmap( pm.width()-Mini.width(), | 304 | painter.drawPixmap( pm.width()-Mini.width(), |
305 | pm.height()-Mini.height(), | 305 | pm.height()-Mini.height(), |
306 | Mini ); | 306 | Mini ); |
307 | pm.setMask( pm.createHeuristicMask( TRUE ) ); | 307 | pm.setMask( pm.createHeuristicMask( TRUE ) ); |
308 | return pm; | 308 | return pm; |
309 | } | 309 | } |
310 | 310 | ||
311 | QPixmap NodeCollection::statePixmap( State_t S) { | 311 | QPixmap NetworkSetup::statePixmap( State_t S) { |
312 | return NSResources->getPixmap( State2PixmapTbl[S] ); | 312 | return NSResources->getPixmap( State2PixmapTbl[S] ); |
313 | } | 313 | } |
314 | 314 | ||
315 | QString NodeCollection::stateName( State_t S) { | 315 | QString NetworkSetup::stateName( State_t S) { |
316 | switch( S ) { | 316 | switch( S ) { |
317 | case Unknown : | 317 | case Unknown : |
318 | return qApp->translate( "networksettings2", "Unknown"); | 318 | return qApp->translate( "networksettings2", "Unknown"); |
319 | case Unavailable : | 319 | case Unavailable : |
320 | return qApp->translate( "networksettings2", "Unavailable"); | 320 | return qApp->translate( "networksettings2", "Unavailable"); |
321 | case Disabled : | 321 | case Disabled : |
322 | return qApp->translate( "networksettings2", "Disabled"); | 322 | return qApp->translate( "networksettings2", "Disabled"); |
323 | case Off : | 323 | case Off : |
@@ -328,51 +328,51 @@ QString NodeCollection::stateName( State_t S) { | |||
328 | return qApp->translate( "networksettings2", "Up"); | 328 | return qApp->translate( "networksettings2", "Up"); |
329 | case Unchecked : /* FT */ | 329 | case Unchecked : /* FT */ |
330 | default : | 330 | default : |
331 | break; | 331 | break; |
332 | } | 332 | } |
333 | return QString(""); | 333 | return QString(""); |
334 | } | 334 | } |
335 | 335 | ||
336 | void NodeCollection::reassign( void ) { | 336 | void NetworkSetup::reassign( void ) { |
337 | for( QListIterator<ANetNodeInstance> it(*this); | 337 | for( QListIterator<ANetNodeInstance> it(*this); |
338 | it.current(); | 338 | it.current(); |
339 | ++it ) { | 339 | ++it ) { |
340 | it.current()->setConnection( this ); | 340 | it.current()->setNetworkSetup( this ); |
341 | } | 341 | } |
342 | } | 342 | } |
343 | 343 | ||
344 | const QStringList & NodeCollection::triggers() { | 344 | const QStringList & NetworkSetup::triggers() { |
345 | return getToplevel()->runtime()->triggers(); | 345 | return getToplevel()->runtime()->triggers(); |
346 | } | 346 | } |
347 | 347 | ||
348 | bool NodeCollection::hasDataForFile( SystemFile & S ) { | 348 | bool NetworkSetup::hasDataForFile( SystemFile & S ) { |
349 | return ( firstWithDataForFile( S ) != 0 ); | 349 | return ( firstWithDataForFile( S ) != 0 ); |
350 | } | 350 | } |
351 | 351 | ||
352 | ANetNodeInstance * NodeCollection::firstWithDataForFile( SystemFile & S ) { | 352 | ANetNodeInstance * NetworkSetup::firstWithDataForFile( SystemFile & S ) { |
353 | for( QListIterator<ANetNodeInstance> it(*this); | 353 | for( QListIterator<ANetNodeInstance> it(*this); |
354 | it.current(); | 354 | it.current(); |
355 | ++it ) { | 355 | ++it ) { |
356 | if( it.current()->hasDataForFile( S ) ) { | 356 | if( it.current()->hasDataForFile( S ) ) { |
357 | return it.current(); | 357 | return it.current(); |
358 | } | 358 | } |
359 | } | 359 | } |
360 | return 0; | 360 | return 0; |
361 | } | 361 | } |
362 | 362 | ||
363 | State_t NodeCollection::state( bool Update ) { | 363 | State_t NetworkSetup::state( bool Update ) { |
364 | State_t NodeState; | 364 | State_t NodeState; |
365 | 365 | ||
366 | if( CurrentState == Unchecked || Update ) { | 366 | if( CurrentState == Unchecked || Update ) { |
367 | // collect states of all nodes until with get the 'higest' | 367 | // collect states of all nodes until with get the 'higest' |
368 | // state possible | 368 | // state possible |
369 | 369 | ||
370 | Log(( "Connection %s state %s\n", | 370 | Log(( "NetworkSetup %s state %s\n", |
371 | Name.latin1(), StateName[CurrentState] )); | 371 | Name.latin1(), StateName[CurrentState] )); |
372 | 372 | ||
373 | CurrentState = Unknown; | 373 | CurrentState = Unknown; |
374 | for( QListIterator<ANetNodeInstance> it(*this); | 374 | for( QListIterator<ANetNodeInstance> it(*this); |
375 | it.current(); | 375 | it.current(); |
376 | ++it ) { | 376 | ++it ) { |
377 | Log(( "-> Detect %s\n", it.current()->name() )); | 377 | Log(( "-> Detect %s\n", it.current()->name() )); |
378 | NodeState = it.current()->runtime()->detectState(); | 378 | NodeState = it.current()->runtime()->detectState(); |
@@ -390,17 +390,17 @@ State_t NodeCollection::state( bool Update ) { | |||
390 | CurrentState = NodeState; | 390 | CurrentState = NodeState; |
391 | } | 391 | } |
392 | } | 392 | } |
393 | } | 393 | } |
394 | 394 | ||
395 | return CurrentState; | 395 | return CurrentState; |
396 | } | 396 | } |
397 | 397 | ||
398 | QString NodeCollection::setState( Action_t A, bool Force ) { | 398 | QString NetworkSetup::setState( Action_t A, bool Force ) { |
399 | 399 | ||
400 | QString msg; | 400 | QString msg; |
401 | Action_t Actions[10]; | 401 | Action_t Actions[10]; |
402 | int NoOfActions = 0; | 402 | int NoOfActions = 0; |
403 | 403 | ||
404 | // get current state | 404 | // get current state |
405 | state( Force ); | 405 | state( Force ); |
406 | 406 | ||
@@ -487,23 +487,32 @@ QString NodeCollection::setState( Action_t A, bool Force ) { | |||
487 | msg = getToplevel()->runtime()->setState( this, Actions[i], Force ); | 487 | msg = getToplevel()->runtime()->setState( this, Actions[i], Force ); |
488 | if( ! msg.isEmpty() ) { | 488 | if( ! msg.isEmpty() ) { |
489 | return msg; | 489 | return msg; |
490 | } | 490 | } |
491 | } | 491 | } |
492 | return QString(); | 492 | return QString(); |
493 | } | 493 | } |
494 | 494 | ||
495 | void NetworkSetup::copyFrom( const NetworkSetup & N ) { | ||
496 | Number = N.Number; | ||
497 | CurrentState = N.CurrentState; | ||
498 | Name = N.Name; | ||
499 | IsNew = N.IsNew; | ||
500 | Index = N.Index; | ||
501 | AssignedInterface = N.AssignedInterface; | ||
502 | } | ||
503 | |||
495 | // | 504 | // |
496 | // | 505 | // |
497 | // RuntimeInfo | 506 | // RuntimeInfo |
498 | // | 507 | // |
499 | // | 508 | // |
500 | 509 | ||
501 | QString RuntimeInfo::setState( NodeCollection * NC, | 510 | QString RuntimeInfo::setState( NetworkSetup * NC, |
502 | Action_t A, | 511 | Action_t A, |
503 | bool Force ) { | 512 | bool Force ) { |
504 | QString M; | 513 | QString M; |
505 | RuntimeInfo * Deeper = nextNode(); | 514 | RuntimeInfo * Deeper = nextNode(); |
506 | 515 | ||
507 | if( Deeper ) { | 516 | if( Deeper ) { |
508 | // first go deeper | 517 | // first go deeper |
509 | M = Deeper->setState( NC, A, Force ); | 518 | M = Deeper->setState( NC, A, Force ); |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h index 151d546..8aebdc0 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.h +++ b/noncore/settings/networksettings2/networksettings2/netnode.h | |||
@@ -10,69 +10,69 @@ | |||
10 | #include <time.h> | 10 | #include <time.h> |
11 | 11 | ||
12 | #include <Utils.h> | 12 | #include <Utils.h> |
13 | #include <system.h> | 13 | #include <system.h> |
14 | 14 | ||
15 | // difference feature interfaces | 15 | // difference feature interfaces |
16 | class AsDevice; | 16 | class AsDevice; |
17 | class AsLine; | 17 | class AsLine; |
18 | class AsConnection; | 18 | class AsNetworkSetup; |
19 | class AsFullSetup; | 19 | class AsFullSetup; |
20 | 20 | ||
21 | // needed for plugin creation function | 21 | // needed for plugin creation function |
22 | #include <qlist.h> | 22 | #include <qlist.h> |
23 | 23 | ||
24 | class ANetNode; | 24 | class ANetNode; |
25 | class ANetNodeInstance; | 25 | class ANetNodeInstance; |
26 | class NodeCollection; | 26 | class NetworkSetup; |
27 | class QTextStream; | 27 | class QTextStream; |
28 | class RuntimeInfo; | 28 | class RuntimeInfo; |
29 | class InterfaceInfo; | 29 | class InterfaceInfo; |
30 | class NSResources; | 30 | class NSResources; |
31 | 31 | ||
32 | extern QString & deQuote( QString & X ); | 32 | extern QString & deQuote( QString & X ); |
33 | extern QString quote( QString X ); | 33 | extern QString quote( QString X ); |
34 | 34 | ||
35 | #include "systemfile.h" | 35 | #include "systemfile.h" |
36 | 36 | ||
37 | typedef enum State { | 37 | typedef enum State { |
38 | // if we have not yet detected the state of the device | 38 | // if we have not yet detected the state of the device |
39 | Unchecked = 0, | 39 | Unchecked = 0, |
40 | // if we cannot determine the state | 40 | // if we cannot determine the state |
41 | Unknown = 1, | 41 | Unknown = 1, |
42 | // if connection cannot be established e.g. because | 42 | // if networkSetup cannot be established e.g. because |
43 | // the hardware is not available | 43 | // the hardware is not available |
44 | Unavailable = 2, | 44 | Unavailable = 2, |
45 | // if the connection cannot be establishec but NOT | 45 | // if the networkSetup cannot be establishec but NOT |
46 | // because it is physically impossible but because | 46 | // because it is physically impossible but because |
47 | // it has been disabled for FUNCTIONAL reasons | 47 | // it has been disabled for FUNCTIONAL reasons |
48 | Disabled = 3, | 48 | Disabled = 3, |
49 | // if connection is available to is currently down | 49 | // if networkSetup is available to is currently down |
50 | // i.e. the corresponding hardware is not activated | 50 | // i.e. the corresponding hardware is not activated |
51 | Off = 4, | 51 | Off = 4, |
52 | // if connection is available to be used (i.e. the | 52 | // if networkSetup is available to be used (i.e. the |
53 | // devices if fully ready to be used | 53 | // devices if fully ready to be used |
54 | Available = 5, | 54 | Available = 5, |
55 | // if connection is being used | 55 | // if networkSetup is being used |
56 | IsUp = 6 | 56 | IsUp = 6 |
57 | } State_t; | 57 | } State_t; |
58 | 58 | ||
59 | typedef enum Action { | 59 | typedef enum Action { |
60 | // to make the device unavailable functionally -> to disabled | 60 | // to make the device unavailable functionally -> to disabled |
61 | Disable = 0, | 61 | Disable = 0, |
62 | // to make the device available functionally -> to off | 62 | // to make the device available functionally -> to off |
63 | Enable = 1, | 63 | Enable = 1, |
64 | // bring the hardware up -> to Available | 64 | // bring the hardware up -> to Available |
65 | Activate = 2, | 65 | Activate = 2, |
66 | // bring the hardware down -> to off | 66 | // bring the hardware down -> to off |
67 | Deactivate = 3, | 67 | Deactivate = 3, |
68 | // bring the connection up -> to IsUp | 68 | // bring the networkSetup up -> to IsUp |
69 | Up = 4, | 69 | Up = 4, |
70 | // bring the connection down -> to Available | 70 | // bring the networkSetup down -> to Available |
71 | Down = 5 | 71 | Down = 5 |
72 | } Action_t; | 72 | } Action_t; |
73 | 73 | ||
74 | class ANetNode : public QObject { | 74 | class ANetNode : public QObject { |
75 | 75 | ||
76 | public: | 76 | public: |
77 | 77 | ||
78 | typedef QArray<ANetNode *> NetNodeList; | 78 | typedef QArray<ANetNode *> NetNodeList; |
@@ -86,17 +86,17 @@ public: | |||
86 | // | 86 | // |
87 | // | 87 | // |
88 | 88 | ||
89 | inline int done( void ) | 89 | inline int done( void ) |
90 | { return Done; } | 90 | { return Done; } |
91 | inline void setDone( int D ) | 91 | inline void setDone( int D ) |
92 | { Done = D; } | 92 | { Done = D; } |
93 | 93 | ||
94 | // does this Node provide a Connection | 94 | // does this Node provide a NetworkSetup |
95 | bool isToplevel( void ); | 95 | bool isToplevel( void ); |
96 | 96 | ||
97 | // set the value of an attribute | 97 | // set the value of an attribute |
98 | void setAttribute( QString & Attr, QString & Value ) ; | 98 | void setAttribute( QString & Attr, QString & Value ) ; |
99 | void saveAttributes( QTextStream & TS ) ; | 99 | void saveAttributes( QTextStream & TS ) ; |
100 | 100 | ||
101 | // compiled references to 'needed' NetNodes -> needs list | 101 | // compiled references to 'needed' NetNodes -> needs list |
102 | inline void setAlternatives( NetNodeList * Alt ) | 102 | inline void setAlternatives( NetNodeList * Alt ) |
@@ -240,20 +240,20 @@ public: | |||
240 | { return NodeType->pixmapName(); } | 240 | { return NodeType->pixmapName(); } |
241 | 241 | ||
242 | inline const char ** provides( void ) | 242 | inline const char ** provides( void ) |
243 | { return NodeType->provides(); } | 243 | { return NodeType->provides(); } |
244 | 244 | ||
245 | inline const char ** needs( void ) | 245 | inline const char ** needs( void ) |
246 | { return NodeType->needs(); } | 246 | { return NodeType->needs(); } |
247 | 247 | ||
248 | inline void setConnection( NodeCollection * NC ) | 248 | inline void setNetworkSetup( NetworkSetup * NC ) |
249 | { Connection = NC; } | 249 | { TheNetworkSetup = NC; } |
250 | inline NodeCollection * connection( void ) | 250 | inline NetworkSetup * networkSetup( void ) |
251 | { return Connection; } | 251 | { return TheNetworkSetup; } |
252 | 252 | ||
253 | // | 253 | // |
254 | // | 254 | // |
255 | // Virtual methods with sensible defaults | 255 | // Virtual methods with sensible defaults |
256 | // | 256 | // |
257 | // | 257 | // |
258 | 258 | ||
259 | 259 | ||
@@ -310,18 +310,18 @@ public: | |||
310 | virtual void * data( void ) = 0; | 310 | virtual void * data( void ) = 0; |
311 | 311 | ||
312 | protected : | 312 | protected : |
313 | 313 | ||
314 | virtual void setSpecificAttribute( QString & , QString & ) = 0; | 314 | virtual void setSpecificAttribute( QString & , QString & ) = 0; |
315 | virtual void saveSpecificAttribute( QTextStream & ) = 0; | 315 | virtual void saveSpecificAttribute( QTextStream & ) = 0; |
316 | 316 | ||
317 | ANetNode * NodeType; | 317 | ANetNode * NodeType; |
318 | // connection to which this node belongs to | 318 | // networkSetup to which this node belongs to |
319 | NodeCollection * Connection; | 319 | NetworkSetup * TheNetworkSetup; |
320 | QString Description; | 320 | QString Description; |
321 | bool IsModified; | 321 | bool IsModified; |
322 | // true if this nodeinstance was just created (and not | 322 | // true if this nodeinstance was just created (and not |
323 | // loaded from file | 323 | // loaded from file |
324 | bool IsNew; | 324 | bool IsNew; |
325 | int Done; | 325 | int Done; |
326 | 326 | ||
327 | static long InstanceCounter; | 327 | static long InstanceCounter; |
@@ -373,17 +373,17 @@ class RuntimeInfo : public QObject { | |||
373 | 373 | ||
374 | public : | 374 | public : |
375 | 375 | ||
376 | RuntimeInfo( ANetNodeInstance * TheNNI ) | 376 | RuntimeInfo( ANetNodeInstance * TheNNI ) |
377 | { NNI = TheNNI; } | 377 | { NNI = TheNNI; } |
378 | 378 | ||
379 | // | 379 | // |
380 | // | 380 | // |
381 | // methods to be overloaded by connection capable | 381 | // methods to be overloaded by networkSetup capable |
382 | // runtimes | 382 | // runtimes |
383 | // | 383 | // |
384 | // | 384 | // |
385 | 385 | ||
386 | 386 | ||
387 | // | 387 | // |
388 | // | 388 | // |
389 | // methods to be overloaded by device capable | 389 | // methods to be overloaded by device capable |
@@ -470,53 +470,56 @@ public : | |||
470 | virtual RuntimeInfo * fullSetup( void ) | 470 | virtual RuntimeInfo * fullSetup( void ) |
471 | { RuntimeInfo * RI = nextNode(); | 471 | { RuntimeInfo * RI = nextNode(); |
472 | return (RI) ? RI->fullSetup() : 0; | 472 | return (RI) ? RI->fullSetup() : 0; |
473 | } | 473 | } |
474 | 474 | ||
475 | inline ANetNodeInstance * netNode() | 475 | inline ANetNodeInstance * netNode() |
476 | { return NNI; } | 476 | { return NNI; } |
477 | 477 | ||
478 | inline NodeCollection * nodeCollection() | 478 | inline NetworkSetup * networkSetup() |
479 | { return NNI->connection(); } | 479 | { return NNI->networkSetup(); } |
480 | 480 | ||
481 | virtual State_t detectState( void ) = 0; | 481 | virtual State_t detectState( void ) = 0; |
482 | // public API to set the state | 482 | // public API to set the state |
483 | virtual QString setState( NodeCollection * NC, | 483 | virtual QString setState( NetworkSetup * NC, |
484 | Action_t A, | 484 | Action_t A, |
485 | bool Force = 0 ); | 485 | bool Force = 0 ); |
486 | 486 | ||
487 | inline RuntimeInfo * nextNode( void ) { | 487 | inline RuntimeInfo * nextNode( void ) { |
488 | ANetNodeInstance * NNI = netNode()->nextNode(); | 488 | ANetNodeInstance * NNI = netNode()->nextNode(); |
489 | return (NNI) ? NNI->runtime() : 0; | 489 | return (NNI) ? NNI->runtime() : 0; |
490 | } | 490 | } |
491 | 491 | ||
492 | signals : | 492 | signals : |
493 | 493 | ||
494 | // sent by device if state changes | 494 | // sent by device if state changes |
495 | void stateChanged( State_t S, ANetNodeInstance * NNI ); | 495 | void stateChanged( State_t S, ANetNodeInstance * NNI ); |
496 | 496 | ||
497 | protected : | 497 | protected : |
498 | 498 | ||
499 | // set state of this node (private API) | 499 | // set state of this node (private API) |
500 | virtual QString setMyState( NodeCollection * NC, | 500 | virtual QString setMyState( NetworkSetup * NC, |
501 | Action_t A, | 501 | Action_t A, |
502 | bool Force = 0 ) = 0; | 502 | bool Force = 0 ) = 0; |
503 | 503 | ||
504 | // connection this runtime info belongs to | 504 | // networkSetup this runtime info belongs to |
505 | ANetNodeInstance * NNI; | 505 | ANetNodeInstance * NNI; |
506 | }; | 506 | }; |
507 | 507 | ||
508 | class NodeCollection : public QList<ANetNodeInstance> { | 508 | class NetworkSetup : public QList<ANetNodeInstance> { |
509 | 509 | ||
510 | public : | 510 | public : |
511 | 511 | ||
512 | NodeCollection( void ); | 512 | NetworkSetup( void ); |
513 | NodeCollection( QTextStream & TS, bool & Dangling ); | 513 | NetworkSetup( QTextStream & TS, bool & Dangling ); |
514 | ~NodeCollection( void ); | 514 | ~NetworkSetup( void ); |
515 | |||
516 | // copy settings from NC to this | ||
517 | void copyFrom( const NetworkSetup & NC ); | ||
515 | 518 | ||
516 | inline int done( void ) | 519 | inline int done( void ) |
517 | { return Done; } | 520 | { return Done; } |
518 | inline void setDone( int D ) | 521 | inline void setDone( int D ) |
519 | { Done = D; } | 522 | { Done = D; } |
520 | 523 | ||
521 | inline int number( void ) | 524 | inline int number( void ) |
522 | { return Number; } | 525 | { return Number; } |
@@ -538,25 +541,25 @@ public : | |||
538 | // return the interface in the OS that is assigned to | 541 | // return the interface in the OS that is assigned to |
539 | // this device | 542 | // this device |
540 | inline InterfaceInfo * assignedInterface( void ) { | 543 | inline InterfaceInfo * assignedInterface( void ) { |
541 | return AssignedInterface; | 544 | return AssignedInterface; |
542 | } | 545 | } |
543 | 546 | ||
544 | // assign the interface to this device | 547 | // assign the interface to this device |
545 | inline void assignInterface( InterfaceInfo * NI ) { | 548 | inline void assignInterface( InterfaceInfo * NI ) { |
546 | if( NI == 0 ) { | 549 | // cleanup previous |
547 | if( AssignedInterface ) { | ||
548 | AssignedInterface->assignConnection( 0 ); | ||
549 | } | ||
550 | } | ||
551 | AssignedInterface = NI; | ||
552 | if( AssignedInterface ) { | 550 | if( AssignedInterface ) { |
553 | AssignedInterface->assignConnection( this ); | 551 | AssignedInterface->assignToNetworkSetup( 0 ); |
554 | } | 552 | } |
553 | if( NI ) { | ||
554 | // assign new | ||
555 | NI->assignToNetworkSetup( this ); | ||
556 | } | ||
557 | AssignedInterface = NI; | ||
555 | } | 558 | } |
556 | 559 | ||
557 | inline RuntimeInfo * device() { | 560 | inline RuntimeInfo * device() { |
558 | return getToplevel()->runtime()->device(); | 561 | return getToplevel()->runtime()->device(); |
559 | } | 562 | } |
560 | 563 | ||
561 | const QStringList & triggers(); | 564 | const QStringList & triggers(); |
562 | 565 | ||
@@ -572,17 +575,17 @@ public : | |||
572 | { return stateName( state(Update) ); } | 575 | { return stateName( state(Update) ); } |
573 | 576 | ||
574 | QString setState( Action_t A, bool Force = 0 ); | 577 | QString setState( Action_t A, bool Force = 0 ); |
575 | 578 | ||
576 | void save( QTextStream & TS ); | 579 | void save( QTextStream & TS ); |
577 | 580 | ||
578 | void append( ANetNodeInstance * NNI ); | 581 | void append( ANetNodeInstance * NNI ); |
579 | 582 | ||
580 | // makes sure that all items in the connection point to | 583 | // makes sure that all items in the networkSetup point to |
581 | // that connectoin | 584 | // that connectoin |
582 | void reassign( void ); | 585 | void reassign( void ); |
583 | 586 | ||
584 | ANetNodeInstance * getToplevel( void ); | 587 | ANetNodeInstance * getToplevel( void ); |
585 | ANetNodeInstance * findNext( ANetNodeInstance * NNI ); | 588 | ANetNodeInstance * findNext( ANetNodeInstance * NNI ); |
586 | ANetNodeInstance * findByName( const QString & S ); | 589 | ANetNodeInstance * findByName( const QString & S ); |
587 | 590 | ||
588 | inline const QString & name() | 591 | inline const QString & name() |
@@ -614,17 +617,17 @@ public : | |||
614 | 617 | ||
615 | private : | 618 | private : |
616 | 619 | ||
617 | int compareItems ( QCollection::Item item1, | 620 | int compareItems ( QCollection::Item item1, |
618 | QCollection::Item item2 ); | 621 | QCollection::Item item2 ); |
619 | 622 | ||
620 | long Number; | 623 | long Number; |
621 | 624 | ||
622 | // state of this connection | 625 | // state of this networkSetup |
623 | State_t CurrentState; | 626 | State_t CurrentState; |
624 | 627 | ||
625 | QString Name; | 628 | QString Name; |
626 | // true if this collection was just created (and not | 629 | // true if this collection was just created (and not |
627 | // loaded from file | 630 | // loaded from file |
628 | bool IsNew; | 631 | bool IsNew; |
629 | // index in listbox | 632 | // index in listbox |
630 | int Index; | 633 | int Index; |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp index b81dcaa..0e72c25 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.cpp +++ b/noncore/settings/networksettings2/networksettings2/resources.cpp | |||
@@ -20,17 +20,17 @@ | |||
20 | 20 | ||
21 | #define PLUGINDIR "plugins/networksettings2" | 21 | #define PLUGINDIR "plugins/networksettings2" |
22 | #define ICONDIR "/pics/networksettings2/" | 22 | #define ICONDIR "/pics/networksettings2/" |
23 | 23 | ||
24 | // single resources instance | 24 | // single resources instance |
25 | TheNSResources * _NSResources = 0; | 25 | TheNSResources * _NSResources = 0; |
26 | 26 | ||
27 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), | 27 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), |
28 | ConnectionsMap(), DanglingConnectionsMap() { | 28 | NetworkSetupsMap(), DanglingNetworkSetupsMap() { |
29 | 29 | ||
30 | _NSResources = this; | 30 | _NSResources = this; |
31 | 31 | ||
32 | detectCurrentUser(); | 32 | detectCurrentUser(); |
33 | 33 | ||
34 | // load available netnodes | 34 | // load available netnodes |
35 | 35 | ||
36 | Plugins = 0; | 36 | Plugins = 0; |
@@ -75,22 +75,22 @@ TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), | |||
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | // define built in Node types to Description map | 78 | // define built in Node types to Description map |
79 | addNodeType( "device", tr( "Network Device" ), | 79 | addNodeType( "device", tr( "Network Device" ), |
80 | tr( "<p>Devices that can handle IP packets</p>" ) ); | 80 | tr( "<p>Devices that can handle IP packets</p>" ) ); |
81 | addNodeType( "line", tr( "Character device" ), | 81 | addNodeType( "line", tr( "Character device" ), |
82 | tr( "<p>Devices that can handle single bytes</p>" ) ); | 82 | tr( "<p>Devices that can handle single bytes</p>" ) ); |
83 | addNodeType( "connection", tr( "IP Connection" ), | 83 | addNodeType( "NetworkSetup", tr( "IP NetworkSetup" ), |
84 | tr( "<p>Nodes that provide working IP connections</p>" ) ); | 84 | tr( "<p>Nodes that provide working IP NetworkSetups</p>" ) ); |
85 | addNodeType( "fullsetup", tr( "Connection Profile" ), | 85 | addNodeType( "fullsetup", tr( "NetworkSetup Profile" ), |
86 | tr( "<p>Fully configured connection profile</p>" ) ); | 86 | tr( "<p>Fully configured NetworkSetup profile</p>" ) ); |
87 | addNodeType( "GPRS", tr( "Connection to GPRS device" ), | 87 | addNodeType( "GPRS", tr( "NetworkSetup to GPRS device" ), |
88 | tr( "<p>Connection to a GPRS capable device</p>" ) ); | 88 | tr( "<p>NetworkSetup to a GPRS capable device</p>" ) ); |
89 | 89 | ||
90 | // get access to the system | 90 | // get access to the system |
91 | TheSystem = new System(); | 91 | TheSystem = new System(); |
92 | 92 | ||
93 | } | 93 | } |
94 | 94 | ||
95 | TheNSResources::~TheNSResources( void ) { | 95 | TheNSResources::~TheNSResources( void ) { |
96 | 96 | ||
@@ -196,22 +196,22 @@ void TheNSResources::findAvailableNetNodes( void ){ | |||
196 | if( trans->load( fn ) ) | 196 | if( trans->load( fn ) ) |
197 | qApp->installTranslator( trans ); | 197 | qApp->installTranslator( trans ); |
198 | else | 198 | else |
199 | delete trans; | 199 | delete trans; |
200 | } | 200 | } |
201 | 201 | ||
202 | } | 202 | } |
203 | 203 | ||
204 | // used to find unique connection number | 204 | // used to find unique NetworkSetup number |
205 | int TheNSResources::assignConnectionNumber( void ) { | 205 | int TheNSResources::assignNetworkSetupNumber( void ) { |
206 | bool found = 1; | 206 | bool found = 1; |
207 | for( int trial = 0; ; trial ++ ) { | 207 | for( int trial = 0; ; trial ++ ) { |
208 | found = 1; | 208 | found = 1; |
209 | for( QDictIterator<NodeCollection> it(ConnectionsMap); | 209 | for( QDictIterator<NetworkSetup> it(NetworkSetupsMap); |
210 | it.current(); | 210 | it.current(); |
211 | ++it ) { | 211 | ++it ) { |
212 | if( it.current()->number() == trial ) { | 212 | if( it.current()->number() == trial ) { |
213 | found = 0; | 213 | found = 0; |
214 | break; | 214 | break; |
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
@@ -240,83 +240,83 @@ QString TheNSResources::tr( const char * s ) { | |||
240 | const QString & TheNSResources::netNode2Name( const char * s ) { | 240 | const QString & TheNSResources::netNode2Name( const char * s ) { |
241 | return NodeTypeNameMap[s]; | 241 | return NodeTypeNameMap[s]; |
242 | } | 242 | } |
243 | 243 | ||
244 | const QString & TheNSResources::netNode2Description( const char * s ) { | 244 | const QString & TheNSResources::netNode2Description( const char * s ) { |
245 | return NodeTypeDescriptionMap[s]; | 245 | return NodeTypeDescriptionMap[s]; |
246 | } | 246 | } |
247 | 247 | ||
248 | void TheNSResources::addConnection( NodeCollection * NC, bool Dangling ) { | 248 | void TheNSResources::addNetworkSetup( NetworkSetup * NC, bool Dangling ) { |
249 | ANetNodeInstance * NNI; | 249 | ANetNodeInstance * NNI; |
250 | Log(( "Add Connection %s, Dangling %d\n", | 250 | Log(( "Add NetworkSetup %s, Dangling %d\n", |
251 | NC->name().latin1(), Dangling )); | 251 | NC->name().latin1(), Dangling )); |
252 | if( Dangling ) { | 252 | if( Dangling ) { |
253 | DanglingConnectionsMap.insert( NC->name(), NC ); | 253 | DanglingNetworkSetupsMap.insert( NC->name(), NC ); |
254 | } else { | 254 | } else { |
255 | ConnectionsMap.insert( NC->name(), NC ); | 255 | NetworkSetupsMap.insert( NC->name(), NC ); |
256 | } | 256 | } |
257 | 257 | ||
258 | // add (new) nodes to NodeList | 258 | // add (new) nodes to NodeList |
259 | for( QListIterator<ANetNodeInstance> it(*NC); | 259 | for( QListIterator<ANetNodeInstance> it(*NC); |
260 | it.current(); | 260 | it.current(); |
261 | ++it ) { | 261 | ++it ) { |
262 | NNI = it.current(); | 262 | NNI = it.current(); |
263 | if( findNodeInstance( NNI->name() ) == 0 ) { | 263 | if( findNodeInstance( NNI->name() ) == 0 ) { |
264 | // new item | 264 | // new item |
265 | addNodeInstance( NNI ); | 265 | addNodeInstance( NNI ); |
266 | } | 266 | } |
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | void TheNSResources::removeConnection( const QString & N ) { | 270 | void TheNSResources::removeNetworkSetup( const QString & N ) { |
271 | NodeCollection * NC = findConnection( N ); | 271 | NetworkSetup * NC = findNetworkSetup( N ); |
272 | if( ! NC ) | 272 | if( ! NC ) |
273 | return; | 273 | return; |
274 | 274 | ||
275 | // delete netnodes in this connection | 275 | // delete netnodes in this NetworkSetup |
276 | ANetNodeInstance * NNI; | 276 | ANetNodeInstance * NNI; |
277 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { | 277 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { |
278 | removeNodeInstance( NNI->name() ); | 278 | removeNodeInstance( NNI->name() ); |
279 | } | 279 | } |
280 | if( ConnectionsMap.find( N ) ) { | 280 | if( NetworkSetupsMap.find( N ) ) { |
281 | ConnectionsMap.remove( N ); | 281 | NetworkSetupsMap.remove( N ); |
282 | } else { | 282 | } else { |
283 | DanglingConnectionsMap.remove( N ); | 283 | DanglingNetworkSetupsMap.remove( N ); |
284 | } | 284 | } |
285 | 285 | ||
286 | } | 286 | } |
287 | 287 | ||
288 | // dangling connections are filtered out | 288 | // dangling NetworkSetups are filtered out |
289 | NodeCollection * TheNSResources::findConnection( const QString & S ) { | 289 | NetworkSetup * TheNSResources::findNetworkSetup( const QString & S ) { |
290 | return ConnectionsMap[ S ]; | 290 | return NetworkSetupsMap[ S ]; |
291 | } | 291 | } |
292 | 292 | ||
293 | NodeCollection * TheNSResources::getConnection( int nr ) { | 293 | NetworkSetup * TheNSResources::getNetworkSetup( int nr ) { |
294 | for( QDictIterator<NodeCollection> it(ConnectionsMap); | 294 | for( QDictIterator<NetworkSetup> it(NetworkSetupsMap); |
295 | it.current(); | 295 | it.current(); |
296 | ++it ) { | 296 | ++it ) { |
297 | if( it.current()->number() == nr ) { | 297 | if( it.current()->number() == nr ) { |
298 | return it.current(); | 298 | return it.current(); |
299 | } | 299 | } |
300 | } | 300 | } |
301 | return 0; | 301 | return 0; |
302 | } | 302 | } |
303 | /* | 303 | /* |
304 | void TheNSResources::renumberConnections( void ) { | 304 | void TheNSResources::renumberNetworkSetups( void ) { |
305 | Name2Connection_t & M = NSResources->connections(); | 305 | Name2NetworkSetup_t & M = NSResources->NetworkSetups(); |
306 | NodeCollection * NC; | 306 | NetworkSetup * NC; |
307 | 307 | ||
308 | // for all connections | 308 | // for all NetworkSetups |
309 | NodeCollection::resetMaxNr(); | 309 | NetworkSetup::resetMaxNr(); |
310 | for( QDictIterator<NodeCollection> it(M); | 310 | for( QDictIterator<NetworkSetup> it(M); |
311 | it.current(); | 311 | it.current(); |
312 | ++it ) { | 312 | ++it ) { |
313 | NC = it.current(); | 313 | NC = it.current(); |
314 | NC->setNumber( NC->maxConnectionNumber()+1 ); | 314 | NC->setNumber( NC->maxNetworkSetupNumber()+1 ); |
315 | NC->setModified( 1 ); | 315 | NC->setModified( 1 ); |
316 | } | 316 | } |
317 | } | 317 | } |
318 | */ | 318 | */ |
319 | 319 | ||
320 | typedef struct EnvVars { | 320 | typedef struct EnvVars { |
321 | char * Name; | 321 | char * Name; |
322 | int Len; | 322 | int Len; |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h index 51c4250..f7393d3 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.h +++ b/noncore/settings/networksettings2/networksettings2/resources.h | |||
@@ -35,33 +35,33 @@ public : | |||
35 | QString HomeDir; | 35 | QString HomeDir; |
36 | int Uid; | 36 | int Uid; |
37 | int Gid; | 37 | int Gid; |
38 | QArray<char *> EnvList; | 38 | QArray<char *> EnvList; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | typedef QDict<ANetNode> Name2NetNode_t; | 41 | typedef QDict<ANetNode> Name2NetNode_t; |
42 | typedef QDict<ANetNodeInstance > Name2Instance_t; | 42 | typedef QDict<ANetNodeInstance > Name2Instance_t; |
43 | typedef QDict<NodeCollection> Name2Connection_t; | 43 | typedef QDict<NetworkSetup> Name2NetworkSetup_t; |
44 | typedef QDict<SystemFile> Name2SystemFile_t; | 44 | typedef QDict<SystemFile> Name2SystemFile_t; |
45 | 45 | ||
46 | class TheNSResources { | 46 | class TheNSResources { |
47 | 47 | ||
48 | public : | 48 | public : |
49 | 49 | ||
50 | TheNSResources( void ); | 50 | TheNSResources( void ); |
51 | ~TheNSResources( ); | 51 | ~TheNSResources( ); |
52 | 52 | ||
53 | // give busy feedback | 53 | // give busy feedback |
54 | void busy( bool B ); | 54 | void busy( bool B ); |
55 | 55 | ||
56 | System & system() | 56 | System & system() |
57 | { return *TheSystem; } | 57 | { return *TheSystem; } |
58 | 58 | ||
59 | int assignConnectionNumber(void); | 59 | int assignNetworkSetupNumber(void); |
60 | QPixmap getPixmap( const QString & Name ); | 60 | QPixmap getPixmap( const QString & Name ); |
61 | 61 | ||
62 | Name2NetNode_t & netNodes( void ) | 62 | Name2NetNode_t & netNodes( void ) |
63 | { return AllNodeTypes; } | 63 | { return AllNodeTypes; } |
64 | bool netNodeExists( const QString & X ) | 64 | bool netNodeExists( const QString & X ) |
65 | { return AllNodeTypes.find(X)!=0; } | 65 | { return AllNodeTypes.find(X)!=0; } |
66 | ANetNode * findNetNode( const QString & N ) | 66 | ANetNode * findNetNode( const QString & N ) |
67 | { return AllNodeTypes.find(N); | 67 | { return AllNodeTypes.find(N); |
@@ -98,44 +98,44 @@ public : | |||
98 | void removeNodeInstance( const QString & N ) | 98 | void removeNodeInstance( const QString & N ) |
99 | { AllNodes.remove( N );} | 99 | { AllNodes.remove( N );} |
100 | ANetNodeInstance * findNodeInstance( const QString & S ) | 100 | ANetNodeInstance * findNodeInstance( const QString & S ) |
101 | { return AllNodes[S]; } | 101 | { return AllNodes[S]; } |
102 | 102 | ||
103 | const QString & netNode2Name( const char * Type ); | 103 | const QString & netNode2Name( const char * Type ); |
104 | const QString & netNode2Description( const char * Type ); | 104 | const QString & netNode2Description( const char * Type ); |
105 | 105 | ||
106 | void addConnection( NodeCollection * NC, bool Dangling ); | 106 | void addNetworkSetup( NetworkSetup * NC, bool Dangling ); |
107 | void removeConnection( const QString & N ); | 107 | void removeNetworkSetup( const QString & N ); |
108 | NodeCollection * findConnection( const QString & N ); | 108 | NetworkSetup * findNetworkSetup( const QString & N ); |
109 | NodeCollection * getConnection( int nr ); | 109 | NetworkSetup * getNetworkSetup( int nr ); |
110 | Name2Connection_t & connections( void ) | 110 | Name2NetworkSetup_t & networkSetups( void ) |
111 | { return ConnectionsMap; } | 111 | { return NetworkSetupsMap; } |
112 | Name2Connection_t & danglingConnections( void ) | 112 | Name2NetworkSetup_t & danglingNetworkSetups( void ) |
113 | { return DanglingConnectionsMap; } | 113 | { return DanglingNetworkSetupsMap; } |
114 | 114 | ||
115 | inline bool userKnown( void ) | 115 | inline bool userKnown( void ) |
116 | { return CurrentUser.known(); } | 116 | { return CurrentUser.known(); } |
117 | CurrentQPEUser & currentUser( void ) | 117 | CurrentQPEUser & currentUser( void ) |
118 | { return CurrentUser; } | 118 | { return CurrentUser; } |
119 | 119 | ||
120 | private : | 120 | private : |
121 | 121 | ||
122 | void detectCurrentUser( void ); | 122 | void detectCurrentUser( void ); |
123 | QString tr( const char * path ); | 123 | QString tr( const char * path ); |
124 | 124 | ||
125 | void findAvailableNetNodes( void ); | 125 | void findAvailableNetNodes( void ); |
126 | 126 | ||
127 | QMap< QString, QString> NodeTypeNameMap; | 127 | QMap< QString, QString> NodeTypeNameMap; |
128 | QMap< QString, QString> NodeTypeDescriptionMap; | 128 | QMap< QString, QString> NodeTypeDescriptionMap; |
129 | // list of connections that are valid | 129 | // list of networkSetups that are valid |
130 | Name2Connection_t ConnectionsMap; | 130 | Name2NetworkSetup_t NetworkSetupsMap; |
131 | // list of connection configurations that are not valid | 131 | // list of networkSetup configurations that are not valid |
132 | // e.g. because plugins are missing | 132 | // e.g. because plugins are missing |
133 | Name2Connection_t DanglingConnectionsMap; | 133 | Name2NetworkSetup_t DanglingNetworkSetupsMap; |
134 | System * TheSystem; | 134 | System * TheSystem; |
135 | Name2SystemFile_t SystemFiles; | 135 | Name2SystemFile_t SystemFiles; |
136 | 136 | ||
137 | // all node type classes | 137 | // all node type classes |
138 | Name2NetNode_t AllNodeTypes; | 138 | Name2NetNode_t AllNodeTypes; |
139 | 139 | ||
140 | // all nodes | 140 | // all nodes |
141 | Name2Instance_t AllNodes; | 141 | Name2Instance_t AllNodes; |
diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp index a290f08..33cc5bd 100644 --- a/noncore/settings/networksettings2/networksettings2/system.cpp +++ b/noncore/settings/networksettings2/networksettings2/system.cpp | |||
@@ -448,23 +448,23 @@ void System::probeInterfaces( void ) { | |||
448 | Log(("NIC %s UP ? %d\n", NicName.latin1(), IFI->IsUp )); | 448 | Log(("NIC %s UP ? %d\n", NicName.latin1(), IFI->IsUp )); |
449 | } | 449 | } |
450 | 450 | ||
451 | ::close( sockfd ); | 451 | ::close( sockfd ); |
452 | } | 452 | } |
453 | 453 | ||
454 | InterfaceInfo * System::findInterface( const QString & N ) { | 454 | InterfaceInfo * System::findInterface( const QString & N ) { |
455 | InterfaceInfo * Run; | 455 | InterfaceInfo * Run; |
456 | // has PAN connection UP interface ? | 456 | // has PAN NetworkSetup UP interface ? |
457 | for( QDictIterator<InterfaceInfo> It(ProbedInterfaces); | 457 | for( QDictIterator<InterfaceInfo> It(ProbedInterfaces); |
458 | It.current(); | 458 | It.current(); |
459 | ++It ) { | 459 | ++It ) { |
460 | Run = It.current(); | 460 | Run = It.current(); |
461 | if( N == Run->Name ) { | 461 | if( N == Run->Name ) { |
462 | // this PAN connection is up | 462 | // this PAN NetworkSetup is up |
463 | return Run; | 463 | return Run; |
464 | } | 464 | } |
465 | } | 465 | } |
466 | return 0; | 466 | return 0; |
467 | } | 467 | } |
468 | 468 | ||
469 | #include <stdarg.h> | 469 | #include <stdarg.h> |
470 | static FILE * logf = 0; | 470 | static FILE * logf = 0; |
diff --git a/noncore/settings/networksettings2/networksettings2/system.h b/noncore/settings/networksettings2/networksettings2/system.h index ebee0d5..794b868 100644 --- a/noncore/settings/networksettings2/networksettings2/system.h +++ b/noncore/settings/networksettings2/networksettings2/system.h | |||
@@ -8,17 +8,17 @@ | |||
8 | using namespace Opie::Core; | 8 | using namespace Opie::Core; |
9 | 9 | ||
10 | // for hardware types | 10 | // for hardware types |
11 | #include <net/if_arp.h> | 11 | #include <net/if_arp.h> |
12 | #include <qdict.h> | 12 | #include <qdict.h> |
13 | #include <qobject.h> | 13 | #include <qobject.h> |
14 | #include <stdio.h> | 14 | #include <stdio.h> |
15 | 15 | ||
16 | class NodeCollection; | 16 | class NetworkSetup; |
17 | class ANetNodeInstance; | 17 | class ANetNodeInstance; |
18 | class QFile; | 18 | class QFile; |
19 | 19 | ||
20 | class MyProcess : public QObject { | 20 | class MyProcess : public QObject { |
21 | 21 | ||
22 | Q_OBJECT | 22 | Q_OBJECT |
23 | 23 | ||
24 | public : | 24 | public : |
@@ -61,23 +61,23 @@ public : | |||
61 | InterfaceInfo() : | 61 | InterfaceInfo() : |
62 | Name(), | 62 | Name(), |
63 | MACAddress(), | 63 | MACAddress(), |
64 | BCastAddress(), | 64 | BCastAddress(), |
65 | Netmask(), | 65 | Netmask(), |
66 | DstAddress() { | 66 | DstAddress() { |
67 | } | 67 | } |
68 | 68 | ||
69 | NodeCollection * assignedConnection() | 69 | NetworkSetup * assignedToNetworkSetup() |
70 | { return Collection; } | 70 | { return Collection; } |
71 | 71 | ||
72 | void assignConnection( NodeCollection * NNI ) | 72 | void assignToNetworkSetup( NetworkSetup * NNI ) |
73 | { Collection = NNI; } | 73 | { Collection = NNI; } |
74 | 74 | ||
75 | NodeCollection * Collection; // connection taking care of me | 75 | NetworkSetup * Collection; // networkSetup taking care of me |
76 | QString Name; // name of interface | 76 | QString Name; // name of interface |
77 | int CardType; // type of card | 77 | int CardType; // type of card |
78 | QString MACAddress; // MAC address | 78 | QString MACAddress; // MAC address |
79 | QString Address; // IP Address | 79 | QString Address; // IP Address |
80 | QString BCastAddress; // Broadcast Address | 80 | QString BCastAddress; // Broadcast Address |
81 | QString Netmask; // Netmask | 81 | QString Netmask; // Netmask |
82 | QString DstAddress; // Peer address (if P-t-P) | 82 | QString DstAddress; // Peer address (if P-t-P) |
83 | bool IsUp; // interface is UP | 83 | bool IsUp; // interface is UP |
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index 39031ed..b4622fc 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -45,24 +45,24 @@ NetworkSettingsData::NetworkSettingsData( void ) { | |||
45 | 45 | ||
46 | for ( QStringList::Iterator it = SL.begin(); | 46 | for ( QStringList::Iterator it = SL.begin(); |
47 | it != SL.end(); | 47 | it != SL.end(); |
48 | ++it ) { | 48 | ++it ) { |
49 | profilenr = atol( (*it).mid( 8 ).latin1() ); | 49 | profilenr = atol( (*it).mid( 8 ).latin1() ); |
50 | // read the interface store int 'up' | 50 | // read the interface store int 'up' |
51 | F->setName( D.path() + "/" + (*it) ); | 51 | F->setName( D.path() + "/" + (*it) ); |
52 | if( F->open( IO_ReadOnly ) ) { | 52 | if( F->open( IO_ReadOnly ) ) { |
53 | NodeCollection * NC; | 53 | NetworkSetup * NC; |
54 | interfacename = TS.readLine(); | 54 | interfacename = TS.readLine(); |
55 | F->close(); | 55 | F->close(); |
56 | 56 | ||
57 | Log(( "Assign interface %s to Profile nr %d\n", | 57 | Log(( "Assign interface %s to Profile nr %d\n", |
58 | interfacename.latin1(), profilenr )); | 58 | interfacename.latin1(), profilenr )); |
59 | 59 | ||
60 | NC = NSResources->getConnection( profilenr ); | 60 | NC = NSResources->getNetworkSetup( profilenr ); |
61 | if( NC ) { | 61 | if( NC ) { |
62 | NC->assignInterface( | 62 | NC->assignInterface( |
63 | NSResources->system().findInterface( interfacename ) ); | 63 | NSResources->system().findInterface( interfacename ) ); |
64 | Log(( "Assign interface %p\n", | 64 | Log(( "Assign interface %p\n", |
65 | NC->assignedInterface() )); | 65 | NC->assignedInterface() )); |
66 | } else { | 66 | } else { |
67 | Log(( "Profile nr %d no longer defined\n", | 67 | Log(( "Profile nr %d no longer defined\n", |
68 | profilenr )); | 68 | profilenr )); |
@@ -94,38 +94,38 @@ void NetworkSettingsData::loadSettings( void ) { | |||
94 | 94 | ||
95 | /* load the file -> | 95 | /* load the file -> |
96 | 96 | ||
97 | FORMAT : | 97 | FORMAT : |
98 | 98 | ||
99 | [NETNODETYPE] | 99 | [NETNODETYPE] |
100 | Entries ... | 100 | Entries ... |
101 | <EMPTYLINE> | 101 | <EMPTYLINE> |
102 | [connection] | 102 | [NetworkSetup] |
103 | Name=Name | 103 | Name=Name |
104 | Node=Name | 104 | Node=Name |
105 | <EMPTYLINE> | 105 | <EMPTYLINE> |
106 | */ | 106 | */ |
107 | while( ! TS.atEnd() ) { | 107 | while( ! TS.atEnd() ) { |
108 | S = Line = TS.readLine(); | 108 | S = Line = TS.readLine(); |
109 | 109 | ||
110 | if ( S.isEmpty() || S[0] != '[' ) | 110 | if ( S.isEmpty() || S[0] != '[' ) |
111 | continue; | 111 | continue; |
112 | 112 | ||
113 | S = S.mid( 1, S.length()-2 ); | 113 | S = S.mid( 1, S.length()-2 ); |
114 | 114 | ||
115 | if( ! NSResources ) { | 115 | if( ! NSResources ) { |
116 | continue; | 116 | continue; |
117 | } | 117 | } |
118 | 118 | ||
119 | if( S == "connection" ) { | 119 | if( S == "NetworkSetup" ) { |
120 | // load connections -> collections of nodes | 120 | // load NetworkSetups -> collections of nodes |
121 | bool Dangling; | 121 | bool Dangling; |
122 | NodeCollection * NC = new NodeCollection( TS, Dangling ); | 122 | NetworkSetup * NC = new NetworkSetup( TS, Dangling ); |
123 | NSResources->addConnection( NC, Dangling ); | 123 | NSResources->addNetworkSetup( NC, Dangling ); |
124 | } else { | 124 | } else { |
125 | ANetNode * NN = 0; | 125 | ANetNode * NN = 0; |
126 | ANetNodeInstance* NNI = 0; | 126 | ANetNodeInstance* NNI = 0; |
127 | if( S.startsWith( "nodetype " ) ) { | 127 | if( S.startsWith( "nodetype " ) ) { |
128 | S = S.mid( 9, S.length()-9 ); | 128 | S = S.mid( 9, S.length()-9 ); |
129 | S = deQuote(S); | 129 | S = deQuote(S); |
130 | // try to find netnode | 130 | // try to find netnode |
131 | NN = NSResources->findNetNode( S ); | 131 | NN = NSResources->findNetNode( S ); |
@@ -246,62 +246,62 @@ QString NetworkSettingsData::saveSettings( void ) { | |||
246 | << QString(NNI->nodeClass()->name()) | 246 | << QString(NNI->nodeClass()->name()) |
247 | << ']' | 247 | << ']' |
248 | << endl; | 248 | << endl; |
249 | NNI->saveAttributes( TS ); | 249 | NNI->saveAttributes( TS ); |
250 | TS << endl; | 250 | TS << endl; |
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | // good connections | 254 | // good NetworkSetups |
255 | { Name2Connection_t & M = NSResources->connections(); | 255 | { Name2NetworkSetup_t & M = NSResources->networkSetups(); |
256 | 256 | ||
257 | // for all connections | 257 | // for all NetworkSetups |
258 | for( QDictIterator<NodeCollection> it(M); | 258 | for( QDictIterator<NetworkSetup> it(M); |
259 | it.current(); | 259 | it.current(); |
260 | ++it ) { | 260 | ++it ) { |
261 | TS << "[connection]" << endl; | 261 | TS << "[NetworkSetup]" << endl; |
262 | it.current()->save(TS); | 262 | it.current()->save(TS); |
263 | } | 263 | } |
264 | } | 264 | } |
265 | 265 | ||
266 | // save dangling connections | 266 | // save dangling NetworkSetups |
267 | { Name2Connection_t & M = NSResources->danglingConnections(); | 267 | { Name2NetworkSetup_t & M = NSResources->danglingNetworkSetups(); |
268 | 268 | ||
269 | // for all connections | 269 | // for all NetworkSetups |
270 | for( QDictIterator<NodeCollection> it(M); | 270 | for( QDictIterator<NetworkSetup> it(M); |
271 | it.current(); | 271 | it.current(); |
272 | ++it ) { | 272 | ++it ) { |
273 | TS << "[connection]" << endl; | 273 | TS << "[NetworkSetup]" << endl; |
274 | it.current()->save(TS); | 274 | it.current()->save(TS); |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | QDir D("."); | 278 | QDir D("."); |
279 | D.rename( CfgFile + ".bup", CfgFile ); | 279 | D.rename( CfgFile + ".bup", CfgFile ); |
280 | 280 | ||
281 | // | 281 | // |
282 | // proper files AND system files regenerated | 282 | // proper files AND system files regenerated |
283 | // | 283 | // |
284 | 284 | ||
285 | 285 | ||
286 | for( QDictIterator<NodeCollection> it(NSResources->connections()); | 286 | for( QDictIterator<NetworkSetup> it(NSResources->networkSetups()); |
287 | it.current(); | 287 | it.current(); |
288 | ++it ) { | 288 | ++it ) { |
289 | it.current()->setModified( 0 ); | 289 | it.current()->setModified( 0 ); |
290 | } | 290 | } |
291 | 291 | ||
292 | return ErrS; | 292 | return ErrS; |
293 | } | 293 | } |
294 | 294 | ||
295 | QString NetworkSettingsData::generateSettings( void ) { | 295 | QString NetworkSettingsData::generateSettings( void ) { |
296 | QString S = ""; | 296 | QString S = ""; |
297 | Name2SystemFile_t & SFM = NSResources->systemFiles(); | 297 | Name2SystemFile_t & SFM = NSResources->systemFiles(); |
298 | Name2Connection_t & M = NSResources->connections(); | 298 | Name2NetworkSetup_t & M = NSResources->networkSetups(); |
299 | NodeCollection * NC; | 299 | NetworkSetup * NC; |
300 | ANetNodeInstance * NNI; | 300 | ANetNodeInstance * NNI; |
301 | ANetNodeInstance * FirstWithData; | 301 | ANetNodeInstance * FirstWithData; |
302 | RuntimeInfo * CurDev; | 302 | RuntimeInfo * CurDev; |
303 | ANetNode * NN, * CurDevNN = 0; | 303 | ANetNode * NN, * CurDevNN = 0; |
304 | long NoOfDevs; | 304 | long NoOfDevs; |
305 | long DevCtStart; | 305 | long DevCtStart; |
306 | bool needToGenerate; | 306 | bool needToGenerate; |
307 | 307 | ||
@@ -423,17 +423,17 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
423 | 423 | ||
424 | for( QDictIterator<ANetNodeInstance> nniit( | 424 | for( QDictIterator<ANetNodeInstance> nniit( |
425 | NSResources->netNodeInstances() ); | 425 | NSResources->netNodeInstances() ); |
426 | nniit.current(); | 426 | nniit.current(); |
427 | ++nniit ) { | 427 | ++nniit ) { |
428 | nniit.current()->setDone(0); | 428 | nniit.current()->setDone(0); |
429 | } | 429 | } |
430 | 430 | ||
431 | for( QDictIterator<NodeCollection> ncit(M); | 431 | for( QDictIterator<NetworkSetup> ncit(M); |
432 | ncit.current(); | 432 | ncit.current(); |
433 | ++ncit ) { | 433 | ++ncit ) { |
434 | ncit.current()->setDone(0); | 434 | ncit.current()->setDone(0); |
435 | } | 435 | } |
436 | 436 | ||
437 | Log( ( "Generating system file %s\n", SF->name().latin1() )); | 437 | Log( ( "Generating system file %s\n", SF->name().latin1() )); |
438 | 438 | ||
439 | needToGenerate = 0; | 439 | needToGenerate = 0; |
@@ -483,39 +483,39 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
483 | // global presection for this system file | 483 | // global presection for this system file |
484 | if( ! SF->preSection() ) { | 484 | if( ! SF->preSection() ) { |
485 | S = qApp->translate( "NetworkSettings", | 485 | S = qApp->translate( "NetworkSettings", |
486 | "<p>Error in section \"Preamble\" for file \"%1\"</p>" ). | 486 | "<p>Error in section \"Preamble\" for file \"%1\"</p>" ). |
487 | arg( SF->name() ); | 487 | arg( SF->name() ); |
488 | return S; | 488 | return S; |
489 | } | 489 | } |
490 | 490 | ||
491 | // find connections that want to write to this file | 491 | // find NetworkSetups that want to write to this file |
492 | for( QDictIterator<NodeCollection> ncit(M); | 492 | for( QDictIterator<NetworkSetup> ncit(M); |
493 | ncit.current(); | 493 | ncit.current(); |
494 | ++ncit ) { | 494 | ++ncit ) { |
495 | 495 | ||
496 | NC = ncit.current(); | 496 | NC = ncit.current(); |
497 | 497 | ||
498 | if( NC->done() ) { | 498 | if( NC->done() ) { |
499 | // already done | 499 | // already done |
500 | continue; | 500 | continue; |
501 | } | 501 | } |
502 | 502 | ||
503 | if( ! NC->hasDataForFile( *SF ) ) { | 503 | if( ! NC->hasDataForFile( *SF ) ) { |
504 | // no data | 504 | // no data |
505 | continue; | 505 | continue; |
506 | } | 506 | } |
507 | 507 | ||
508 | Log(("Generating %s for connection %s\n", | 508 | Log(("Generating %s for NetworkSetup %s\n", |
509 | SF->name().latin1(), NC->name().latin1() )); | 509 | SF->name().latin1(), NC->name().latin1() )); |
510 | // find highest item that wants to write data to this file | 510 | // find highest item that wants to write data to this file |
511 | FirstWithData = NC->firstWithDataForFile( *SF ); | 511 | FirstWithData = NC->firstWithDataForFile( *SF ); |
512 | 512 | ||
513 | // find device on which this connection works | 513 | // find device on which this NetworkSetup works |
514 | CurDev = NC->device(); | 514 | CurDev = NC->device(); |
515 | // class of that node | 515 | // class of that node |
516 | CurDevNN = CurDev->netNode()->nodeClass(); | 516 | CurDevNN = CurDev->netNode()->nodeClass(); |
517 | 517 | ||
518 | if( ! FirstWithData->nodeClass()->done() ) { | 518 | if( ! FirstWithData->nodeClass()->done() ) { |
519 | // generate fixed part | 519 | // generate fixed part |
520 | if( ! SF->preDeviceSection( CurDevNN ) ) { | 520 | if( ! SF->preDeviceSection( CurDevNN ) ) { |
521 | S = qApp->translate( "NetworkSettings", | 521 | S = qApp->translate( "NetworkSettings", |
@@ -566,27 +566,27 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
566 | 566 | ||
567 | Log(( "Systemfile %s for Nodeclass %s is done\n", | 567 | Log(( "Systemfile %s for Nodeclass %s is done\n", |
568 | SF->name().latin1(), | 568 | SF->name().latin1(), |
569 | CurDev->netNode()->nodeClass()->name() | 569 | CurDev->netNode()->nodeClass()->name() |
570 | )); | 570 | )); |
571 | } | 571 | } |
572 | 572 | ||
573 | // generate profile specific info | 573 | // generate profile specific info |
574 | // for all nodeconnections that work on the same device | 574 | // for all nodeNetworkSetups that work on the same device |
575 | for( QDictIterator<NodeCollection> ncit2(M); | 575 | for( QDictIterator<NetworkSetup> ncit2(M); |
576 | ncit2.current(); | 576 | ncit2.current(); |
577 | ++ncit2 ) { | 577 | ++ncit2 ) { |
578 | 578 | ||
579 | if( ncit2.current()->device() != CurDev ) { | 579 | if( ncit2.current()->device() != CurDev ) { |
580 | // different device | 580 | // different device |
581 | continue; | 581 | continue; |
582 | } | 582 | } |
583 | 583 | ||
584 | Log(("Connection %s of family %s\n", | 584 | Log(("NetworkSetup %s of family %s\n", |
585 | ncit2.current()->name().latin1(), | 585 | ncit2.current()->name().latin1(), |
586 | CurDev->name() )); | 586 | CurDev->name() )); |
587 | // generate | 587 | // generate |
588 | NNI = ncit2.current()->firstWithDataForFile( *SF ); | 588 | NNI = ncit2.current()->firstWithDataForFile( *SF ); |
589 | for( int i = DevCtStart; i < NoOfDevs ; i ++ ) { | 589 | for( int i = DevCtStart; i < NoOfDevs ; i ++ ) { |
590 | if( ! SF->preNodeSection( NNI, i ) ) { | 590 | if( ! SF->preNodeSection( NNI, i ) ) { |
591 | S = qApp->translate( "NetworkSettings", | 591 | S = qApp->translate( "NetworkSettings", |
592 | "<p>Error in \"Pre-Node Part\" for file \"%1\" and node \"%2\"</p>" ). | 592 | "<p>Error in \"Pre-Node Part\" for file \"%1\" and node \"%2\"</p>" ). |
@@ -640,62 +640,62 @@ QString NetworkSettingsData::generateSettings( void ) { | |||
640 | } | 640 | } |
641 | 641 | ||
642 | // end of file | 642 | // end of file |
643 | SF->close(); | 643 | SF->close(); |
644 | } | 644 | } |
645 | return S; | 645 | return S; |
646 | } | 646 | } |
647 | 647 | ||
648 | QList<NodeCollection> NetworkSettingsData::collectPossible( | 648 | QList<NetworkSetup> NetworkSettingsData::collectPossible( |
649 | const QString & Interface ) { | 649 | const QString & Interface ) { |
650 | // collect connections that can work on top of this interface | 650 | // collect NetworkSetups that can work on top of this interface |
651 | NodeCollection * NC; | 651 | NetworkSetup * NC; |
652 | QList<NodeCollection> PossibleConnections; | 652 | QList<NetworkSetup> PossibleNetworkSetups; |
653 | Name2Connection_t & M = NSResources->connections(); | 653 | Name2NetworkSetup_t & M = NSResources->networkSetups(); |
654 | 654 | ||
655 | // for all connections | 655 | // for all NetworkSetups |
656 | for( QDictIterator<NodeCollection> it(M); | 656 | for( QDictIterator<NetworkSetup> it(M); |
657 | it.current(); | 657 | it.current(); |
658 | ++it ) { | 658 | ++it ) { |
659 | NC = it.current(); | 659 | NC = it.current(); |
660 | // check if this profile handles the requested interface | 660 | // check if this profile handles the requested interface |
661 | if( NC->handlesInterface( Interface ) && // if different Intf. | 661 | if( NC->handlesInterface( Interface ) && // if different Intf. |
662 | NC->state() != Disabled && // if enabled | 662 | NC->state() != Disabled && // if enabled |
663 | NC->state() != IsUp // if already used | 663 | NC->state() != IsUp // if already used |
664 | ) { | 664 | ) { |
665 | Log( ( "Append %s for %s\n", | 665 | Log( ( "Append %s for %s\n", |
666 | NC->name().latin1(), Interface.latin1() )); | 666 | NC->name().latin1(), Interface.latin1() )); |
667 | PossibleConnections.append( NC ); | 667 | PossibleNetworkSetups.append( NC ); |
668 | } | 668 | } |
669 | } | 669 | } |
670 | return PossibleConnections; | 670 | return PossibleNetworkSetups; |
671 | } | 671 | } |
672 | 672 | ||
673 | 673 | ||
674 | /* | 674 | /* |
675 | Called by the system to see if interface can be brought UP | 675 | Called by the system to see if interface can be brought UP |
676 | 676 | ||
677 | if allowed, echo Interface-allowed else Interface-disallowed | 677 | if allowed, echo Interface-allowed else Interface-disallowed |
678 | */ | 678 | */ |
679 | 679 | ||
680 | bool NetworkSettingsData::canStart( const QString & Interface ) { | 680 | bool NetworkSettingsData::canStart( const QString & Interface ) { |
681 | // load situation | 681 | // load situation |
682 | NodeCollection * NC = 0; | 682 | NetworkSetup * NC = 0; |
683 | QList<NodeCollection> PossibleConnections; | 683 | QList<NetworkSetup> PossibleNetworkSetups; |
684 | 684 | ||
685 | PossibleConnections = collectPossible( Interface ); | 685 | PossibleNetworkSetups = collectPossible( Interface ); |
686 | 686 | ||
687 | Log( ( "for %s : Possiblilies %d\n", | 687 | Log( ( "for %s : Possiblilies %d\n", |
688 | Interface.latin1(), PossibleConnections.count() )); | 688 | Interface.latin1(), PossibleNetworkSetups.count() )); |
689 | switch( PossibleConnections.count() ) { | 689 | switch( PossibleNetworkSetups.count() ) { |
690 | case 0 : // no connections | 690 | case 0 : // no NetworkSetups |
691 | break; | 691 | break; |
692 | case 1 : // one connection | 692 | case 1 : // one NetworkSetup |
693 | NC = PossibleConnections.first(); | 693 | NC = PossibleNetworkSetups.first(); |
694 | break; | 694 | break; |
695 | default : // need to ask user ? | 695 | default : // need to ask user ? |
696 | return 1; | 696 | return 1; |
697 | } | 697 | } |
698 | 698 | ||
699 | if( NC ) { | 699 | if( NC ) { |
700 | switch( NC->state() ) { | 700 | switch( NC->state() ) { |
701 | case Unchecked : | 701 | case Unchecked : |
@@ -731,49 +731,49 @@ bool NetworkSettingsData::canStart( const QString & Interface ) { | |||
731 | printf( "D-%s\n", Interface.latin1() ); | 731 | printf( "D-%s\n", Interface.latin1() ); |
732 | return 0; | 732 | return 0; |
733 | } | 733 | } |
734 | 734 | ||
735 | bool NetworkSettingsData::isModified( void ) { | 735 | bool NetworkSettingsData::isModified( void ) { |
736 | if( ForceModified ) | 736 | if( ForceModified ) |
737 | return 1; | 737 | return 1; |
738 | 738 | ||
739 | for( QDictIterator<NodeCollection> it(NSResources->connections()); | 739 | for( QDictIterator<NetworkSetup> it(NSResources->networkSetups()); |
740 | it.current(); | 740 | it.current(); |
741 | ++it ) { | 741 | ++it ) { |
742 | if( it.current()->isModified() ) { | 742 | if( it.current()->isModified() ) { |
743 | return 1; | 743 | return 1; |
744 | } | 744 | } |
745 | } | 745 | } |
746 | return 0; | 746 | return 0; |
747 | } | 747 | } |
748 | 748 | ||
749 | bool NetworkSettingsData::couldBeTriggered( const QString & Interface ) { | 749 | bool NetworkSettingsData::couldBeTriggered( const QString & Interface ) { |
750 | // load situation | 750 | // load situation |
751 | QList<NodeCollection> PossibleTriggered; | 751 | QList<NetworkSetup> PossibleTriggered; |
752 | 752 | ||
753 | PossibleTriggered = collectTriggered( Interface ); | 753 | PossibleTriggered = collectTriggered( Interface ); |
754 | 754 | ||
755 | Log( ( "for %s : Possiblilies %d\n", | 755 | Log( ( "for %s : Possiblilies %d\n", |
756 | Interface.latin1(), PossibleTriggered.count() )); | 756 | Interface.latin1(), PossibleTriggered.count() )); |
757 | 757 | ||
758 | return ( PossibleTriggered.count() ) ? 1 : 0; | 758 | return ( PossibleTriggered.count() ) ? 1 : 0; |
759 | } | 759 | } |
760 | 760 | ||
761 | QList<NodeCollection> NetworkSettingsData::collectTriggered( | 761 | QList<NetworkSetup> NetworkSettingsData::collectTriggered( |
762 | const QString & Interface ) { | 762 | const QString & Interface ) { |
763 | 763 | ||
764 | // collect connections that could be triggered by this interface | 764 | // collect NetworkSetups that could be triggered by this interface |
765 | NodeCollection * NC; | 765 | NetworkSetup * NC; |
766 | QList<NodeCollection> PossibleTriggered; | 766 | QList<NetworkSetup> PossibleTriggered; |
767 | 767 | ||
768 | // for all connections | 768 | // for all NetworkSetups |
769 | Name2Connection_t & M = NSResources->connections(); | 769 | Name2NetworkSetup_t & M = NSResources->networkSetups(); |
770 | 770 | ||
771 | for( QDictIterator<NodeCollection> it(M); | 771 | for( QDictIterator<NetworkSetup> it(M); |
772 | it.current(); | 772 | it.current(); |
773 | ++it ) { | 773 | ++it ) { |
774 | NC = it.current(); | 774 | NC = it.current(); |
775 | // check if this profile handles the requested interface | 775 | // check if this profile handles the requested interface |
776 | if( NC->triggeredBy( Interface ) && // if different Intf. | 776 | if( NC->triggeredBy( Interface ) && // if different Intf. |
777 | NC->state() != Disabled && // if enabled | 777 | NC->state() != Disabled && // if enabled |
778 | NC->state() != IsUp // if already used | 778 | NC->state() != IsUp // if already used |
779 | ) { | 779 | ) { |
diff --git a/noncore/settings/networksettings2/nsdata.h b/noncore/settings/networksettings2/nsdata.h index 5791c1e..b9c216d 100644 --- a/noncore/settings/networksettings2/nsdata.h +++ b/noncore/settings/networksettings2/nsdata.h | |||
@@ -14,25 +14,25 @@ public : | |||
14 | QString saveSettings( void ); | 14 | QString saveSettings( void ); |
15 | 15 | ||
16 | QString generateSettings( void ); | 16 | QString generateSettings( void ); |
17 | 17 | ||
18 | bool isModified( void ); | 18 | bool isModified( void ); |
19 | inline void setModified( bool M ) | 19 | inline void setModified( bool M ) |
20 | { ForceModified = M; } | 20 | { ForceModified = M; } |
21 | 21 | ||
22 | QList<NodeCollection> collectPossible( const QString & Interface ); | 22 | QList<NetworkSetup> collectPossible( const QString & Interface ); |
23 | // return TRUE if we need gui to decide | 23 | // return TRUE if we need gui to decide |
24 | bool canStart( const QString & Interface ); | 24 | bool canStart( const QString & Interface ); |
25 | // return TRUE if there are vpns that could be triggered | 25 | // return TRUE if there are vpns that could be triggered |
26 | // by this interface | 26 | // by this interface |
27 | bool couldBeTriggered( const QString & Interface ); | 27 | bool couldBeTriggered( const QString & Interface ); |
28 | 28 | ||
29 | private : | 29 | private : |
30 | 30 | ||
31 | QList<NodeCollection> collectTriggered( const QString &Interface ); | 31 | QList<NetworkSetup> collectTriggered( const QString &Interface ); |
32 | bool ForceModified; | 32 | bool ForceModified; |
33 | 33 | ||
34 | // collect strings in config file nobody wants | 34 | // collect strings in config file nobody wants |
35 | QStringList LeftOvers; | 35 | QStringList LeftOvers; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | #endif | 38 | #endif |
diff --git a/noncore/settings/networksettings2/opietooth2/OTDriver.cpp b/noncore/settings/networksettings2/opietooth2/OTDriver.cpp index a7ee662..cfd0491 100644 --- a/noncore/settings/networksettings2/opietooth2/OTDriver.cpp +++ b/noncore/settings/networksettings2/opietooth2/OTDriver.cpp | |||
@@ -708,17 +708,17 @@ long OTDriver::getLinkQuality( const OTDeviceAddress & Addr ) { | |||
708 | sizeof(*cr) + sizeof(struct hci_conn_info)); | 708 | sizeof(*cr) + sizeof(struct hci_conn_info)); |
709 | if (!cr) | 709 | if (!cr) |
710 | return 0; | 710 | return 0; |
711 | 711 | ||
712 | bacpy( &(cr->bdaddr), &(Addr.getBDAddr()) ); | 712 | bacpy( &(cr->bdaddr), &(Addr.getBDAddr()) ); |
713 | cr->type = ACL_LINK; | 713 | cr->type = ACL_LINK; |
714 | 714 | ||
715 | if (ioctl( fd(), HCIGETCONNINFO, (unsigned long) cr) < 0) { | 715 | if (ioctl( fd(), HCIGETCONNINFO, (unsigned long) cr) < 0) { |
716 | odebug << "Get connection info failed" << oendl; | 716 | odebug << "Get NetworkSetup info failed" << oendl; |
717 | free(cr); | 717 | free(cr); |
718 | return 0; | 718 | return 0; |
719 | } | 719 | } |
720 | 720 | ||
721 | handle = htobs(cr->conn_info->handle); | 721 | handle = htobs(cr->conn_info->handle); |
722 | 722 | ||
723 | free(cr); | 723 | free(cr); |
724 | 724 | ||
@@ -726,17 +726,17 @@ long OTDriver::getLinkQuality( const OTDeviceAddress & Addr ) { | |||
726 | rq.ogf = OGF_STATUS_PARAM; | 726 | rq.ogf = OGF_STATUS_PARAM; |
727 | rq.ocf = OCF_READ_RSSI; | 727 | rq.ocf = OCF_READ_RSSI; |
728 | rq.cparam = &handle; | 728 | rq.cparam = &handle; |
729 | rq.clen = 2; | 729 | rq.clen = 2; |
730 | rq.rparam = &rp; | 730 | rq.rparam = &rp; |
731 | rq.rlen = GET_LINK_QUALITY_RP_SIZE; | 731 | rq.rlen = GET_LINK_QUALITY_RP_SIZE; |
732 | 732 | ||
733 | if (hci_send_req( fd(), &rq, 100) < 0) { | 733 | if (hci_send_req( fd(), &rq, 100) < 0) { |
734 | odebug << "Get connection info failed" << oendl; | 734 | odebug << "Get NetworkSetup info failed" << oendl; |
735 | return 0; | 735 | return 0; |
736 | } | 736 | } |
737 | 737 | ||
738 | if( rp.status ) { | 738 | if( rp.status ) { |
739 | odebug << QString().sprintf("HCI get_link_quality cmd failed (0x%2.2X)", rp.status) << oendl; | 739 | odebug << QString().sprintf("HCI get_link_quality cmd failed (0x%2.2X)", rp.status) << oendl; |
740 | return 0; | 740 | return 0; |
741 | } | 741 | } |
742 | 742 | ||
diff --git a/noncore/settings/networksettings2/opietooth2/OTDriver.h b/noncore/settings/networksettings2/opietooth2/OTDriver.h index b54ffdf..899fab4 100644 --- a/noncore/settings/networksettings2/opietooth2/OTDriver.h +++ b/noncore/settings/networksettings2/opietooth2/OTDriver.h | |||
@@ -7,17 +7,17 @@ | |||
7 | * the Free Software Foundation; either version 2 of the License, or * | 7 | * the Free Software Foundation; either version 2 of the License, or * |
8 | * (at your option) any later version. * | 8 | * (at your option) any later version. * |
9 | ***************************************************************************/ | 9 | ***************************************************************************/ |
10 | 10 | ||
11 | #ifndef OTDRIVER_H | 11 | #ifndef OTDRIVER_H |
12 | #define OTDRIVER_H | 12 | #define OTDRIVER_H |
13 | 13 | ||
14 | /* | 14 | /* |
15 | * This class handles the connection with the BlueZ libraries, implements | 15 | * This class handles the networkSetup with the BlueZ libraries, implements |
16 | * most of the bluetooth-related functions and owns the KBTDevice class | 16 | * most of the bluetooth-related functions and owns the KBTDevice class |
17 | * that is a single local bluetooth device representation. | 17 | * that is a single local bluetooth device representation. |
18 | * It is used as a Singleton pattern thru the getDefaultConnector() method. | 18 | * It is used as a Singleton pattern thru the getDefaultConnector() method. |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | #include <qobject.h> | 21 | #include <qobject.h> |
22 | #include <opie2/odebug.h> | 22 | #include <opie2/odebug.h> |
23 | #include <bluezlib.h> | 23 | #include <bluezlib.h> |
@@ -113,17 +113,17 @@ public: | |||
113 | * Returns the string representation of the device id, | 113 | * Returns the string representation of the device id, |
114 | * with the same format of the hciconfig tool. | 114 | * with the same format of the hciconfig tool. |
115 | */ | 115 | */ |
116 | QString devname() | 116 | QString devname() |
117 | { return Dev; }; | 117 | { return Dev; }; |
118 | 118 | ||
119 | /* | 119 | /* |
120 | * Returns the file descriptor for the local | 120 | * Returns the file descriptor for the local |
121 | * connection to this device | 121 | * networkSetup to this device |
122 | */ | 122 | */ |
123 | int fd() const | 123 | int fd() const |
124 | { return Fd; }; | 124 | { return Fd; }; |
125 | void setfd(int _fd) | 125 | void setfd(int _fd) |
126 | { Fd = _fd; }; | 126 | { Fd = _fd; }; |
127 | 127 | ||
128 | void setType(int _type) | 128 | void setType(int _type) |
129 | { Type = _type; }; | 129 | { Type = _type; }; |
diff --git a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp index 1b61a2e..7fc8719 100644 --- a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp +++ b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp | |||
@@ -57,19 +57,19 @@ OTGateway::OTGateway( void ) : QObject( 0, "OTGateway" ), | |||
57 | } | 57 | } |
58 | 58 | ||
59 | // load all known devices | 59 | // load all known devices |
60 | updateDrivers(); | 60 | updateDrivers(); |
61 | 61 | ||
62 | // load all peers we have ever seen | 62 | // load all peers we have ever seen |
63 | loadKnownPeers(); | 63 | loadKnownPeers(); |
64 | 64 | ||
65 | // iterate over drivers and find active connections | 65 | // iterate over drivers and find active NetworkSetups |
66 | // adding/updating peers | 66 | // adding/updating peers |
67 | loadActiveConnections(); | 67 | loadActiveNetworkSetups(); |
68 | 68 | ||
69 | // check every 4 seconds the state of BT | 69 | // check every 4 seconds the state of BT |
70 | timerEvent(0); | 70 | timerEvent(0); |
71 | RefreshTimer = -1; | 71 | RefreshTimer = -1; |
72 | setRefreshTimer( 4000 ); | 72 | setRefreshTimer( 4000 ); |
73 | 73 | ||
74 | // load known link keys | 74 | // load known link keys |
75 | readLinkKeys(); | 75 | readLinkKeys(); |
@@ -370,43 +370,43 @@ const char * OTGateway::deviceTypeToName( int cls ) { | |||
370 | return "imaging"; | 370 | return "imaging"; |
371 | case 0x07: | 371 | case 0x07: |
372 | default : | 372 | default : |
373 | break; | 373 | break; |
374 | } | 374 | } |
375 | return "unknown"; | 375 | return "unknown"; |
376 | } | 376 | } |
377 | 377 | ||
378 | PANConnectionVector OTGateway::getPANConnections( void ) { | 378 | PANNetworkSetupVector OTGateway::getPANNetworkSetups( void ) { |
379 | PANConnectionVector V; | 379 | PANNetworkSetupVector V; |
380 | 380 | ||
381 | struct bnep_connlist_req req; | 381 | struct bnep_connlist_req req; |
382 | struct bnep_conninfo ci[48]; | 382 | struct bnep_conninfo ci[48]; |
383 | 383 | ||
384 | V.setAutoDelete(TRUE); | 384 | V.setAutoDelete(TRUE); |
385 | 385 | ||
386 | int ctl = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_BNEP); | 386 | int ctl = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_BNEP); |
387 | if (ctl < 0) { | 387 | if (ctl < 0) { |
388 | odebug << "Failed to open control socket" << oendl; | 388 | odebug << "Failed to open control socket" << oendl; |
389 | return V; | 389 | return V; |
390 | } | 390 | } |
391 | 391 | ||
392 | req.cnum = 48; | 392 | req.cnum = 48; |
393 | req.ci = ci; | 393 | req.ci = ci; |
394 | if (ioctl(ctl, BNEPGETCONNLIST, &req)) { | 394 | if (ioctl(ctl, BNEPGETCONNLIST, &req)) { |
395 | odebug << "Failed to get connection list" << oendl; | 395 | odebug << "Failed to get NetworkSetup list" << oendl; |
396 | ::close( ctl ); | 396 | ::close( ctl ); |
397 | return V; | 397 | return V; |
398 | } | 398 | } |
399 | 399 | ||
400 | for ( unsigned i=0; i < req.cnum; i++) { | 400 | for ( unsigned i=0; i < req.cnum; i++) { |
401 | V.resize( V.size() + 1 ); | 401 | V.resize( V.size() + 1 ); |
402 | if( ci[i].role == BNEP_SVC_PANU ) { | 402 | if( ci[i].role == BNEP_SVC_PANU ) { |
403 | // we are the client | 403 | // we are the client |
404 | V.insert( V.size()-1, new OTPANConnection( | 404 | V.insert( V.size()-1, new OTPANNetworkSetup( |
405 | ci[i].device, | 405 | ci[i].device, |
406 | batostr((bdaddr_t *) ci[i].dst) | 406 | batostr((bdaddr_t *) ci[i].dst) |
407 | ) ); | 407 | ) ); |
408 | } | 408 | } |
409 | } | 409 | } |
410 | 410 | ||
411 | ::close( ctl ); | 411 | ::close( ctl ); |
412 | return V; | 412 | return V; |
@@ -505,17 +505,17 @@ bool OTGateway::removeLinkKey( unsigned int Index ) { | |||
505 | 505 | ||
506 | // remove last element | 506 | // remove last element |
507 | AllKeys.resize( AllKeys.size()-1 ); | 507 | AllKeys.resize( AllKeys.size()-1 ); |
508 | 508 | ||
509 | return 1; | 509 | return 1; |
510 | } | 510 | } |
511 | 511 | ||
512 | #define MAXCONNECTIONS 10 | 512 | #define MAXCONNECTIONS 10 |
513 | void OTGateway::loadActiveConnections( void ) { | 513 | void OTGateway::loadActiveNetworkSetups( void ) { |
514 | 514 | ||
515 | struct hci_conn_list_req *cl; | 515 | struct hci_conn_list_req *cl; |
516 | struct hci_conn_info *ci; | 516 | struct hci_conn_info *ci; |
517 | OTDeviceAddress Addr; | 517 | OTDeviceAddress Addr; |
518 | OTPeer * P; | 518 | OTPeer * P; |
519 | 519 | ||
520 | if (!(cl = (struct hci_conn_list_req *)malloc( | 520 | if (!(cl = (struct hci_conn_list_req *)malloc( |
521 | MAXCONNECTIONS * sizeof(*ci) + sizeof(*cl)))) { | 521 | MAXCONNECTIONS * sizeof(*ci) + sizeof(*cl)))) { |
@@ -527,23 +527,23 @@ void OTGateway::loadActiveConnections( void ) { | |||
527 | for( unsigned int i = 0; | 527 | for( unsigned int i = 0; |
528 | i < AllDrivers.count(); | 528 | i < AllDrivers.count(); |
529 | i ++ ) { | 529 | i ++ ) { |
530 | 530 | ||
531 | if( ! AllDrivers[i]->isUp() ) { | 531 | if( ! AllDrivers[i]->isUp() ) { |
532 | continue; | 532 | continue; |
533 | } | 533 | } |
534 | 534 | ||
535 | // driver is up -> check connections | 535 | // driver is up -> check NetworkSetups |
536 | cl->dev_id = AllDrivers[i]->devId(); | 536 | cl->dev_id = AllDrivers[i]->devId(); |
537 | cl->conn_num = MAXCONNECTIONS; | 537 | cl->conn_num = MAXCONNECTIONS; |
538 | ci = cl->conn_info; | 538 | ci = cl->conn_info; |
539 | 539 | ||
540 | if (ioctl( getSocket(), HCIGETCONNLIST, (void *) cl)) { | 540 | if (ioctl( getSocket(), HCIGETCONNLIST, (void *) cl)) { |
541 | emit error( tr("Can't get connection list") ); | 541 | emit error( tr("Can't get NetworkSetup list") ); |
542 | break; | 542 | break; |
543 | } | 543 | } |
544 | 544 | ||
545 | for ( int k = 0; k < cl->conn_num; k++, ci++) { | 545 | for ( int k = 0; k < cl->conn_num; k++, ci++) { |
546 | 546 | ||
547 | if( ci->state != BT_CONNECTED ) { | 547 | if( ci->state != BT_CONNECTED ) { |
548 | // not yet connected | 548 | // not yet connected |
549 | continue; | 549 | continue; |
@@ -748,17 +748,17 @@ int OTGateway::releaseRFCommDevice( int devnr ) { | |||
748 | emit error( tr("Can't get device list") ); | 748 | emit error( tr("Can't get device list") ); |
749 | ::close( s ); | 749 | ::close( s ); |
750 | return 0; | 750 | return 0; |
751 | } | 751 | } |
752 | 752 | ||
753 | dr = di; | 753 | dr = di; |
754 | for (i = 0; i < dl->dev_num; i++, dr++) { | 754 | for (i = 0; i < dl->dev_num; i++, dr++) { |
755 | if( dr->id == devnr ) { | 755 | if( dr->id == devnr ) { |
756 | // still in connection list | 756 | // still in NetworkSetup list |
757 | struct rfcomm_dev_req req; | 757 | struct rfcomm_dev_req req; |
758 | int err; | 758 | int err; |
759 | 759 | ||
760 | memset(&req, 0, sizeof(req)); | 760 | memset(&req, 0, sizeof(req)); |
761 | req.dev_id = devnr; | 761 | req.dev_id = devnr; |
762 | 762 | ||
763 | if ((err = ioctl(s, RFCOMMRELEASEDEV, &req)) < 0 ) { | 763 | if ((err = ioctl(s, RFCOMMRELEASEDEV, &req)) < 0 ) { |
764 | return err; | 764 | return err; |
diff --git a/noncore/settings/networksettings2/opietooth2/OTGateway.h b/noncore/settings/networksettings2/opietooth2/OTGateway.h index 11c6b30..d0e42db 100644 --- a/noncore/settings/networksettings2/opietooth2/OTGateway.h +++ b/noncore/settings/networksettings2/opietooth2/OTGateway.h | |||
@@ -12,21 +12,21 @@ class QPixmap; | |||
12 | 12 | ||
13 | namespace Opietooth2 { | 13 | namespace Opietooth2 { |
14 | 14 | ||
15 | class OTDriverList; | 15 | class OTDriverList; |
16 | class OTDriver; | 16 | class OTDriver; |
17 | class OTDevice; | 17 | class OTDevice; |
18 | class OTPeer; | 18 | class OTPeer; |
19 | class OTInquiry; | 19 | class OTInquiry; |
20 | class OTPANConnection; | 20 | class OTPANNetworkSetup; |
21 | class OTLinkKey; | 21 | class OTLinkKey; |
22 | 22 | ||
23 | typedef QVector<OTPeer> PeerVector; | 23 | typedef QVector<OTPeer> PeerVector; |
24 | typedef QVector<OTPANConnection> PANConnectionVector; | 24 | typedef QVector<OTPANNetworkSetup> PANNetworkSetupVector; |
25 | typedef QArray<OTLinkKey> LinkKeyArray; | 25 | typedef QArray<OTLinkKey> LinkKeyArray; |
26 | 26 | ||
27 | class OTLinkKey { | 27 | class OTLinkKey { |
28 | 28 | ||
29 | public : | 29 | public : |
30 | 30 | ||
31 | OTLinkKey( const OTDeviceAddress & F, | 31 | OTLinkKey( const OTDeviceAddress & F, |
32 | const OTDeviceAddress & T ) { | 32 | const OTDeviceAddress & T ) { |
@@ -38,21 +38,21 @@ public : | |||
38 | { return To; } | 38 | { return To; } |
39 | const OTDeviceAddress & from() | 39 | const OTDeviceAddress & from() |
40 | { return From; } | 40 | { return From; } |
41 | 41 | ||
42 | OTDeviceAddress From; | 42 | OTDeviceAddress From; |
43 | OTDeviceAddress To; | 43 | OTDeviceAddress To; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | class OTPANConnection { | 46 | class OTPANNetworkSetup { |
47 | 47 | ||
48 | public : | 48 | public : |
49 | 49 | ||
50 | OTPANConnection( const QString & Dev, const QString & CT ) { | 50 | OTPANNetworkSetup( const QString & Dev, const QString & CT ) { |
51 | Device = Dev; | 51 | Device = Dev; |
52 | ConnectedTo = CT; | 52 | ConnectedTo = CT; |
53 | } | 53 | } |
54 | 54 | ||
55 | QString Device; | 55 | QString Device; |
56 | QString ConnectedTo; | 56 | QString ConnectedTo; |
57 | }; | 57 | }; |
58 | 58 | ||
@@ -87,17 +87,17 @@ public : | |||
87 | { return HciCtl; } | 87 | { return HciCtl; } |
88 | 88 | ||
89 | OTDriverList & getDriverList() | 89 | OTDriverList & getDriverList() |
90 | { return AllDrivers; } | 90 | { return AllDrivers; } |
91 | OTDriver * driver( int nr ) | 91 | OTDriver * driver( int nr ) |
92 | { return AllDrivers.count() == 0 ? 0 : AllDrivers[nr]; } | 92 | { return AllDrivers.count() == 0 ? 0 : AllDrivers[nr]; } |
93 | void updateDrivers(); | 93 | void updateDrivers(); |
94 | 94 | ||
95 | PANConnectionVector getPANConnections(); | 95 | PANNetworkSetupVector getPANNetworkSetups(); |
96 | 96 | ||
97 | // scan neighbourhood using device | 97 | // scan neighbourhood using device |
98 | void scanNeighbourhood( OTDriver * D = 0 ); | 98 | void scanNeighbourhood( OTDriver * D = 0 ); |
99 | void stopScanOfNeighbourhood(void ); | 99 | void stopScanOfNeighbourhood(void ); |
100 | void setScanWith( OTDriver * D = 0 ) | 100 | void setScanWith( OTDriver * D = 0 ) |
101 | { ScanWith = (D) ? D : | 101 | { ScanWith = (D) ? D : |
102 | (AllDrivers.count() ) ? AllDrivers[0] : 0; } | 102 | (AllDrivers.count() ) ? AllDrivers[0] : 0; } |
103 | OTDriver * scanWith( void ) | 103 | OTDriver * scanWith( void ) |
@@ -168,17 +168,17 @@ protected : | |||
168 | 168 | ||
169 | void connectNotify( const char * Signal ); | 169 | void connectNotify( const char * Signal ); |
170 | void disconnectNotify( const char * Signal ); | 170 | void disconnectNotify( const char * Signal ); |
171 | 171 | ||
172 | void timerEvent( QTimerEvent * ); | 172 | void timerEvent( QTimerEvent * ); |
173 | 173 | ||
174 | private : | 174 | private : |
175 | 175 | ||
176 | void loadActiveConnections( void ); | 176 | void loadActiveNetworkSetups( void ); |
177 | void loadKnownPeers( void ); | 177 | void loadKnownPeers( void ); |
178 | void saveKnownPeers( void ); | 178 | void saveKnownPeers( void ); |
179 | bool isConnectedTo( int devid, | 179 | bool isConnectedTo( int devid, |
180 | const OTDeviceAddress & Address ); | 180 | const OTDeviceAddress & Address ); |
181 | 181 | ||
182 | void readLinkKeys(); | 182 | void readLinkKeys(); |
183 | 183 | ||
184 | static OTGateway * SingleGateway; | 184 | static OTGateway * SingleGateway; |
diff --git a/noncore/settings/networksettings2/opietooth2/OTInquiry.h b/noncore/settings/networksettings2/opietooth2/OTInquiry.h index f7bdeec..559af7a 100644 --- a/noncore/settings/networksettings2/opietooth2/OTInquiry.h +++ b/noncore/settings/networksettings2/opietooth2/OTInquiry.h | |||
@@ -33,17 +33,17 @@ class OTHCISocket; | |||
33 | 33 | ||
34 | /** Scans for nearby bluetooth devices. | 34 | /** Scans for nearby bluetooth devices. |
35 | * This class provides an asynchronous interface to the | 35 | * This class provides an asynchronous interface to the |
36 | * inquriy HCI command. To scan for other devices, connect | 36 | * inquriy HCI command. To scan for other devices, connect |
37 | * to the signals neighbourFound() and finished() and call | 37 | * to the signals neighbourFound() and finished() and call |
38 | * inquiry(). Inquiry results are signalled as soon as they arrive, | 38 | * inquiry(). Inquiry results are signalled as soon as they arrive, |
39 | * so the information can be displayed before the whole inquiry | 39 | * so the information can be displayed before the whole inquiry |
40 | * process is finished. | 40 | * process is finished. |
41 | * Still no connections should be set up before | 41 | * Still no networkSetups should be set up before |
42 | * the finished() signal was sent (hmm, is this always true..?) | 42 | * the finished() signal was sent (hmm, is this always true..?) |
43 | */ | 43 | */ |
44 | 44 | ||
45 | class OTInquiry : public QObject { | 45 | class OTInquiry : public QObject { |
46 | 46 | ||
47 | Q_OBJECT | 47 | Q_OBJECT |
48 | 48 | ||
49 | public: | 49 | public: |
diff --git a/noncore/settings/networksettings2/ppp/PPPDialingedit.cpp b/noncore/settings/networksettings2/ppp/PPPDialingedit.cpp index 9264ceb..2b03c73 100644 --- a/noncore/settings/networksettings2/ppp/PPPDialingedit.cpp +++ b/noncore/settings/networksettings2/ppp/PPPDialingedit.cpp | |||
@@ -11,15 +11,14 @@ PPPDialingEdit::PPPDialingEdit( QWidget * Parent ) : | |||
11 | 11 | ||
12 | // populate widget stack | 12 | // populate widget stack |
13 | } | 13 | } |
14 | 14 | ||
15 | QString PPPDialingEdit::acceptable( void ) { | 15 | QString PPPDialingEdit::acceptable( void ) { |
16 | return QString(); | 16 | return QString(); |
17 | } | 17 | } |
18 | 18 | ||
19 | bool PPPDialingEdit::commit( PPPData & D ) { | 19 | bool PPPDialingEdit::commit( PPPData & ) { |
20 | bool SM; | 20 | return true; |
21 | return SM; | ||
22 | } | 21 | } |
23 | 22 | ||
24 | void PPPDialingEdit::showData( PPPData & D ) { | 23 | void PPPDialingEdit::showData( PPPData & D ) { |
25 | } | 24 | } |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp index 8c15e9c..884168c 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp +++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp | |||
@@ -9,24 +9,24 @@ | |||
9 | QStringList * PPPNetNode::ProperFiles = 0; | 9 | QStringList * PPPNetNode::ProperFiles = 0; |
10 | 10 | ||
11 | static const char * PPPNeeds[] = | 11 | static const char * PPPNeeds[] = |
12 | { "modem", | 12 | { "modem", |
13 | 0 | 13 | 0 |
14 | }; | 14 | }; |
15 | 15 | ||
16 | static const char * PPPProvides[] = | 16 | static const char * PPPProvides[] = |
17 | { "connection", | 17 | { "NetworkSetup", |
18 | 0 | 18 | 0 |
19 | }; | 19 | }; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Constructor, find all of the possible interfaces | 22 | * Constructor, find all of the possible interfaces |
23 | */ | 23 | */ |
24 | PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) { | 24 | PPPNetNode::PPPNetNode() : ANetNode(tr("PPP NetworkSetup")) { |
25 | 25 | ||
26 | NSResources->addSystemFile( | 26 | NSResources->addSystemFile( |
27 | "pap-secrets", "/etc/ppp/pap-secrets", 0 ); | 27 | "pap-secrets", "/etc/ppp/pap-secrets", 0 ); |
28 | NSResources->addSystemFile( | 28 | NSResources->addSystemFile( |
29 | "chap-secrets", "/etc/ppp/chap-secrets", 0 ); | 29 | "chap-secrets", "/etc/ppp/chap-secrets", 0 ); |
30 | } | 30 | } |
31 | 31 | ||
32 | /** | 32 | /** |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp index 9e3bb64..7286d96 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NNI.cpp +++ b/noncore/settings/networksettings2/ppp/ppp_NNI.cpp | |||
@@ -144,65 +144,65 @@ void APPP::commit( void ) { | |||
144 | if( GUI && GUI->commit( Data ) ) { | 144 | if( GUI && GUI->commit( Data ) ) { |
145 | setModified( 1 ); | 145 | setModified( 1 ); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | bool APPP::openFile( SystemFile & SF ) { | 149 | bool APPP::openFile( SystemFile & SF ) { |
150 | if( SF.name() == "peers" ) { | 150 | if( SF.name() == "peers" ) { |
151 | SF.setPath( removeSpaces( | 151 | SF.setPath( removeSpaces( |
152 | QString( "/tmp/ppp/peers/" ) + connection()->name() ) ); | 152 | QString( "/tmp/ppp/peers/" ) + networkSetup()->name() ) ); |
153 | return 1; | 153 | return 1; |
154 | } else if ( SF.name() == "chatscripts" ) { | 154 | } else if ( SF.name() == "chatscripts" ) { |
155 | SF.setPath( removeSpaces( | 155 | SF.setPath( removeSpaces( |
156 | QString( "/tmp/chatscripts/" ) + connection()->name() ) ); | 156 | QString( "/tmp/chatscripts/" ) + networkSetup()->name() ) ); |
157 | return 1; | 157 | return 1; |
158 | } | 158 | } |
159 | return 0; | 159 | return 0; |
160 | } | 160 | } |
161 | 161 | ||
162 | short APPP::generateFile( SystemFile & SF, long DevNr ) { | 162 | short APPP::generateFile( SystemFile & SF, long DevNr ) { |
163 | short rvl, rvd; | 163 | short rvl, rvd; |
164 | 164 | ||
165 | rvl = 1; | 165 | rvl = 1; |
166 | rvd = 1; | 166 | rvd = 1; |
167 | 167 | ||
168 | if( SF.name() == "pap-secrets" ) { | 168 | if( SF.name() == "pap-secrets" ) { |
169 | Log(("Generate PPP for %s\n", SF.name().latin1() )); | 169 | Log(("Generate PPP for %s\n", SF.name().latin1() )); |
170 | 170 | ||
171 | if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) { | 171 | if( Data.Auth.Mode == 1 && Data.Auth.PCEMode == 0 ) { |
172 | SF << "# secrets for " | 172 | SF << "# secrets for " |
173 | << connection()->name().latin1() | 173 | << networkSetup()->name().latin1() |
174 | << endl; | 174 | << endl; |
175 | SF << Data.Auth.Client | 175 | SF << Data.Auth.Client |
176 | << " " | 176 | << " " |
177 | << Data.Auth.Server | 177 | << Data.Auth.Server |
178 | << " " | 178 | << " " |
179 | << Data.Auth.Secret | 179 | << Data.Auth.Secret |
180 | << endl; | 180 | << endl; |
181 | rvl = 0; | 181 | rvl = 0; |
182 | rvd = connection()->getToplevel()->generateFileEmbedded( | 182 | rvd = networkSetup()->getToplevel()->generateFileEmbedded( |
183 | SF, DevNr ); | 183 | SF, DevNr ); |
184 | } | 184 | } |
185 | } else if( SF.name() == "chap-secrets" ) { | 185 | } else if( SF.name() == "chap-secrets" ) { |
186 | Log(("Generate PPP for %s\n", SF.name().latin1() )); | 186 | Log(("Generate PPP for %s\n", SF.name().latin1() )); |
187 | if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) { | 187 | if( Data.Auth.Mode == 1 && Data.Auth.PCEMode != 0 ) { |
188 | // used for both EAP and Chap | 188 | // used for both EAP and Chap |
189 | SF << "# secrets for " | 189 | SF << "# secrets for " |
190 | << connection()->name().latin1() | 190 | << networkSetup()->name().latin1() |
191 | << endl; | 191 | << endl; |
192 | SF << Data.Auth.Client | 192 | SF << Data.Auth.Client |
193 | << " " | 193 | << " " |
194 | << Data.Auth.Server | 194 | << Data.Auth.Server |
195 | << " " | 195 | << " " |
196 | << Data.Auth.Secret | 196 | << Data.Auth.Secret |
197 | << endl; | 197 | << endl; |
198 | 198 | ||
199 | rvl = 0; | 199 | rvl = 0; |
200 | rvd = connection()->getToplevel()->generateFileEmbedded( | 200 | rvd = networkSetup()->getToplevel()->generateFileEmbedded( |
201 | SF, DevNr ); | 201 | SF, DevNr ); |
202 | } | 202 | } |
203 | } else if ( SF.name() == "peers" ) { | 203 | } else if ( SF.name() == "peers" ) { |
204 | 204 | ||
205 | QFileInfo FI(SF.path()); | 205 | QFileInfo FI(SF.path()); |
206 | Log(("Generate PPP for %s\n", SF.name().latin1() )); | 206 | Log(("Generate PPP for %s\n", SF.name().latin1() )); |
207 | 207 | ||
208 | SF << "connect \"/usr/sbin/chat -v -f /etc/chatscripts/" | 208 | SF << "connect \"/usr/sbin/chat -v -f /etc/chatscripts/" |
@@ -216,20 +216,20 @@ short APPP::generateFile( SystemFile & SF, long DevNr ) { | |||
216 | } | 216 | } |
217 | 217 | ||
218 | SF << "linkname " | 218 | SF << "linkname " |
219 | << removeSpaces( SF.name().latin1() ) | 219 | << removeSpaces( SF.name().latin1() ) |
220 | << endl; | 220 | << endl; |
221 | 221 | ||
222 | // insert other data here | 222 | // insert other data here |
223 | rvl = 0; | 223 | rvl = 0; |
224 | rvd = connection()->getToplevel()->generateFileEmbedded( | 224 | rvd = networkSetup()->getToplevel()->generateFileEmbedded( |
225 | SF, DevNr ); | 225 | SF, DevNr ); |
226 | } else if ( SF.name() == "chatscripts" ) { | 226 | } else if ( SF.name() == "chatscripts" ) { |
227 | Log(("Generate PPP for %s\n", SF.name().latin1() )); | 227 | Log(("Generate PPP for %s\n", SF.name().latin1() )); |
228 | rvl = 0; | 228 | rvl = 0; |
229 | rvd = connection()->getToplevel()->generateFileEmbedded( | 229 | rvd = networkSetup()->getToplevel()->generateFileEmbedded( |
230 | SF, DevNr ); | 230 | SF, DevNr ); |
231 | } | 231 | } |
232 | 232 | ||
233 | return (rvd == 2 || rvl == 2 ) ? 2 : | 233 | return (rvd == 2 || rvl == 2 ) ? 2 : |
234 | (rvd == 0 || rvl == 0 ) ? 0 : 1; | 234 | (rvd == 0 || rvl == 0 ) ? 0 : 1; |
235 | } | 235 | } |
diff --git a/noncore/settings/networksettings2/ppp/ppprun.cpp b/noncore/settings/networksettings2/ppp/ppprun.cpp index 8403e6d..f548483 100644 --- a/noncore/settings/networksettings2/ppp/ppprun.cpp +++ b/noncore/settings/networksettings2/ppp/ppprun.cpp | |||
@@ -8,17 +8,17 @@ PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) : | |||
8 | 8 | ||
9 | State_t PPPRun::detectState( void ) { | 9 | State_t PPPRun::detectState( void ) { |
10 | if( isMyPPPDRunning( ) ) { | 10 | if( isMyPPPDRunning( ) ) { |
11 | return ( isMyPPPUp() ) ? IsUp : Available; | 11 | return ( isMyPPPUp() ) ? IsUp : Available; |
12 | } | 12 | } |
13 | return Off; | 13 | return Off; |
14 | } | 14 | } |
15 | 15 | ||
16 | QString PPPRun::setMyState( NodeCollection * NC, Action_t A, bool ) { | 16 | QString PPPRun::setMyState( NetworkSetup * , Action_t , bool ) { |
17 | return QString(); | 17 | return QString(); |
18 | } | 18 | } |
19 | 19 | ||
20 | bool PPPRun::isMyPPPDRunning( void ) { | 20 | bool PPPRun::isMyPPPDRunning( void ) { |
21 | return 0; | 21 | return 0; |
22 | } | 22 | } |
23 | 23 | ||
24 | bool PPPRun::isMyPPPUp( void ) { | 24 | bool PPPRun::isMyPPPUp( void ) { |
@@ -29,17 +29,17 @@ bool PPPRun::isMyPPPUp( void ) { | |||
29 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 29 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
30 | It.current(); | 30 | It.current(); |
31 | ++It ) { | 31 | ++It ) { |
32 | Run = It.current(); | 32 | Run = It.current(); |
33 | if( R.match( Run->Name ) >= 0 && | 33 | if( R.match( Run->Name ) >= 0 && |
34 | Run->IsPointToPoint | 34 | Run->IsPointToPoint |
35 | ) { | 35 | ) { |
36 | // this is a LAN card | 36 | // this is a LAN card |
37 | if( Run->assignedConnection() == netNode()->connection() ) { | 37 | if( Run->assignedToNetworkSetup() == netNode()->networkSetup() ) { |
38 | // assigned to us | 38 | // assigned to us |
39 | return 1; | 39 | return 1; |
40 | } | 40 | } |
41 | } | 41 | } |
42 | } | 42 | } |
43 | return 0; | 43 | return 0; |
44 | } | 44 | } |
45 | 45 | ||
diff --git a/noncore/settings/networksettings2/ppp/ppprun.h b/noncore/settings/networksettings2/ppp/ppprun.h index 2990a96..9535382 100644 --- a/noncore/settings/networksettings2/ppp/ppprun.h +++ b/noncore/settings/networksettings2/ppp/ppprun.h | |||
@@ -18,17 +18,17 @@ public : | |||
18 | State_t detectState( void ); | 18 | State_t detectState( void ); |
19 | virtual RuntimeInfo * device( void ) | 19 | virtual RuntimeInfo * device( void ) |
20 | { return this; } | 20 | { return this; } |
21 | virtual RuntimeInfo * connection( void ) | 21 | virtual RuntimeInfo * connection( void ) |
22 | { return this; } | 22 | { return this; } |
23 | 23 | ||
24 | protected : | 24 | protected : |
25 | 25 | ||
26 | QString setMyState( NodeCollection * , Action_t, bool ); | 26 | QString setMyState( NetworkSetup * , Action_t, bool ); |
27 | 27 | ||
28 | private : | 28 | private : |
29 | 29 | ||
30 | bool isMyPPPDRunning( void ); | 30 | bool isMyPPPDRunning( void ); |
31 | bool isMyPPPUp( void ); | 31 | bool isMyPPPUp( void ); |
32 | 32 | ||
33 | PPPData * D; | 33 | PPPData * D; |
34 | QRegExp Pat; | 34 | QRegExp Pat; |
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp index 1e6912e..007f4a5 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.cpp +++ b/noncore/settings/networksettings2/profile/profile_NN.cpp | |||
@@ -1,43 +1,43 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | #include "profile_NN.h" | 2 | #include "profile_NN.h" |
3 | #include "profile_NNI.h" | 3 | #include "profile_NNI.h" |
4 | 4 | ||
5 | #include "netnodeinterface.h" | 5 | #include "netnodeinterface.h" |
6 | 6 | ||
7 | static const char * ProfileNeeds[] = | 7 | static const char * ProfileNeeds[] = |
8 | { "connection", | 8 | { "NetworkSetup", |
9 | 0 | 9 | 0 |
10 | }; | 10 | }; |
11 | static const char * ProfileProvides[] = | 11 | static const char * ProfileProvides[] = |
12 | { "fullsetup", | 12 | { "fullsetup", |
13 | 0 | 13 | 0 |
14 | }; | 14 | }; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Constructor, find all of the possible interfaces | 17 | * Constructor, find all of the possible interfaces |
18 | */ | 18 | */ |
19 | ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) { | 19 | ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular NetworkSetup profile")) { |
20 | 20 | ||
21 | NSResources->addSystemFile( | 21 | NSResources->addSystemFile( |
22 | "interfaces", "/etc/network/interfaces", 1 ); | 22 | "interfaces", "/etc/network/interfaces", 1 ); |
23 | 23 | ||
24 | } | 24 | } |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Delete any interfaces that we own. | 27 | * Delete any interfaces that we own. |
28 | */ | 28 | */ |
29 | ProfileNetNode::~ProfileNetNode(){ | 29 | ProfileNetNode::~ProfileNetNode(){ |
30 | } | 30 | } |
31 | 31 | ||
32 | const QString ProfileNetNode::nodeDescription(){ | 32 | const QString ProfileNetNode::nodeDescription(){ |
33 | return tr("\ | 33 | return tr("\ |
34 | <p>Define use of an IP connection.</p>\ | 34 | <p>Define use of an IP NetworkSetup.</p>\ |
35 | <p>Configure if and when this connection needs to be established</p>\ | 35 | <p>Configure if and when this NetworkSetup needs to be established</p>\ |
36 | " | 36 | " |
37 | ); | 37 | ); |
38 | } | 38 | } |
39 | 39 | ||
40 | ANetNodeInstance * ProfileNetNode::createInstance( void ) { | 40 | ANetNodeInstance * ProfileNetNode::createInstance( void ) { |
41 | return new AProfile( this ); | 41 | return new AProfile( this ); |
42 | } | 42 | } |
43 | 43 | ||
diff --git a/noncore/settings/networksettings2/profile/profiledata.h b/noncore/settings/networksettings2/profile/profiledata.h index c9577e5..2f7060d 100644 --- a/noncore/settings/networksettings2/profile/profiledata.h +++ b/noncore/settings/networksettings2/profile/profiledata.h | |||
@@ -4,14 +4,14 @@ | |||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | class ProfileData { | 5 | class ProfileData { |
6 | public : | 6 | public : |
7 | QString Description; | 7 | QString Description; |
8 | // start up automatically | 8 | // start up automatically |
9 | bool Automatic; | 9 | bool Automatic; |
10 | // if started up automatically, ask user for confirmation | 10 | // if started up automatically, ask user for confirmation |
11 | bool Confirm; | 11 | bool Confirm; |
12 | // Do not bring this connection up | 12 | // Do not bring this networkSetup up |
13 | bool Disabled; | 13 | bool Disabled; |
14 | bool TriggerVPN; | 14 | bool TriggerVPN; |
15 | } ; | 15 | } ; |
16 | 16 | ||
17 | #endif | 17 | #endif |
diff --git a/noncore/settings/networksettings2/profile/profileedit.cpp b/noncore/settings/networksettings2/profile/profileedit.cpp index 88aab15..ad943fe 100644 --- a/noncore/settings/networksettings2/profile/profileedit.cpp +++ b/noncore/settings/networksettings2/profile/profileedit.cpp | |||
@@ -9,19 +9,23 @@ | |||
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 | II = TNNI->networkSetup()->assignedInterface(); | ||
18 | Log(( "Interface %p %p %p: %d\n", II, | ||
19 | TNNI, TNNI->networkSetup(), (II) ? II->IsUp : 0 )); | ||
20 | |||
17 | NNI = TNNI; | 21 | NNI = TNNI; |
18 | Dev = NNI->runtime()->device(); | 22 | Dev = NNI->runtime()->device(); |
19 | if( ( II = NNI->connection()->assignedInterface() ) ) { | 23 | if( ( II = NNI->networkSetup()->assignedInterface() ) ) { |
20 | 24 | ||
21 | Refresh_CB->setEnabled( TRUE ); | 25 | Refresh_CB->setEnabled( TRUE ); |
22 | Snd_GB->setEnabled( TRUE ); | 26 | Snd_GB->setEnabled( TRUE ); |
23 | Rcv_GB->setEnabled( TRUE ); | 27 | Rcv_GB->setEnabled( TRUE ); |
24 | Collisions_FRM->setEnabled( TRUE ); | 28 | Collisions_FRM->setEnabled( TRUE ); |
25 | 29 | ||
26 | // show current content | 30 | // show current content |
27 | SLOT_Refresh(); | 31 | SLOT_Refresh(); |
@@ -72,17 +76,17 @@ bool ProfileEdit::commit( ProfileData & Data ) { | |||
72 | CBM( Data.TriggerVPN, TriggersVPN_CB, SM ); | 76 | CBM( Data.TriggerVPN, TriggersVPN_CB, SM ); |
73 | CBM( Data.Disabled, Disabled_CB, SM ); | 77 | CBM( Data.Disabled, Disabled_CB, SM ); |
74 | CBM( Data.Confirm, Confirm_CB, SM ); | 78 | CBM( Data.Confirm, Confirm_CB, SM ); |
75 | 79 | ||
76 | return SM; | 80 | return SM; |
77 | } | 81 | } |
78 | 82 | ||
79 | void ProfileEdit::SLOT_Refresh( void ) { | 83 | void ProfileEdit::SLOT_Refresh( void ) { |
80 | InterfaceInfo * II = NNI->connection()->assignedInterface(); | 84 | InterfaceInfo * II = NNI->networkSetup()->assignedInterface(); |
81 | NSResources->system().refreshStatistics( *II ); | 85 | NSResources->system().refreshStatistics( *II ); |
82 | RcvBytes_LBL->setText( II->RcvBytes ); | 86 | RcvBytes_LBL->setText( II->RcvBytes ); |
83 | SndBytes_LBL->setText( II->SndBytes ); | 87 | SndBytes_LBL->setText( II->SndBytes ); |
84 | RcvErrors_LBL->setText( II->RcvErrors ); | 88 | RcvErrors_LBL->setText( II->RcvErrors ); |
85 | SndErrors_LBL->setText( II->SndErrors ); | 89 | SndErrors_LBL->setText( II->SndErrors ); |
86 | RcvDropped_LBL->setText( II->RcvDropped ); | 90 | RcvDropped_LBL->setText( II->RcvDropped ); |
87 | SndDropped_LBL->setText( II->SndDropped ); | 91 | SndDropped_LBL->setText( II->SndDropped ); |
88 | Collisions_LBL->setText( II->Collisions ); | 92 | Collisions_LBL->setText( II->Collisions ); |
diff --git a/noncore/settings/networksettings2/profile/profilerun.cpp b/noncore/settings/networksettings2/profile/profilerun.cpp index acb67bd..48011ea 100644 --- a/noncore/settings/networksettings2/profile/profilerun.cpp +++ b/noncore/settings/networksettings2/profile/profilerun.cpp | |||
@@ -1,20 +1,24 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | 2 | ||
3 | #include "profilerun.h" | 3 | #include "profilerun.h" |
4 | 4 | ||
5 | State_t ProfileRun::detectState( void ) { | 5 | State_t ProfileRun::detectState( void ) { |
6 | InterfaceInfo * II = networkSetup()->assignedInterface(); | ||
7 | |||
8 | Log(( "Interface %p %p %p: %d\n", II, | ||
9 | netNode(), netNode()->networkSetup(), (II) ? II->IsUp : 0 )); | ||
6 | if( Data->Disabled ) { | 10 | if( Data->Disabled ) { |
7 | return Disabled; | 11 | return Disabled; |
8 | } | 12 | } |
9 | return Unknown; | 13 | return Unknown; |
10 | } | 14 | } |
11 | 15 | ||
12 | QString ProfileRun::setMyState( NodeCollection * NC, Action_t A, bool ) { | 16 | QString ProfileRun::setMyState( NetworkSetup * NC, Action_t A, bool ) { |
13 | odebug << "Profile " << Data->Disabled << oendl; | 17 | odebug << "Profile " << Data->Disabled << oendl; |
14 | if( A == Disable ) { | 18 | if( A == Disable ) { |
15 | if( ! Data->Disabled ) { | 19 | if( ! Data->Disabled ) { |
16 | Data->Disabled = 1; | 20 | Data->Disabled = 1; |
17 | NC->setModified( 1 ); | 21 | NC->setModified( 1 ); |
18 | } | 22 | } |
19 | } else if( A == Enable ) { | 23 | } else if( A == Enable ) { |
20 | if( Data->Disabled ) { | 24 | if( Data->Disabled ) { |
diff --git a/noncore/settings/networksettings2/profile/profilerun.h b/noncore/settings/networksettings2/profile/profilerun.h index 2d48b15..9470c0f 100644 --- a/noncore/settings/networksettings2/profile/profilerun.h +++ b/noncore/settings/networksettings2/profile/profilerun.h | |||
@@ -18,16 +18,16 @@ public : | |||
18 | { return Data->Description; } | 18 | { return Data->Description; } |
19 | virtual bool triggersVPN( void ) | 19 | virtual bool triggersVPN( void ) |
20 | { return Data->TriggerVPN; } | 20 | { return Data->TriggerVPN; } |
21 | 21 | ||
22 | State_t detectState( void ); | 22 | State_t detectState( void ); |
23 | 23 | ||
24 | protected : | 24 | protected : |
25 | 25 | ||
26 | QString setMyState( NodeCollection * , Action_t, bool ); | 26 | QString setMyState( NetworkSetup * , Action_t, bool ); |
27 | 27 | ||
28 | private : | 28 | private : |
29 | 29 | ||
30 | ProfileData * Data; | 30 | ProfileData * Data; |
31 | 31 | ||
32 | }; | 32 | }; |
33 | #endif | 33 | #endif |
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp index 6d90ae0..6e2597c 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.cpp +++ b/noncore/settings/networksettings2/usb/usb_NN.cpp | |||
@@ -25,17 +25,17 @@ USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) { | |||
25 | * Delete any interfaces that we own. | 25 | * Delete any interfaces that we own. |
26 | */ | 26 | */ |
27 | USBNetNode::~USBNetNode(){ | 27 | USBNetNode::~USBNetNode(){ |
28 | } | 28 | } |
29 | 29 | ||
30 | const QString USBNetNode::nodeDescription(){ | 30 | const QString USBNetNode::nodeDescription(){ |
31 | return tr("\ | 31 | return tr("\ |
32 | <p>Configure Ethernet over USB.</p>\ | 32 | <p>Configure Ethernet over USB.</p>\ |
33 | <p>Use this for a computer to computer USB cable connection</p>\ | 33 | <p>Use this for a computer to computer USB cable NetworkSetup</p>\ |
34 | " | 34 | " |
35 | ); | 35 | ); |
36 | } | 36 | } |
37 | 37 | ||
38 | ANetNodeInstance * USBNetNode::createInstance( void ) { | 38 | ANetNodeInstance * USBNetNode::createInstance( void ) { |
39 | return new AUSB( this ); | 39 | return new AUSB( this ); |
40 | } | 40 | } |
41 | 41 | ||
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp index 763644e..4082f7f 100644 --- a/noncore/settings/networksettings2/usb/usbrun.cpp +++ b/noncore/settings/networksettings2/usb/usbrun.cpp | |||
@@ -5,17 +5,17 @@ | |||
5 | #include "usbrun.h" | 5 | #include "usbrun.h" |
6 | 6 | ||
7 | State_t USBRun::detectState( void ) { | 7 | State_t USBRun::detectState( void ) { |
8 | 8 | ||
9 | // unavailable : no card found | 9 | // unavailable : no card found |
10 | // available : card found and assigned to us or free | 10 | // available : card found and assigned to us or free |
11 | // up : card found and assigned to us and up | 11 | // up : card found and assigned to us and up |
12 | 12 | ||
13 | NodeCollection * NC = nodeCollection(); | 13 | NetworkSetup * NC = networkSetup(); |
14 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | 14 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); |
15 | System & Sys = NSResources->system(); | 15 | System & Sys = NSResources->system(); |
16 | InterfaceInfo * Run; | 16 | InterfaceInfo * Run; |
17 | QFile F( S ); | 17 | QFile F( S ); |
18 | Log(("Detecting for %s\n", NC->name().latin1() )); | 18 | Log(("Detecting for %s\n", NC->name().latin1() )); |
19 | 19 | ||
20 | if( F.open( IO_ReadOnly ) ) { | 20 | if( F.open( IO_ReadOnly ) ) { |
21 | // could open file -> read interface and assign | 21 | // could open file -> read interface and assign |
@@ -56,17 +56,17 @@ State_t USBRun::detectState( void ) { | |||
56 | // usb cables are currently always available when requested | 56 | // usb cables are currently always available when requested |
57 | // until we can detect if we are plugged in | 57 | // until we can detect if we are plugged in |
58 | return Available; | 58 | return Available; |
59 | } | 59 | } |
60 | 60 | ||
61 | return Unavailable; | 61 | return Unavailable; |
62 | } | 62 | } |
63 | 63 | ||
64 | QString USBRun::setMyState( NodeCollection * NC, Action_t A, bool ) { | 64 | QString USBRun::setMyState( NetworkSetup * NC, Action_t, bool ) { |
65 | 65 | ||
66 | InterfaceInfo * I = getInterface(); | 66 | InterfaceInfo * I = getInterface(); |
67 | 67 | ||
68 | if( ! I ) { | 68 | if( ! I ) { |
69 | return QString("No usb device available"); | 69 | return QString("No usb device available"); |
70 | } | 70 | } |
71 | 71 | ||
72 | Log(( "Grabbed USB interface %s\n", I->Name.latin1() )); | 72 | Log(( "Grabbed USB interface %s\n", I->Name.latin1() )); |
@@ -92,21 +92,21 @@ InterfaceInfo * USBRun::getInterface( void ) { | |||
92 | handlesInterface( Run->Name ), | 92 | handlesInterface( Run->Name ), |
93 | Run->CardType, ARPHRD_ETHER, | 93 | Run->CardType, ARPHRD_ETHER, |
94 | ! Run->IsUp )); | 94 | ! Run->IsUp )); |
95 | 95 | ||
96 | if( handlesInterface( Run->Name ) && | 96 | if( handlesInterface( Run->Name ) && |
97 | Run->CardType == ARPHRD_ETHER | 97 | Run->CardType == ARPHRD_ETHER |
98 | ) { | 98 | ) { |
99 | // this is a USB card | 99 | // this is a USB card |
100 | if( Run->assignedConnection() == netNode()->connection() ) { | 100 | if( Run->assignedToNetworkSetup() == netNode()->networkSetup() ) { |
101 | // assigned to us | 101 | // assigned to us |
102 | return Run; | 102 | return Run; |
103 | } else if( ! Run->IsUp && | 103 | } else if( ! Run->IsUp && |
104 | Run->assignedConnection() == 0 ) { | 104 | Run->assignedToNetworkSetup() == 0 ) { |
105 | // free | 105 | // free |
106 | best = Run; | 106 | best = Run; |
107 | } // UP or not assigned to us | 107 | } // UP or not assigned to us |
108 | } | 108 | } |
109 | } | 109 | } |
110 | return best; // can be 0 | 110 | return best; // can be 0 |
111 | } | 111 | } |
112 | 112 | ||
diff --git a/noncore/settings/networksettings2/usb/usbrun.h b/noncore/settings/networksettings2/usb/usbrun.h index 6ce4fa2..0872f3d 100644 --- a/noncore/settings/networksettings2/usb/usbrun.h +++ b/noncore/settings/networksettings2/usb/usbrun.h | |||
@@ -20,17 +20,17 @@ public : | |||
20 | 20 | ||
21 | bool handlesInterface( const QString & I ); | 21 | bool handlesInterface( const QString & I ); |
22 | bool handlesInterface( InterfaceInfo * ); | 22 | bool handlesInterface( InterfaceInfo * ); |
23 | 23 | ||
24 | State_t detectState( void ); | 24 | State_t detectState( void ); |
25 | 25 | ||
26 | protected : | 26 | protected : |
27 | 27 | ||
28 | QString setMyState( NodeCollection * , Action_t, bool ); | 28 | QString setMyState( NetworkSetup * , Action_t, bool ); |
29 | 29 | ||
30 | private : | 30 | private : |
31 | 31 | ||
32 | InterfaceInfo * getInterface( void ); | 32 | InterfaceInfo * getInterface( void ); |
33 | QRegExp Pat; | 33 | QRegExp Pat; |
34 | 34 | ||
35 | }; | 35 | }; |
36 | #endif | 36 | #endif |
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp index 96e9df2..7c2e77b 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp +++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp | |||
@@ -3,34 +3,34 @@ | |||
3 | 3 | ||
4 | #include "netnodeinterface.h" | 4 | #include "netnodeinterface.h" |
5 | 5 | ||
6 | static const char * VPNNeeds[] = | 6 | static const char * VPNNeeds[] = |
7 | { 0 | 7 | { 0 |
8 | }; | 8 | }; |
9 | 9 | ||
10 | static const char * VPNProvides[] = | 10 | static const char * VPNProvides[] = |
11 | { "connection", | 11 | { "NetworkSetup", |
12 | 0 | 12 | 0 |
13 | }; | 13 | }; |
14 | /** | 14 | /** |
15 | * Constructor, find all of the possible interfaces | 15 | * Constructor, find all of the possible interfaces |
16 | */ | 16 | */ |
17 | VPNNetNode::VPNNetNode() : ANetNode(tr("VPN Connection")) { | 17 | VPNNetNode::VPNNetNode() : ANetNode(tr("VPN NetworkSetup")) { |
18 | } | 18 | } |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * Delete any interfaces that we own. | 21 | * Delete any interfaces that we own. |
22 | */ | 22 | */ |
23 | VPNNetNode::~VPNNetNode(){ | 23 | VPNNetNode::~VPNNetNode(){ |
24 | } | 24 | } |
25 | 25 | ||
26 | const QString VPNNetNode::nodeDescription(){ | 26 | const QString VPNNetNode::nodeDescription(){ |
27 | return tr("\ | 27 | return tr("\ |
28 | <p>Configure private IP connection.</p>\ | 28 | <p>Configure private IP NetworkSetup.</p>\ |
29 | <p>Defines Secure tunnels over non secure IP sessions</p>\ | 29 | <p>Defines Secure tunnels over non secure IP sessions</p>\ |
30 | " | 30 | " |
31 | ); | 31 | ); |
32 | } | 32 | } |
33 | 33 | ||
34 | ANetNodeInstance * VPNNetNode::createInstance( void ) { | 34 | ANetNodeInstance * VPNNetNode::createInstance( void ) { |
35 | return new AVPN( this ); | 35 | return new AVPN( this ); |
36 | } | 36 | } |
diff --git a/noncore/settings/networksettings2/vpn/vpnrun.h b/noncore/settings/networksettings2/vpn/vpnrun.h index 9a55625..e40aa87 100644 --- a/noncore/settings/networksettings2/vpn/vpnrun.h +++ b/noncore/settings/networksettings2/vpn/vpnrun.h | |||
@@ -15,13 +15,13 @@ public : | |||
15 | virtual RuntimeInfo * connection( void ) | 15 | virtual RuntimeInfo * connection( void ) |
16 | { return this; } | 16 | { return this; } |
17 | 17 | ||
18 | State_t detectState( void ) | 18 | State_t detectState( void ) |
19 | { return Unknown; } | 19 | { return Unknown; } |
20 | 20 | ||
21 | protected : | 21 | protected : |
22 | 22 | ||
23 | QString setMyState( NodeCollection * , Action_t, bool ) | 23 | QString setMyState( NetworkSetup * , Action_t, bool ) |
24 | { return QString(); } | 24 | { return QString(); } |
25 | }; | 25 | }; |
26 | 26 | ||
27 | #endif | 27 | #endif |
diff --git a/noncore/settings/networksettings2/wlan/wlanedit.cpp b/noncore/settings/networksettings2/wlan/wlanedit.cpp index 74174bf..73c0c7c 100644 --- a/noncore/settings/networksettings2/wlan/wlanedit.cpp +++ b/noncore/settings/networksettings2/wlan/wlanedit.cpp | |||
@@ -15,17 +15,17 @@ | |||
15 | WLanEdit::WLanEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : | 15 | WLanEdit::WLanEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : |
16 | WLanGUI( Parent ), RefreshTimer(this){ | 16 | WLanGUI( Parent ), RefreshTimer(this){ |
17 | 17 | ||
18 | InterfaceInfo * II; | 18 | InterfaceInfo * II; |
19 | 19 | ||
20 | NNI = TNNI; | 20 | NNI = TNNI; |
21 | Dev = NNI->runtime()->device(); | 21 | Dev = NNI->runtime()->device(); |
22 | WE = 0; | 22 | WE = 0; |
23 | if( ( II = NNI->connection()->assignedInterface() ) ) { | 23 | if( ( II = NNI->networkSetup()->assignedInterface() ) ) { |
24 | // show data | 24 | // show data |
25 | WE = new WExtensions( II->Name ); | 25 | WE = new WExtensions( II->Name ); |
26 | 26 | ||
27 | if( WE->doesHaveWirelessExtensions() ) { | 27 | if( WE->doesHaveWirelessExtensions() ) { |
28 | QString S; | 28 | QString S; |
29 | Station_LBL->setText( WE->station() ); | 29 | Station_LBL->setText( WE->station() ); |
30 | ESSID_LBL->setText( WE->essid() ); | 30 | ESSID_LBL->setText( WE->essid() ); |
31 | Mode_LBL->setText( WE->mode() ); | 31 | Mode_LBL->setText( WE->mode() ); |
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.cpp b/noncore/settings/networksettings2/wlan/wlanrun.cpp index b15a560..a0c5884 100644 --- a/noncore/settings/networksettings2/wlan/wlanrun.cpp +++ b/noncore/settings/networksettings2/wlan/wlanrun.cpp | |||
@@ -6,17 +6,17 @@ | |||
6 | #include "wlanrun.h" | 6 | #include "wlanrun.h" |
7 | 7 | ||
8 | State_t WLanRun::detectState( void ) { | 8 | State_t WLanRun::detectState( void ) { |
9 | 9 | ||
10 | // unavailable : no card found | 10 | // unavailable : no card found |
11 | // available : card found and assigned to us or free | 11 | // available : card found and assigned to us or free |
12 | // up : card found and assigned to us and up | 12 | // up : card found and assigned to us and up |
13 | 13 | ||
14 | NodeCollection * NC = nodeCollection(); | 14 | NetworkSetup * NC = networkSetup(); |
15 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | 15 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); |
16 | System & Sys = NSResources->system(); | 16 | System & Sys = NSResources->system(); |
17 | InterfaceInfo * Run; | 17 | InterfaceInfo * Run; |
18 | 18 | ||
19 | QFile F( S ); | 19 | QFile F( S ); |
20 | 20 | ||
21 | if( F.open( IO_ReadOnly ) ) { | 21 | if( F.open( IO_ReadOnly ) ) { |
22 | // could open file -> read interface and assign | 22 | // could open file -> read interface and assign |
@@ -65,17 +65,17 @@ State_t WLanRun::detectState( void ) { | |||
65 | return Off; | 65 | return Off; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | return Unavailable; | 69 | return Unavailable; |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | QString WLanRun::setMyState( NodeCollection * , Action_t , bool ) { | 73 | QString WLanRun::setMyState( NetworkSetup * , Action_t , bool ) { |
74 | 74 | ||
75 | // we only handle activate and deactivate | 75 | // we only handle activate and deactivate |
76 | return QString(); | 76 | return QString(); |
77 | } | 77 | } |
78 | 78 | ||
79 | // get interface that is free or assigned to us | 79 | // get interface that is free or assigned to us |
80 | InterfaceInfo * WLanRun::getInterface( void ) { | 80 | InterfaceInfo * WLanRun::getInterface( void ) { |
81 | 81 | ||
@@ -89,20 +89,20 @@ InterfaceInfo * WLanRun::getInterface( void ) { | |||
89 | if( handlesInterface( *Run ) && | 89 | if( handlesInterface( *Run ) && |
90 | ( Run->CardType == ARPHRD_ETHER | 90 | ( Run->CardType == ARPHRD_ETHER |
91 | #ifdef ARPHRD_IEEE1394 | 91 | #ifdef ARPHRD_IEEE1394 |
92 | || Run->CardType == ARPHRD_IEEE1394 | 92 | || Run->CardType == ARPHRD_IEEE1394 |
93 | #endif | 93 | #endif |
94 | ) | 94 | ) |
95 | ) { | 95 | ) { |
96 | // this is a LAN card | 96 | // this is a LAN card |
97 | if( Run->assignedConnection() == netNode()->connection() ) { | 97 | if( Run->assignedToNetworkSetup() == netNode()->networkSetup() ) { |
98 | // assigned to us | 98 | // assigned to us |
99 | return Run; | 99 | return Run; |
100 | } else if( Run->assignedConnection() == 0 ) { | 100 | } else if( Run->assignedToNetworkSetup() == 0 ) { |
101 | // free | 101 | // free |
102 | best = Run; | 102 | best = Run; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | } | 105 | } |
106 | return best; // can be 0 | 106 | return best; // can be 0 |
107 | } | 107 | } |
108 | 108 | ||
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.h b/noncore/settings/networksettings2/wlan/wlanrun.h index fd325d4..e3e7735 100644 --- a/noncore/settings/networksettings2/wlan/wlanrun.h +++ b/noncore/settings/networksettings2/wlan/wlanrun.h | |||
@@ -19,17 +19,17 @@ public : | |||
19 | 19 | ||
20 | bool handlesInterface( const QString & I ); | 20 | bool handlesInterface( const QString & I ); |
21 | bool handlesInterface( const InterfaceInfo & II ); | 21 | bool handlesInterface( const InterfaceInfo & II ); |
22 | 22 | ||
23 | State_t detectState( void ); | 23 | State_t detectState( void ); |
24 | 24 | ||
25 | protected : | 25 | protected : |
26 | 26 | ||
27 | QString setMyState( NodeCollection * , Action_t, bool ); | 27 | QString setMyState( NetworkSetup * , Action_t, bool ); |
28 | 28 | ||
29 | private : | 29 | private : |
30 | 30 | ||
31 | InterfaceInfo * getInterface( void ); | 31 | InterfaceInfo * getInterface( void ); |
32 | QRegExp Pat; | 32 | QRegExp Pat; |
33 | WLanData * Data; | 33 | WLanData * Data; |
34 | }; | 34 | }; |
35 | 35 | ||