38 files changed, 554 insertions, 172 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp index 4579e37..1d0a0f7 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.cpp | |||
@@ -1,143 +1,145 @@ | |||
1 | #include "bluetooth_NN.h" | 1 | #include "bluetooth_NN.h" |
2 | #include "bluetoothBNEP_NNI.h" | 2 | #include "bluetoothBNEP_NNI.h" |
3 | #include "bluetoothRFCOMM_NNI.h" | 3 | #include "bluetoothRFCOMM_NNI.h" |
4 | 4 | ||
5 | // | 5 | // |
6 | // | 6 | // |
7 | // BLUETOOTH PAN/NAP node | 7 | // BLUETOOTH PAN/NAP node |
8 | // | 8 | // |
9 | // | 9 | // |
10 | 10 | ||
11 | static const char * BluetoothBNEPNeeds[] = | 11 | static const char * BluetoothBNEPNeeds[] = |
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 | BluetoothBNEPNetNode::BluetoothBNEPNetNode() : ANetNode() { | 18 | BluetoothBNEPNetNode::BluetoothBNEPNetNode() : |
19 | ANetNode(tr("Bluetooth PAN/NAP")) { | ||
19 | InstanceCount = 7; // default | 20 | InstanceCount = 7; // default |
20 | } | 21 | } |
21 | 22 | ||
22 | /** | 23 | /** |
23 | * Delete any interfaces that we own. | 24 | * Delete any interfaces that we own. |
24 | */ | 25 | */ |
25 | BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){ | 26 | BluetoothBNEPNetNode::~BluetoothBNEPNetNode(){ |
26 | } | 27 | } |
27 | 28 | ||
28 | const QString BluetoothBNEPNetNode::nodeDescription(){ | 29 | const QString BluetoothBNEPNetNode::nodeDescription(){ |
29 | return tr("\ | 30 | return tr("\ |
30 | <p>Sets up a bluetooth link using the bluetooth Network profile.</p>\ | 31 | <p>Sets up a bluetooth link using the bluetooth Network profile.</p>\ |
31 | <p>Use this to connect two computing devices.</p>\ | 32 | <p>Use this to connect two computing devices.</p>\ |
32 | " | 33 | " |
33 | ); | 34 | ); |
34 | } | 35 | } |
35 | 36 | ||
36 | ANetNodeInstance * BluetoothBNEPNetNode::createInstance( void ) { | 37 | ANetNodeInstance * BluetoothBNEPNetNode::createInstance( void ) { |
37 | return new ABluetoothBNEP( this ); | 38 | return new ABluetoothBNEP( this ); |
38 | } | 39 | } |
39 | 40 | ||
40 | const char ** BluetoothBNEPNetNode::needs( void ) { | 41 | const char ** BluetoothBNEPNetNode::needs( void ) { |
41 | return BluetoothBNEPNeeds; | 42 | return BluetoothBNEPNeeds; |
42 | } | 43 | } |
43 | 44 | ||
44 | const char * BluetoothBNEPNetNode::provides( void ) { | 45 | const char * BluetoothBNEPNetNode::provides( void ) { |
45 | return "device"; | 46 | return "device"; |
46 | } | 47 | } |
47 | 48 | ||
48 | bool BluetoothBNEPNetNode::generateProperFilesFor( | 49 | bool BluetoothBNEPNetNode::generateProperFilesFor( |
49 | ANetNodeInstance * ) { | 50 | ANetNodeInstance * ) { |
50 | return 1; | 51 | return 1; |
51 | } | 52 | } |
52 | 53 | ||
53 | bool BluetoothBNEPNetNode::hasDataFor( const QString & S ) { | 54 | bool BluetoothBNEPNetNode::hasDataFor( const QString & S ) { |
54 | return S == "interfaces"; | 55 | return S == "interfaces"; |
55 | } | 56 | } |
56 | 57 | ||
57 | bool BluetoothBNEPNetNode::generateDeviceDataForCommonFile( | 58 | bool BluetoothBNEPNetNode::generateDeviceDataForCommonFile( |
58 | SystemFile & , | 59 | SystemFile & , |
59 | long ) { | 60 | long ) { |
60 | return 1; | 61 | return 1; |
61 | } | 62 | } |
62 | 63 | ||
63 | QString BluetoothBNEPNetNode::genNic( long nr ) { | 64 | QString BluetoothBNEPNetNode::genNic( long nr ) { |
64 | QString S; | 65 | QString S; |
65 | return S.sprintf( "bnep%ld", nr ); | 66 | return S.sprintf( "bnep%ld", nr ); |
66 | } | 67 | } |
67 | 68 | ||
68 | 69 | ||
69 | void BluetoothBNEPNetNode::setSpecificAttribute( QString & A, QString & V ) { | 70 | void BluetoothBNEPNetNode::setSpecificAttribute( QString & A, QString & V ) { |
70 | if( A == "interfacecount" ) { | 71 | if( A == "interfacecount" ) { |
71 | InstanceCount = V.toLong(); | 72 | InstanceCount = V.toLong(); |
72 | } | 73 | } |
73 | } | 74 | } |
74 | 75 | ||
75 | void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) { | 76 | void BluetoothBNEPNetNode::saveSpecificAttribute( QTextStream & TS) { |
76 | TS << "interfacecount=" | 77 | TS << "interfacecount=" |
77 | << InstanceCount | 78 | << InstanceCount |
78 | << endl; | 79 | << endl; |
79 | } | 80 | } |
80 | 81 | ||
81 | // | 82 | // |
82 | // | 83 | // |
83 | // BLUETOOTH RFCOMM | 84 | // BLUETOOTH RFCOMM |
84 | // | 85 | // |
85 | // | 86 | // |
86 | 87 | ||
87 | static const char * BluetoothRFCOMMNeeds[] = | 88 | static const char * BluetoothRFCOMMNeeds[] = |
88 | { 0 | 89 | { 0 |
89 | }; | 90 | }; |
90 | 91 | ||
91 | BluetoothRFCOMMNetNode::BluetoothRFCOMMNetNode() : ANetNode() { | 92 | BluetoothRFCOMMNetNode::BluetoothRFCOMMNetNode() : |
93 | ANetNode( tr("Bluetooth serial link") ) { | ||
92 | } | 94 | } |
93 | 95 | ||
94 | BluetoothRFCOMMNetNode::~BluetoothRFCOMMNetNode(){ | 96 | BluetoothRFCOMMNetNode::~BluetoothRFCOMMNetNode(){ |
95 | } | 97 | } |
96 | 98 | ||
97 | const QString BluetoothRFCOMMNetNode::nodeDescription(){ | 99 | const QString BluetoothRFCOMMNetNode::nodeDescription(){ |
98 | return tr("\ | 100 | return tr("\ |
99 | <p>Sets up a bluetooth link using the bluetooth serial profile.</p>\ | 101 | <p>Sets up a bluetooth link using the bluetooth serial profile.</p>\ |
100 | <p>Use this to connect to a GSM.</p>\ | 102 | <p>Use this to connect to a GSM.</p>\ |
101 | " | 103 | " |
102 | ); | 104 | ); |
103 | } | 105 | } |
104 | 106 | ||
105 | ANetNodeInstance * BluetoothRFCOMMNetNode::createInstance( void ) { | 107 | ANetNodeInstance * BluetoothRFCOMMNetNode::createInstance( void ) { |
106 | return new ABluetoothRFCOMM( this ); | 108 | return new ABluetoothRFCOMM( this ); |
107 | } | 109 | } |
108 | 110 | ||
109 | const char ** BluetoothRFCOMMNetNode::needs( void ) { | 111 | const char ** BluetoothRFCOMMNetNode::needs( void ) { |
110 | return BluetoothRFCOMMNeeds; | 112 | return BluetoothRFCOMMNeeds; |
111 | } | 113 | } |
112 | 114 | ||
113 | const char * BluetoothRFCOMMNetNode::provides( void ) { | 115 | const char * BluetoothRFCOMMNetNode::provides( void ) { |
114 | return "line"; | 116 | return "line"; |
115 | } | 117 | } |
116 | 118 | ||
117 | bool BluetoothRFCOMMNetNode::generateProperFilesFor( | 119 | bool BluetoothRFCOMMNetNode::generateProperFilesFor( |
118 | ANetNodeInstance * ) { | 120 | ANetNodeInstance * ) { |
119 | return 0; | 121 | return 0; |
120 | } | 122 | } |
121 | 123 | ||
122 | bool BluetoothRFCOMMNetNode::hasDataFor( const QString & ) { | 124 | bool BluetoothRFCOMMNetNode::hasDataFor( const QString & ) { |
123 | return 0; | 125 | return 0; |
124 | } | 126 | } |
125 | 127 | ||
126 | bool BluetoothRFCOMMNetNode::generateDeviceDataForCommonFile( | 128 | bool BluetoothRFCOMMNetNode::generateDeviceDataForCommonFile( |
127 | SystemFile & , | 129 | SystemFile & , |
128 | long ) { | 130 | long ) { |
129 | return 0; | 131 | return 0; |
130 | } | 132 | } |
131 | 133 | ||
132 | void BluetoothRFCOMMNetNode::setSpecificAttribute( QString &, QString & ) { | 134 | void BluetoothRFCOMMNetNode::setSpecificAttribute( QString &, QString & ) { |
133 | } | 135 | } |
134 | 136 | ||
135 | void BluetoothRFCOMMNetNode::saveSpecificAttribute( QTextStream & ) { | 137 | void BluetoothRFCOMMNetNode::saveSpecificAttribute( QTextStream & ) { |
136 | } | 138 | } |
137 | 139 | ||
138 | extern "C" { | 140 | extern "C" { |
139 | void create_plugin( QList<ANetNode> & PNN ) { | 141 | void create_plugin( QList<ANetNode> & PNN ) { |
140 | PNN.append( new BluetoothBNEPNetNode() ); | 142 | PNN.append( new BluetoothBNEPNetNode() ); |
141 | PNN.append( new BluetoothRFCOMMNetNode() ); | 143 | PNN.append( new BluetoothRFCOMMNetNode() ); |
142 | } | 144 | } |
143 | } | 145 | } |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h index 882d2e3..2e5e1d2 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h | |||
@@ -1,87 +1,81 @@ | |||
1 | #ifndef BLUETOOTH_NETNODE_H | 1 | #ifndef BLUETOOTH_NETNODE_H |
2 | #define BLUETOOTH_NETNODE_H | 2 | #define BLUETOOTH_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class ABluetoothBNEP; | 6 | class ABluetoothBNEP; |
7 | 7 | ||
8 | class BluetoothBNEPNetNode : public ANetNode { | 8 | class BluetoothBNEPNetNode : public ANetNode { |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | BluetoothBNEPNetNode(); | 14 | BluetoothBNEPNetNode(); |
15 | virtual ~BluetoothBNEPNetNode(); | 15 | virtual ~BluetoothBNEPNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/bluetooth"; } | 18 | { return "Devices/bluetooth"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("Bluetooth PAN/NAP"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 28 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDeviceDataForCommonFile( | 29 | virtual bool generateDeviceDataForCommonFile( |
33 | SystemFile & , long DevNr ); | 30 | SystemFile & , long DevNr ); |
34 | 31 | ||
35 | virtual long instanceCount( void ) | 32 | virtual long instanceCount( void ) |
36 | { return InstanceCount; } | 33 | { return InstanceCount; } |
37 | virtual QString genNic( long ); | 34 | virtual QString genNic( long ); |
38 | 35 | ||
39 | private: | 36 | private: |
40 | 37 | ||
41 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
42 | virtual void saveSpecificAttribute( QTextStream & TS ); | 39 | virtual void saveSpecificAttribute( QTextStream & TS ); |
43 | 40 | ||
44 | // number of interfaces for this device | 41 | // number of interfaces for this device |
45 | long InstanceCount; | 42 | long InstanceCount; |
46 | 43 | ||
47 | }; | 44 | }; |
48 | 45 | ||
49 | class BluetoothRFCOMMNetNode : public ANetNode { | 46 | class BluetoothRFCOMMNetNode : public ANetNode { |
50 | 47 | ||
51 | Q_OBJECT | 48 | Q_OBJECT |
52 | 49 | ||
53 | public: | 50 | public: |
54 | 51 | ||
55 | BluetoothRFCOMMNetNode(); | 52 | BluetoothRFCOMMNetNode(); |
56 | virtual ~BluetoothRFCOMMNetNode(); | 53 | virtual ~BluetoothRFCOMMNetNode(); |
57 | 54 | ||
58 | virtual const QString pixmapName() | 55 | virtual const QString pixmapName() |
59 | { return "Devices/bluetooth"; } | 56 | { return "Devices/bluetooth"; } |
60 | 57 | ||
61 | virtual const QString nodeName() | ||
62 | { return tr("Bluetooth serial link"); } | ||
63 | |||
64 | virtual const QString nodeDescription() ; | 58 | virtual const QString nodeDescription() ; |
65 | 59 | ||
66 | virtual ANetNodeInstance * createInstance( void ); | 60 | virtual ANetNodeInstance * createInstance( void ); |
67 | 61 | ||
68 | virtual const char ** needs( void ); | 62 | virtual const char ** needs( void ); |
69 | virtual const char * provides( void ); | 63 | virtual const char * provides( void ); |
70 | 64 | ||
71 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 65 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
72 | virtual bool hasDataFor( const QString & S ); | 66 | virtual bool hasDataFor( const QString & S ); |
73 | virtual bool generateDeviceDataForCommonFile( | 67 | virtual bool generateDeviceDataForCommonFile( |
74 | SystemFile & , long ); | 68 | SystemFile & , long ); |
75 | 69 | ||
76 | private: | 70 | private: |
77 | 71 | ||
78 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 72 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
79 | virtual void saveSpecificAttribute( QTextStream & TS ); | 73 | virtual void saveSpecificAttribute( QTextStream & TS ); |
80 | }; | 74 | }; |
81 | 75 | ||
82 | extern "C" | 76 | extern "C" |
83 | { | 77 | { |
84 | void create_plugin( QList<ANetNode> & PNN ); | 78 | void create_plugin( QList<ANetNode> & PNN ); |
85 | }; | 79 | }; |
86 | 80 | ||
87 | #endif | 81 | #endif |
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp index dd41c1f..e95b4f6 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.cpp +++ b/noncore/settings/networksettings2/cable/cable_NN.cpp | |||
@@ -1,60 +1,60 @@ | |||
1 | #include "cable_NN.h" | 1 | #include "cable_NN.h" |
2 | #include "cable_NNI.h" | 2 | #include "cable_NNI.h" |
3 | 3 | ||
4 | static const char * CableNeeds[] = | 4 | static const char * CableNeeds[] = |
5 | { 0 | 5 | { 0 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor, find all of the possible interfaces | 9 | * Constructor, find all of the possible interfaces |
10 | */ | 10 | */ |
11 | CableNetNode::CableNetNode() : ANetNode() { | 11 | CableNetNode::CableNetNode() : ANetNode(tr("Cable Connection")) { |
12 | } | 12 | } |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Delete any interfaces that we own. | 15 | * Delete any interfaces that we own. |
16 | */ | 16 | */ |
17 | CableNetNode::~CableNetNode(){ | 17 | CableNetNode::~CableNetNode(){ |
18 | } | 18 | } |
19 | 19 | ||
20 | const QString CableNetNode::nodeDescription(){ | 20 | const QString CableNetNode::nodeDescription(){ |
21 | return tr("\ | 21 | return tr("\ |
22 | <p>Sets up a wired serial or parallel.</p>\ | 22 | <p>Sets up a wired serial or parallel.</p>\ |
23 | " | 23 | " |
24 | ); | 24 | ); |
25 | } | 25 | } |
26 | 26 | ||
27 | ANetNodeInstance * CableNetNode::createInstance( void ) { | 27 | ANetNodeInstance * CableNetNode::createInstance( void ) { |
28 | return new ACable( this ); | 28 | return new ACable( this ); |
29 | } | 29 | } |
30 | 30 | ||
31 | const char ** CableNetNode::needs( void ) { | 31 | const char ** CableNetNode::needs( void ) { |
32 | return CableNeeds; | 32 | return CableNeeds; |
33 | } | 33 | } |
34 | 34 | ||
35 | const char * CableNetNode::provides( void ) { | 35 | const char * CableNetNode::provides( void ) { |
36 | return "line"; | 36 | return "line"; |
37 | } | 37 | } |
38 | 38 | ||
39 | bool CableNetNode::generateProperFilesFor( | 39 | bool CableNetNode::generateProperFilesFor( |
40 | ANetNodeInstance * ) { | 40 | ANetNodeInstance * ) { |
41 | return 1; | 41 | return 1; |
42 | } | 42 | } |
43 | 43 | ||
44 | bool CableNetNode::generateDeviceDataForCommonFile( | 44 | bool CableNetNode::generateDeviceDataForCommonFile( |
45 | SystemFile & , | 45 | SystemFile & , |
46 | long ) { | 46 | long ) { |
47 | return 1; | 47 | return 1; |
48 | } | 48 | } |
49 | 49 | ||
50 | void CableNetNode::setSpecificAttribute( QString & , QString & ) { | 50 | void CableNetNode::setSpecificAttribute( QString & , QString & ) { |
51 | } | 51 | } |
52 | 52 | ||
53 | void CableNetNode::saveSpecificAttribute( QTextStream & ) { | 53 | void CableNetNode::saveSpecificAttribute( QTextStream & ) { |
54 | } | 54 | } |
55 | 55 | ||
56 | extern "C" { | 56 | extern "C" { |
57 | void create_plugin( QList<ANetNode> & PNN ) { | 57 | void create_plugin( QList<ANetNode> & PNN ) { |
58 | PNN.append( new CableNetNode() ); | 58 | PNN.append( new CableNetNode() ); |
59 | } | 59 | } |
60 | } | 60 | } |
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h index b37f31a..c48037a 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.h +++ b/noncore/settings/networksettings2/cable/cable_NN.h | |||
@@ -1,47 +1,44 @@ | |||
1 | #ifndef CABLE_NETNODE_H | 1 | #ifndef CABLE_NETNODE_H |
2 | #define CABLE_NETNODE_H | 2 | #define CABLE_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class ACable; | 6 | class ACable; |
7 | 7 | ||
8 | class CableNetNode : public ANetNode { | 8 | class CableNetNode : public ANetNode { |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | CableNetNode(); | 14 | CableNetNode(); |
15 | virtual ~CableNetNode(); | 15 | virtual ~CableNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/cable"; } | 18 | { return "Devices/cable"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("Cable Connection"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & ) | 28 | virtual bool hasDataFor( const QString & ) |
32 | { return 0; } | 29 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 30 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr); | 31 | SystemFile & SF, long DevNr); |
35 | 32 | ||
36 | private: | 33 | private: |
37 | 34 | ||
38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
39 | virtual void saveSpecificAttribute( QTextStream & TS ); | 36 | virtual void saveSpecificAttribute( QTextStream & TS ); |
40 | }; | 37 | }; |
41 | 38 | ||
42 | extern "C" | 39 | extern "C" |
43 | { | 40 | { |
44 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
45 | }; | 42 | }; |
46 | 43 | ||
47 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp index 4bbe502..77826d1 100644 --- a/noncore/settings/networksettings2/editconnection.cpp +++ b/noncore/settings/networksettings2/editconnection.cpp | |||
@@ -1,577 +1,577 @@ | |||
1 | #include <qlistview.h> | 1 | #include <qlistview.h> |
2 | #include <qwidgetstack.h> | 2 | #include <qwidgetstack.h> |
3 | #include <qframe.h> | 3 | #include <qframe.h> |
4 | #include <qcombobox.h> | 4 | #include <qcombobox.h> |
5 | #include <qtabwidget.h> | 5 | #include <qtabwidget.h> |
6 | #include <qmessagebox.h> | 6 | #include <qmessagebox.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | #include <qheader.h> | 9 | #include <qheader.h> |
10 | #include <qpainter.h> | 10 | #include <qpainter.h> |
11 | #include <qcheckbox.h> | 11 | #include <qcheckbox.h> |
12 | #include <qlabel.h> | 12 | #include <qlabel.h> |
13 | 13 | ||
14 | #include "editconnection.h" | 14 | #include "editconnection.h" |
15 | #include "resources.h" | 15 | #include "resources.h" |
16 | #include "netnode.h" | 16 | #include "netnode.h" |
17 | 17 | ||
18 | // | 18 | // |
19 | // | 19 | // |
20 | // THESE TO GIVE BETTER FEEDBACK ABOUT DISABLED ITEMS | 20 | // THESE TO GIVE BETTER FEEDBACK ABOUT DISABLED ITEMS |
21 | // | 21 | // |
22 | // | 22 | // |
23 | 23 | ||
24 | class MyQCheckListItem : public QCheckListItem | 24 | class MyQCheckListItem : public QCheckListItem |
25 | { | 25 | { |
26 | public: | 26 | public: |
27 | MyQCheckListItem( QListView *parent, const QString & S, Type T ) : | 27 | MyQCheckListItem( QListView *parent, const QString & S, Type T ) : |
28 | QCheckListItem( parent, S, T ) { } | 28 | QCheckListItem( parent, S, T ) { } |
29 | MyQCheckListItem( QCheckListItem *parent, const QString & S, Type T ) : | 29 | MyQCheckListItem( QCheckListItem *parent, const QString & S, Type T ) : |
30 | QCheckListItem( parent, S, T ) { } | 30 | QCheckListItem( parent, S, T ) { } |
31 | MyQCheckListItem( QListViewItem *parent, const QString & S, Type T ) : | 31 | MyQCheckListItem( QListViewItem *parent, const QString & S, Type T ) : |
32 | QCheckListItem( parent, S, T ) { } | 32 | QCheckListItem( parent, S, T ) { } |
33 | 33 | ||
34 | virtual void paintCell( QPainter *p, const QColorGroup &cg, | 34 | virtual void paintCell( QPainter *p, const QColorGroup &cg, |
35 | int column, int width, int alignment ); | 35 | int column, int width, int alignment ); |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | void MyQCheckListItem::paintCell( QPainter *p, const QColorGroup &cg, | 39 | void MyQCheckListItem::paintCell( QPainter *p, const QColorGroup &cg, |
40 | int column, int width, int alignment ) | 40 | int column, int width, int alignment ) |
41 | { | 41 | { |
42 | QColorGroup _cg( cg ); | 42 | QColorGroup _cg( cg ); |
43 | QColor c = _cg.text(); | 43 | QColor c = _cg.text(); |
44 | if ( ! isSelectable() ) | 44 | if ( ! isSelectable() ) |
45 | _cg.setColor( QColorGroup::Text, Qt::lightGray ); | 45 | _cg.setColor( QColorGroup::Text, Qt::lightGray ); |
46 | QCheckListItem::paintCell( p, _cg, column, width, alignment ); | 46 | QCheckListItem::paintCell( p, _cg, column, width, alignment ); |
47 | _cg.setColor( QColorGroup::Text, c ); | 47 | _cg.setColor( QColorGroup::Text, c ); |
48 | } | 48 | } |
49 | 49 | ||
50 | class MyQListViewItem : public QListViewItem | 50 | class MyQListViewItem : public QListViewItem |
51 | { | 51 | { |
52 | public: | 52 | public: |
53 | MyQListViewItem( QListView *parent, const QString & S ) : | 53 | MyQListViewItem( QListView *parent, const QString & S ) : |
54 | QListViewItem( parent, S ) { } | 54 | QListViewItem( parent, S ) { } |
55 | MyQListViewItem( QListViewItem *parent, const QString & S ) : | 55 | MyQListViewItem( QListViewItem *parent, const QString & S ) : |
56 | QListViewItem( parent, S ) { } | 56 | QListViewItem( parent, S ) { } |
57 | 57 | ||
58 | virtual void paintCell( QPainter *p, const QColorGroup &cg, | 58 | virtual void paintCell( QPainter *p, const QColorGroup &cg, |
59 | int column, int width, int alignment ); | 59 | int column, int width, int alignment ); |
60 | 60 | ||
61 | }; | 61 | }; |
62 | 62 | ||
63 | void MyQListViewItem::paintCell( QPainter *p, const QColorGroup &cg, | 63 | void MyQListViewItem::paintCell( QPainter *p, const QColorGroup &cg, |
64 | int column, int width, int alignment ) | 64 | int column, int width, int alignment ) |
65 | { | 65 | { |
66 | QColorGroup _cg( cg ); | 66 | QColorGroup _cg( cg ); |
67 | QColor c = _cg.text(); | 67 | QColor c = _cg.text(); |
68 | if ( ! isSelectable() ) | 68 | if ( ! isSelectable() ) |
69 | _cg.setColor( QColorGroup::Text, Qt::lightGray ); | 69 | _cg.setColor( QColorGroup::Text, Qt::lightGray ); |
70 | QListViewItem::paintCell( p, _cg, column, width, alignment ); | 70 | QListViewItem::paintCell( p, _cg, column, width, alignment ); |
71 | _cg.setColor( QColorGroup::Text, c ); | 71 | _cg.setColor( QColorGroup::Text, c ); |
72 | } | 72 | } |
73 | 73 | ||
74 | // | 74 | // |
75 | // | 75 | // |
76 | // REAL GUI | 76 | // REAL GUI |
77 | // | 77 | // |
78 | // | 78 | // |
79 | 79 | ||
80 | bool EditConnection::AutoCollapse = 1; | 80 | bool EditConnection::AutoCollapse = 1; |
81 | 81 | ||
82 | EditConnection::EditConnection( QWidget* parent ) : | 82 | EditConnection::EditConnection( QWidget* parent ) : |
83 | EditConnectionGUI( parent, 0, TRUE ), TmpCollection() { | 83 | EditConnectionGUI( parent, 0, TRUE ), TmpCollection() { |
84 | 84 | ||
85 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); | 85 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); |
86 | Setup_FRM->setEnabled( FALSE ); | 86 | Setup_FRM->setEnabled( FALSE ); |
87 | 87 | ||
88 | TmpIsValid = 0; | 88 | TmpIsValid = 0; |
89 | SelectedNodes = 0; | 89 | SelectedNodes = 0; |
90 | 90 | ||
91 | AutoCollapse_CB->setChecked( AutoCollapse ); | 91 | AutoCollapse_CB->setChecked( AutoCollapse ); |
92 | 92 | ||
93 | Mapping = new QPtrDict<ANetNode>; | 93 | Mapping = new QPtrDict<ANetNode>; |
94 | Mapping->setAutoDelete( FALSE ); | 94 | Mapping->setAutoDelete( FALSE ); |
95 | Nodes_LV->header()->hide(); | 95 | Nodes_LV->header()->hide(); |
96 | // popluate tree with all NetNodes | 96 | // popluate tree with all NetNodes |
97 | buildFullTree(); | 97 | buildFullTree(); |
98 | } | 98 | } |
99 | 99 | ||
100 | NodeCollection * EditConnection::getTmpCollection( void ) { | 100 | NodeCollection * EditConnection::getTmpCollection( void ) { |
101 | 101 | ||
102 | if( TmpIsValid ) | 102 | if( TmpIsValid ) |
103 | // content is stil OK | 103 | // content is stil OK |
104 | return &(TmpCollection); | 104 | return &(TmpCollection); |
105 | 105 | ||
106 | // reset collection -> delete all NEW NetNodes | 106 | // reset collection -> delete all NEW NetNodes |
107 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 107 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
108 | it.current(); | 108 | it.current(); |
109 | ++it ) { | 109 | ++it ) { |
110 | if( it.current()->isNew() ) { | 110 | if( it.current()->isNew() ) { |
111 | delete it.current(); | 111 | delete it.current(); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | TmpCollection.clear(); | 114 | TmpCollection.clear(); |
115 | 115 | ||
116 | // update content | 116 | // update content |
117 | QListViewItem * it = Nodes_LV->firstChild(); | 117 | QListViewItem * it = Nodes_LV->firstChild(); |
118 | ANetNode * NN; | 118 | ANetNode * NN; |
119 | // start iter | 119 | // start iter |
120 | ANetNodeInstance * NNI = | 120 | ANetNodeInstance * NNI = |
121 | (SelectedNodes) ? SelectedNodes->first() : 0 ; | 121 | (SelectedNodes) ? SelectedNodes->first() : 0 ; |
122 | 122 | ||
123 | TmpCollection.setModified( 0 ); | 123 | TmpCollection.setModified( 0 ); |
124 | 124 | ||
125 | while ( it ) { | 125 | while ( it ) { |
126 | NN = (*Mapping)[it]; | 126 | NN = (*Mapping)[it]; |
127 | if( NN == 0 ) { | 127 | if( NN == 0 ) { |
128 | // child is controller -> has sub radio | 128 | // child is controller -> has sub radio |
129 | // check if one radio is selected | 129 | // check if one radio is selected |
130 | it = it->firstChild(); | 130 | it = it->firstChild(); |
131 | while( it ) { | 131 | while( it ) { |
132 | if( ((QCheckListItem *)it)->isOn() ) { | 132 | if( ((QCheckListItem *)it)->isOn() ) { |
133 | // this radio is selected -> go deeper | 133 | // this radio is selected -> go deeper |
134 | if( SelectedNodes == 0 || | 134 | if( SelectedNodes == 0 || |
135 | NNI == 0 || | 135 | NNI == 0 || |
136 | NNI->nodeClass()->nodeName() != it->text(0) ) { | 136 | it->text(0) != NNI->nodeClass()->name() ) { |
137 | // new item not in previous collection | 137 | // new item not in previous collection |
138 | ANetNodeInstance * NNI = (*Mapping)[it]->createInstance(); | 138 | ANetNodeInstance * NNI = (*Mapping)[it]->createInstance(); |
139 | NNI->initialize(); | 139 | NNI->initialize(); |
140 | // this node type not in collection | 140 | // this node type not in collection |
141 | TmpCollection.append( NNI ); | 141 | TmpCollection.append( NNI ); |
142 | // master collection changed because new item in it | 142 | // master collection changed because new item in it |
143 | TmpCollection.setModified( 1 ); | 143 | TmpCollection.setModified( 1 ); |
144 | // no more valid items in old list | 144 | // no more valid items in old list |
145 | NNI = 0; | 145 | NNI = 0; |
146 | } else { | 146 | } else { |
147 | // already in list -> copy pointer | 147 | // already in list -> copy pointer |
148 | TmpCollection.append( NNI ); | 148 | TmpCollection.append( NNI ); |
149 | NNI = SelectedNodes->next(); | 149 | NNI = SelectedNodes->next(); |
150 | } | 150 | } |
151 | it = it->firstChild(); | 151 | it = it->firstChild(); |
152 | // do not bother to check other items | 152 | // do not bother to check other items |
153 | break; | 153 | break; |
154 | } | 154 | } |
155 | it = it->nextSibling(); | 155 | it = it->nextSibling(); |
156 | } | 156 | } |
157 | } else { | 157 | } else { |
158 | // check children | 158 | // check children |
159 | it = it->firstChild(); | 159 | it = it->firstChild(); |
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | TmpIsValid = 1; | 163 | TmpIsValid = 1; |
164 | return &(TmpCollection); | 164 | return &(TmpCollection); |
165 | } | 165 | } |
166 | 166 | ||
167 | // pass a connection NodeCollection to be edited | 167 | // pass a connection NodeCollection to be edited |
168 | void EditConnection::setConnection( NodeCollection * NC ) { | 168 | void EditConnection::setConnection( NodeCollection * NC ) { |
169 | ANetNodeInstance * NNI; | 169 | ANetNodeInstance * NNI; |
170 | ANetNode * NN; | 170 | ANetNode * NN; |
171 | 171 | ||
172 | SelectedNodes = NC; | 172 | SelectedNodes = NC; |
173 | Name_LE->setText( NC->name() ); | 173 | Name_LE->setText( NC->name() ); |
174 | NNI = NC->first(); | 174 | NNI = NC->first(); |
175 | 175 | ||
176 | // show configure tabl | 176 | // show configure tabl |
177 | Tab_TB->setCurrentPage( 1 ); | 177 | Tab_TB->setCurrentPage( 1 ); |
178 | 178 | ||
179 | // valid colledction | 179 | // valid colledction |
180 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); | 180 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); |
181 | Setup_FRM->setEnabled( FALSE ); | 181 | Setup_FRM->setEnabled( FALSE ); |
182 | 182 | ||
183 | // select items in collection | 183 | // select items in collection |
184 | QListViewItem * it = Nodes_LV->firstChild(); | 184 | QListViewItem * it = Nodes_LV->firstChild(); |
185 | bool Found; | 185 | bool Found; |
186 | 186 | ||
187 | TmpIsValid = 0; | 187 | TmpIsValid = 0; |
188 | 188 | ||
189 | while ( it ) { | 189 | while ( it ) { |
190 | // listitem corresponds to netnode | 190 | // listitem corresponds to netnode |
191 | NN = (*Mapping)[it]; | 191 | NN = (*Mapping)[it]; |
192 | if( NN == 0 ) { | 192 | if( NN == 0 ) { |
193 | // child is controller -> has sub radio | 193 | // child is controller -> has sub radio |
194 | QString Ctr = it->text(0); | 194 | QString Ctr = it->text(0); |
195 | // check if one radio is selected | 195 | // check if one radio is selected |
196 | it = it->firstChild(); | 196 | it = it->firstChild(); |
197 | Found = 0; | 197 | Found = 0; |
198 | while( it ) { | 198 | while( it ) { |
199 | if( NNI && NNI->nodeClass()->nodeName() == it->text(0) ) { | 199 | if( NNI && it->text(0) == NNI->nodeClass()->name() ) { |
200 | // this radio is part of the collection | 200 | // this radio is part of the collection |
201 | ((QCheckListItem *)it)->setOn( 1 ); | 201 | ((QCheckListItem *)it)->setOn( 1 ); |
202 | updateGUI( it, NNI->nodeClass() ); | 202 | updateGUI( it, NNI->nodeClass() ); |
203 | // check its children | 203 | // check its children |
204 | Found = 1; | 204 | Found = 1; |
205 | it = it->firstChild(); | 205 | it = it->firstChild(); |
206 | NNI = SelectedNodes->next(); | 206 | NNI = SelectedNodes->next(); |
207 | // do not bother to check other items | 207 | // do not bother to check other items |
208 | break; | 208 | break; |
209 | } | 209 | } |
210 | it = it->nextSibling(); | 210 | it = it->nextSibling(); |
211 | } | 211 | } |
212 | if( ! Found ) { | 212 | if( ! Found ) { |
213 | // this means that this level is NOT present in collection | 213 | // this means that this level is NOT present in collection |
214 | // probably INCOMPATIBEL collection OR Missing plugin | 214 | // probably INCOMPATIBEL collection OR Missing plugin |
215 | QMessageBox::warning( | 215 | QMessageBox::warning( |
216 | 0, | 216 | 0, |
217 | tr( "Error presentig Connection" ), | 217 | tr( "Error presentig Connection" ), |
218 | tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ). | 218 | tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ). |
219 | arg(Ctr) ); | 219 | arg(Ctr) ); |
220 | return; | 220 | return; |
221 | } | 221 | } |
222 | } else { | 222 | } else { |
223 | // automatic item -> check children | 223 | // automatic item -> check children |
224 | it = it->firstChild(); | 224 | it = it->firstChild(); |
225 | } | 225 | } |
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
229 | // get result of editing (either new OR updated collection | 229 | // get result of editing (either new OR updated collection |
230 | NodeCollection * EditConnection::connection( void ) { | 230 | NodeCollection * EditConnection::connection( void ) { |
231 | 231 | ||
232 | if( SelectedNodes == 0 ) { | 232 | if( SelectedNodes == 0 ) { |
233 | // new collection | 233 | // new collection |
234 | SelectedNodes = new NodeCollection; | 234 | SelectedNodes = new NodeCollection; |
235 | } | 235 | } |
236 | 236 | ||
237 | // clean out old entries | 237 | // clean out old entries |
238 | SelectedNodes->clear(); | 238 | SelectedNodes->clear(); |
239 | 239 | ||
240 | // transfer | 240 | // transfer |
241 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 241 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
242 | it.current(); | 242 | it.current(); |
243 | ++it ) { | 243 | ++it ) { |
244 | SelectedNodes->append( it.current() ); | 244 | SelectedNodes->append( it.current() ); |
245 | } | 245 | } |
246 | 246 | ||
247 | if( TmpCollection.isModified() ) | 247 | if( TmpCollection.isModified() ) |
248 | SelectedNodes->setModified( 1 ); | 248 | SelectedNodes->setModified( 1 ); |
249 | 249 | ||
250 | if( SelectedNodes->name() != Name_LE->text() ) { | 250 | if( SelectedNodes->name() != Name_LE->text() ) { |
251 | SelectedNodes->setName( Name_LE->text() ); | 251 | SelectedNodes->setName( Name_LE->text() ); |
252 | SelectedNodes->setModified( 1 ); | 252 | SelectedNodes->setModified( 1 ); |
253 | } | 253 | } |
254 | 254 | ||
255 | return SelectedNodes; | 255 | return SelectedNodes; |
256 | } | 256 | } |
257 | 257 | ||
258 | // Build device tree -> start | 258 | // Build device tree -> start |
259 | void EditConnection::buildFullTree( void ) { | 259 | void EditConnection::buildFullTree( void ) { |
260 | ANetNode * NN; | 260 | ANetNode * NN; |
261 | 261 | ||
262 | // toplevel item | 262 | // toplevel item |
263 | MyQCheckListItem * TheTop = new MyQCheckListItem( | 263 | MyQCheckListItem * TheTop = new MyQCheckListItem( |
264 | Nodes_LV, | 264 | Nodes_LV, |
265 | NSResources->netNode2Name("fullsetup"), | 265 | NSResources->netNode2Name("fullsetup"), |
266 | QCheckListItem::Controller ); | 266 | QCheckListItem::Controller ); |
267 | TheTop->setOpen( TRUE ); | 267 | TheTop->setOpen( TRUE ); |
268 | Description_LBL->setText( | 268 | Description_LBL->setText( |
269 | NSResources->netNode2Description( "fullsetup" ) ); | 269 | NSResources->netNode2Description( "fullsetup" ) ); |
270 | Nodes_LV->setSelected( TheTop, TRUE ); | 270 | Nodes_LV->setSelected( TheTop, TRUE ); |
271 | 271 | ||
272 | // find all Nodes that care toplevel nodes -> ie provide | 272 | // find all Nodes that care toplevel nodes -> ie provide |
273 | // TCP/IP Connection | 273 | // TCP/IP Connection |
274 | for( QDictIterator<NetNode_t> Iter(NSResources->netNodes()); | 274 | for( QDictIterator<NetNode_t> Iter(NSResources->netNodes()); |
275 | Iter.current(); | 275 | Iter.current(); |
276 | ++Iter ) { | 276 | ++Iter ) { |
277 | 277 | ||
278 | NN = Iter.current()->NetNode; | 278 | NN = Iter.current()->NetNode; |
279 | 279 | ||
280 | if( ! NN->isToplevel() ) { | 280 | if( ! NN->isToplevel() ) { |
281 | continue; | 281 | continue; |
282 | } | 282 | } |
283 | 283 | ||
284 | MyQCheckListItem * it = new MyQCheckListItem( TheTop, | 284 | MyQCheckListItem * it = new MyQCheckListItem( TheTop, |
285 | NN->nodeName(), | 285 | NN->name(), |
286 | QCheckListItem::RadioButton ); | 286 | QCheckListItem::RadioButton ); |
287 | it->setPixmap( 0, NSResources->getPixmap( "Devices/commprofile" ) ); | 287 | it->setPixmap( 0, NSResources->getPixmap( "Devices/commprofile" ) ); |
288 | // remember that this node maps to this listitem | 288 | // remember that this node maps to this listitem |
289 | Mapping->insert( it, NN ); | 289 | Mapping->insert( it, NN ); |
290 | buildSubTree( it, NN ); | 290 | buildSubTree( it, NN ); |
291 | } | 291 | } |
292 | } | 292 | } |
293 | 293 | ||
294 | // Build device tree -> help function | 294 | // Build device tree -> help function |
295 | void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { | 295 | void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { |
296 | ANetNode::NetNodeList & NNL = NN->alternatives(); | 296 | ANetNode::NetNodeList & NNL = NN->alternatives(); |
297 | 297 | ||
298 | if( NNL.size() > 1 ) { | 298 | if( NNL.size() > 1 ) { |
299 | // this node has alternatives -> needs radio buttons | 299 | // this node has alternatives -> needs radio buttons |
300 | it = new MyQCheckListItem( | 300 | it = new MyQCheckListItem( |
301 | it, | 301 | it, |
302 | NSResources->netNode2Name(NNL[0]->provides()), | 302 | NSResources->netNode2Name(NNL[0]->provides()), |
303 | QCheckListItem::Controller ); | 303 | QCheckListItem::Controller ); |
304 | it->setSelectable( FALSE ); | 304 | it->setSelectable( FALSE ); |
305 | } | 305 | } |
306 | 306 | ||
307 | for ( unsigned int i=0; i < NNL.size(); i++ ) { | 307 | for ( unsigned int i=0; i < NNL.size(); i++ ) { |
308 | QListViewItem * CI; | 308 | QListViewItem * CI; |
309 | if( NNL.size() > 1 ) { | 309 | if( NNL.size() > 1 ) { |
310 | // generate radio buttons | 310 | // generate radio buttons |
311 | CI = new MyQCheckListItem( | 311 | CI = new MyQCheckListItem( |
312 | (QCheckListItem *)it, | 312 | (QCheckListItem *)it, |
313 | NNL[i]->nodeName(), QCheckListItem::RadioButton ); | 313 | NNL[i]->name(), QCheckListItem::RadioButton ); |
314 | // remember that this node maps to this listitem | 314 | // remember that this node maps to this listitem |
315 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); | 315 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); |
316 | Mapping->insert( CI, NNL[i] ); | 316 | Mapping->insert( CI, NNL[i] ); |
317 | CI->setSelectable( FALSE ); | 317 | CI->setSelectable( FALSE ); |
318 | } else { | 318 | } else { |
319 | // Single item | 319 | // Single item |
320 | CI = new MyQListViewItem( it, NNL[i]->nodeName() ); | 320 | CI = new MyQListViewItem( it, NNL[i]->name() ); |
321 | // remember that this node maps to this listitem | 321 | // remember that this node maps to this listitem |
322 | Mapping->insert( CI, NNL[i] ); | 322 | Mapping->insert( CI, NNL[i] ); |
323 | CI->setSelectable( FALSE ); | 323 | CI->setSelectable( FALSE ); |
324 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); | 324 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); |
325 | } | 325 | } |
326 | buildSubTree( CI, NNL[i] ); | 326 | buildSubTree( CI, NNL[i] ); |
327 | } | 327 | } |
328 | } | 328 | } |
329 | 329 | ||
330 | // Clicked ok OK button | 330 | // Clicked ok OK button |
331 | void EditConnection::accept( void ) { | 331 | void EditConnection::accept( void ) { |
332 | if( ! haveCompleteConfig( 0 ) || Name_LE->text().isEmpty() ) { | 332 | if( ! haveCompleteConfig( 0 ) || Name_LE->text().isEmpty() ) { |
333 | QMessageBox::warning( | 333 | QMessageBox::warning( |
334 | 0, | 334 | 0, |
335 | tr( "Closing Connection Setup" ), | 335 | tr( "Closing Connection Setup" ), |
336 | tr( "Definition not complete or no name" ) ); | 336 | tr( "Definition not complete or no name" ) ); |
337 | return; | 337 | return; |
338 | } | 338 | } |
339 | 339 | ||
340 | // check if all devices have acceptable input | 340 | // check if all devices have acceptable input |
341 | getTmpCollection(); | 341 | getTmpCollection(); |
342 | { ANetNodeInstance * NNI; | 342 | { ANetNodeInstance * NNI; |
343 | QString S; | 343 | QString S; |
344 | 344 | ||
345 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 345 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
346 | it.current(); | 346 | it.current(); |
347 | ++it ) { | 347 | ++it ) { |
348 | NNI = it.current(); | 348 | NNI = it.current(); |
349 | // widget must show its own problems | 349 | // widget must show its own problems |
350 | S = NNI->acceptable(); | 350 | S = NNI->acceptable(); |
351 | if( ! S.isEmpty() ) { | 351 | if( ! S.isEmpty() ) { |
352 | QMessageBox::warning( | 352 | QMessageBox::warning( |
353 | 0, | 353 | 0, |
354 | tr( "Cannot save" ), | 354 | tr( "Cannot save" ), |
355 | S ); | 355 | S ); |
356 | return; | 356 | return; |
357 | } | 357 | } |
358 | NNI->commit(); | 358 | NNI->commit(); |
359 | 359 | ||
360 | if( NNI->isModified() ) { | 360 | if( NNI->isModified() ) { |
361 | TmpCollection.setModified( 1 ); | 361 | TmpCollection.setModified( 1 ); |
362 | // commit the data | 362 | // commit the data |
363 | } | 363 | } |
364 | } | 364 | } |
365 | } | 365 | } |
366 | 366 | ||
367 | QDialog::accept(); | 367 | QDialog::accept(); |
368 | } | 368 | } |
369 | 369 | ||
370 | // triggered by CB | 370 | // triggered by CB |
371 | void EditConnection::SLOT_AutoCollapse( bool b ) { | 371 | void EditConnection::SLOT_AutoCollapse( bool b ) { |
372 | AutoCollapse = b; | 372 | AutoCollapse = b; |
373 | } | 373 | } |
374 | 374 | ||
375 | // clicked on node in tree -> update GUI | 375 | // clicked on node in tree -> update GUI |
376 | void EditConnection::SLOT_SelectNode( QListViewItem * it ) { | 376 | void EditConnection::SLOT_SelectNode( QListViewItem * it ) { |
377 | ANetNode * NN; | 377 | ANetNode * NN; |
378 | if( it == 0 || it->depth() == 0 ) { | 378 | if( it == 0 || it->depth() == 0 ) { |
379 | Description_LBL->setText( | 379 | Description_LBL->setText( |
380 | NSResources->netNode2Description( "fullsetup" ) ); | 380 | NSResources->netNode2Description( "fullsetup" ) ); |
381 | // topevel or no selection | 381 | // topevel or no selection |
382 | return; | 382 | return; |
383 | } | 383 | } |
384 | 384 | ||
385 | // store conversion from lvitem to node | 385 | // store conversion from lvitem to node |
386 | NN = (*Mapping)[ it ]; | 386 | NN = (*Mapping)[ it ]; |
387 | 387 | ||
388 | if( ! NN ) { | 388 | if( ! NN ) { |
389 | // intermediate node | 389 | // intermediate node |
390 | NN = (*Mapping)[ it->firstChild() ]; | 390 | NN = (*Mapping)[ it->firstChild() ]; |
391 | if( NN ) { | 391 | if( NN ) { |
392 | // figure out type of this node -> produce mesage | 392 | // figure out type of this node -> produce mesage |
393 | Description_LBL->setText( NSResources->netNode2Description(NN->provides()) ); | 393 | Description_LBL->setText( NSResources->netNode2Description(NN->provides()) ); |
394 | } else { | 394 | } else { |
395 | Description_LBL->setText( "" ); | 395 | Description_LBL->setText( "" ); |
396 | } | 396 | } |
397 | return; | 397 | return; |
398 | } | 398 | } |
399 | 399 | ||
400 | Description_LBL->setText( NN->nodeDescription() ); | 400 | Description_LBL->setText( NN->nodeDescription() ); |
401 | 401 | ||
402 | if( ! it->isSelectable() ) { | 402 | if( ! it->isSelectable() ) { |
403 | return; | 403 | return; |
404 | } | 404 | } |
405 | 405 | ||
406 | if( ! ((QCheckListItem *)it)->isOn() ) { | 406 | if( ! ((QCheckListItem *)it)->isOn() ) { |
407 | // clicked on line but NOT on Check or Radio item | 407 | // clicked on line but NOT on Check or Radio item |
408 | return; | 408 | return; |
409 | } | 409 | } |
410 | 410 | ||
411 | // item has really changed -> update | 411 | // item has really changed -> update |
412 | TmpIsValid = 0; | 412 | TmpIsValid = 0; |
413 | updateGUI( it, NN ); | 413 | updateGUI( it, NN ); |
414 | } | 414 | } |
415 | 415 | ||
416 | // cliecked on TAB to go to setup | 416 | // cliecked on TAB to go to setup |
417 | void EditConnection::SLOT_AlterTab( const QString & S ) { | 417 | void EditConnection::SLOT_AlterTab( const QString & S ) { |
418 | if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) { | 418 | if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) { |
419 | // switched to setup -> update CB and populate ws with | 419 | // switched to setup -> update CB and populate ws with |
420 | // forms for devices | 420 | // forms for devices |
421 | 421 | ||
422 | if( ! TmpIsValid ) { | 422 | if( ! TmpIsValid ) { |
423 | getTmpCollection(); | 423 | getTmpCollection(); |
424 | 424 | ||
425 | // clear CB and Ws | 425 | // clear CB and Ws |
426 | { QWidget * W; | 426 | { QWidget * W; |
427 | int i = 0; | 427 | int i = 0; |
428 | 428 | ||
429 | Devices_CB->clear(); | 429 | Devices_CB->clear(); |
430 | while( ( W = Setup_WS->widget( i ) ) ) { | 430 | while( ( W = Setup_WS->widget( i ) ) ) { |
431 | Setup_WS->removeWidget( W ); | 431 | Setup_WS->removeWidget( W ); |
432 | i ++; | 432 | i ++; |
433 | } | 433 | } |
434 | } | 434 | } |
435 | 435 | ||
436 | // update CB | 436 | // update CB |
437 | // and populate WidgetStack | 437 | // and populate WidgetStack |
438 | { ANetNodeInstance * NNI; | 438 | { ANetNodeInstance * NNI; |
439 | QListIterator<ANetNodeInstance> it(TmpCollection); | 439 | QListIterator<ANetNodeInstance> it(TmpCollection); |
440 | int i = 0; | 440 | int i = 0; |
441 | QWidget * W; | 441 | QWidget * W; |
442 | 442 | ||
443 | for ( ; it.current(); ++it ) { | 443 | for ( ; it.current(); ++it ) { |
444 | NNI = it.current(); | 444 | NNI = it.current(); |
445 | Devices_CB->insertItem( | 445 | Devices_CB->insertItem( |
446 | NSResources->getPixmap( NNI->nodeClass()->pixmapName() ), | 446 | NSResources->getPixmap( NNI->nodeClass()->pixmapName() ), |
447 | NNI->nodeClass()->nodeName() | 447 | NNI->nodeClass()->name() |
448 | ); | 448 | ); |
449 | 449 | ||
450 | // add edit widget | 450 | // add edit widget |
451 | W = NNI->edit( Setup_WS ); | 451 | W = NNI->edit( Setup_WS ); |
452 | if( ! W) { | 452 | if( ! W) { |
453 | W = new QLabel( Setup_WS, | 453 | W = new QLabel( Setup_WS, |
454 | tr("No configuration required")); | 454 | tr("No configuration required")); |
455 | } | 455 | } |
456 | Setup_WS->addWidget( W , i ); | 456 | Setup_WS->addWidget( W , i ); |
457 | i ++; | 457 | i ++; |
458 | } | 458 | } |
459 | } | 459 | } |
460 | Setup_WS->raiseWidget( 0 ); | 460 | Setup_WS->raiseWidget( 0 ); |
461 | } // still valid | 461 | } // still valid |
462 | } | 462 | } |
463 | } | 463 | } |
464 | 464 | ||
465 | // update visual feedback of selection state | 465 | // update visual feedback of selection state |
466 | void EditConnection::updateGUI( QListViewItem * it, ANetNode * NN ) { | 466 | void EditConnection::updateGUI( QListViewItem * it, ANetNode * NN ) { |
467 | 467 | ||
468 | bool HCC = haveCompleteConfig( it ); | 468 | bool HCC = haveCompleteConfig( it ); |
469 | Tab_TB->setTabEnabled( Setup_FRM, HCC ); | 469 | Tab_TB->setTabEnabled( Setup_FRM, HCC ); |
470 | Setup_FRM->setEnabled( HCC ); | 470 | Setup_FRM->setEnabled( HCC ); |
471 | 471 | ||
472 | // disable children of all siblings at same level | 472 | // disable children of all siblings at same level |
473 | QListViewItem * Sbl = it->parent()->firstChild(); | 473 | QListViewItem * Sbl = it->parent()->firstChild(); |
474 | while( Sbl ) { | 474 | while( Sbl ) { |
475 | if ( Sbl != it ) { | 475 | if ( Sbl != it ) { |
476 | disableTree( Sbl->firstChild(), FALSE ); | 476 | disableTree( Sbl->firstChild(), FALSE ); |
477 | Sbl->setSelectable( TRUE ); | 477 | Sbl->setSelectable( TRUE ); |
478 | if( AutoCollapse ) | 478 | if( AutoCollapse ) |
479 | Sbl->setOpen( FALSE ); | 479 | Sbl->setOpen( FALSE ); |
480 | } | 480 | } |
481 | Sbl = Sbl->nextSibling(); | 481 | Sbl = Sbl->nextSibling(); |
482 | } | 482 | } |
483 | 483 | ||
484 | // enable selected path (as deep as it goes | 484 | // enable selected path (as deep as it goes |
485 | it->setOpen( TRUE ); | 485 | it->setOpen( TRUE ); |
486 | enablePath( it->firstChild(), | 486 | enablePath( it->firstChild(), |
487 | (it->depth()==1) ? | 487 | (it->depth()==1) ? |
488 | 1 : // toplevel always alternatives | 488 | 1 : // toplevel always alternatives |
489 | (NN->alternatives().size() > 1) ); | 489 | (NN->alternatives().size() > 1) ); |
490 | } | 490 | } |
491 | 491 | ||
492 | void EditConnection::disableTree( QListViewItem * it, bool Mode ) { | 492 | void EditConnection::disableTree( QListViewItem * it, bool Mode ) { |
493 | while( it ) { | 493 | while( it ) { |
494 | // disable sbl's chidren | 494 | // disable sbl's chidren |
495 | it->setSelectable( Mode ); | 495 | it->setSelectable( Mode ); |
496 | if( AutoCollapse ) | 496 | if( AutoCollapse ) |
497 | it->setOpen( Mode ); | 497 | it->setOpen( Mode ); |
498 | disableTree( it->firstChild(), Mode ); | 498 | disableTree( it->firstChild(), Mode ); |
499 | it = it->nextSibling(); | 499 | it = it->nextSibling(); |
500 | } | 500 | } |
501 | } | 501 | } |
502 | 502 | ||
503 | // pah : ParentHasAlternatives | 503 | // pah : ParentHasAlternatives |
504 | void EditConnection::enablePath( QListViewItem * it, bool pha ) { | 504 | void EditConnection::enablePath( QListViewItem * it, bool pha ) { |
505 | while( it ) { | 505 | while( it ) { |
506 | ANetNode * NN; | 506 | ANetNode * NN; |
507 | NN = (*Mapping)[it]; | 507 | NN = (*Mapping)[it]; |
508 | if( NN ) { | 508 | if( NN ) { |
509 | if( pha ) { | 509 | if( pha ) { |
510 | bool doOn = ((QCheckListItem *)it)->isOn(); | 510 | bool doOn = ((QCheckListItem *)it)->isOn(); |
511 | // we are a checklistitem for sure | 511 | // we are a checklistitem for sure |
512 | it->setSelectable( TRUE ); | 512 | it->setSelectable( TRUE ); |
513 | if( AutoCollapse && ! doOn ) | 513 | if( AutoCollapse && ! doOn ) |
514 | it->setOpen( doOn ); | 514 | it->setOpen( doOn ); |
515 | if( doOn ) { | 515 | if( doOn ) { |
516 | // selected alternative | 516 | // selected alternative |
517 | enablePath( it->firstChild(), | 517 | enablePath( it->firstChild(), |
518 | NN->alternatives().size() > 1); | 518 | NN->alternatives().size() > 1); |
519 | } else { | 519 | } else { |
520 | // non-selected alternative | 520 | // non-selected alternative |
521 | disableTree( it->firstChild(), FALSE); | 521 | disableTree( it->firstChild(), FALSE); |
522 | } | 522 | } |
523 | } else { | 523 | } else { |
524 | // we are single subitem | 524 | // we are single subitem |
525 | it->setSelectable( TRUE ); | 525 | it->setSelectable( TRUE ); |
526 | it->setOpen( TRUE ); | 526 | it->setOpen( TRUE ); |
527 | enablePath( it->firstChild(), | 527 | enablePath( it->firstChild(), |
528 | NN->alternatives().size() > 1); | 528 | NN->alternatives().size() > 1); |
529 | } | 529 | } |
530 | } else { | 530 | } else { |
531 | // controller node | 531 | // controller node |
532 | it->setSelectable( TRUE ); | 532 | it->setSelectable( TRUE ); |
533 | it->setOpen( TRUE ); | 533 | it->setOpen( TRUE ); |
534 | enablePath( it->firstChild(), pha ); | 534 | enablePath( it->firstChild(), pha ); |
535 | } | 535 | } |
536 | it = it->nextSibling(); | 536 | it = it->nextSibling(); |
537 | } | 537 | } |
538 | } | 538 | } |
539 | 539 | ||
540 | // do we have a complete configuration (all needs are provided for ?) | 540 | // do we have a complete configuration (all needs are provided for ?) |
541 | bool EditConnection::haveCompleteConfig( QListViewItem * it ) { | 541 | bool EditConnection::haveCompleteConfig( QListViewItem * it ) { |
542 | if( it == 0 || ((QCheckListItem *)it)->isOn() ) { | 542 | if( it == 0 || ((QCheckListItem *)it)->isOn() ) { |
543 | // check children | 543 | // check children |
544 | it = (it) ? it->firstChild() : Nodes_LV->firstChild() ; | 544 | it = (it) ? it->firstChild() : Nodes_LV->firstChild() ; |
545 | while ( it ) { | 545 | while ( it ) { |
546 | if( ((QCheckListItem *)it)->type() == | 546 | if( ((QCheckListItem *)it)->type() == |
547 | QCheckListItem::Controller ) { | 547 | QCheckListItem::Controller ) { |
548 | // child is controller -> has sub radio | 548 | // child is controller -> has sub radio |
549 | // check if one radio is selected | 549 | // check if one radio is selected |
550 | it = it->firstChild(); | 550 | it = it->firstChild(); |
551 | while( it ) { | 551 | while( it ) { |
552 | if( ((QCheckListItem *)it)->isOn() ) { | 552 | if( ((QCheckListItem *)it)->isOn() ) { |
553 | // this radio is selected -> go deeper | 553 | // this radio is selected -> go deeper |
554 | it = it->firstChild(); | 554 | it = it->firstChild(); |
555 | if( ! it ) { | 555 | if( ! it ) { |
556 | // was deepest level | 556 | // was deepest level |
557 | return 1; | 557 | return 1; |
558 | } | 558 | } |
559 | // do not bother to check other items | 559 | // do not bother to check other items |
560 | break; | 560 | break; |
561 | } | 561 | } |
562 | it = it->nextSibling(); | 562 | it = it->nextSibling(); |
563 | } | 563 | } |
564 | if( ! it ) { | 564 | if( ! it ) { |
565 | // no radio selected | 565 | // no radio selected |
566 | return 0; | 566 | return 0; |
567 | } | 567 | } |
568 | } else { | 568 | } else { |
569 | // check children | 569 | // check children |
570 | it = it->firstChild(); | 570 | it = it->firstChild(); |
571 | } | 571 | } |
572 | } | 572 | } |
573 | // deepest level -> all is still OK | 573 | // deepest level -> all is still OK |
574 | return 1; | 574 | return 1; |
575 | } // was not ON | 575 | } // was not ON |
576 | return 0; | 576 | return 0; |
577 | } | 577 | } |
diff --git a/noncore/settings/networksettings2/irda/irda_NN.cpp b/noncore/settings/networksettings2/irda/irda_NN.cpp index 49b7707..f2fda5c 100644 --- a/noncore/settings/networksettings2/irda/irda_NN.cpp +++ b/noncore/settings/networksettings2/irda/irda_NN.cpp | |||
@@ -1,60 +1,60 @@ | |||
1 | #include "irda_NN.h" | 1 | #include "irda_NN.h" |
2 | #include "irda_NNI.h" | 2 | #include "irda_NNI.h" |
3 | 3 | ||
4 | static const char * IRDANeeds[] = | 4 | static const char * IRDANeeds[] = |
5 | { 0 | 5 | { 0 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor, find all of the possible interfaces | 9 | * Constructor, find all of the possible interfaces |
10 | */ | 10 | */ |
11 | IRDANetNode::IRDANetNode() : ANetNode() { | 11 | IRDANetNode::IRDANetNode() : ANetNode(tr("Infrared link")) { |
12 | } | 12 | } |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Delete any interfaces that we own. | 15 | * Delete any interfaces that we own. |
16 | */ | 16 | */ |
17 | IRDANetNode::~IRDANetNode(){ | 17 | IRDANetNode::~IRDANetNode(){ |
18 | } | 18 | } |
19 | 19 | ||
20 | const QString IRDANetNode::nodeDescription(){ | 20 | const QString IRDANetNode::nodeDescription(){ |
21 | return tr("\ | 21 | return tr("\ |
22 | <p>Sets up a infra red serial link.</p>\ | 22 | <p>Sets up a infra red serial link.</p>\ |
23 | " | 23 | " |
24 | ); | 24 | ); |
25 | } | 25 | } |
26 | 26 | ||
27 | ANetNodeInstance * IRDANetNode::createInstance( void ) { | 27 | ANetNodeInstance * IRDANetNode::createInstance( void ) { |
28 | return new AIRDA( this ); | 28 | return new AIRDA( this ); |
29 | } | 29 | } |
30 | 30 | ||
31 | const char ** IRDANetNode::needs( void ) { | 31 | const char ** IRDANetNode::needs( void ) { |
32 | return IRDANeeds; | 32 | return IRDANeeds; |
33 | } | 33 | } |
34 | 34 | ||
35 | const char * IRDANetNode::provides( void ) { | 35 | const char * IRDANetNode::provides( void ) { |
36 | return "line"; | 36 | return "line"; |
37 | } | 37 | } |
38 | 38 | ||
39 | bool IRDANetNode::generateProperFilesFor( | 39 | bool IRDANetNode::generateProperFilesFor( |
40 | ANetNodeInstance * ) { | 40 | ANetNodeInstance * ) { |
41 | return 1; | 41 | return 1; |
42 | } | 42 | } |
43 | 43 | ||
44 | bool IRDANetNode::generateDeviceDataForCommonFile( | 44 | bool IRDANetNode::generateDeviceDataForCommonFile( |
45 | SystemFile & , | 45 | SystemFile & , |
46 | long ) { | 46 | long ) { |
47 | return 1; | 47 | return 1; |
48 | } | 48 | } |
49 | 49 | ||
50 | void IRDANetNode::setSpecificAttribute( QString & , QString & ) { | 50 | void IRDANetNode::setSpecificAttribute( QString & , QString & ) { |
51 | } | 51 | } |
52 | 52 | ||
53 | void IRDANetNode::saveSpecificAttribute( QTextStream & ) { | 53 | void IRDANetNode::saveSpecificAttribute( QTextStream & ) { |
54 | } | 54 | } |
55 | 55 | ||
56 | extern "C" { | 56 | extern "C" { |
57 | void create_plugin( QList<ANetNode> & PNN ) { | 57 | void create_plugin( QList<ANetNode> & PNN ) { |
58 | PNN.append( new IRDANetNode() ); | 58 | PNN.append( new IRDANetNode() ); |
59 | } | 59 | } |
60 | } | 60 | } |
diff --git a/noncore/settings/networksettings2/irda/irda_NN.h b/noncore/settings/networksettings2/irda/irda_NN.h index 2dcef74..fa6408d 100644 --- a/noncore/settings/networksettings2/irda/irda_NN.h +++ b/noncore/settings/networksettings2/irda/irda_NN.h | |||
@@ -1,47 +1,44 @@ | |||
1 | #ifndef IRDA_NETNODE_H | 1 | #ifndef IRDA_NETNODE_H |
2 | #define IRDA_NETNODE_H | 2 | #define IRDA_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AIRDA; | 6 | class AIRDA; |
7 | 7 | ||
8 | class IRDANetNode : public ANetNode { | 8 | class IRDANetNode : public ANetNode { |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | IRDANetNode(); | 14 | IRDANetNode(); |
15 | virtual ~IRDANetNode(); | 15 | virtual ~IRDANetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/irda"; } | 18 | { return "Devices/irda"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("Infrared link"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & ) | 28 | virtual bool hasDataFor( const QString & ) |
32 | { return 0; } | 29 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 30 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr ); | 31 | SystemFile & SF, long DevNr ); |
35 | 32 | ||
36 | private: | 33 | private: |
37 | 34 | ||
38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
39 | virtual void saveSpecificAttribute( QTextStream & TS ); | 36 | virtual void saveSpecificAttribute( QTextStream & TS ); |
40 | }; | 37 | }; |
41 | 38 | ||
42 | extern "C" | 39 | extern "C" |
43 | { | 40 | { |
44 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
45 | }; | 42 | }; |
46 | 43 | ||
47 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/lancard/lancardGUI.ui b/noncore/settings/networksettings2/lancard/lancardGUI.ui index 8d94816..c407175 100644 --- a/noncore/settings/networksettings2/lancard/lancardGUI.ui +++ b/noncore/settings/networksettings2/lancard/lancardGUI.ui | |||
@@ -1,129 +1,189 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>LanCardGUI</class> | 2 | <class>LanCardGUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>Lancard_FRM</cstring> | 7 | <cstring>Lancard_FRM</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>362</width> | 14 | <width>354</width> |
15 | <height>359</height> | 15 | <height>359</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>LAN card</string> | 20 | <string>LAN card</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>2</number> | 31 | <number>2</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>2</number> | 35 | <number>2</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QCheckBox</class> | 38 | <class>QCheckBox</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>AnyCard_CB</cstring> | 41 | <cstring>AnyCard_CB</cstring> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>text</name> | 44 | <name>text</name> |
45 | <string>Any available LAN card</string> | 45 | <string>Any available LAN card</string> |
46 | </property> | 46 | </property> |
47 | <property stdset="1"> | 47 | <property stdset="1"> |
48 | <name>checked</name> | 48 | <name>checked</name> |
49 | <bool>true</bool> | 49 | <bool>true</bool> |
50 | </property> | 50 | </property> |
51 | </widget> | 51 | </widget> |
52 | <widget> | 52 | <widget> |
53 | <class>QGroupBox</class> | 53 | <class>QGroupBox</class> |
54 | <property stdset="1"> | 54 | <property stdset="1"> |
55 | <name>name</name> | 55 | <name>name</name> |
56 | <cstring>GroupBox1</cstring> | 56 | <cstring>GroupBox1</cstring> |
57 | </property> | 57 | </property> |
58 | <property stdset="1"> | 58 | <property stdset="1"> |
59 | <name>enabled</name> | 59 | <name>enabled</name> |
60 | <bool>false</bool> | 60 | <bool>false</bool> |
61 | </property> | 61 | </property> |
62 | <property stdset="1"> | 62 | <property stdset="1"> |
63 | <name>title</name> | 63 | <name>title</name> |
64 | <string>Select Card</string> | 64 | <string>Select Card</string> |
65 | </property> | 65 | </property> |
66 | <property> | 66 | <property> |
67 | <name>layoutMargin</name> | 67 | <name>layoutMargin</name> |
68 | </property> | 68 | </property> |
69 | <vbox> | 69 | <vbox> |
70 | <property stdset="1"> | 70 | <property stdset="1"> |
71 | <name>margin</name> | 71 | <name>margin</name> |
72 | <number>11</number> | 72 | <number>5</number> |
73 | </property> | 73 | </property> |
74 | <property stdset="1"> | 74 | <property stdset="1"> |
75 | <name>spacing</name> | 75 | <name>spacing</name> |
76 | <number>6</number> | 76 | <number>6</number> |
77 | </property> | 77 | </property> |
78 | <widget> | 78 | <widget> |
79 | <class>QListView</class> | 79 | <class>QListView</class> |
80 | <column> | 80 | <column> |
81 | <property> | 81 | <property> |
82 | <name>text</name> | 82 | <name>text</name> |
83 | <string>Name</string> | ||
84 | </property> | ||
85 | <property> | ||
86 | <name>clickable</name> | ||
87 | <bool>true</bool> | ||
88 | </property> | ||
89 | <property> | ||
90 | <name>resizeable</name> | ||
91 | <bool>true</bool> | ||
92 | </property> | ||
93 | </column> | ||
94 | <column> | ||
95 | <property> | ||
96 | <name>text</name> | ||
97 | <string>MACAddress</string> | 83 | <string>MACAddress</string> |
98 | </property> | 84 | </property> |
99 | <property> | 85 | <property> |
100 | <name>clickable</name> | 86 | <name>clickable</name> |
101 | <bool>true</bool> | 87 | <bool>true</bool> |
102 | </property> | 88 | </property> |
103 | <property> | 89 | <property> |
104 | <name>resizeable</name> | 90 | <name>resizeable</name> |
105 | <bool>true</bool> | 91 | <bool>true</bool> |
106 | </property> | 92 | </property> |
107 | </column> | 93 | </column> |
108 | <property stdset="1"> | 94 | <property stdset="1"> |
109 | <name>name</name> | 95 | <name>name</name> |
110 | <cstring>LanCards_LV</cstring> | 96 | <cstring>LanCards_LV</cstring> |
111 | </property> | 97 | </property> |
112 | <property stdset="1"> | 98 | <property stdset="1"> |
113 | <name>allColumnsShowFocus</name> | 99 | <name>allColumnsShowFocus</name> |
114 | <bool>true</bool> | 100 | <bool>true</bool> |
115 | </property> | 101 | </property> |
116 | </widget> | 102 | </widget> |
103 | <widget> | ||
104 | <class>QLayoutWidget</class> | ||
105 | <property stdset="1"> | ||
106 | <name>name</name> | ||
107 | <cstring>Layout2</cstring> | ||
108 | </property> | ||
109 | <hbox> | ||
110 | <property stdset="1"> | ||
111 | <name>margin</name> | ||
112 | <number>0</number> | ||
113 | </property> | ||
114 | <property stdset="1"> | ||
115 | <name>spacing</name> | ||
116 | <number>6</number> | ||
117 | </property> | ||
118 | <widget> | ||
119 | <class>QPushButton</class> | ||
120 | <property stdset="1"> | ||
121 | <name>name</name> | ||
122 | <cstring>RemoveUnknown_BUT</cstring> | ||
123 | </property> | ||
124 | <property stdset="1"> | ||
125 | <name>text</name> | ||
126 | <string>Remove Unknown</string> | ||
127 | </property> | ||
128 | </widget> | ||
129 | <spacer> | ||
130 | <property> | ||
131 | <name>name</name> | ||
132 | <cstring>Spacer1</cstring> | ||
133 | </property> | ||
134 | <property stdset="1"> | ||
135 | <name>orientation</name> | ||
136 | <enum>Horizontal</enum> | ||
137 | </property> | ||
138 | <property stdset="1"> | ||
139 | <name>sizeType</name> | ||
140 | <enum>Expanding</enum> | ||
141 | </property> | ||
142 | <property> | ||
143 | <name>sizeHint</name> | ||
144 | <size> | ||
145 | <width>20</width> | ||
146 | <height>20</height> | ||
147 | </size> | ||
148 | </property> | ||
149 | </spacer> | ||
150 | <widget> | ||
151 | <class>QPushButton</class> | ||
152 | <property stdset="1"> | ||
153 | <name>name</name> | ||
154 | <cstring>RescanCards_BUT</cstring> | ||
155 | </property> | ||
156 | <property stdset="1"> | ||
157 | <name>text</name> | ||
158 | <string>Rescan</string> | ||
159 | </property> | ||
160 | </widget> | ||
161 | </hbox> | ||
162 | </widget> | ||
117 | </vbox> | 163 | </vbox> |
118 | </widget> | 164 | </widget> |
119 | </vbox> | 165 | </vbox> |
120 | </widget> | 166 | </widget> |
121 | <connections> | 167 | <connections> |
122 | <connection> | 168 | <connection> |
123 | <sender>AnyCard_CB</sender> | 169 | <sender>AnyCard_CB</sender> |
124 | <signal>toggled(bool)</signal> | 170 | <signal>toggled(bool)</signal> |
125 | <receiver>GroupBox1</receiver> | 171 | <receiver>GroupBox1</receiver> |
126 | <slot>setDisabled(bool)</slot> | 172 | <slot>setDisabled(bool)</slot> |
127 | </connection> | 173 | </connection> |
174 | <connection> | ||
175 | <sender>RescanCards_BUT</sender> | ||
176 | <signal>clicked()</signal> | ||
177 | <receiver>Lancard_FRM</receiver> | ||
178 | <slot>SLOT_ScanCards()</slot> | ||
179 | </connection> | ||
180 | <connection> | ||
181 | <sender>RemoveUnknown_BUT</sender> | ||
182 | <signal>clicked()</signal> | ||
183 | <receiver>Lancard_FRM</receiver> | ||
184 | <slot>SLOT_RemoveUnknown()</slot> | ||
185 | </connection> | ||
186 | <slot access="public">SLOT_ScanCards()</slot> | ||
187 | <slot access="public">SLOT_RemoveUnknown()</slot> | ||
128 | </connections> | 188 | </connections> |
129 | </UI> | 189 | </UI> |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.cpp b/noncore/settings/networksettings2/lancard/lancard_NN.cpp index ba1c1f8..a4afab1 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.cpp +++ b/noncore/settings/networksettings2/lancard/lancard_NN.cpp | |||
@@ -1,85 +1,94 @@ | |||
1 | #include "lancard_NN.h" | 1 | #include "lancard_NN.h" |
2 | #include "lancard_NNI.h" | 2 | #include "lancard_NNI.h" |
3 | 3 | ||
4 | static const char * LanCardNeeds[] = | 4 | static const char * LanCardNeeds[] = |
5 | { 0 }; | 5 | { 0 }; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * Constructor, find all of the possible interfaces | 8 | * Constructor, find all of the possible interfaces |
9 | */ | 9 | */ |
10 | LanCardNetNode::LanCardNetNode() : ANetNode() { | 10 | LanCardNetNode::LanCardNetNode() : ANetNode(tr("LAN card")), NICMACAddresses() { |
11 | InstanceCount = 2; | 11 | InstanceCount = 2; |
12 | } | 12 | } |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Delete any interfaces that we own. | 15 | * Delete any interfaces that we own. |
16 | */ | 16 | */ |
17 | LanCardNetNode::~LanCardNetNode(){ | 17 | LanCardNetNode::~LanCardNetNode(){ |
18 | } | 18 | } |
19 | 19 | ||
20 | const QString LanCardNetNode::nodeDescription(){ | 20 | const QString LanCardNetNode::nodeDescription(){ |
21 | return tr("\ | 21 | return tr("\ |
22 | <p>Sets up a wired regular LAN card.</p>\ | 22 | <p>Sets up a wired regular LAN card.</p>\ |
23 | <p>Use this to set up 10/100/1000 MBit LAN cards.</p>\ | 23 | <p>Use this to set up 10/100/1000 MBit LAN cards.</p>\ |
24 | " | 24 | " |
25 | ); | 25 | ); |
26 | } | 26 | } |
27 | 27 | ||
28 | ANetNodeInstance * LanCardNetNode::createInstance( void ) { | 28 | ANetNodeInstance * LanCardNetNode::createInstance( void ) { |
29 | return new ALanCard( this ); | 29 | return new ALanCard( this ); |
30 | } | 30 | } |
31 | 31 | ||
32 | 32 | ||
33 | const char ** LanCardNetNode::needs( void ) { | 33 | const char ** LanCardNetNode::needs( void ) { |
34 | return LanCardNeeds; | 34 | return LanCardNeeds; |
35 | } | 35 | } |
36 | 36 | ||
37 | const char * LanCardNetNode::provides( void ) { | 37 | const char * LanCardNetNode::provides( void ) { |
38 | return "device"; | 38 | return "device"; |
39 | } | 39 | } |
40 | 40 | ||
41 | bool LanCardNetNode::generateProperFilesFor( | 41 | bool LanCardNetNode::generateProperFilesFor( |
42 | ANetNodeInstance * ) { | 42 | ANetNodeInstance * ) { |
43 | return 1; | 43 | return 1; |
44 | } | 44 | } |
45 | 45 | ||
46 | bool LanCardNetNode::hasDataFor( const QString & S ) { | 46 | bool LanCardNetNode::hasDataFor( const QString & S ) { |
47 | return S == "interfaces"; | 47 | return S == "interfaces"; |
48 | } | 48 | } |
49 | 49 | ||
50 | bool LanCardNetNode::generateDeviceDataForCommonFile( | 50 | bool LanCardNetNode::generateDeviceDataForCommonFile( |
51 | SystemFile & S , | 51 | SystemFile & S , |
52 | long DevNr ) { | 52 | long DevNr ) { |
53 | QString NIC = genNic( DevNr ); | 53 | QString NIC = genNic( DevNr ); |
54 | 54 | ||
55 | if( S.name() == "interfaces" ) { | 55 | if( S.name() == "interfaces" ) { |
56 | // generate mapping stanza for this interface | 56 | // generate mapping stanza for this interface |
57 | S << "# check if " << NIC << " can be brought UP" << endl; | 57 | S << "# check if " << NIC << " can be brought UP" << endl; |
58 | S << "mapping " << NIC << endl; | 58 | S << "mapping " << NIC << endl; |
59 | S << " script networksettings2-request" << endl << endl; | 59 | S << " script networksettings2-request" << endl << endl; |
60 | } | 60 | } |
61 | return 0; | 61 | return 0; |
62 | } | 62 | } |
63 | 63 | ||
64 | QString LanCardNetNode::genNic( long nr ) { | 64 | QString LanCardNetNode::genNic( long nr ) { |
65 | QString S; | 65 | QString S; |
66 | return S.sprintf( "eth%ld", nr ); | 66 | return S.sprintf( "eth%ld", nr ); |
67 | } | 67 | } |
68 | 68 | ||
69 | void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) { | 69 | void LanCardNetNode::setSpecificAttribute( QString & A, QString & V ) { |
70 | if( A == "interfacecount" ) { | 70 | if( A == "interfacecount" ) { |
71 | InstanceCount = V.toLong(); | 71 | InstanceCount = V.toLong(); |
72 | } else if ( A == "macaddress" ) { | ||
73 | NICMACAddresses.append( V ); | ||
72 | } | 74 | } |
73 | } | 75 | } |
74 | 76 | ||
75 | void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) { | 77 | void LanCardNetNode::saveSpecificAttribute( QTextStream & TS) { |
76 | TS << "interfacecount=" | 78 | TS << "interfacecount=" |
77 | << InstanceCount | 79 | << InstanceCount |
78 | << endl; | 80 | << endl; |
81 | for( QStringList::Iterator it = NICMACAddresses.begin(); | ||
82 | it != NICMACAddresses.end(); | ||
83 | ++it ) { | ||
84 | TS << "macaddress=" | ||
85 | << (*it) | ||
86 | << endl; | ||
87 | } | ||
79 | } | 88 | } |
80 | 89 | ||
81 | extern "C" { | 90 | extern "C" { |
82 | void create_plugin( QList<ANetNode> & PNN ) { | 91 | void create_plugin( QList<ANetNode> & PNN ) { |
83 | PNN.append( new LanCardNetNode() ); | 92 | PNN.append( new LanCardNetNode() ); |
84 | } | 93 | } |
85 | } | 94 | } |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h index 5f2b25d..d58823c 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.h +++ b/noncore/settings/networksettings2/lancard/lancard_NN.h | |||
@@ -1,55 +1,57 @@ | |||
1 | #ifndef LANCARD_NETNODE_H | 1 | #ifndef LANCARD_NETNODE_H |
2 | #define LANCARD_NETNODE_H | 2 | #define LANCARD_NETNODE_H |
3 | 3 | ||
4 | #include <qstringlist.h> | ||
4 | #include "netnode.h" | 5 | #include "netnode.h" |
5 | 6 | ||
6 | class ALanCard; | 7 | class ALanCard; |
7 | 8 | ||
8 | class LanCardNetNode : public ANetNode{ | 9 | class LanCardNetNode : public ANetNode{ |
9 | 10 | ||
10 | Q_OBJECT | 11 | Q_OBJECT |
11 | 12 | ||
12 | public: | 13 | public: |
13 | 14 | ||
14 | LanCardNetNode(); | 15 | LanCardNetNode(); |
15 | virtual ~LanCardNetNode(); | 16 | virtual ~LanCardNetNode(); |
16 | 17 | ||
17 | virtual const QString pixmapName() | 18 | virtual const QString pixmapName() |
18 | { return "Devices/card"; } | 19 | { return "Devices/card"; } |
19 | 20 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("LAN card"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 21 | virtual const QString nodeDescription() ; |
24 | 22 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 23 | virtual ANetNodeInstance * createInstance( void ); |
26 | 24 | ||
27 | virtual const char ** needs( void ); | 25 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 26 | virtual const char * provides( void ); |
29 | 27 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 28 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 29 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDeviceDataForCommonFile( | 30 | virtual bool generateDeviceDataForCommonFile( |
33 | SystemFile & SF, long DevNr ); | 31 | SystemFile & SF, long DevNr ); |
34 | 32 | ||
35 | virtual long instanceCount( void ) | 33 | virtual long instanceCount( void ) |
36 | { return InstanceCount; } | 34 | { return InstanceCount; } |
37 | 35 | ||
38 | virtual QString genNic( long ); | 36 | virtual QString genNic( long ); |
37 | virtual QStringList & addressesOfNIC( void ) | ||
38 | { return NICMACAddresses; } | ||
39 | 39 | ||
40 | private: | 40 | private: |
41 | 41 | ||
42 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 42 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
43 | virtual void saveSpecificAttribute( QTextStream & TS ); | 43 | virtual void saveSpecificAttribute( QTextStream & TS ); |
44 | 44 | ||
45 | // number of interfaces for this device | 45 | // number of interfaces for this device |
46 | long InstanceCount; | 46 | long InstanceCount; |
47 | 47 | ||
48 | QStringList NICMACAddresses; | ||
49 | |||
48 | }; | 50 | }; |
49 | 51 | ||
50 | extern "C" | 52 | extern "C" |
51 | { | 53 | { |
52 | void create_plugin( QList<ANetNode> & PNN ); | 54 | void create_plugin( QList<ANetNode> & PNN ); |
53 | }; | 55 | }; |
54 | 56 | ||
55 | #endif | 57 | #endif |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp index 5962d52..99c033e 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NNI.cpp +++ b/noncore/settings/networksettings2/lancard/lancard_NNI.cpp | |||
@@ -1,51 +1,51 @@ | |||
1 | #include "lancardedit.h" | 1 | #include "lancardedit.h" |
2 | #include "lancard_NNI.h" | 2 | #include "lancard_NNI.h" |
3 | #include "lancard_NN.h" | 3 | #include "lancard_NN.h" |
4 | 4 | ||
5 | ALanCard::ALanCard( LanCardNetNode * PNN ) : ANetNodeInstance( PNN ) { | 5 | ALanCard::ALanCard( LanCardNetNode * PNN ) : ANetNodeInstance( PNN ) { |
6 | 6 | ||
7 | Data.AnyLanCard = 1; | 7 | Data.AnyLanCard = 1; |
8 | Data.HWAddresses.clear(); | 8 | Data.HWAddresses.clear(); |
9 | 9 | ||
10 | GUI = 0; | 10 | GUI = 0; |
11 | RT = 0; | 11 | RT = 0; |
12 | } | 12 | } |
13 | 13 | ||
14 | void ALanCard::setSpecificAttribute( QString & A, QString & V ) { | 14 | void ALanCard::setSpecificAttribute( QString & A, QString & V ) { |
15 | if( A == "matchanycard" ) { | 15 | if( A == "matchanycard" ) { |
16 | Data.AnyLanCard = (V == "yes" ); | 16 | Data.AnyLanCard = (V == "yes" ); |
17 | } else if( A == "match" ) { | 17 | } else if( A == "match" ) { |
18 | Data.HWAddresses.append( V ); | 18 | Data.HWAddresses.append( V ); |
19 | } | 19 | } |
20 | } | 20 | } |
21 | 21 | ||
22 | void ALanCard::saveSpecificAttribute( QTextStream & TS) { | 22 | void ALanCard::saveSpecificAttribute( QTextStream & TS) { |
23 | TS << "matchanycard=" << | 23 | TS << "matchanycard=" << |
24 | ((Data.AnyLanCard) ? "yes" : "no") << endl; | 24 | ((Data.AnyLanCard) ? "yes" : "no") << endl; |
25 | for( QStringList::Iterator it = Data.HWAddresses.begin(); | 25 | for( QStringList::Iterator it = Data.HWAddresses.begin(); |
26 | it != Data.HWAddresses.end(); ++it ) { | 26 | it != Data.HWAddresses.end(); ++it ) { |
27 | TS << "match=" << quote( *it ) << endl; | 27 | TS << "match=" << quote( *it ) << endl; |
28 | } | 28 | } |
29 | } | 29 | } |
30 | 30 | ||
31 | QWidget * ALanCard::edit( QWidget * parent ) { | 31 | QWidget * ALanCard::edit( QWidget * parent ) { |
32 | GUI = new LanCardEdit( parent ); | 32 | GUI = new LanCardEdit( parent ); |
33 | GUI->showData( Data ); | 33 | GUI->showData( this ); |
34 | return GUI; | 34 | return GUI; |
35 | } | 35 | } |
36 | 36 | ||
37 | QString ALanCard::acceptable( void ) { | 37 | QString ALanCard::acceptable( void ) { |
38 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 38 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
39 | } | 39 | } |
40 | 40 | ||
41 | void ALanCard::commit( void ) { | 41 | void ALanCard::commit( void ) { |
42 | if( GUI && GUI->commit( Data ) ) | 42 | if( GUI && GUI->commit( Data ) ) |
43 | setModified( 1 ); | 43 | setModified( 1 ); |
44 | } | 44 | } |
45 | 45 | ||
46 | bool ALanCard::generateDataForCommonFile( | 46 | bool ALanCard::generateDataForCommonFile( |
47 | SystemFile & , | 47 | SystemFile & , |
48 | long ) { | 48 | long ) { |
49 | return 1; | 49 | return 1; |
50 | } | 50 | } |
51 | 51 | ||
diff --git a/noncore/settings/networksettings2/lancard/lancardedit.cpp b/noncore/settings/networksettings2/lancard/lancardedit.cpp index fa7f6dc..ffe9bf6 100644 --- a/noncore/settings/networksettings2/lancard/lancardedit.cpp +++ b/noncore/settings/networksettings2/lancard/lancardedit.cpp | |||
@@ -1,95 +1,208 @@ | |||
1 | #include <GUIUtils.h> | 1 | #include <GUIUtils.h> |
2 | #include <resources.h> | 2 | #include <resources.h> |
3 | #include <qarray.h> | ||
3 | #include <qlistview.h> | 4 | #include <qlistview.h> |
4 | #include <qcheckbox.h> | 5 | #include <qcheckbox.h> |
5 | #include <qheader.h> | 6 | #include <qheader.h> |
6 | #include <qregexp.h> | 7 | #include <qregexp.h> |
8 | |||
7 | #include "lancardedit.h" | 9 | #include "lancardedit.h" |
10 | #include "lancard_NN.h" | ||
11 | #include "lancard_NNI.h" | ||
8 | 12 | ||
9 | LanCardEdit::LanCardEdit( QWidget * Parent ) : LanCardGUI( Parent ){ | 13 | LanCardEdit::LanCardEdit( QWidget * Parent ) : LanCardGUI( Parent ){ |
10 | System & S = NSResources->system(); | ||
11 | QRegExp R( "eth[0-9]" ); | ||
12 | QCheckListItem * CLI; | ||
13 | |||
14 | LanCards_LV->header()->hide(); | 14 | LanCards_LV->header()->hide(); |
15 | 15 | ||
16 | // populate with all lancards in system | ||
17 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | ||
18 | It.current(); | ||
19 | ++It ) { | ||
20 | if( R.match( It.current()->Name ) >= 0 && | ||
21 | It.current()->CardType == ARPHRD_ETHER | ||
22 | ) { | ||
23 | CLI = new QCheckListItem( LanCards_LV, It.current()->Name, | ||
24 | QCheckListItem::CheckBox ); | ||
25 | CLI->setText( 1, It.current()->MACAddress ); | ||
26 | } | ||
27 | } | ||
28 | } | 16 | } |
29 | 17 | ||
30 | QString LanCardEdit::acceptable( void ) { | 18 | QString LanCardEdit::acceptable( void ) { |
31 | return QString(); | 19 | return QString(); |
32 | } | 20 | } |
33 | 21 | ||
34 | |||
35 | bool LanCardEdit::commit( LanCardData & Data ) { | 22 | bool LanCardEdit::commit( LanCardData & Data ) { |
36 | bool SM = 0; | 23 | bool SM = 0; |
37 | CBM( Data.AnyLanCard, AnyCard_CB, SM ); | 24 | CBM( Data.AnyLanCard, AnyCard_CB, SM ); |
38 | 25 | ||
39 | if( ! Data.AnyLanCard ) { | 26 | if( ! Data.AnyLanCard ) { |
40 | // collect set of lancards that match | 27 | // take copy for orig list |
28 | QStringList NewList( Data.HWAddresses ); | ||
29 | |||
30 | // update HWAddresses to new state | ||
31 | // remove item also from NewList | ||
41 | int idx; | 32 | int idx; |
42 | QCheckListItem * CLI = (QCheckListItem *)LanCards_LV->firstChild(); | 33 | QCheckListItem * CLI = (QCheckListItem *)LanCards_LV->firstChild(); |
43 | while( CLI ) { | 34 | while( CLI ) { |
44 | idx = Data.HWAddresses.findIndex(CLI->text(1)); | 35 | idx = Data.HWAddresses.findIndex(CLI->text(0)); |
45 | if( CLI->isOn() ) { | 36 | if( CLI->isOn() ) { |
46 | if( idx < 0 ) { | 37 | if( idx < 0 ) { |
47 | // should be in list | 38 | // should be in list |
48 | Data.HWAddresses.append( CLI->text(1) ); | 39 | Data.HWAddresses.append( CLI->text(0) ); |
49 | SM = 1; | 40 | SM = 1; |
50 | } | 41 | } |
51 | } else { | 42 | } else { |
52 | // should not be in list | 43 | // should not be in list |
53 | if( idx >= 0 ) { | 44 | if( idx >= 0 ) { |
54 | Data.HWAddresses.remove( Data.HWAddresses.at(idx) ); | 45 | NewList.remove( CLI->text(0) ); |
46 | Data.HWAddresses.remove( CLI->text(0) ); | ||
55 | SM = 1; | 47 | SM = 1; |
56 | } | 48 | } |
57 | } | 49 | } |
58 | CLI = (QCheckListItem *)CLI->nextSibling(); | 50 | CLI = (QCheckListItem *)CLI->nextSibling(); |
59 | } | 51 | } |
52 | |||
53 | // if newlist still contains items. it were items | ||
54 | // that were checked but no longer are present in the system | ||
55 | SM |= ( NewList.count() > 0 ) ; | ||
60 | } | 56 | } |
61 | return SM || ContainedObsoleteMAC ; | 57 | return SM; |
62 | } | 58 | } |
63 | 59 | ||
64 | void LanCardEdit::showData( LanCardData & Data ) { | 60 | void LanCardEdit::showData( ALanCard * LC ) { |
61 | NNI = LC; | ||
62 | LanCardData & Data = *((LanCardData *)LC->data()); | ||
63 | |||
65 | AnyCard_CB->setChecked( Data.AnyLanCard ); | 64 | AnyCard_CB->setChecked( Data.AnyLanCard ); |
66 | 65 | ||
66 | // load all cards | ||
67 | populateList(); | ||
68 | |||
69 | // set checks | ||
67 | QCheckListItem * CLI = (QCheckListItem *)LanCards_LV->firstChild(); | 70 | QCheckListItem * CLI = (QCheckListItem *)LanCards_LV->firstChild(); |
71 | while( CLI ) { | ||
72 | CLI->setOn( Data.HWAddresses.findIndex(CLI->text(0)) >= 0 ); | ||
73 | CLI = (QCheckListItem *)CLI->nextSibling(); | ||
74 | } | ||
75 | } | ||
68 | 76 | ||
69 | ContainedObsoleteMAC = 0; | 77 | // load all known cards in list |
70 | // remove obsolete address | 78 | void LanCardEdit::populateList( void ) { |
71 | for( QStringList::Iterator it=Data.HWAddresses.begin(); | 79 | LanCardNetNode *NN = (LanCardNetNode *)NNI->nodeClass(); |
72 | it != Data.HWAddresses.end(); | 80 | QCheckListItem * CLI; |
73 | ) { | 81 | bool Found; |
74 | CLI = (QCheckListItem *)LanCards_LV->firstChild(); | 82 | |
75 | while( CLI ) { | 83 | LanCards_LV->clear(); |
76 | if( CLI->text(1) == (*it) ) | 84 | |
77 | // still valid | 85 | for( QStringList::Iterator it = NN->addressesOfNIC().begin(); |
86 | it != NN->addressesOfNIC().end(); | ||
87 | ++it ) { | ||
88 | CLI = new QCheckListItem( LanCards_LV, (*it), QCheckListItem::CheckBox ); | ||
89 | |||
90 | // check interfaces and see if this card is present | ||
91 | Found = 0; | ||
92 | for( QDictIterator<InterfaceInfo> NIt(NSResources->system().interfaces()); | ||
93 | NIt.current(); | ||
94 | ++NIt ) { | ||
95 | if( NIt.current()->MACAddress == (*it) ) { | ||
96 | Found = 1; | ||
78 | break; | 97 | break; |
79 | CLI = (QCheckListItem *)CLI->nextSibling(); | 98 | } |
80 | } | 99 | } |
81 | if( CLI == 0 ) { | 100 | |
82 | // address not found -> remove | 101 | CLI->setPixmap( 0, NSResources->getPixmap( |
83 | ContainedObsoleteMAC = 1; | 102 | (Found) ? "add" : "remove" ) ); |
84 | Data.HWAddresses.remove( it ); | 103 | } |
85 | } else { | 104 | } |
86 | ++ it; | 105 | |
106 | // rescan system for new cards | ||
107 | void LanCardEdit::SLOT_ScanCards( void ) { | ||
108 | LanCardNetNode *NN = (LanCardNetNode *)NNI->nodeClass(); | ||
109 | |||
110 | // add any NIC that is new and matches our interfacename | ||
111 | System & S = NSResources->system(); | ||
112 | QRegExp R( "eth[0-9]" ); | ||
113 | // populate with all lancards in system | ||
114 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | ||
115 | It.current(); | ||
116 | ++It ) { | ||
117 | fprintf( stderr, "TEST %s %s\n", | ||
118 | It.current()->Name.latin1(), | ||
119 | It.current()->MACAddress.latin1() ); | ||
120 | if( R.match( It.current()->Name ) >= 0 && | ||
121 | ( It.current()->CardType == ARPHRD_ETHER | ||
122 | #ifdef ARPHRD_IEEE1394 | ||
123 | || It.current()->CardType == ARPHRD_IEEE1394 | ||
124 | #endif | ||
125 | ) | ||
126 | ) { | ||
127 | // old item ? | ||
128 | QCheckListItem * CLI = | ||
129 | (QCheckListItem *)LanCards_LV->firstChild(); | ||
130 | while( CLI ) { | ||
131 | if( CLI->text(0) == It.current()->MACAddress ) { | ||
132 | break; | ||
133 | } | ||
134 | CLI = (QCheckListItem *)CLI->nextSibling(); | ||
135 | } | ||
136 | |||
137 | if( ! CLI ) { | ||
138 | // new item | ||
139 | CLI = new QCheckListItem( LanCards_LV, | ||
140 | It.current()->MACAddress, | ||
141 | QCheckListItem::CheckBox ); | ||
142 | } | ||
143 | |||
144 | // mark present | ||
145 | CLI->setPixmap( 0, NSResources->getPixmap( | ||
146 | "add" ) ); | ||
147 | |||
148 | if( NN->addressesOfNIC().findIndex( It.current()->MACAddress) < 0 ) { | ||
149 | // new | ||
150 | NN->addressesOfNIC().append( It.current()->MACAddress ); | ||
151 | } | ||
87 | } | 152 | } |
88 | } | 153 | } |
89 | 154 | ||
90 | // set checks | 155 | } |
156 | |||
157 | // remove all cards that are not present -> flagged with 'remove' | ||
158 | // and unchecked | ||
159 | void LanCardEdit::SLOT_RemoveUnknown( void ) { | ||
160 | QArray<QCheckListItem *> AllItems; | ||
161 | |||
162 | LanCardNetNode *NN = (LanCardNetNode *)NNI->nodeClass(); | ||
163 | |||
164 | QCheckListItem * CLI = (QCheckListItem *)LanCards_LV->firstChild(); | ||
91 | while( CLI ) { | 165 | while( CLI ) { |
92 | CLI->setOn( Data.HWAddresses.findIndex(CLI->text(1)) >= 0 ); | 166 | AllItems.resize( AllItems.size()+1 ); |
167 | AllItems[ AllItems.size()-1 ] = CLI; | ||
93 | CLI = (QCheckListItem *)CLI->nextSibling(); | 168 | CLI = (QCheckListItem *)CLI->nextSibling(); |
94 | } | 169 | } |
170 | |||
171 | // force update of system | ||
172 | System & S = NSResources->system(); | ||
173 | S.probeInterfaces(); | ||
174 | |||
175 | // add any NIC that is new and matches our interfacename | ||
176 | QRegExp R( "eth[0-9]" ); | ||
177 | |||
178 | |||
179 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | ||
180 | It.current(); | ||
181 | ++It ) { | ||
182 | if( R.match( It.current()->Name ) >= 0 && | ||
183 | ( It.current()->CardType == ARPHRD_ETHER | ||
184 | #ifdef ARPHRD_IEEE1394 | ||
185 | || It.current()->CardType == ARPHRD_IEEE1394 | ||
186 | #endif | ||
187 | ) | ||
188 | ) { | ||
189 | |||
190 | for ( unsigned i = 0; i< AllItems.size(); i++ ) { | ||
191 | if( AllItems[i] && | ||
192 | AllItems[i]->text(0) == It.current()->MACAddress ) { | ||
193 | AllItems[i] = 0; | ||
194 | break; | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | } | ||
199 | |||
200 | // AllItems now contains all cards NOT present | ||
201 | // remove all items non null and not ON | ||
202 | for ( unsigned i = 0; i< AllItems.size(); i++ ) { | ||
203 | if( AllItems[i] && ! AllItems[i]->isOn() ) { | ||
204 | NN->addressesOfNIC().remove( AllItems[i]->text(0) ); | ||
205 | delete AllItems[i]; | ||
206 | } | ||
207 | } | ||
95 | } | 208 | } |
diff --git a/noncore/settings/networksettings2/lancard/lancardedit.h b/noncore/settings/networksettings2/lancard/lancardedit.h index 8def789..282db1f 100644 --- a/noncore/settings/networksettings2/lancard/lancardedit.h +++ b/noncore/settings/networksettings2/lancard/lancardedit.h | |||
@@ -1,16 +1,24 @@ | |||
1 | #include "lancarddata.h" | 1 | #include "lancarddata.h" |
2 | #include "lancardGUI.h" | 2 | #include "lancardGUI.h" |
3 | 3 | ||
4 | class ALanCard; | ||
5 | |||
4 | class LanCardEdit : public LanCardGUI { | 6 | class LanCardEdit : public LanCardGUI { |
5 | 7 | ||
6 | public : | 8 | public : |
7 | 9 | ||
8 | LanCardEdit( QWidget * parent ); | 10 | LanCardEdit( QWidget * parent ); |
9 | QString acceptable( void ); | 11 | QString acceptable( void ); |
10 | bool commit( LanCardData & Data ); | 12 | bool commit( LanCardData & Data ); |
11 | void showData( LanCardData & Data ); | 13 | void showData( ALanCard * NNI ); |
14 | |||
15 | public slots : | ||
16 | |||
17 | void SLOT_ScanCards( void ); | ||
18 | void SLOT_RemoveUnknown( void ); | ||
12 | 19 | ||
13 | private : | 20 | private : |
14 | 21 | ||
15 | bool ContainedObsoleteMAC; | 22 | void populateList( void ); |
23 | ALanCard * NNI; | ||
16 | }; | 24 | }; |
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.cpp b/noncore/settings/networksettings2/lancard/lancardrun.cpp index 951756d..2e4fc43 100644 --- a/noncore/settings/networksettings2/lancard/lancardrun.cpp +++ b/noncore/settings/networksettings2/lancard/lancardrun.cpp | |||
@@ -1,166 +1,192 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <qtextstream.h> | 2 | #include <qtextstream.h> |
3 | #include <qstringlist.h> | ||
3 | #include <resources.h> | 4 | #include <resources.h> |
4 | #include "lancardrun.h" | 5 | #include "lancardrun.h" |
5 | 6 | ||
6 | void LanCardRun::detectState( NodeCollection * NC ) { | 7 | void LanCardRun::detectState( NodeCollection * NC ) { |
7 | 8 | ||
8 | // unavailable : no card found | 9 | // unavailable : no card found |
9 | // available : card found and assigned to us or free | 10 | // available : card found and assigned to us or free |
10 | // up : card found and assigned to us and up | 11 | // up : card found and assigned to us and up |
11 | 12 | ||
12 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | 13 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); |
13 | System & Sys = NSResources->system(); | 14 | System & Sys = NSResources->system(); |
14 | InterfaceInfo * Run; | 15 | InterfaceInfo * Run; |
15 | 16 | ||
16 | QFile F( S ); | 17 | QFile F( S ); |
17 | 18 | ||
18 | if( F.open( IO_ReadOnly ) ) { | 19 | if( F.open( IO_ReadOnly ) ) { |
19 | // could open file -> read interface and assign | 20 | // could open file -> read interface and assign |
20 | QString X; | 21 | QString X; |
21 | QTextStream TS(&F); | 22 | QTextStream TS(&F); |
22 | X = TS.readLine(); | 23 | X = TS.readLine(); |
23 | // find interface | 24 | // find interface |
24 | if( handlesInterface( X ) ) { | 25 | if( handlesInterface( X ) ) { |
25 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 26 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
26 | It.current(); | 27 | It.current(); |
27 | ++It ) { | 28 | ++It ) { |
28 | Run = It.current(); | 29 | Run = It.current(); |
29 | if( X == Run->Name ) { | 30 | if( X == Run->Name ) { |
30 | Run->assignNode( netNode() ); | 31 | Run->assignNode( netNode() ); |
31 | assignInterface( Run ); | 32 | assignInterface( Run ); |
32 | NC->setCurrentState( IsUp ); | 33 | NC->setCurrentState( IsUp ); |
33 | return; | 34 | return; |
34 | } | 35 | } |
35 | } | 36 | } |
36 | } | 37 | } |
37 | } | 38 | } |
38 | 39 | ||
39 | if( ( Run = assignedInterface() ) ) { | 40 | if( ( Run = assignedInterface() ) ) { |
40 | // we already have an interface assigned -> still present ? | 41 | // we already have an interface assigned -> still present ? |
41 | if( ! Run->IsUp ) { | 42 | if( ! Run->IsUp ) { |
42 | // usb is still free -> keep assignment | 43 | // usb is still free -> keep assignment |
43 | NC->setCurrentState( Available ); | 44 | NC->setCurrentState( Available ); |
44 | return; | 45 | return; |
45 | } // else interface is up but NOT us -> some other profile | 46 | } // else interface is up but NOT us -> some other profile |
46 | } | 47 | } |
47 | 48 | ||
48 | // nothing (valid) assigned to us | 49 | // nothing (valid) assigned to us |
49 | assignInterface( 0 ); | 50 | assignInterface( 0 ); |
50 | 51 | ||
51 | // find possible interface | 52 | // find possible interface |
52 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 53 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
53 | It.current(); | 54 | It.current(); |
54 | ++It ) { | 55 | ++It ) { |
55 | Run = It.current(); | 56 | Run = It.current(); |
56 | if( handlesInterface( Run->Name ) && | 57 | if( handlesInterface( *Run ) && |
57 | Run->CardType == ARPHRD_ETHER && | 58 | ( Run->CardType == ARPHRD_ETHER |
59 | #ifdef ARPHRD_IEEE1394 | ||
60 | || Run->CardType == ARPHRD_IEEE1394 | ||
61 | #endif | ||
62 | ) && | ||
58 | ! Run->IsUp | 63 | ! Run->IsUp |
59 | ) { | 64 | ) { |
60 | // proper type, and Not UP -> free | 65 | // proper type, and Not UP -> free |
61 | NC->setCurrentState( Off ); | 66 | NC->setCurrentState( Off ); |
62 | return; | 67 | return; |
63 | } | 68 | } |
64 | } | 69 | } |
65 | // no free found | 70 | // no free found |
66 | 71 | ||
67 | NC->setCurrentState( Unavailable ); | 72 | NC->setCurrentState( Unavailable ); |
68 | 73 | ||
69 | } | 74 | } |
70 | 75 | ||
71 | bool LanCardRun::setState( NodeCollection * NC, Action_t A ) { | 76 | bool LanCardRun::setState( NodeCollection * NC, Action_t A ) { |
72 | 77 | ||
73 | // we only handle activate and deactivate | 78 | // we only handle activate and deactivate |
74 | switch( A ) { | 79 | switch( A ) { |
75 | case Activate : | 80 | case Activate : |
76 | { | 81 | { |
77 | if( NC->currentState() != Off ) { | 82 | if( NC->currentState() != Off ) { |
78 | return 0; | 83 | return 0; |
79 | } | 84 | } |
80 | InterfaceInfo * N = getInterface(); | 85 | InterfaceInfo * N = getInterface(); |
81 | if( ! N ) { | 86 | if( ! N ) { |
82 | // no interface available | 87 | // no interface available |
83 | NC->setCurrentState( Unavailable ); | 88 | NC->setCurrentState( Unavailable ); |
84 | return 0; | 89 | return 0; |
85 | } | 90 | } |
86 | // because we were OFF the interface | 91 | // because we were OFF the interface |
87 | // we get back is NOT assigned | 92 | // we get back is NOT assigned |
88 | N->assignNode( netNode() ); | 93 | N->assignNode( netNode() ); |
89 | assignInterface( N ); | 94 | assignInterface( N ); |
90 | NC->setCurrentState( Available ); | 95 | NC->setCurrentState( Available ); |
91 | return 1; | 96 | return 1; |
92 | } | 97 | } |
93 | case Deactivate : | 98 | case Deactivate : |
94 | if( NC->currentState() == IsUp ) { | 99 | if( NC->currentState() == IsUp ) { |
95 | // bring down first | 100 | // bring down first |
96 | if( ! connection()->setState( Down ) ) | 101 | if( ! connection()->setState( Down ) ) |
97 | // could not ... | 102 | // could not ... |
98 | return 0; | 103 | return 0; |
99 | } else if( NC->currentState() != Available ) { | 104 | } else if( NC->currentState() != Available ) { |
100 | return 1; | 105 | return 1; |
101 | } | 106 | } |
102 | assignedInterface()->assignNode( 0 ); // release | 107 | assignedInterface()->assignNode( 0 ); // release |
103 | assignInterface( 0 ); | 108 | assignInterface( 0 ); |
104 | NC->setCurrentState( Off ); | 109 | NC->setCurrentState( Off ); |
105 | return 1; | 110 | return 1; |
106 | default : | 111 | default : |
107 | // FT | 112 | // FT |
108 | break; | 113 | break; |
109 | } | 114 | } |
110 | return 0; | 115 | return 0; |
111 | } | 116 | } |
112 | 117 | ||
113 | bool LanCardRun::canSetState( State_t Curr, Action_t A ) { | 118 | bool LanCardRun::canSetState( State_t Curr, Action_t A ) { |
114 | // we only handle up down activate and deactivate | 119 | // we only handle up down activate and deactivate |
115 | switch( A ) { | 120 | switch( A ) { |
116 | case Activate : | 121 | case Activate : |
117 | { // at least available | 122 | { // at least available |
118 | if( Curr == Available ) { | 123 | if( Curr == Available ) { |
119 | return 1; | 124 | return 1; |
120 | } | 125 | } |
121 | // or we can make one available | 126 | // or we can make one available |
122 | InterfaceInfo * N = getInterface(); | 127 | InterfaceInfo * N = getInterface(); |
123 | if( ! N || N->assignedNode() != 0 ) { | 128 | if( ! N || N->assignedNode() != 0 ) { |
124 | // non available or assigned | 129 | // non available or assigned |
125 | return 0; | 130 | return 0; |
126 | } | 131 | } |
127 | return 1; | 132 | return 1; |
128 | } | 133 | } |
129 | case Deactivate : | 134 | case Deactivate : |
130 | return ( Curr >= Available ); | 135 | return ( Curr >= Available ); |
131 | default : | 136 | default : |
132 | // FT | 137 | // FT |
133 | break; | 138 | break; |
134 | } | 139 | } |
135 | return 0; | 140 | return 0; |
136 | } | 141 | } |
137 | 142 | ||
138 | // get interface that is free or assigned to us | 143 | // get interface that is free or assigned to us |
139 | InterfaceInfo * LanCardRun::getInterface( void ) { | 144 | InterfaceInfo * LanCardRun::getInterface( void ) { |
140 | 145 | ||
141 | System & S = NSResources->system(); | 146 | System & S = NSResources->system(); |
142 | InterfaceInfo * best = 0, * Run; | 147 | InterfaceInfo * best = 0, * Run; |
143 | 148 | ||
144 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 149 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
145 | It.current(); | 150 | It.current(); |
146 | ++It ) { | 151 | ++It ) { |
147 | Run = It.current(); | 152 | Run = It.current(); |
148 | if( handlesInterface( Run->Name ) && | 153 | if( handlesInterface( *Run ) && |
149 | Run->CardType == ARPHRD_ETHER | 154 | ( Run->CardType == ARPHRD_ETHER |
155 | #ifdef ARPHRD_IEEE1394 | ||
156 | || Run->CardType == ARPHRD_IEEE1394 | ||
157 | #endif | ||
158 | ) | ||
150 | ) { | 159 | ) { |
151 | // this is a LAN card | 160 | // this is a LAN card |
152 | if( Run->assignedNode() == netNode() ) { | 161 | if( Run->assignedNode() == netNode() ) { |
153 | // assigned to us | 162 | // assigned to us |
154 | return Run; | 163 | return Run; |
155 | } else if( Run->assignedNode() == 0 ) { | 164 | } else if( Run->assignedNode() == 0 ) { |
156 | // free | 165 | // free |
157 | best = Run; | 166 | best = Run; |
158 | } | 167 | } |
159 | } | 168 | } |
160 | } | 169 | } |
161 | return best; // can be 0 | 170 | return best; // can be 0 |
162 | } | 171 | } |
163 | 172 | ||
164 | bool LanCardRun::handlesInterface( const QString & S ) { | 173 | bool LanCardRun::handlesInterface( const QString & S ) { |
174 | InterfaceInfo * II; | ||
175 | II = NSResources->system().interface( S ); | ||
176 | if( ( II = NSResources->system().interface( S ) ) ) { | ||
177 | return handlesInterface( *II ); | ||
178 | } | ||
165 | return Pat.match( S ) >= 0; | 179 | return Pat.match( S ) >= 0; |
166 | } | 180 | } |
181 | |||
182 | bool LanCardRun::handlesInterface( const InterfaceInfo & II ) { | ||
183 | if( Pat.match( II.Name ) < 0 ) | ||
184 | return 0; | ||
185 | |||
186 | if( Data->AnyLanCard ) { | ||
187 | return 1; | ||
188 | } | ||
189 | |||
190 | // must also match hardware address | ||
191 | return ( Data->HWAddresses.findIndex( II.MACAddress ) >= 0 ); | ||
192 | } | ||
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.h b/noncore/settings/networksettings2/lancard/lancardrun.h index 499b417..e8a535a 100644 --- a/noncore/settings/networksettings2/lancard/lancardrun.h +++ b/noncore/settings/networksettings2/lancard/lancardrun.h | |||
@@ -1,37 +1,39 @@ | |||
1 | #ifndef LANCARDRUN_H | 1 | #ifndef LANCARDRUN_H |
2 | #define LANCARDRUN_H | 2 | #define LANCARDRUN_H |
3 | 3 | ||
4 | #include <asdevice.h> | 4 | #include <asdevice.h> |
5 | #include <qregexp.h> | 5 | #include <qregexp.h> |
6 | #include "lancarddata.h" | 6 | #include "lancarddata.h" |
7 | 7 | ||
8 | class LanCardRun : public AsDevice { | 8 | class LanCardRun : public AsDevice { |
9 | 9 | ||
10 | public : | 10 | public : |
11 | 11 | ||
12 | LanCardRun( ANetNodeInstance * NNI, | 12 | LanCardRun( ANetNodeInstance * NNI, |
13 | LanCardData & Data ) : AsDevice( NNI ), | 13 | LanCardData & D ) : AsDevice( NNI ), |
14 | Pat( "eth[0-9]" ) | 14 | Pat( "eth[0-9]" ) |
15 | { } | 15 | { Data = &D; } |
16 | 16 | ||
17 | virtual AsDevice * device( void ) | 17 | virtual AsDevice * device( void ) |
18 | { return (AsDevice *)this; } | 18 | { return (AsDevice *)this; } |
19 | 19 | ||
20 | virtual AsDevice * asDevice( void ) | 20 | virtual AsDevice * asDevice( void ) |
21 | { return (AsDevice *)this; } | 21 | { return (AsDevice *)this; } |
22 | 22 | ||
23 | protected : | 23 | protected : |
24 | 24 | ||
25 | void detectState( NodeCollection * NC ); | 25 | void detectState( NodeCollection * NC ); |
26 | bool setState( NodeCollection * NC, Action_t A ); | 26 | bool setState( NodeCollection * NC, Action_t A ); |
27 | bool canSetState( State_t Curr, Action_t A ); | 27 | bool canSetState( State_t Curr, Action_t A ); |
28 | 28 | ||
29 | bool handlesInterface( const QString & I ); | 29 | bool handlesInterface( const QString & I ); |
30 | bool handlesInterface( const InterfaceInfo & II ); | ||
30 | 31 | ||
31 | private : | 32 | private : |
32 | 33 | ||
33 | InterfaceInfo * getInterface( void ); | 34 | InterfaceInfo * getInterface( void ); |
34 | QRegExp Pat; | 35 | QRegExp Pat; |
36 | LanCardData * Data; | ||
35 | 37 | ||
36 | }; | 38 | }; |
37 | #endif | 39 | #endif |
diff --git a/noncore/settings/networksettings2/modem/modem_NN.cpp b/noncore/settings/networksettings2/modem/modem_NN.cpp index 1cc8524..9d70d7a 100644 --- a/noncore/settings/networksettings2/modem/modem_NN.cpp +++ b/noncore/settings/networksettings2/modem/modem_NN.cpp | |||
@@ -1,61 +1,61 @@ | |||
1 | #include "modem_NN.h" | 1 | #include "modem_NN.h" |
2 | #include "modem_NNI.h" | 2 | #include "modem_NNI.h" |
3 | 3 | ||
4 | static const char * ModemNeeds[] = | 4 | static const char * ModemNeeds[] = |
5 | { "line" | 5 | { "line" |
6 | }; | 6 | }; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor, find all of the possible interfaces | 9 | * Constructor, find all of the possible interfaces |
10 | */ | 10 | */ |
11 | ModemNetNode::ModemNetNode() : ANetNode() { | 11 | ModemNetNode::ModemNetNode() : ANetNode(tr("Dialup modem")) { |
12 | } | 12 | } |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Delete any interfaces that we own. | 15 | * Delete any interfaces that we own. |
16 | */ | 16 | */ |
17 | ModemNetNode::~ModemNetNode(){ | 17 | ModemNetNode::~ModemNetNode(){ |
18 | } | 18 | } |
19 | 19 | ||
20 | const QString ModemNetNode::nodeDescription(){ | 20 | const QString ModemNetNode::nodeDescription(){ |
21 | return tr("\ | 21 | return tr("\ |
22 | <p>Sets up a dialing procedures.</p>\ | 22 | <p>Sets up a dialing procedures.</p>\ |
23 | <p>Use this to dial up over modems, ISDN, GSM, ...</p>\ | 23 | <p>Use this to dial up over modems, ISDN, GSM, ...</p>\ |
24 | " | 24 | " |
25 | ); | 25 | ); |
26 | } | 26 | } |
27 | 27 | ||
28 | ANetNodeInstance * ModemNetNode::createInstance( void ) { | 28 | ANetNodeInstance * ModemNetNode::createInstance( void ) { |
29 | return new AModem( this ); | 29 | return new AModem( this ); |
30 | } | 30 | } |
31 | 31 | ||
32 | const char ** ModemNetNode::needs( void ) { | 32 | const char ** ModemNetNode::needs( void ) { |
33 | return ModemNeeds; | 33 | return ModemNeeds; |
34 | } | 34 | } |
35 | 35 | ||
36 | const char * ModemNetNode::provides( void ) { | 36 | const char * ModemNetNode::provides( void ) { |
37 | return "line"; | 37 | return "line"; |
38 | } | 38 | } |
39 | 39 | ||
40 | bool ModemNetNode::generateProperFilesFor( | 40 | bool ModemNetNode::generateProperFilesFor( |
41 | ANetNodeInstance * ) { | 41 | ANetNodeInstance * ) { |
42 | return 1; | 42 | return 1; |
43 | } | 43 | } |
44 | 44 | ||
45 | bool ModemNetNode::generateDeviceDataForCommonFile( | 45 | bool ModemNetNode::generateDeviceDataForCommonFile( |
46 | SystemFile & , | 46 | SystemFile & , |
47 | long ) { | 47 | long ) { |
48 | return 1; | 48 | return 1; |
49 | } | 49 | } |
50 | 50 | ||
51 | void ModemNetNode::setSpecificAttribute( QString & , QString & ) { | 51 | void ModemNetNode::setSpecificAttribute( QString & , QString & ) { |
52 | } | 52 | } |
53 | 53 | ||
54 | void ModemNetNode::saveSpecificAttribute( QTextStream & ) { | 54 | void ModemNetNode::saveSpecificAttribute( QTextStream & ) { |
55 | } | 55 | } |
56 | 56 | ||
57 | extern "C" { | 57 | extern "C" { |
58 | void create_plugin( QList<ANetNode> & PNN ) { | 58 | void create_plugin( QList<ANetNode> & PNN ) { |
59 | PNN.append( new ModemNetNode() ); | 59 | PNN.append( new ModemNetNode() ); |
60 | } | 60 | } |
61 | } | 61 | } |
diff --git a/noncore/settings/networksettings2/modem/modem_NN.h b/noncore/settings/networksettings2/modem/modem_NN.h index 849f928..2f496dd 100644 --- a/noncore/settings/networksettings2/modem/modem_NN.h +++ b/noncore/settings/networksettings2/modem/modem_NN.h | |||
@@ -1,47 +1,44 @@ | |||
1 | #ifndef MODEM_NETNODE_H | 1 | #ifndef MODEM_NETNODE_H |
2 | #define MODEM_NETNODE_H | 2 | #define MODEM_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AModem; | 6 | class AModem; |
7 | 7 | ||
8 | class ModemNetNode : public ANetNode{ | 8 | class ModemNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | ModemNetNode(); | 14 | ModemNetNode(); |
15 | virtual ~ModemNetNode(); | 15 | virtual ~ModemNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/modem"; } | 18 | { return "Devices/modem"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("Dialup modem"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & ) | 28 | virtual bool hasDataFor( const QString & ) |
32 | { return 0; } | 29 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 30 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr ); | 31 | SystemFile & SF, long DevNr ); |
35 | 32 | ||
36 | private: | 33 | private: |
37 | 34 | ||
38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
39 | virtual void saveSpecificAttribute( QTextStream & TS ); | 36 | virtual void saveSpecificAttribute( QTextStream & TS ); |
40 | }; | 37 | }; |
41 | 38 | ||
42 | extern "C" | 39 | extern "C" |
43 | { | 40 | { |
44 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
45 | }; | 42 | }; |
46 | 43 | ||
47 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/network/networkGUI.ui b/noncore/settings/networksettings2/network/networkGUI.ui index 9115ec0..5f71f82 100644 --- a/noncore/settings/networksettings2/network/networkGUI.ui +++ b/noncore/settings/networksettings2/network/networkGUI.ui | |||
@@ -1,1071 +1,1196 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>NetworkGUI</class> | 2 | <class>NetworkGUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>NetworkGUI</cstring> | 7 | <cstring>NetworkGUI</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>293</width> | 14 | <width>289</width> |
15 | <height>254</height> | 15 | <height>254</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Interface Configuration</string> | 20 | <string>Interface Configuration</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>0</number> | 31 | <number>0</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>0</number> | 35 | <number>0</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>TabWidget11</cstring> | 41 | <cstring>MainTab_TAB</cstring> |
42 | </property> | 42 | </property> |
43 | <property> | 43 | <property> |
44 | <name>layoutMargin</name> | 44 | <name>layoutMargin</name> |
45 | </property> | 45 | </property> |
46 | <property> | 46 | <property> |
47 | <name>layoutSpacing</name> | 47 | <name>layoutSpacing</name> |
48 | </property> | 48 | </property> |
49 | <widget> | 49 | <widget> |
50 | <class>QWidget</class> | 50 | <class>QWidget</class> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>name</name> | 52 | <name>name</name> |
53 | <cstring>tab</cstring> | 53 | <cstring>tab</cstring> |
54 | </property> | 54 | </property> |
55 | <attribute> | 55 | <attribute> |
56 | <name>title</name> | 56 | <name>title</name> |
57 | <string>Setup</string> | 57 | <string>Setup</string> |
58 | </attribute> | 58 | </attribute> |
59 | <vbox> | 59 | <vbox> |
60 | <property stdset="1"> | 60 | <property stdset="1"> |
61 | <name>margin</name> | 61 | <name>margin</name> |
62 | <number>0</number> | 62 | <number>0</number> |
63 | </property> | 63 | </property> |
64 | <property stdset="1"> | 64 | <property stdset="1"> |
65 | <name>spacing</name> | 65 | <name>spacing</name> |
66 | <number>0</number> | 66 | <number>0</number> |
67 | </property> | 67 | </property> |
68 | <widget> | 68 | <widget> |
69 | <class>QCheckBox</class> | 69 | <class>QCheckBox</class> |
70 | <property stdset="1"> | 70 | <property stdset="1"> |
71 | <name>name</name> | 71 | <name>name</name> |
72 | <cstring>DHCP_CB</cstring> | 72 | <cstring>DHCP_CB</cstring> |
73 | </property> | 73 | </property> |
74 | <property stdset="1"> | 74 | <property stdset="1"> |
75 | <name>text</name> | 75 | <name>text</name> |
76 | <string>Address from server</string> | 76 | <string>Address from server</string> |
77 | </property> | 77 | </property> |
78 | <property stdset="1"> | 78 | <property stdset="1"> |
79 | <name>checked</name> | 79 | <name>checked</name> |
80 | <bool>true</bool> | 80 | <bool>true</bool> |
81 | </property> | 81 | </property> |
82 | </widget> | 82 | </widget> |
83 | <widget> | 83 | <widget> |
84 | <class>QLayoutWidget</class> | 84 | <class>QLayoutWidget</class> |
85 | <property stdset="1"> | 85 | <property stdset="1"> |
86 | <name>name</name> | 86 | <name>name</name> |
87 | <cstring>Layout3</cstring> | 87 | <cstring>Layout3</cstring> |
88 | </property> | 88 | </property> |
89 | <hbox> | 89 | <hbox> |
90 | <property stdset="1"> | 90 | <property stdset="1"> |
91 | <name>margin</name> | 91 | <name>margin</name> |
92 | <number>0</number> | 92 | <number>0</number> |
93 | </property> | 93 | </property> |
94 | <property stdset="1"> | 94 | <property stdset="1"> |
95 | <name>spacing</name> | 95 | <name>spacing</name> |
96 | <number>6</number> | 96 | <number>6</number> |
97 | </property> | 97 | </property> |
98 | <spacer> | 98 | <spacer> |
99 | <property> | 99 | <property> |
100 | <name>name</name> | 100 | <name>name</name> |
101 | <cstring>Spacer6</cstring> | 101 | <cstring>Spacer6</cstring> |
102 | </property> | 102 | </property> |
103 | <property stdset="1"> | 103 | <property stdset="1"> |
104 | <name>orientation</name> | 104 | <name>orientation</name> |
105 | <enum>Horizontal</enum> | 105 | <enum>Horizontal</enum> |
106 | </property> | 106 | </property> |
107 | <property stdset="1"> | 107 | <property stdset="1"> |
108 | <name>sizeType</name> | 108 | <name>sizeType</name> |
109 | <enum>Fixed</enum> | 109 | <enum>Fixed</enum> |
110 | </property> | 110 | </property> |
111 | <property> | 111 | <property> |
112 | <name>sizeHint</name> | 112 | <name>sizeHint</name> |
113 | <size> | 113 | <size> |
114 | <width>20</width> | 114 | <width>20</width> |
115 | <height>20</height> | 115 | <height>20</height> |
116 | </size> | 116 | </size> |
117 | </property> | 117 | </property> |
118 | </spacer> | 118 | </spacer> |
119 | <widget> | 119 | <widget> |
120 | <class>QFrame</class> | 120 | <class>QFrame</class> |
121 | <property stdset="1"> | 121 | <property stdset="1"> |
122 | <name>name</name> | 122 | <name>name</name> |
123 | <cstring>StaticIP_GB</cstring> | 123 | <cstring>StaticIP_GB</cstring> |
124 | </property> | 124 | </property> |
125 | <property stdset="1"> | 125 | <property stdset="1"> |
126 | <name>enabled</name> | 126 | <name>enabled</name> |
127 | <bool>false</bool> | 127 | <bool>false</bool> |
128 | </property> | 128 | </property> |
129 | <property stdset="1"> | 129 | <property stdset="1"> |
130 | <name>sizePolicy</name> | 130 | <name>sizePolicy</name> |
131 | <sizepolicy> | 131 | <sizepolicy> |
132 | <hsizetype>7</hsizetype> | 132 | <hsizetype>7</hsizetype> |
133 | <vsizetype>5</vsizetype> | 133 | <vsizetype>5</vsizetype> |
134 | </sizepolicy> | 134 | </sizepolicy> |
135 | </property> | 135 | </property> |
136 | <property stdset="1"> | 136 | <property stdset="1"> |
137 | <name>frameShape</name> | 137 | <name>frameShape</name> |
138 | <enum>NoFrame</enum> | 138 | <enum>NoFrame</enum> |
139 | </property> | 139 | </property> |
140 | <property stdset="1"> | 140 | <property stdset="1"> |
141 | <name>frameShadow</name> | 141 | <name>frameShadow</name> |
142 | <enum>Raised</enum> | 142 | <enum>Raised</enum> |
143 | </property> | 143 | </property> |
144 | <property> | 144 | <property> |
145 | <name>layoutMargin</name> | 145 | <name>layoutMargin</name> |
146 | </property> | 146 | </property> |
147 | <property> | 147 | <property> |
148 | <name>layoutSpacing</name> | 148 | <name>layoutSpacing</name> |
149 | </property> | 149 | </property> |
150 | <grid> | 150 | <grid> |
151 | <property stdset="1"> | 151 | <property stdset="1"> |
152 | <name>margin</name> | 152 | <name>margin</name> |
153 | <number>0</number> | 153 | <number>0</number> |
154 | </property> | 154 | </property> |
155 | <property stdset="1"> | 155 | <property stdset="1"> |
156 | <name>spacing</name> | 156 | <name>spacing</name> |
157 | <number>1</number> | 157 | <number>1</number> |
158 | </property> | 158 | </property> |
159 | <widget row="0" column="0" > | 159 | <widget row="0" column="0" > |
160 | <class>QLabel</class> | 160 | <class>QLabel</class> |
161 | <property stdset="1"> | 161 | <property stdset="1"> |
162 | <name>name</name> | 162 | <name>name</name> |
163 | <cstring>TextLabel4</cstring> | 163 | <cstring>TextLabel4</cstring> |
164 | </property> | 164 | </property> |
165 | <property stdset="1"> | 165 | <property stdset="1"> |
166 | <name>text</name> | 166 | <name>text</name> |
167 | <string>IP Address</string> | 167 | <string>IP Address</string> |
168 | </property> | 168 | </property> |
169 | <property stdset="1"> | 169 | <property stdset="1"> |
170 | <name>alignment</name> | 170 | <name>alignment</name> |
171 | <set>AlignCenter</set> | 171 | <set>AlignCenter</set> |
172 | </property> | 172 | </property> |
173 | <property> | 173 | <property> |
174 | <name>hAlign</name> | 174 | <name>hAlign</name> |
175 | </property> | 175 | </property> |
176 | </widget> | 176 | </widget> |
177 | <widget row="1" column="0" > | 177 | <widget row="1" column="0" > |
178 | <class>QLabel</class> | 178 | <class>QLabel</class> |
179 | <property stdset="1"> | 179 | <property stdset="1"> |
180 | <name>name</name> | 180 | <name>name</name> |
181 | <cstring>TextLabel5</cstring> | 181 | <cstring>TextLabel5</cstring> |
182 | </property> | 182 | </property> |
183 | <property stdset="1"> | 183 | <property stdset="1"> |
184 | <name>text</name> | 184 | <name>text</name> |
185 | <string>Subnet Mask</string> | 185 | <string>Subnet Mask</string> |
186 | </property> | 186 | </property> |
187 | <property stdset="1"> | 187 | <property stdset="1"> |
188 | <name>alignment</name> | 188 | <name>alignment</name> |
189 | <set>AlignCenter</set> | 189 | <set>AlignCenter</set> |
190 | </property> | 190 | </property> |
191 | <property> | 191 | <property> |
192 | <name>hAlign</name> | 192 | <name>hAlign</name> |
193 | </property> | 193 | </property> |
194 | </widget> | 194 | </widget> |
195 | <widget row="4" column="0" > | 195 | <widget row="4" column="0" > |
196 | <class>QLabel</class> | 196 | <class>QLabel</class> |
197 | <property stdset="1"> | 197 | <property stdset="1"> |
198 | <name>name</name> | 198 | <name>name</name> |
199 | <cstring>TextLabel2</cstring> | 199 | <cstring>TextLabel2</cstring> |
200 | </property> | 200 | </property> |
201 | <property stdset="1"> | 201 | <property stdset="1"> |
202 | <name>text</name> | 202 | <name>text</name> |
203 | <string>First DNS</string> | 203 | <string>First DNS</string> |
204 | </property> | 204 | </property> |
205 | <property stdset="1"> | 205 | <property stdset="1"> |
206 | <name>alignment</name> | 206 | <name>alignment</name> |
207 | <set>AlignCenter</set> | 207 | <set>AlignCenter</set> |
208 | </property> | 208 | </property> |
209 | <property> | 209 | <property> |
210 | <name>hAlign</name> | 210 | <name>hAlign</name> |
211 | </property> | 211 | </property> |
212 | </widget> | 212 | </widget> |
213 | <widget row="3" column="0" > | 213 | <widget row="3" column="0" > |
214 | <class>QLabel</class> | 214 | <class>QLabel</class> |
215 | <property stdset="1"> | 215 | <property stdset="1"> |
216 | <name>name</name> | 216 | <name>name</name> |
217 | <cstring>TextLabel1_2</cstring> | 217 | <cstring>TextLabel1_2</cstring> |
218 | </property> | 218 | </property> |
219 | <property stdset="1"> | 219 | <property stdset="1"> |
220 | <name>text</name> | 220 | <name>text</name> |
221 | <string>Gateway</string> | 221 | <string>Gateway</string> |
222 | </property> | 222 | </property> |
223 | <property stdset="1"> | 223 | <property stdset="1"> |
224 | <name>alignment</name> | 224 | <name>alignment</name> |
225 | <set>AlignCenter</set> | 225 | <set>AlignCenter</set> |
226 | </property> | 226 | </property> |
227 | <property> | 227 | <property> |
228 | <name>hAlign</name> | 228 | <name>hAlign</name> |
229 | </property> | 229 | </property> |
230 | </widget> | 230 | </widget> |
231 | <widget row="2" column="0" > | 231 | <widget row="2" column="0" > |
232 | <class>QLabel</class> | 232 | <class>QLabel</class> |
233 | <property stdset="1"> | 233 | <property stdset="1"> |
234 | <name>name</name> | 234 | <name>name</name> |
235 | <cstring>TextLabel1</cstring> | 235 | <cstring>TextLabel1</cstring> |
236 | </property> | 236 | </property> |
237 | <property stdset="1"> | 237 | <property stdset="1"> |
238 | <name>text</name> | 238 | <name>text</name> |
239 | <string>Broadcast</string> | 239 | <string>Broadcast</string> |
240 | </property> | 240 | </property> |
241 | <property stdset="1"> | 241 | <property stdset="1"> |
242 | <name>alignment</name> | 242 | <name>alignment</name> |
243 | <set>AlignCenter</set> | 243 | <set>AlignCenter</set> |
244 | </property> | 244 | </property> |
245 | <property> | 245 | <property> |
246 | <name>hAlign</name> | 246 | <name>hAlign</name> |
247 | </property> | 247 | </property> |
248 | </widget> | 248 | </widget> |
249 | <widget row="5" column="0" > | 249 | <widget row="5" column="0" > |
250 | <class>QLabel</class> | 250 | <class>QLabel</class> |
251 | <property stdset="1"> | 251 | <property stdset="1"> |
252 | <name>name</name> | 252 | <name>name</name> |
253 | <cstring>TextLabel3</cstring> | 253 | <cstring>TextLabel3</cstring> |
254 | </property> | 254 | </property> |
255 | <property stdset="1"> | 255 | <property stdset="1"> |
256 | <name>text</name> | 256 | <name>text</name> |
257 | <string>Second DNS</string> | 257 | <string>Second DNS</string> |
258 | </property> | 258 | </property> |
259 | <property stdset="1"> | 259 | <property stdset="1"> |
260 | <name>alignment</name> | 260 | <name>alignment</name> |
261 | <set>AlignCenter</set> | 261 | <set>AlignCenter</set> |
262 | </property> | 262 | </property> |
263 | <property> | 263 | <property> |
264 | <name>hAlign</name> | 264 | <name>hAlign</name> |
265 | </property> | 265 | </property> |
266 | </widget> | 266 | </widget> |
267 | <widget row="0" column="1" > | 267 | <widget row="0" column="1" > |
268 | <class>QLineEdit</class> | 268 | <class>QLineEdit</class> |
269 | <property stdset="1"> | 269 | <property stdset="1"> |
270 | <name>name</name> | 270 | <name>name</name> |
271 | <cstring>IPAddress_LE</cstring> | 271 | <cstring>IPAddress_LE</cstring> |
272 | </property> | 272 | </property> |
273 | </widget> | 273 | </widget> |
274 | <widget row="1" column="1" > | 274 | <widget row="1" column="1" > |
275 | <class>QLineEdit</class> | 275 | <class>QLineEdit</class> |
276 | <property stdset="1"> | 276 | <property stdset="1"> |
277 | <name>name</name> | 277 | <name>name</name> |
278 | <cstring>SubnetMask_LE</cstring> | 278 | <cstring>SubnetMask_LE</cstring> |
279 | </property> | 279 | </property> |
280 | <property stdset="1"> | 280 | <property stdset="1"> |
281 | <name>text</name> | 281 | <name>text</name> |
282 | <string>255.255.255.0</string> | 282 | <string>255.255.255.0</string> |
283 | </property> | 283 | </property> |
284 | </widget> | 284 | </widget> |
285 | <widget row="2" column="1" > | 285 | <widget row="2" column="1" > |
286 | <class>QLineEdit</class> | 286 | <class>QLineEdit</class> |
287 | <property stdset="1"> | 287 | <property stdset="1"> |
288 | <name>name</name> | 288 | <name>name</name> |
289 | <cstring>Broadcast_LE</cstring> | 289 | <cstring>Broadcast_LE</cstring> |
290 | </property> | 290 | </property> |
291 | </widget> | 291 | </widget> |
292 | <widget row="3" column="1" > | 292 | <widget row="3" column="1" > |
293 | <class>QLineEdit</class> | 293 | <class>QLineEdit</class> |
294 | <property stdset="1"> | 294 | <property stdset="1"> |
295 | <name>name</name> | 295 | <name>name</name> |
296 | <cstring>Gateway_LE</cstring> | 296 | <cstring>Gateway_LE</cstring> |
297 | </property> | 297 | </property> |
298 | </widget> | 298 | </widget> |
299 | <widget row="4" column="1" > | 299 | <widget row="4" column="1" > |
300 | <class>QLineEdit</class> | 300 | <class>QLineEdit</class> |
301 | <property stdset="1"> | 301 | <property stdset="1"> |
302 | <name>name</name> | 302 | <name>name</name> |
303 | <cstring>DNS1_LE</cstring> | 303 | <cstring>DNS1_LE</cstring> |
304 | </property> | 304 | </property> |
305 | </widget> | 305 | </widget> |
306 | <widget row="5" column="1" > | 306 | <widget row="5" column="1" > |
307 | <class>QLineEdit</class> | 307 | <class>QLineEdit</class> |
308 | <property stdset="1"> | 308 | <property stdset="1"> |
309 | <name>name</name> | 309 | <name>name</name> |
310 | <cstring>DNS2_LE</cstring> | 310 | <cstring>DNS2_LE</cstring> |
311 | </property> | 311 | </property> |
312 | </widget> | 312 | </widget> |
313 | </grid> | 313 | </grid> |
314 | </widget> | 314 | </widget> |
315 | </hbox> | 315 | </hbox> |
316 | </widget> | 316 | </widget> |
317 | <widget> | 317 | <widget> |
318 | <class>QLabel</class> | 318 | <class>QLabel</class> |
319 | <property stdset="1"> | 319 | <property stdset="1"> |
320 | <name>name</name> | 320 | <name>name</name> |
321 | <cstring>TextLabel2_2</cstring> | 321 | <cstring>TextLabel2_2</cstring> |
322 | </property> | 322 | </property> |
323 | <property stdset="1"> | 323 | <property stdset="1"> |
324 | <name>text</name> | 324 | <name>text</name> |
325 | <string>DHCP Settings</string> | 325 | <string>DHCP Settings</string> |
326 | </property> | 326 | </property> |
327 | </widget> | 327 | </widget> |
328 | <widget> | 328 | <widget> |
329 | <class>QLayoutWidget</class> | 329 | <class>QLayoutWidget</class> |
330 | <property stdset="1"> | 330 | <property stdset="1"> |
331 | <name>name</name> | 331 | <name>name</name> |
332 | <cstring>Layout5</cstring> | 332 | <cstring>Layout5</cstring> |
333 | </property> | 333 | </property> |
334 | <hbox> | 334 | <hbox> |
335 | <property stdset="1"> | 335 | <property stdset="1"> |
336 | <name>margin</name> | 336 | <name>margin</name> |
337 | <number>0</number> | 337 | <number>0</number> |
338 | </property> | 338 | </property> |
339 | <property stdset="1"> | 339 | <property stdset="1"> |
340 | <name>spacing</name> | 340 | <name>spacing</name> |
341 | <number>6</number> | 341 | <number>6</number> |
342 | </property> | 342 | </property> |
343 | <spacer> | 343 | <spacer> |
344 | <property> | 344 | <property> |
345 | <name>name</name> | 345 | <name>name</name> |
346 | <cstring>Spacer26</cstring> | 346 | <cstring>Spacer26</cstring> |
347 | </property> | 347 | </property> |
348 | <property stdset="1"> | 348 | <property stdset="1"> |
349 | <name>orientation</name> | 349 | <name>orientation</name> |
350 | <enum>Horizontal</enum> | 350 | <enum>Horizontal</enum> |
351 | </property> | 351 | </property> |
352 | <property stdset="1"> | 352 | <property stdset="1"> |
353 | <name>sizeType</name> | 353 | <name>sizeType</name> |
354 | <enum>Fixed</enum> | 354 | <enum>Fixed</enum> |
355 | </property> | 355 | </property> |
356 | <property> | 356 | <property> |
357 | <name>sizeHint</name> | 357 | <name>sizeHint</name> |
358 | <size> | 358 | <size> |
359 | <width>20</width> | 359 | <width>20</width> |
360 | <height>20</height> | 360 | <height>20</height> |
361 | </size> | 361 | </size> |
362 | </property> | 362 | </property> |
363 | </spacer> | 363 | </spacer> |
364 | <widget> | 364 | <widget> |
365 | <class>QFrame</class> | 365 | <class>QFrame</class> |
366 | <property stdset="1"> | 366 | <property stdset="1"> |
367 | <name>name</name> | 367 | <name>name</name> |
368 | <cstring>Frame27</cstring> | 368 | <cstring>Frame27</cstring> |
369 | </property> | 369 | </property> |
370 | <property stdset="1"> | 370 | <property stdset="1"> |
371 | <name>sizePolicy</name> | 371 | <name>sizePolicy</name> |
372 | <sizepolicy> | 372 | <sizepolicy> |
373 | <hsizetype>7</hsizetype> | 373 | <hsizetype>7</hsizetype> |
374 | <vsizetype>5</vsizetype> | 374 | <vsizetype>5</vsizetype> |
375 | </sizepolicy> | 375 | </sizepolicy> |
376 | </property> | 376 | </property> |
377 | <property stdset="1"> | 377 | <property stdset="1"> |
378 | <name>frameShape</name> | 378 | <name>frameShape</name> |
379 | <enum>NoFrame</enum> | 379 | <enum>NoFrame</enum> |
380 | </property> | 380 | </property> |
381 | <property stdset="1"> | 381 | <property stdset="1"> |
382 | <name>frameShadow</name> | 382 | <name>frameShadow</name> |
383 | <enum>Raised</enum> | 383 | <enum>Raised</enum> |
384 | </property> | 384 | </property> |
385 | <property> | 385 | <property> |
386 | <name>layoutMargin</name> | 386 | <name>layoutMargin</name> |
387 | </property> | 387 | </property> |
388 | <property> | 388 | <property> |
389 | <name>layoutSpacing</name> | 389 | <name>layoutSpacing</name> |
390 | </property> | 390 | </property> |
391 | <hbox> | 391 | <hbox> |
392 | <property stdset="1"> | 392 | <property stdset="1"> |
393 | <name>margin</name> | 393 | <name>margin</name> |
394 | <number>0</number> | 394 | <number>0</number> |
395 | </property> | 395 | </property> |
396 | <property stdset="1"> | 396 | <property stdset="1"> |
397 | <name>spacing</name> | 397 | <name>spacing</name> |
398 | <number>2</number> | 398 | <number>2</number> |
399 | </property> | 399 | </property> |
400 | <widget> | 400 | <widget> |
401 | <class>QCheckBox</class> | 401 | <class>QCheckBox</class> |
402 | <property stdset="1"> | 402 | <property stdset="1"> |
403 | <name>name</name> | 403 | <name>name</name> |
404 | <cstring>SendHostname_CB</cstring> | 404 | <cstring>SendHostname_CB</cstring> |
405 | </property> | 405 | </property> |
406 | <property stdset="1"> | 406 | <property stdset="1"> |
407 | <name>text</name> | 407 | <name>text</name> |
408 | <string>Send hostname</string> | 408 | <string>Send hostname</string> |
409 | </property> | 409 | </property> |
410 | </widget> | 410 | </widget> |
411 | <widget> | 411 | <widget> |
412 | <class>QLineEdit</class> | 412 | <class>QLineEdit</class> |
413 | <property stdset="1"> | 413 | <property stdset="1"> |
414 | <name>name</name> | 414 | <name>name</name> |
415 | <cstring>Hostname_LE</cstring> | 415 | <cstring>Hostname_LE</cstring> |
416 | </property> | 416 | </property> |
417 | <property stdset="1"> | 417 | <property stdset="1"> |
418 | <name>enabled</name> | 418 | <name>enabled</name> |
419 | <bool>false</bool> | 419 | <bool>false</bool> |
420 | </property> | 420 | </property> |
421 | <property stdset="1"> | 421 | <property stdset="1"> |
422 | <name>sizePolicy</name> | 422 | <name>sizePolicy</name> |
423 | <sizepolicy> | 423 | <sizepolicy> |
424 | <hsizetype>7</hsizetype> | 424 | <hsizetype>7</hsizetype> |
425 | <vsizetype>0</vsizetype> | 425 | <vsizetype>0</vsizetype> |
426 | </sizepolicy> | 426 | </sizepolicy> |
427 | </property> | 427 | </property> |
428 | </widget> | 428 | </widget> |
429 | </hbox> | 429 | </hbox> |
430 | </widget> | 430 | </widget> |
431 | </hbox> | 431 | </hbox> |
432 | </widget> | 432 | </widget> |
433 | <spacer> | 433 | <spacer> |
434 | <property> | 434 | <property> |
435 | <name>name</name> | 435 | <name>name</name> |
436 | <cstring>Spacer38</cstring> | 436 | <cstring>Spacer38</cstring> |
437 | </property> | 437 | </property> |
438 | <property stdset="1"> | 438 | <property stdset="1"> |
439 | <name>orientation</name> | 439 | <name>orientation</name> |
440 | <enum>Vertical</enum> | 440 | <enum>Vertical</enum> |
441 | </property> | 441 | </property> |
442 | <property stdset="1"> | 442 | <property stdset="1"> |
443 | <name>sizeType</name> | 443 | <name>sizeType</name> |
444 | <enum>Expanding</enum> | 444 | <enum>Expanding</enum> |
445 | </property> | 445 | </property> |
446 | <property> | 446 | <property> |
447 | <name>sizeHint</name> | 447 | <name>sizeHint</name> |
448 | <size> | 448 | <size> |
449 | <width>20</width> | 449 | <width>20</width> |
450 | <height>20</height> | 450 | <height>20</height> |
451 | </size> | 451 | </size> |
452 | </property> | 452 | </property> |
453 | </spacer> | 453 | </spacer> |
454 | </vbox> | 454 | </vbox> |
455 | </widget> | 455 | </widget> |
456 | <widget> | 456 | <widget> |
457 | <class>QWidget</class> | 457 | <class>QWidget</class> |
458 | <property stdset="1"> | 458 | <property stdset="1"> |
459 | <name>name</name> | 459 | <name>name</name> |
460 | <cstring>tab</cstring> | 460 | <cstring>tab</cstring> |
461 | </property> | 461 | </property> |
462 | <attribute> | 462 | <attribute> |
463 | <name>title</name> | 463 | <name>title</name> |
464 | <string>Extra commands</string> | 464 | <string>Extra commands</string> |
465 | </attribute> | 465 | </attribute> |
466 | <vbox> | 466 | <vbox> |
467 | <property stdset="1"> | 467 | <property stdset="1"> |
468 | <name>margin</name> | 468 | <name>margin</name> |
469 | <number>0</number> | 469 | <number>0</number> |
470 | </property> | 470 | </property> |
471 | <property stdset="1"> | 471 | <property stdset="1"> |
472 | <name>spacing</name> | 472 | <name>spacing</name> |
473 | <number>2</number> | 473 | <number>2</number> |
474 | </property> | 474 | </property> |
475 | <widget> | 475 | <widget> |
476 | <class>QLineEdit</class> | 476 | <class>QLineEdit</class> |
477 | <property stdset="1"> | 477 | <property stdset="1"> |
478 | <name>name</name> | 478 | <name>name</name> |
479 | <cstring>Command_LE</cstring> | 479 | <cstring>Command_LE</cstring> |
480 | </property> | 480 | </property> |
481 | </widget> | 481 | </widget> |
482 | <widget> | 482 | <widget> |
483 | <class>QTabWidget</class> | 483 | <class>QTabWidget</class> |
484 | <property stdset="1"> | 484 | <property stdset="1"> |
485 | <name>name</name> | 485 | <name>name</name> |
486 | <cstring>Tab_TB</cstring> | 486 | <cstring>Tab_TAB</cstring> |
487 | </property> | 487 | </property> |
488 | <property> | 488 | <property> |
489 | <name>layoutMargin</name> | 489 | <name>layoutMargin</name> |
490 | </property> | 490 | </property> |
491 | <property> | 491 | <property> |
492 | <name>layoutSpacing</name> | 492 | <name>layoutSpacing</name> |
493 | </property> | 493 | </property> |
494 | <widget> | 494 | <widget> |
495 | <class>QWidget</class> | 495 | <class>QWidget</class> |
496 | <property stdset="1"> | 496 | <property stdset="1"> |
497 | <name>name</name> | 497 | <name>name</name> |
498 | <cstring>tab</cstring> | 498 | <cstring>tab</cstring> |
499 | </property> | 499 | </property> |
500 | <attribute> | 500 | <attribute> |
501 | <name>title</name> | 501 | <name>title</name> |
502 | <string>Pre-Up</string> | 502 | <string>Pre-Up</string> |
503 | </attribute> | 503 | </attribute> |
504 | <hbox> | 504 | <hbox> |
505 | <property stdset="1"> | 505 | <property stdset="1"> |
506 | <name>margin</name> | 506 | <name>margin</name> |
507 | <number>0</number> | 507 | <number>0</number> |
508 | </property> | 508 | </property> |
509 | <property stdset="1"> | 509 | <property stdset="1"> |
510 | <name>spacing</name> | 510 | <name>spacing</name> |
511 | <number>2</number> | 511 | <number>2</number> |
512 | </property> | 512 | </property> |
513 | <widget> | 513 | <widget> |
514 | <class>QListBox</class> | 514 | <class>QListBox</class> |
515 | <property stdset="1"> | 515 | <property stdset="1"> |
516 | <name>name</name> | 516 | <name>name</name> |
517 | <cstring>PreUp_LB</cstring> | 517 | <cstring>PreUp_LB</cstring> |
518 | </property> | 518 | </property> |
519 | </widget> | 519 | </widget> |
520 | <widget> | 520 | <widget> |
521 | <class>QFrame</class> | 521 | <class>QFrame</class> |
522 | <property stdset="1"> | 522 | <property stdset="1"> |
523 | <name>name</name> | 523 | <name>name</name> |
524 | <cstring>Frame5_2</cstring> | 524 | <cstring>Frame5_2</cstring> |
525 | </property> | 525 | </property> |
526 | <property stdset="1"> | 526 | <property stdset="1"> |
527 | <name>sizePolicy</name> | 527 | <name>sizePolicy</name> |
528 | <sizepolicy> | 528 | <sizepolicy> |
529 | <hsizetype>0</hsizetype> | 529 | <hsizetype>0</hsizetype> |
530 | <vsizetype>7</vsizetype> | 530 | <vsizetype>7</vsizetype> |
531 | </sizepolicy> | 531 | </sizepolicy> |
532 | </property> | 532 | </property> |
533 | <property stdset="1"> | 533 | <property stdset="1"> |
534 | <name>frameShape</name> | 534 | <name>frameShape</name> |
535 | <enum>StyledPanel</enum> | 535 | <enum>StyledPanel</enum> |
536 | </property> | 536 | </property> |
537 | <property stdset="1"> | 537 | <property stdset="1"> |
538 | <name>frameShadow</name> | 538 | <name>frameShadow</name> |
539 | <enum>Raised</enum> | 539 | <enum>Raised</enum> |
540 | </property> | 540 | </property> |
541 | <property> | 541 | <property> |
542 | <name>layoutMargin</name> | 542 | <name>layoutMargin</name> |
543 | </property> | 543 | </property> |
544 | <property> | 544 | <property> |
545 | <name>layoutSpacing</name> | 545 | <name>layoutSpacing</name> |
546 | </property> | 546 | </property> |
547 | <vbox> | 547 | <vbox> |
548 | <property stdset="1"> | 548 | <property stdset="1"> |
549 | <name>margin</name> | 549 | <name>margin</name> |
550 | <number>0</number> | 550 | <number>0</number> |
551 | </property> | 551 | </property> |
552 | <property stdset="1"> | 552 | <property stdset="1"> |
553 | <name>spacing</name> | 553 | <name>spacing</name> |
554 | <number>1</number> | 554 | <number>1</number> |
555 | </property> | 555 | </property> |
556 | <widget> | 556 | <widget> |
557 | <class>QToolButton</class> | 557 | <class>QToolButton</class> |
558 | <property stdset="1"> | 558 | <property stdset="1"> |
559 | <name>name</name> | 559 | <name>name</name> |
560 | <cstring>AddPreUp_TB</cstring> | 560 | <cstring>AddPreUp_TB</cstring> |
561 | </property> | 561 | </property> |
562 | <property stdset="1"> | 562 | <property stdset="1"> |
563 | <name>text</name> | 563 | <name>text</name> |
564 | <string>...</string> | 564 | <string>...</string> |
565 | </property> | 565 | </property> |
566 | </widget> | 566 | </widget> |
567 | <widget> | 567 | <widget> |
568 | <class>QToolButton</class> | 568 | <class>QToolButton</class> |
569 | <property stdset="1"> | 569 | <property stdset="1"> |
570 | <name>name</name> | 570 | <name>name</name> |
571 | <cstring>DeletePreUp_TB</cstring> | 571 | <cstring>DeletePreUp_TB</cstring> |
572 | </property> | 572 | </property> |
573 | <property stdset="1"> | 573 | <property stdset="1"> |
574 | <name>text</name> | 574 | <name>text</name> |
575 | <string>...</string> | 575 | <string>...</string> |
576 | </property> | 576 | </property> |
577 | </widget> | 577 | </widget> |
578 | <widget> | 578 | <widget> |
579 | <class>QToolButton</class> | 579 | <class>QToolButton</class> |
580 | <property stdset="1"> | 580 | <property stdset="1"> |
581 | <name>name</name> | 581 | <name>name</name> |
582 | <cstring>UpPreUp_TB</cstring> | 582 | <cstring>UpPreUp_TB</cstring> |
583 | </property> | 583 | </property> |
584 | <property stdset="1"> | 584 | <property stdset="1"> |
585 | <name>text</name> | 585 | <name>text</name> |
586 | <string>...</string> | 586 | <string>...</string> |
587 | </property> | 587 | </property> |
588 | </widget> | 588 | </widget> |
589 | <widget> | 589 | <widget> |
590 | <class>QToolButton</class> | 590 | <class>QToolButton</class> |
591 | <property stdset="1"> | 591 | <property stdset="1"> |
592 | <name>name</name> | 592 | <name>name</name> |
593 | <cstring>DownPreUp_TB</cstring> | 593 | <cstring>DownPreUp_TB</cstring> |
594 | </property> | 594 | </property> |
595 | <property stdset="1"> | 595 | <property stdset="1"> |
596 | <name>text</name> | 596 | <name>text</name> |
597 | <string>...</string> | 597 | <string>...</string> |
598 | </property> | 598 | </property> |
599 | </widget> | 599 | </widget> |
600 | <spacer> | 600 | <spacer> |
601 | <property> | 601 | <property> |
602 | <name>name</name> | 602 | <name>name</name> |
603 | <cstring>Spacer5_2_2</cstring> | 603 | <cstring>Spacer5_2_2</cstring> |
604 | </property> | 604 | </property> |
605 | <property stdset="1"> | 605 | <property stdset="1"> |
606 | <name>orientation</name> | 606 | <name>orientation</name> |
607 | <enum>Vertical</enum> | 607 | <enum>Vertical</enum> |
608 | </property> | 608 | </property> |
609 | <property stdset="1"> | 609 | <property stdset="1"> |
610 | <name>sizeType</name> | 610 | <name>sizeType</name> |
611 | <enum>Expanding</enum> | 611 | <enum>Expanding</enum> |
612 | </property> | 612 | </property> |
613 | <property> | 613 | <property> |
614 | <name>sizeHint</name> | 614 | <name>sizeHint</name> |
615 | <size> | 615 | <size> |
616 | <width>20</width> | 616 | <width>20</width> |
617 | <height>20</height> | 617 | <height>20</height> |
618 | </size> | 618 | </size> |
619 | </property> | 619 | </property> |
620 | </spacer> | 620 | </spacer> |
621 | </vbox> | 621 | </vbox> |
622 | </widget> | 622 | </widget> |
623 | </hbox> | 623 | </hbox> |
624 | </widget> | 624 | </widget> |
625 | <widget> | 625 | <widget> |
626 | <class>QWidget</class> | 626 | <class>QWidget</class> |
627 | <property stdset="1"> | 627 | <property stdset="1"> |
628 | <name>name</name> | 628 | <name>name</name> |
629 | <cstring>tab</cstring> | 629 | <cstring>tab</cstring> |
630 | </property> | 630 | </property> |
631 | <attribute> | 631 | <attribute> |
632 | <name>title</name> | 632 | <name>title</name> |
633 | <string>Post-Up</string> | 633 | <string>Post-Up</string> |
634 | </attribute> | 634 | </attribute> |
635 | <hbox> | 635 | <hbox> |
636 | <property stdset="1"> | 636 | <property stdset="1"> |
637 | <name>margin</name> | 637 | <name>margin</name> |
638 | <number>0</number> | 638 | <number>0</number> |
639 | </property> | 639 | </property> |
640 | <property stdset="1"> | 640 | <property stdset="1"> |
641 | <name>spacing</name> | 641 | <name>spacing</name> |
642 | <number>2</number> | 642 | <number>2</number> |
643 | </property> | 643 | </property> |
644 | <widget> | 644 | <widget> |
645 | <class>QListBox</class> | 645 | <class>QListBox</class> |
646 | <property stdset="1"> | 646 | <property stdset="1"> |
647 | <name>name</name> | 647 | <name>name</name> |
648 | <cstring>PostUp_LB</cstring> | 648 | <cstring>PostUp_LB</cstring> |
649 | </property> | 649 | </property> |
650 | </widget> | 650 | </widget> |
651 | <widget> | 651 | <widget> |
652 | <class>QFrame</class> | 652 | <class>QFrame</class> |
653 | <property stdset="1"> | 653 | <property stdset="1"> |
654 | <name>name</name> | 654 | <name>name</name> |
655 | <cstring>Frame5</cstring> | 655 | <cstring>Frame5</cstring> |
656 | </property> | 656 | </property> |
657 | <property stdset="1"> | 657 | <property stdset="1"> |
658 | <name>sizePolicy</name> | 658 | <name>sizePolicy</name> |
659 | <sizepolicy> | 659 | <sizepolicy> |
660 | <hsizetype>0</hsizetype> | 660 | <hsizetype>0</hsizetype> |
661 | <vsizetype>7</vsizetype> | 661 | <vsizetype>7</vsizetype> |
662 | </sizepolicy> | 662 | </sizepolicy> |
663 | </property> | 663 | </property> |
664 | <property stdset="1"> | 664 | <property stdset="1"> |
665 | <name>frameShape</name> | 665 | <name>frameShape</name> |
666 | <enum>StyledPanel</enum> | 666 | <enum>StyledPanel</enum> |
667 | </property> | 667 | </property> |
668 | <property stdset="1"> | 668 | <property stdset="1"> |
669 | <name>frameShadow</name> | 669 | <name>frameShadow</name> |
670 | <enum>Raised</enum> | 670 | <enum>Raised</enum> |
671 | </property> | 671 | </property> |
672 | <property> | 672 | <property> |
673 | <name>layoutMargin</name> | 673 | <name>layoutMargin</name> |
674 | </property> | 674 | </property> |
675 | <property> | 675 | <property> |
676 | <name>layoutSpacing</name> | 676 | <name>layoutSpacing</name> |
677 | </property> | 677 | </property> |
678 | <vbox> | 678 | <vbox> |
679 | <property stdset="1"> | 679 | <property stdset="1"> |
680 | <name>margin</name> | 680 | <name>margin</name> |
681 | <number>0</number> | 681 | <number>0</number> |
682 | </property> | 682 | </property> |
683 | <property stdset="1"> | 683 | <property stdset="1"> |
684 | <name>spacing</name> | 684 | <name>spacing</name> |
685 | <number>1</number> | 685 | <number>1</number> |
686 | </property> | 686 | </property> |
687 | <widget> | 687 | <widget> |
688 | <class>QToolButton</class> | 688 | <class>QToolButton</class> |
689 | <property stdset="1"> | 689 | <property stdset="1"> |
690 | <name>name</name> | 690 | <name>name</name> |
691 | <cstring>AddPostUp_TB</cstring> | 691 | <cstring>AddPostUp_TB</cstring> |
692 | </property> | 692 | </property> |
693 | <property stdset="1"> | 693 | <property stdset="1"> |
694 | <name>text</name> | 694 | <name>text</name> |
695 | <string>...</string> | 695 | <string>...</string> |
696 | </property> | 696 | </property> |
697 | </widget> | 697 | </widget> |
698 | <widget> | 698 | <widget> |
699 | <class>QToolButton</class> | 699 | <class>QToolButton</class> |
700 | <property stdset="1"> | 700 | <property stdset="1"> |
701 | <name>name</name> | 701 | <name>name</name> |
702 | <cstring>DeletePostUp_TB</cstring> | 702 | <cstring>DeletePostUp_TB</cstring> |
703 | </property> | 703 | </property> |
704 | <property stdset="1"> | 704 | <property stdset="1"> |
705 | <name>text</name> | 705 | <name>text</name> |
706 | <string>...</string> | 706 | <string>...</string> |
707 | </property> | 707 | </property> |
708 | </widget> | 708 | </widget> |
709 | <widget> | 709 | <widget> |
710 | <class>QToolButton</class> | 710 | <class>QToolButton</class> |
711 | <property stdset="1"> | 711 | <property stdset="1"> |
712 | <name>name</name> | 712 | <name>name</name> |
713 | <cstring>UpPostUp_TB</cstring> | 713 | <cstring>UpPostUp_TB</cstring> |
714 | </property> | 714 | </property> |
715 | <property stdset="1"> | 715 | <property stdset="1"> |
716 | <name>text</name> | 716 | <name>text</name> |
717 | <string>...</string> | 717 | <string>...</string> |
718 | </property> | 718 | </property> |
719 | </widget> | 719 | </widget> |
720 | <widget> | 720 | <widget> |
721 | <class>QToolButton</class> | 721 | <class>QToolButton</class> |
722 | <property stdset="1"> | 722 | <property stdset="1"> |
723 | <name>name</name> | 723 | <name>name</name> |
724 | <cstring>DownPostUp_TB</cstring> | 724 | <cstring>DownPostUp_TB</cstring> |
725 | </property> | 725 | </property> |
726 | <property stdset="1"> | 726 | <property stdset="1"> |
727 | <name>text</name> | 727 | <name>text</name> |
728 | <string>...</string> | 728 | <string>...</string> |
729 | </property> | 729 | </property> |
730 | </widget> | 730 | </widget> |
731 | <spacer> | 731 | <spacer> |
732 | <property> | 732 | <property> |
733 | <name>name</name> | 733 | <name>name</name> |
734 | <cstring>Spacer5_5</cstring> | 734 | <cstring>Spacer5_5</cstring> |
735 | </property> | 735 | </property> |
736 | <property stdset="1"> | 736 | <property stdset="1"> |
737 | <name>orientation</name> | 737 | <name>orientation</name> |
738 | <enum>Vertical</enum> | 738 | <enum>Vertical</enum> |
739 | </property> | 739 | </property> |
740 | <property stdset="1"> | 740 | <property stdset="1"> |
741 | <name>sizeType</name> | 741 | <name>sizeType</name> |
742 | <enum>Expanding</enum> | 742 | <enum>Expanding</enum> |
743 | </property> | 743 | </property> |
744 | <property> | 744 | <property> |
745 | <name>sizeHint</name> | 745 | <name>sizeHint</name> |
746 | <size> | 746 | <size> |
747 | <width>20</width> | 747 | <width>20</width> |
748 | <height>20</height> | 748 | <height>20</height> |
749 | </size> | 749 | </size> |
750 | </property> | 750 | </property> |
751 | </spacer> | 751 | </spacer> |
752 | </vbox> | 752 | </vbox> |
753 | </widget> | 753 | </widget> |
754 | </hbox> | 754 | </hbox> |
755 | </widget> | 755 | </widget> |
756 | <widget> | 756 | <widget> |
757 | <class>QWidget</class> | 757 | <class>QWidget</class> |
758 | <property stdset="1"> | 758 | <property stdset="1"> |
759 | <name>name</name> | 759 | <name>name</name> |
760 | <cstring>tab</cstring> | 760 | <cstring>tab</cstring> |
761 | </property> | 761 | </property> |
762 | <attribute> | 762 | <attribute> |
763 | <name>title</name> | 763 | <name>title</name> |
764 | <string>Pre-Down</string> | 764 | <string>Pre-Down</string> |
765 | </attribute> | 765 | </attribute> |
766 | <hbox> | 766 | <hbox> |
767 | <property stdset="1"> | 767 | <property stdset="1"> |
768 | <name>margin</name> | 768 | <name>margin</name> |
769 | <number>0</number> | 769 | <number>0</number> |
770 | </property> | 770 | </property> |
771 | <property stdset="1"> | 771 | <property stdset="1"> |
772 | <name>spacing</name> | 772 | <name>spacing</name> |
773 | <number>2</number> | 773 | <number>2</number> |
774 | </property> | 774 | </property> |
775 | <widget> | 775 | <widget> |
776 | <class>QListBox</class> | 776 | <class>QListBox</class> |
777 | <property stdset="1"> | 777 | <property stdset="1"> |
778 | <name>name</name> | 778 | <name>name</name> |
779 | <cstring>PreDown_LB</cstring> | 779 | <cstring>PreDown_LB</cstring> |
780 | </property> | 780 | </property> |
781 | </widget> | 781 | </widget> |
782 | <widget> | 782 | <widget> |
783 | <class>QFrame</class> | 783 | <class>QFrame</class> |
784 | <property stdset="1"> | 784 | <property stdset="1"> |
785 | <name>name</name> | 785 | <name>name</name> |
786 | <cstring>Frame5_3</cstring> | 786 | <cstring>Frame5_3</cstring> |
787 | </property> | 787 | </property> |
788 | <property stdset="1"> | 788 | <property stdset="1"> |
789 | <name>sizePolicy</name> | 789 | <name>sizePolicy</name> |
790 | <sizepolicy> | 790 | <sizepolicy> |
791 | <hsizetype>0</hsizetype> | 791 | <hsizetype>0</hsizetype> |
792 | <vsizetype>3</vsizetype> | 792 | <vsizetype>3</vsizetype> |
793 | </sizepolicy> | 793 | </sizepolicy> |
794 | </property> | 794 | </property> |
795 | <property stdset="1"> | 795 | <property stdset="1"> |
796 | <name>frameShape</name> | 796 | <name>frameShape</name> |
797 | <enum>StyledPanel</enum> | 797 | <enum>StyledPanel</enum> |
798 | </property> | 798 | </property> |
799 | <property stdset="1"> | 799 | <property stdset="1"> |
800 | <name>frameShadow</name> | 800 | <name>frameShadow</name> |
801 | <enum>Raised</enum> | 801 | <enum>Raised</enum> |
802 | </property> | 802 | </property> |
803 | <property> | 803 | <property> |
804 | <name>layoutMargin</name> | 804 | <name>layoutMargin</name> |
805 | </property> | 805 | </property> |
806 | <property> | 806 | <property> |
807 | <name>layoutSpacing</name> | 807 | <name>layoutSpacing</name> |
808 | </property> | 808 | </property> |
809 | <vbox> | 809 | <vbox> |
810 | <property stdset="1"> | 810 | <property stdset="1"> |
811 | <name>margin</name> | 811 | <name>margin</name> |
812 | <number>0</number> | 812 | <number>0</number> |
813 | </property> | 813 | </property> |
814 | <property stdset="1"> | 814 | <property stdset="1"> |
815 | <name>spacing</name> | 815 | <name>spacing</name> |
816 | <number>1</number> | 816 | <number>1</number> |
817 | </property> | 817 | </property> |
818 | <widget> | 818 | <widget> |
819 | <class>QToolButton</class> | 819 | <class>QToolButton</class> |
820 | <property stdset="1"> | 820 | <property stdset="1"> |
821 | <name>name</name> | 821 | <name>name</name> |
822 | <cstring>AddPreDown_TB</cstring> | 822 | <cstring>AddPreDown_TB</cstring> |
823 | </property> | 823 | </property> |
824 | <property stdset="1"> | 824 | <property stdset="1"> |
825 | <name>text</name> | 825 | <name>text</name> |
826 | <string>...</string> | 826 | <string>...</string> |
827 | </property> | 827 | </property> |
828 | </widget> | 828 | </widget> |
829 | <widget> | 829 | <widget> |
830 | <class>QToolButton</class> | 830 | <class>QToolButton</class> |
831 | <property stdset="1"> | 831 | <property stdset="1"> |
832 | <name>name</name> | 832 | <name>name</name> |
833 | <cstring>DeletePreDown_TB</cstring> | 833 | <cstring>DeletePreDown_TB</cstring> |
834 | </property> | 834 | </property> |
835 | <property stdset="1"> | 835 | <property stdset="1"> |
836 | <name>text</name> | 836 | <name>text</name> |
837 | <string>...</string> | 837 | <string>...</string> |
838 | </property> | 838 | </property> |
839 | </widget> | 839 | </widget> |
840 | <widget> | 840 | <widget> |
841 | <class>QToolButton</class> | 841 | <class>QToolButton</class> |
842 | <property stdset="1"> | 842 | <property stdset="1"> |
843 | <name>name</name> | 843 | <name>name</name> |
844 | <cstring>UpPreDown_TB</cstring> | 844 | <cstring>UpPreDown_TB</cstring> |
845 | </property> | 845 | </property> |
846 | <property stdset="1"> | 846 | <property stdset="1"> |
847 | <name>text</name> | 847 | <name>text</name> |
848 | <string>...</string> | 848 | <string>...</string> |
849 | </property> | 849 | </property> |
850 | </widget> | 850 | </widget> |
851 | <widget> | 851 | <widget> |
852 | <class>QToolButton</class> | 852 | <class>QToolButton</class> |
853 | <property stdset="1"> | 853 | <property stdset="1"> |
854 | <name>name</name> | 854 | <name>name</name> |
855 | <cstring>DownPreDown_TB</cstring> | 855 | <cstring>DownPreDown_TB</cstring> |
856 | </property> | 856 | </property> |
857 | <property stdset="1"> | 857 | <property stdset="1"> |
858 | <name>text</name> | 858 | <name>text</name> |
859 | <string>...</string> | 859 | <string>...</string> |
860 | </property> | 860 | </property> |
861 | </widget> | 861 | </widget> |
862 | <spacer> | 862 | <spacer> |
863 | <property> | 863 | <property> |
864 | <name>name</name> | 864 | <name>name</name> |
865 | <cstring>Spacer5_3_2</cstring> | 865 | <cstring>Spacer5_3_2</cstring> |
866 | </property> | 866 | </property> |
867 | <property stdset="1"> | 867 | <property stdset="1"> |
868 | <name>orientation</name> | 868 | <name>orientation</name> |
869 | <enum>Vertical</enum> | 869 | <enum>Vertical</enum> |
870 | </property> | 870 | </property> |
871 | <property stdset="1"> | 871 | <property stdset="1"> |
872 | <name>sizeType</name> | 872 | <name>sizeType</name> |
873 | <enum>Expanding</enum> | 873 | <enum>Expanding</enum> |
874 | </property> | 874 | </property> |
875 | <property> | 875 | <property> |
876 | <name>sizeHint</name> | 876 | <name>sizeHint</name> |
877 | <size> | 877 | <size> |
878 | <width>20</width> | 878 | <width>20</width> |
879 | <height>20</height> | 879 | <height>20</height> |
880 | </size> | 880 | </size> |
881 | </property> | 881 | </property> |
882 | </spacer> | 882 | </spacer> |
883 | </vbox> | 883 | </vbox> |
884 | </widget> | 884 | </widget> |
885 | </hbox> | 885 | </hbox> |
886 | </widget> | 886 | </widget> |
887 | <widget> | 887 | <widget> |
888 | <class>QWidget</class> | 888 | <class>QWidget</class> |
889 | <property stdset="1"> | 889 | <property stdset="1"> |
890 | <name>name</name> | 890 | <name>name</name> |
891 | <cstring>tab</cstring> | 891 | <cstring>tab</cstring> |
892 | </property> | 892 | </property> |
893 | <attribute> | 893 | <attribute> |
894 | <name>title</name> | 894 | <name>title</name> |
895 | <string>Post-Down</string> | 895 | <string>Post-Down</string> |
896 | </attribute> | 896 | </attribute> |
897 | <hbox> | 897 | <hbox> |
898 | <property stdset="1"> | 898 | <property stdset="1"> |
899 | <name>margin</name> | 899 | <name>margin</name> |
900 | <number>0</number> | 900 | <number>0</number> |
901 | </property> | 901 | </property> |
902 | <property stdset="1"> | 902 | <property stdset="1"> |
903 | <name>spacing</name> | 903 | <name>spacing</name> |
904 | <number>2</number> | 904 | <number>2</number> |
905 | </property> | 905 | </property> |
906 | <widget> | 906 | <widget> |
907 | <class>QListBox</class> | 907 | <class>QListBox</class> |
908 | <property stdset="1"> | 908 | <property stdset="1"> |
909 | <name>name</name> | 909 | <name>name</name> |
910 | <cstring>PostDown_LB</cstring> | 910 | <cstring>PostDown_LB</cstring> |
911 | </property> | 911 | </property> |
912 | </widget> | 912 | </widget> |
913 | <widget> | 913 | <widget> |
914 | <class>QFrame</class> | 914 | <class>QFrame</class> |
915 | <property stdset="1"> | 915 | <property stdset="1"> |
916 | <name>name</name> | 916 | <name>name</name> |
917 | <cstring>Frame5_4</cstring> | 917 | <cstring>Frame5_4</cstring> |
918 | </property> | 918 | </property> |
919 | <property stdset="1"> | 919 | <property stdset="1"> |
920 | <name>sizePolicy</name> | 920 | <name>sizePolicy</name> |
921 | <sizepolicy> | 921 | <sizepolicy> |
922 | <hsizetype>0</hsizetype> | 922 | <hsizetype>0</hsizetype> |
923 | <vsizetype>7</vsizetype> | 923 | <vsizetype>7</vsizetype> |
924 | </sizepolicy> | 924 | </sizepolicy> |
925 | </property> | 925 | </property> |
926 | <property stdset="1"> | 926 | <property stdset="1"> |
927 | <name>frameShape</name> | 927 | <name>frameShape</name> |
928 | <enum>StyledPanel</enum> | 928 | <enum>StyledPanel</enum> |
929 | </property> | 929 | </property> |
930 | <property stdset="1"> | 930 | <property stdset="1"> |
931 | <name>frameShadow</name> | 931 | <name>frameShadow</name> |
932 | <enum>Raised</enum> | 932 | <enum>Raised</enum> |
933 | </property> | 933 | </property> |
934 | <property> | 934 | <property> |
935 | <name>layoutMargin</name> | 935 | <name>layoutMargin</name> |
936 | </property> | 936 | </property> |
937 | <property> | 937 | <property> |
938 | <name>layoutSpacing</name> | 938 | <name>layoutSpacing</name> |
939 | </property> | 939 | </property> |
940 | <vbox> | 940 | <vbox> |
941 | <property stdset="1"> | 941 | <property stdset="1"> |
942 | <name>margin</name> | 942 | <name>margin</name> |
943 | <number>0</number> | 943 | <number>0</number> |
944 | </property> | 944 | </property> |
945 | <property stdset="1"> | 945 | <property stdset="1"> |
946 | <name>spacing</name> | 946 | <name>spacing</name> |
947 | <number>1</number> | 947 | <number>1</number> |
948 | </property> | 948 | </property> |
949 | <widget> | 949 | <widget> |
950 | <class>QToolButton</class> | 950 | <class>QToolButton</class> |
951 | <property stdset="1"> | 951 | <property stdset="1"> |
952 | <name>name</name> | 952 | <name>name</name> |
953 | <cstring>AddPostDown_TB</cstring> | 953 | <cstring>AddPostDown_TB</cstring> |
954 | </property> | 954 | </property> |
955 | <property stdset="1"> | 955 | <property stdset="1"> |
956 | <name>text</name> | 956 | <name>text</name> |
957 | <string>...</string> | 957 | <string>...</string> |
958 | </property> | 958 | </property> |
959 | </widget> | 959 | </widget> |
960 | <widget> | 960 | <widget> |
961 | <class>QToolButton</class> | 961 | <class>QToolButton</class> |
962 | <property stdset="1"> | 962 | <property stdset="1"> |
963 | <name>name</name> | 963 | <name>name</name> |
964 | <cstring>DeletePostDown_TB</cstring> | 964 | <cstring>DeletePostDown_TB</cstring> |
965 | </property> | 965 | </property> |
966 | <property stdset="1"> | 966 | <property stdset="1"> |
967 | <name>text</name> | 967 | <name>text</name> |
968 | <string>...</string> | 968 | <string>...</string> |
969 | </property> | 969 | </property> |
970 | </widget> | 970 | </widget> |
971 | <widget> | 971 | <widget> |
972 | <class>QToolButton</class> | 972 | <class>QToolButton</class> |
973 | <property stdset="1"> | 973 | <property stdset="1"> |
974 | <name>name</name> | 974 | <name>name</name> |
975 | <cstring>UpPostDown_TB</cstring> | 975 | <cstring>UpPostDown_TB</cstring> |
976 | </property> | 976 | </property> |
977 | <property stdset="1"> | 977 | <property stdset="1"> |
978 | <name>text</name> | 978 | <name>text</name> |
979 | <string>...</string> | 979 | <string>...</string> |
980 | </property> | 980 | </property> |
981 | </widget> | 981 | </widget> |
982 | <widget> | 982 | <widget> |
983 | <class>QToolButton</class> | 983 | <class>QToolButton</class> |
984 | <property stdset="1"> | 984 | <property stdset="1"> |
985 | <name>name</name> | 985 | <name>name</name> |
986 | <cstring>DownPostDown_TB</cstring> | 986 | <cstring>DownPostDown_TB</cstring> |
987 | </property> | 987 | </property> |
988 | <property stdset="1"> | 988 | <property stdset="1"> |
989 | <name>text</name> | 989 | <name>text</name> |
990 | <string>...</string> | 990 | <string>...</string> |
991 | </property> | 991 | </property> |
992 | </widget> | 992 | </widget> |
993 | <spacer> | 993 | <spacer> |
994 | <property> | 994 | <property> |
995 | <name>name</name> | 995 | <name>name</name> |
996 | <cstring>Spacer5_4</cstring> | 996 | <cstring>Spacer5_4</cstring> |
997 | </property> | 997 | </property> |
998 | <property stdset="1"> | 998 | <property stdset="1"> |
999 | <name>orientation</name> | 999 | <name>orientation</name> |
1000 | <enum>Vertical</enum> | 1000 | <enum>Vertical</enum> |
1001 | </property> | 1001 | </property> |
1002 | <property stdset="1"> | 1002 | <property stdset="1"> |
1003 | <name>sizeType</name> | 1003 | <name>sizeType</name> |
1004 | <enum>Expanding</enum> | 1004 | <enum>Expanding</enum> |
1005 | </property> | 1005 | </property> |
1006 | <property> | 1006 | <property> |
1007 | <name>sizeHint</name> | 1007 | <name>sizeHint</name> |
1008 | <size> | 1008 | <size> |
1009 | <width>20</width> | 1009 | <width>20</width> |
1010 | <height>20</height> | 1010 | <height>20</height> |
1011 | </size> | 1011 | </size> |
1012 | </property> | 1012 | </property> |
1013 | </spacer> | 1013 | </spacer> |
1014 | </vbox> | 1014 | </vbox> |
1015 | </widget> | 1015 | </widget> |
1016 | </hbox> | 1016 | </hbox> |
1017 | </widget> | 1017 | </widget> |
1018 | </widget> | 1018 | </widget> |
1019 | </vbox> | 1019 | </vbox> |
1020 | </widget> | 1020 | </widget> |
1021 | </widget> | 1021 | </widget> |
1022 | </vbox> | 1022 | </vbox> |
1023 | </widget> | 1023 | </widget> |
1024 | <connections> | 1024 | <connections> |
1025 | <connection> | 1025 | <connection> |
1026 | <sender>DHCP_CB</sender> | 1026 | <sender>DHCP_CB</sender> |
1027 | <signal>toggled(bool)</signal> | 1027 | <signal>toggled(bool)</signal> |
1028 | <receiver>StaticIP_GB</receiver> | 1028 | <receiver>StaticIP_GB</receiver> |
1029 | <slot>setDisabled(bool)</slot> | 1029 | <slot>setDisabled(bool)</slot> |
1030 | </connection> | 1030 | </connection> |
1031 | <connection> | 1031 | <connection> |
1032 | <sender>SubnetMask_LE</sender> | 1032 | <sender>SubnetMask_LE</sender> |
1033 | <signal>textChanged(const QString&)</signal> | 1033 | <signal>textChanged(const QString&)</signal> |
1034 | <receiver>NetworkGUI</receiver> | 1034 | <receiver>NetworkGUI</receiver> |
1035 | <slot>SLOT_NetmaskModified( const QString & )</slot> | 1035 | <slot>SLOT_NetmaskModified( const QString & )</slot> |
1036 | </connection> | 1036 | </connection> |
1037 | <connection> | 1037 | <connection> |
1038 | <sender>IPAddress_LE</sender> | 1038 | <sender>IPAddress_LE</sender> |
1039 | <signal>textChanged(const QString&)</signal> | 1039 | <signal>textChanged(const QString&)</signal> |
1040 | <receiver>NetworkGUI</receiver> | 1040 | <receiver>NetworkGUI</receiver> |
1041 | <slot>SLOT_NetmaskModified( const QString & )</slot> | 1041 | <slot>SLOT_NetmaskModified( const QString & )</slot> |
1042 | </connection> | 1042 | </connection> |
1043 | <connection> | 1043 | <connection> |
1044 | <sender>DHCP_CB</sender> | 1044 | <sender>DHCP_CB</sender> |
1045 | <signal>toggled(bool)</signal> | 1045 | <signal>toggled(bool)</signal> |
1046 | <receiver>Frame27</receiver> | 1046 | <receiver>Frame27</receiver> |
1047 | <slot>setEnabled(bool)</slot> | 1047 | <slot>setEnabled(bool)</slot> |
1048 | </connection> | 1048 | </connection> |
1049 | <connection> | 1049 | <connection> |
1050 | <sender>DHCP_CB</sender> | 1050 | <sender>DHCP_CB</sender> |
1051 | <signal>toggled(bool)</signal> | 1051 | <signal>toggled(bool)</signal> |
1052 | <receiver>TextLabel2_2</receiver> | 1052 | <receiver>TextLabel2_2</receiver> |
1053 | <slot>setEnabled(bool)</slot> | 1053 | <slot>setEnabled(bool)</slot> |
1054 | </connection> | 1054 | </connection> |
1055 | <connection> | 1055 | <connection> |
1056 | <sender>SendHostname_CB</sender> | 1056 | <sender>SendHostname_CB</sender> |
1057 | <signal>toggled(bool)</signal> | 1057 | <signal>toggled(bool)</signal> |
1058 | <receiver>Hostname_LE</receiver> | 1058 | <receiver>Hostname_LE</receiver> |
1059 | <slot>setEnabled(bool)</slot> | 1059 | <slot>setEnabled(bool)</slot> |
1060 | </connection> | 1060 | </connection> |
1061 | <connection> | ||
1062 | <sender>AddPreUp_TB</sender> | ||
1063 | <signal>clicked()</signal> | ||
1064 | <receiver>NetworkGUI</receiver> | ||
1065 | <slot>SLOT_Add()</slot> | ||
1066 | </connection> | ||
1067 | <connection> | ||
1068 | <sender>DeletePreUp_TB</sender> | ||
1069 | <signal>clicked()</signal> | ||
1070 | <receiver>NetworkGUI</receiver> | ||
1071 | <slot>SLOT_Remove()</slot> | ||
1072 | </connection> | ||
1073 | <connection> | ||
1074 | <sender>UpPreUp_TB</sender> | ||
1075 | <signal>clicked()</signal> | ||
1076 | <receiver>NetworkGUI</receiver> | ||
1077 | <slot>SLOT_Up()</slot> | ||
1078 | </connection> | ||
1079 | <connection> | ||
1080 | <sender>DownPreUp_TB</sender> | ||
1081 | <signal>clicked()</signal> | ||
1082 | <receiver>NetworkGUI</receiver> | ||
1083 | <slot>SLOT_Down()</slot> | ||
1084 | </connection> | ||
1085 | <connection> | ||
1086 | <sender>AddPostUp_TB</sender> | ||
1087 | <signal>clicked()</signal> | ||
1088 | <receiver>NetworkGUI</receiver> | ||
1089 | <slot>SLOT_Add()</slot> | ||
1090 | </connection> | ||
1091 | <connection> | ||
1092 | <sender>DeletePostUp_TB</sender> | ||
1093 | <signal>clicked()</signal> | ||
1094 | <receiver>NetworkGUI</receiver> | ||
1095 | <slot>SLOT_Remove()</slot> | ||
1096 | </connection> | ||
1097 | <connection> | ||
1098 | <sender>UpPostUp_TB</sender> | ||
1099 | <signal>clicked()</signal> | ||
1100 | <receiver>NetworkGUI</receiver> | ||
1101 | <slot>SLOT_Up()</slot> | ||
1102 | </connection> | ||
1103 | <connection> | ||
1104 | <sender>DownPostUp_TB</sender> | ||
1105 | <signal>clicked()</signal> | ||
1106 | <receiver>NetworkGUI</receiver> | ||
1107 | <slot>SLOT_Down()</slot> | ||
1108 | </connection> | ||
1109 | <connection> | ||
1110 | <sender>AddPreDown_TB</sender> | ||
1111 | <signal>clicked()</signal> | ||
1112 | <receiver>NetworkGUI</receiver> | ||
1113 | <slot>SLOT_Add()</slot> | ||
1114 | </connection> | ||
1115 | <connection> | ||
1116 | <sender>DeletePreDown_TB</sender> | ||
1117 | <signal>clicked()</signal> | ||
1118 | <receiver>NetworkGUI</receiver> | ||
1119 | <slot>SLOT_Remove()</slot> | ||
1120 | </connection> | ||
1121 | <connection> | ||
1122 | <sender>UpPreDown_TB</sender> | ||
1123 | <signal>clicked()</signal> | ||
1124 | <receiver>NetworkGUI</receiver> | ||
1125 | <slot>SLOT_Up()</slot> | ||
1126 | </connection> | ||
1127 | <connection> | ||
1128 | <sender>DownPreDown_TB</sender> | ||
1129 | <signal>clicked()</signal> | ||
1130 | <receiver>NetworkGUI</receiver> | ||
1131 | <slot>SLOT_Down()</slot> | ||
1132 | </connection> | ||
1133 | <connection> | ||
1134 | <sender>AddPostDown_TB</sender> | ||
1135 | <signal>clicked()</signal> | ||
1136 | <receiver>NetworkGUI</receiver> | ||
1137 | <slot>SLOT_Add()</slot> | ||
1138 | </connection> | ||
1139 | <connection> | ||
1140 | <sender>DeletePostDown_TB</sender> | ||
1141 | <signal>clicked()</signal> | ||
1142 | <receiver>NetworkGUI</receiver> | ||
1143 | <slot>SLOT_Remove()</slot> | ||
1144 | </connection> | ||
1145 | <connection> | ||
1146 | <sender>UpPostDown_TB</sender> | ||
1147 | <signal>clicked()</signal> | ||
1148 | <receiver>NetworkGUI</receiver> | ||
1149 | <slot>SLOT_Up()</slot> | ||
1150 | </connection> | ||
1151 | <connection> | ||
1152 | <sender>DownPostDown_TB</sender> | ||
1153 | <signal>clicked()</signal> | ||
1154 | <receiver>NetworkGUI</receiver> | ||
1155 | <slot>SLOT_Down()</slot> | ||
1156 | </connection> | ||
1157 | <connection> | ||
1158 | <sender>PreUp_LB</sender> | ||
1159 | <signal>doubleClicked(QListBoxItem*)</signal> | ||
1160 | <receiver>NetworkGUI</receiver> | ||
1161 | <slot>SLOT_ShowCommand( QListBoxItem *)</slot> | ||
1162 | </connection> | ||
1163 | <connection> | ||
1164 | <sender>PreDown_LB</sender> | ||
1165 | <signal>doubleClicked(QListBoxItem*)</signal> | ||
1166 | <receiver>NetworkGUI</receiver> | ||
1167 | <slot>SLOT_ShowCommand( QListBoxItem *)</slot> | ||
1168 | </connection> | ||
1169 | <connection> | ||
1170 | <sender>PostDown_LB</sender> | ||
1171 | <signal>doubleClicked(QListBoxItem*)</signal> | ||
1172 | <receiver>NetworkGUI</receiver> | ||
1173 | <slot>SLOT_ShowCommand( QListBoxItem *)</slot> | ||
1174 | </connection> | ||
1175 | <connection> | ||
1176 | <sender>PostUp_LB</sender> | ||
1177 | <signal>doubleClicked(QListBoxItem*)</signal> | ||
1178 | <receiver>NetworkGUI</receiver> | ||
1179 | <slot>SLOT_ShowCommand( QListBoxItem *)</slot> | ||
1180 | </connection> | ||
1181 | <slot access="public">SLOT_Add()</slot> | ||
1182 | <slot access="public">SLOT_Down()</slot> | ||
1061 | <slot access="public">SLOT_NetmaskModified( const QString & )</slot> | 1183 | <slot access="public">SLOT_NetmaskModified( const QString & )</slot> |
1184 | <slot access="public">SLOT_Remove()</slot> | ||
1185 | <slot access="public">SLOT_Up()</slot> | ||
1186 | <slot access="public">SLOT_ShowCommand( QListBoxItem *)</slot> | ||
1062 | </connections> | 1187 | </connections> |
1063 | <tabstops> | 1188 | <tabstops> |
1064 | <tabstop>DHCP_CB</tabstop> | 1189 | <tabstop>DHCP_CB</tabstop> |
1065 | <tabstop>IPAddress_LE</tabstop> | 1190 | <tabstop>IPAddress_LE</tabstop> |
1066 | <tabstop>SubnetMask_LE</tabstop> | 1191 | <tabstop>SubnetMask_LE</tabstop> |
1067 | <tabstop>Gateway_LE</tabstop> | 1192 | <tabstop>Gateway_LE</tabstop> |
1068 | <tabstop>DNS1_LE</tabstop> | 1193 | <tabstop>DNS1_LE</tabstop> |
1069 | <tabstop>DNS2_LE</tabstop> | 1194 | <tabstop>DNS2_LE</tabstop> |
1070 | </tabstops> | 1195 | </tabstops> |
1071 | </UI> | 1196 | </UI> |
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp index d27d54a..b5989df 100644 --- a/noncore/settings/networksettings2/network/network_NN.cpp +++ b/noncore/settings/networksettings2/network/network_NN.cpp | |||
@@ -1,62 +1,62 @@ | |||
1 | #include "network_NN.h" | 1 | #include "network_NN.h" |
2 | #include "network_NNI.h" | 2 | #include "network_NNI.h" |
3 | 3 | ||
4 | static const char * NetworkNeeds[] = | 4 | static const char * NetworkNeeds[] = |
5 | { "device", | 5 | { "device", |
6 | 0 | 6 | 0 |
7 | }; | 7 | }; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor, find all of the possible interfaces | 10 | * Constructor, find all of the possible interfaces |
11 | */ | 11 | */ |
12 | NetworkNetNode::NetworkNetNode() : ANetNode() { | 12 | NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { |
13 | } | 13 | } |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Delete any interfaces that we own. | 16 | * Delete any interfaces that we own. |
17 | */ | 17 | */ |
18 | NetworkNetNode::~NetworkNetNode(){ | 18 | NetworkNetNode::~NetworkNetNode(){ |
19 | } | 19 | } |
20 | 20 | ||
21 | const QString NetworkNetNode::nodeDescription(){ | 21 | const QString NetworkNetNode::nodeDescription(){ |
22 | return tr("\ | 22 | return tr("\ |
23 | <p>Sets up TCP/IP options.</p>\ | 23 | <p>Sets up TCP/IP options.</p>\ |
24 | <p>Use this to configure the TCP/IP protocol</p>\ | 24 | <p>Use this to configure the TCP/IP protocol</p>\ |
25 | " | 25 | " |
26 | ); | 26 | ); |
27 | } | 27 | } |
28 | 28 | ||
29 | ANetNodeInstance * NetworkNetNode::createInstance( void ) { | 29 | ANetNodeInstance * NetworkNetNode::createInstance( void ) { |
30 | return new ANetwork( this ); | 30 | return new ANetwork( this ); |
31 | } | 31 | } |
32 | 32 | ||
33 | const char ** NetworkNetNode::needs( void ) { | 33 | const char ** NetworkNetNode::needs( void ) { |
34 | return NetworkNeeds; | 34 | return NetworkNeeds; |
35 | } | 35 | } |
36 | 36 | ||
37 | const char * NetworkNetNode::provides( void ) { | 37 | const char * NetworkNetNode::provides( void ) { |
38 | return "connection"; | 38 | return "connection"; |
39 | } | 39 | } |
40 | 40 | ||
41 | bool NetworkNetNode::generateProperFilesFor( | 41 | bool NetworkNetNode::generateProperFilesFor( |
42 | ANetNodeInstance * ) { | 42 | ANetNodeInstance * ) { |
43 | return 1; | 43 | return 1; |
44 | } | 44 | } |
45 | 45 | ||
46 | bool NetworkNetNode::generateDeviceDataForCommonFile( | 46 | bool NetworkNetNode::generateDeviceDataForCommonFile( |
47 | SystemFile & , | 47 | SystemFile & , |
48 | long ) { | 48 | long ) { |
49 | return 1; | 49 | return 1; |
50 | } | 50 | } |
51 | 51 | ||
52 | void NetworkNetNode::setSpecificAttribute( QString & , QString & ) { | 52 | void NetworkNetNode::setSpecificAttribute( QString & , QString & ) { |
53 | } | 53 | } |
54 | 54 | ||
55 | void NetworkNetNode::saveSpecificAttribute( QTextStream & ) { | 55 | void NetworkNetNode::saveSpecificAttribute( QTextStream & ) { |
56 | } | 56 | } |
57 | 57 | ||
58 | extern "C" { | 58 | extern "C" { |
59 | void create_plugin( QList<ANetNode> & PNN ) { | 59 | void create_plugin( QList<ANetNode> & PNN ) { |
60 | PNN.append( new NetworkNetNode() ); | 60 | PNN.append( new NetworkNetNode() ); |
61 | } | 61 | } |
62 | } | 62 | } |
diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h index 0f87e1b..6548c32 100644 --- a/noncore/settings/networksettings2/network/network_NN.h +++ b/noncore/settings/networksettings2/network/network_NN.h | |||
@@ -1,47 +1,44 @@ | |||
1 | #ifndef NETWORK_NETNODE_H | 1 | #ifndef NETWORK_NETNODE_H |
2 | #define NETWORK_NETNODE_H | 2 | #define NETWORK_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class ANetwork; | 6 | class ANetwork; |
7 | 7 | ||
8 | class NetworkNetNode : public ANetNode{ | 8 | class NetworkNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | NetworkNetNode(); | 14 | NetworkNetNode(); |
15 | virtual ~NetworkNetNode(); | 15 | virtual ~NetworkNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/tcpip"; } | 18 | { return "Devices/tcpip"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("IP Configuration"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & ) | 28 | virtual bool hasDataFor( const QString & ) |
32 | { return 0; } | 29 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 30 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr ); | 31 | SystemFile & SF, long DevNr ); |
35 | 32 | ||
36 | private: | 33 | private: |
37 | 34 | ||
38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
39 | virtual void saveSpecificAttribute( QTextStream & TS ); | 36 | virtual void saveSpecificAttribute( QTextStream & TS ); |
40 | }; | 37 | }; |
41 | 38 | ||
42 | extern "C" | 39 | extern "C" |
43 | { | 40 | { |
44 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
45 | }; | 42 | }; |
46 | 43 | ||
47 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/network/networkedit.cpp b/noncore/settings/networksettings2/network/networkedit.cpp index 182213b..05110d9 100644 --- a/noncore/settings/networksettings2/network/networkedit.cpp +++ b/noncore/settings/networksettings2/network/networkedit.cpp | |||
@@ -1,160 +1,224 @@ | |||
1 | #include <qtoolbutton.h> | 1 | #include <qtoolbutton.h> |
2 | #include <qcheckbox.h> | 2 | #include <qcheckbox.h> |
3 | #include <qtabwidget.h> | ||
3 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
4 | #include <qlistbox.h> | 5 | #include <qlistbox.h> |
5 | #include <GUIUtils.h> | 6 | #include <GUIUtils.h> |
6 | #include <resources.h> | 7 | #include <resources.h> |
7 | #include "networkedit.h" | 8 | #include "networkedit.h" |
8 | 9 | ||
9 | NetworkEdit::NetworkEdit( QWidget * Parent ) : NetworkGUI( Parent ){ | 10 | NetworkEdit::NetworkEdit( QWidget * Parent ) : NetworkGUI( Parent ){ |
10 | 11 | ||
11 | AddPreDown_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 12 | AddPreDown_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
12 | AddPreUp_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 13 | AddPreUp_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
13 | AddPostDown_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 14 | AddPostDown_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
14 | AddPostUp_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 15 | AddPostUp_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
15 | 16 | ||
16 | DeletePreDown_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 17 | DeletePreDown_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
17 | DeletePreUp_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 18 | DeletePreUp_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
18 | DeletePostDown_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 19 | DeletePostDown_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
19 | DeletePostUp_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 20 | DeletePostUp_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
20 | 21 | ||
21 | UpPreDown_TB->setPixmap( NSResources->getPixmap( "up" ) ); | 22 | UpPreDown_TB->setPixmap( NSResources->getPixmap( "up" ) ); |
22 | UpPreUp_TB->setPixmap( NSResources->getPixmap( "up" ) ); | 23 | UpPreUp_TB->setPixmap( NSResources->getPixmap( "up" ) ); |
23 | UpPostDown_TB->setPixmap( NSResources->getPixmap( "up" ) ); | 24 | UpPostDown_TB->setPixmap( NSResources->getPixmap( "up" ) ); |
24 | UpPostUp_TB->setPixmap( NSResources->getPixmap( "up" ) ); | 25 | UpPostUp_TB->setPixmap( NSResources->getPixmap( "up" ) ); |
25 | 26 | ||
26 | DownPreDown_TB->setPixmap( NSResources->getPixmap( "down" ) ); | 27 | DownPreDown_TB->setPixmap( NSResources->getPixmap( "down" ) ); |
27 | DownPreUp_TB->setPixmap( NSResources->getPixmap( "down" ) ); | 28 | DownPreUp_TB->setPixmap( NSResources->getPixmap( "down" ) ); |
28 | DownPostDown_TB->setPixmap( NSResources->getPixmap( "down" ) ); | 29 | DownPostDown_TB->setPixmap( NSResources->getPixmap( "down" ) ); |
29 | DownPostUp_TB->setPixmap( NSResources->getPixmap( "down" ) ); | 30 | DownPostUp_TB->setPixmap( NSResources->getPixmap( "down" ) ); |
30 | 31 | ||
31 | } | 32 | } |
32 | 33 | ||
33 | QString NetworkEdit::acceptable( void ) { | 34 | QString NetworkEdit::acceptable( void ) { |
34 | if( DHCP_CB->isChecked() ) { | 35 | if( DHCP_CB->isChecked() ) { |
35 | if( SendHostname_CB->isChecked() ) | 36 | if( SendHostname_CB->isChecked() ) |
36 | if( Hostname_LE->text().isEmpty() ) | 37 | if( Hostname_LE->text().isEmpty() ) |
37 | return tr("Hostname needed"); | 38 | return tr("Hostname needed"); |
38 | return QString(); | 39 | return QString(); |
39 | } | 40 | } |
40 | 41 | ||
41 | if( IPAddress_LE->text().isEmpty() ) | 42 | if( IPAddress_LE->text().isEmpty() ) |
42 | return tr("IPAddress needed"); | 43 | return tr("IPAddress needed"); |
43 | if( Broadcast_LE->text().isEmpty() ) | 44 | if( Broadcast_LE->text().isEmpty() ) |
44 | return tr("Broadcast needed"); | 45 | return tr("Broadcast needed"); |
45 | if( SubnetMask_LE->text().isEmpty() ) | 46 | if( SubnetMask_LE->text().isEmpty() ) |
46 | return tr("Subnet mask needed"); | 47 | return tr("Subnet mask needed"); |
47 | 48 | ||
48 | // valid IP ? | 49 | // valid IP ? |
49 | if( ! validIP( IPAddress_LE->text() ) ) | 50 | if( ! validIP( IPAddress_LE->text() ) ) |
50 | return tr("IPAddress not valid"); | 51 | return tr("IPAddress not valid"); |
51 | if( ! validIP( SubnetMask_LE->text() ) ) | 52 | if( ! validIP( SubnetMask_LE->text() ) ) |
52 | return tr("Subnet mask not valid"); | 53 | return tr("Subnet mask not valid"); |
53 | if( ! validIP( Broadcast_LE->text() ) ) | 54 | if( ! validIP( Broadcast_LE->text() ) ) |
54 | return tr("Broadcast address not valid"); | 55 | return tr("Broadcast address not valid"); |
55 | if( Gateway_LE->text().isEmpty() || | 56 | if( Gateway_LE->text().isEmpty() || |
56 | ! validIP( Gateway_LE->text() ) ) | 57 | ! validIP( Gateway_LE->text() ) ) |
57 | return tr("Gateway address not valid"); | 58 | return tr("Gateway address not valid"); |
58 | if( ! DNS1_LE->text().isEmpty() && | 59 | if( ! DNS1_LE->text().isEmpty() && |
59 | ! validIP( DNS1_LE->text() ) ) | 60 | ! validIP( DNS1_LE->text() ) ) |
60 | return tr("DNS1 address not valid"); | 61 | return tr("DNS1 address not valid"); |
61 | if( ! DNS2_LE->text().isEmpty() && | 62 | if( ! DNS2_LE->text().isEmpty() && |
62 | ! validIP( DNS2_LE->text() ) ) | 63 | ! validIP( DNS2_LE->text() ) ) |
63 | return tr("DNS2 address not valid"); | 64 | return tr("DNS2 address not valid"); |
64 | return QString(); | 65 | return QString(); |
65 | } | 66 | } |
66 | 67 | ||
67 | bool NetworkEdit::commit( NetworkData_t & Data ) { | 68 | bool NetworkEdit::commit( NetworkData_t & Data ) { |
68 | bool SM = 0; | 69 | bool SM = 0; |
69 | CBM( Data.UseDHCP, DHCP_CB, SM ); | 70 | CBM( Data.UseDHCP, DHCP_CB, SM ); |
70 | TXTM( Data.IPAddress, IPAddress_LE, SM ); | 71 | TXTM( Data.IPAddress, IPAddress_LE, SM ); |
71 | CBM( Data.SendHostname, SendHostname_CB, SM ); | 72 | CBM( Data.SendHostname, SendHostname_CB, SM ); |
72 | TXTM( Data.Hostname, Hostname_LE, SM ); | 73 | TXTM( Data.Hostname, Hostname_LE, SM ); |
73 | TXTM( Data.Gateway, Gateway_LE, SM ); | 74 | TXTM( Data.Gateway, Gateway_LE, SM ); |
74 | TXTM( Data.Broadcast, Broadcast_LE, SM ); | 75 | TXTM( Data.Broadcast, Broadcast_LE, SM ); |
75 | TXTM( Data.NetMask, SubnetMask_LE, SM ); | 76 | TXTM( Data.NetMask, SubnetMask_LE, SM ); |
76 | TXTM( Data.DNS1, DNS1_LE, SM ); | 77 | TXTM( Data.DNS1, DNS1_LE, SM ); |
77 | TXTM( Data.DNS2, DNS2_LE, SM ); | 78 | TXTM( Data.DNS2, DNS2_LE, SM ); |
78 | 79 | ||
79 | SM |= updateList( Data.PreUp_SL, PreUp_LB ); | 80 | SM |= updateList( Data.PreUp_SL, PreUp_LB ); |
80 | SM |= updateList( Data.PostUp_SL, PostUp_LB ); | 81 | SM |= updateList( Data.PostUp_SL, PostUp_LB ); |
81 | SM |= updateList( Data.PreDown_SL, PreDown_LB ); | 82 | SM |= updateList( Data.PreDown_SL, PreDown_LB ); |
82 | SM |= updateList( Data.PostDown_SL, PostDown_LB ); | 83 | SM |= updateList( Data.PostDown_SL, PostDown_LB ); |
83 | 84 | ||
84 | return SM; | 85 | return SM; |
85 | } | 86 | } |
86 | 87 | ||
87 | void NetworkEdit::showData( NetworkData_t & Data ) { | 88 | void NetworkEdit::showData( NetworkData_t & Data ) { |
88 | DHCP_CB->setChecked( Data.UseDHCP ); | 89 | DHCP_CB->setChecked( Data.UseDHCP ); |
89 | SendHostname_CB->setChecked( Data.SendHostname ); | 90 | SendHostname_CB->setChecked( Data.SendHostname ); |
90 | Hostname_LE->setText( Data.Hostname ); | 91 | Hostname_LE->setText( Data.Hostname ); |
91 | IPAddress_LE->setText( Data.IPAddress ); | 92 | IPAddress_LE->setText( Data.IPAddress ); |
92 | Gateway_LE->setText( Data.Gateway ); | 93 | Gateway_LE->setText( Data.Gateway ); |
93 | SubnetMask_LE->setText( Data.NetMask ); | 94 | SubnetMask_LE->setText( Data.NetMask ); |
94 | Broadcast_LE->setText( Data.Broadcast ); | 95 | Broadcast_LE->setText( Data.Broadcast ); |
95 | DNS1_LE->setText( Data.DNS1 ); | 96 | DNS1_LE->setText( Data.DNS1 ); |
96 | DNS2_LE->setText( Data.DNS2 ); | 97 | DNS2_LE->setText( Data.DNS2 ); |
97 | 98 | ||
98 | populateList( Data.PreUp_SL, PreUp_LB ); | 99 | populateList( Data.PreUp_SL, PreUp_LB ); |
99 | populateList( Data.PostUp_SL, PostUp_LB ); | 100 | populateList( Data.PostUp_SL, PostUp_LB ); |
100 | populateList( Data.PreDown_SL, PreDown_LB ); | 101 | populateList( Data.PreDown_SL, PreDown_LB ); |
101 | populateList( Data.PostDown_SL, PostDown_LB ); | 102 | populateList( Data.PostDown_SL, PostDown_LB ); |
102 | } | 103 | } |
103 | 104 | ||
104 | bool NetworkEdit::updateList( QStringList & SL, QListBox * LB ) { | 105 | bool NetworkEdit::updateList( QStringList & SL, QListBox * LB ) { |
105 | bool Changed; | 106 | bool Changed; |
106 | QStringList NewSL; | 107 | QStringList NewSL; |
107 | 108 | ||
108 | // collect new list | 109 | // collect new list |
109 | for( unsigned int i = 0; i < LB->count() ; i ++ ) { | 110 | for( unsigned int i = 0; i < LB->count() ; i ++ ) { |
110 | NewSL.append( LB->text(i) ); | 111 | NewSL.append( LB->text(i) ); |
111 | } | 112 | } |
112 | 113 | ||
113 | // check if at least ONE item in new list is NEW | 114 | if( NewSL.count() != SL.count() ) { |
115 | // less or more items | ||
116 | SL= NewSL; | ||
117 | return 1; | ||
118 | } | ||
119 | |||
120 | // Same size -> same content ? | ||
114 | Changed = 0; | 121 | Changed = 0; |
115 | for ( QStringList::Iterator it = NewSL.begin(); | 122 | for ( QStringList::Iterator it = NewSL.begin(); |
116 | it != NewSL.end(); | 123 | it != NewSL.end(); |
117 | ++it ) { | 124 | ++it ) { |
118 | if( SL.findIndex( (*it) ) < 0 ) { | 125 | if( SL.findIndex( (*it) ) < 0 ) { |
119 | // new or modified item | 126 | // new or modified item |
120 | Changed = 1; | 127 | Changed = 1; |
121 | SL = NewSL; | 128 | SL = NewSL; |
122 | break; | 129 | break; |
123 | } | 130 | } |
124 | } | 131 | } |
125 | return Changed; | 132 | return Changed; |
126 | } | 133 | } |
127 | 134 | ||
128 | void NetworkEdit::populateList( QStringList & SL, QListBox * LB ) { | 135 | void NetworkEdit::populateList( QStringList & SL, QListBox * LB ) { |
129 | LB->clear(); | 136 | LB->clear(); |
130 | for ( QStringList::Iterator it = SL.begin(); | 137 | for ( QStringList::Iterator it = SL.begin(); |
131 | it != SL.end(); | 138 | it != SL.end(); |
132 | ++it ) { | 139 | ++it ) { |
133 | LB->insertItem( (*it) ); | 140 | LB->insertItem( (*it) ); |
134 | } | 141 | } |
135 | } | 142 | } |
136 | 143 | ||
137 | void NetworkEdit::SLOT_NetmaskModified( const QString & ) { | 144 | void NetworkEdit::SLOT_NetmaskModified( const QString & ) { |
138 | QString IP, SN; | 145 | QString IP, SN; |
139 | IP = IPAddress_LE->text(); | 146 | IP = IPAddress_LE->text(); |
140 | SN = SubnetMask_LE->text(); | 147 | SN = SubnetMask_LE->text(); |
141 | if( IP.isEmpty() || SN.isEmpty() ) | 148 | if( IP.isEmpty() || SN.isEmpty() ) |
142 | return; | 149 | return; |
143 | 150 | ||
144 | if( ! validIP(IP) || ! validIP( SN ) ) | 151 | if( ! validIP(IP) || ! validIP( SN ) ) |
145 | return; | 152 | return; |
146 | 153 | ||
147 | // if all ones | 154 | // if all ones |
148 | // broadcast = (IPAddress | ~netmask ) | 155 | // broadcast = (IPAddress | ~netmask ) |
149 | { QString NW; | 156 | { QString NW; |
150 | QStringList ipal = QStringList::split( '.', IP ); | 157 | QStringList ipal = QStringList::split( '.', IP ); |
151 | QStringList nmal = QStringList::split( '.', SN ); | 158 | QStringList nmal = QStringList::split( '.', SN ); |
152 | 159 | ||
153 | NW = QString( "%1.%2.%3.%4" ). | 160 | NW = QString( "%1.%2.%3.%4" ). |
154 | arg( ipal[0].toShort() | ( ~ nmal[0].toShort() & 0x00ff) ). | 161 | arg( ipal[0].toShort() | ( ~ nmal[0].toShort() & 0x00ff) ). |
155 | arg( ipal[1].toShort() | ( ~ nmal[1].toShort() & 0x00ff) ). | 162 | arg( ipal[1].toShort() | ( ~ nmal[1].toShort() & 0x00ff) ). |
156 | arg( ipal[2].toShort() | ( ~ nmal[2].toShort() & 0x00ff) ). | 163 | arg( ipal[2].toShort() | ( ~ nmal[2].toShort() & 0x00ff) ). |
157 | arg( ipal[3].toShort() | ( ~ nmal[3].toShort() & 0x00ff) ); | 164 | arg( ipal[3].toShort() | ( ~ nmal[3].toShort() & 0x00ff) ); |
158 | Broadcast_LE->setText( NW ); | 165 | Broadcast_LE->setText( NW ); |
159 | } | 166 | } |
160 | } | 167 | } |
168 | |||
169 | QListBox * NetworkEdit::getActiveLB( void ) { | ||
170 | switch( Tab_TAB->currentPageIndex() ) { | ||
171 | case 0 : | ||
172 | return PreUp_LB; | ||
173 | case 1 : | ||
174 | return PostUp_LB; | ||
175 | case 2 : | ||
176 | return PreDown_LB; | ||
177 | } | ||
178 | return PostDown_LB; | ||
179 | } | ||
180 | |||
181 | void NetworkEdit::SLOT_Add( void ) { | ||
182 | if( Command_LE->text().isEmpty() ) | ||
183 | return; | ||
184 | QListBox * LB = getActiveLB(); | ||
185 | |||
186 | LB->insertItem( Command_LE->text() ); | ||
187 | } | ||
188 | |||
189 | void NetworkEdit::SLOT_Remove( void ) { | ||
190 | QListBox * LB = getActiveLB(); | ||
191 | int i; | ||
192 | |||
193 | if( ( i = LB->currentItem() ) >= 0 ) { | ||
194 | LB->removeItem( i ); | ||
195 | } | ||
196 | } | ||
197 | |||
198 | void NetworkEdit::SLOT_Up( void ) { | ||
199 | QListBox * LB = getActiveLB(); | ||
200 | int i; | ||
201 | |||
202 | if( ( i = LB->currentItem() ) > 0 ) { | ||
203 | QListBoxItem * LBI = LB->item(i); | ||
204 | LB->takeItem( LBI ); | ||
205 | LB->insertItem( LBI, --i ); | ||
206 | LB->setCurrentItem( i ); | ||
207 | } | ||
208 | } | ||
209 | |||
210 | void NetworkEdit::SLOT_Down( void ) { | ||
211 | QListBox * LB = getActiveLB(); | ||
212 | int i; | ||
213 | |||
214 | if( ( i = LB->currentItem() ) >= 0 && (unsigned)(i+1) != LB->count() ) { | ||
215 | QListBoxItem * LBI = LB->item(i); | ||
216 | LB->takeItem( LBI ); | ||
217 | LB->insertItem( LBI, ++i ); | ||
218 | LB->setCurrentItem( i ); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | void NetworkEdit::SLOT_ShowCommand( QListBoxItem * It ) { | ||
223 | Command_LE->setText( It->text() ); | ||
224 | } | ||
diff --git a/noncore/settings/networksettings2/network/networkedit.h b/noncore/settings/networksettings2/network/networkedit.h index 9ed4e84..adc20e0 100644 --- a/noncore/settings/networksettings2/network/networkedit.h +++ b/noncore/settings/networksettings2/network/networkedit.h | |||
@@ -1,21 +1,29 @@ | |||
1 | #include "networkdata.h" | 1 | #include "networkdata.h" |
2 | #include "networkGUI.h" | 2 | #include "networkGUI.h" |
3 | 3 | ||
4 | class QListBox; | ||
5 | |||
4 | class NetworkEdit : public NetworkGUI { | 6 | class NetworkEdit : public NetworkGUI { |
5 | 7 | ||
6 | public : | 8 | public : |
7 | 9 | ||
8 | NetworkEdit( QWidget * parent ); | 10 | NetworkEdit( QWidget * parent ); |
9 | QString acceptable( void ); | 11 | QString acceptable( void ); |
10 | bool commit( NetworkData_t & Data ); | 12 | bool commit( NetworkData_t & Data ); |
11 | void showData( NetworkData_t & Data ); | 13 | void showData( NetworkData_t & Data ); |
12 | 14 | ||
13 | public slots : | 15 | public slots : |
14 | 16 | ||
15 | void SLOT_NetmaskModified( const QString & S ); | 17 | void SLOT_NetmaskModified( const QString & S ); |
18 | void SLOT_ShowCommand( QListBoxItem * LBI ); | ||
19 | void SLOT_Add( void ); | ||
20 | void SLOT_Remove( void ); | ||
21 | void SLOT_Up( void ); | ||
22 | void SLOT_Down( void ); | ||
16 | 23 | ||
17 | private : | 24 | private : |
18 | 25 | ||
26 | QListBox * getActiveLB( void ); | ||
19 | bool updateList( QStringList &SL, QListBox * LB ); | 27 | bool updateList( QStringList &SL, QListBox * LB ); |
20 | void populateList( QStringList &SL, QListBox * LB ); | 28 | void populateList( QStringList &SL, QListBox * LB ); |
21 | }; | 29 | }; |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp index 3691e5a..417fba8 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.cpp +++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp | |||
@@ -1,299 +1,299 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <time.h> | 2 | #include <time.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <qpixmap.h> | 4 | #include <qpixmap.h> |
5 | 5 | ||
6 | #include "resources.h" | 6 | #include "resources.h" |
7 | #include "netnode.h" | 7 | #include "netnode.h" |
8 | 8 | ||
9 | #include "asdevice.h" | 9 | #include "asdevice.h" |
10 | #include "asline.h" | 10 | #include "asline.h" |
11 | #include "asconnection.h" | 11 | #include "asconnection.h" |
12 | #include "asfullsetup.h" | 12 | #include "asfullsetup.h" |
13 | 13 | ||
14 | QString & deQuote( QString & X ) { | 14 | QString & deQuote( QString & X ) { |
15 | if( X[0] == '"' ) { | 15 | if( X[0] == '"' ) { |
16 | // remove end and trailing "" and \x -> x | 16 | // remove end and trailing "" and \x -> x |
17 | QChar R; | 17 | QChar R; |
18 | long idx; | 18 | long idx; |
19 | idx = X.length()-1; | 19 | idx = X.length()-1; |
20 | X = X.mid( 1, idx ); | 20 | X = X.mid( 1, idx ); |
21 | 21 | ||
22 | idx = 0; | 22 | idx = 0; |
23 | while( ( idx = X.find( '\\', idx ) ) >= 0 ) { | 23 | while( ( idx = X.find( '\\', idx ) ) >= 0 ) { |
24 | R = X[idx+1]; | 24 | R = X[idx+1]; |
25 | X.replace( idx, 2, &R, 1 ); | 25 | X.replace( idx, 2, &R, 1 ); |
26 | } | 26 | } |
27 | X = X.left( X.length()-1 ); | 27 | X = X.left( X.length()-1 ); |
28 | } | 28 | } |
29 | return X; | 29 | return X; |
30 | } | 30 | } |
31 | 31 | ||
32 | QString quote( QString X ) { | 32 | QString quote( QString X ) { |
33 | if( X.find( QRegExp( "[ \n\"\\\t]" ) ) >= 0 ) { | 33 | if( X.find( QRegExp( "[ \n\"\\\t]" ) ) >= 0 ) { |
34 | // need to quote this | 34 | // need to quote this |
35 | QString OutString = "\""; | 35 | QString OutString = "\""; |
36 | 36 | ||
37 | X.replace( QRegExp("\""), "\\\"" ); | 37 | X.replace( QRegExp("\""), "\\\"" ); |
38 | X.replace( QRegExp("\\"), "\\\\" ); | 38 | X.replace( QRegExp("\\"), "\\\\" ); |
39 | X.replace( QRegExp(" "), "\\ " ); | 39 | X.replace( QRegExp(" "), "\\ " ); |
40 | 40 | ||
41 | OutString += X; | 41 | OutString += X; |
42 | OutString += "\""; | 42 | OutString += "\""; |
43 | X = OutString; | 43 | X = OutString; |
44 | } | 44 | } |
45 | return X; | 45 | return X; |
46 | } | 46 | } |
47 | 47 | ||
48 | 48 | ||
49 | // | 49 | // |
50 | // | 50 | // |
51 | // ANETNODE | 51 | // ANETNODE |
52 | // | 52 | // |
53 | // | 53 | // |
54 | 54 | ||
55 | void ANetNode::saveAttributes( QTextStream & TS ) { | 55 | void ANetNode::saveAttributes( QTextStream & TS ) { |
56 | saveSpecificAttribute( TS ); | 56 | saveSpecificAttribute( TS ); |
57 | } | 57 | } |
58 | 58 | ||
59 | void ANetNode::setAttribute( QString & Attr, QString & Value ){ | 59 | void ANetNode::setAttribute( QString & Attr, QString & Value ){ |
60 | setSpecificAttribute( Attr, Value ); | 60 | setSpecificAttribute( Attr, Value ); |
61 | } | 61 | } |
62 | 62 | ||
63 | // | 63 | // |
64 | // | 64 | // |
65 | // ANETNODEINSTANCE | 65 | // ANETNODEINSTANCE |
66 | // | 66 | // |
67 | // | 67 | // |
68 | 68 | ||
69 | long ANetNodeInstance::InstanceCounter = -1; | 69 | long ANetNodeInstance::InstanceCounter = -1; |
70 | 70 | ||
71 | void ANetNodeInstance::initialize( void ) { | 71 | void ANetNodeInstance::initialize( void ) { |
72 | if( InstanceCounter == -1 ) | 72 | if( InstanceCounter == -1 ) |
73 | InstanceCounter = time(0); | 73 | InstanceCounter = time(0); |
74 | // set name | 74 | // set name |
75 | QString N; | 75 | QString N; |
76 | N.sprintf( "-%ld", InstanceCounter++ ); | 76 | N.sprintf( "-%ld", InstanceCounter++ ); |
77 | N.prepend( NodeType->nodeName() ); | 77 | N.prepend( NodeType->name() ); |
78 | setNodeName( N ); | 78 | setName( N.latin1() ); |
79 | } | 79 | } |
80 | 80 | ||
81 | void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){ | 81 | void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){ |
82 | if( Attr == "name" ) { | 82 | if( Attr == "name" ) { |
83 | NodeName = Value; | 83 | setName( Value.latin1() ); |
84 | } else { | 84 | } else { |
85 | setSpecificAttribute( Attr, Value ); | 85 | setSpecificAttribute( Attr, Value ); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { | 89 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { |
90 | TS << "name=" << quote( NodeName ) << endl; | 90 | TS << "name=" << name() << endl; |
91 | saveSpecificAttribute( TS ); | 91 | saveSpecificAttribute( TS ); |
92 | } | 92 | } |
93 | 93 | ||
94 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { | 94 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { |
95 | return connection()->findNext( this ); | 95 | return connection()->findNext( this ); |
96 | } | 96 | } |
97 | 97 | ||
98 | // | 98 | // |
99 | // | 99 | // |
100 | // NODECOLLECTION | 100 | // NODECOLLECTION |
101 | // | 101 | // |
102 | // | 102 | // |
103 | 103 | ||
104 | long NodeCollection::MaxNr = -1; | 104 | long NodeCollection::MaxNr = -1; |
105 | 105 | ||
106 | NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { | 106 | NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { |
107 | IsModified = 0; | 107 | IsModified = 0; |
108 | Index = -1; | 108 | Index = -1; |
109 | Name=""; | 109 | Name=""; |
110 | IsNew = 1; | 110 | IsNew = 1; |
111 | CurrentState = Unchecked; | 111 | CurrentState = Unchecked; |
112 | } | 112 | } |
113 | 113 | ||
114 | NodeCollection::NodeCollection( QTextStream & TS ) : | 114 | NodeCollection::NodeCollection( QTextStream & TS ) : |
115 | QList<ANetNodeInstance>() { | 115 | QList<ANetNodeInstance>() { |
116 | long idx; | 116 | long idx; |
117 | bool InError = 0; | 117 | bool InError = 0; |
118 | QString S, A, N; | 118 | QString S, A, N; |
119 | IsModified = 0; | 119 | IsModified = 0; |
120 | Index = -1; | 120 | Index = -1; |
121 | Name=""; | 121 | Name=""; |
122 | IsNew = 0; | 122 | IsNew = 0; |
123 | CurrentState = Unchecked; | 123 | CurrentState = Unchecked; |
124 | 124 | ||
125 | do { | 125 | do { |
126 | S = TS.readLine(); | 126 | S = TS.readLine(); |
127 | if( S.isEmpty() ) { | 127 | if( S.isEmpty() ) { |
128 | if( InError ) { | 128 | if( InError ) { |
129 | // remove all nodes | 129 | // remove all nodes |
130 | clear(); | 130 | clear(); |
131 | } | 131 | } |
132 | // empty line | 132 | // empty line |
133 | break; | 133 | break; |
134 | } | 134 | } |
135 | 135 | ||
136 | idx = S.find('='); | 136 | idx = S.find('='); |
137 | S.stripWhiteSpace(); | 137 | S.stripWhiteSpace(); |
138 | A = S.left( idx ); | 138 | A = S.left( idx ); |
139 | A.lower(); | 139 | A.lower(); |
140 | N = S.mid( idx+1, S.length() ); | 140 | N = S.mid( idx+1, S.length() ); |
141 | N.stripWhiteSpace(); | 141 | N.stripWhiteSpace(); |
142 | N = deQuote( N ); | 142 | N = deQuote( N ); |
143 | 143 | ||
144 | if( A == "name" ) { | 144 | if( A == "name" ) { |
145 | Name = N; | 145 | Name = N; |
146 | } else if( A == "number" ) { | 146 | } else if( A == "number" ) { |
147 | setNumber( N.toLong() ); | 147 | setNumber( N.toLong() ); |
148 | } else if( A == "node" ) { | 148 | } else if( A == "node" ) { |
149 | ANetNodeInstance * NNI = NSResources->findNodeInstance( N ); | 149 | ANetNodeInstance * NNI = NSResources->findNodeInstance( N ); |
150 | if( NNI && ! InError ) { | 150 | if( NNI && ! InError ) { |
151 | append( NSResources->findNodeInstance( N ) ); | 151 | append( NSResources->findNodeInstance( N ) ); |
152 | } else { | 152 | } else { |
153 | // could not find a node type -> collection invalid | 153 | // could not find a node type -> collection invalid |
154 | InError = 1; | 154 | InError = 1; |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } while( 1 ); | 157 | } while( 1 ); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | NodeCollection::~NodeCollection( void ) { | 161 | NodeCollection::~NodeCollection( void ) { |
162 | } | 162 | } |
163 | 163 | ||
164 | const QString & NodeCollection::description( void ) { | 164 | const QString & NodeCollection::description( void ) { |
165 | ANetNodeInstance * NNI = getToplevel(); | 165 | ANetNodeInstance * NNI = getToplevel(); |
166 | return (NNI) ? NNI->runtime()->asFullSetup()->description() : Name; | 166 | return (NNI) ? NNI->runtime()->asFullSetup()->description() : Name; |
167 | } | 167 | } |
168 | 168 | ||
169 | void NodeCollection::append( ANetNodeInstance * NNI ) { | 169 | void NodeCollection::append( ANetNodeInstance * NNI ) { |
170 | NNI->setConnection( this ); | 170 | NNI->setConnection( this ); |
171 | QList<ANetNodeInstance>::append( NNI ); | 171 | QList<ANetNodeInstance>::append( NNI ); |
172 | } | 172 | } |
173 | 173 | ||
174 | void NodeCollection::save( QTextStream & TS ) { | 174 | void NodeCollection::save( QTextStream & TS ) { |
175 | 175 | ||
176 | TS << "name=" << quote( Name ) << endl; | 176 | TS << "name=" << quote( Name ) << endl; |
177 | TS << "number=" << number() << endl; | 177 | TS << "number=" << number() << endl; |
178 | ANetNodeInstance * NNI; | 178 | ANetNodeInstance * NNI; |
179 | for( QListIterator<ANetNodeInstance> it(*this); | 179 | for( QListIterator<ANetNodeInstance> it(*this); |
180 | it.current(); | 180 | it.current(); |
181 | ++it ) { | 181 | ++it ) { |
182 | NNI = it.current(); | 182 | NNI = it.current(); |
183 | TS << "node=" << quote( NNI->nodeName() ) << endl; | 183 | TS << "node=" << NNI->name() << endl; |
184 | } | 184 | } |
185 | TS << endl; | 185 | TS << endl; |
186 | IsNew = 0; | 186 | IsNew = 0; |
187 | } | 187 | } |
188 | 188 | ||
189 | ANetNodeInstance * NodeCollection::getToplevel( void ) { | 189 | ANetNodeInstance * NodeCollection::getToplevel( void ) { |
190 | ANetNodeInstance * NNI = 0; | 190 | ANetNodeInstance * NNI = 0; |
191 | for( QListIterator<ANetNodeInstance> it(*this); | 191 | for( QListIterator<ANetNodeInstance> it(*this); |
192 | it.current(); | 192 | it.current(); |
193 | ++it ) { | 193 | ++it ) { |
194 | NNI = it.current(); | 194 | NNI = it.current(); |
195 | if( NNI->nodeClass()->isToplevel() ) | 195 | if( NNI->nodeClass()->isToplevel() ) |
196 | break; | 196 | break; |
197 | } | 197 | } |
198 | return NNI; | 198 | return NNI; |
199 | } | 199 | } |
200 | 200 | ||
201 | ANetNodeInstance * NodeCollection::findByName( const QString & S ) { | 201 | ANetNodeInstance * NodeCollection::findByName( const QString & S ) { |
202 | ANetNodeInstance * NNI = 0; | 202 | ANetNodeInstance * NNI = 0; |
203 | for( QListIterator<ANetNodeInstance> it(*this); | 203 | for( QListIterator<ANetNodeInstance> it(*this); |
204 | it.current(); | 204 | it.current(); |
205 | ++it ) { | 205 | ++it ) { |
206 | NNI = it.current(); | 206 | NNI = it.current(); |
207 | if( NNI->name() == S ) | 207 | if( NNI->name() == S ) |
208 | break; | 208 | break; |
209 | } | 209 | } |
210 | return NNI; | 210 | return NNI; |
211 | } | 211 | } |
212 | 212 | ||
213 | ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { | 213 | ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { |
214 | ANetNodeInstance * NNNI; | 214 | ANetNodeInstance * NNNI; |
215 | 215 | ||
216 | if( ! NNI ) | 216 | if( ! NNI ) |
217 | getToplevel(); | 217 | getToplevel(); |
218 | 218 | ||
219 | for( QListIterator<ANetNodeInstance> it(*this); | 219 | for( QListIterator<ANetNodeInstance> it(*this); |
220 | it.current(); | 220 | it.current(); |
221 | ++it ) { | 221 | ++it ) { |
222 | NNNI = it.current(); | 222 | NNNI = it.current(); |
223 | if( NNNI == NNI ) { | 223 | if( NNNI == NNI ) { |
224 | ++it; | 224 | ++it; |
225 | return it.current(); | 225 | return it.current(); |
226 | } | 226 | } |
227 | } | 227 | } |
228 | return 0; // no more next | 228 | return 0; // no more next |
229 | } | 229 | } |
230 | 230 | ||
231 | int NodeCollection::compareItems( QCollection::Item I1, | 231 | int NodeCollection::compareItems( QCollection::Item I1, |
232 | QCollection::Item I2 ) { | 232 | QCollection::Item I2 ) { |
233 | ANetNodeInstance * NNI1, * NNI2; | 233 | ANetNodeInstance * NNI1, * NNI2; |
234 | NNI1 = (ANetNodeInstance *)I1; | 234 | NNI1 = (ANetNodeInstance *)I1; |
235 | NNI2 = (ANetNodeInstance *)I2; | 235 | NNI2 = (ANetNodeInstance *)I2; |
236 | return NNI1->nodeName().compare( NNI2->nodeName() ); | 236 | return strcmp( NNI1->name(), NNI2->name() ); |
237 | } | 237 | } |
238 | 238 | ||
239 | static char * State2PixmapTbl[] = { | 239 | static char * State2PixmapTbl[] = { |
240 | "NULL", // Unchecked : no pixmap | 240 | "NULL", // Unchecked : no pixmap |
241 | "check", // Unknown | 241 | "check", // Unknown |
242 | "delete", // unavailable | 242 | "delete", // unavailable |
243 | "disabled", // disabled | 243 | "disabled", // disabled |
244 | "off", // off | 244 | "off", // off |
245 | "disconnected", // available | 245 | "disconnected", // available |
246 | "connected" // up | 246 | "connected" // up |
247 | }; | 247 | }; |
248 | 248 | ||
249 | QPixmap NodeCollection::devicePixmap( void ) { | 249 | QPixmap NodeCollection::devicePixmap( void ) { |
250 | return NSResources->getPixmap( | 250 | return NSResources->getPixmap( |
251 | device()->netNode()->pixmapName()+"-large" ); | 251 | device()->netNode()->pixmapName()+"-large" ); |
252 | } | 252 | } |
253 | 253 | ||
254 | QPixmap NodeCollection::statePixmap( State_t S) { | 254 | QPixmap NodeCollection::statePixmap( State_t S) { |
255 | return NSResources->getPixmap( State2PixmapTbl[S] ); | 255 | return NSResources->getPixmap( State2PixmapTbl[S] ); |
256 | } | 256 | } |
257 | 257 | ||
258 | QString NodeCollection::stateName( State_t S) { | 258 | QString NodeCollection::stateName( State_t S) { |
259 | switch( S ) { | 259 | switch( S ) { |
260 | case Unknown : | 260 | case Unknown : |
261 | return qApp->translate( "networksettings2", "Unknown"); | 261 | return qApp->translate( "networksettings2", "Unknown"); |
262 | case Unavailable : | 262 | case Unavailable : |
263 | return qApp->translate( "networksettings2", "Unavailable"); | 263 | return qApp->translate( "networksettings2", "Unavailable"); |
264 | case Disabled : | 264 | case Disabled : |
265 | return qApp->translate( "networksettings2", "Disabled"); | 265 | return qApp->translate( "networksettings2", "Disabled"); |
266 | case Off : | 266 | case Off : |
267 | return qApp->translate( "networksettings2", "Off"); | 267 | return qApp->translate( "networksettings2", "Off"); |
268 | case Available : | 268 | case Available : |
269 | return qApp->translate( "networksettings2", "Available"); | 269 | return qApp->translate( "networksettings2", "Available"); |
270 | case IsUp : | 270 | case IsUp : |
271 | return qApp->translate( "networksettings2", "IsUp"); | 271 | return qApp->translate( "networksettings2", "IsUp"); |
272 | case Unchecked : /* FT */ | 272 | case Unchecked : /* FT */ |
273 | default : | 273 | default : |
274 | break; | 274 | break; |
275 | } | 275 | } |
276 | return QString(""); | 276 | return QString(""); |
277 | } | 277 | } |
278 | 278 | ||
279 | void NodeCollection::reassign( void ) { | 279 | void NodeCollection::reassign( void ) { |
280 | for( QListIterator<ANetNodeInstance> it(*this); | 280 | for( QListIterator<ANetNodeInstance> it(*this); |
281 | it.current(); | 281 | it.current(); |
282 | ++it ) { | 282 | ++it ) { |
283 | it.current()->setConnection( this ); | 283 | it.current()->setConnection( this ); |
284 | } | 284 | } |
285 | } | 285 | } |
286 | 286 | ||
287 | // | 287 | // |
288 | // | 288 | // |
289 | // RUNTIMEINFO | 289 | // RUNTIMEINFO |
290 | // | 290 | // |
291 | // | 291 | // |
292 | 292 | ||
293 | InterfaceInfo * RuntimeInfo::assignedInterface( void ) { | 293 | InterfaceInfo * RuntimeInfo::assignedInterface( void ) { |
294 | return netNode()->nextNode()->runtime()->assignedInterface(); | 294 | return netNode()->nextNode()->runtime()->assignedInterface(); |
295 | } | 295 | } |
296 | 296 | ||
297 | AsDevice * RuntimeInfo::device( void ) { | 297 | AsDevice * RuntimeInfo::device( void ) { |
298 | return netNode()->nextNode()->runtime()->device(); | 298 | return netNode()->nextNode()->runtime()->device(); |
299 | } | 299 | } |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h index 6ec9ef6..27d54f8 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.h +++ b/noncore/settings/networksettings2/networksettings2/netnode.h | |||
@@ -1,389 +1,382 @@ | |||
1 | #ifndef NETNODE_H | 1 | #ifndef NETNODE_H |
2 | #define NETNODE_H | 2 | #define NETNODE_H |
3 | 3 | ||
4 | #include <qtextstream.h> | 4 | #include <qtextstream.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qpixmap.h> | 7 | #include <qpixmap.h> |
8 | #include <qobject.h> | 8 | #include <qobject.h> |
9 | #include <time.h> | 9 | #include <time.h> |
10 | 10 | ||
11 | // difference feature interfaces | 11 | // difference feature interfaces |
12 | class AsDevice; | 12 | class AsDevice; |
13 | class AsLine; | 13 | class AsLine; |
14 | class AsConnection; | 14 | class AsConnection; |
15 | class AsFullSetup; | 15 | class AsFullSetup; |
16 | 16 | ||
17 | // needed for plugin creation function | 17 | // needed for plugin creation function |
18 | #include <qlist.h> | 18 | #include <qlist.h> |
19 | 19 | ||
20 | class ANetNode; | 20 | class ANetNode; |
21 | class ANetNodeInstance; | 21 | class ANetNodeInstance; |
22 | class NodeCollection; | 22 | class NodeCollection; |
23 | class QTextStream; | 23 | class QTextStream; |
24 | class RuntimeInfo; | 24 | class RuntimeInfo; |
25 | class InterfaceInfo; | 25 | class InterfaceInfo; |
26 | 26 | ||
27 | extern QString & deQuote( QString & X ); | 27 | extern QString & deQuote( QString & X ); |
28 | extern QString quote( QString X ); | 28 | extern QString quote( QString X ); |
29 | 29 | ||
30 | #include "systemfile.h" | 30 | #include "systemfile.h" |
31 | 31 | ||
32 | typedef enum State { | 32 | typedef enum State { |
33 | // if we have not yet detected the state of the device | 33 | // if we have not yet detected the state of the device |
34 | Unchecked = 0, | 34 | Unchecked = 0, |
35 | // if we cannot determine the state | 35 | // if we cannot determine the state |
36 | Unknown = 1, | 36 | Unknown = 1, |
37 | // if connection cannot be established e.g. because | 37 | // if connection cannot be established e.g. because |
38 | // the hardware is not available | 38 | // the hardware is not available |
39 | Unavailable = 2, | 39 | Unavailable = 2, |
40 | // if the connection cannot be establishec but NOT | 40 | // if the connection cannot be establishec but NOT |
41 | // because it is physically impossible but because | 41 | // because it is physically impossible but because |
42 | // it has been disabled for FUNCTIONAL reasons | 42 | // it has been disabled for FUNCTIONAL reasons |
43 | Disabled = 3, | 43 | Disabled = 3, |
44 | // if connection is available to is currently down | 44 | // if connection is available to is currently down |
45 | // i.e. the corresponding hardware is not activated | 45 | // i.e. the corresponding hardware is not activated |
46 | Off = 4, | 46 | Off = 4, |
47 | // if connection is available to be used (i.e. the | 47 | // if connection is available to be used (i.e. the |
48 | // devices if fully ready to be used | 48 | // devices if fully ready to be used |
49 | Available = 5, | 49 | Available = 5, |
50 | // if connection is being used | 50 | // if connection is being used |
51 | IsUp = 6 | 51 | IsUp = 6 |
52 | } State_t; | 52 | } State_t; |
53 | 53 | ||
54 | typedef enum Action { | 54 | typedef enum Action { |
55 | // to make the device unavailable functionally | 55 | // to make the device unavailable functionally |
56 | Disable = 0, | 56 | Disable = 0, |
57 | // to make the device available functionally | 57 | // to make the device available functionally |
58 | Enable = 1, | 58 | Enable = 1, |
59 | // bring the hardware up | 59 | // bring the hardware up |
60 | Activate = 2, | 60 | Activate = 2, |
61 | // bring the hardware down | 61 | // bring the hardware down |
62 | Deactivate = 3, | 62 | Deactivate = 3, |
63 | // bring the connection up | 63 | // bring the connection up |
64 | Up = 4, | 64 | Up = 4, |
65 | // bring the connection down | 65 | // bring the connection down |
66 | Down = 5 | 66 | Down = 5 |
67 | } Action_t; | 67 | } Action_t; |
68 | 68 | ||
69 | class ANetNode : public QObject{ | 69 | class ANetNode : public QObject{ |
70 | 70 | ||
71 | public: | 71 | public: |
72 | 72 | ||
73 | typedef QArray<ANetNode *> NetNodeList; | 73 | typedef QArray<ANetNode *> NetNodeList; |
74 | 74 | ||
75 | ANetNode(){}; | 75 | ANetNode( const char * Name ) : QObject( 0, Name ) {} |
76 | virtual ~ANetNode(){}; | 76 | virtual ~ANetNode(){}; |
77 | 77 | ||
78 | // pixmap needed for this NetNode | 78 | // pixmap needed for this NetNode |
79 | virtual const QString pixmapName() = 0; | 79 | virtual const QString pixmapName() = 0; |
80 | 80 | ||
81 | // name of this NetNode | ||
82 | virtual const QString nodeName() = 0; | ||
83 | |||
84 | // description for this NetNode | 81 | // description for this NetNode |
85 | virtual const QString nodeDescription() = 0; | 82 | virtual const QString nodeDescription() = 0; |
86 | 83 | ||
87 | // create a blank instance of a net node | 84 | // create a blank instance of a net node |
88 | virtual ANetNodeInstance * createInstance( void ) = 0; | 85 | virtual ANetNodeInstance * createInstance( void ) = 0; |
89 | 86 | ||
90 | // return feature this NetNode provides | 87 | // return feature this NetNode provides |
91 | virtual const char * provides( void ) = 0; | 88 | virtual const char * provides( void ) = 0; |
92 | virtual const char ** needs( void ) = 0; | 89 | virtual const char ** needs( void ) = 0; |
93 | 90 | ||
94 | // generate files specific for this node (if any) | 91 | // generate files specific for this node (if any) |
95 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ) = 0; | 92 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ) = 0; |
96 | // return TRUE if this node has data to be inserted in systemfile | 93 | // return TRUE if this node has data to be inserted in systemfile |
97 | // with name S | 94 | // with name S |
98 | virtual bool hasDataFor( const QString & S ) = 0; | 95 | virtual bool hasDataFor( const QString & S ) = 0; |
99 | // generate data specific for the device for the system file S | 96 | // generate data specific for the device for the system file S |
100 | // called only IF data was needed | 97 | // called only IF data was needed |
101 | virtual bool generateDeviceDataForCommonFile( | 98 | virtual bool generateDeviceDataForCommonFile( |
102 | SystemFile & SF, long DevNr ) = 0; | 99 | SystemFile & SF, long DevNr ) = 0; |
103 | 100 | ||
104 | // does this Node provide a Connection | 101 | // does this Node provide a Connection |
105 | bool isToplevel( void ) | 102 | bool isToplevel( void ) |
106 | { return strcmp( provides(), "fullsetup") == 0 ; } | 103 | { return strcmp( provides(), "fullsetup") == 0 ; } |
107 | 104 | ||
108 | // generate NIC name based on instance nr | 105 | // generate NIC name based on instance nr |
109 | // only relevant if node instances are devices | 106 | // only relevant if node instances are devices |
110 | virtual QString genNic( long ) | 107 | virtual QString genNic( long ) |
111 | { return QString(""); } | 108 | { return QString(""); } |
112 | 109 | ||
113 | // max number of instances for this node type | 110 | // max number of instances for this node type |
114 | // only relevant if node instances are devices | 111 | // only relevant if node instances are devices |
115 | virtual long instanceCount( void ) | 112 | virtual long instanceCount( void ) |
116 | { return 1; } | 113 | { return 1; } |
117 | 114 | ||
118 | // set the value of an attribute | 115 | // set the value of an attribute |
119 | void setAttribute( QString & Attr, QString & Value ) ; | 116 | void setAttribute( QString & Attr, QString & Value ) ; |
120 | void saveAttributes( QTextStream & TS ) ; | 117 | void saveAttributes( QTextStream & TS ) ; |
121 | 118 | ||
122 | // compiled references to 'needed' NetNodes -> needs list | 119 | // compiled references to 'needed' NetNodes -> needs list |
123 | void setAlternatives( NetNodeList * Alt ) | 120 | void setAlternatives( NetNodeList * Alt ) |
124 | { Alternatives = Alt; } | 121 | { Alternatives = Alt; } |
125 | NetNodeList & alternatives( void ) | 122 | NetNodeList & alternatives( void ) |
126 | { return *Alternatives; } | 123 | { return *Alternatives; } |
127 | 124 | ||
128 | protected : | 125 | protected : |
129 | 126 | ||
130 | NetNodeList * Alternatives; | 127 | NetNodeList * Alternatives; |
131 | 128 | ||
132 | private : | 129 | private : |
133 | 130 | ||
134 | virtual void setSpecificAttribute( QString & , QString & ) = 0; | 131 | virtual void setSpecificAttribute( QString & , QString & ) = 0; |
135 | virtual void saveSpecificAttribute( QTextStream & ) = 0; | 132 | virtual void saveSpecificAttribute( QTextStream & ) = 0; |
136 | 133 | ||
137 | }; | 134 | }; |
138 | 135 | ||
139 | class ANetNodeInstance : public QObject { | 136 | class ANetNodeInstance : public QObject { |
140 | 137 | ||
141 | public: | 138 | public: |
142 | 139 | ||
143 | ANetNodeInstance( ANetNode * NN ) : QObject() | 140 | ANetNodeInstance( ANetNode * NN ) : QObject() |
144 | { IsModified=0; NodeType = NN; IsNew = TRUE; } | 141 | { IsModified=0; NodeType = NN; IsNew = TRUE; } |
145 | virtual ~ANetNodeInstance( void ) { } | 142 | virtual ~ANetNodeInstance( void ) { } |
146 | 143 | ||
147 | virtual RuntimeInfo * runtime( void ) = 0; | 144 | virtual RuntimeInfo * runtime( void ) = 0; |
148 | 145 | ||
149 | void setConnection( NodeCollection * NC ) | 146 | void setConnection( NodeCollection * NC ) |
150 | { Connection = NC; } | 147 | { Connection = NC; } |
151 | NodeCollection * connection( void ) | 148 | NodeCollection * connection( void ) |
152 | { return Connection; } | 149 | { return Connection; } |
153 | 150 | ||
154 | // create edit widget under parent | 151 | // create edit widget under parent |
155 | virtual QWidget * edit( QWidget * parent ) = 0; | 152 | virtual QWidget * edit( QWidget * parent ) = 0; |
156 | // is given data acceptable | 153 | // is given data acceptable |
157 | virtual QString acceptable( void ) = 0; | 154 | virtual QString acceptable( void ) = 0; |
158 | 155 | ||
159 | // return data was modified | 156 | // return data was modified |
160 | void setModified( bool M ) | 157 | void setModified( bool M ) |
161 | { IsModified = M; } | 158 | { IsModified = M; } |
162 | bool isModified( void ) | 159 | bool isModified( void ) |
163 | { return IsModified; } | 160 | { return IsModified; } |
164 | 161 | ||
165 | // get data from GUI and store in node | 162 | // get data from GUI and store in node |
166 | virtual void commit( void ) = 0; | 163 | virtual void commit( void ) = 0; |
167 | 164 | ||
168 | // get next node | 165 | // get next node |
169 | ANetNodeInstance * nextNode(); | 166 | ANetNodeInstance * nextNode(); |
170 | // return NetNode this is an instance of | 167 | // return NetNode this is an instance of |
171 | ANetNode * nodeClass( void ) | 168 | ANetNode * nodeClass( void ) |
172 | { return NodeType; } | 169 | { return NodeType; } |
173 | 170 | ||
174 | // intialize am instance of a net node | 171 | // intialize am instance of a net node |
175 | void initialize( void ); | 172 | void initialize( void ); |
176 | 173 | ||
177 | // set the value of an attribute | 174 | // set the value of an attribute |
178 | void setAttribute( QString & Attr, QString & Value ) ; | 175 | void setAttribute( QString & Attr, QString & Value ) ; |
179 | void saveAttributes( QTextStream & TS ) ; | 176 | void saveAttributes( QTextStream & TS ) ; |
180 | 177 | ||
181 | // return true if node isntance is NEW and not loaded | 178 | // return true if node isntance is NEW and not loaded |
182 | void setNew( bool IsN ) | 179 | void setNew( bool IsN ) |
183 | { IsNew = IsN; } | 180 | { IsNew = IsN; } |
184 | bool isNew( void ) | 181 | bool isNew( void ) |
185 | { return IsNew; } | 182 | { return IsNew; } |
186 | 183 | ||
187 | // return logical name of this instance | ||
188 | QString & nodeName( void ) | ||
189 | { return NodeName; } | ||
190 | void setNodeName( const QString & S ) | ||
191 | { NodeName = S; } | ||
192 | // return description for this instance | 184 | // return description for this instance |
193 | QString & description( void ) | 185 | QString & description( void ) |
194 | { return Description; } | 186 | { return Description; } |
195 | void setDescription( const QString & S ) | 187 | void setDescription( const QString & S ) |
196 | { Description = S; } | 188 | { Description = S; } |
197 | 189 | ||
198 | // pixmap for this instance -> from NetNode | 190 | // pixmap for this instance -> from NetNode |
199 | const QString pixmapName( void ) | 191 | const QString pixmapName( void ) |
200 | { return NodeType->pixmapName(); } | 192 | { return NodeType->pixmapName(); } |
201 | 193 | ||
202 | const char * provides( void ) | 194 | const char * provides( void ) |
203 | { return NodeType->provides(); } | 195 | { return NodeType->provides(); } |
204 | 196 | ||
205 | const char ** needs( void ) | 197 | const char ** needs( void ) |
206 | { return NodeType->needs(); } | 198 | { return NodeType->needs(); } |
207 | 199 | ||
208 | // returns node specific data -> only useful for 'buddy' | 200 | // returns node specific data -> only useful for 'buddy' |
209 | virtual void * data( void ) = 0; | 201 | virtual void * data( void ) = 0; |
210 | 202 | ||
211 | // return TRUE if this node has data to be inserted in systemfile | 203 | // return TRUE if this node has data to be inserted in systemfile |
212 | // with name S | 204 | // with name S |
213 | virtual bool hasDataFor( const QString & S ) = 0; | 205 | virtual bool hasDataFor( const QString & S ) = 0; |
214 | 206 | ||
215 | // generate data specific for a profile and for the system file S | 207 | // generate data specific for a profile and for the system file S |
216 | // called only IF data was needed | 208 | // called only IF data was needed |
217 | virtual bool generateDataForCommonFile( | 209 | virtual bool generateDataForCommonFile( |
218 | SystemFile & SF, long DevNr ) = 0; | 210 | SystemFile & SF, long DevNr ) = 0; |
219 | 211 | ||
220 | protected : | 212 | protected : |
221 | 213 | ||
222 | virtual void setSpecificAttribute( QString & , QString & ) = 0; | 214 | virtual void setSpecificAttribute( QString & , QString & ) = 0; |
223 | virtual void saveSpecificAttribute( QTextStream & ) = 0; | 215 | virtual void saveSpecificAttribute( QTextStream & ) = 0; |
224 | 216 | ||
225 | ANetNode * NodeType; | 217 | ANetNode * NodeType; |
226 | // connection to which this node belongs to | 218 | // connection to which this node belongs to |
227 | NodeCollection * Connection; | 219 | NodeCollection * Connection; |
228 | QString NodeName; | ||
229 | QString Description; | 220 | QString Description; |
230 | bool IsModified; | 221 | bool IsModified; |
231 | bool IsNew; | 222 | bool IsNew; |
232 | 223 | ||
233 | static long InstanceCounter; | 224 | static long InstanceCounter; |
234 | }; | 225 | }; |
235 | 226 | ||
236 | class RuntimeInfo : public QObject { | 227 | class RuntimeInfo : public QObject { |
237 | 228 | ||
238 | Q_OBJECT | 229 | Q_OBJECT |
239 | 230 | ||
240 | public : | 231 | public : |
241 | 232 | ||
242 | RuntimeInfo( ANetNodeInstance * TheNNI ) | 233 | RuntimeInfo( ANetNodeInstance * TheNNI ) |
243 | { NNI = TheNNI; } | 234 | { NNI = TheNNI; } |
244 | 235 | ||
245 | // downcast implemented by specify runtime classes | 236 | // downcast implemented by specify runtime classes |
246 | virtual AsDevice * asDevice( void ) | 237 | virtual AsDevice * asDevice( void ) |
247 | { return 0; } | 238 | { return 0; } |
248 | virtual AsConnection * asConnection( void ) | 239 | virtual AsConnection * asConnection( void ) |
249 | { return 0; } | 240 | { return 0; } |
250 | virtual AsLine * asLine( void ) | 241 | virtual AsLine * asLine( void ) |
251 | { return 0; } | 242 | { return 0; } |
252 | virtual AsFullSetup * asFullSetup( void ) | 243 | virtual AsFullSetup * asFullSetup( void ) |
253 | { return 0; } | 244 | { return 0; } |
254 | 245 | ||
255 | // does this node handles this interface e.g.eth0 | 246 | // does this node handles this interface e.g.eth0 |
256 | // recurse deeper if this node cannot answer that question | 247 | // recurse deeper if this node cannot answer that question |
257 | virtual bool handlesInterface( const QString & ) | 248 | virtual bool handlesInterface( const QString & ) |
258 | { return 0; } | 249 | { return 0; } |
250 | virtual bool handlesInterface( const InterfaceInfo & ) | ||
251 | { return 0; } | ||
259 | virtual InterfaceInfo * assignedInterface( void ); | 252 | virtual InterfaceInfo * assignedInterface( void ); |
260 | virtual AsDevice * device( void ); | 253 | virtual AsDevice * device( void ); |
261 | 254 | ||
262 | ANetNodeInstance * netNode() | 255 | ANetNodeInstance * netNode() |
263 | { return NNI; } | 256 | { return NNI; } |
264 | NodeCollection * connection() | 257 | NodeCollection * connection() |
265 | { return NNI->connection(); } | 258 | { return NNI->connection(); } |
266 | 259 | ||
267 | virtual void detectState( NodeCollection * NC ) = 0; | 260 | virtual void detectState( NodeCollection * NC ) = 0; |
268 | virtual bool setState( NodeCollection * NC, Action_t A ) = 0; | 261 | virtual bool setState( NodeCollection * NC, Action_t A ) = 0; |
269 | virtual bool canSetState( State_t Curr, Action_t A ) = 0; | 262 | virtual bool canSetState( State_t Curr, Action_t A ) = 0; |
270 | 263 | ||
271 | signals : | 264 | signals : |
272 | 265 | ||
273 | // sent by device if state changes | 266 | // sent by device if state changes |
274 | void stateChanged( State_t S, ANetNodeInstance * NNI ); | 267 | void stateChanged( State_t S, ANetNodeInstance * NNI ); |
275 | 268 | ||
276 | protected : | 269 | protected : |
277 | 270 | ||
278 | // connection this runtime info belongs to | 271 | // connection this runtime info belongs to |
279 | ANetNodeInstance * NNI; | 272 | ANetNodeInstance * NNI; |
280 | }; | 273 | }; |
281 | 274 | ||
282 | class NodeCollection : public QList<ANetNodeInstance> { | 275 | class NodeCollection : public QList<ANetNodeInstance> { |
283 | 276 | ||
284 | public : | 277 | public : |
285 | 278 | ||
286 | NodeCollection( void ); | 279 | NodeCollection( void ); |
287 | NodeCollection( QTextStream & TS ); | 280 | NodeCollection( QTextStream & TS ); |
288 | ~NodeCollection( void ); | 281 | ~NodeCollection( void ); |
289 | 282 | ||
290 | int number( void ) | 283 | int number( void ) |
291 | { return Number; } | 284 | { return Number; } |
292 | void setNumber( int i ) | 285 | void setNumber( int i ) |
293 | { Number = i; if( MaxNr < i ) MaxNr = i; } | 286 | { Number = i; if( MaxNr < i ) MaxNr = i; } |
294 | bool isNew( void ) | 287 | bool isNew( void ) |
295 | { return IsNew; } | 288 | { return IsNew; } |
296 | void setNew( bool N ) | 289 | void setNew( bool N ) |
297 | { IsNew = N ; } | 290 | { IsNew = N ; } |
298 | bool isModified( void ) | 291 | bool isModified( void ) |
299 | { return IsModified; } | 292 | { return IsModified; } |
300 | void setModified( bool N ) | 293 | void setModified( bool N ) |
301 | { IsModified = N ; } | 294 | { IsModified = N ; } |
302 | 295 | ||
303 | bool handlesInterface( const QString & S ) { | 296 | bool handlesInterface( const QString & S ) { |
304 | return getToplevel()->runtime()->handlesInterface( S ); | 297 | return getToplevel()->runtime()->handlesInterface( S ); |
305 | } | 298 | } |
306 | 299 | ||
307 | InterfaceInfo * assignedInterface( void ) { | 300 | InterfaceInfo * assignedInterface( void ) { |
308 | return getToplevel()->runtime()->assignedInterface(); | 301 | return getToplevel()->runtime()->assignedInterface(); |
309 | } | 302 | } |
310 | 303 | ||
311 | AsDevice * device() { | 304 | AsDevice * device() { |
312 | return getToplevel()->runtime()->device(); | 305 | return getToplevel()->runtime()->device(); |
313 | } | 306 | } |
314 | 307 | ||
315 | State_t state( bool Update = 0 ) | 308 | State_t state( bool Update = 0 ) |
316 | { if( CurrentState == Unchecked || Update ) { | 309 | { if( CurrentState == Unchecked || Update ) { |
317 | // need to get current state | 310 | // need to get current state |
318 | getToplevel()->runtime()->detectState( this ); | 311 | getToplevel()->runtime()->detectState( this ); |
319 | } | 312 | } |
320 | return CurrentState; | 313 | return CurrentState; |
321 | } | 314 | } |
322 | 315 | ||
323 | // get the ixmap for this device | 316 | // get the ixmap for this device |
324 | QPixmap devicePixmap( void ); | 317 | QPixmap devicePixmap( void ); |
325 | QPixmap statePixmap( State_t S ); | 318 | QPixmap statePixmap( State_t S ); |
326 | QPixmap statePixmap( bool Update = 0 ) | 319 | QPixmap statePixmap( bool Update = 0 ) |
327 | { return statePixmap( state(Update) ); } | 320 | { return statePixmap( state(Update) ); } |
328 | QString stateName( State_t ); | 321 | QString stateName( State_t ); |
329 | QString stateName( bool Update = 0 ) | 322 | QString stateName( bool Update = 0 ) |
330 | { return stateName( state(Update) ); } | 323 | { return stateName( state(Update) ); } |
331 | 324 | ||
332 | bool setState( Action_t A ) | 325 | bool setState( Action_t A ) |
333 | { return getToplevel()->runtime()->setState( this, A ); } | 326 | { return getToplevel()->runtime()->setState( this, A ); } |
334 | bool canSetState( Action_t A ) | 327 | bool canSetState( Action_t A ) |
335 | { return getToplevel()->runtime()->canSetState( CurrentState, A ); } | 328 | { return getToplevel()->runtime()->canSetState( CurrentState, A ); } |
336 | 329 | ||
337 | void save( QTextStream & TS ); | 330 | void save( QTextStream & TS ); |
338 | 331 | ||
339 | void append( ANetNodeInstance * NNI ); | 332 | void append( ANetNodeInstance * NNI ); |
340 | 333 | ||
341 | // makes sure that all items in the connection point to | 334 | // makes sure that all items in the connection point to |
342 | // that connectoin | 335 | // that connectoin |
343 | void reassign( void ); | 336 | void reassign( void ); |
344 | 337 | ||
345 | ANetNodeInstance * getToplevel( void ); | 338 | ANetNodeInstance * getToplevel( void ); |
346 | ANetNodeInstance * findNext( ANetNodeInstance * NNI ); | 339 | ANetNodeInstance * findNext( ANetNodeInstance * NNI ); |
347 | ANetNodeInstance * findByName( const QString & S ); | 340 | ANetNodeInstance * findByName( const QString & S ); |
348 | 341 | ||
349 | const QString & name() | 342 | const QString & name() |
350 | { return Name; } | 343 | { return Name; } |
351 | 344 | ||
352 | const QString & description( void ); | 345 | const QString & description( void ); |
353 | 346 | ||
354 | void setName( const QString & N) | 347 | void setName( const QString & N) |
355 | { Name = N; } | 348 | { Name = N; } |
356 | 349 | ||
357 | State_t currentState( void ) | 350 | State_t currentState( void ) |
358 | { return CurrentState; } | 351 | { return CurrentState; } |
359 | void setCurrentState( State_t S ) | 352 | void setCurrentState( State_t S ) |
360 | { CurrentState = S; } | 353 | { CurrentState = S; } |
361 | 354 | ||
362 | long maxConnectionNumber( void ) | 355 | long maxConnectionNumber( void ) |
363 | { return MaxNr; } | 356 | { return MaxNr; } |
364 | 357 | ||
365 | static void resetMaxNr( void ) | 358 | static void resetMaxNr( void ) |
366 | { MaxNr = -1; } | 359 | { MaxNr = -1; } |
367 | 360 | ||
368 | private : | 361 | private : |
369 | 362 | ||
370 | int compareItems ( QCollection::Item item1, | 363 | int compareItems ( QCollection::Item item1, |
371 | QCollection::Item item2 ); | 364 | QCollection::Item item2 ); |
372 | 365 | ||
373 | static long MaxNr; | 366 | static long MaxNr; |
374 | long Number; | 367 | long Number; |
375 | 368 | ||
376 | // state of this connection | 369 | // state of this connection |
377 | State_t CurrentState; | 370 | State_t CurrentState; |
378 | 371 | ||
379 | QString Name; | 372 | QString Name; |
380 | // true if this collection was just created (and not | 373 | // true if this collection was just created (and not |
381 | // loaded from file | 374 | // loaded from file |
382 | bool IsNew; | 375 | bool IsNew; |
383 | // index in listbox | 376 | // index in listbox |
384 | int Index; | 377 | int Index; |
385 | bool IsModified; | 378 | bool IsModified; |
386 | 379 | ||
387 | }; | 380 | }; |
388 | 381 | ||
389 | #endif | 382 | #endif |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp index e6ce2b7..4b7a62f 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.cpp +++ b/noncore/settings/networksettings2/networksettings2/resources.cpp | |||
@@ -1,369 +1,369 @@ | |||
1 | #include <unistd.h> | 1 | #include <unistd.h> |
2 | #include <errno.h> | 2 | #include <errno.h> |
3 | #include <fcntl.h> | 3 | #include <fcntl.h> |
4 | #include <pwd.h> | 4 | #include <pwd.h> |
5 | #include <qpixmap.h> | 5 | #include <qpixmap.h> |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | #include <qpe/qlibrary.h> | 7 | #include <qpe/qlibrary.h> |
8 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
9 | #include <opie2/odebug.h> | 9 | #include <opie2/odebug.h> |
10 | #include <qtopia/resource.h> | 10 | #include <qtopia/resource.h> |
11 | 11 | ||
12 | #include "netnode.h" | 12 | #include "netnode.h" |
13 | #include "resources.h" | 13 | #include "resources.h" |
14 | 14 | ||
15 | #define PLUGINDIR "plugins/networksettings2" | 15 | #define PLUGINDIR "plugins/networksettings2" |
16 | #define ICONDIR "/pics/networksettings2/" | 16 | #define ICONDIR "/pics/networksettings2/" |
17 | 17 | ||
18 | // single resources instance | 18 | // single resources instance |
19 | TheNSResources * _NSResources = 0; | 19 | TheNSResources * _NSResources = 0; |
20 | 20 | ||
21 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), | 21 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), |
22 | ConnectionsMap() { | 22 | ConnectionsMap() { |
23 | 23 | ||
24 | _NSResources = this; | 24 | _NSResources = this; |
25 | 25 | ||
26 | // load available netnodes | 26 | // load available netnodes |
27 | findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR ); | 27 | findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR ); |
28 | 28 | ||
29 | // compile provides and needs lists | 29 | // compile provides and needs lists |
30 | { const char ** NeedsRun; | 30 | { const char ** NeedsRun; |
31 | QDictIterator<NetNode_t> OuterIt( AllNodeTypes ); | 31 | QDictIterator<NetNode_t> OuterIt( AllNodeTypes ); |
32 | bool Done; | 32 | bool Done; |
33 | 33 | ||
34 | for ( ; OuterIt.current(); ++OuterIt ) { | 34 | for ( ; OuterIt.current(); ++OuterIt ) { |
35 | // find needs list | 35 | // find needs list |
36 | ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList; | 36 | ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList; |
37 | ANetNode::NetNodeList & NNL = *(NNLP); | 37 | ANetNode::NetNodeList & NNL = *(NNLP); |
38 | 38 | ||
39 | // must iterate this way to avoid duplication pointers | 39 | // must iterate this way to avoid duplication pointers |
40 | for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes ); | 40 | for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes ); |
41 | InnerIt.current(); ++InnerIt ) { | 41 | InnerIt.current(); ++InnerIt ) { |
42 | if( InnerIt.current() == OuterIt.current() ) | 42 | if( InnerIt.current() == OuterIt.current() ) |
43 | // avoid recursive | 43 | // avoid recursive |
44 | continue; | 44 | continue; |
45 | 45 | ||
46 | const char * Provides = InnerIt.current()->NetNode->provides(); | 46 | const char * Provides = InnerIt.current()->NetNode->provides(); |
47 | NeedsRun = OuterIt.current()->NetNode->needs(); | 47 | NeedsRun = OuterIt.current()->NetNode->needs(); |
48 | for( ; *NeedsRun; NeedsRun ++ ) { | 48 | for( ; *NeedsRun; NeedsRun ++ ) { |
49 | if( strcmp( Provides, *NeedsRun ) == 0 ) { | 49 | if( strcmp( Provides, *NeedsRun ) == 0 ) { |
50 | // inner provides what outer needs | 50 | // inner provides what outer needs |
51 | NNL.resize( NNL.size() + 1 ); | 51 | NNL.resize( NNL.size() + 1 ); |
52 | NNL[NNL.size()-1] = InnerIt.current()->NetNode; | 52 | NNL[NNL.size()-1] = InnerIt.current()->NetNode; |
53 | Done = 1; // break from 2 loops | 53 | Done = 1; // break from 2 loops |
54 | break; | 54 | break; |
55 | } | 55 | } |
56 | } | 56 | } |
57 | } | 57 | } |
58 | OuterIt.current()->NetNode->setAlternatives( NNLP ); | 58 | OuterIt.current()->NetNode->setAlternatives( NNLP ); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | // define Node types to Description map | 62 | // define Node types to Description map |
63 | NodeTypeNameMap.insert( "device", tr( "Network Device" ) ); | 63 | NodeTypeNameMap.insert( "device", tr( "Network Device" ) ); |
64 | NodeTypeNameMap.insert( "line", tr( "Character device" ) ); | 64 | NodeTypeNameMap.insert( "line", tr( "Character device" ) ); |
65 | NodeTypeNameMap.insert( "connection", tr( "IP Connection" ) ); | 65 | NodeTypeNameMap.insert( "connection", tr( "IP Connection" ) ); |
66 | NodeTypeNameMap.insert( "fullsetup", tr( "Connection Profile" ) ); | 66 | NodeTypeNameMap.insert( "fullsetup", tr( "Connection Profile" ) ); |
67 | 67 | ||
68 | NodeTypeDescriptionMap.insert( "device", | 68 | NodeTypeDescriptionMap.insert( "device", |
69 | tr( "<p>Devices that can handle IP packets</p>" ) ); | 69 | tr( "<p>Devices that can handle IP packets</p>" ) ); |
70 | NodeTypeDescriptionMap.insert( "line", | 70 | NodeTypeDescriptionMap.insert( "line", |
71 | tr( "<p>Devices that can handle single bytes</p>" ) ); | 71 | tr( "<p>Devices that can handle single bytes</p>" ) ); |
72 | NodeTypeDescriptionMap.insert( "connection", | 72 | NodeTypeDescriptionMap.insert( "connection", |
73 | tr( "<p>Nodes that provide working IP connections</p>" ) ); | 73 | tr( "<p>Nodes that provide working IP connections</p>" ) ); |
74 | NodeTypeDescriptionMap.insert( "fullsetup", | 74 | NodeTypeDescriptionMap.insert( "fullsetup", |
75 | tr( "<p>Fully configured connection profile</p>" ) ); | 75 | tr( "<p>Fully configured connection profile</p>" ) ); |
76 | 76 | ||
77 | // define system files | 77 | // define system files |
78 | addSystemFile( new SystemFile( "interfaces", "./interfaces" ) ); | 78 | addSystemFile( new SystemFile( "interfaces", "./interfaces" ) ); |
79 | 79 | ||
80 | // get access to the system | 80 | // get access to the system |
81 | TheSystem = new System(); | 81 | TheSystem = new System(); |
82 | 82 | ||
83 | detectCurrentUser(); | 83 | detectCurrentUser(); |
84 | } | 84 | } |
85 | 85 | ||
86 | TheNSResources::~TheNSResources( void ) { | 86 | TheNSResources::~TheNSResources( void ) { |
87 | delete TheSystem; | 87 | delete TheSystem; |
88 | } | 88 | } |
89 | 89 | ||
90 | /** | 90 | /** |
91 | * Load all modules that are found in the path | 91 | * Load all modules that are found in the path |
92 | * @param path a directory that is scaned for any plugins that can be loaded | 92 | * @param path a directory that is scaned for any plugins that can be loaded |
93 | * and attempts to load them | 93 | * and attempts to load them |
94 | */ | 94 | */ |
95 | void TheNSResources::findAvailableNetNodes(const QString &path){ | 95 | void TheNSResources::findAvailableNetNodes(const QString &path){ |
96 | 96 | ||
97 | QDir d(path); | 97 | QDir d(path); |
98 | if(!d.exists()) | 98 | if(!d.exists()) |
99 | return; | 99 | return; |
100 | 100 | ||
101 | QString lang = ::getenv("LANG"); | 101 | QString lang = ::getenv("LANG"); |
102 | 102 | ||
103 | // Don't want sym links | 103 | // Don't want sym links |
104 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 104 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
105 | const QFileInfoList *list = d.entryInfoList(); | 105 | const QFileInfoList *list = d.entryInfoList(); |
106 | QFileInfoListIterator it( *list ); | 106 | QFileInfoListIterator it( *list ); |
107 | QFileInfo *fi; | 107 | QFileInfo *fi; |
108 | 108 | ||
109 | while ( (fi=it.current()) ) { | 109 | while ( (fi=it.current()) ) { |
110 | 110 | ||
111 | if( fi->fileName().contains(".so")){ | 111 | if( fi->fileName().contains(".so")){ |
112 | /* if loaded install translation */ | 112 | /* if loaded install translation */ |
113 | if( loadNetNode(path + "/" + fi->fileName()) ) { | 113 | if( loadNetNode(path + "/" + fi->fileName()) ) { |
114 | QTranslator *trans = new QTranslator(qApp); | 114 | QTranslator *trans = new QTranslator(qApp); |
115 | QString fn = QPEApplication::qpeDir()+ | 115 | QString fn = QPEApplication::qpeDir()+ |
116 | "/i18n/"+lang+"/"+ | 116 | "/i18n/"+lang+"/"+ |
117 | fi->fileName().left( fi->fileName().find(".") )+ | 117 | fi->fileName().left( fi->fileName().find(".") )+ |
118 | ".qm"; | 118 | ".qm"; |
119 | 119 | ||
120 | if( trans->load( fn ) ) | 120 | if( trans->load( fn ) ) |
121 | qApp->installTranslator( trans ); | 121 | qApp->installTranslator( trans ); |
122 | else | 122 | else |
123 | delete trans; | 123 | delete trans; |
124 | } | 124 | } |
125 | } | 125 | } |
126 | ++it; | 126 | ++it; |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | /** | 130 | /** |
131 | * Attempt to load a function and resolve a function. | 131 | * Attempt to load a function and resolve a function. |
132 | * @param pluginFileName - the name of the file in which to attempt to load | 132 | * @param pluginFileName - the name of the file in which to attempt to load |
133 | * @param resolveString - function pointer to resolve | 133 | * @param resolveString - function pointer to resolve |
134 | * @return true of loading is successful | 134 | * @return true of loading is successful |
135 | */ | 135 | */ |
136 | bool TheNSResources::loadNetNode( | 136 | bool TheNSResources::loadNetNode( |
137 | const QString &pluginFileName, const QString &resolveString){ | 137 | const QString &pluginFileName, const QString &resolveString){ |
138 | 138 | ||
139 | QLibrary *lib = new QLibrary(pluginFileName); | 139 | QLibrary *lib = new QLibrary(pluginFileName); |
140 | void * res = lib->resolve(resolveString); | 140 | void * res = lib->resolve(resolveString); |
141 | if( ! res ){ | 141 | if( ! res ){ |
142 | delete lib; | 142 | delete lib; |
143 | return 0; | 143 | return 0; |
144 | } | 144 | } |
145 | 145 | ||
146 | GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; | 146 | GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; |
147 | 147 | ||
148 | // Try to get an object. | 148 | // Try to get an object. |
149 | QList<ANetNode> PNN; | 149 | QList<ANetNode> PNN; |
150 | 150 | ||
151 | getNetNodeList( PNN ); | 151 | getNetNodeList( PNN ); |
152 | if( PNN.isEmpty() ) { | 152 | if( PNN.isEmpty() ) { |
153 | delete lib; | 153 | delete lib; |
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
156 | 156 | ||
157 | ANetNode * NNP; | 157 | ANetNode * NNP; |
158 | for( QListIterator<ANetNode> it(PNN); | 158 | for( QListIterator<ANetNode> it(PNN); |
159 | it.current(); | 159 | it.current(); |
160 | ++it ) { | 160 | ++it ) { |
161 | NetNode_t * NN; | 161 | NetNode_t * NN; |
162 | 162 | ||
163 | NNP = it.current(); | 163 | NNP = it.current(); |
164 | NN = new NetNode_t; | 164 | NN = new NetNode_t; |
165 | NN->NetNode = NNP; | 165 | NN->NetNode = NNP; |
166 | NN->TheLibrary = lib; | 166 | NN->TheLibrary = lib; |
167 | NN->NodeCountInLib = PNN.count(); | 167 | NN->NodeCountInLib = PNN.count(); |
168 | 168 | ||
169 | // store mapping | 169 | // store mapping |
170 | AllNodeTypes.insert( NN->NetNode->nodeName(), NN ); | 170 | printf( "Store %s\n", NN->NetNode->name() ); |
171 | AllNodeTypes.insert( NN->NetNode->name(), NN ); | ||
171 | } | 172 | } |
172 | 173 | ||
173 | return 1; | 174 | return 1; |
174 | } | 175 | } |
175 | 176 | ||
176 | QPixmap TheNSResources::getPixmap( const QString & QS ) { | 177 | QPixmap TheNSResources::getPixmap( const QString & QS ) { |
177 | QString S("networksettings2/"); | 178 | QString S("networksettings2/"); |
178 | S += QS; | 179 | S += QS; |
179 | printf( " pixmap %s\n", S.latin1() ); | ||
180 | return Resource::loadPixmap( QString("networksettings2/")+QS ); | 180 | return Resource::loadPixmap( QString("networksettings2/")+QS ); |
181 | } | 181 | } |
182 | 182 | ||
183 | QString TheNSResources::tr( const char * s ) { | 183 | QString TheNSResources::tr( const char * s ) { |
184 | return qApp->translate( "resource", s ); | 184 | return qApp->translate( "resource", s ); |
185 | } | 185 | } |
186 | 186 | ||
187 | const QString & TheNSResources::netNode2Name( const char * s ) { | 187 | const QString & TheNSResources::netNode2Name( const char * s ) { |
188 | return NodeTypeNameMap[s]; | 188 | return NodeTypeNameMap[s]; |
189 | } | 189 | } |
190 | 190 | ||
191 | const QString & TheNSResources::netNode2Description( const char * s ) { | 191 | const QString & TheNSResources::netNode2Description( const char * s ) { |
192 | return NodeTypeDescriptionMap[s]; | 192 | return NodeTypeDescriptionMap[s]; |
193 | } | 193 | } |
194 | 194 | ||
195 | void TheNSResources::addConnection( NodeCollection * NC ) { | 195 | void TheNSResources::addConnection( NodeCollection * NC ) { |
196 | ANetNodeInstance * NNI; | 196 | ANetNodeInstance * NNI; |
197 | ConnectionsMap.insert( NC->name(), NC ); | 197 | ConnectionsMap.insert( NC->name(), NC ); |
198 | // add (new) nodes to NodeList | 198 | // add (new) nodes to NodeList |
199 | for( QListIterator<ANetNodeInstance> it(*NC); | 199 | for( QListIterator<ANetNodeInstance> it(*NC); |
200 | it.current(); | 200 | it.current(); |
201 | ++it ) { | 201 | ++it ) { |
202 | NNI = it.current(); | 202 | NNI = it.current(); |
203 | if( findNodeInstance( NNI->nodeName() ) == 0 ) { | 203 | if( findNodeInstance( NNI->name() ) == 0 ) { |
204 | // new item | 204 | // new item |
205 | addNodeInstance( NNI ); | 205 | addNodeInstance( NNI ); |
206 | } | 206 | } |
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
210 | void TheNSResources::removeConnection( const QString & N ) { | 210 | void TheNSResources::removeConnection( const QString & N ) { |
211 | NodeCollection * NC = findConnection( N ); | 211 | NodeCollection * NC = findConnection( N ); |
212 | if( ! NC ) | 212 | if( ! NC ) |
213 | return; | 213 | return; |
214 | 214 | ||
215 | // delete netnodes in this connection | 215 | // delete netnodes in this connection |
216 | ANetNodeInstance * NNI; | 216 | ANetNodeInstance * NNI; |
217 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { | 217 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { |
218 | removeNodeInstance( NNI->nodeName() ); | 218 | removeNodeInstance( NNI->name() ); |
219 | } | 219 | } |
220 | ConnectionsMap.remove( N ); | 220 | ConnectionsMap.remove( N ); |
221 | } | 221 | } |
222 | 222 | ||
223 | NodeCollection * TheNSResources::findConnection( const QString & S ) { | 223 | NodeCollection * TheNSResources::findConnection( const QString & S ) { |
224 | return ConnectionsMap[ S ]; | 224 | return ConnectionsMap[ S ]; |
225 | } | 225 | } |
226 | 226 | ||
227 | void TheNSResources::renumberConnections( void ) { | 227 | void TheNSResources::renumberConnections( void ) { |
228 | Name2Connection_t & M = NSResources->connections(); | 228 | Name2Connection_t & M = NSResources->connections(); |
229 | NodeCollection * NC; | 229 | NodeCollection * NC; |
230 | 230 | ||
231 | // for all connections | 231 | // for all connections |
232 | NodeCollection::resetMaxNr(); | 232 | NodeCollection::resetMaxNr(); |
233 | for( QDictIterator<NodeCollection> it(M); | 233 | for( QDictIterator<NodeCollection> it(M); |
234 | it.current(); | 234 | it.current(); |
235 | ++it ) { | 235 | ++it ) { |
236 | NC = it.current(); | 236 | NC = it.current(); |
237 | NC->setNumber( NC->maxConnectionNumber()+1 ); | 237 | NC->setNumber( NC->maxConnectionNumber()+1 ); |
238 | NC->setModified( 1 ); | 238 | NC->setModified( 1 ); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | typedef struct EnvVars { | 242 | typedef struct EnvVars { |
243 | char * Name; | 243 | char * Name; |
244 | int Len; | 244 | int Len; |
245 | } EnvVar_t; | 245 | } EnvVar_t; |
246 | 246 | ||
247 | #define AnEV(x) x, sizeof(x)-1 | 247 | #define AnEV(x) x, sizeof(x)-1 |
248 | 248 | ||
249 | static EnvVar_t EV[] = { | 249 | static EnvVar_t EV[] = { |
250 | // AnEV( "HOME=" ), -> SPECIAL | 250 | // AnEV( "HOME=" ), -> SPECIAL |
251 | // AnEV( "LOGNAME=" ), -> SPECIAL | 251 | // AnEV( "LOGNAME=" ), -> SPECIAL |
252 | AnEV( "USER=" ), | 252 | AnEV( "USER=" ), |
253 | AnEV( "LD_LIBRARY_PATH=" ), | 253 | AnEV( "LD_LIBRARY_PATH=" ), |
254 | AnEV( "PATH=" ), | 254 | AnEV( "PATH=" ), |
255 | AnEV( "QTDIR=" ), | 255 | AnEV( "QTDIR=" ), |
256 | AnEV( "OPIEDIR=" ), | 256 | AnEV( "OPIEDIR=" ), |
257 | AnEV( "SHELL=" ), | 257 | AnEV( "SHELL=" ), |
258 | { NULL, 0 } | 258 | { NULL, 0 } |
259 | }; | 259 | }; |
260 | 260 | ||
261 | void TheNSResources::detectCurrentUser( void ) { | 261 | void TheNSResources::detectCurrentUser( void ) { |
262 | // find current running qpe | 262 | // find current running qpe |
263 | QString QPEEnvFile = ""; | 263 | QString QPEEnvFile = ""; |
264 | 264 | ||
265 | // open proc dir and find all dirs in it | 265 | // open proc dir and find all dirs in it |
266 | { QRegExp R("[0-9]+"); | 266 | { QRegExp R("[0-9]+"); |
267 | QDir ProcDir( "/proc" ); | 267 | QDir ProcDir( "/proc" ); |
268 | QString QPELoc = QPEApplication::qpeDir() + "bin/qpe"; | 268 | QString QPELoc = QPEApplication::qpeDir() + "bin/qpe"; |
269 | QFileInfo FI; | 269 | QFileInfo FI; |
270 | QStringList EL = ProcDir.entryList( QDir::Dirs ); | 270 | QStringList EL = ProcDir.entryList( QDir::Dirs ); |
271 | 271 | ||
272 | // print it out | 272 | // print it out |
273 | for ( QStringList::Iterator it = EL.begin(); | 273 | for ( QStringList::Iterator it = EL.begin(); |
274 | it != EL.end(); | 274 | it != EL.end(); |
275 | ++it ) { | 275 | ++it ) { |
276 | if( R.match( (*it) ) >= 0 ) { | 276 | if( R.match( (*it) ) >= 0 ) { |
277 | QString S = ProcDir.path()+"/"+ (*it); | 277 | QString S = ProcDir.path()+"/"+ (*it); |
278 | S.append( "/exe" ); | 278 | S.append( "/exe" ); |
279 | FI.setFile( S ); | 279 | FI.setFile( S ); |
280 | // get the linke | 280 | // get the linke |
281 | S = FI.readLink(); | 281 | S = FI.readLink(); |
282 | if( S == QPELoc ) { | 282 | if( S == QPELoc ) { |
283 | // found running qpe | 283 | // found running qpe |
284 | QPEEnvFile.sprintf( ProcDir.path()+ "/" + (*it) + "/environ" ); | 284 | QPEEnvFile.sprintf( ProcDir.path()+ "/" + (*it) + "/environ" ); |
285 | break; | 285 | break; |
286 | } | 286 | } |
287 | } | 287 | } |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
291 | if( QPEEnvFile.isEmpty() ) { | 291 | if( QPEEnvFile.isEmpty() ) { |
292 | // could not find qpe | 292 | // could not find qpe |
293 | fprintf( stderr, "Could not find qpe\n" ); | 293 | fprintf( stderr, "Could not find qpe\n" ); |
294 | return; | 294 | return; |
295 | } | 295 | } |
296 | 296 | ||
297 | // FI now contains path ProcDir to the cmd dir | 297 | // FI now contains path ProcDir to the cmd dir |
298 | { char * Buf = 0; | 298 | { char * Buf = 0; |
299 | char TB[1024]; | 299 | char TB[1024]; |
300 | long BufSize = 0; | 300 | long BufSize = 0; |
301 | int fd; | 301 | int fd; |
302 | int rd; | 302 | int rd; |
303 | 303 | ||
304 | fd = open( QPEEnvFile.latin1(), O_RDONLY ); | 304 | fd = open( QPEEnvFile.latin1(), O_RDONLY ); |
305 | if( fd < 0 ) { | 305 | if( fd < 0 ) { |
306 | fprintf( stderr, "Could not open %s : %d\n", | 306 | fprintf( stderr, "Could not open %s : %d\n", |
307 | QPEEnvFile.latin1(), errno ); | 307 | QPEEnvFile.latin1(), errno ); |
308 | return; | 308 | return; |
309 | } | 309 | } |
310 | 310 | ||
311 | while( (rd = read( fd, TB, sizeof(TB) ) ) > 0 ) { | 311 | while( (rd = read( fd, TB, sizeof(TB) ) ) > 0 ) { |
312 | Buf = (char *)realloc( Buf, BufSize+rd ); | 312 | Buf = (char *)realloc( Buf, BufSize+rd ); |
313 | memcpy( Buf+BufSize, TB, rd ); | 313 | memcpy( Buf+BufSize, TB, rd ); |
314 | BufSize += rd; | 314 | BufSize += rd; |
315 | } | 315 | } |
316 | 316 | ||
317 | char * Data = Buf; | 317 | char * Data = Buf; |
318 | char * DataEnd = Data+BufSize-1; | 318 | char * DataEnd = Data+BufSize-1; |
319 | 319 | ||
320 | // get env items out of list | 320 | // get env items out of list |
321 | while( Data < DataEnd ) { | 321 | while( Data < DataEnd ) { |
322 | if( strncmp( Data, "LOGNAME=", 8 ) == 0 ) { | 322 | if( strncmp( Data, "LOGNAME=", 8 ) == 0 ) { |
323 | CurrentUser.UserName = Data+8; | 323 | CurrentUser.UserName = Data+8; |
324 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); | 324 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); |
325 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = | 325 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = |
326 | strdup( Data ); | 326 | strdup( Data ); |
327 | } else if( strncmp( Data, "HOME=", 5 ) == 0 ) { | 327 | } else if( strncmp( Data, "HOME=", 5 ) == 0 ) { |
328 | CurrentUser.HomeDir = Data+5; | 328 | CurrentUser.HomeDir = Data+5; |
329 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); | 329 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); |
330 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = | 330 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = |
331 | strdup( Data ); | 331 | strdup( Data ); |
332 | } else { | 332 | } else { |
333 | EnvVar_t * Run = EV; | 333 | EnvVar_t * Run = EV; |
334 | while( Run->Name ) { | 334 | while( Run->Name ) { |
335 | if( strncmp( Data, Run->Name, Run->Len ) == 0 ) { | 335 | if( strncmp( Data, Run->Name, Run->Len ) == 0 ) { |
336 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); | 336 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); |
337 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = | 337 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = |
338 | strdup( Data ); | 338 | strdup( Data ); |
339 | break; | 339 | break; |
340 | } | 340 | } |
341 | Run ++; | 341 | Run ++; |
342 | } | 342 | } |
343 | } | 343 | } |
344 | 344 | ||
345 | Data += strlen( Data )+1; | 345 | Data += strlen( Data )+1; |
346 | } | 346 | } |
347 | 347 | ||
348 | free( Buf ); | 348 | free( Buf ); |
349 | 349 | ||
350 | if( ! CurrentUser.UserName.isEmpty() ) { | 350 | if( ! CurrentUser.UserName.isEmpty() ) { |
351 | // find user info | 351 | // find user info |
352 | struct passwd pwd; | 352 | struct passwd pwd; |
353 | struct passwd * pwdres; | 353 | struct passwd * pwdres; |
354 | 354 | ||
355 | if( getpwnam_r( CurrentUser.UserName.latin1(), | 355 | if( getpwnam_r( CurrentUser.UserName.latin1(), |
356 | &pwd, TB, sizeof(TB), &pwdres ) || | 356 | &pwd, TB, sizeof(TB), &pwdres ) || |
357 | pwdres == 0 ) { | 357 | pwdres == 0 ) { |
358 | fprintf( stderr, "Could not determine user %s : %d\n", | 358 | fprintf( stderr, "Could not determine user %s : %d\n", |
359 | CurrentUser.UserName.latin1(), errno ); | 359 | CurrentUser.UserName.latin1(), errno ); |
360 | return; | 360 | return; |
361 | } | 361 | } |
362 | CurrentUser.Uid = pwd.pw_uid; | 362 | CurrentUser.Uid = pwd.pw_uid; |
363 | CurrentUser.Gid = pwd.pw_gid; | 363 | CurrentUser.Gid = pwd.pw_gid; |
364 | } else{ | 364 | } else{ |
365 | CurrentUser.Uid = | 365 | CurrentUser.Uid = |
366 | CurrentUser.Gid = -1; | 366 | CurrentUser.Gid = -1; |
367 | } | 367 | } |
368 | } | 368 | } |
369 | } | 369 | } |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.h b/noncore/settings/networksettings2/networksettings2/resources.h index 7050f10..3d6a44f 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.h +++ b/noncore/settings/networksettings2/networksettings2/resources.h | |||
@@ -1,128 +1,128 @@ | |||
1 | #ifndef __RESOURCES__H | 1 | #ifndef __RESOURCES__H |
2 | #define __RESOURCES__H | 2 | #define __RESOURCES__H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qdict.h> | 5 | #include <qdict.h> |
6 | #include <qmap.h> | 6 | #include <qmap.h> |
7 | #include <qlist.h> | 7 | #include <qlist.h> |
8 | #include "netnode.h" | 8 | #include "netnode.h" |
9 | #include "systemfile.h" | 9 | #include "systemfile.h" |
10 | #include "system.h" | 10 | #include "system.h" |
11 | 11 | ||
12 | class QLibrary; | 12 | class QLibrary; |
13 | class QPixmap; | 13 | class QPixmap; |
14 | class ANetNode; | 14 | class ANetNode; |
15 | class ANetNodeInstance; | 15 | class ANetNodeInstance; |
16 | 16 | ||
17 | typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN ); | 17 | typedef void (*GetNetNodeListFt_t)(QList<ANetNode>& PNN ); |
18 | 18 | ||
19 | typedef struct NetNode_S { | 19 | typedef struct NetNode_S { |
20 | ANetNode * NetNode; | 20 | ANetNode * NetNode; |
21 | QLibrary * TheLibrary; | 21 | QLibrary * TheLibrary; |
22 | long NodeCountInLib; | 22 | long NodeCountInLib; |
23 | } NetNode_t; | 23 | } NetNode_t; |
24 | 24 | ||
25 | class CurrentQPEUser { | 25 | class CurrentQPEUser { |
26 | 26 | ||
27 | public : | 27 | public : |
28 | CurrentQPEUser() : UserName(), HomeDir(), EnvList() {} | 28 | CurrentQPEUser() : UserName(), HomeDir(), EnvList() {} |
29 | 29 | ||
30 | QString UserName; | 30 | QString UserName; |
31 | QString HomeDir; | 31 | QString HomeDir; |
32 | int Uid; | 32 | int Uid; |
33 | int Gid; | 33 | int Gid; |
34 | QArray<char *> EnvList; | 34 | QArray<char *> EnvList; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | typedef QDict<NetNode_t> Name2NetNode_t; | 37 | typedef QDict<NetNode_t> Name2NetNode_t; |
38 | typedef QDict<ANetNodeInstance > Name2Instance_t; | 38 | typedef QDict<ANetNodeInstance > Name2Instance_t; |
39 | typedef QDict<NodeCollection> Name2Connection_t; | 39 | typedef QDict<NodeCollection> Name2Connection_t; |
40 | typedef QDict<SystemFile> Name2SystemFile_t; | 40 | typedef QDict<SystemFile> Name2SystemFile_t; |
41 | 41 | ||
42 | class TheNSResources { | 42 | class TheNSResources { |
43 | 43 | ||
44 | public : | 44 | public : |
45 | 45 | ||
46 | TheNSResources( void ); | 46 | TheNSResources( void ); |
47 | ~TheNSResources( ); | 47 | ~TheNSResources( ); |
48 | 48 | ||
49 | System & system() | 49 | System & system() |
50 | { return *TheSystem; } | 50 | { return *TheSystem; } |
51 | 51 | ||
52 | QPixmap getPixmap( const QString & Name ); | 52 | QPixmap getPixmap( const QString & Name ); |
53 | 53 | ||
54 | Name2NetNode_t & netNodes( void ) | 54 | Name2NetNode_t & netNodes( void ) |
55 | { return AllNodeTypes; } | 55 | { return AllNodeTypes; } |
56 | bool netNodeExists( const QString & X ) | 56 | bool netNodeExists( const QString & X ) |
57 | { return AllNodeTypes.find(X)!=0; } | 57 | { return AllNodeTypes.find(X)!=0; } |
58 | ANetNode * findNetNode( const QString & N ) | 58 | ANetNode * findNetNode( const QString & N ) |
59 | { NetNode_t * NNT = AllNodeTypes.find(N); | 59 | { NetNode_t * NNT = AllNodeTypes.find(N); |
60 | return (NNT) ? NNT->NetNode : 0; | 60 | return (NNT) ? NNT->NetNode : 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | Name2SystemFile_t & systemFiles( void ) | 63 | Name2SystemFile_t & systemFiles( void ) |
64 | { return SystemFiles; } | 64 | { return SystemFiles; } |
65 | void addSystemFile( SystemFile * SF ) | 65 | void addSystemFile( SystemFile * SF ) |
66 | { SystemFiles.insert( SF->name(), SF ); } | 66 | { SystemFiles.insert( SF->name(), SF ); } |
67 | 67 | ||
68 | ANetNodeInstance * createNodeInstance( const QString & S ) | 68 | ANetNodeInstance * createNodeInstance( const QString & S ) |
69 | { ANetNodeInstance * NNI = 0; | 69 | { ANetNodeInstance * NNI = 0; |
70 | NetNode_t * NNT = AllNodeTypes[S]; | 70 | NetNode_t * NNT = AllNodeTypes[S]; |
71 | if( ! NNT ) { | 71 | if( ! NNT ) { |
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
74 | NNI = NNT->NetNode->createInstance(); | 74 | NNI = NNT->NetNode->createInstance(); |
75 | NNI->initialize(); | 75 | NNI->initialize(); |
76 | return NNI; | 76 | return NNI; |
77 | } | 77 | } |
78 | 78 | ||
79 | Name2Instance_t & netNodeInstances( void ) | 79 | Name2Instance_t & netNodeInstances( void ) |
80 | { return AllNodes; } | 80 | { return AllNodes; } |
81 | void addNodeInstance( ANetNodeInstance * I ) | 81 | void addNodeInstance( ANetNodeInstance * I ) |
82 | { AllNodes.insert( I->nodeName(), I ); } | 82 | { AllNodes.insert( I->name(), I ); } |
83 | void removeNodeInstance( const QString & N ) | 83 | void removeNodeInstance( const QString & N ) |
84 | { AllNodes.remove( N );} | 84 | { AllNodes.remove( N );} |
85 | ANetNodeInstance * findNodeInstance( const QString & S ) | 85 | ANetNodeInstance * findNodeInstance( const QString & S ) |
86 | { return (AllNodes.find(S)!=0) ? AllNodes[S] : 0; } | 86 | { return (AllNodes.find(S)!=0) ? AllNodes[S] : 0; } |
87 | 87 | ||
88 | const QString & netNode2Name( const char * Type ); | 88 | const QString & netNode2Name( const char * Type ); |
89 | const QString & netNode2Description( const char * Type ); | 89 | const QString & netNode2Description( const char * Type ); |
90 | 90 | ||
91 | void renumberConnections( void ); | 91 | void renumberConnections( void ); |
92 | void addConnection( NodeCollection * NC ); | 92 | void addConnection( NodeCollection * NC ); |
93 | void removeConnection( const QString & N ); | 93 | void removeConnection( const QString & N ); |
94 | NodeCollection * findConnection( const QString & N ); | 94 | NodeCollection * findConnection( const QString & N ); |
95 | Name2Connection_t & connections( void ) | 95 | Name2Connection_t & connections( void ) |
96 | { return ConnectionsMap; } | 96 | { return ConnectionsMap; } |
97 | 97 | ||
98 | CurrentQPEUser & currentUser( void ) | 98 | CurrentQPEUser & currentUser( void ) |
99 | { return CurrentUser; } | 99 | { return CurrentUser; } |
100 | 100 | ||
101 | private : | 101 | private : |
102 | 102 | ||
103 | void detectCurrentUser( void ); | 103 | void detectCurrentUser( void ); |
104 | QString tr( const char * path ); | 104 | QString tr( const char * path ); |
105 | void findAvailableNetNodes( const QString &path ); | 105 | void findAvailableNetNodes( const QString &path ); |
106 | bool loadNetNode( | 106 | bool loadNetNode( |
107 | const QString &pluginFileName, | 107 | const QString &pluginFileName, |
108 | const QString &resolveString = "create_plugin"); | 108 | const QString &resolveString = "create_plugin"); |
109 | 109 | ||
110 | QMap< QString, QString> NodeTypeNameMap; | 110 | QMap< QString, QString> NodeTypeNameMap; |
111 | QMap< QString, QString> NodeTypeDescriptionMap; | 111 | QMap< QString, QString> NodeTypeDescriptionMap; |
112 | Name2Connection_t ConnectionsMap; | 112 | Name2Connection_t ConnectionsMap; |
113 | System * TheSystem; | 113 | System * TheSystem; |
114 | Name2SystemFile_t SystemFiles; | 114 | Name2SystemFile_t SystemFiles; |
115 | 115 | ||
116 | // all node type classes | 116 | // all node type classes |
117 | Name2NetNode_t AllNodeTypes; | 117 | Name2NetNode_t AllNodeTypes; |
118 | 118 | ||
119 | // all nodes | 119 | // all nodes |
120 | Name2Instance_t AllNodes; | 120 | Name2Instance_t AllNodes; |
121 | 121 | ||
122 | CurrentQPEUser CurrentUser; | 122 | CurrentQPEUser CurrentUser; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | extern TheNSResources * _NSResources; | 125 | extern TheNSResources * _NSResources; |
126 | #define NSResources _NSResources | 126 | #define NSResources _NSResources |
127 | 127 | ||
128 | #endif | 128 | #endif |
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.cpp b/noncore/settings/networksettings2/networksettings2/systemfile.cpp index 62bb6af..b3fc1a5 100644 --- a/noncore/settings/networksettings2/networksettings2/systemfile.cpp +++ b/noncore/settings/networksettings2/networksettings2/systemfile.cpp | |||
@@ -1,185 +1,185 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qfileinfo.h> | 3 | #include <qfileinfo.h> |
4 | #include <qmessagebox.h> | 4 | #include <qmessagebox.h> |
5 | #include <qfile.h> | 5 | #include <qfile.h> |
6 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
7 | 7 | ||
8 | #include "resources.h" | 8 | #include "resources.h" |
9 | #include "systemfile.h" | 9 | #include "systemfile.h" |
10 | 10 | ||
11 | #define TEMPLATEDIR "networktemplates/" | 11 | #define TEMPLATEDIR "networktemplates/" |
12 | QString TemplDir; | 12 | QString TemplDir; |
13 | 13 | ||
14 | SystemFile::SystemFile( const QString & N, const QString & P ){ | 14 | SystemFile::SystemFile( const QString & N, const QString & P ){ |
15 | Name = N; | 15 | Name = N; |
16 | Path = P; | 16 | Path = P; |
17 | F = 0; | 17 | F = 0; |
18 | // get template info | 18 | // get template info |
19 | { QString S; | 19 | { QString S; |
20 | QFileInfo FI; | 20 | QFileInfo FI; |
21 | 21 | ||
22 | // find location of templates | 22 | // find location of templates |
23 | TemplDir = QPEApplication::qpeDir() + "etc/" + TEMPLATEDIR; | 23 | TemplDir = QPEApplication::qpeDir() + "etc/" + TEMPLATEDIR; |
24 | FI.setFile( TemplDir ); | 24 | FI.setFile( TemplDir ); |
25 | if( ! FI.isDir() ) { | 25 | if( ! FI.isDir() ) { |
26 | // try current dir | 26 | // try current dir |
27 | TemplDir = "./" TEMPLATEDIR; | 27 | TemplDir = "./" TEMPLATEDIR; |
28 | FI.setFile( TemplDir ); | 28 | FI.setFile( TemplDir ); |
29 | if( ! FI.isDir() ) { | 29 | if( ! FI.isDir() ) { |
30 | hasPreSection = | 30 | hasPreSection = |
31 | hasPostSection = | 31 | hasPostSection = |
32 | hasPreNodeSection = | 32 | hasPreNodeSection = |
33 | hasPostNodeSection = | 33 | hasPostNodeSection = |
34 | hasPreDeviceSection = | 34 | hasPreDeviceSection = |
35 | hasPostDeviceSection = 0; | 35 | hasPostDeviceSection = 0; |
36 | return; | 36 | return; |
37 | } | 37 | } |
38 | } | 38 | } |
39 | 39 | ||
40 | // have found location | 40 | // have found location |
41 | S = TemplDir + Name + "/presection"; | 41 | S = TemplDir + Name + "/presection"; |
42 | FI.setFile( S ); | 42 | FI.setFile( S ); |
43 | hasPreSection = ( FI.exists() && FI.isReadable() ); | 43 | hasPreSection = ( FI.exists() && FI.isReadable() ); |
44 | S = TemplDir + Name + "/postsection"; | 44 | S = TemplDir + Name + "/postsection"; |
45 | FI.setFile( S ); | 45 | FI.setFile( S ); |
46 | hasPostSection = ( FI.exists() && FI.isReadable() ); | 46 | hasPostSection = ( FI.exists() && FI.isReadable() ); |
47 | S = TemplDir + Name + "/prenodesection"; | 47 | S = TemplDir + Name + "/prenodesection"; |
48 | FI.setFile( S ); | 48 | FI.setFile( S ); |
49 | hasPreNodeSection = ( FI.exists() && FI.isReadable() ); | 49 | hasPreNodeSection = ( FI.exists() && FI.isReadable() ); |
50 | S = TemplDir + Name + "/postnodesection"; | 50 | S = TemplDir + Name + "/postnodesection"; |
51 | FI.setFile( S ); | 51 | FI.setFile( S ); |
52 | hasPostNodeSection = ( FI.exists() && FI.isReadable() ); | 52 | hasPostNodeSection = ( FI.exists() && FI.isReadable() ); |
53 | S = TemplDir + Name + "/predevicesection"; | 53 | S = TemplDir + Name + "/predevicesection"; |
54 | FI.setFile( S ); | 54 | FI.setFile( S ); |
55 | hasPreDeviceSection = ( FI.exists() && FI.isReadable() ); | 55 | hasPreDeviceSection = ( FI.exists() && FI.isReadable() ); |
56 | S = TemplDir + Name + "/postdevicesection"; | 56 | S = TemplDir + Name + "/postdevicesection"; |
57 | FI.setFile( S ); | 57 | FI.setFile( S ); |
58 | hasPostDeviceSection = ( FI.exists() && FI.isReadable() ); | 58 | hasPostDeviceSection = ( FI.exists() && FI.isReadable() ); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | SystemFile::~SystemFile( void ) { | 62 | SystemFile::~SystemFile( void ) { |
63 | if( F ) | 63 | if( F ) |
64 | delete F; | 64 | delete F; |
65 | } | 65 | } |
66 | 66 | ||
67 | bool SystemFile::open( void ) { | 67 | bool SystemFile::open( void ) { |
68 | if( F ) { | 68 | if( F ) { |
69 | F->close(); | 69 | F->close(); |
70 | delete F; | 70 | delete F; |
71 | } | 71 | } |
72 | 72 | ||
73 | F = new QFile( Path + "bup" ); | 73 | F = new QFile( Path + "bup" ); |
74 | if( ! F->open( IO_WriteOnly ) ) { | 74 | if( ! F->open( IO_WriteOnly ) ) { |
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | setDevice( F ); | 77 | setDevice( F ); |
78 | return 1; | 78 | return 1; |
79 | } | 79 | } |
80 | 80 | ||
81 | bool SystemFile::close( void ) { | 81 | bool SystemFile::close( void ) { |
82 | if( ! F ) { | 82 | if( ! F ) { |
83 | return 1 ; | 83 | return 1 ; |
84 | } | 84 | } |
85 | 85 | ||
86 | QString OldP = Path + "bup"; | 86 | QString OldP = Path + "bup"; |
87 | 87 | ||
88 | F->close(); | 88 | F->close(); |
89 | delete F; | 89 | delete F; |
90 | F = 0; | 90 | F = 0; |
91 | 91 | ||
92 | return ( rename( OldP.latin1(), Path.latin1() ) >= 0 ); | 92 | return ( rename( OldP.latin1(), Path.latin1() ) >= 0 ); |
93 | } | 93 | } |
94 | 94 | ||
95 | bool SystemFile::preSection( void ) { | 95 | bool SystemFile::preSection( void ) { |
96 | if( hasPreSection ) { | 96 | if( hasPreSection ) { |
97 | QFile Fl( TemplDir + Name + "/presection" ); | 97 | QFile Fl( TemplDir + Name + "/presection" ); |
98 | if( ! Fl.open( IO_ReadOnly ) ) | 98 | if( ! Fl.open( IO_ReadOnly ) ) |
99 | return 1; // error | 99 | return 1; // error |
100 | // copy file to this file | 100 | // copy file to this file |
101 | F->writeBlock( Fl.readAll() ); | 101 | F->writeBlock( Fl.readAll() ); |
102 | } | 102 | } |
103 | return 0; | 103 | return 0; |
104 | } | 104 | } |
105 | 105 | ||
106 | bool SystemFile::postSection( void ) { | 106 | bool SystemFile::postSection( void ) { |
107 | if( hasPostSection ) { | 107 | if( hasPostSection ) { |
108 | QFile Fl( TemplDir + Name + "/postsection" ); | 108 | QFile Fl( TemplDir + Name + "/postsection" ); |
109 | if( ! Fl.open( IO_ReadOnly ) ) | 109 | if( ! Fl.open( IO_ReadOnly ) ) |
110 | return 1; // error | 110 | return 1; // error |
111 | // copy file to this file | 111 | // copy file to this file |
112 | F->writeBlock( Fl.readAll() ); | 112 | F->writeBlock( Fl.readAll() ); |
113 | } | 113 | } |
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
116 | 116 | ||
117 | bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { | 117 | bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { |
118 | if( hasPreNodeSection ) { | 118 | if( hasPreNodeSection ) { |
119 | QFile Fl( TemplDir + Name + "/prenodesection" ); | 119 | QFile Fl( TemplDir + Name + "/prenodesection" ); |
120 | if( ! Fl.open( IO_ReadOnly ) ) | 120 | if( ! Fl.open( IO_ReadOnly ) ) |
121 | return 1; // error | 121 | return 1; // error |
122 | QTextStream TX( &Fl ); | 122 | QTextStream TX( &Fl ); |
123 | QString Out; | 123 | QString Out; |
124 | QString S = TX.readLine(); | 124 | QString S = TX.readLine(); |
125 | while( ! TX.eof() ) { | 125 | while( ! TX.eof() ) { |
126 | Out = S. | 126 | Out = S. |
127 | arg(NNI->nodeClass()->nodeName()); | 127 | arg(NNI->nodeClass()->name()); |
128 | (*this) << Out << endl; | 128 | (*this) << Out << endl; |
129 | S = TX.readLine(); | 129 | S = TX.readLine(); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
134 | 134 | ||
135 | bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) { | 135 | bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) { |
136 | if( hasPostNodeSection ) { | 136 | if( hasPostNodeSection ) { |
137 | QFile Fl( TemplDir + Name + "/postnodesection" ); | 137 | QFile Fl( TemplDir + Name + "/postnodesection" ); |
138 | if( ! Fl.open( IO_ReadOnly ) ) | 138 | if( ! Fl.open( IO_ReadOnly ) ) |
139 | return 1; // error | 139 | return 1; // error |
140 | QTextStream TX( &Fl ); | 140 | QTextStream TX( &Fl ); |
141 | QString Out; | 141 | QString Out; |
142 | QString S = TX.readLine(); | 142 | QString S = TX.readLine(); |
143 | while( ! TX.eof() ) { | 143 | while( ! TX.eof() ) { |
144 | Out = S. | 144 | Out = S. |
145 | arg(NNI->nodeName()); | 145 | arg(NNI->name()); |
146 | (*this) << Out << endl; | 146 | (*this) << Out << endl; |
147 | S = TX.readLine(); | 147 | S = TX.readLine(); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | return 0; | 150 | return 0; |
151 | } | 151 | } |
152 | 152 | ||
153 | bool SystemFile::preDeviceSection( ANetNode * NN ) { | 153 | bool SystemFile::preDeviceSection( ANetNode * NN ) { |
154 | if( hasPreDeviceSection ) { | 154 | if( hasPreDeviceSection ) { |
155 | QFile Fl( TemplDir + Name + "/predevicesection" ); | 155 | QFile Fl( TemplDir + Name + "/predevicesection" ); |
156 | if( ! Fl.open( IO_ReadOnly ) ) | 156 | if( ! Fl.open( IO_ReadOnly ) ) |
157 | return 1; // error | 157 | return 1; // error |
158 | QTextStream TX( &Fl ); | 158 | QTextStream TX( &Fl ); |
159 | QString Out; | 159 | QString Out; |
160 | QString S = TX.readLine(); | 160 | QString S = TX.readLine(); |
161 | while( ! TX.eof() ) { | 161 | while( ! TX.eof() ) { |
162 | Out = S.arg(NN->nodeName()); | 162 | Out = S.arg(NN->name()); |
163 | (*this) << Out << endl; | 163 | (*this) << Out << endl; |
164 | S = TX.readLine(); | 164 | S = TX.readLine(); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | return 0; | 167 | return 0; |
168 | } | 168 | } |
169 | 169 | ||
170 | bool SystemFile::postDeviceSection( ANetNode * NN ) { | 170 | bool SystemFile::postDeviceSection( ANetNode * NN ) { |
171 | if( hasPostDeviceSection ) { | 171 | if( hasPostDeviceSection ) { |
172 | QFile Fl( TemplDir + Name + "/postdevicesection" ); | 172 | QFile Fl( TemplDir + Name + "/postdevicesection" ); |
173 | if( ! Fl.open( IO_ReadOnly ) ) | 173 | if( ! Fl.open( IO_ReadOnly ) ) |
174 | return 1; // error | 174 | return 1; // error |
175 | QTextStream TX( &Fl ); | 175 | QTextStream TX( &Fl ); |
176 | QString Out; | 176 | QString Out; |
177 | QString S = TX.readLine(); | 177 | QString S = TX.readLine(); |
178 | while( ! TX.eof() ) { | 178 | while( ! TX.eof() ) { |
179 | Out = S.arg(NN->nodeName()); | 179 | Out = S.arg(NN->name()); |
180 | (*this) << Out << endl; | 180 | (*this) << Out << endl; |
181 | S = TX.readLine(); | 181 | S = TX.readLine(); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | return 0; | 184 | return 0; |
185 | } | 185 | } |
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index 13979ce..64b83f7 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -1,579 +1,582 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <qdir.h> | 4 | #include <qdir.h> |
5 | #include <qfile.h> | 5 | #include <qfile.h> |
6 | #include <qfileinfo.h> | 6 | #include <qfileinfo.h> |
7 | 7 | ||
8 | #include "nsdata.h" | 8 | #include "nsdata.h" |
9 | #include <asdevice.h> | 9 | #include <asdevice.h> |
10 | #include <resources.h> | 10 | #include <resources.h> |
11 | 11 | ||
12 | static QString CfgFile; | 12 | static QString CfgFile; |
13 | 13 | ||
14 | NetworkSettingsData::NetworkSettingsData( void ) { | 14 | NetworkSettingsData::NetworkSettingsData( void ) { |
15 | // init global resources structure | 15 | // init global resources structure |
16 | new TheNSResources(); | 16 | new TheNSResources(); |
17 | 17 | ||
18 | CfgFile.sprintf( "%s/NETCONFIG", | 18 | CfgFile.sprintf( "%s/Settings/NS2.conf", |
19 | NSResources->currentUser().HomeDir.latin1() ); | 19 | NSResources->currentUser().HomeDir.latin1() ); |
20 | fprintf( stderr, "Cfg from %s\n", CfgFile.latin1() ); | 20 | fprintf( stderr, "Cfg from %s\n", CfgFile.latin1() ); |
21 | 21 | ||
22 | // load settings | 22 | // load settings |
23 | Force = 0; | 23 | Force = 0; |
24 | IsModified = 0; | 24 | IsModified = 0; |
25 | loadSettings(); | 25 | loadSettings(); |
26 | } | 26 | } |
27 | 27 | ||
28 | // saving is done by caller | 28 | // saving is done by caller |
29 | NetworkSettingsData::~NetworkSettingsData( void ) { | 29 | NetworkSettingsData::~NetworkSettingsData( void ) { |
30 | delete NSResources; | 30 | delete NSResources; |
31 | } | 31 | } |
32 | 32 | ||
33 | void NetworkSettingsData::loadSettings( void ) { | 33 | void NetworkSettingsData::loadSettings( void ) { |
34 | QString Line, S; | 34 | QString Line, S; |
35 | QString Attr, Value; | 35 | QString Attr, Value; |
36 | long idx; | 36 | long idx; |
37 | 37 | ||
38 | QFile F( CfgFile ); | 38 | QFile F( CfgFile ); |
39 | QTextStream TS( &F ); | 39 | QTextStream TS( &F ); |
40 | 40 | ||
41 | do { | 41 | do { |
42 | 42 | ||
43 | if( ! F.open(IO_ReadOnly) ) | 43 | if( ! F.open(IO_ReadOnly) ) |
44 | break; | 44 | break; |
45 | 45 | ||
46 | /* load the file -> | 46 | /* load the file -> |
47 | 47 | ||
48 | FORMAT : | 48 | FORMAT : |
49 | 49 | ||
50 | [NETNODETYPE] | 50 | [NETNODETYPE] |
51 | Entries ... | 51 | Entries ... |
52 | <EMPTYLINE> | 52 | <EMPTYLINE> |
53 | [connection] | 53 | [connection] |
54 | Name=Name | 54 | Name=Name |
55 | Node=Name | 55 | Node=Name |
56 | <EMPTYLINE> | 56 | <EMPTYLINE> |
57 | */ | 57 | */ |
58 | while( ! TS.atEnd() ) { | 58 | while( ! TS.atEnd() ) { |
59 | S = Line = TS.readLine(); | 59 | S = Line = TS.readLine(); |
60 | 60 | ||
61 | if ( S.isEmpty() || S[0] != '[' ) | 61 | if ( S.isEmpty() || S[0] != '[' ) |
62 | continue; | 62 | continue; |
63 | 63 | ||
64 | S = S.mid( 1, S.length()-2 ); | 64 | S = S.mid( 1, S.length()-2 ); |
65 | 65 | ||
66 | if( ! NSResources ) { | 66 | if( ! NSResources ) { |
67 | continue; | 67 | continue; |
68 | } | 68 | } |
69 | 69 | ||
70 | if( S == "connection" ) { | 70 | if( S == "connection" ) { |
71 | // load connections -> collections of nodes | 71 | // load connections -> collections of nodes |
72 | NodeCollection * NC = new NodeCollection( TS ); | 72 | NodeCollection * NC = new NodeCollection( TS ); |
73 | NSResources->addConnection( NC ); | 73 | NSResources->addConnection( NC ); |
74 | } else { | 74 | } else { |
75 | ANetNode * NN = 0; | 75 | ANetNode * NN = 0; |
76 | ANetNodeInstance* NNI = 0; | 76 | ANetNodeInstance* NNI = 0; |
77 | if( S.startsWith( "nodetype " ) ) { | 77 | if( S.startsWith( "nodetype " ) ) { |
78 | S = S.mid( 9, S.length()-9-1 ); | 78 | S = S.mid( 9, S.length()-9 ); |
79 | fprintf( stderr, "Node %s\n", S.latin1() ); | 79 | S = deQuote(S); |
80 | // try to find netnode | 80 | // try to find netnode |
81 | NN = NSResources->findNetNode( S ); | 81 | NN = NSResources->findNetNode( S ); |
82 | fprintf( stderr, "Node %s : %p\n", S.latin1(), NN ); | ||
82 | } else { | 83 | } else { |
83 | // try to find instance | 84 | // try to find instance |
84 | NNI = NSResources->createNodeInstance( S ); | 85 | NNI = NSResources->createNodeInstance( S ); |
86 | fprintf( stderr, "NodeInstance %s : %p\n", S.latin1(), NNI ); | ||
87 | } | ||
88 | |||
89 | if( NN == 0 && NNI == 0 ) { | ||
90 | LeftOvers.append( Line ); | ||
85 | } | 91 | } |
86 | 92 | ||
87 | do { | 93 | do { |
88 | S = TS.readLine(); | 94 | S = Line = TS.readLine(); |
89 | 95 | ||
90 | if( NN || NNI ) { | 96 | if( NN || NNI ) { |
91 | if( S.isEmpty() ) { | 97 | if( S.isEmpty() ) { |
92 | // empty line | 98 | // empty line |
93 | break; | 99 | break; |
94 | } | 100 | } |
95 | idx = S.find( '=' ); | 101 | idx = S.find( '=' ); |
96 | if( idx > 0 ) { | 102 | if( idx > 0 ) { |
97 | Attr = S.left( idx ); | 103 | Attr = S.left( idx ); |
98 | Value = S.mid( idx+1, S.length() ); | 104 | Value = S.mid( idx+1, S.length() ); |
99 | } else { | 105 | } else { |
100 | Value=""; | 106 | Value=""; |
101 | Attr = S; | 107 | Attr = S; |
102 | } | 108 | } |
103 | 109 | ||
104 | Value.stripWhiteSpace(); | 110 | Value.stripWhiteSpace(); |
105 | Attr.stripWhiteSpace(); | 111 | Attr.stripWhiteSpace(); |
106 | Attr.lower(); | 112 | Attr.lower(); |
107 | // dequote Attr | 113 | // dequote Attr |
108 | Value = deQuote(Value); | 114 | Value = deQuote(Value); |
109 | 115 | ||
110 | if( NN ) { | 116 | if( NN ) { |
111 | // set the attribute | 117 | // set the attribute |
112 | NNI->setAttribute( Attr, Value ); | 118 | NN->setAttribute( Attr, Value ); |
113 | } else { | 119 | } else { |
114 | // set the attribute | 120 | // set the attribute |
115 | NNI->setAttribute( Attr, Value ); | 121 | NNI->setAttribute( Attr, Value ); |
116 | } | 122 | } |
117 | } else { | 123 | } else { |
118 | LeftOvers.append( Line ); | 124 | LeftOvers.append( Line ); |
119 | // add empty line too as delimiter | 125 | // add empty line too as delimiter |
120 | if( S.isEmpty() ) { | 126 | if( S.isEmpty() ) { |
121 | // empty line | 127 | // empty line |
122 | break; | 128 | break; |
123 | } | 129 | } |
124 | } | 130 | } |
125 | } while( 1 ); | 131 | } while( 1 ); |
132 | |||
126 | if( NNI ) { | 133 | if( NNI ) { |
127 | // loading from file -> exists | 134 | // loading from file -> exists |
128 | NNI->setNew( FALSE ); | 135 | NNI->setNew( FALSE ); |
129 | NSResources->addNodeInstance( NNI ); | 136 | NSResources->addNodeInstance( NNI ); |
130 | } | 137 | } |
131 | } | 138 | } |
132 | } | 139 | } |
133 | 140 | ||
134 | } while( 0 ); | 141 | } while( 0 ); |
135 | 142 | ||
136 | } | 143 | } |
137 | 144 | ||
138 | QString NetworkSettingsData::saveSettings( void ) { | 145 | QString NetworkSettingsData::saveSettings( void ) { |
139 | QString ErrS = ""; | 146 | QString ErrS = ""; |
140 | 147 | ||
141 | if( ! isModified() ) | 148 | if( ! isModified() ) |
142 | return ErrS; | 149 | return ErrS; |
143 | 150 | ||
144 | QString S; | 151 | QString S; |
145 | QFile F( CfgFile + ".bup" ); | 152 | QFile F( CfgFile + ".bup" ); |
146 | 153 | ||
147 | printf( "Saving settings to %s\n", CfgFile.latin1() ); | 154 | printf( "Saving settings to %s\n", CfgFile.latin1() ); |
148 | if( ! F.open( IO_WriteOnly | IO_Truncate ) ) { | 155 | if( ! F.open( IO_WriteOnly | IO_Truncate ) ) { |
149 | ErrS = qApp->translate( "NetworkSettings", | 156 | ErrS = qApp->translate( "NetworkSettings", |
150 | "<p>Could not save setup to \"%1\" !</p>" ). | 157 | "<p>Could not save setup to \"%1\" !</p>" ). |
151 | arg(CfgFile); | 158 | arg(CfgFile); |
152 | // problem | 159 | // problem |
153 | return ErrS; | 160 | return ErrS; |
154 | } | 161 | } |
155 | 162 | ||
156 | QTextStream TS( &F ); | 163 | QTextStream TS( &F ); |
157 | 164 | ||
158 | // save leftovers | 165 | // save leftovers |
159 | for ( QStringList::Iterator it = LeftOvers.begin(); | 166 | for ( QStringList::Iterator it = LeftOvers.begin(); |
160 | it != LeftOvers.end(); ++it ) { | 167 | it != LeftOvers.end(); ++it ) { |
161 | TS << (*it) << endl; | 168 | TS << (*it) << endl; |
162 | } | 169 | } |
163 | 170 | ||
164 | // save global configs | 171 | // save global configs |
165 | for( QDictIterator<NetNode_t> it( NSResources->netNodes() ); | 172 | for( QDictIterator<NetNode_t> it( NSResources->netNodes() ); |
166 | it.current(); | 173 | it.current(); |
167 | ++it ) { | 174 | ++it ) { |
168 | TS << "[nodetype " | 175 | TS << "[nodetype " |
169 | << it.current()->NetNode->name() | 176 | << quote( QString( it.current()->NetNode->name() ) ) |
170 | << "]" | 177 | << "]" |
171 | << endl; | 178 | << endl; |
172 | 179 | ||
173 | it.current()->NetNode->saveAttributes( TS ); | 180 | it.current()->NetNode->saveAttributes( TS ); |
181 | TS << endl; | ||
174 | } | 182 | } |
175 | 183 | ||
176 | { Name2Connection_t & M = NSResources->connections(); | 184 | { Name2Connection_t & M = NSResources->connections(); |
177 | ANetNodeInstance * NNI; | 185 | ANetNodeInstance * NNI; |
178 | 186 | ||
179 | // for all connections | 187 | // for all connections |
180 | for( QDictIterator<NodeCollection> it(M); | 188 | for( QDictIterator<NodeCollection> it(M); |
181 | it.current(); | 189 | it.current(); |
182 | ++it ) { | 190 | ++it ) { |
183 | // all nodes in those connections | 191 | // all nodes in those connections |
184 | for( QListIterator<ANetNodeInstance> nit(*(it.current())); | 192 | for( QListIterator<ANetNodeInstance> nit(*(it.current())); |
185 | nit.current(); | 193 | nit.current(); |
186 | ++nit ) { | 194 | ++nit ) { |
187 | // header | 195 | // header |
188 | NNI = nit.current(); | 196 | NNI = nit.current(); |
189 | TS << '[' <<NNI->nodeClass()->nodeName() << ']' << endl; | 197 | TS << '[' |
198 | << QString(NNI->nodeClass()->name()) | ||
199 | << ']' | ||
200 | << endl; | ||
190 | NNI->saveAttributes( TS ); | 201 | NNI->saveAttributes( TS ); |
191 | TS << endl; | 202 | TS << endl; |
192 | } | 203 | } |
193 | 204 | ||
194 | TS << "[connection]" << endl; | 205 | TS << "[connection]" << endl; |
195 | it.current()->save(TS); | 206 | it.current()->save(TS); |
196 | } | 207 | } |
197 | } | 208 | } |
198 | 209 | ||
199 | QDir D("."); | 210 | QDir D("."); |
200 | D.rename( CfgFile + ".bup", CfgFile ); | 211 | D.rename( CfgFile + ".bup", CfgFile ); |
201 | 212 | ||
202 | // | 213 | // |
203 | // proper files AND system files regenerated | 214 | // proper files AND system files regenerated |
204 | // | 215 | // |
205 | 216 | ||
206 | setModified( 0 ); | 217 | setModified( 0 ); |
207 | return ErrS; | 218 | return ErrS; |
208 | } | 219 | } |
209 | 220 | ||
210 | QString NetworkSettingsData::generateSettings( bool ForceReq ) { | 221 | QString NetworkSettingsData::generateSettings( bool ForceReq ) { |
211 | bool ForceIt; | 222 | bool ForceIt; |
212 | QString S = ""; | 223 | QString S = ""; |
213 | 224 | ||
214 | // include own force flag | 225 | // include own force flag |
215 | ForceIt = (Force) ? 1 : ForceReq; | 226 | ForceIt = (Force) ? 1 : ForceReq; |
216 | 227 | ||
217 | if( ! ForceIt && ! isModified() ) | 228 | if( ! ForceIt && ! isModified() ) |
218 | return S; | 229 | return S; |
219 | 230 | ||
220 | // regenerate system files | 231 | // regenerate system files |
221 | fprintf( stderr, "Generating settings from %s\n", CfgFile.latin1() ); | 232 | fprintf( stderr, "Generating settings from %s\n", CfgFile.latin1() ); |
222 | 233 | ||
223 | { Name2SystemFile_t & SFM = NSResources->systemFiles(); | 234 | { Name2SystemFile_t & SFM = NSResources->systemFiles(); |
224 | Name2Connection_t & M = NSResources->connections(); | 235 | Name2Connection_t & M = NSResources->connections(); |
225 | NodeCollection * NC; | 236 | NodeCollection * NC; |
226 | ANetNodeInstance * NNI; | 237 | ANetNodeInstance * NNI; |
227 | SystemFile * SF; | 238 | SystemFile * SF; |
228 | AsDevice * CurDev; | 239 | AsDevice * CurDev; |
229 | ANetNode * CurDevNN; | 240 | ANetNode * CurDevNN; |
230 | bool needToRegenerate = ForceIt; | 241 | bool needToRegenerate = ForceIt; |
231 | 242 | ||
232 | // | 243 | // |
233 | // check if we need to generate at least one of the system files | 244 | // check if we need to generate at least one of the system files |
234 | // | 245 | // |
235 | if( ! ForceIt ) { | 246 | if( ! ForceIt ) { |
236 | for( QDictIterator<SystemFile> sfit(SFM); | 247 | for( QDictIterator<SystemFile> sfit(SFM); |
237 | sfit.current(); | 248 | sfit.current(); |
238 | ++sfit ) { | 249 | ++sfit ) { |
239 | SF = sfit.current(); | 250 | SF = sfit.current(); |
240 | 251 | ||
241 | // check if there are nodes that are modified and require | 252 | // check if there are nodes that are modified and require |
242 | // data for this system file | 253 | // data for this system file |
243 | 254 | ||
244 | // for all connections | 255 | // for all connections |
245 | for( QDictIterator<NodeCollection> ncit(M); | 256 | for( QDictIterator<NodeCollection> ncit(M); |
246 | ncit.current(); | 257 | ncit.current(); |
247 | ++ncit ) { | 258 | ++ncit ) { |
248 | NC = ncit.current(); | 259 | NC = ncit.current(); |
249 | 260 | ||
250 | if( NC->isModified() ) { | 261 | if( NC->isModified() ) { |
251 | // does this connection 'touch' this system file ? | 262 | // does this connection 'touch' this system file ? |
252 | for( QListIterator<ANetNodeInstance> cncit(*NC); | 263 | for( QListIterator<ANetNodeInstance> cncit(*NC); |
253 | cncit.current(); | 264 | cncit.current(); |
254 | ++cncit ) { | 265 | ++cncit ) { |
255 | NNI = cncit.current(); | 266 | NNI = cncit.current(); |
256 | if( ( NNI->nodeClass()->hasDataFor( SF->name() ) || | 267 | if( ( NNI->nodeClass()->hasDataFor( SF->name() ) || |
257 | NNI->hasDataFor( SF->name() ) | 268 | NNI->hasDataFor( SF->name() ) |
258 | ) && | 269 | ) && |
259 | NNI->isModified() ) { | 270 | NNI->isModified() ) { |
260 | needToRegenerate = 1; | 271 | needToRegenerate = 1; |
261 | break; | 272 | break; |
262 | } | 273 | } |
263 | } | 274 | } |
264 | } | 275 | } |
265 | if( needToRegenerate ) | 276 | if( needToRegenerate ) |
266 | break; | 277 | break; |
267 | } | 278 | } |
268 | if( needToRegenerate ) | 279 | if( needToRegenerate ) |
269 | break; | 280 | break; |
270 | } | 281 | } |
271 | } | 282 | } |
272 | 283 | ||
273 | // we cannot renumber with a FORCE request since | 284 | // we cannot renumber with a FORCE request since |
274 | // we probably are NOT going to save the config | 285 | // we probably are NOT going to save the config |
275 | // e.g. when using --regen option | 286 | // e.g. when using --regen option |
276 | if( ! ForceReq && needToRegenerate ) { | 287 | if( ! ForceReq && needToRegenerate ) { |
277 | NSResources->renumberConnections(); | 288 | NSResources->renumberConnections(); |
278 | setModified(1); | 289 | setModified(1); |
279 | } | 290 | } |
280 | 291 | ||
281 | // | 292 | // |
282 | // generate files proper to each netnodeinstance | 293 | // generate files proper to each netnodeinstance |
283 | // | 294 | // |
284 | { Name2Instance_t & NNIs = NSResources->netNodeInstances(); | 295 | { Name2Instance_t & NNIs = NSResources->netNodeInstances(); |
285 | 296 | ||
286 | for( QDictIterator<ANetNodeInstance> NNIIt(NNIs); | 297 | for( QDictIterator<ANetNodeInstance> NNIIt(NNIs); |
287 | NNIIt.current(); | 298 | NNIIt.current(); |
288 | ++NNIIt | 299 | ++NNIIt |
289 | ){ | 300 | ){ |
290 | // for all nodes find those that are modified | 301 | // for all nodes find those that are modified |
291 | NNI = NNIIt.current(); | 302 | NNI = NNIIt.current(); |
292 | 303 | ||
293 | if( ForceIt || NNI->isModified() ) { | 304 | if( ForceIt || NNI->isModified() ) { |
294 | if( ! NNI->nodeClass()->generateProperFilesFor( NNI ) ) { | 305 | if( ! NNI->nodeClass()->generateProperFilesFor( NNI ) ) { |
295 | // problem generating | 306 | // problem generating |
296 | S = qApp->translate( "NetworkSettings", | 307 | S = qApp->translate( "NetworkSettings", |
297 | "<p>Cannot generate files proper to \"%1\"</p>" ). | 308 | "<p>Cannot generate files proper to \"%1\"</p>" ). |
298 | arg(NNI->nodeClass()->nodeName()) ; | 309 | arg(NNI->nodeClass()->name()) ; |
299 | return S; | 310 | return S; |
300 | } | 311 | } |
301 | } | 312 | } |
302 | } | 313 | } |
303 | } | 314 | } |
304 | 315 | ||
305 | // | 316 | // |
306 | // generate all system files | 317 | // generate all system files |
307 | // | 318 | // |
308 | for( QDictIterator<SystemFile> sfit(SFM); | 319 | for( QDictIterator<SystemFile> sfit(SFM); |
309 | sfit.current(); | 320 | sfit.current(); |
310 | ++sfit ) { | 321 | ++sfit ) { |
311 | SF = sfit.current(); | 322 | SF = sfit.current(); |
312 | 323 | ||
313 | fprintf( stderr, "Generating %s\n", SF->name().latin1() ); | 324 | fprintf( stderr, "Generating %s\n", SF->name().latin1() ); |
314 | SF->open(); | 325 | SF->open(); |
315 | 326 | ||
316 | do { // so we can break; | 327 | do { // so we can break; |
317 | 328 | ||
318 | // global presection for this system file | 329 | // global presection for this system file |
319 | if( SF->preSection() ) { | 330 | if( SF->preSection() ) { |
320 | S = qApp->translate( "NetworkSettings", | 331 | S = qApp->translate( "NetworkSettings", |
321 | "<p>Error in preSection for file \"%1\"</p>" ). | 332 | "<p>Error in preSection for file \"%1\"</p>" ). |
322 | arg( SF->name() ); | 333 | arg( SF->name() ); |
323 | return S; | 334 | return S; |
324 | } | 335 | } |
325 | 336 | ||
326 | // find all netnodes and figure out if | 337 | // find all netnodes and figure out if |
327 | // for that node there are instances | 338 | // for that node there are instances |
328 | for( QDictIterator<NetNode_t> nnit( | 339 | for( QDictIterator<NetNode_t> nnit( |
329 | NSResources->netNodes() ); | 340 | NSResources->netNodes() ); |
330 | nnit.current(); | 341 | nnit.current(); |
331 | ++nnit ) { | 342 | ++nnit ) { |
332 | 343 | ||
333 | CurDevNN = nnit.current()->NetNode; | 344 | CurDevNN = nnit.current()->NetNode; |
334 | 345 | ||
335 | // are there instances for this netnode ? | 346 | // are there instances for this netnode ? |
336 | NNI = 0; | 347 | NNI = 0; |
337 | for( QDictIterator<ANetNodeInstance> nniit( | 348 | for( QDictIterator<ANetNodeInstance> nniit( |
338 | NSResources->netNodeInstances() ); | 349 | NSResources->netNodeInstances() ); |
339 | nniit.current(); | 350 | nniit.current(); |
340 | ++nniit ) { | 351 | ++nniit ) { |
341 | if( nniit.current()->nodeClass() == CurDevNN ) { | 352 | if( nniit.current()->nodeClass() == CurDevNN ) { |
342 | NNI = nniit.current(); | 353 | NNI = nniit.current(); |
343 | break; | 354 | break; |
344 | } | 355 | } |
345 | } | 356 | } |
346 | 357 | ||
347 | if( ! NNI ) | 358 | if( ! NNI ) |
348 | // no instances -> next netnode type | 359 | // no instances -> next netnode type |
349 | continue; | 360 | continue; |
350 | 361 | ||
351 | // has this node data for this system file ? | 362 | // has this node data for this system file ? |
352 | if( (CurDev = NNI->runtime()->asDevice() ) ) { | 363 | if( (CurDev = NNI->runtime()->asDevice() ) ) { |
353 | // generate start for this nodetype for all possible devices of this type | 364 | // generate start for this nodetype for all possible devices of this type |
354 | for( int i = 0; i < CurDevNN->instanceCount(); i ++ ) { | 365 | for( int i = 0; i < CurDevNN->instanceCount(); i ++ ) { |
355 | S = generateSystemFileNode( *SF, CurDev, NNI, i ); | 366 | S = generateSystemFileNode( *SF, CurDev, NNI, i ); |
356 | if( ! S.isEmpty() ) | 367 | if( ! S.isEmpty() ) |
357 | return S; | 368 | return S; |
358 | } | 369 | } |
359 | } else { | 370 | } else { |
360 | S = generateSystemFileNode( *SF, 0, NNI, -1 ); | 371 | S = generateSystemFileNode( *SF, 0, NNI, -1 ); |
361 | if( ! S.isEmpty() ) | 372 | if( ! S.isEmpty() ) |
362 | return S; | 373 | return S; |
363 | } | 374 | } |
364 | } | 375 | } |
365 | 376 | ||
366 | if( SF->postSection() ) { | 377 | if( SF->postSection() ) { |
367 | S = qApp->translate( "NetworkSettings", | 378 | S = qApp->translate( "NetworkSettings", |
368 | "<p>Error in postSection for file \"%1\"</p>" ). | 379 | "<p>Error in postSection for file \"%1\"</p>" ). |
369 | arg( SF->name() ); | 380 | arg( SF->name() ); |
370 | return S; | 381 | return S; |
371 | } | 382 | } |
372 | 383 | ||
373 | } while( 0 ); | 384 | } while( 0 ); |
374 | SF->close(); | 385 | SF->close(); |
375 | } | 386 | } |
376 | } | 387 | } |
377 | Force = 0; | 388 | Force = 0; |
378 | return S; | 389 | return S; |
379 | } | 390 | } |
380 | 391 | ||
381 | QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interface ) { | 392 | QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interface ) { |
382 | // collect connections that can work on top of this interface | 393 | // collect connections that can work on top of this interface |
383 | NodeCollection * NC; | 394 | NodeCollection * NC; |
384 | QList<NodeCollection> PossibleConnections; | 395 | QList<NodeCollection> PossibleConnections; |
385 | Name2Connection_t & M = NSResources->connections(); | 396 | Name2Connection_t & M = NSResources->connections(); |
386 | 397 | ||
387 | // for all connections | 398 | // for all connections |
388 | for( QDictIterator<NodeCollection> it(M); | 399 | for( QDictIterator<NodeCollection> it(M); |
389 | it.current(); | 400 | it.current(); |
390 | ++it ) { | 401 | ++it ) { |
391 | NC = it.current(); | 402 | NC = it.current(); |
392 | // check if this profile handles the requested interface | 403 | // check if this profile handles the requested interface |
393 | fprintf( stderr, "check %s\n", NC->name().latin1() ); | ||
394 | if( NC->handlesInterface( Interface ) && // if different Intf. | 404 | if( NC->handlesInterface( Interface ) && // if different Intf. |
395 | NC->state() != Disabled && // if not enabled | 405 | NC->state() != Disabled && // if not enabled |
396 | NC->state() != IsUp // if already used | 406 | NC->state() != IsUp // if already used |
397 | ) { | 407 | ) { |
398 | fprintf( stderr, "Append %s\n", NC->name().latin1() ); | 408 | fprintf( stderr, "Append %s for %s\n", NC->name().latin1(), Interface); |
399 | PossibleConnections.append( NC ); | 409 | PossibleConnections.append( NC ); |
400 | } | 410 | } |
401 | } | 411 | } |
402 | return PossibleConnections; | 412 | return PossibleConnections; |
403 | } | 413 | } |
404 | 414 | ||
405 | 415 | ||
406 | /* | 416 | /* |
407 | Called by the system to see if interface can be brought UP | 417 | Called by the system to see if interface can be brought UP |
408 | 418 | ||
409 | if allowed, echo Interface-allowed else Interface-disallowed | 419 | if allowed, echo Interface-allowed else Interface-disallowed |
410 | */ | 420 | */ |
411 | 421 | ||
412 | bool NetworkSettingsData::canStart( const char * Interface ) { | 422 | bool NetworkSettingsData::canStart( const char * Interface ) { |
413 | // load situation | 423 | // load situation |
414 | NodeCollection * NC = 0; | 424 | NodeCollection * NC = 0; |
415 | QList<NodeCollection> PossibleConnections; | 425 | QList<NodeCollection> PossibleConnections; |
416 | 426 | ||
417 | PossibleConnections = collectPossible( Interface ); | 427 | PossibleConnections = collectPossible( Interface ); |
418 | 428 | ||
419 | fprintf( stderr, "Possiblilies %d\n", | 429 | fprintf( stderr, "Possiblilies %d\n", |
420 | PossibleConnections.count() ); | 430 | PossibleConnections.count() ); |
421 | switch( PossibleConnections.count() ) { | 431 | switch( PossibleConnections.count() ) { |
422 | case 0 : // no connections | 432 | case 0 : // no connections |
423 | break; | 433 | break; |
424 | case 1 : // one connection | 434 | case 1 : // one connection |
425 | NC = PossibleConnections.first(); | 435 | NC = PossibleConnections.first(); |
426 | break; | 436 | break; |
427 | default : // need to ask user ? | 437 | default : // need to ask user ? |
428 | return 1; | 438 | return 1; |
429 | } | 439 | } |
430 | 440 | ||
431 | if( NC ) { | 441 | if( NC ) { |
432 | switch( NC->state() ) { | 442 | switch( NC->state() ) { |
433 | case Unchecked : | 443 | case Unchecked : |
434 | case Unknown : | 444 | case Unknown : |
435 | case Unavailable : | 445 | case Unavailable : |
436 | case Disabled : | 446 | case Disabled : |
437 | // this profile does not allow interface to be UP | 447 | // this profile does not allow interface to be UP |
438 | // -> try others | 448 | // -> try others |
439 | break; | 449 | break; |
440 | case Off : | 450 | case Off : |
441 | // try to UP the device | 451 | // try to UP the device |
442 | if( ! NC->setState( Activate ) ) { | 452 | if( ! NC->setState( Activate ) ) { |
443 | // cannot bring device Online -> try other alters | 453 | // cannot bring device Online -> try other alters |
444 | break; | 454 | break; |
445 | } | 455 | } |
446 | // FT | 456 | // FT |
447 | case Available : | 457 | case Available : |
448 | case IsUp : // also called for 'ifdown' | 458 | case IsUp : // also called for 'ifdown' |
449 | // device is ready -> done | 459 | // device is ready -> done |
450 | printf( "%s-c%d-allowed\n", Interface, NC->number() ); | 460 | printf( "%s-c%d-allowed\n", Interface, NC->number() ); |
451 | return 0; | 461 | return 0; |
452 | } | 462 | } |
453 | } | 463 | } |
454 | 464 | ||
455 | // if we come here no alternatives are possible | 465 | // if we come here no alternatives are possible |
456 | printf( "%s-cnn-disallowed\n", Interface ); | 466 | printf( "%s-cnn-disallowed\n", Interface ); |
457 | return 0; | 467 | return 0; |
458 | } | 468 | } |
459 | 469 | ||
460 | /* | 470 | /* |
461 | Called by the system to regenerate config files | 471 | Called by the system to regenerate config files |
462 | */ | 472 | */ |
463 | 473 | ||
464 | bool NetworkSettingsData::regenerate( void ) { | 474 | bool NetworkSettingsData::regenerate( void ) { |
465 | QString S; | 475 | QString S; |
466 | // load situation | 476 | // load situation |
467 | S = generateSettings( TRUE ); | 477 | S = generateSettings( TRUE ); |
468 | if( ! S.isEmpty() ) { | 478 | if( ! S.isEmpty() ) { |
469 | fprintf( stdout, "%s\n", S.latin1() ); | 479 | fprintf( stdout, "%s\n", S.latin1() ); |
470 | return 1; | 480 | return 1; |
471 | } | 481 | } |
472 | return 0; | 482 | return 0; |
473 | } | 483 | } |
474 | 484 | ||
475 | QString NetworkSettingsData::generateSystemFileNode( | 485 | QString NetworkSettingsData::generateSystemFileNode( |
476 | SystemFile &SF, | 486 | SystemFile &SF, |
477 | AsDevice * CurDev, | 487 | AsDevice * CurDev, |
478 | ANetNodeInstance * DevNNI, | 488 | ANetNodeInstance * DevNNI, |
479 | long DevInstNr ) { | 489 | long DevInstNr ) { |
480 | 490 | ||
481 | QString S=""; | 491 | QString S=""; |
482 | ANetNode * CurDevNN = DevNNI->nodeClass(); | 492 | ANetNode * CurDevNN = DevNNI->nodeClass(); |
483 | Name2Connection_t & M = NSResources->connections(); | 493 | Name2Connection_t & M = NSResources->connections(); |
484 | 494 | ||
485 | if( SF.preDeviceSection( CurDevNN ) ) { | 495 | if( SF.preDeviceSection( CurDevNN ) ) { |
486 | S = qApp->translate( "NetworkSettings", | 496 | S = qApp->translate( "NetworkSettings", |
487 | "<p>Error in preDeviceSection for file \"%1\" and nodetype \"%2\"</p>" ). | 497 | "<p>Error in preDeviceSection for file \"%1\" and nodetype \"%2\"</p>" ). |
488 | arg( SF.name() ). | 498 | arg( SF.name() ). |
489 | arg( CurDevNN->nodeName() ); | 499 | arg( CurDevNN->name() ); |
490 | return S; | 500 | return S; |
491 | } | 501 | } |
492 | 502 | ||
493 | if( CurDevNN->hasDataFor( SF.name() ) ) { | 503 | if( CurDevNN->hasDataFor( SF.name() ) ) { |
494 | if( CurDevNN->generateDeviceDataForCommonFile( SF, DevInstNr ) ) { | 504 | if( CurDevNN->generateDeviceDataForCommonFile( SF, DevInstNr ) ) { |
495 | S = qApp->translate( "NetworkSettings", | 505 | S = qApp->translate( "NetworkSettings", |
496 | "<p>Error in node Device part for file \"%1\" and node \"%2\"</p>" ). | 506 | "<p>Error in node Device part for file \"%1\" and node \"%2\"</p>" ). |
497 | arg( SF.name() ). | 507 | arg( SF.name() ). |
498 | arg( CurDevNN->nodeName() ); | 508 | arg( CurDevNN->name() ); |
499 | return S; | 509 | return S; |
500 | } | 510 | } |
501 | } | 511 | } |
502 | 512 | ||
503 | if( CurDev ) | ||
504 | fprintf( stderr, "Cur %s\n", CurDevNN->nodeName().latin1() ); | ||
505 | else | ||
506 | fprintf( stderr, "Cur NO\n" ); | ||
507 | |||
508 | // now generate profile specific data for all | 513 | // now generate profile specific data for all |
509 | // connections working on a device of the current | 514 | // connections working on a device of the current |
510 | // netnode type | 515 | // netnode type |
511 | for( QDictIterator<NodeCollection> ncit(M); | 516 | for( QDictIterator<NodeCollection> ncit(M); |
512 | ncit.current(); | 517 | ncit.current(); |
513 | ++ncit ) { | 518 | ++ncit ) { |
514 | NodeCollection * NC = ncit.current(); | 519 | NodeCollection * NC = ncit.current(); |
515 | 520 | ||
516 | // currenly only those connections that work on | 521 | // currenly only those connections that work on |
517 | // the current device (or on no device if no current) | 522 | // the current device (or on no device if no current) |
518 | AsDevice * Dev = NC->device(); | 523 | AsDevice * Dev = NC->device(); |
519 | 524 | ||
520 | fprintf( stderr, "%s\n", Dev->netNode()->nodeName().latin1() ); | ||
521 | if( CurDev ) { | 525 | if( CurDev ) { |
522 | if( CurDevNN != Dev->netNode()->nodeClass() ) { | 526 | if( CurDevNN != Dev->netNode()->nodeClass() ) { |
523 | // other device type -> later | 527 | // other device type -> later |
524 | fprintf( stderr, "Other Dev type\n" ); | ||
525 | continue; | 528 | continue; |
526 | } | 529 | } |
527 | } else { | 530 | } else { |
528 | if( Dev ) { | 531 | if( Dev ) { |
529 | // other | 532 | // other |
530 | continue; | 533 | continue; |
531 | } | 534 | } |
532 | } | 535 | } |
533 | 536 | ||
534 | // generate 'entry' | 537 | // generate 'entry' |
535 | if( SF.preNodeSection( DevNNI, DevInstNr ) ) { | 538 | if( SF.preNodeSection( DevNNI, DevInstNr ) ) { |
536 | S = qApp->translate( "NetworkSettings", | 539 | S = qApp->translate( "NetworkSettings", |
537 | "<p>Error in preNodeSection for file \"%1\" and node \"%2\"</p>" ). | 540 | "<p>Error in preNodeSection for file \"%1\" and node \"%2\"</p>" ). |
538 | arg( SF.name() ). | 541 | arg( SF.name() ). |
539 | arg( CurDevNN->nodeName() ); | 542 | arg( CurDevNN->name() ); |
540 | return S; | 543 | return S; |
541 | } | 544 | } |
542 | 545 | ||
543 | // ask all nodes in connection | 546 | // ask all nodes in connection |
544 | for( QListIterator<ANetNodeInstance> cncit(*NC); | 547 | for( QListIterator<ANetNodeInstance> cncit(*NC); |
545 | cncit.current(); | 548 | cncit.current(); |
546 | ++cncit ) { | 549 | ++cncit ) { |
547 | ANetNodeInstance * NNI = cncit.current(); | 550 | ANetNodeInstance * NNI = cncit.current(); |
548 | 551 | ||
549 | if( NNI->hasDataFor( SF.name() ) ) { | 552 | if( NNI->hasDataFor( SF.name() ) ) { |
550 | if( NNI->generateDataForCommonFile(SF,DevInstNr) ) { | 553 | if( NNI->generateDataForCommonFile(SF,DevInstNr) ) { |
551 | S = qApp->translate( "NetworkSettings", | 554 | S = qApp->translate( "NetworkSettings", |
552 | "<p>Error in node part for file \"%1\" and node \"%2\"</p>" ). | 555 | "<p>Error in node part for file \"%1\" and node \"%2\"</p>" ). |
553 | arg( SF.name() ). | 556 | arg( SF.name() ). |
554 | arg( NNI->nodeClass()->nodeName() ); | 557 | arg( NNI->nodeClass()->name() ); |
555 | return S; | 558 | return S; |
556 | } | 559 | } |
557 | } | 560 | } |
558 | } | 561 | } |
559 | 562 | ||
560 | if( SF.postNodeSection( DevNNI, DevInstNr ) ) { | 563 | if( SF.postNodeSection( DevNNI, DevInstNr ) ) { |
561 | S = qApp->translate( "NetworkSettings", | 564 | S = qApp->translate( "NetworkSettings", |
562 | "<p>Error in postNodeSection for file \"%1\" and node \"%2\"</p>" ). | 565 | "<p>Error in postNodeSection for file \"%1\" and node \"%2\"</p>" ). |
563 | arg( SF.name() ). | 566 | arg( SF.name() ). |
564 | arg( CurDevNN->nodeName() ); | 567 | arg( CurDevNN->name() ); |
565 | return S; | 568 | return S; |
566 | } | 569 | } |
567 | SF << endl; | 570 | SF << endl; |
568 | } | 571 | } |
569 | 572 | ||
570 | if( SF.postDeviceSection( CurDevNN ) ) { | 573 | if( SF.postDeviceSection( CurDevNN ) ) { |
571 | S = qApp->translate( "NetworkSettings", | 574 | S = qApp->translate( "NetworkSettings", |
572 | "<p>Error in postDeviceSection for file \"%1\" and node \"%2\"</p>" ). | 575 | "<p>Error in postDeviceSection for file \"%1\" and node \"%2\"</p>" ). |
573 | arg( SF.name() ). | 576 | arg( SF.name() ). |
574 | arg( CurDevNN->nodeName() ); | 577 | arg( CurDevNN->name() ); |
575 | return S; | 578 | return S; |
576 | } | 579 | } |
577 | 580 | ||
578 | return S; | 581 | return S; |
579 | } | 582 | } |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp index 0bf415b..208c7c2 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp +++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp | |||
@@ -1,68 +1,68 @@ | |||
1 | #include "ppp_NN.h" | 1 | #include "ppp_NN.h" |
2 | #include "ppp_NNI.h" | 2 | #include "ppp_NNI.h" |
3 | 3 | ||
4 | static const char * PPPNeeds[] = | 4 | static const char * PPPNeeds[] = |
5 | { "line", | 5 | { "line", |
6 | "modem", | 6 | "modem", |
7 | 0 | 7 | 0 |
8 | }; | 8 | }; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Constructor, find all of the possible interfaces | 11 | * Constructor, find all of the possible interfaces |
12 | */ | 12 | */ |
13 | PPPNetNode::PPPNetNode() : ANetNode() { | 13 | PPPNetNode::PPPNetNode() : ANetNode(tr("PPP Connection")) { |
14 | } | 14 | } |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Delete any interfaces that we own. | 17 | * Delete any interfaces that we own. |
18 | */ | 18 | */ |
19 | PPPNetNode::~PPPNetNode(){ | 19 | PPPNetNode::~PPPNetNode(){ |
20 | } | 20 | } |
21 | 21 | ||
22 | const QString PPPNetNode::nodeDescription(){ | 22 | const QString PPPNetNode::nodeDescription(){ |
23 | return tr("\ | 23 | return tr("\ |
24 | <p>Sets up IP using PPP.</p>\ | 24 | <p>Sets up IP using PPP.</p>\ |
25 | <p>Use this for dialup devices or serial setups</p>\ | 25 | <p>Use this for dialup devices or serial setups</p>\ |
26 | " | 26 | " |
27 | ); | 27 | ); |
28 | } | 28 | } |
29 | 29 | ||
30 | ANetNodeInstance * PPPNetNode::createInstance( void ) { | 30 | ANetNodeInstance * PPPNetNode::createInstance( void ) { |
31 | return new APPP( this ); | 31 | return new APPP( this ); |
32 | } | 32 | } |
33 | 33 | ||
34 | const char ** PPPNetNode::needs( void ) { | 34 | const char ** PPPNetNode::needs( void ) { |
35 | return PPPNeeds; | 35 | return PPPNeeds; |
36 | } | 36 | } |
37 | 37 | ||
38 | const char * PPPNetNode::provides( void ) { | 38 | const char * PPPNetNode::provides( void ) { |
39 | return "connection"; | 39 | return "connection"; |
40 | } | 40 | } |
41 | 41 | ||
42 | bool PPPNetNode::generateProperFilesFor( | 42 | bool PPPNetNode::generateProperFilesFor( |
43 | ANetNodeInstance * ) { | 43 | ANetNodeInstance * ) { |
44 | return 1; | 44 | return 1; |
45 | } | 45 | } |
46 | 46 | ||
47 | bool PPPNetNode::generateDeviceDataForCommonFile( | 47 | bool PPPNetNode::generateDeviceDataForCommonFile( |
48 | SystemFile & , | 48 | SystemFile & , |
49 | long ) { | 49 | long ) { |
50 | return 1; | 50 | return 1; |
51 | } | 51 | } |
52 | 52 | ||
53 | QString PPPNetNode::genNic( long NicNr ) { | 53 | QString PPPNetNode::genNic( long NicNr ) { |
54 | QString S; | 54 | QString S; |
55 | return S.sprintf( "ppp%ld", NicNr ); | 55 | return S.sprintf( "ppp%ld", NicNr ); |
56 | } | 56 | } |
57 | 57 | ||
58 | void PPPNetNode::setSpecificAttribute( QString & , QString & ) { | 58 | void PPPNetNode::setSpecificAttribute( QString & , QString & ) { |
59 | } | 59 | } |
60 | 60 | ||
61 | void PPPNetNode::saveSpecificAttribute( QTextStream & ) { | 61 | void PPPNetNode::saveSpecificAttribute( QTextStream & ) { |
62 | } | 62 | } |
63 | 63 | ||
64 | extern "C" { | 64 | extern "C" { |
65 | void create_plugin( QList<ANetNode> & PNN ) { | 65 | void create_plugin( QList<ANetNode> & PNN ) { |
66 | PNN.append( new PPPNetNode() ); | 66 | PNN.append( new PPPNetNode() ); |
67 | } | 67 | } |
68 | } | 68 | } |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h index fbbbbe1..b1483c4 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.h +++ b/noncore/settings/networksettings2/ppp/ppp_NN.h | |||
@@ -1,49 +1,46 @@ | |||
1 | #ifndef PPP_NETNODE_H | 1 | #ifndef PPP_NETNODE_H |
2 | #define PPP_NETNODE_H | 2 | #define PPP_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class APPP; | 6 | class APPP; |
7 | 7 | ||
8 | class PPPNetNode : public ANetNode{ | 8 | class PPPNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | PPPNetNode(); | 14 | PPPNetNode(); |
15 | virtual ~PPPNetNode(); | 15 | virtual ~PPPNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/ppp"; } | 18 | { return "Devices/ppp"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("PPP Connection"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & ) | 28 | virtual bool hasDataFor( const QString & ) |
32 | { return 0; } | 29 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 30 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr ); | 31 | SystemFile & SF, long DevNr ); |
35 | 32 | ||
36 | virtual QString genNic( long NicNr ); | 33 | virtual QString genNic( long NicNr ); |
37 | 34 | ||
38 | private: | 35 | private: |
39 | 36 | ||
40 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 37 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
41 | virtual void saveSpecificAttribute( QTextStream & TS ); | 38 | virtual void saveSpecificAttribute( QTextStream & TS ); |
42 | }; | 39 | }; |
43 | 40 | ||
44 | extern "C" | 41 | extern "C" |
45 | { | 42 | { |
46 | void create_plugin( QList<ANetNode> & PNN ); | 43 | void create_plugin( QList<ANetNode> & PNN ); |
47 | }; | 44 | }; |
48 | 45 | ||
49 | #endif | 46 | #endif |
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp index 0f71dc7..d06b7ef 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.cpp +++ b/noncore/settings/networksettings2/profile/profile_NN.cpp | |||
@@ -1,62 +1,62 @@ | |||
1 | #include "profile_NN.h" | 1 | #include "profile_NN.h" |
2 | #include "profile_NNI.h" | 2 | #include "profile_NNI.h" |
3 | 3 | ||
4 | static const char * ProfileNeeds[] = | 4 | static const char * ProfileNeeds[] = |
5 | { "connection", | 5 | { "connection", |
6 | 0 | 6 | 0 |
7 | }; | 7 | }; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor, find all of the possible interfaces | 10 | * Constructor, find all of the possible interfaces |
11 | */ | 11 | */ |
12 | ProfileNetNode::ProfileNetNode() : ANetNode() { | 12 | ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular profile")) { |
13 | } | 13 | } |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Delete any interfaces that we own. | 16 | * Delete any interfaces that we own. |
17 | */ | 17 | */ |
18 | ProfileNetNode::~ProfileNetNode(){ | 18 | ProfileNetNode::~ProfileNetNode(){ |
19 | } | 19 | } |
20 | 20 | ||
21 | const QString ProfileNetNode::nodeDescription(){ | 21 | const QString ProfileNetNode::nodeDescription(){ |
22 | return tr("\ | 22 | return tr("\ |
23 | <p>Define use of an IP connection.</p>\ | 23 | <p>Define use of an IP connection.</p>\ |
24 | <p>Configure if and when this connection needs to be established</p>\ | 24 | <p>Configure if and when this connection needs to be established</p>\ |
25 | " | 25 | " |
26 | ); | 26 | ); |
27 | } | 27 | } |
28 | 28 | ||
29 | ANetNodeInstance * ProfileNetNode::createInstance( void ) { | 29 | ANetNodeInstance * ProfileNetNode::createInstance( void ) { |
30 | return new AProfile( this ); | 30 | return new AProfile( this ); |
31 | } | 31 | } |
32 | 32 | ||
33 | const char ** ProfileNetNode::needs( void ) { | 33 | const char ** ProfileNetNode::needs( void ) { |
34 | return ProfileNeeds; | 34 | return ProfileNeeds; |
35 | } | 35 | } |
36 | 36 | ||
37 | const char * ProfileNetNode::provides( void ) { | 37 | const char * ProfileNetNode::provides( void ) { |
38 | return "fullsetup"; | 38 | return "fullsetup"; |
39 | } | 39 | } |
40 | 40 | ||
41 | bool ProfileNetNode::generateProperFilesFor( | 41 | bool ProfileNetNode::generateProperFilesFor( |
42 | ANetNodeInstance * ) { | 42 | ANetNodeInstance * ) { |
43 | return 1; | 43 | return 1; |
44 | } | 44 | } |
45 | 45 | ||
46 | bool ProfileNetNode::generateDeviceDataForCommonFile( | 46 | bool ProfileNetNode::generateDeviceDataForCommonFile( |
47 | SystemFile & , | 47 | SystemFile & , |
48 | long ) { | 48 | long ) { |
49 | return 1; | 49 | return 1; |
50 | } | 50 | } |
51 | 51 | ||
52 | void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { | 52 | void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { |
53 | } | 53 | } |
54 | 54 | ||
55 | void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { | 55 | void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { |
56 | } | 56 | } |
57 | 57 | ||
58 | extern "C" { | 58 | extern "C" { |
59 | void create_plugin( QList<ANetNode> & PNN ) { | 59 | void create_plugin( QList<ANetNode> & PNN ) { |
60 | PNN.append( new ProfileNetNode() ); | 60 | PNN.append( new ProfileNetNode() ); |
61 | } | 61 | } |
62 | } | 62 | } |
diff --git a/noncore/settings/networksettings2/profile/profile_NN.h b/noncore/settings/networksettings2/profile/profile_NN.h index 1313ab2..e602bd7 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.h +++ b/noncore/settings/networksettings2/profile/profile_NN.h | |||
@@ -1,47 +1,44 @@ | |||
1 | #ifndef PROFILE_NETNODE_H | 1 | #ifndef PROFILE_NETNODE_H |
2 | #define PROFILE_NETNODE_H | 2 | #define PROFILE_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AProfile; | 6 | class AProfile; |
7 | 7 | ||
8 | class ProfileNetNode : public ANetNode{ | 8 | class ProfileNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | ProfileNetNode(); | 14 | ProfileNetNode(); |
15 | virtual ~ProfileNetNode(); | 15 | virtual ~ProfileNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/commprofile"; } | 18 | { return "Devices/commprofile"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("Regular profile"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & ) | 28 | virtual bool hasDataFor( const QString & ) |
32 | { return 0; } | 29 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 30 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr); | 31 | SystemFile & SF, long DevNr); |
35 | 32 | ||
36 | private: | 33 | private: |
37 | 34 | ||
38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
39 | virtual void saveSpecificAttribute( QTextStream & TS ); | 36 | virtual void saveSpecificAttribute( QTextStream & TS ); |
40 | }; | 37 | }; |
41 | 38 | ||
42 | extern "C" | 39 | extern "C" |
43 | { | 40 | { |
44 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
45 | }; | 42 | }; |
46 | 43 | ||
47 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp index d5971cf..9101490 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.cpp +++ b/noncore/settings/networksettings2/usb/usb_NN.cpp | |||
@@ -1,77 +1,77 @@ | |||
1 | #include "usb_NN.h" | 1 | #include "usb_NN.h" |
2 | #include "usb_NNI.h" | 2 | #include "usb_NNI.h" |
3 | 3 | ||
4 | static const char * USBNeeds[] = | 4 | static const char * USBNeeds[] = |
5 | { 0 | 5 | { 0 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor, find all of the possible interfaces | 9 | * Constructor, find all of the possible interfaces |
10 | */ | 10 | */ |
11 | USBNetNode::USBNetNode() : ANetNode() { | 11 | USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) { |
12 | } | 12 | } |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Delete any interfaces that we own. | 15 | * Delete any interfaces that we own. |
16 | */ | 16 | */ |
17 | USBNetNode::~USBNetNode(){ | 17 | USBNetNode::~USBNetNode(){ |
18 | } | 18 | } |
19 | 19 | ||
20 | const QString USBNetNode::nodeDescription(){ | 20 | const QString USBNetNode::nodeDescription(){ |
21 | return tr("\ | 21 | return tr("\ |
22 | <p>Configure Ethernet over USB.</p>\ | 22 | <p>Configure Ethernet over USB.</p>\ |
23 | <p>Use this for a computer to computer USB cable connection</p>\ | 23 | <p>Use this for a computer to computer USB cable connection</p>\ |
24 | " | 24 | " |
25 | ); | 25 | ); |
26 | } | 26 | } |
27 | 27 | ||
28 | ANetNodeInstance * USBNetNode::createInstance( void ) { | 28 | ANetNodeInstance * USBNetNode::createInstance( void ) { |
29 | return new AUSB( this ); | 29 | return new AUSB( this ); |
30 | } | 30 | } |
31 | 31 | ||
32 | const char ** USBNetNode::needs( void ) { | 32 | const char ** USBNetNode::needs( void ) { |
33 | return USBNeeds; | 33 | return USBNeeds; |
34 | } | 34 | } |
35 | 35 | ||
36 | const char * USBNetNode::provides( void ) { | 36 | const char * USBNetNode::provides( void ) { |
37 | return "device"; | 37 | return "device"; |
38 | } | 38 | } |
39 | 39 | ||
40 | bool USBNetNode::generateProperFilesFor( | 40 | bool USBNetNode::generateProperFilesFor( |
41 | ANetNodeInstance * ) { | 41 | ANetNodeInstance * ) { |
42 | return 1; | 42 | return 1; |
43 | } | 43 | } |
44 | 44 | ||
45 | bool USBNetNode::hasDataFor( const QString & S ) { | 45 | bool USBNetNode::hasDataFor( const QString & S ) { |
46 | return (S== "interfaces"); | 46 | return (S== "interfaces"); |
47 | } | 47 | } |
48 | 48 | ||
49 | bool USBNetNode::generateDeviceDataForCommonFile( | 49 | bool USBNetNode::generateDeviceDataForCommonFile( |
50 | SystemFile & S , | 50 | SystemFile & S , |
51 | long DevNr ) { | 51 | long DevNr ) { |
52 | QString NIC = genNic( DevNr ); | 52 | QString NIC = genNic( DevNr ); |
53 | 53 | ||
54 | if( S.name() == "interfaces" ) { | 54 | if( S.name() == "interfaces" ) { |
55 | // generate mapping stanza for this interface | 55 | // generate mapping stanza for this interface |
56 | S << "# check if " << NIC << " can be brought UP" << endl; | 56 | S << "# check if " << NIC << " can be brought UP" << endl; |
57 | S << "mapping " << NIC << endl; | 57 | S << "mapping " << NIC << endl; |
58 | S << " script networksettings2-request" << endl << endl; | 58 | S << " script networksettings2-request" << endl << endl; |
59 | } | 59 | } |
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | QString USBNetNode::genNic( long ) { | 63 | QString USBNetNode::genNic( long ) { |
64 | return QString( "usbf" ); | 64 | return QString( "usbf" ); |
65 | } | 65 | } |
66 | 66 | ||
67 | void USBNetNode::setSpecificAttribute( QString & , QString & ) { | 67 | void USBNetNode::setSpecificAttribute( QString & , QString & ) { |
68 | } | 68 | } |
69 | 69 | ||
70 | void USBNetNode::saveSpecificAttribute( QTextStream & ) { | 70 | void USBNetNode::saveSpecificAttribute( QTextStream & ) { |
71 | } | 71 | } |
72 | 72 | ||
73 | extern "C" { | 73 | extern "C" { |
74 | void create_plugin( QList<ANetNode> & PNN ) { | 74 | void create_plugin( QList<ANetNode> & PNN ) { |
75 | PNN.append( new USBNetNode() ); | 75 | PNN.append( new USBNetNode() ); |
76 | } | 76 | } |
77 | } | 77 | } |
diff --git a/noncore/settings/networksettings2/usb/usb_NN.h b/noncore/settings/networksettings2/usb/usb_NN.h index 0b83ea6..fea89f0 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.h +++ b/noncore/settings/networksettings2/usb/usb_NN.h | |||
@@ -1,48 +1,45 @@ | |||
1 | #ifndef USB_NETNODE_H | 1 | #ifndef USB_NETNODE_H |
2 | #define USB_NETNODE_H | 2 | #define USB_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AUSB; | 6 | class AUSB; |
7 | 7 | ||
8 | class USBNetNode : public ANetNode{ | 8 | class USBNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | USBNetNode(); | 14 | USBNetNode(); |
15 | virtual ~USBNetNode(); | 15 | virtual ~USBNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/usb"; } | 18 | { return "Devices/usb"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("USB Cable Connect"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S); | 28 | virtual bool hasDataFor( const QString & S); |
32 | virtual bool generateDeviceDataForCommonFile( | 29 | virtual bool generateDeviceDataForCommonFile( |
33 | SystemFile & SF, long DevNr ); | 30 | SystemFile & SF, long DevNr ); |
34 | 31 | ||
35 | virtual QString genNic( long nr ); | 32 | virtual QString genNic( long nr ); |
36 | 33 | ||
37 | private: | 34 | private: |
38 | 35 | ||
39 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 36 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
40 | virtual void saveSpecificAttribute( QTextStream & TS ); | 37 | virtual void saveSpecificAttribute( QTextStream & TS ); |
41 | }; | 38 | }; |
42 | 39 | ||
43 | extern "C" | 40 | extern "C" |
44 | { | 41 | { |
45 | void create_plugin( QList<ANetNode> & PNN ); | 42 | void create_plugin( QList<ANetNode> & PNN ); |
46 | }; | 43 | }; |
47 | 44 | ||
48 | #endif | 45 | #endif |
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp index 307e9dd..bfc30f9 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp +++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp | |||
@@ -1,62 +1,62 @@ | |||
1 | #include "vpn_NN.h" | 1 | #include "vpn_NN.h" |
2 | #include "vpn_NNI.h" | 2 | #include "vpn_NNI.h" |
3 | 3 | ||
4 | static const char * VPNNeeds[] = | 4 | static const char * VPNNeeds[] = |
5 | { "connection", | 5 | { "connection", |
6 | 0 | 6 | 0 |
7 | }; | 7 | }; |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor, find all of the possible interfaces | 10 | * Constructor, find all of the possible interfaces |
11 | */ | 11 | */ |
12 | VPNNetNode::VPNNetNode() : ANetNode() { | 12 | VPNNetNode::VPNNetNode() : ANetNode(tr("VPN Connection")) { |
13 | } | 13 | } |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Delete any interfaces that we own. | 16 | * Delete any interfaces that we own. |
17 | */ | 17 | */ |
18 | VPNNetNode::~VPNNetNode(){ | 18 | VPNNetNode::~VPNNetNode(){ |
19 | } | 19 | } |
20 | 20 | ||
21 | const QString VPNNetNode::nodeDescription(){ | 21 | const QString VPNNetNode::nodeDescription(){ |
22 | return tr("\ | 22 | return tr("\ |
23 | <p>Configure private IP connection.</p>\ | 23 | <p>Configure private IP connection.</p>\ |
24 | <p>Defines Secure tunnels over non secure IP sessions</p>\ | 24 | <p>Defines Secure tunnels over non secure IP sessions</p>\ |
25 | " | 25 | " |
26 | ); | 26 | ); |
27 | } | 27 | } |
28 | 28 | ||
29 | ANetNodeInstance * VPNNetNode::createInstance( void ) { | 29 | ANetNodeInstance * VPNNetNode::createInstance( void ) { |
30 | return new AVPN( this ); | 30 | return new AVPN( this ); |
31 | } | 31 | } |
32 | 32 | ||
33 | const char ** VPNNetNode::needs( void ) { | 33 | const char ** VPNNetNode::needs( void ) { |
34 | return VPNNeeds; | 34 | return VPNNeeds; |
35 | } | 35 | } |
36 | 36 | ||
37 | const char * VPNNetNode::provides( void ) { | 37 | const char * VPNNetNode::provides( void ) { |
38 | return "connection"; | 38 | return "connection"; |
39 | } | 39 | } |
40 | 40 | ||
41 | bool VPNNetNode::generateProperFilesFor( | 41 | bool VPNNetNode::generateProperFilesFor( |
42 | ANetNodeInstance * ) { | 42 | ANetNodeInstance * ) { |
43 | return 1; | 43 | return 1; |
44 | } | 44 | } |
45 | 45 | ||
46 | bool VPNNetNode::generateDeviceDataForCommonFile( | 46 | bool VPNNetNode::generateDeviceDataForCommonFile( |
47 | SystemFile & , | 47 | SystemFile & , |
48 | long ) { | 48 | long ) { |
49 | return 1; | 49 | return 1; |
50 | } | 50 | } |
51 | 51 | ||
52 | void VPNNetNode::setSpecificAttribute( QString & , QString & ) { | 52 | void VPNNetNode::setSpecificAttribute( QString & , QString & ) { |
53 | } | 53 | } |
54 | 54 | ||
55 | void VPNNetNode::saveSpecificAttribute( QTextStream & ) { | 55 | void VPNNetNode::saveSpecificAttribute( QTextStream & ) { |
56 | } | 56 | } |
57 | 57 | ||
58 | extern "C" { | 58 | extern "C" { |
59 | void create_plugin( QList<ANetNode> & PNN ) { | 59 | void create_plugin( QList<ANetNode> & PNN ) { |
60 | PNN.append( new VPNNetNode() ); | 60 | PNN.append( new VPNNetNode() ); |
61 | } | 61 | } |
62 | } | 62 | } |
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.h b/noncore/settings/networksettings2/vpn/vpn_NN.h index 1cd3fcc..5b6632e 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.h +++ b/noncore/settings/networksettings2/vpn/vpn_NN.h | |||
@@ -1,47 +1,44 @@ | |||
1 | #ifndef VPN_NETNODE_H | 1 | #ifndef VPN_NETNODE_H |
2 | #define VPN_NETNODE_H | 2 | #define VPN_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AVPN; | 6 | class AVPN; |
7 | 7 | ||
8 | class VPNNetNode : public ANetNode{ | 8 | class VPNNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | VPNNetNode(); | 14 | VPNNetNode(); |
15 | virtual ~VPNNetNode(); | 15 | virtual ~VPNNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/vpn"; } | 18 | { return "Devices/vpn"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("VPN Connection"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & ) | 28 | virtual bool hasDataFor( const QString & ) |
32 | { return 0; } | 29 | { return 0; } |
33 | virtual bool generateDeviceDataForCommonFile( | 30 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr ); | 31 | SystemFile & SF, long DevNr ); |
35 | 32 | ||
36 | private: | 33 | private: |
37 | 34 | ||
38 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 35 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
39 | virtual void saveSpecificAttribute( QTextStream & TS ); | 36 | virtual void saveSpecificAttribute( QTextStream & TS ); |
40 | }; | 37 | }; |
41 | 38 | ||
42 | extern "C" | 39 | extern "C" |
43 | { | 40 | { |
44 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
45 | }; | 42 | }; |
46 | 43 | ||
47 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.cpp b/noncore/settings/networksettings2/wlan/wlan_NN.cpp index e0c4db2..7a2c1a7 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NN.cpp | |||
@@ -1,85 +1,85 @@ | |||
1 | #include "wlan_NN.h" | 1 | #include "wlan_NN.h" |
2 | #include "wlan_NNI.h" | 2 | #include "wlan_NNI.h" |
3 | 3 | ||
4 | static const char * WLanNeeds[] = | 4 | static const char * WLanNeeds[] = |
5 | { 0 | 5 | { 0 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor, find all of the possible interfaces | 9 | * Constructor, find all of the possible interfaces |
10 | */ | 10 | */ |
11 | WLanNetNode::WLanNetNode() : ANetNode() { | 11 | WLanNetNode::WLanNetNode() : ANetNode(tr("WLan Device")) { |
12 | InstanceCount = 2; | 12 | InstanceCount = 2; |
13 | } | 13 | } |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Delete any interfaces that we own. | 16 | * Delete any interfaces that we own. |
17 | */ | 17 | */ |
18 | WLanNetNode::~WLanNetNode(){ | 18 | WLanNetNode::~WLanNetNode(){ |
19 | } | 19 | } |
20 | 20 | ||
21 | const QString WLanNetNode::nodeDescription(){ | 21 | const QString WLanNetNode::nodeDescription(){ |
22 | return tr("\ | 22 | return tr("\ |
23 | <p>Configure Wi/Fi or WLan network cards.</p>\ | 23 | <p>Configure Wi/Fi or WLan network cards.</p>\ |
24 | <p>Defines Wireless options for those cards</p>\ | 24 | <p>Defines Wireless options for those cards</p>\ |
25 | " | 25 | " |
26 | ); | 26 | ); |
27 | } | 27 | } |
28 | 28 | ||
29 | ANetNodeInstance * WLanNetNode::createInstance( void ) { | 29 | ANetNodeInstance * WLanNetNode::createInstance( void ) { |
30 | return new AWLan( this ); | 30 | return new AWLan( this ); |
31 | } | 31 | } |
32 | 32 | ||
33 | const char ** WLanNetNode::needs( void ) { | 33 | const char ** WLanNetNode::needs( void ) { |
34 | return WLanNeeds; | 34 | return WLanNeeds; |
35 | } | 35 | } |
36 | 36 | ||
37 | const char * WLanNetNode::provides( void ) { | 37 | const char * WLanNetNode::provides( void ) { |
38 | return "device"; | 38 | return "device"; |
39 | } | 39 | } |
40 | 40 | ||
41 | bool WLanNetNode::generateProperFilesFor( | 41 | bool WLanNetNode::generateProperFilesFor( |
42 | ANetNodeInstance * ) { | 42 | ANetNodeInstance * ) { |
43 | return 1; | 43 | return 1; |
44 | } | 44 | } |
45 | 45 | ||
46 | bool WLanNetNode::hasDataFor( const QString & S ) { | 46 | bool WLanNetNode::hasDataFor( const QString & S ) { |
47 | return S == "interfaces"; | 47 | return S == "interfaces"; |
48 | } | 48 | } |
49 | 49 | ||
50 | bool WLanNetNode::generateDeviceDataForCommonFile( | 50 | bool WLanNetNode::generateDeviceDataForCommonFile( |
51 | SystemFile & S, | 51 | SystemFile & S, |
52 | long DevNr ) { | 52 | long DevNr ) { |
53 | QString NIC = genNic( DevNr ); | 53 | QString NIC = genNic( DevNr ); |
54 | 54 | ||
55 | if( S.name() == "interfaces" ) { | 55 | if( S.name() == "interfaces" ) { |
56 | // generate mapping stanza for this interface | 56 | // generate mapping stanza for this interface |
57 | S << "# check if " << NIC << " can be brought UP" << endl; | 57 | S << "# check if " << NIC << " can be brought UP" << endl; |
58 | S << "mapping " << NIC << endl; | 58 | S << "mapping " << NIC << endl; |
59 | S << " script networksettings2-request" << endl << endl; | 59 | S << " script networksettings2-request" << endl << endl; |
60 | } | 60 | } |
61 | return 0; | 61 | return 0; |
62 | } | 62 | } |
63 | 63 | ||
64 | QString WLanNetNode::genNic( long nr ) { | 64 | QString WLanNetNode::genNic( long nr ) { |
65 | QString S; | 65 | QString S; |
66 | return S.sprintf( "wlan%ld", nr ); | 66 | return S.sprintf( "wlan%ld", nr ); |
67 | } | 67 | } |
68 | 68 | ||
69 | void WLanNetNode::setSpecificAttribute( QString & A, QString & V ) { | 69 | void WLanNetNode::setSpecificAttribute( QString & A, QString & V ) { |
70 | if( A == "interfacecount" ) { | 70 | if( A == "interfacecount" ) { |
71 | InstanceCount = V.toLong(); | 71 | InstanceCount = V.toLong(); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | void WLanNetNode::saveSpecificAttribute( QTextStream & TS ) { | 75 | void WLanNetNode::saveSpecificAttribute( QTextStream & TS ) { |
76 | TS << "interfacecount=" | 76 | TS << "interfacecount=" |
77 | << InstanceCount | 77 | << InstanceCount |
78 | << endl; | 78 | << endl; |
79 | } | 79 | } |
80 | 80 | ||
81 | extern "C" { | 81 | extern "C" { |
82 | void create_plugin( QList<ANetNode> & PNN ) { | 82 | void create_plugin( QList<ANetNode> & PNN ) { |
83 | PNN.append( new WLanNetNode() ); | 83 | PNN.append( new WLanNetNode() ); |
84 | } | 84 | } |
85 | } | 85 | } |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h index e93a89a..b5ff3fd 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.h +++ b/noncore/settings/networksettings2/wlan/wlan_NN.h | |||
@@ -1,56 +1,53 @@ | |||
1 | #ifndef WLAN_NETNODE_H | 1 | #ifndef WLAN_NETNODE_H |
2 | #define WLAN_NETNODE_H | 2 | #define WLAN_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class AWLan; | 6 | class AWLan; |
7 | 7 | ||
8 | class WLanNetNode : public ANetNode{ | 8 | class WLanNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | WLanNetNode(); | 14 | WLanNetNode(); |
15 | virtual ~WLanNetNode(); | 15 | virtual ~WLanNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "Devices/wlan"; } | 18 | { return "Devices/wlan"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | ||
21 | { return tr("WLan Device"); } | ||
22 | |||
23 | virtual const QString nodeDescription() ; | 20 | virtual const QString nodeDescription() ; |
24 | 21 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 22 | virtual ANetNodeInstance * createInstance( void ); |
26 | 23 | ||
27 | virtual const char ** needs( void ); | 24 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 25 | virtual const char * provides( void ); |
29 | 26 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 27 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | 28 | ||
32 | virtual bool hasDataFor( const QString & S ); | 29 | virtual bool hasDataFor( const QString & S ); |
33 | virtual bool generateDeviceDataForCommonFile( | 30 | virtual bool generateDeviceDataForCommonFile( |
34 | SystemFile & SF, long DevNr ); | 31 | SystemFile & SF, long DevNr ); |
35 | 32 | ||
36 | virtual long instanceCount( void ) | 33 | virtual long instanceCount( void ) |
37 | { return InstanceCount; } | 34 | { return InstanceCount; } |
38 | 35 | ||
39 | virtual QString genNic( long ); | 36 | virtual QString genNic( long ); |
40 | 37 | ||
41 | private: | 38 | private: |
42 | 39 | ||
43 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 40 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
44 | virtual void saveSpecificAttribute( QTextStream & TS ); | 41 | virtual void saveSpecificAttribute( QTextStream & TS ); |
45 | 42 | ||
46 | // number of interfaces for this device | 43 | // number of interfaces for this device |
47 | long InstanceCount; | 44 | long InstanceCount; |
48 | 45 | ||
49 | }; | 46 | }; |
50 | 47 | ||
51 | extern "C" | 48 | extern "C" |
52 | { | 49 | { |
53 | void create_plugin( QList<ANetNode> & PNN ); | 50 | void create_plugin( QList<ANetNode> & PNN ); |
54 | }; | 51 | }; |
55 | 52 | ||
56 | #endif | 53 | #endif |