author | wimpie <wimpie> | 2004-04-04 00:27:59 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-04 00:27:59 (UTC) |
commit | a416c6c9630d6d63ee63cf520953b86af8b7cddc (patch) (unidiff) | |
tree | dbd0f5173728129f5a3faffdafd4f73d8cc72407 | |
parent | 152ffce2a4e8191d28738e3b40d8a726250a8767 (diff) | |
download | opie-a416c6c9630d6d63ee63cf520953b86af8b7cddc.zip opie-a416c6c9630d6d63ee63cf520953b86af8b7cddc.tar.gz opie-a416c6c9630d6d63ee63cf520953b86af8b7cddc.tar.bz2 |
*** empty log message ***
25 files changed, 130 insertions, 250 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h index 4dd508d..57ff95e 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMM_NNI.h | |||
@@ -1,42 +1,42 @@ | |||
1 | #ifndef BLUETOOTHRFCOMM_H | 1 | #ifndef BLUETOOTHRFCOMM_H |
2 | #define BLUETOOTHRFCOMM_H | 2 | #define BLUETOOTHRFCOMM_H |
3 | 3 | ||
4 | #include <netnode.h> | 4 | #include <netnode.h> |
5 | #include "bluetoothRFCOMMdata.h" | 5 | #include "bluetoothRFCOMMdata.h" |
6 | #include "bluetoothRFCOMMrun.h" | 6 | #include "bluetoothRFCOMMrun.h" |
7 | 7 | ||
8 | class BluetoothRFCOMMNetNode; | 8 | class BluetoothRFCOMMNetNode; |
9 | class BluetoothRFCOMMEdit; | 9 | class BluetoothRFCOMMEdit; |
10 | 10 | ||
11 | class ABluetoothRFCOMM : public ANetNodeInstance { | 11 | class ABluetoothRFCOMM : public ANetNodeInstance { |
12 | 12 | ||
13 | public : | 13 | public : |
14 | 14 | ||
15 | ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ); | 15 | ABluetoothRFCOMM( BluetoothRFCOMMNetNode * PNN ); |
16 | 16 | ||
17 | QWidget * edit( QWidget * parent ); | 17 | QWidget * edit( QWidget * parent ); |
18 | QString acceptable( void ); | 18 | QString acceptable( void ); |
19 | void commit( void ); | 19 | void commit( void ); |
20 | 20 | ||
21 | RuntimeInfo * runtime( void ) | 21 | RuntimeInfo * runtime( void ) |
22 | { if( RT ) | 22 | { if( RT == 0 ) |
23 | RT = new BluetoothRFCOMMRun( this, Data ); | 23 | RT = new BluetoothRFCOMMRun( this, Data ); |
24 | return RT; | 24 | return RT; |
25 | } | 25 | } |
26 | 26 | ||
27 | virtual void * data( void ) | 27 | virtual void * data( void ) |
28 | { return (void *)&Data; } | 28 | { return (void *)&Data; } |
29 | 29 | ||
30 | protected : | 30 | protected : |
31 | 31 | ||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | 33 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | 34 | ||
35 | private : | 35 | private : |
36 | 36 | ||
37 | BluetoothRFCOMMEdit * GUI; | 37 | BluetoothRFCOMMEdit * GUI; |
38 | BluetoothRFCOMMData Data; | 38 | BluetoothRFCOMMData Data; |
39 | BluetoothRFCOMMRun * RT; | 39 | BluetoothRFCOMMRun * RT; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | #endif | 42 | #endif |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h index ee346f0..705201c 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h +++ b/noncore/settings/networksettings2/bluetooth/bluetooth_NN.h | |||
@@ -1,75 +1,75 @@ | |||
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 "bluetooth"; } | 18 | { return "Devices/bluetooth"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("Bluetooth PAN/NAP"); } | 21 | { return tr("Bluetooth PAN/NAP"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | class BluetoothRFCOMMNetNode : public ANetNode { | 39 | class BluetoothRFCOMMNetNode : public ANetNode { |
40 | 40 | ||
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | 42 | ||
43 | public: | 43 | public: |
44 | 44 | ||
45 | BluetoothRFCOMMNetNode(); | 45 | BluetoothRFCOMMNetNode(); |
46 | virtual ~BluetoothRFCOMMNetNode(); | 46 | virtual ~BluetoothRFCOMMNetNode(); |
47 | 47 | ||
48 | virtual const QString pixmapName() | 48 | virtual const QString pixmapName() |
49 | { return "bluetooth"; } | 49 | { return "Devices/bluetooth"; } |
50 | 50 | ||
51 | virtual const QString nodeName() | 51 | virtual const QString nodeName() |
52 | { return tr("Bluetooth serial link"); } | 52 | { return tr("Bluetooth serial link"); } |
53 | 53 | ||
54 | virtual const QString nodeDescription() ; | 54 | virtual const QString nodeDescription() ; |
55 | 55 | ||
56 | virtual ANetNodeInstance * createInstance( void ); | 56 | virtual ANetNodeInstance * createInstance( void ); |
57 | 57 | ||
58 | virtual const char ** needs( void ); | 58 | virtual const char ** needs( void ); |
59 | virtual const char * provides( void ); | 59 | virtual const char * provides( void ); |
60 | 60 | ||
61 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 61 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
62 | virtual bool hasDataFor( const QString & S ); | 62 | virtual bool hasDataFor( const QString & S ); |
63 | virtual bool generateDataForCommonFile( | 63 | virtual bool generateDataForCommonFile( |
64 | SystemFile & SF, long, ANetNodeInstance * NNI ); | 64 | SystemFile & SF, long, ANetNodeInstance * NNI ); |
65 | 65 | ||
66 | private: | 66 | private: |
67 | 67 | ||
68 | }; | 68 | }; |
69 | 69 | ||
70 | extern "C" | 70 | extern "C" |
71 | { | 71 | { |
72 | void create_plugin( QList<ANetNode> & PNN ); | 72 | void create_plugin( QList<ANetNode> & PNN ); |
73 | }; | 73 | }; |
74 | 74 | ||
75 | #endif | 75 | #endif |
diff --git a/noncore/settings/networksettings2/cable/cable_NN.h b/noncore/settings/networksettings2/cable/cable_NN.h index 401317b..da99c1c 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.h +++ b/noncore/settings/networksettings2/cable/cable_NN.h | |||
@@ -1,44 +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 "cable"; } | 18 | { return "Devices/cable"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("Cable Connection"); } | 21 | { return tr("Cable Connection"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/editconnection.cpp b/noncore/settings/networksettings2/editconnection.cpp index d4b2bb3..ce13573 100644 --- a/noncore/settings/networksettings2/editconnection.cpp +++ b/noncore/settings/networksettings2/editconnection.cpp | |||
@@ -1,582 +1,582 @@ | |||
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 | { ANetNodeInstance * NNI; | 107 | { ANetNodeInstance * NNI; |
108 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 108 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
109 | it.current(); | 109 | it.current(); |
110 | ++it ) { | 110 | ++it ) { |
111 | if( it.current()->isNew() ) { | 111 | if( it.current()->isNew() ) { |
112 | delete it.current(); | 112 | delete it.current(); |
113 | } | 113 | } |
114 | } | 114 | } |
115 | TmpCollection.clear(); | 115 | TmpCollection.clear(); |
116 | } | 116 | } |
117 | 117 | ||
118 | // update content | 118 | // update content |
119 | QListViewItem * it = Nodes_LV->firstChild(); | 119 | QListViewItem * it = Nodes_LV->firstChild(); |
120 | ANetNode * NN; | 120 | ANetNode * NN; |
121 | // start iter | 121 | // start iter |
122 | ANetNodeInstance * NNI = | 122 | ANetNodeInstance * NNI = |
123 | (SelectedNodes) ? SelectedNodes->first() : 0 ; | 123 | (SelectedNodes) ? SelectedNodes->first() : 0 ; |
124 | 124 | ||
125 | TmpCollection.setModified( 0 ); | 125 | TmpCollection.setModified( 0 ); |
126 | 126 | ||
127 | while ( it ) { | 127 | while ( it ) { |
128 | NN = (*Mapping)[it]; | 128 | NN = (*Mapping)[it]; |
129 | if( NN == 0 ) { | 129 | if( NN == 0 ) { |
130 | // child is controller -> has sub radio | 130 | // child is controller -> has sub radio |
131 | // check if one radio is selected | 131 | // check if one radio is selected |
132 | it = it->firstChild(); | 132 | it = it->firstChild(); |
133 | while( it ) { | 133 | while( it ) { |
134 | if( ((QCheckListItem *)it)->isOn() ) { | 134 | if( ((QCheckListItem *)it)->isOn() ) { |
135 | // this radio is selected -> go deeper | 135 | // this radio is selected -> go deeper |
136 | if( SelectedNodes == 0 || | 136 | if( SelectedNodes == 0 || |
137 | NNI == 0 || | 137 | NNI == 0 || |
138 | NNI->netNode()->nodeName() != it->text(0) ) { | 138 | NNI->netNode()->nodeName() != it->text(0) ) { |
139 | // new item not in previous collection | 139 | // new item not in previous collection |
140 | ANetNodeInstance * NNI = (*Mapping)[it]->createInstance(); | 140 | ANetNodeInstance * NNI = (*Mapping)[it]->createInstance(); |
141 | NNI->initialize(); | 141 | NNI->initialize(); |
142 | // this node type not in collection | 142 | // this node type not in collection |
143 | TmpCollection.append( NNI ); | 143 | TmpCollection.append( NNI ); |
144 | // master collection changed because new item in it | 144 | // master collection changed because new item in it |
145 | TmpCollection.setModified( 1 ); | 145 | TmpCollection.setModified( 1 ); |
146 | // no more valid items in old list | 146 | // no more valid items in old list |
147 | NNI = 0; | 147 | NNI = 0; |
148 | } else { | 148 | } else { |
149 | // already in list -> copy pointer | 149 | // already in list -> copy pointer |
150 | TmpCollection.append( NNI ); | 150 | TmpCollection.append( NNI ); |
151 | NNI = SelectedNodes->next(); | 151 | NNI = SelectedNodes->next(); |
152 | } | 152 | } |
153 | it = it->firstChild(); | 153 | it = it->firstChild(); |
154 | // do not bother to check other items | 154 | // do not bother to check other items |
155 | break; | 155 | break; |
156 | } | 156 | } |
157 | it = it->nextSibling(); | 157 | it = it->nextSibling(); |
158 | } | 158 | } |
159 | } else { | 159 | } else { |
160 | // check children | 160 | // check children |
161 | it = it->firstChild(); | 161 | it = it->firstChild(); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | TmpIsValid = 1; | 165 | TmpIsValid = 1; |
166 | return &(TmpCollection); | 166 | return &(TmpCollection); |
167 | } | 167 | } |
168 | 168 | ||
169 | // pass a connection NodeCollection to be edited | 169 | // pass a connection NodeCollection to be edited |
170 | void EditConnection::setConnection( NodeCollection * NC ) { | 170 | void EditConnection::setConnection( NodeCollection * NC ) { |
171 | ANetNodeInstance * NNI; | 171 | ANetNodeInstance * NNI; |
172 | ANetNode * NN; | 172 | ANetNode * NN; |
173 | 173 | ||
174 | SelectedNodes = NC; | 174 | SelectedNodes = NC; |
175 | Name_LE->setText( NC->name() ); | 175 | Name_LE->setText( NC->name() ); |
176 | NNI = NC->first(); | 176 | NNI = NC->first(); |
177 | 177 | ||
178 | // show configure tabl | 178 | // show configure tabl |
179 | Tab_TB->setCurrentPage( 1 ); | 179 | Tab_TB->setCurrentPage( 1 ); |
180 | 180 | ||
181 | // valid colledction | 181 | // valid colledction |
182 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); | 182 | Tab_TB->setTabEnabled( Setup_FRM, FALSE ); |
183 | Setup_FRM->setEnabled( FALSE ); | 183 | Setup_FRM->setEnabled( FALSE ); |
184 | 184 | ||
185 | // select items in collection | 185 | // select items in collection |
186 | QListViewItem * it = Nodes_LV->firstChild(); | 186 | QListViewItem * it = Nodes_LV->firstChild(); |
187 | bool Found; | 187 | bool Found; |
188 | 188 | ||
189 | TmpIsValid = 0; | 189 | TmpIsValid = 0; |
190 | 190 | ||
191 | while ( it ) { | 191 | while ( it ) { |
192 | // listitem corresponds to netnode | 192 | // listitem corresponds to netnode |
193 | NN = (*Mapping)[it]; | 193 | NN = (*Mapping)[it]; |
194 | if( NN == 0 ) { | 194 | if( NN == 0 ) { |
195 | // child is controller -> has sub radio | 195 | // child is controller -> has sub radio |
196 | QString Ctr = it->text(0); | 196 | QString Ctr = it->text(0); |
197 | // check if one radio is selected | 197 | // check if one radio is selected |
198 | it = it->firstChild(); | 198 | it = it->firstChild(); |
199 | Found = 0; | 199 | Found = 0; |
200 | while( it ) { | 200 | while( it ) { |
201 | if( NNI && NNI->netNode()->nodeName() == it->text(0) ) { | 201 | if( NNI && NNI->netNode()->nodeName() == it->text(0) ) { |
202 | // this radio is part of the collection | 202 | // this radio is part of the collection |
203 | ((QCheckListItem *)it)->setOn( 1 ); | 203 | ((QCheckListItem *)it)->setOn( 1 ); |
204 | updateGUI( it, NNI->netNode() ); | 204 | updateGUI( it, NNI->netNode() ); |
205 | // check its children | 205 | // check its children |
206 | Found = 1; | 206 | Found = 1; |
207 | it = it->firstChild(); | 207 | it = it->firstChild(); |
208 | NNI = SelectedNodes->next(); | 208 | NNI = SelectedNodes->next(); |
209 | // do not bother to check other items | 209 | // do not bother to check other items |
210 | break; | 210 | break; |
211 | } | 211 | } |
212 | it = it->nextSibling(); | 212 | it = it->nextSibling(); |
213 | } | 213 | } |
214 | if( ! Found ) { | 214 | if( ! Found ) { |
215 | // this means that this level is NOT present in collection | 215 | // this means that this level is NOT present in collection |
216 | // probably INCOMPATIBEL collection OR Missing plugin | 216 | // probably INCOMPATIBEL collection OR Missing plugin |
217 | QMessageBox::warning( | 217 | QMessageBox::warning( |
218 | 0, | 218 | 0, |
219 | tr( "Error presentig Connection" ), | 219 | tr( "Error presentig Connection" ), |
220 | tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ). | 220 | tr( "<p>Old connection or missing plugin \"<i>%1</i>\"</p>" ). |
221 | arg(Ctr) ); | 221 | arg(Ctr) ); |
222 | return; | 222 | return; |
223 | } | 223 | } |
224 | } else { | 224 | } else { |
225 | // automatic item -> check children | 225 | // automatic item -> check children |
226 | it = it->firstChild(); | 226 | it = it->firstChild(); |
227 | } | 227 | } |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | // get result of editing (either new OR updated collection | 231 | // get result of editing (either new OR updated collection |
232 | NodeCollection * EditConnection::connection( void ) { | 232 | NodeCollection * EditConnection::connection( void ) { |
233 | 233 | ||
234 | if( SelectedNodes == 0 ) { | 234 | if( SelectedNodes == 0 ) { |
235 | // new collection | 235 | // new collection |
236 | SelectedNodes = new NodeCollection; | 236 | SelectedNodes = new NodeCollection; |
237 | } | 237 | } |
238 | 238 | ||
239 | // clean out old entries | 239 | // clean out old entries |
240 | SelectedNodes->clear(); | 240 | SelectedNodes->clear(); |
241 | 241 | ||
242 | // transfer | 242 | // transfer |
243 | { ANetNodeInstance * NNI; | 243 | { ANetNodeInstance * NNI; |
244 | 244 | ||
245 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 245 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
246 | it.current(); | 246 | it.current(); |
247 | ++it ) { | 247 | ++it ) { |
248 | SelectedNodes->append( it.current() ); | 248 | SelectedNodes->append( it.current() ); |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | if( TmpCollection.isModified() ) | 252 | if( TmpCollection.isModified() ) |
253 | SelectedNodes->setModified( 1 ); | 253 | SelectedNodes->setModified( 1 ); |
254 | 254 | ||
255 | if( SelectedNodes->name() != Name_LE->text() ) { | 255 | if( SelectedNodes->name() != Name_LE->text() ) { |
256 | SelectedNodes->setName( Name_LE->text() ); | 256 | SelectedNodes->setName( Name_LE->text() ); |
257 | SelectedNodes->setModified( 1 ); | 257 | SelectedNodes->setModified( 1 ); |
258 | } | 258 | } |
259 | 259 | ||
260 | return SelectedNodes; | 260 | return SelectedNodes; |
261 | } | 261 | } |
262 | 262 | ||
263 | // Build device tree -> start | 263 | // Build device tree -> start |
264 | void EditConnection::buildFullTree( void ) { | 264 | void EditConnection::buildFullTree( void ) { |
265 | ANetNode * NN; | 265 | ANetNode * NN; |
266 | 266 | ||
267 | // toplevel item | 267 | // toplevel item |
268 | MyQCheckListItem * TheTop = new MyQCheckListItem( | 268 | MyQCheckListItem * TheTop = new MyQCheckListItem( |
269 | Nodes_LV, | 269 | Nodes_LV, |
270 | NSResources->netNode2Name("fullsetup"), | 270 | NSResources->netNode2Name("fullsetup"), |
271 | QCheckListItem::Controller ); | 271 | QCheckListItem::Controller ); |
272 | TheTop->setOpen( TRUE ); | 272 | TheTop->setOpen( TRUE ); |
273 | Description_LBL->setText( | 273 | Description_LBL->setText( |
274 | NSResources->netNode2Description( "fullsetup" ) ); | 274 | NSResources->netNode2Description( "fullsetup" ) ); |
275 | Nodes_LV->setSelected( TheTop, TRUE ); | 275 | Nodes_LV->setSelected( TheTop, TRUE ); |
276 | 276 | ||
277 | // find all Nodes that care toplevel nodes -> ie provide | 277 | // find all Nodes that care toplevel nodes -> ie provide |
278 | // TCP/IP Connection | 278 | // TCP/IP Connection |
279 | for( QDictIterator<NetNode_t> Iter(NSResources->netNodes()); | 279 | for( QDictIterator<NetNode_t> Iter(NSResources->netNodes()); |
280 | Iter.current(); | 280 | Iter.current(); |
281 | ++Iter ) { | 281 | ++Iter ) { |
282 | 282 | ||
283 | NN = Iter.current()->NetNode; | 283 | NN = Iter.current()->NetNode; |
284 | 284 | ||
285 | if( ! NN->isToplevel() ) { | 285 | if( ! NN->isToplevel() ) { |
286 | continue; | 286 | continue; |
287 | } | 287 | } |
288 | 288 | ||
289 | MyQCheckListItem * it = new MyQCheckListItem( TheTop, | 289 | MyQCheckListItem * it = new MyQCheckListItem( TheTop, |
290 | NN->nodeName(), | 290 | NN->nodeName(), |
291 | QCheckListItem::RadioButton ); | 291 | QCheckListItem::RadioButton ); |
292 | it->setPixmap( 0, NSResources->getPixmap( "commprofile" ) ); | 292 | it->setPixmap( 0, NSResources->getPixmap( "Devices/commprofile" ) ); |
293 | // remember that this node maps to this listitem | 293 | // remember that this node maps to this listitem |
294 | Mapping->insert( it, NN ); | 294 | Mapping->insert( it, NN ); |
295 | buildSubTree( it, NN ); | 295 | buildSubTree( it, NN ); |
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
299 | // Build device tree -> help function | 299 | // Build device tree -> help function |
300 | void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { | 300 | void EditConnection::buildSubTree( QListViewItem * it, ANetNode *NN ) { |
301 | ANetNode::NetNodeList & NNL = NN->alternatives(); | 301 | ANetNode::NetNodeList & NNL = NN->alternatives(); |
302 | 302 | ||
303 | if( NNL.size() > 1 ) { | 303 | if( NNL.size() > 1 ) { |
304 | // this node has alternatives -> needs radio buttons | 304 | // this node has alternatives -> needs radio buttons |
305 | it = new MyQCheckListItem( | 305 | it = new MyQCheckListItem( |
306 | it, | 306 | it, |
307 | NSResources->netNode2Name(NNL[0]->provides()), | 307 | NSResources->netNode2Name(NNL[0]->provides()), |
308 | QCheckListItem::Controller ); | 308 | QCheckListItem::Controller ); |
309 | it->setSelectable( FALSE ); | 309 | it->setSelectable( FALSE ); |
310 | } | 310 | } |
311 | 311 | ||
312 | for ( unsigned int i=0; i < NNL.size(); i++ ) { | 312 | for ( unsigned int i=0; i < NNL.size(); i++ ) { |
313 | QListViewItem * CI; | 313 | QListViewItem * CI; |
314 | if( NNL.size() > 1 ) { | 314 | if( NNL.size() > 1 ) { |
315 | // generate radio buttons | 315 | // generate radio buttons |
316 | CI = new MyQCheckListItem( | 316 | CI = new MyQCheckListItem( |
317 | (QCheckListItem *)it, | 317 | (QCheckListItem *)it, |
318 | NNL[i]->nodeName(), QCheckListItem::RadioButton ); | 318 | NNL[i]->nodeName(), QCheckListItem::RadioButton ); |
319 | // remember that this node maps to this listitem | 319 | // remember that this node maps to this listitem |
320 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); | 320 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); |
321 | Mapping->insert( CI, NNL[i] ); | 321 | Mapping->insert( CI, NNL[i] ); |
322 | CI->setSelectable( FALSE ); | 322 | CI->setSelectable( FALSE ); |
323 | } else { | 323 | } else { |
324 | // Single item | 324 | // Single item |
325 | CI = new MyQListViewItem( it, NNL[i]->nodeName() ); | 325 | CI = new MyQListViewItem( it, NNL[i]->nodeName() ); |
326 | // remember that this node maps to this listitem | 326 | // remember that this node maps to this listitem |
327 | Mapping->insert( CI, NNL[i] ); | 327 | Mapping->insert( CI, NNL[i] ); |
328 | CI->setSelectable( FALSE ); | 328 | CI->setSelectable( FALSE ); |
329 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); | 329 | CI->setPixmap( 0, NSResources->getPixmap( NNL[i]->pixmapName() ) ); |
330 | } | 330 | } |
331 | buildSubTree( CI, NNL[i] ); | 331 | buildSubTree( CI, NNL[i] ); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | // Clicked ok OK button | 335 | // Clicked ok OK button |
336 | void EditConnection::accept( void ) { | 336 | void EditConnection::accept( void ) { |
337 | if( ! haveCompleteConfig( 0 ) || Name_LE->text().isEmpty() ) { | 337 | if( ! haveCompleteConfig( 0 ) || Name_LE->text().isEmpty() ) { |
338 | QMessageBox::warning( | 338 | QMessageBox::warning( |
339 | 0, | 339 | 0, |
340 | tr( "Closing Connection Setup" ), | 340 | tr( "Closing Connection Setup" ), |
341 | tr( "Definition not complete or no name" ) ); | 341 | tr( "Definition not complete or no name" ) ); |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | 344 | ||
345 | // check if all devices have acceptable input | 345 | // check if all devices have acceptable input |
346 | getTmpCollection(); | 346 | getTmpCollection(); |
347 | { ANetNodeInstance * NNI; | 347 | { ANetNodeInstance * NNI; |
348 | QString S; | 348 | QString S; |
349 | 349 | ||
350 | for( QListIterator<ANetNodeInstance> it(TmpCollection); | 350 | for( QListIterator<ANetNodeInstance> it(TmpCollection); |
351 | it.current(); | 351 | it.current(); |
352 | ++it ) { | 352 | ++it ) { |
353 | NNI = it.current(); | 353 | NNI = it.current(); |
354 | // widget must show its own problems | 354 | // widget must show its own problems |
355 | S = NNI->acceptable(); | 355 | S = NNI->acceptable(); |
356 | if( ! S.isEmpty() ) { | 356 | if( ! S.isEmpty() ) { |
357 | QMessageBox::warning( | 357 | QMessageBox::warning( |
358 | 0, | 358 | 0, |
359 | tr( "Cannot save" ), | 359 | tr( "Cannot save" ), |
360 | S ); | 360 | S ); |
361 | return; | 361 | return; |
362 | } | 362 | } |
363 | NNI->commit(); | 363 | NNI->commit(); |
364 | 364 | ||
365 | if( NNI->isModified() ) { | 365 | if( NNI->isModified() ) { |
366 | TmpCollection.setModified( 1 ); | 366 | TmpCollection.setModified( 1 ); |
367 | // commit the data | 367 | // commit the data |
368 | } | 368 | } |
369 | } | 369 | } |
370 | } | 370 | } |
371 | 371 | ||
372 | QDialog::accept(); | 372 | QDialog::accept(); |
373 | } | 373 | } |
374 | 374 | ||
375 | // triggered by CB | 375 | // triggered by CB |
376 | void EditConnection::SLOT_AutoCollapse( bool b ) { | 376 | void EditConnection::SLOT_AutoCollapse( bool b ) { |
377 | AutoCollapse = b; | 377 | AutoCollapse = b; |
378 | } | 378 | } |
379 | 379 | ||
380 | // clicked on node in tree -> update GUI | 380 | // clicked on node in tree -> update GUI |
381 | void EditConnection::SLOT_SelectNode( QListViewItem * it ) { | 381 | void EditConnection::SLOT_SelectNode( QListViewItem * it ) { |
382 | ANetNode * NN; | 382 | ANetNode * NN; |
383 | if( it == 0 || it->depth() == 0 ) { | 383 | if( it == 0 || it->depth() == 0 ) { |
384 | Description_LBL->setText( | 384 | Description_LBL->setText( |
385 | NSResources->netNode2Description( "fullsetup" ) ); | 385 | NSResources->netNode2Description( "fullsetup" ) ); |
386 | // topevel or no selection | 386 | // topevel or no selection |
387 | return; | 387 | return; |
388 | } | 388 | } |
389 | 389 | ||
390 | // store conversion from lvitem to node | 390 | // store conversion from lvitem to node |
391 | NN = (*Mapping)[ it ]; | 391 | NN = (*Mapping)[ it ]; |
392 | 392 | ||
393 | if( ! NN ) { | 393 | if( ! NN ) { |
394 | // intermediate node | 394 | // intermediate node |
395 | NN = (*Mapping)[ it->firstChild() ]; | 395 | NN = (*Mapping)[ it->firstChild() ]; |
396 | if( NN ) { | 396 | if( NN ) { |
397 | // figure out type of this node -> produce mesage | 397 | // figure out type of this node -> produce mesage |
398 | Description_LBL->setText( NSResources->netNode2Description(NN->provides()) ); | 398 | Description_LBL->setText( NSResources->netNode2Description(NN->provides()) ); |
399 | } else { | 399 | } else { |
400 | Description_LBL->setText( "" ); | 400 | Description_LBL->setText( "" ); |
401 | } | 401 | } |
402 | return; | 402 | return; |
403 | } | 403 | } |
404 | 404 | ||
405 | Description_LBL->setText( NN->nodeDescription() ); | 405 | Description_LBL->setText( NN->nodeDescription() ); |
406 | 406 | ||
407 | if( ! it->isSelectable() ) { | 407 | if( ! it->isSelectable() ) { |
408 | return; | 408 | return; |
409 | } | 409 | } |
410 | 410 | ||
411 | if( ! ((QCheckListItem *)it)->isOn() ) { | 411 | if( ! ((QCheckListItem *)it)->isOn() ) { |
412 | // clicked on line but NOT on Check or Radio item | 412 | // clicked on line but NOT on Check or Radio item |
413 | return; | 413 | return; |
414 | } | 414 | } |
415 | 415 | ||
416 | // item has really changed -> update | 416 | // item has really changed -> update |
417 | TmpIsValid = 0; | 417 | TmpIsValid = 0; |
418 | updateGUI( it, NN ); | 418 | updateGUI( it, NN ); |
419 | } | 419 | } |
420 | 420 | ||
421 | // cliecked on TAB to go to setup | 421 | // cliecked on TAB to go to setup |
422 | void EditConnection::SLOT_AlterTab( const QString & S ) { | 422 | void EditConnection::SLOT_AlterTab( const QString & S ) { |
423 | if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) { | 423 | if( S == tr( "Setup" ) && Setup_FRM->isEnabled() ) { |
424 | // switched to setup -> update CB and populate ws with | 424 | // switched to setup -> update CB and populate ws with |
425 | // forms for devices | 425 | // forms for devices |
426 | 426 | ||
427 | if( ! TmpIsValid ) { | 427 | if( ! TmpIsValid ) { |
428 | getTmpCollection(); | 428 | getTmpCollection(); |
429 | 429 | ||
430 | // clear CB and Ws | 430 | // clear CB and Ws |
431 | { QWidget * W; | 431 | { QWidget * W; |
432 | int i = 0; | 432 | int i = 0; |
433 | 433 | ||
434 | Devices_CB->clear(); | 434 | Devices_CB->clear(); |
435 | while( ( W = Setup_WS->widget( i ) ) ) { | 435 | while( ( W = Setup_WS->widget( i ) ) ) { |
436 | Setup_WS->removeWidget( W ); | 436 | Setup_WS->removeWidget( W ); |
437 | i ++; | 437 | i ++; |
438 | } | 438 | } |
439 | } | 439 | } |
440 | 440 | ||
441 | // update CB | 441 | // update CB |
442 | // and populate WidgetStack | 442 | // and populate WidgetStack |
443 | { ANetNodeInstance * NNI; | 443 | { ANetNodeInstance * NNI; |
444 | QListIterator<ANetNodeInstance> it(TmpCollection); | 444 | QListIterator<ANetNodeInstance> it(TmpCollection); |
445 | int i = 0; | 445 | int i = 0; |
446 | QWidget * W; | 446 | QWidget * W; |
447 | 447 | ||
448 | for ( ; it.current(); ++it ) { | 448 | for ( ; it.current(); ++it ) { |
449 | NNI = it.current(); | 449 | NNI = it.current(); |
450 | Devices_CB->insertItem( | 450 | Devices_CB->insertItem( |
451 | NSResources->getPixmap( NNI->netNode()->pixmapName() ), | 451 | NSResources->getPixmap( NNI->netNode()->pixmapName() ), |
452 | NNI->netNode()->nodeName() | 452 | NNI->netNode()->nodeName() |
453 | ); | 453 | ); |
454 | 454 | ||
455 | // add edit widget | 455 | // add edit widget |
456 | W = NNI->edit( Setup_WS ); | 456 | W = NNI->edit( Setup_WS ); |
457 | if( ! W) { | 457 | if( ! W) { |
458 | W = new QLabel( Setup_WS, | 458 | W = new QLabel( Setup_WS, |
459 | tr("No configuration required")); | 459 | tr("No configuration required")); |
460 | } | 460 | } |
461 | Setup_WS->addWidget( W , i ); | 461 | Setup_WS->addWidget( W , i ); |
462 | i ++; | 462 | i ++; |
463 | } | 463 | } |
464 | } | 464 | } |
465 | Setup_WS->raiseWidget( 0 ); | 465 | Setup_WS->raiseWidget( 0 ); |
466 | } // still valid | 466 | } // still valid |
467 | } | 467 | } |
468 | } | 468 | } |
469 | 469 | ||
470 | // update visual feedback of selection state | 470 | // update visual feedback of selection state |
471 | void EditConnection::updateGUI( QListViewItem * it, ANetNode * NN ) { | 471 | void EditConnection::updateGUI( QListViewItem * it, ANetNode * NN ) { |
472 | 472 | ||
473 | bool HCC = haveCompleteConfig( it ); | 473 | bool HCC = haveCompleteConfig( it ); |
474 | Tab_TB->setTabEnabled( Setup_FRM, HCC ); | 474 | Tab_TB->setTabEnabled( Setup_FRM, HCC ); |
475 | Setup_FRM->setEnabled( HCC ); | 475 | Setup_FRM->setEnabled( HCC ); |
476 | 476 | ||
477 | // disable children of all siblings at same level | 477 | // disable children of all siblings at same level |
478 | QListViewItem * Sbl = it->parent()->firstChild(); | 478 | QListViewItem * Sbl = it->parent()->firstChild(); |
479 | while( Sbl ) { | 479 | while( Sbl ) { |
480 | if ( Sbl != it ) { | 480 | if ( Sbl != it ) { |
481 | disableTree( Sbl->firstChild(), FALSE ); | 481 | disableTree( Sbl->firstChild(), FALSE ); |
482 | Sbl->setSelectable( TRUE ); | 482 | Sbl->setSelectable( TRUE ); |
483 | if( AutoCollapse ) | 483 | if( AutoCollapse ) |
484 | Sbl->setOpen( FALSE ); | 484 | Sbl->setOpen( FALSE ); |
485 | } | 485 | } |
486 | Sbl = Sbl->nextSibling(); | 486 | Sbl = Sbl->nextSibling(); |
487 | } | 487 | } |
488 | 488 | ||
489 | // enable selected path (as deep as it goes | 489 | // enable selected path (as deep as it goes |
490 | it->setOpen( TRUE ); | 490 | it->setOpen( TRUE ); |
491 | enablePath( it->firstChild(), | 491 | enablePath( it->firstChild(), |
492 | (it->depth()==1) ? | 492 | (it->depth()==1) ? |
493 | 1 : // toplevel always alternatives | 493 | 1 : // toplevel always alternatives |
494 | (NN->alternatives().size() > 1) ); | 494 | (NN->alternatives().size() > 1) ); |
495 | } | 495 | } |
496 | 496 | ||
497 | void EditConnection::disableTree( QListViewItem * it, bool Mode ) { | 497 | void EditConnection::disableTree( QListViewItem * it, bool Mode ) { |
498 | while( it ) { | 498 | while( it ) { |
499 | // disable sbl's chidren | 499 | // disable sbl's chidren |
500 | it->setSelectable( Mode ); | 500 | it->setSelectable( Mode ); |
501 | if( AutoCollapse ) | 501 | if( AutoCollapse ) |
502 | it->setOpen( Mode ); | 502 | it->setOpen( Mode ); |
503 | disableTree( it->firstChild(), Mode ); | 503 | disableTree( it->firstChild(), Mode ); |
504 | it = it->nextSibling(); | 504 | it = it->nextSibling(); |
505 | } | 505 | } |
506 | } | 506 | } |
507 | 507 | ||
508 | // pah : ParentHasAlternatives | 508 | // pah : ParentHasAlternatives |
509 | void EditConnection::enablePath( QListViewItem * it, bool pha ) { | 509 | void EditConnection::enablePath( QListViewItem * it, bool pha ) { |
510 | while( it ) { | 510 | while( it ) { |
511 | ANetNode * NN; | 511 | ANetNode * NN; |
512 | NN = (*Mapping)[it]; | 512 | NN = (*Mapping)[it]; |
513 | if( NN ) { | 513 | if( NN ) { |
514 | if( pha ) { | 514 | if( pha ) { |
515 | bool doOn = ((QCheckListItem *)it)->isOn(); | 515 | bool doOn = ((QCheckListItem *)it)->isOn(); |
516 | // we are a checklistitem for sure | 516 | // we are a checklistitem for sure |
517 | it->setSelectable( TRUE ); | 517 | it->setSelectable( TRUE ); |
518 | if( AutoCollapse && ! doOn ) | 518 | if( AutoCollapse && ! doOn ) |
519 | it->setOpen( doOn ); | 519 | it->setOpen( doOn ); |
520 | if( doOn ) { | 520 | if( doOn ) { |
521 | // selected alternative | 521 | // selected alternative |
522 | enablePath( it->firstChild(), | 522 | enablePath( it->firstChild(), |
523 | NN->alternatives().size() > 1); | 523 | NN->alternatives().size() > 1); |
524 | } else { | 524 | } else { |
525 | // non-selected alternative | 525 | // non-selected alternative |
526 | disableTree( it->firstChild(), FALSE); | 526 | disableTree( it->firstChild(), FALSE); |
527 | } | 527 | } |
528 | } else { | 528 | } else { |
529 | // we are single subitem | 529 | // we are single subitem |
530 | it->setSelectable( TRUE ); | 530 | it->setSelectable( TRUE ); |
531 | it->setOpen( TRUE ); | 531 | it->setOpen( TRUE ); |
532 | enablePath( it->firstChild(), | 532 | enablePath( it->firstChild(), |
533 | NN->alternatives().size() > 1); | 533 | NN->alternatives().size() > 1); |
534 | } | 534 | } |
535 | } else { | 535 | } else { |
536 | // controller node | 536 | // controller node |
537 | it->setSelectable( TRUE ); | 537 | it->setSelectable( TRUE ); |
538 | it->setOpen( TRUE ); | 538 | it->setOpen( TRUE ); |
539 | enablePath( it->firstChild(), pha ); | 539 | enablePath( it->firstChild(), pha ); |
540 | } | 540 | } |
541 | it = it->nextSibling(); | 541 | it = it->nextSibling(); |
542 | } | 542 | } |
543 | } | 543 | } |
544 | 544 | ||
545 | // do we have a complete configuration (all needs are provided for ?) | 545 | // do we have a complete configuration (all needs are provided for ?) |
546 | bool EditConnection::haveCompleteConfig( QListViewItem * it ) { | 546 | bool EditConnection::haveCompleteConfig( QListViewItem * it ) { |
547 | if( it == 0 || ((QCheckListItem *)it)->isOn() ) { | 547 | if( it == 0 || ((QCheckListItem *)it)->isOn() ) { |
548 | // check children | 548 | // check children |
549 | it = (it) ? it->firstChild() : Nodes_LV->firstChild() ; | 549 | it = (it) ? it->firstChild() : Nodes_LV->firstChild() ; |
550 | while ( it ) { | 550 | while ( it ) { |
551 | if( ((QCheckListItem *)it)->type() == | 551 | if( ((QCheckListItem *)it)->type() == |
552 | QCheckListItem::Controller ) { | 552 | QCheckListItem::Controller ) { |
553 | // child is controller -> has sub radio | 553 | // child is controller -> has sub radio |
554 | // check if one radio is selected | 554 | // check if one radio is selected |
555 | it = it->firstChild(); | 555 | it = it->firstChild(); |
556 | while( it ) { | 556 | while( it ) { |
557 | if( ((QCheckListItem *)it)->isOn() ) { | 557 | if( ((QCheckListItem *)it)->isOn() ) { |
558 | // this radio is selected -> go deeper | 558 | // this radio is selected -> go deeper |
559 | it = it->firstChild(); | 559 | it = it->firstChild(); |
560 | if( ! it ) { | 560 | if( ! it ) { |
561 | // was deepest level | 561 | // was deepest level |
562 | return 1; | 562 | return 1; |
563 | } | 563 | } |
564 | // do not bother to check other items | 564 | // do not bother to check other items |
565 | break; | 565 | break; |
566 | } | 566 | } |
567 | it = it->nextSibling(); | 567 | it = it->nextSibling(); |
568 | } | 568 | } |
569 | if( ! it ) { | 569 | if( ! it ) { |
570 | // no radio selected | 570 | // no radio selected |
571 | return 0; | 571 | return 0; |
572 | } | 572 | } |
573 | } else { | 573 | } else { |
574 | // check children | 574 | // check children |
575 | it = it->firstChild(); | 575 | it = it->firstChild(); |
576 | } | 576 | } |
577 | } | 577 | } |
578 | // deepest level -> all is still OK | 578 | // deepest level -> all is still OK |
579 | return 1; | 579 | return 1; |
580 | } // was not ON | 580 | } // was not ON |
581 | return 0; | 581 | return 0; |
582 | } | 582 | } |
diff --git a/noncore/settings/networksettings2/irda/irda_NN.h b/noncore/settings/networksettings2/irda/irda_NN.h index 82811a4..6574c17 100644 --- a/noncore/settings/networksettings2/irda/irda_NN.h +++ b/noncore/settings/networksettings2/irda/irda_NN.h | |||
@@ -1,44 +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 "irda"; } | 18 | { return "Devices/irda"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("Infrared link"); } | 21 | { return tr("Infrared link"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/lancard/lancard_NN.h b/noncore/settings/networksettings2/lancard/lancard_NN.h index 576a6e0..71b49d0 100644 --- a/noncore/settings/networksettings2/lancard/lancard_NN.h +++ b/noncore/settings/networksettings2/lancard/lancard_NN.h | |||
@@ -1,44 +1,44 @@ | |||
1 | #ifndef LANCARD_NETNODE_H | 1 | #ifndef LANCARD_NETNODE_H |
2 | #define LANCARD_NETNODE_H | 2 | #define LANCARD_NETNODE_H |
3 | 3 | ||
4 | #include "netnode.h" | 4 | #include "netnode.h" |
5 | 5 | ||
6 | class ALanCard; | 6 | class ALanCard; |
7 | 7 | ||
8 | class LanCardNetNode : public ANetNode{ | 8 | class LanCardNetNode : public ANetNode{ |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | 13 | ||
14 | LanCardNetNode(); | 14 | LanCardNetNode(); |
15 | virtual ~LanCardNetNode(); | 15 | virtual ~LanCardNetNode(); |
16 | 16 | ||
17 | virtual const QString pixmapName() | 17 | virtual const QString pixmapName() |
18 | { return "card"; } | 18 | { return "Devices/card"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("LAN card"); } | 21 | { return tr("LAN card"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp index 1e1270e..7ec26a7 100644 --- a/noncore/settings/networksettings2/main.cpp +++ b/noncore/settings/networksettings2/main.cpp | |||
@@ -1,119 +1,119 @@ | |||
1 | #include "nsdata.h" | 1 | #include "nsdata.h" |
2 | #include "activateprofile.h" | 2 | #include "activateprofile.h" |
3 | #include "networksettings.h" | 3 | #include "networksettings.h" |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | 5 | ||
6 | #include <opie/oapplicationfactory.h> | 6 | #include <opie/oapplicationfactory.h> |
7 | 7 | ||
8 | #ifdef GONE | 8 | #ifdef GONE |
9 | 9 | ||
10 | OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> ) | 10 | OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> ) |
11 | 11 | ||
12 | #else | 12 | #else |
13 | 13 | ||
14 | // just standard GUI | 14 | // just standard GUI |
15 | #define ACT_GUI 0 | 15 | #define ACT_GUI 0 |
16 | // used by interfaces to request for allow of up/down | 16 | // used by interfaces to request for allow of up/down |
17 | #define ACT_REQUEST 1 | 17 | #define ACT_REQUEST 1 |
18 | // regenerate config files | 18 | // regenerate config files |
19 | #define ACT_REGEN 2 | 19 | #define ACT_REGEN 2 |
20 | // used by interfaces to request user prompt | 20 | // used by interfaces to request user prompt |
21 | #define ACT_PROMPT 3 | 21 | #define ACT_PROMPT 3 |
22 | 22 | ||
23 | int main( int argc, char * argv[] ) { | 23 | int main( int argc, char * argv[] ) { |
24 | int rv = 0; | 24 | int rv = 0; |
25 | int Action = ACT_GUI; | 25 | int Action = ACT_GUI; |
26 | // could be overruled by -qws | 26 | // could be overruled by -qws |
27 | QApplication::Type GuiType = QApplication::GuiClient; | 27 | QApplication::Type GuiType = QApplication::GuiClient; |
28 | 28 | ||
29 | #ifdef _WS_QWS_ | 29 | #ifdef _WS_QWS_ |
30 | QPEApplication * TheApp; | 30 | QPEApplication * TheApp; |
31 | #else | 31 | #else |
32 | QApplication * TheApp; | 32 | QApplication * TheApp; |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | for ( int i = 1; i < argc; i ++ ) { | 35 | for ( int i = 1; i < argc; i ++ ) { |
36 | int rmv; | 36 | int rmv; |
37 | rmv = 0; | 37 | rmv = 0; |
38 | if( strcmp( argv[i], "--regen" ) == 0 ) { | 38 | if( strcmp( argv[i], "--regen" ) == 0 ) { |
39 | Action = ACT_REGEN; | 39 | Action = ACT_REGEN; |
40 | GuiType = QApplication::Tty; | 40 | GuiType = QApplication::Tty; |
41 | rmv = 1; | 41 | rmv = 1; |
42 | } else if( strcmp( argv[i], "--prompt" ) == 0 ) { | 42 | } else if( strcmp( argv[i], "--prompt" ) == 0 ) { |
43 | Action = ACT_PROMPT; | 43 | Action = ACT_PROMPT; |
44 | rmv = 1; | 44 | rmv = 1; |
45 | } | 45 | } |
46 | if( rmv ) { | 46 | if( rmv ) { |
47 | memmove( argv+i, argv+i+rmv, | 47 | memmove( argv+i, argv+i+rmv, |
48 | sizeof( char * ) * (argc-i-rmv) ); | 48 | sizeof( char * ) * (argc-i-rmv) ); |
49 | i --; | 49 | i --; |
50 | argc -= rmv; | 50 | argc -= rmv; |
51 | } | 51 | } |
52 | } | 52 | } |
53 | 53 | ||
54 | if( strstr( argv[0], "-request" ) ) { | 54 | if( strstr( argv[0], "-request" ) ) { |
55 | // called from system to request something | 55 | // called from system to request something |
56 | GuiType = QApplication::Tty; | 56 | GuiType = QApplication::Tty; |
57 | Action = ACT_REQUEST; | 57 | Action = ACT_REQUEST; |
58 | } | 58 | } |
59 | 59 | ||
60 | // Start Qt | 60 | // Start Qt |
61 | #ifdef _WS_QWS_ | 61 | #ifdef _WS_QWS_ |
62 | // because QPEApplication does not handle GuiType well | 62 | // because QPEApplication does not handle GuiType well |
63 | if( GuiType == QApplication::Tty ) { | 63 | if( GuiType == QApplication::Tty ) { |
64 | // this cast is NOT correct but we do not use | 64 | // this cast is NOT correct but we do not use |
65 | // TheApp anymore ... | 65 | // TheApp anymore ... |
66 | TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType ); | 66 | TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType ); |
67 | } else { | 67 | } else { |
68 | TheApp = new QPEApplication( argc, argv, GuiType ); | 68 | TheApp = new QPEApplication( argc, argv, GuiType ); |
69 | } | 69 | } |
70 | #else | 70 | #else |
71 | TheApp = new QApplication( argc, argv, GuiType ); | 71 | TheApp = new QApplication( argc, argv, GuiType ); |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | // init qt with app widget | 74 | // init qt with app widget |
75 | 75 | ||
76 | switch( Action ) { | 76 | switch( Action ) { |
77 | case ACT_REQUEST : | 77 | case ACT_REQUEST : |
78 | { NetworkSettingsData NS; | 78 | { NetworkSettingsData NS; |
79 | NS.canStart( argv[1] ); | 79 | NS.canStart( argv[1] ); |
80 | } | 80 | } |
81 | break; | 81 | break; |
82 | case ACT_REGEN : | 82 | case ACT_REGEN : |
83 | { NetworkSettingsData NS; | 83 | { NetworkSettingsData NS; |
84 | // regen returns 0 if OK | 84 | // regen returns 0 if OK |
85 | rv = (NS.regenerate()) ? 1 : 0; | 85 | rv = (NS.regenerate()) ? 1 : 0; |
86 | } | 86 | } |
87 | break; | 87 | break; |
88 | case ACT_PROMPT : | 88 | case ACT_PROMPT : |
89 | { ActivateProfile AP(argv[1]); | 89 | { ActivateProfile AP(argv[1]); |
90 | if( AP.exec() == QDialog::Accepted ) { | 90 | if( AP.exec() == QDialog::Accepted ) { |
91 | printf( "%s-c%d-allowed", AP.selectedProfile() ); | 91 | printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() ); |
92 | } else { | 92 | } else { |
93 | printf( "%s-cNN-disallowed" ); | 93 | printf( "%s-cNN-disallowed", argv[1] ); |
94 | } | 94 | } |
95 | } | 95 | } |
96 | break; | 96 | break; |
97 | case ACT_GUI : | 97 | case ACT_GUI : |
98 | { QWidget * W = new NetworkSettings(0); | 98 | { QWidget * W = new NetworkSettings(0); |
99 | TheApp->setMainWidget( W ); | 99 | TheApp->setMainWidget( W ); |
100 | W->show(); | 100 | W->show(); |
101 | #ifdef _WS_QWS_ | 101 | #ifdef _WS_QWS_ |
102 | W->showMaximized(); | 102 | W->showMaximized(); |
103 | #else | 103 | #else |
104 | W->resize( W->sizeHint() ); | 104 | W->resize( W->sizeHint() ); |
105 | #endif | 105 | #endif |
106 | rv = TheApp->exec(); | 106 | rv = TheApp->exec(); |
107 | delete W; | 107 | delete W; |
108 | } | 108 | } |
109 | break; | 109 | break; |
110 | } | 110 | } |
111 | 111 | ||
112 | return rv; | 112 | return rv; |
113 | } | 113 | } |
114 | 114 | ||
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | 117 | ||
118 | // main.cpp | 118 | // main.cpp |
119 | 119 | ||
diff --git a/noncore/settings/networksettings2/modem/modem_NN.h b/noncore/settings/networksettings2/modem/modem_NN.h index 0f4c124..5eceed2 100644 --- a/noncore/settings/networksettings2/modem/modem_NN.h +++ b/noncore/settings/networksettings2/modem/modem_NN.h | |||
@@ -1,44 +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 "modem"; } | 18 | { return "Devices/modem"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("Dialup modem"); } | 21 | { return tr("Dialup modem"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/network/network_NN.h b/noncore/settings/networksettings2/network/network_NN.h index 3b0cd64..220e00f 100644 --- a/noncore/settings/networksettings2/network/network_NN.h +++ b/noncore/settings/networksettings2/network/network_NN.h | |||
@@ -1,44 +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 "tcpip"; } | 18 | { return "Devices/tcpip"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("IP Configuration"); } | 21 | { return tr("IP Configuration"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp index e732bfa..8deca14 100644 --- a/noncore/settings/networksettings2/network/networkrun.cpp +++ b/noncore/settings/networksettings2/network/networkrun.cpp | |||
@@ -1,63 +1,63 @@ | |||
1 | #include <system.h> | 1 | #include <system.h> |
2 | #include <asdevice.h> | 2 | #include <asdevice.h> |
3 | #include "networkrun.h" | 3 | #include "networkrun.h" |
4 | 4 | ||
5 | void NetworkRun::detectState( NodeCollection * NC ) { | 5 | void NetworkRun::detectState( NodeCollection * NC ) { |
6 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); | 6 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); |
7 | AsDevice * Next = RI->asDevice(); | 7 | AsDevice * Next = RI->asDevice(); |
8 | InterfaceInfo * II = Next->assignedInterface(); | 8 | InterfaceInfo * II = Next->assignedInterface(); |
9 | 9 | ||
10 | if( II ) { | 10 | if( II ) { |
11 | // device has assigned interface | 11 | // device has assigned interface |
12 | NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) ); | 12 | NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) ); |
13 | } | 13 | } |
14 | 14 | ||
15 | // has no interface -> delegate | 15 | // has no interface -> delegate |
16 | RI->detectState( NC ); | 16 | RI->detectState( NC ); |
17 | } | 17 | } |
18 | 18 | ||
19 | bool NetworkRun::setState( NodeCollection * NC, Action_t A ) { | 19 | bool NetworkRun::setState( NodeCollection * NC, Action_t A ) { |
20 | // we handle UP and DOWN | 20 | // we handle UP and DOWN |
21 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); | 21 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); |
22 | AsDevice * Next = RI->asDevice(); | 22 | AsDevice * Next = RI->asDevice(); |
23 | InterfaceInfo * II = Next->assignedInterface(); | 23 | InterfaceInfo * II = Next->assignedInterface(); |
24 | 24 | ||
25 | if( A == Up ) { | 25 | if( A == Up ) { |
26 | // we can bring UP if lower level is available | 26 | // we can bring UP if lower level is available |
27 | if( NC->currentState() == Available ) { | 27 | if( NC->currentState() == Available ) { |
28 | QString S; | 28 | QString S; |
29 | S.sprintf( "ifup %s=manual", II->Name.latin1() ); | 29 | S.sprintf( "ifup %s", II->Name.latin1() ); |
30 | NSResources->system().execute( S ); | 30 | NSResources->system().execute( S ); |
31 | NC->setCurrentState( IsUp ); | 31 | NC->setCurrentState( IsUp ); |
32 | } | 32 | } |
33 | return 1; | 33 | return 1; |
34 | } else if( A == Down ) { | 34 | } else if( A == Down ) { |
35 | if( NC->currentState() == IsUp ) { | 35 | if( NC->currentState() == IsUp ) { |
36 | QString S; | 36 | QString S; |
37 | S.sprintf( "ifdown %s", II->Name.latin1() ); | 37 | S.sprintf( "ifdown %s", II->Name.latin1() ); |
38 | NSResources->system().execute( S ); | 38 | NSResources->system().execute( S ); |
39 | NC->setCurrentState( Available ); | 39 | NC->setCurrentState( Available ); |
40 | } | 40 | } |
41 | return 1; | 41 | return 1; |
42 | } | 42 | } |
43 | // delegate | 43 | // delegate |
44 | return RI->setState( NC, A ); | 44 | return RI->setState( NC, A ); |
45 | } | 45 | } |
46 | 46 | ||
47 | bool NetworkRun::canSetState( State_t Curr, Action_t A ) { | 47 | bool NetworkRun::canSetState( State_t Curr, Action_t A ) { |
48 | // we handle UP and DOWN | 48 | // we handle UP and DOWN |
49 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); | 49 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); |
50 | 50 | ||
51 | if( A == Up ) { | 51 | if( A == Up ) { |
52 | return ( Curr == Available ); | 52 | return ( Curr == Available ); |
53 | } else if( A == Down ) { | 53 | } else if( A == Down ) { |
54 | return ( Curr == IsUp ); | 54 | return ( Curr == IsUp ); |
55 | } | 55 | } |
56 | // delegate | 56 | // delegate |
57 | return RI->canSetState( Curr, A ); | 57 | return RI->canSetState( Curr, A ); |
58 | } | 58 | } |
59 | 59 | ||
60 | bool NetworkRun::handlesInterface( const QString & S ) { | 60 | bool NetworkRun::handlesInterface( const QString & S ) { |
61 | // donno -> pass deeper | 61 | // donno -> pass deeper |
62 | return netNode()->nextNode()->runtime()->handlesInterface(S); | 62 | return netNode()->nextNode()->runtime()->handlesInterface(S); |
63 | } | 63 | } |
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp index f72fa8e..e1110e2 100644 --- a/noncore/settings/networksettings2/networksettings.cpp +++ b/noncore/settings/networksettings2/networksettings.cpp | |||
@@ -1,414 +1,411 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | 2 | ||
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | #include <qiconset.h> | 4 | #include <qlistbox.h> |
5 | #include <qgroupbox.h> | 5 | #include <qgroupbox.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qlistbox.h> | 7 | #include <qlistbox.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlabel.h> | 9 | #include <qlabel.h> |
10 | #include <qiconview.h> | 10 | #include <qiconview.h> |
11 | #include <qtimer.h> | 11 | #include <qtimer.h> |
12 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
13 | #include <qtoolbutton.h> | 13 | #include <qtoolbutton.h> |
14 | 14 | ||
15 | #include <asdevice.h> | 15 | #include <asdevice.h> |
16 | #include "networksettings.h" | 16 | #include "networksettings.h" |
17 | #include "netnode.h" | 17 | #include "netnode.h" |
18 | #include "editconnection.h" | 18 | #include "editconnection.h" |
19 | 19 | ||
20 | NetworkSettings::NetworkSettings( QWidget *parent, | 20 | NetworkSettings::NetworkSettings( QWidget *parent, |
21 | const char *name, | 21 | const char *name, |
22 | WFlags fl ) : NetworkSettingsGUI(parent,name,fl), | 22 | WFlags fl ) : NetworkSettingsGUI(parent,name,fl), |
23 | NSD() { | 23 | NSD() { |
24 | 24 | ||
25 | UpdateTimer = new QTimer( this ); | 25 | UpdateTimer = new QTimer( this ); |
26 | // set pixmaps | 26 | // set pixmaps |
27 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 27 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
28 | Delete_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 28 | Delete_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
29 | CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) ); | 29 | CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) ); |
30 | Enable_TB->setPixmap( NSResources->getPixmap( "disabled" ) ); | 30 | Enable_TB->setPixmap( NSResources->getPixmap( "disabled" ) ); |
31 | GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) ); | 31 | GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) ); |
32 | 32 | ||
33 | Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) ); | 33 | Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) ); |
34 | 34 | ||
35 | On_TB->setPixmap( NSResources->getPixmap( "off" ) ); | 35 | On_TB->setPixmap( NSResources->getPixmap( "off" ) ); |
36 | 36 | ||
37 | // populate main Listbox | 37 | // populate main Listbox |
38 | Profiles_IV->clear(); | 38 | Profiles_LB->clear(); |
39 | { Name2Connection_t & M = NSResources->connections(); | 39 | { Name2Connection_t & M = NSResources->connections(); |
40 | NodeCollection * NC; | 40 | NodeCollection * NC; |
41 | QIconViewItem * IVI; | ||
42 | |||
43 | // for all connections | 41 | // for all connections |
44 | for( QDictIterator<NodeCollection> it(M); | 42 | for( QDictIterator<NodeCollection> it(M); |
45 | it.current(); | 43 | it.current(); |
46 | ++it ) { | 44 | ++it ) { |
47 | NC = it.current(); | 45 | NC = it.current(); |
48 | IVI = new QIconViewItem( Profiles_IV, | 46 | Profiles_LB->insertItem( NC->devicePixmap(), |
49 | NC->name(), | 47 | NC->name() ); |
50 | NC->devicePixmap() ); | ||
51 | } | 48 | } |
52 | } | 49 | } |
53 | 50 | ||
54 | if( Profiles_IV->count() ) { | 51 | if( Profiles_LB->count() ) { |
55 | Profiles_IV->setSelected( Profiles_IV->firstItem(), TRUE ); | 52 | Profiles_LB->setSelected( 0, TRUE ); |
56 | } | 53 | } |
57 | 54 | ||
58 | // if no profiles -> auto popup editing | 55 | // if no profiles -> auto popup editing |
59 | if( NSResources->connections().count() == 0 ) { | 56 | if( NSResources->connections().count() == 0 ) { |
60 | QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) ); | 57 | QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) ); |
61 | } | 58 | } |
62 | 59 | ||
63 | UpdateTimer->start( 5000 ); | 60 | UpdateTimer->start( 5000 ); |
64 | connect( UpdateTimer, SIGNAL( timeout() ), | 61 | connect( UpdateTimer, SIGNAL( timeout() ), |
65 | this, SLOT( SLOT_RefreshStates() ) ); | 62 | this, SLOT( SLOT_RefreshStates() ) ); |
66 | 63 | ||
67 | /* Add QCopChannel */ | 64 | /* Add QCopChannel */ |
68 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), | 65 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
69 | this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) ); | 66 | this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) ); |
70 | } | 67 | } |
71 | 68 | ||
72 | NetworkSettings::~NetworkSettings() { | 69 | NetworkSettings::~NetworkSettings() { |
73 | QString S; | 70 | QString S; |
74 | 71 | ||
75 | S = NSD.generateSettings(); | 72 | S = NSD.generateSettings(); |
76 | if( ! S.isEmpty() ) { | 73 | if( ! S.isEmpty() ) { |
77 | QMessageBox::warning( | 74 | QMessageBox::warning( |
78 | 0, | 75 | 0, |
79 | tr( "Generating system configuration" ), | 76 | tr( "Generating system configuration" ), |
80 | S | 77 | S |
81 | ); | 78 | ); |
82 | } | 79 | } |
83 | 80 | ||
84 | S = NSD.saveSettings(); | 81 | S = NSD.saveSettings(); |
85 | if( ! S.isEmpty() ) { | 82 | if( ! S.isEmpty() ) { |
86 | // problem saving | 83 | // problem saving |
87 | QMessageBox::warning( | 84 | QMessageBox::warning( |
88 | 0, | 85 | 0, |
89 | tr( "Saving setup" ), S ); | 86 | tr( "Saving setup" ), S ); |
90 | } | 87 | } |
91 | } | 88 | } |
92 | 89 | ||
93 | void NetworkSettings::SLOT_RefreshStates( void ) { | 90 | void NetworkSettings::SLOT_RefreshStates( void ) { |
94 | QIconViewItem * IVI = Profiles_IV->currentItem(); // remeber | 91 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember |
95 | 92 | ||
96 | if( IVI ) { | 93 | if( LBI ) { |
97 | NodeCollection * NC; | 94 | NodeCollection * NC; |
98 | NSResources->system().probeInterfaces(); | 95 | NSResources->system().probeInterfaces(); |
99 | // update current selection only | 96 | // update current selection only |
100 | NC = NSResources->findConnection( IVI->text() ); | 97 | NC = NSResources->findConnection( LBI->text() ); |
101 | if( NC ) { | 98 | if( NC ) { |
102 | State_t OldS = NC->state(); | 99 | State_t OldS = NC->state(); |
103 | State_t NewS = NC->state(1); | 100 | State_t NewS = NC->state(1); |
104 | if( OldS != NewS ) { | 101 | if( OldS != NewS ) { |
105 | updateProfileState( IVI ); | 102 | updateProfileState( LBI ); |
106 | } | 103 | } |
107 | } | 104 | } |
108 | } | 105 | } |
109 | 106 | ||
110 | 107 | ||
111 | /* -> LATER !! | 108 | /* -> LATER !! |
112 | bool is; | 109 | bool is; |
113 | NodeCollection * NC; | 110 | NodeCollection * NC; |
114 | 111 | ||
115 | for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) { | 112 | for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) { |
116 | NC = NSResources->findConnection( Profiles_LB->text(i) ); | 113 | NC = NSResources->findConnection( Profiles_LB->text(i) ); |
117 | if( NC ) { | 114 | if( NC ) { |
118 | State_t OldS = NC->state(); | 115 | State_t OldS = NC->state(); |
119 | State_t NewS = NC->state(1); | 116 | State_t NewS = NC->state(1); |
120 | if( OldS != NewS ) { | 117 | if( OldS != NewS ) { |
121 | is = Profiles_LB->isSelected(i); | 118 | is = Profiles_LB->isSelected(i); |
122 | Profiles_LB->changeItem( NC->statePixmap(NewS), | 119 | Profiles_LB->changeItem( NC->statePixmap(NewS), |
123 | NC->name(), | 120 | NC->name(), |
124 | i ); | 121 | i ); |
125 | if( is ) { | 122 | if( is ) { |
126 | Profiles_LB->setSelected( i, TRUE ); | 123 | Profiles_LB->setSelected( i, TRUE ); |
127 | } | 124 | } |
128 | } | 125 | } |
129 | } | 126 | } |
130 | } | 127 | } |
131 | if( ci >= 0 ) | 128 | if( ci >= 0 ) |
132 | Profiles_LB->setCurrentItem( ci ); | 129 | Profiles_LB->setCurrentItem( ci ); |
133 | */ | 130 | */ |
134 | } | 131 | } |
135 | 132 | ||
136 | void NetworkSettings::SLOT_AddNode( void ) { | 133 | void NetworkSettings::SLOT_AddNode( void ) { |
137 | SLOT_EditNode( 0 ); | 134 | SLOT_EditNode( 0 ); |
138 | } | 135 | } |
139 | 136 | ||
140 | void NetworkSettings::SLOT_DeleteNode( void ) { | 137 | void NetworkSettings::SLOT_DeleteNode( void ) { |
141 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 138 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
142 | 139 | ||
143 | if ( ! IVI ) | 140 | if ( ! LBI ) |
144 | return; | 141 | return; |
145 | 142 | ||
146 | if( QMessageBox::warning( | 143 | if( QMessageBox::warning( |
147 | 0, | 144 | 0, |
148 | tr( "Removing profile" ), | 145 | tr( "Removing profile" ), |
149 | tr( "Remove selected profile ?" ), | 146 | tr( "Remove selected profile ?" ), |
150 | 1, 0 ) == 1 ) { | 147 | 1, 0 ) == 1 ) { |
151 | NSResources->removeConnection( IVI->text() ); | 148 | NSResources->removeConnection( LBI->text() ); |
152 | delete IVI; | 149 | delete LBI; |
153 | setModified( 1 ); | 150 | setModified( 1 ); |
154 | NSD.forceGeneration(1); | 151 | NSD.forceGeneration(1); |
155 | } | 152 | } |
156 | } | 153 | } |
157 | 154 | ||
158 | void NetworkSettings::SLOT_EditNode( QIconViewItem * IVI ) { | 155 | void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { |
159 | QString OldName = ""; | 156 | QString OldName = ""; |
160 | EditConnection EC( this ); | 157 | EditConnection EC( this ); |
161 | 158 | ||
162 | if( IVI ) { | 159 | if( LBI ) { |
163 | NodeCollection * NC = NSResources->findConnection( IVI->text() ); | 160 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
164 | if( ! NC ) { | 161 | if( ! NC ) { |
165 | return; | 162 | return; |
166 | } | 163 | } |
167 | OldName = NC->name(); | 164 | OldName = NC->name(); |
168 | EC.setConnection( NC ); | 165 | EC.setConnection( NC ); |
169 | } | 166 | } |
170 | 167 | ||
171 | EC.showMaximized(); | 168 | EC.showMaximized(); |
172 | // disable refresh timer | 169 | // disable refresh timer |
173 | UpdateTimer->stop(); | 170 | UpdateTimer->stop(); |
174 | if( EC.exec() == QDialog::Accepted ) { | 171 | if( EC.exec() == QDialog::Accepted ) { |
175 | // toplevel item -> store | 172 | // toplevel item -> store |
176 | NodeCollection * NC = EC.connection(); | 173 | NodeCollection * NC = EC.connection(); |
177 | if( NC->isModified() ) { | 174 | if( NC->isModified() ) { |
178 | setModified( 1 ); | 175 | setModified( 1 ); |
179 | if( IVI ) { | 176 | if( LBI ) { |
180 | // new name -> remove item | 177 | // new name -> remove item |
181 | NSResources->removeConnection( OldName ); | 178 | NSResources->removeConnection( OldName ); |
182 | // must add it here since change will trigger event | 179 | // must add it here since change will trigger event |
183 | NSResources->addConnection( NC ); | 180 | NSResources->addConnection( NC ); |
184 | IVI->setText( NC->name() ); | 181 | Profiles_LB->changeItem( NC->devicePixmap(), |
185 | IVI->setPixmap( NC->devicePixmap() ); | 182 | NC->name(), |
183 | Profiles_LB->index( LBI ) | ||
184 | ); | ||
186 | } else { | 185 | } else { |
187 | // new item | 186 | // new item |
187 | int ci = Profiles_LB->count(); | ||
188 | NSResources->addConnection( NC ); | 188 | NSResources->addConnection( NC ); |
189 | NC->setNumber( NC->maxConnectionNumber()+1 ); | 189 | NC->setNumber( NC->maxConnectionNumber()+1 ); |
190 | IVI = new QIconViewItem( Profiles_IV, | 190 | Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); |
191 | NC->name(), | 191 | Profiles_LB->setSelected( ci, TRUE ); |
192 | NC->devicePixmap() | ||
193 | ); | ||
194 | Profiles_IV->setSelected( IVI, TRUE ); | ||
195 | } | 192 | } |
196 | updateProfileState( IVI ); | 193 | updateProfileState( LBI ); |
197 | } | 194 | } |
198 | } else { | 195 | } else { |
199 | // cancelled : reset connection | 196 | // cancelled : reset connection |
200 | if( IVI ) { | 197 | if( LBI ) { |
201 | NodeCollection * NC = NSResources->findConnection( IVI->text() ); | 198 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
202 | NC->reassign(); | 199 | NC->reassign(); |
203 | } | 200 | } |
204 | } | 201 | } |
205 | // reenable | 202 | // reenable |
206 | UpdateTimer->start( 5000 ); | 203 | UpdateTimer->start( 5000 ); |
207 | } | 204 | } |
208 | 205 | ||
209 | void NetworkSettings::SLOT_ShowNode( QIconViewItem * IVI ) { | 206 | void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { |
210 | if( IVI == 0 ) | 207 | if( LBI == 0 ) |
211 | return; | 208 | return; |
212 | 209 | ||
213 | NodeCollection * NC = NSResources->findConnection( IVI->text() ); | 210 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
214 | 211 | ||
215 | // is button possible | 212 | // is button possible |
216 | bool EnabledPossible, OnPossible, ConnectPossible; | 213 | bool EnabledPossible, OnPossible, ConnectPossible; |
217 | // is button On or Off | 214 | // is button On or Off |
218 | bool DisabledOn, OnOn, ConnectOn; | 215 | bool DisabledOn, OnOn, ConnectOn; |
219 | 216 | ||
220 | EnabledPossible = OnPossible = ConnectPossible = 1; | 217 | EnabledPossible = OnPossible = ConnectPossible = 1; |
221 | DisabledOn = 1; | 218 | DisabledOn = 1; |
222 | OnOn = ConnectOn = 0; | 219 | OnOn = ConnectOn = 0; |
223 | 220 | ||
224 | switch( NC->state() ) { | 221 | switch( NC->state() ) { |
225 | case Unknown : | 222 | case Unknown : |
226 | // cannot occur here | 223 | // cannot occur here |
227 | break; | 224 | break; |
228 | case Unchecked : | 225 | case Unchecked : |
229 | case Unavailable : | 226 | case Unavailable : |
230 | // cannot do anything but recheck | 227 | // cannot do anything but recheck |
231 | EnabledPossible = OnPossible = ConnectPossible = 0; | 228 | EnabledPossible = OnPossible = ConnectPossible = 0; |
232 | break; | 229 | break; |
233 | case Disabled : | 230 | case Disabled : |
234 | OnPossible = ConnectPossible = 0; | 231 | OnPossible = ConnectPossible = 0; |
235 | break; | 232 | break; |
236 | case Off : | 233 | case Off : |
237 | DisabledOn = 0; | 234 | DisabledOn = 0; |
238 | break; | 235 | break; |
239 | case Available : | 236 | case Available : |
240 | OnOn = 1; | 237 | OnOn = 1; |
241 | DisabledOn = 0; | 238 | DisabledOn = 0; |
242 | break; | 239 | break; |
243 | case IsUp : | 240 | case IsUp : |
244 | OnOn = ConnectOn = 1; | 241 | OnOn = ConnectOn = 1; |
245 | DisabledOn = 0; | 242 | DisabledOn = 0; |
246 | break; | 243 | break; |
247 | } | 244 | } |
248 | 245 | ||
249 | // set button state | 246 | // set button state |
250 | Enable_TB->setEnabled( EnabledPossible ); | 247 | Enable_TB->setEnabled( EnabledPossible ); |
251 | On_TB->setEnabled( OnPossible ); | 248 | On_TB->setEnabled( OnPossible ); |
252 | Connect_TB->setEnabled( ConnectPossible ); | 249 | Connect_TB->setEnabled( ConnectPossible ); |
253 | 250 | ||
254 | Enable_TB->setOn( DisabledOn ); | 251 | Enable_TB->setOn( DisabledOn ); |
255 | On_TB->setOn( OnOn ); | 252 | On_TB->setOn( OnOn ); |
256 | Connect_TB->setOn( ConnectOn ); | 253 | Connect_TB->setOn( ConnectOn ); |
257 | 254 | ||
258 | if( NC->description().isEmpty() ) { | 255 | if( NC->description().isEmpty() ) { |
259 | Description_LBL->setText( tr( "No description" ) ); | 256 | Description_LBL->setText( tr( "No description" ) ); |
260 | } else { | 257 | } else { |
261 | Description_LBL->setText( NC->description() ); | 258 | Description_LBL->setText( NC->description() ); |
262 | } | 259 | } |
263 | 260 | ||
264 | CurProfile_GB->setTitle( IVI->text() ); | 261 | CurProfile_GB->setTitle( LBI->text() ); |
265 | State_LBL->setText( NC->stateName() ); | 262 | State_LBL->setText( NC->stateName() ); |
266 | } | 263 | } |
267 | 264 | ||
268 | void NetworkSettings::SLOT_CheckState( void ) { | 265 | void NetworkSettings::SLOT_CheckState( void ) { |
269 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 266 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
270 | if ( ! IVI ) | 267 | if ( ! LBI ) |
271 | return; | 268 | return; |
272 | updateProfileState( IVI ); | 269 | updateProfileState( LBI ); |
273 | } | 270 | } |
274 | 271 | ||
275 | void NetworkSettings::updateProfileState( QIconViewItem * IVI ) { | 272 | void NetworkSettings::updateProfileState( QListBoxItem * LBI ) { |
276 | if( IVI == Profiles_IV->currentItem() ) { | 273 | if( LBI == Profiles_LB->item( Profiles_LB->currentItem() ) ) { |
277 | SLOT_ShowNode( IVI ); | 274 | SLOT_ShowNode( LBI ); |
278 | } | 275 | } |
279 | } | 276 | } |
280 | 277 | ||
281 | void NetworkSettings::SLOT_GenerateConfig( void ) { | 278 | void NetworkSettings::SLOT_GenerateConfig( void ) { |
282 | QString S = NSD.generateSettings( TRUE ); | 279 | QString S = NSD.generateSettings( TRUE ); |
283 | 280 | ||
284 | if( ! S.isEmpty() ) { | 281 | if( ! S.isEmpty() ) { |
285 | QMessageBox::warning( | 282 | QMessageBox::warning( |
286 | 0, | 283 | 0, |
287 | tr( "Generating system configuration" ), | 284 | tr( "Generating system configuration" ), |
288 | S | 285 | S |
289 | ); | 286 | ); |
290 | } | 287 | } |
291 | } | 288 | } |
292 | 289 | ||
293 | void NetworkSettings::SLOT_Enable( void ) { | 290 | void NetworkSettings::SLOT_Enable( void ) { |
294 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 291 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
295 | QString Msg; | 292 | QString Msg; |
296 | if ( ! IVI ) | 293 | if ( ! LBI ) |
297 | return; | 294 | return; |
298 | 295 | ||
299 | NodeCollection * NC = | 296 | NodeCollection * NC = |
300 | NSResources->findConnection( IVI->text() ); | 297 | NSResources->findConnection( LBI->text() ); |
301 | 298 | ||
302 | bool rv; | 299 | bool rv; |
303 | switch( NC->state() ) { | 300 | switch( NC->state() ) { |
304 | case Disabled : | 301 | case Disabled : |
305 | Msg = tr( "Cannot enable profile" ); | 302 | Msg = tr( "Cannot enable profile" ); |
306 | rv = NC->setState( Enable ); | 303 | rv = NC->setState( Enable ); |
307 | break; | 304 | break; |
308 | default : | 305 | default : |
309 | Msg = tr( "Cannot disable profile" ); | 306 | Msg = tr( "Cannot disable profile" ); |
310 | rv = NC->setState( Disable ); | 307 | rv = NC->setState( Disable ); |
311 | break; | 308 | break; |
312 | } | 309 | } |
313 | 310 | ||
314 | if( ! rv ) { | 311 | if( ! rv ) { |
315 | QMessageBox::warning( | 312 | QMessageBox::warning( |
316 | 0, | 313 | 0, |
317 | tr( "Activating profile" ), | 314 | tr( "Activating profile" ), |
318 | Msg ); | 315 | Msg ); |
319 | return; | 316 | return; |
320 | } | 317 | } |
321 | updateProfileState( IVI ); | 318 | updateProfileState( LBI ); |
322 | } | 319 | } |
323 | 320 | ||
324 | void NetworkSettings::SLOT_On( void ) { | 321 | void NetworkSettings::SLOT_On( void ) { |
325 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 322 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
326 | 323 | ||
327 | if ( ! IVI ) | 324 | if ( ! LBI ) |
328 | return; | 325 | return; |
329 | 326 | ||
330 | NodeCollection * NC = | 327 | NodeCollection * NC = |
331 | NSResources->findConnection( IVI->text() ); | 328 | NSResources->findConnection( LBI->text() ); |
332 | 329 | ||
333 | bool rv; | 330 | bool rv; |
334 | switch( NC->state() ) { | 331 | switch( NC->state() ) { |
335 | case Off : | 332 | case Off : |
336 | // activate interface | 333 | // activate interface |
337 | rv = NC->setState( Activate ); | 334 | rv = NC->setState( Activate ); |
338 | break; | 335 | break; |
339 | case Available : | 336 | case Available : |
340 | // deactivate | 337 | // deactivate |
341 | rv = NC->setState( Deactivate ); | 338 | rv = NC->setState( Deactivate ); |
342 | break; | 339 | break; |
343 | case IsUp : | 340 | case IsUp : |
344 | // bring down and deactivate | 341 | // bring down and deactivate |
345 | rv = ( NC->setState( Down ) && | 342 | rv = ( NC->setState( Down ) && |
346 | NC->setState( Deactivate ) ); | 343 | NC->setState( Deactivate ) ); |
347 | break; | 344 | break; |
348 | default : | 345 | default : |
349 | // others no change | 346 | // others no change |
350 | return; | 347 | return; |
351 | } | 348 | } |
352 | 349 | ||
353 | if( ! rv ) { | 350 | if( ! rv ) { |
354 | QMessageBox::warning( | 351 | QMessageBox::warning( |
355 | 0, | 352 | 0, |
356 | tr( "Activating profile" ), | 353 | tr( "Activating profile" ), |
357 | tr( "Cannot enable profile" ) ); | 354 | tr( "Cannot enable profile" ) ); |
358 | return; | 355 | return; |
359 | } | 356 | } |
360 | updateProfileState( IVI ); | 357 | updateProfileState( LBI ); |
361 | } | 358 | } |
362 | 359 | ||
363 | void NetworkSettings::SLOT_Connect( void ) { | 360 | void NetworkSettings::SLOT_Connect( void ) { |
364 | QIconViewItem * IVI = Profiles_IV->currentItem(); | 361 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
365 | 362 | ||
366 | if ( ! IVI ) | 363 | if ( ! LBI ) |
367 | return; | 364 | return; |
368 | 365 | ||
369 | NodeCollection * NC = | 366 | NodeCollection * NC = |
370 | NSResources->findConnection( IVI->text() ); | 367 | NSResources->findConnection( LBI->text() ); |
371 | 368 | ||
372 | bool rv; | 369 | bool rv; |
373 | switch( NC->state() ) { | 370 | switch( NC->state() ) { |
374 | case IsUp : | 371 | case IsUp : |
375 | // down interface | 372 | // down interface |
376 | rv = NC->setState( Down ); | 373 | rv = NC->setState( Down ); |
377 | break; | 374 | break; |
378 | case Available : | 375 | case Available : |
379 | // up interface | 376 | // up interface |
380 | rv = NC->setState( Up ); | 377 | rv = NC->setState( Up ); |
381 | break; | 378 | break; |
382 | case Off : | 379 | case Off : |
383 | // activate and bring up | 380 | // activate and bring up |
384 | rv = ( NC->setState( Activate ) && | 381 | rv = ( NC->setState( Activate ) && |
385 | NC->setState( Up ) ); | 382 | NC->setState( Up ) ); |
386 | break; | 383 | break; |
387 | default : | 384 | default : |
388 | // others no change | 385 | // others no change |
389 | return; | 386 | return; |
390 | } | 387 | } |
391 | 388 | ||
392 | if( ! rv ) { | 389 | if( ! rv ) { |
393 | QMessageBox::warning( | 390 | QMessageBox::warning( |
394 | 0, | 391 | 0, |
395 | tr( "Activating profile" ), | 392 | tr( "Activating profile" ), |
396 | tr( "Cannot enable profile" ) ); | 393 | tr( "Cannot enable profile" ) ); |
397 | return; | 394 | return; |
398 | } | 395 | } |
399 | 396 | ||
400 | // we do not update the GUI but wait for the REAL upping of the device | 397 | // we do not update the GUI but wait for the REAL upping of the device |
401 | } | 398 | } |
402 | 399 | ||
403 | void NetworkSettings::SLOT_QCopMessage(const QCString &msg, const QByteArray &data) { | 400 | void NetworkSettings::SLOT_QCopMessage(const QCString &msg, const QByteArray &data) { |
404 | QDataStream stream( data, IO_ReadOnly ); | 401 | QDataStream stream( data, IO_ReadOnly ); |
405 | 402 | ||
406 | if( msg == "raise" ) { | 403 | if( msg == "raise" ) { |
407 | raise(); | 404 | raise(); |
408 | return; | 405 | return; |
409 | } /* if ( msg == "someMessage(int,int,int)" ) { | 406 | } /* if ( msg == "someMessage(int,int,int)" ) { |
410 | int a,b,c; | 407 | int a,b,c; |
411 | stream >> a >> b >> c; | 408 | stream >> a >> b >> c; |
412 | ... | 409 | ... |
413 | } */ | 410 | } */ |
414 | } | 411 | } |
diff --git a/noncore/settings/networksettings2/networksettings.h b/noncore/settings/networksettings2/networksettings.h index fadf81b..d9ea5d4 100644 --- a/noncore/settings/networksettings2/networksettings.h +++ b/noncore/settings/networksettings2/networksettings.h | |||
@@ -1,49 +1,49 @@ | |||
1 | #include "nsdata.h" | 1 | #include "nsdata.h" |
2 | #include "networksettingsGUI.h" | 2 | #include "networksettingsGUI.h" |
3 | #include "resources.h" | 3 | #include "resources.h" |
4 | 4 | ||
5 | class ANetNode; | 5 | class ANetNode; |
6 | class ANetNodeInstance; | 6 | class ANetNodeInstance; |
7 | class QTimer; | 7 | class QTimer; |
8 | class QIconViewItem; | 8 | class QListBoxItem; |
9 | 9 | ||
10 | class NetworkSettings : public NetworkSettingsGUI { | 10 | class NetworkSettings : public NetworkSettingsGUI { |
11 | 11 | ||
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | 13 | ||
14 | public : | 14 | public : |
15 | 15 | ||
16 | NetworkSettings( QWidget *parent=0, | 16 | NetworkSettings( QWidget *parent=0, |
17 | const char *name=0, | 17 | const char *name=0, |
18 | WFlags fl = 0 ); | 18 | WFlags fl = 0 ); |
19 | ~NetworkSettings( void ); | 19 | ~NetworkSettings( void ); |
20 | 20 | ||
21 | static QString appName( void ) | 21 | static QString appName( void ) |
22 | { return QString::fromLatin1("networksettings"); } | 22 | { return QString::fromLatin1("networksettings"); } |
23 | 23 | ||
24 | bool isModified( void ) | 24 | bool isModified( void ) |
25 | { return NSD.isModified(); } | 25 | { return NSD.isModified(); } |
26 | void setModified( bool m ) | 26 | void setModified( bool m ) |
27 | { NSD.setModified( m ); } | 27 | { NSD.setModified( m ); } |
28 | 28 | ||
29 | public slots : | 29 | public slots : |
30 | 30 | ||
31 | void SLOT_AddNode( void ); | 31 | void SLOT_AddNode( void ); |
32 | void SLOT_DeleteNode( void ); | 32 | void SLOT_DeleteNode( void ); |
33 | void SLOT_ShowNode( QIconViewItem * ); | 33 | void SLOT_ShowNode( QListBoxItem * ); |
34 | void SLOT_EditNode( QIconViewItem * ); | 34 | void SLOT_EditNode( QListBoxItem * ); |
35 | void SLOT_CheckState( void ); | 35 | void SLOT_CheckState( void ); |
36 | void SLOT_Enable( void ); | 36 | void SLOT_Enable( void ); |
37 | void SLOT_On( void ); | 37 | void SLOT_On( void ); |
38 | void SLOT_Connect( void ); | 38 | void SLOT_Connect( void ); |
39 | void SLOT_GenerateConfig( void ); | 39 | void SLOT_GenerateConfig( void ); |
40 | void SLOT_RefreshStates( void ); | 40 | void SLOT_RefreshStates( void ); |
41 | void SLOT_QCopMessage( const QCString&,const QByteArray& ); | 41 | void SLOT_QCopMessage( const QCString&,const QByteArray& ); |
42 | 42 | ||
43 | private : | 43 | private : |
44 | 44 | ||
45 | void updateProfileState( QIconViewItem * it ); | 45 | void updateProfileState( QListBoxItem * it ); |
46 | QTimer * UpdateTimer; | 46 | QTimer * UpdateTimer; |
47 | NetworkSettingsData NSD; | 47 | NetworkSettingsData NSD; |
48 | 48 | ||
49 | }; | 49 | }; |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp index d36a1e5..f040c99 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.cpp +++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp | |||
@@ -1,302 +1,302 @@ | |||
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 | // | 51 | // |
52 | // | 52 | // |
53 | 53 | ||
54 | long ANetNodeInstance::InstanceCounter = -1; | 54 | long ANetNodeInstance::InstanceCounter = -1; |
55 | 55 | ||
56 | void ANetNodeInstance::initialize( void ) { | 56 | void ANetNodeInstance::initialize( void ) { |
57 | if( InstanceCounter == -1 ) | 57 | if( InstanceCounter == -1 ) |
58 | InstanceCounter = time(0); | 58 | InstanceCounter = time(0); |
59 | // set name | 59 | // set name |
60 | QString N; | 60 | QString N; |
61 | N.sprintf( "-%ld", InstanceCounter++ ); | 61 | N.sprintf( "-%ld", InstanceCounter++ ); |
62 | N.prepend( NodeType->nodeName() ); | 62 | N.prepend( NodeType->nodeName() ); |
63 | setNodeName( N ); | 63 | setNodeName( N ); |
64 | } | 64 | } |
65 | 65 | ||
66 | void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){ | 66 | void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){ |
67 | if( Attr == "name" ) { | 67 | if( Attr == "name" ) { |
68 | NodeName = Value; | 68 | NodeName = Value; |
69 | } else { | 69 | } else { |
70 | setSpecificAttribute( Attr, Value ); | 70 | setSpecificAttribute( Attr, Value ); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { | 74 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { |
75 | TS << "name=" << quote( NodeName ) << endl; | 75 | TS << "name=" << quote( NodeName ) << endl; |
76 | saveSpecificAttribute( TS ); | 76 | saveSpecificAttribute( TS ); |
77 | } | 77 | } |
78 | 78 | ||
79 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { | 79 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { |
80 | return connection()->findNext( this ); | 80 | return connection()->findNext( this ); |
81 | } | 81 | } |
82 | 82 | ||
83 | // | 83 | // |
84 | // | 84 | // |
85 | // | 85 | // |
86 | // | 86 | // |
87 | // | 87 | // |
88 | 88 | ||
89 | long NodeCollection::MaxNr = -1; | 89 | long NodeCollection::MaxNr = -1; |
90 | 90 | ||
91 | NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { | 91 | NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { |
92 | IsModified = 0; | 92 | IsModified = 0; |
93 | Index = -1; | 93 | Index = -1; |
94 | Name=""; | 94 | Name=""; |
95 | IsNew = 1; | 95 | IsNew = 1; |
96 | CurrentState = Unchecked; | 96 | CurrentState = Unchecked; |
97 | } | 97 | } |
98 | 98 | ||
99 | NodeCollection::NodeCollection( QTextStream & TS ) : | 99 | NodeCollection::NodeCollection( QTextStream & TS ) : |
100 | QList<ANetNodeInstance>() { | 100 | QList<ANetNodeInstance>() { |
101 | long idx; | 101 | long idx; |
102 | bool InError = 0; | 102 | bool InError = 0; |
103 | QString S, A, N; | 103 | QString S, A, N; |
104 | IsModified = 0; | 104 | IsModified = 0; |
105 | Index = -1; | 105 | Index = -1; |
106 | Name=""; | 106 | Name=""; |
107 | IsNew = 0; | 107 | IsNew = 0; |
108 | CurrentState = Unchecked; | 108 | CurrentState = Unchecked; |
109 | 109 | ||
110 | do { | 110 | do { |
111 | S = TS.readLine(); | 111 | S = TS.readLine(); |
112 | if( S.isEmpty() ) { | 112 | if( S.isEmpty() ) { |
113 | if( InError ) { | 113 | if( InError ) { |
114 | // remove all nodes | 114 | // remove all nodes |
115 | clear(); | 115 | clear(); |
116 | } | 116 | } |
117 | // empty line | 117 | // empty line |
118 | break; | 118 | break; |
119 | } | 119 | } |
120 | 120 | ||
121 | idx = S.find('='); | 121 | idx = S.find('='); |
122 | S.stripWhiteSpace(); | 122 | S.stripWhiteSpace(); |
123 | A = S.left( idx ); | 123 | A = S.left( idx ); |
124 | A.lower(); | 124 | A.lower(); |
125 | N = S.mid( idx+1, S.length() ); | 125 | N = S.mid( idx+1, S.length() ); |
126 | N.stripWhiteSpace(); | 126 | N.stripWhiteSpace(); |
127 | N = deQuote( N ); | 127 | N = deQuote( N ); |
128 | 128 | ||
129 | if( A == "name" ) { | 129 | if( A == "name" ) { |
130 | Name = N; | 130 | Name = N; |
131 | } else if( A == "number" ) { | 131 | } else if( A == "number" ) { |
132 | setNumber( N.toLong() ); | 132 | setNumber( N.toLong() ); |
133 | } else if( A == "node" ) { | 133 | } else if( A == "node" ) { |
134 | ANetNodeInstance * NNI = NSResources->findNodeInstance( N ); | 134 | ANetNodeInstance * NNI = NSResources->findNodeInstance( N ); |
135 | if( NNI && ! InError ) { | 135 | if( NNI && ! InError ) { |
136 | append( NSResources->findNodeInstance( N ) ); | 136 | append( NSResources->findNodeInstance( N ) ); |
137 | } else { | 137 | } else { |
138 | // could not find a node type -> collection invalid | 138 | // could not find a node type -> collection invalid |
139 | InError = 1; | 139 | InError = 1; |
140 | } | 140 | } |
141 | } | 141 | } |
142 | } while( 1 ); | 142 | } while( 1 ); |
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
146 | NodeCollection::~NodeCollection( void ) { | 146 | NodeCollection::~NodeCollection( void ) { |
147 | } | 147 | } |
148 | 148 | ||
149 | const QString & NodeCollection::description( void ) { | 149 | const QString & NodeCollection::description( void ) { |
150 | ANetNodeInstance * NNI = getToplevel(); | 150 | ANetNodeInstance * NNI = getToplevel(); |
151 | return (NNI) ? NNI->runtime()->asFullSetup()->description() : Name; | 151 | return (NNI) ? NNI->runtime()->asFullSetup()->description() : Name; |
152 | } | 152 | } |
153 | 153 | ||
154 | void NodeCollection::append( ANetNodeInstance * NNI ) { | 154 | void NodeCollection::append( ANetNodeInstance * NNI ) { |
155 | NNI->setConnection( this ); | 155 | NNI->setConnection( this ); |
156 | QList<ANetNodeInstance>::append( NNI ); | 156 | QList<ANetNodeInstance>::append( NNI ); |
157 | } | 157 | } |
158 | 158 | ||
159 | void NodeCollection::save( QTextStream & TS ) { | 159 | void NodeCollection::save( QTextStream & TS ) { |
160 | 160 | ||
161 | TS << "name=" << quote( Name ) << endl; | 161 | TS << "name=" << quote( Name ) << endl; |
162 | TS << "number=" << number() << endl; | 162 | TS << "number=" << number() << endl; |
163 | ANetNodeInstance * NNI; | 163 | ANetNodeInstance * NNI; |
164 | for( QListIterator<ANetNodeInstance> it(*this); | 164 | for( QListIterator<ANetNodeInstance> it(*this); |
165 | it.current(); | 165 | it.current(); |
166 | ++it ) { | 166 | ++it ) { |
167 | NNI = it.current(); | 167 | NNI = it.current(); |
168 | TS << "node=" << quote( NNI->nodeName() ) << endl; | 168 | TS << "node=" << quote( NNI->nodeName() ) << endl; |
169 | } | 169 | } |
170 | TS << endl; | 170 | TS << endl; |
171 | IsNew = 0; | 171 | IsNew = 0; |
172 | } | 172 | } |
173 | 173 | ||
174 | ANetNodeInstance * NodeCollection::getToplevel( void ) { | 174 | ANetNodeInstance * NodeCollection::getToplevel( void ) { |
175 | ANetNodeInstance * NNI = 0; | 175 | ANetNodeInstance * NNI = 0; |
176 | for( QListIterator<ANetNodeInstance> it(*this); | 176 | for( QListIterator<ANetNodeInstance> it(*this); |
177 | it.current(); | 177 | it.current(); |
178 | ++it ) { | 178 | ++it ) { |
179 | NNI = it.current(); | 179 | NNI = it.current(); |
180 | if( NNI->netNode()->isToplevel() ) | 180 | if( NNI->netNode()->isToplevel() ) |
181 | break; | 181 | break; |
182 | } | 182 | } |
183 | return NNI; | 183 | return NNI; |
184 | } | 184 | } |
185 | 185 | ||
186 | ANetNodeInstance * NodeCollection::findByName( const QString & S ) { | 186 | ANetNodeInstance * NodeCollection::findByName( const QString & S ) { |
187 | ANetNodeInstance * NNI = 0; | 187 | ANetNodeInstance * NNI = 0; |
188 | for( QListIterator<ANetNodeInstance> it(*this); | 188 | for( QListIterator<ANetNodeInstance> it(*this); |
189 | it.current(); | 189 | it.current(); |
190 | ++it ) { | 190 | ++it ) { |
191 | NNI = it.current(); | 191 | NNI = it.current(); |
192 | if( NNI->name() == S ) | 192 | if( NNI->name() == S ) |
193 | break; | 193 | break; |
194 | } | 194 | } |
195 | return NNI; | 195 | return NNI; |
196 | } | 196 | } |
197 | 197 | ||
198 | ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { | 198 | ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { |
199 | ANetNodeInstance * NNNI; | 199 | ANetNodeInstance * NNNI; |
200 | 200 | ||
201 | if( ! NNI ) | 201 | if( ! NNI ) |
202 | getToplevel(); | 202 | getToplevel(); |
203 | 203 | ||
204 | for( QListIterator<ANetNodeInstance> it(*this); | 204 | for( QListIterator<ANetNodeInstance> it(*this); |
205 | it.current(); | 205 | it.current(); |
206 | ++it ) { | 206 | ++it ) { |
207 | NNNI = it.current(); | 207 | NNNI = it.current(); |
208 | if( NNNI == NNI ) { | 208 | if( NNNI == NNI ) { |
209 | ++it; | 209 | ++it; |
210 | return it.current(); | 210 | return it.current(); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | return 0; // no more next | 213 | return 0; // no more next |
214 | } | 214 | } |
215 | 215 | ||
216 | int NodeCollection::compareItems( QCollection::Item I1, | 216 | int NodeCollection::compareItems( QCollection::Item I1, |
217 | QCollection::Item I2 ) { | 217 | QCollection::Item I2 ) { |
218 | ANetNodeInstance * NNI1, * NNI2; | 218 | ANetNodeInstance * NNI1, * NNI2; |
219 | NNI1 = (ANetNodeInstance *)I1; | 219 | NNI1 = (ANetNodeInstance *)I1; |
220 | NNI2 = (ANetNodeInstance *)I2; | 220 | NNI2 = (ANetNodeInstance *)I2; |
221 | return NNI1->nodeName().compare( NNI2->nodeName() ); | 221 | return NNI1->nodeName().compare( NNI2->nodeName() ); |
222 | } | 222 | } |
223 | 223 | ||
224 | static char * State2PixmapTbl[] = { | 224 | static char * State2PixmapTbl[] = { |
225 | "NULL", // Unchecked : no pixmap | 225 | "NULL", // Unchecked : no pixmap |
226 | "check", // Unknown | 226 | "check", // Unknown |
227 | "delete", // unavailable | 227 | "delete", // unavailable |
228 | "disabled", // disabled | 228 | "disabled", // disabled |
229 | "off", // off | 229 | "off", // off |
230 | "disconnected", // available | 230 | "disconnected", // available |
231 | "connected" // up | 231 | "connected" // up |
232 | }; | 232 | }; |
233 | 233 | ||
234 | QPixmap NodeCollection::devicePixmap( void ) { | 234 | QPixmap NodeCollection::devicePixmap( void ) { |
235 | return NSResources->getPixmap( | 235 | return NSResources->getPixmap( |
236 | device()->netNode()->pixmapName()+"-large" ); | 236 | device()->netNode()->pixmapName()+"-large" ); |
237 | } | 237 | } |
238 | 238 | ||
239 | QPixmap NodeCollection::statePixmap( State_t S) { | 239 | QPixmap NodeCollection::statePixmap( State_t S) { |
240 | return NSResources->getPixmap( State2PixmapTbl[S] ); | 240 | return NSResources->getPixmap( State2PixmapTbl[S] ); |
241 | } | 241 | } |
242 | 242 | ||
243 | QString NodeCollection::stateName( State_t S) { | 243 | QString NodeCollection::stateName( State_t S) { |
244 | switch( S ) { | 244 | switch( S ) { |
245 | case Unknown : | 245 | case Unknown : |
246 | return qApp->translate( "networksettings2", "Unknown"); | 246 | return qApp->translate( "networksettings2", "Unknown"); |
247 | case Unavailable : | 247 | case Unavailable : |
248 | return qApp->translate( "networksettings2", "Unavailable"); | 248 | return qApp->translate( "networksettings2", "Unavailable"); |
249 | case Disabled : | 249 | case Disabled : |
250 | return qApp->translate( "networksettings2", "Disabled"); | 250 | return qApp->translate( "networksettings2", "Disabled"); |
251 | case Off : | 251 | case Off : |
252 | return qApp->translate( "networksettings2", "Off"); | 252 | return qApp->translate( "networksettings2", "Off"); |
253 | case Available : | 253 | case Available : |
254 | return qApp->translate( "networksettings2", "Available"); | 254 | return qApp->translate( "networksettings2", "Available"); |
255 | case IsUp : | 255 | case IsUp : |
256 | return qApp->translate( "networksettings2", "IsUp"); | 256 | return qApp->translate( "networksettings2", "IsUp"); |
257 | case Unchecked : /* FT */ | 257 | case Unchecked : /* FT */ |
258 | default : | 258 | default : |
259 | break; | 259 | break; |
260 | } | 260 | } |
261 | return QString(""); | 261 | return QString(""); |
262 | } | 262 | } |
263 | 263 | ||
264 | void NodeCollection::reassign( void ) { | 264 | void NodeCollection::reassign( void ) { |
265 | for( QListIterator<ANetNodeInstance> it(*this); | 265 | for( QListIterator<ANetNodeInstance> it(*this); |
266 | it.current(); | 266 | it.current(); |
267 | ++it ) { | 267 | ++it ) { |
268 | it.current()->setConnection( this ); | 268 | it.current()->setConnection( this ); |
269 | } | 269 | } |
270 | } | 270 | } |
271 | 271 | ||
272 | InterfaceInfo * RuntimeInfo::assignedInterface( void ) { | 272 | InterfaceInfo * RuntimeInfo::assignedInterface( void ) { |
273 | return netNode()->nextNode()->runtime()->assignedInterface(); | 273 | return netNode()->nextNode()->runtime()->assignedInterface(); |
274 | } | 274 | } |
275 | 275 | ||
276 | AsDevice * RuntimeInfo::device( void ) { | 276 | AsDevice * RuntimeInfo::device( void ) { |
277 | return netNode()->nextNode()->runtime()->device(); | 277 | return netNode()->nextNode()->runtime()->device(); |
278 | } | 278 | } |
279 | 279 | ||
280 | ANetNodeInstance * FakeNetNode::createInstance( void ) { | 280 | ANetNodeInstance * FakeNetNode::createInstance( void ) { |
281 | return new FakeNetNodeInstance( this ); | 281 | return new FakeNetNodeInstance( this ); |
282 | } | 282 | } |
283 | 283 | ||
284 | void FakeNetNodeInstance::setSpecificAttribute( | 284 | void FakeNetNodeInstance::setSpecificAttribute( |
285 | QString & A, QString & V ) { | 285 | QString & A, QString & V ) { |
286 | ValAttrPairs.insert( A, new QString(V) ); | 286 | ValAttrPairs.insert( A, new QString(V) ); |
287 | } | 287 | } |
288 | 288 | ||
289 | void FakeNetNodeInstance::saveSpecificAttribute( QTextStream &TS ) { | 289 | void FakeNetNodeInstance::saveSpecificAttribute( QTextStream &TS ) { |
290 | for( QDictIterator<QString> it( ValAttrPairs ); | 290 | for( QDictIterator<QString> it( ValAttrPairs ); |
291 | it.current(); | 291 | it.current(); |
292 | ++ it ) { | 292 | ++ it ) { |
293 | TS << it.currentKey().latin1() | 293 | TS << it.currentKey().latin1() |
294 | << "=" | 294 | << "=" |
295 | << quote( *(it.current())) | 295 | << quote( *(it.current())) |
296 | << endl ; | 296 | << endl ; |
297 | ++it; | 297 | ++it; |
298 | } | 298 | } |
299 | } | 299 | } |
300 | 300 | ||
301 | // collects all info that no plugin acceps | 301 | // collects all info that no plugin acceps |
302 | FakeNetNode * FakeNode = 0; | 302 | FakeNetNode * FakeNode = 0; |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp index 15e1b64..0301361 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.cpp +++ b/noncore/settings/networksettings2/networksettings2/resources.cpp | |||
@@ -1,231 +1,234 @@ | |||
1 | #include <qpixmap.h> | 1 | #include <qpixmap.h> |
2 | #include <qpe/qlibrary.h> | 2 | #include <qpe/qlibrary.h> |
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | #include <qdir.h> | 4 | #include <qdir.h> |
5 | #include <opie2/odebug.h> | 5 | #include <opie2/odebug.h> |
6 | #include <qtopia/resource.h> | 6 | #include <qtopia/resource.h> |
7 | 7 | ||
8 | #include "netnode.h" | 8 | #include "netnode.h" |
9 | #include "resources.h" | 9 | #include "resources.h" |
10 | 10 | ||
11 | #define PLUGINDIR "plugins/networksettings2" | 11 | #define PLUGINDIR "plugins/networksettings2" |
12 | #define ICONDIR "/pics/networksettings2/" | 12 | #define ICONDIR "/pics/networksettings2/" |
13 | 13 | ||
14 | // single resources instance | 14 | // single resources instance |
15 | TheNSResources * _NSResources = 0; | 15 | TheNSResources * _NSResources = 0; |
16 | 16 | ||
17 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), | 17 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), |
18 | ConnectionsMap() { | 18 | ConnectionsMap() { |
19 | 19 | ||
20 | _NSResources = this; | 20 | _NSResources = this; |
21 | 21 | ||
22 | // load available netnodes | 22 | // load available netnodes |
23 | findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR ); | 23 | findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR ); |
24 | 24 | ||
25 | // compile provides and needs lists | 25 | // compile provides and needs lists |
26 | { const char ** NeedsRun; | 26 | { const char ** NeedsRun; |
27 | QDictIterator<NetNode_t> OuterIt( AllNodeTypes ); | 27 | QDictIterator<NetNode_t> OuterIt( AllNodeTypes ); |
28 | bool Done; | 28 | bool Done; |
29 | 29 | ||
30 | for ( ; OuterIt.current(); ++OuterIt ) { | 30 | for ( ; OuterIt.current(); ++OuterIt ) { |
31 | // find needs list | 31 | // find needs list |
32 | ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList; | 32 | ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList; |
33 | ANetNode::NetNodeList & NNL = *(NNLP); | 33 | ANetNode::NetNodeList & NNL = *(NNLP); |
34 | 34 | ||
35 | // must iterate this way to avoid duplication pointers | 35 | // must iterate this way to avoid duplication pointers |
36 | for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes ); | 36 | for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes ); |
37 | InnerIt.current(); ++InnerIt ) { | 37 | InnerIt.current(); ++InnerIt ) { |
38 | if( InnerIt.current() == OuterIt.current() ) | 38 | if( InnerIt.current() == OuterIt.current() ) |
39 | // avoid recursive | 39 | // avoid recursive |
40 | continue; | 40 | continue; |
41 | 41 | ||
42 | const char * Provides = InnerIt.current()->NetNode->provides(); | 42 | const char * Provides = InnerIt.current()->NetNode->provides(); |
43 | NeedsRun = OuterIt.current()->NetNode->needs(); | 43 | NeedsRun = OuterIt.current()->NetNode->needs(); |
44 | for( ; *NeedsRun; NeedsRun ++ ) { | 44 | for( ; *NeedsRun; NeedsRun ++ ) { |
45 | if( strcmp( Provides, *NeedsRun ) == 0 ) { | 45 | if( strcmp( Provides, *NeedsRun ) == 0 ) { |
46 | // inner provides what outer needs | 46 | // inner provides what outer needs |
47 | NNL.resize( NNL.size() + 1 ); | 47 | NNL.resize( NNL.size() + 1 ); |
48 | NNL[NNL.size()-1] = InnerIt.current()->NetNode; | 48 | NNL[NNL.size()-1] = InnerIt.current()->NetNode; |
49 | Done = 1; // break from 2 loops | 49 | Done = 1; // break from 2 loops |
50 | break; | 50 | break; |
51 | } | 51 | } |
52 | } | 52 | } |
53 | } | 53 | } |
54 | OuterIt.current()->NetNode->setAlternatives( NNLP ); | 54 | OuterIt.current()->NetNode->setAlternatives( NNLP ); |
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | // define Node types to Description map | 58 | // define Node types to Description map |
59 | NodeTypeNameMap.insert( "device", tr( "Network Device" ) ); | 59 | NodeTypeNameMap.insert( "device", tr( "Network Device" ) ); |
60 | NodeTypeNameMap.insert( "line", tr( "Character device" ) ); | 60 | NodeTypeNameMap.insert( "line", tr( "Character device" ) ); |
61 | NodeTypeNameMap.insert( "connection", tr( "IP Connection" ) ); | 61 | NodeTypeNameMap.insert( "connection", tr( "IP Connection" ) ); |
62 | NodeTypeNameMap.insert( "fullsetup", tr( "Connection Profile" ) ); | 62 | NodeTypeNameMap.insert( "fullsetup", tr( "Connection Profile" ) ); |
63 | 63 | ||
64 | NodeTypeDescriptionMap.insert( "device", | 64 | NodeTypeDescriptionMap.insert( "device", |
65 | tr( "<p>Devices that can handle IP packets</p>" ) ); | 65 | tr( "<p>Devices that can handle IP packets</p>" ) ); |
66 | NodeTypeDescriptionMap.insert( "line", | 66 | NodeTypeDescriptionMap.insert( "line", |
67 | tr( "<p>Devices that can handle single bytes</p>" ) ); | 67 | tr( "<p>Devices that can handle single bytes</p>" ) ); |
68 | NodeTypeDescriptionMap.insert( "connection", | 68 | NodeTypeDescriptionMap.insert( "connection", |
69 | tr( "<p>Nodes that provide working IP connections</p>" ) ); | 69 | tr( "<p>Nodes that provide working IP connections</p>" ) ); |
70 | NodeTypeDescriptionMap.insert( "fullsetup", | 70 | NodeTypeDescriptionMap.insert( "fullsetup", |
71 | tr( "<p>Fully configured connection profile</p>" ) ); | 71 | tr( "<p>Fully configured connection profile</p>" ) ); |
72 | 72 | ||
73 | // define system files | 73 | // define system files |
74 | addSystemFile( new SystemFile( "interfaces", "./interfaces" ) ); | 74 | addSystemFile( new SystemFile( "interfaces", "./interfaces" ) ); |
75 | 75 | ||
76 | // get access to the system | 76 | // get access to the system |
77 | TheSystem = new System(); | 77 | TheSystem = new System(); |
78 | } | 78 | } |
79 | 79 | ||
80 | TheNSResources::~TheNSResources( void ) { | 80 | TheNSResources::~TheNSResources( void ) { |
81 | delete TheSystem; | 81 | delete TheSystem; |
82 | } | 82 | } |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * Load all modules that are found in the path | 85 | * Load all modules that are found in the path |
86 | * @param path a directory that is scaned for any plugins that can be loaded | 86 | * @param path a directory that is scaned for any plugins that can be loaded |
87 | * and attempts to load them | 87 | * and attempts to load them |
88 | */ | 88 | */ |
89 | void TheNSResources::findAvailableNetNodes(const QString &path){ | 89 | void TheNSResources::findAvailableNetNodes(const QString &path){ |
90 | 90 | ||
91 | QDir d(path); | 91 | QDir d(path); |
92 | if(!d.exists()) | 92 | if(!d.exists()) |
93 | return; | 93 | return; |
94 | 94 | ||
95 | QString lang = ::getenv("LANG"); | 95 | QString lang = ::getenv("LANG"); |
96 | 96 | ||
97 | // Don't want sym links | 97 | // Don't want sym links |
98 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 98 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
99 | const QFileInfoList *list = d.entryInfoList(); | 99 | const QFileInfoList *list = d.entryInfoList(); |
100 | QFileInfoListIterator it( *list ); | 100 | QFileInfoListIterator it( *list ); |
101 | QFileInfo *fi; | 101 | QFileInfo *fi; |
102 | 102 | ||
103 | while ( (fi=it.current()) ) { | 103 | while ( (fi=it.current()) ) { |
104 | 104 | ||
105 | if( fi->fileName().contains(".so")){ | 105 | if( fi->fileName().contains(".so")){ |
106 | /* if loaded install translation */ | 106 | /* if loaded install translation */ |
107 | if( loadNetNode(path + "/" + fi->fileName()) ) { | 107 | if( loadNetNode(path + "/" + fi->fileName()) ) { |
108 | QTranslator *trans = new QTranslator(qApp); | 108 | QTranslator *trans = new QTranslator(qApp); |
109 | QString fn = QPEApplication::qpeDir()+ | 109 | QString fn = QPEApplication::qpeDir()+ |
110 | "/i18n/"+lang+"/"+ | 110 | "/i18n/"+lang+"/"+ |
111 | fi->fileName().left( fi->fileName().find(".") )+ | 111 | fi->fileName().left( fi->fileName().find(".") )+ |
112 | ".qm"; | 112 | ".qm"; |
113 | 113 | ||
114 | if( trans->load( fn ) ) | 114 | if( trans->load( fn ) ) |
115 | qApp->installTranslator( trans ); | 115 | qApp->installTranslator( trans ); |
116 | else | 116 | else |
117 | delete trans; | 117 | delete trans; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | ++it; | 120 | ++it; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Attempt to load a function and resolve a function. | 125 | * Attempt to load a function and resolve a function. |
126 | * @param pluginFileName - the name of the file in which to attempt to load | 126 | * @param pluginFileName - the name of the file in which to attempt to load |
127 | * @param resolveString - function pointer to resolve | 127 | * @param resolveString - function pointer to resolve |
128 | * @return true of loading is successful | 128 | * @return true of loading is successful |
129 | */ | 129 | */ |
130 | bool TheNSResources::loadNetNode( | 130 | bool TheNSResources::loadNetNode( |
131 | const QString &pluginFileName, const QString &resolveString){ | 131 | const QString &pluginFileName, const QString &resolveString){ |
132 | 132 | ||
133 | QLibrary *lib = new QLibrary(pluginFileName); | 133 | QLibrary *lib = new QLibrary(pluginFileName); |
134 | void * res = lib->resolve(resolveString); | 134 | void * res = lib->resolve(resolveString); |
135 | if( ! res ){ | 135 | if( ! res ){ |
136 | delete lib; | 136 | delete lib; |
137 | return 0; | 137 | return 0; |
138 | } | 138 | } |
139 | 139 | ||
140 | GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; | 140 | GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; |
141 | 141 | ||
142 | // Try to get an object. | 142 | // Try to get an object. |
143 | QList<ANetNode> PNN; | 143 | QList<ANetNode> PNN; |
144 | 144 | ||
145 | getNetNodeList( PNN ); | 145 | getNetNodeList( PNN ); |
146 | if( PNN.isEmpty() ) { | 146 | if( PNN.isEmpty() ) { |
147 | delete lib; | 147 | delete lib; |
148 | return 0; | 148 | return 0; |
149 | } | 149 | } |
150 | 150 | ||
151 | ANetNode * NNP; | 151 | ANetNode * NNP; |
152 | for( QListIterator<ANetNode> it(PNN); | 152 | for( QListIterator<ANetNode> it(PNN); |
153 | it.current(); | 153 | it.current(); |
154 | ++it ) { | 154 | ++it ) { |
155 | NetNode_t * NN; | 155 | NetNode_t * NN; |
156 | 156 | ||
157 | NNP = it.current(); | 157 | NNP = it.current(); |
158 | NN = new NetNode_t; | 158 | NN = new NetNode_t; |
159 | NN->NetNode = NNP; | 159 | NN->NetNode = NNP; |
160 | NN->TheLibrary = lib; | 160 | NN->TheLibrary = lib; |
161 | NN->NodeCountInLib = PNN.count(); | 161 | NN->NodeCountInLib = PNN.count(); |
162 | 162 | ||
163 | // store mapping | 163 | // store mapping |
164 | AllNodeTypes.insert( NN->NetNode->nodeName(), NN ); | 164 | AllNodeTypes.insert( NN->NetNode->nodeName(), NN ); |
165 | } | 165 | } |
166 | 166 | ||
167 | return 1; | 167 | return 1; |
168 | } | 168 | } |
169 | 169 | ||
170 | QPixmap TheNSResources::getPixmap( const QString & QS ) { | 170 | QPixmap TheNSResources::getPixmap( const QString & QS ) { |
171 | return Resource::loadPixmap( QString("networksettings2")+QS ); | 171 | QString S("networksettings2/"); |
172 | S += QS; | ||
173 | printf( " pixmap %s\n", S.latin1() ); | ||
174 | return Resource::loadPixmap( QString("networksettings2/")+QS ); | ||
172 | } | 175 | } |
173 | 176 | ||
174 | QString TheNSResources::tr( const char * s ) { | 177 | QString TheNSResources::tr( const char * s ) { |
175 | return qApp->translate( "resource", s ); | 178 | return qApp->translate( "resource", s ); |
176 | } | 179 | } |
177 | 180 | ||
178 | const QString & TheNSResources::netNode2Name( const char * s ) { | 181 | const QString & TheNSResources::netNode2Name( const char * s ) { |
179 | return NodeTypeNameMap[s]; | 182 | return NodeTypeNameMap[s]; |
180 | } | 183 | } |
181 | 184 | ||
182 | const QString & TheNSResources::netNode2Description( const char * s ) { | 185 | const QString & TheNSResources::netNode2Description( const char * s ) { |
183 | return NodeTypeDescriptionMap[s]; | 186 | return NodeTypeDescriptionMap[s]; |
184 | } | 187 | } |
185 | 188 | ||
186 | void TheNSResources::addConnection( NodeCollection * NC ) { | 189 | void TheNSResources::addConnection( NodeCollection * NC ) { |
187 | ANetNodeInstance * NNI; | 190 | ANetNodeInstance * NNI; |
188 | ConnectionsMap.insert( NC->name(), NC ); | 191 | ConnectionsMap.insert( NC->name(), NC ); |
189 | // add (new) nodes to NodeList | 192 | // add (new) nodes to NodeList |
190 | for( QListIterator<ANetNodeInstance> it(*NC); | 193 | for( QListIterator<ANetNodeInstance> it(*NC); |
191 | it.current(); | 194 | it.current(); |
192 | ++it ) { | 195 | ++it ) { |
193 | NNI = it.current(); | 196 | NNI = it.current(); |
194 | if( findNodeInstance( NNI->nodeName() ) == 0 ) { | 197 | if( findNodeInstance( NNI->nodeName() ) == 0 ) { |
195 | // new item | 198 | // new item |
196 | addNodeInstance( NNI ); | 199 | addNodeInstance( NNI ); |
197 | } | 200 | } |
198 | } | 201 | } |
199 | } | 202 | } |
200 | 203 | ||
201 | void TheNSResources::removeConnection( const QString & N ) { | 204 | void TheNSResources::removeConnection( const QString & N ) { |
202 | NodeCollection * NC = findConnection( N ); | 205 | NodeCollection * NC = findConnection( N ); |
203 | if( ! NC ) | 206 | if( ! NC ) |
204 | return; | 207 | return; |
205 | 208 | ||
206 | // delete netnodes in this connection | 209 | // delete netnodes in this connection |
207 | ANetNodeInstance * NNI; | 210 | ANetNodeInstance * NNI; |
208 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { | 211 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { |
209 | removeNodeInstance( NNI->nodeName() ); | 212 | removeNodeInstance( NNI->nodeName() ); |
210 | } | 213 | } |
211 | ConnectionsMap.remove( N ); | 214 | ConnectionsMap.remove( N ); |
212 | } | 215 | } |
213 | 216 | ||
214 | NodeCollection * TheNSResources::findConnection( const QString & S ) { | 217 | NodeCollection * TheNSResources::findConnection( const QString & S ) { |
215 | return ConnectionsMap[ S ]; | 218 | return ConnectionsMap[ S ]; |
216 | } | 219 | } |
217 | 220 | ||
218 | void TheNSResources::renumberConnections( void ) { | 221 | void TheNSResources::renumberConnections( void ) { |
219 | Name2Connection_t & M = NSResources->connections(); | 222 | Name2Connection_t & M = NSResources->connections(); |
220 | NodeCollection * NC; | 223 | NodeCollection * NC; |
221 | 224 | ||
222 | // for all connections | 225 | // for all connections |
223 | NodeCollection::resetMaxNr(); | 226 | NodeCollection::resetMaxNr(); |
224 | for( QDictIterator<NodeCollection> it(M); | 227 | for( QDictIterator<NodeCollection> it(M); |
225 | it.current(); | 228 | it.current(); |
226 | ++it ) { | 229 | ++it ) { |
227 | NC = it.current(); | 230 | NC = it.current(); |
228 | NC->setNumber( NC->maxConnectionNumber()+1 ); | 231 | NC->setNumber( NC->maxConnectionNumber()+1 ); |
229 | NC->setModified( 1 ); | 232 | NC->setModified( 1 ); |
230 | } | 233 | } |
231 | } | 234 | } |
diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp index 99f642e..85dcd7d 100644 --- a/noncore/settings/networksettings2/networksettings2/system.cpp +++ b/noncore/settings/networksettings2/networksettings2/system.cpp | |||
@@ -1,318 +1,319 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <sys/types.h> | 2 | #include <sys/types.h> |
3 | #include <sys/wait.h> | 3 | #include <sys/wait.h> |
4 | #include <qfile.h> | 4 | #include <qfile.h> |
5 | #include <qtextstream.h> | 5 | #include <qtextstream.h> |
6 | #include <net/if.h> | 6 | #include <net/if.h> |
7 | #include <net/if_arp.h> | 7 | #include <net/if_arp.h> |
8 | #include <netinet/in.h> | 8 | #include <netinet/in.h> |
9 | #include <arpa/inet.h> | 9 | #include <arpa/inet.h> |
10 | #include <sys/ioctl.h> | 10 | #include <sys/ioctl.h> |
11 | #include <sys/socket.h> | 11 | #include <sys/socket.h> |
12 | 12 | ||
13 | #include "resources.h" | 13 | #include "resources.h" |
14 | #include "system.h" | 14 | #include "system.h" |
15 | 15 | ||
16 | #define PROCNETDEV "/proc/net/dev" | 16 | #define PROCNETDEV "/proc/net/dev" |
17 | 17 | ||
18 | static char Dig2Hex[] = { | 18 | static char Dig2Hex[] = { |
19 | '0', '1', '2', '3', | 19 | '0', '1', '2', '3', |
20 | '4', '5', '6', '7', | 20 | '4', '5', '6', '7', |
21 | '8', '9', 'A', 'B', | 21 | '8', '9', 'A', 'B', |
22 | 'C', 'D', 'E', 'F' | 22 | 'C', 'D', 'E', 'F' |
23 | }; | 23 | }; |
24 | 24 | ||
25 | // get HIGH nibble of byte | 25 | // get HIGH nibble of byte |
26 | #define HN(x) Dig2Hex[(((x)&0xf0)>>4)] | 26 | #define HN(x) Dig2Hex[(((x)&0xf0)>>4)] |
27 | // get LOW nibble of byte | 27 | // get LOW nibble of byte |
28 | #define LN(x) Dig2Hex[((x)&0x0f)] | 28 | #define LN(x) Dig2Hex[((x)&0x0f)] |
29 | 29 | ||
30 | System::System( void ) : ProbedInterfaces() { | 30 | System::System( void ) : ProbedInterfaces() { |
31 | probeInterfaces(); | 31 | probeInterfaces(); |
32 | } | 32 | } |
33 | 33 | ||
34 | System::~System( void ) { | 34 | System::~System( void ) { |
35 | if( ProcDevNet ) | 35 | if( ProcDevNet ) |
36 | delete ProcDevNet; | 36 | delete ProcDevNet; |
37 | } | 37 | } |
38 | 38 | ||
39 | int System::execute( const QString & S ) { | 39 | int System::execute( const QString & S ) { |
40 | QString MyS = S; | 40 | QString MyS = S; |
41 | int rv; | 41 | int rv; |
42 | 42 | ||
43 | if( S.isEmpty() ) { | 43 | if( S.isEmpty() ) { |
44 | // loophole to start shell | 44 | // loophole to start shell |
45 | return 8888; | 45 | return 8888; |
46 | } | 46 | } |
47 | if( getenv("USER") != "root" ) { | 47 | if( getenv("USER") != "root" ) { |
48 | // use SUDO | 48 | // use SUDO |
49 | MyS.prepend( "sudo " ); | 49 | MyS.prepend( "sudo " ); |
50 | } | 50 | } |
51 | 51 | ||
52 | fprintf( stderr, "Executing %s\n", MyS.latin1() ); | 52 | fprintf( stderr, "Executing %s\n", MyS.latin1() ); |
53 | 53 | ||
54 | rv = system( MyS.latin1() ) ; | 54 | rv = system( MyS.latin1() ) ; |
55 | switch( rv ) { | 55 | switch( rv ) { |
56 | case -1 : | 56 | case -1 : |
57 | // cannot fork | 57 | // cannot fork |
58 | return 1; | 58 | return 1; |
59 | case 127 : | 59 | case 127 : |
60 | // cannot start shell | 60 | // cannot start shell |
61 | return 2; | 61 | return 2; |
62 | default : | 62 | default : |
63 | if( WEXITSTATUS(rv) != 0 ) { | 63 | if( WEXITSTATUS(rv) != 0 ) { |
64 | // error in command | 64 | // error in command |
65 | return 3; | 65 | return 3; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | // all is fine | 68 | // all is fine |
69 | return 0; | 69 | return 0; |
70 | } | 70 | } |
71 | 71 | ||
72 | void System::refreshStatistics( InterfaceInfo & I ) { | 72 | void System::refreshStatistics( InterfaceInfo & I ) { |
73 | if( ! ProcDevNet ) { | 73 | if( ! ProcDevNet ) { |
74 | return; | 74 | return; |
75 | } | 75 | } |
76 | // cannot seek on dev | 76 | // cannot seek on dev |
77 | ProcDevNet->close(); | 77 | ProcDevNet->close(); |
78 | ProcDevNet->open( IO_ReadOnly ); | 78 | ProcDevNet->open( IO_ReadOnly ); |
79 | 79 | ||
80 | QString line; | 80 | QString line; |
81 | QTextStream procTs(ProcDevNet); | 81 | QTextStream procTs(ProcDevNet); |
82 | QStringList SL; | 82 | QStringList SL; |
83 | int loc = -1; | 83 | int loc = -1; |
84 | int version; | 84 | int version; |
85 | 85 | ||
86 | procTs.readLine(); | 86 | procTs.readLine(); |
87 | line = procTs.readLine(); | 87 | line = procTs.readLine(); |
88 | // get version | 88 | // get version |
89 | if( line.find("compressed") ) | 89 | if( line.find("compressed") ) |
90 | version = 3; | 90 | version = 3; |
91 | else if( line.find( "bytes" ) ) | 91 | else if( line.find( "bytes" ) ) |
92 | version = 2; | 92 | version = 2; |
93 | else | 93 | else |
94 | version = 1; | 94 | version = 1; |
95 | while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) { | 95 | while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) { |
96 | if( (loc = line.find(":") ) == -1) { | 96 | if( (loc = line.find(":") ) == -1) { |
97 | continue; | 97 | continue; |
98 | } | 98 | } |
99 | 99 | ||
100 | if( I.Name != line.left(loc) ) | 100 | if( I.Name != line.left(loc) ) |
101 | continue; | 101 | continue; |
102 | 102 | ||
103 | // tokenize | 103 | // tokenize |
104 | SL = QStringList::split( ' ', line, FALSE ); | 104 | SL = QStringList::split( ' ', line, FALSE ); |
105 | 105 | ||
106 | // update data | 106 | // update data |
107 | switch( version ) { | 107 | switch( version ) { |
108 | case 1 : | 108 | case 1 : |
109 | I.RcvBytes = SL[1]; | 109 | I.RcvBytes = SL[1]; |
110 | I.RcvErrors = SL[3]; | 110 | I.RcvErrors = SL[3]; |
111 | I.RcvDropped = SL[4]; | 111 | I.RcvDropped = SL[4]; |
112 | I.SndBytes = SL[6]; | 112 | I.SndBytes = SL[6]; |
113 | I.SndErrors = SL[8]; | 113 | I.SndErrors = SL[8]; |
114 | I.SndDropped = SL[9]; | 114 | I.SndDropped = SL[9]; |
115 | I.Collisions = SL[11]; | 115 | I.Collisions = SL[11]; |
116 | break; | 116 | break; |
117 | case 2 : | 117 | case 2 : |
118 | I.RcvBytes = SL[1]; | 118 | I.RcvBytes = SL[1]; |
119 | I.RcvErrors = SL[3]; | 119 | I.RcvErrors = SL[3]; |
120 | I.RcvDropped = SL[4]; | 120 | I.RcvDropped = SL[4]; |
121 | I.SndBytes = SL[7]; | 121 | I.SndBytes = SL[7]; |
122 | I.SndErrors = SL[9]; | 122 | I.SndErrors = SL[9]; |
123 | I.SndDropped = SL[10]; | 123 | I.SndDropped = SL[10]; |
124 | I.Collisions = SL[12]; | 124 | I.Collisions = SL[12]; |
125 | break; | 125 | break; |
126 | case 3 : | 126 | case 3 : |
127 | I.RcvBytes = SL[1]; | 127 | I.RcvBytes = SL[1]; |
128 | I.RcvErrors = SL[3]; | 128 | I.RcvErrors = SL[3]; |
129 | I.RcvDropped = SL[4]; | 129 | I.RcvDropped = SL[4]; |
130 | I.SndBytes = SL[9]; | 130 | I.SndBytes = SL[9]; |
131 | I.SndErrors = SL[11]; | 131 | I.SndErrors = SL[11]; |
132 | I.SndDropped = SL[12]; | 132 | I.SndDropped = SL[12]; |
133 | I.Collisions = SL[14]; | 133 | I.Collisions = SL[14]; |
134 | break; | 134 | break; |
135 | } | 135 | } |
136 | break; | 136 | break; |
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | // | 140 | // |
141 | // THIS UPDATES THE LIST -> INTERFACES ARE NOT DELETED BUT | 141 | // THIS UPDATES THE LIST -> INTERFACES ARE NOT DELETED BUT |
142 | // FLAGGED AS ! 'IsUp' IF NO LONGER PRESENT | 142 | // FLAGGED AS ! 'IsUp' IF NO LONGER PRESENT |
143 | // | 143 | // |
144 | 144 | ||
145 | void System::probeInterfaces( void ) { | 145 | void System::probeInterfaces( void ) { |
146 | 146 | ||
147 | // probe interfaces | 147 | // probe interfaces |
148 | int sockfd; | 148 | int sockfd; |
149 | // get list of all interfaces | 149 | // get list of all interfaces |
150 | struct ifreq ifrs; | 150 | struct ifreq ifrs; |
151 | InterfaceInfo * IFI; | 151 | InterfaceInfo * IFI; |
152 | 152 | ||
153 | // flag all as 'down' | 153 | // flag all as 'down' |
154 | for( QDictIterator<InterfaceInfo> it( ProbedInterfaces ); | 154 | for( QDictIterator<InterfaceInfo> it( ProbedInterfaces ); |
155 | it.current(); | 155 | it.current(); |
156 | ++it ) { | 156 | ++it ) { |
157 | it.current()->IsUp = 0; | 157 | it.current()->IsUp = 0; |
158 | } | 158 | } |
159 | 159 | ||
160 | sockfd = socket(PF_INET, SOCK_DGRAM, 0); | 160 | sockfd = socket(PF_INET, SOCK_DGRAM, 0); |
161 | if(sockfd == -1) | 161 | if(sockfd == -1) |
162 | return; | 162 | return; |
163 | 163 | ||
164 | // read interfaces from /proc/dev/net | 164 | // read interfaces from /proc/dev/net |
165 | // SIOCGIFCONF does not return ALL interfaces ???!? | 165 | // SIOCGIFCONF does not return ALL interfaces ???!? |
166 | ProcDevNet = new QFile(PROCNETDEV); | 166 | ProcDevNet = new QFile(PROCNETDEV); |
167 | if( ! ProcDevNet->open(IO_ReadOnly) ) { | 167 | if( ! ProcDevNet->open(IO_ReadOnly) ) { |
168 | delete ProcDevNet; | 168 | delete ProcDevNet; |
169 | ProcDevNet =0; | 169 | ProcDevNet =0; |
170 | return; | 170 | return; |
171 | } | 171 | } |
172 | 172 | ||
173 | QString line; | 173 | QString line; |
174 | QString NicName; | 174 | QString NicName; |
175 | QTextStream procTs(ProcDevNet); | 175 | QTextStream procTs(ProcDevNet); |
176 | int loc = -1; | 176 | int loc = -1; |
177 | 177 | ||
178 | procTs.readLine(); // eat a line | 178 | procTs.readLine(); // eat a line |
179 | procTs.readLine(); // eat a line | 179 | procTs.readLine(); // eat a line |
180 | while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) { | 180 | while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) { |
181 | if((loc = line.find(":")) == -1) { | 181 | if((loc = line.find(":")) == -1) { |
182 | continue; | 182 | continue; |
183 | } | 183 | } |
184 | 184 | ||
185 | NicName = line.left(loc); | 185 | NicName = line.left(loc); |
186 | 186 | ||
187 | // set name for ioctl | 187 | // set name for ioctl |
188 | strcpy( ifrs.ifr_name, NicName.latin1() ); | 188 | strcpy( ifrs.ifr_name, NicName.latin1() ); |
189 | 189 | ||
190 | if ( ! ( IFI = ProbedInterfaces.find( NicName ) ) ) { | 190 | if ( ! ( IFI = ProbedInterfaces.find( NicName ) ) ) { |
191 | // new nic | 191 | // new nic |
192 | fprintf( stderr, "NEWNIC %s\n", NicName.latin1()); | 192 | fprintf( stderr, "NEWNIC %s\n", NicName.latin1()); |
193 | IFI = new InterfaceInfo; | 193 | IFI = new InterfaceInfo; |
194 | IFI->Name = line.left(loc); | 194 | IFI->Name = line.left(loc); |
195 | IFI->NetNode = 0; | 195 | IFI->NetNode = 0; |
196 | ProbedInterfaces.insert( IFI->Name, IFI ); | 196 | ProbedInterfaces.insert( IFI->Name, IFI ); |
197 | 197 | ||
198 | // get dynamic info | 198 | // get dynamic info |
199 | if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) { | 199 | if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) { |
200 | IFI->IsPointToPoint = ((ifrs.ifr_flags & IFF_POINTOPOINT) == IFF_POINTOPOINT); | 200 | IFI->IsPointToPoint = ((ifrs.ifr_flags & IFF_POINTOPOINT) == IFF_POINTOPOINT); |
201 | } else { | 201 | } else { |
202 | IFI->IsPointToPoint = 0; | 202 | IFI->IsPointToPoint = 0; |
203 | } | 203 | } |
204 | 204 | ||
205 | // settings that never change | 205 | // settings that never change |
206 | IFI->DstAddress = ""; | 206 | IFI->DstAddress = ""; |
207 | 207 | ||
208 | if( IFI->IsPointToPoint ) { | 208 | if( IFI->IsPointToPoint ) { |
209 | if( ioctl(sockfd, SIOCGIFDSTADDR, &ifrs) >= 0 ) { | 209 | if( ioctl(sockfd, SIOCGIFDSTADDR, &ifrs) >= 0 ) { |
210 | IFI->DstAddress = | 210 | IFI->DstAddress = |
211 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_dstaddr)->sin_addr); | 211 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_dstaddr)->sin_addr); |
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | IFI->CardType = 999999; | 215 | IFI->CardType = 999999; |
216 | IFI->MACAddress = ""; | 216 | IFI->MACAddress = ""; |
217 | 217 | ||
218 | if( ioctl(sockfd, SIOCGIFHWADDR, &ifrs) >= 0 ) { | 218 | if( ioctl(sockfd, SIOCGIFHWADDR, &ifrs) >= 0 ) { |
219 | fprintf( stderr, "%s = %d\n", IFI->Name.latin1(), | 219 | fprintf( stderr, "%s = %d\n", IFI->Name.latin1(), |
220 | ifrs.ifr_hwaddr.sa_family ); | 220 | ifrs.ifr_hwaddr.sa_family ); |
221 | 221 | ||
222 | IFI->CardType = ifrs.ifr_hwaddr.sa_family; | 222 | IFI->CardType = ifrs.ifr_hwaddr.sa_family; |
223 | switch( ifrs.ifr_hwaddr.sa_family ) { | 223 | switch( ifrs.ifr_hwaddr.sa_family ) { |
224 | case ARPHRD_ETHER : // regular MAC address | 224 | case ARPHRD_ETHER : // regular MAC address |
225 | // valid address -> convert to regular ::: format | 225 | // valid address -> convert to regular ::: format |
226 | // length = 6 bytes = 12 DIGITS -> 6 : | 226 | // length = 6 bytes = 12 DIGITS -> 6 : |
227 | IFI->MACAddress.sprintf( | 227 | IFI->MACAddress.sprintf( |
228 | "%c%c:%c%c:%c%c:%c%c:%c%c:%c%c", | 228 | "%c%c:%c%c:%c%c:%c%c:%c%c:%c%c", |
229 | HN( ifrs.ifr_hwaddr.sa_data[0] ), | 229 | HN( ifrs.ifr_hwaddr.sa_data[0] ), |
230 | LN( ifrs.ifr_hwaddr.sa_data[0] ), | 230 | LN( ifrs.ifr_hwaddr.sa_data[0] ), |
231 | HN( ifrs.ifr_hwaddr.sa_data[1] ), | 231 | HN( ifrs.ifr_hwaddr.sa_data[1] ), |
232 | LN( ifrs.ifr_hwaddr.sa_data[1] ), | 232 | LN( ifrs.ifr_hwaddr.sa_data[1] ), |
233 | HN( ifrs.ifr_hwaddr.sa_data[2] ), | 233 | HN( ifrs.ifr_hwaddr.sa_data[2] ), |
234 | LN( ifrs.ifr_hwaddr.sa_data[2] ), | 234 | LN( ifrs.ifr_hwaddr.sa_data[2] ), |
235 | HN( ifrs.ifr_hwaddr.sa_data[3] ), | 235 | HN( ifrs.ifr_hwaddr.sa_data[3] ), |
236 | LN( ifrs.ifr_hwaddr.sa_data[3] ), | 236 | LN( ifrs.ifr_hwaddr.sa_data[3] ), |
237 | HN( ifrs.ifr_hwaddr.sa_data[4] ), | 237 | HN( ifrs.ifr_hwaddr.sa_data[4] ), |
238 | LN( ifrs.ifr_hwaddr.sa_data[4] ), | 238 | LN( ifrs.ifr_hwaddr.sa_data[4] ), |
239 | HN( ifrs.ifr_hwaddr.sa_data[5] ), | 239 | HN( ifrs.ifr_hwaddr.sa_data[5] ), |
240 | LN( ifrs.ifr_hwaddr.sa_data[5] ) | 240 | LN( ifrs.ifr_hwaddr.sa_data[5] ) |
241 | ); | 241 | ); |
242 | break; | 242 | break; |
243 | #ifdef ARPHRD_IEEE1394 | 243 | #ifdef ARPHRD_IEEE1394 |
244 | case ARPHRD_IEEE1394 : // Firewire Eth address | 244 | case ARPHRD_IEEE1394 : // Firewire Eth address |
245 | IFI->MACAddress.sprintf( | 245 | IFI->MACAddress.sprintf( |
246 | "%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-00-00", | 246 | "%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-00-00", |
247 | HN( ifrs.ifr_hwaddr.sa_data[0] ), | 247 | HN( ifrs.ifr_hwaddr.sa_data[0] ), |
248 | LN( ifrs.ifr_hwaddr.sa_data[0] ), | 248 | LN( ifrs.ifr_hwaddr.sa_data[0] ), |
249 | HN( ifrs.ifr_hwaddr.sa_data[1] ), | 249 | HN( ifrs.ifr_hwaddr.sa_data[1] ), |
250 | LN( ifrs.ifr_hwaddr.sa_data[1] ), | 250 | LN( ifrs.ifr_hwaddr.sa_data[1] ), |
251 | HN( ifrs.ifr_hwaddr.sa_data[2] ), | 251 | HN( ifrs.ifr_hwaddr.sa_data[2] ), |
252 | LN( ifrs.ifr_hwaddr.sa_data[2] ), | 252 | LN( ifrs.ifr_hwaddr.sa_data[2] ), |
253 | HN( ifrs.ifr_hwaddr.sa_data[3] ), | 253 | HN( ifrs.ifr_hwaddr.sa_data[3] ), |
254 | LN( ifrs.ifr_hwaddr.sa_data[3] ), | 254 | LN( ifrs.ifr_hwaddr.sa_data[3] ), |
255 | HN( ifrs.ifr_hwaddr.sa_data[4] ), | 255 | HN( ifrs.ifr_hwaddr.sa_data[4] ), |
256 | LN( ifrs.ifr_hwaddr.sa_data[4] ), | 256 | LN( ifrs.ifr_hwaddr.sa_data[4] ), |
257 | HN( ifrs.ifr_hwaddr.sa_data[5] ), | 257 | HN( ifrs.ifr_hwaddr.sa_data[5] ), |
258 | LN( ifrs.ifr_hwaddr.sa_data[5] ), | 258 | LN( ifrs.ifr_hwaddr.sa_data[5] ), |
259 | HN( ifrs.ifr_hwaddr.sa_data[6] ), | 259 | HN( ifrs.ifr_hwaddr.sa_data[6] ), |
260 | LN( ifrs.ifr_hwaddr.sa_data[6] ), | 260 | LN( ifrs.ifr_hwaddr.sa_data[6] ), |
261 | HN( ifrs.ifr_hwaddr.sa_data[7] ), | 261 | HN( ifrs.ifr_hwaddr.sa_data[7] ), |
262 | LN( ifrs.ifr_hwaddr.sa_data[7] ), | 262 | LN( ifrs.ifr_hwaddr.sa_data[7] ), |
263 | HN( ifrs.ifr_hwaddr.sa_data[8] ), | 263 | HN( ifrs.ifr_hwaddr.sa_data[8] ), |
264 | LN( ifrs.ifr_hwaddr.sa_data[8] ), | 264 | LN( ifrs.ifr_hwaddr.sa_data[8] ), |
265 | HN( ifrs.ifr_hwaddr.sa_data[9] ), | 265 | HN( ifrs.ifr_hwaddr.sa_data[9] ), |
266 | LN( ifrs.ifr_hwaddr.sa_data[9] ), | 266 | LN( ifrs.ifr_hwaddr.sa_data[9] ), |
267 | HN( ifrs.ifr_hwaddr.sa_data[10] ), | 267 | HN( ifrs.ifr_hwaddr.sa_data[10] ), |
268 | LN( ifrs.ifr_hwaddr.sa_data[10] ), | 268 | LN( ifrs.ifr_hwaddr.sa_data[10] ), |
269 | HN( ifrs.ifr_hwaddr.sa_data[11] ), | 269 | HN( ifrs.ifr_hwaddr.sa_data[11] ), |
270 | LN( ifrs.ifr_hwaddr.sa_data[11] ), | 270 | LN( ifrs.ifr_hwaddr.sa_data[11] ), |
271 | HN( ifrs.ifr_hwaddr.sa_data[12] ), | 271 | HN( ifrs.ifr_hwaddr.sa_data[12] ), |
272 | LN( ifrs.ifr_hwaddr.sa_data[12] ), | 272 | LN( ifrs.ifr_hwaddr.sa_data[12] ), |
273 | HN( ifrs.ifr_hwaddr.sa_data[13] ), | 273 | HN( ifrs.ifr_hwaddr.sa_data[13] ), |
274 | LN( ifrs.ifr_hwaddr.sa_data[13] ) | 274 | LN( ifrs.ifr_hwaddr.sa_data[13] ) |
275 | ); | 275 | ); |
276 | break; | 276 | break; |
277 | #endif | 277 | #endif |
278 | case ARPHRD_PPP : // PPP | 278 | case ARPHRD_PPP : // PPP |
279 | break; | 279 | break; |
280 | case ARPHRD_IEEE80211 : // WLAN | 280 | case ARPHRD_IEEE80211 : // WLAN |
281 | break; | 281 | break; |
282 | case ARPHRD_IRDA : // IRDA | 282 | case ARPHRD_IRDA : // IRDA |
283 | break; | 283 | break; |
284 | } | 284 | } |
285 | } | 285 | } |
286 | } else // else already probed before -> just update | 286 | } else // else already probed before -> just update |
287 | fprintf( stderr, "OLDNIC %s\n", NicName.latin1()); | 287 | fprintf( stderr, "OLDNIC %s\n", NicName.latin1()); |
288 | 288 | ||
289 | // get dynamic info | 289 | // get dynamic info |
290 | if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) { | 290 | if( ioctl(sockfd, SIOCGIFFLAGS, &ifrs) >= 0 ) { |
291 | IFI->IsUp = ((ifrs.ifr_flags & IFF_UP) == IFF_UP); | 291 | IFI->IsUp = ((ifrs.ifr_flags & IFF_UP) == IFF_UP); |
292 | IFI->HasMulticast = ((ifrs.ifr_flags & IFF_MULTICAST) == IFF_MULTICAST); | 292 | IFI->HasMulticast = ((ifrs.ifr_flags & IFF_MULTICAST) == IFF_MULTICAST); |
293 | } else { | 293 | } else { |
294 | IFI->IsUp = 0; | 294 | IFI->IsUp = 0; |
295 | IFI->HasMulticast = 0; | 295 | IFI->HasMulticast = 0; |
296 | } | 296 | } |
297 | 297 | ||
298 | if( ioctl(sockfd, SIOCGIFADDR, &ifrs) >= 0 ) { | 298 | if( ioctl(sockfd, SIOCGIFADDR, &ifrs) >= 0 ) { |
299 | IFI->Address = | 299 | IFI->Address = |
300 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_addr)->sin_addr); | 300 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_addr)->sin_addr); |
301 | } else { | 301 | } else { |
302 | IFI->Address = ""; | 302 | IFI->Address = ""; |
303 | IFI->IsUp = 0; | 303 | IFI->IsUp = 0; |
304 | } | 304 | } |
305 | if( ioctl(sockfd, SIOCGIFBRDADDR, &ifrs) >= 0 ) { | 305 | if( ioctl(sockfd, SIOCGIFBRDADDR, &ifrs) >= 0 ) { |
306 | IFI->BCastAddress = | 306 | IFI->BCastAddress = |
307 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_broadaddr)->sin_addr); | 307 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_broadaddr)->sin_addr); |
308 | } else { | 308 | } else { |
309 | IFI->BCastAddress = ""; | 309 | IFI->BCastAddress = ""; |
310 | } | 310 | } |
311 | if( ioctl(sockfd, SIOCGIFNETMASK, &ifrs) >= 0 ) { | 311 | if( ioctl(sockfd, SIOCGIFNETMASK, &ifrs) >= 0 ) { |
312 | IFI->Netmask = | 312 | IFI->Netmask = |
313 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_netmask)->sin_addr); | 313 | inet_ntoa(((struct sockaddr_in*)&ifrs.ifr_netmask)->sin_addr); |
314 | } else { | 314 | } else { |
315 | IFI->Netmask = ""; | 315 | IFI->Netmask = ""; |
316 | } | 316 | } |
317 | fprintf( stderr, "NIC %s UP %d\n", NicName.latin1(), IFI->IsUp ); | ||
317 | } | 318 | } |
318 | } | 319 | } |
diff --git a/noncore/settings/networksettings2/networksettingsGUI.ui b/noncore/settings/networksettings2/networksettingsGUI.ui index d457c35..1d79123 100644 --- a/noncore/settings/networksettings2/networksettingsGUI.ui +++ b/noncore/settings/networksettings2/networksettingsGUI.ui | |||
@@ -1,598 +1,457 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>NetworkSettingsGUI</class> | 2 | <class>NetworkSettingsGUI</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>NetworkSettingsGUI</cstring> | 7 | <cstring>NetworkSettingsGUI</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>403</width> | 14 | <width>399</width> |
15 | <height>502</height> | 15 | <height>502</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>Network Settings</string> | 20 | <string>Network Settings</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>2</number> | 35 | <number>0</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QFrame</class> | 38 | <class>QFrame</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>Frame4</cstring> | 41 | <cstring>Frame4</cstring> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>sizePolicy</name> | 44 | <name>sizePolicy</name> |
45 | <sizepolicy> | 45 | <sizepolicy> |
46 | <hsizetype>7</hsizetype> | 46 | <hsizetype>7</hsizetype> |
47 | <vsizetype>0</vsizetype> | 47 | <vsizetype>0</vsizetype> |
48 | </sizepolicy> | 48 | </sizepolicy> |
49 | </property> | 49 | </property> |
50 | <property stdset="1"> | 50 | <property stdset="1"> |
51 | <name>frameShape</name> | 51 | <name>frameShape</name> |
52 | <enum>NoFrame</enum> | 52 | <enum>NoFrame</enum> |
53 | </property> | 53 | </property> |
54 | <property stdset="1"> | 54 | <property stdset="1"> |
55 | <name>frameShadow</name> | 55 | <name>frameShadow</name> |
56 | <enum>Raised</enum> | 56 | <enum>Raised</enum> |
57 | </property> | 57 | </property> |
58 | <property> | 58 | <property> |
59 | <name>layoutMargin</name> | 59 | <name>layoutMargin</name> |
60 | </property> | 60 | </property> |
61 | <property> | 61 | <property> |
62 | <name>layoutSpacing</name> | 62 | <name>layoutSpacing</name> |
63 | </property> | 63 | </property> |
64 | <hbox> | 64 | <hbox> |
65 | <property stdset="1"> | 65 | <property stdset="1"> |
66 | <name>margin</name> | 66 | <name>margin</name> |
67 | <number>0</number> | 67 | <number>0</number> |
68 | </property> | 68 | </property> |
69 | <property stdset="1"> | 69 | <property stdset="1"> |
70 | <name>spacing</name> | 70 | <name>spacing</name> |
71 | <number>1</number> | 71 | <number>1</number> |
72 | </property> | 72 | </property> |
73 | <widget> | 73 | <widget> |
74 | <class>QToolButton</class> | 74 | <class>QToolButton</class> |
75 | <property stdset="1"> | 75 | <property stdset="1"> |
76 | <name>name</name> | 76 | <name>name</name> |
77 | <cstring>Add_TB</cstring> | 77 | <cstring>Add_TB</cstring> |
78 | </property> | 78 | </property> |
79 | <property stdset="1"> | 79 | <property stdset="1"> |
80 | <name>sizePolicy</name> | 80 | <name>sizePolicy</name> |
81 | <sizepolicy> | 81 | <sizepolicy> |
82 | <hsizetype>0</hsizetype> | 82 | <hsizetype>0</hsizetype> |
83 | <vsizetype>0</vsizetype> | 83 | <vsizetype>0</vsizetype> |
84 | </sizepolicy> | 84 | </sizepolicy> |
85 | </property> | 85 | </property> |
86 | <property stdset="1"> | 86 | <property stdset="1"> |
87 | <name>text</name> | 87 | <name>text</name> |
88 | <string>...</string> | 88 | <string>...</string> |
89 | </property> | 89 | </property> |
90 | </widget> | 90 | </widget> |
91 | <widget> | 91 | <widget> |
92 | <class>QToolButton</class> | 92 | <class>QToolButton</class> |
93 | <property stdset="1"> | 93 | <property stdset="1"> |
94 | <name>name</name> | 94 | <name>name</name> |
95 | <cstring>Delete_TB</cstring> | 95 | <cstring>Delete_TB</cstring> |
96 | </property> | 96 | </property> |
97 | <property stdset="1"> | 97 | <property stdset="1"> |
98 | <name>sizePolicy</name> | 98 | <name>sizePolicy</name> |
99 | <sizepolicy> | 99 | <sizepolicy> |
100 | <hsizetype>0</hsizetype> | 100 | <hsizetype>0</hsizetype> |
101 | <vsizetype>0</vsizetype> | 101 | <vsizetype>0</vsizetype> |
102 | </sizepolicy> | 102 | </sizepolicy> |
103 | </property> | 103 | </property> |
104 | <property stdset="1"> | 104 | <property stdset="1"> |
105 | <name>text</name> | 105 | <name>text</name> |
106 | <string>...</string> | 106 | <string>...</string> |
107 | </property> | 107 | </property> |
108 | </widget> | 108 | </widget> |
109 | <widget> | 109 | <widget> |
110 | <class>QToolButton</class> | 110 | <class>QToolButton</class> |
111 | <property stdset="1"> | 111 | <property stdset="1"> |
112 | <name>name</name> | 112 | <name>name</name> |
113 | <cstring>CheckState_TB</cstring> | 113 | <cstring>CheckState_TB</cstring> |
114 | </property> | 114 | </property> |
115 | <property stdset="1"> | 115 | <property stdset="1"> |
116 | <name>sizePolicy</name> | 116 | <name>sizePolicy</name> |
117 | <sizepolicy> | 117 | <sizepolicy> |
118 | <hsizetype>0</hsizetype> | 118 | <hsizetype>0</hsizetype> |
119 | <vsizetype>0</vsizetype> | 119 | <vsizetype>0</vsizetype> |
120 | </sizepolicy> | 120 | </sizepolicy> |
121 | </property> | 121 | </property> |
122 | <property stdset="1"> | 122 | <property stdset="1"> |
123 | <name>text</name> | 123 | <name>text</name> |
124 | <string>...</string> | 124 | <string>...</string> |
125 | </property> | 125 | </property> |
126 | </widget> | 126 | </widget> |
127 | <widget> | 127 | <widget> |
128 | <class>QToolButton</class> | 128 | <class>QToolButton</class> |
129 | <property stdset="1"> | 129 | <property stdset="1"> |
130 | <name>name</name> | 130 | <name>name</name> |
131 | <cstring>GenConfig_TB</cstring> | 131 | <cstring>GenConfig_TB</cstring> |
132 | </property> | 132 | </property> |
133 | <property stdset="1"> | 133 | <property stdset="1"> |
134 | <name>sizePolicy</name> | 134 | <name>sizePolicy</name> |
135 | <sizepolicy> | 135 | <sizepolicy> |
136 | <hsizetype>0</hsizetype> | 136 | <hsizetype>0</hsizetype> |
137 | <vsizetype>0</vsizetype> | 137 | <vsizetype>0</vsizetype> |
138 | </sizepolicy> | 138 | </sizepolicy> |
139 | </property> | 139 | </property> |
140 | <property stdset="1"> | 140 | <property stdset="1"> |
141 | <name>text</name> | 141 | <name>text</name> |
142 | <string>...</string> | 142 | <string>...</string> |
143 | </property> | 143 | </property> |
144 | </widget> | 144 | </widget> |
145 | <spacer> | 145 | <spacer> |
146 | <property> | 146 | <property> |
147 | <name>name</name> | 147 | <name>name</name> |
148 | <cstring>Spacer1</cstring> | 148 | <cstring>Spacer1</cstring> |
149 | </property> | 149 | </property> |
150 | <property stdset="1"> | 150 | <property stdset="1"> |
151 | <name>orientation</name> | 151 | <name>orientation</name> |
152 | <enum>Horizontal</enum> | 152 | <enum>Horizontal</enum> |
153 | </property> | 153 | </property> |
154 | <property stdset="1"> | 154 | <property stdset="1"> |
155 | <name>sizeType</name> | 155 | <name>sizeType</name> |
156 | <enum>Expanding</enum> | 156 | <enum>Expanding</enum> |
157 | </property> | 157 | </property> |
158 | <property> | 158 | <property> |
159 | <name>sizeHint</name> | 159 | <name>sizeHint</name> |
160 | <size> | 160 | <size> |
161 | <width>20</width> | 161 | <width>20</width> |
162 | <height>20</height> | 162 | <height>20</height> |
163 | </size> | 163 | </size> |
164 | </property> | 164 | </property> |
165 | </spacer> | 165 | </spacer> |
166 | <widget> | 166 | <widget> |
167 | <class>QToolButton</class> | 167 | <class>QToolButton</class> |
168 | <property stdset="1"> | 168 | <property stdset="1"> |
169 | <name>name</name> | 169 | <name>name</name> |
170 | <cstring>On_TB</cstring> | 170 | <cstring>On_TB</cstring> |
171 | </property> | 171 | </property> |
172 | <property stdset="1"> | 172 | <property stdset="1"> |
173 | <name>sizePolicy</name> | 173 | <name>sizePolicy</name> |
174 | <sizepolicy> | 174 | <sizepolicy> |
175 | <hsizetype>0</hsizetype> | 175 | <hsizetype>0</hsizetype> |
176 | <vsizetype>0</vsizetype> | 176 | <vsizetype>0</vsizetype> |
177 | </sizepolicy> | 177 | </sizepolicy> |
178 | </property> | 178 | </property> |
179 | <property stdset="1"> | 179 | <property stdset="1"> |
180 | <name>text</name> | 180 | <name>text</name> |
181 | <string>...</string> | 181 | <string>...</string> |
182 | </property> | 182 | </property> |
183 | <property stdset="1"> | 183 | <property stdset="1"> |
184 | <name>toggleButton</name> | 184 | <name>toggleButton</name> |
185 | <bool>true</bool> | 185 | <bool>true</bool> |
186 | </property> | 186 | </property> |
187 | <property stdset="1"> | 187 | <property stdset="1"> |
188 | <name>toggleButton</name> | 188 | <name>toggleButton</name> |
189 | <bool>true</bool> | 189 | <bool>true</bool> |
190 | </property> | 190 | </property> |
191 | </widget> | 191 | </widget> |
192 | <widget> | 192 | <widget> |
193 | <class>QToolButton</class> | 193 | <class>QToolButton</class> |
194 | <property stdset="1"> | 194 | <property stdset="1"> |
195 | <name>name</name> | 195 | <name>name</name> |
196 | <cstring>Enable_TB</cstring> | 196 | <cstring>Enable_TB</cstring> |
197 | </property> | 197 | </property> |
198 | <property stdset="1"> | 198 | <property stdset="1"> |
199 | <name>sizePolicy</name> | 199 | <name>sizePolicy</name> |
200 | <sizepolicy> | 200 | <sizepolicy> |
201 | <hsizetype>0</hsizetype> | 201 | <hsizetype>0</hsizetype> |
202 | <vsizetype>0</vsizetype> | 202 | <vsizetype>0</vsizetype> |
203 | </sizepolicy> | 203 | </sizepolicy> |
204 | </property> | 204 | </property> |
205 | <property stdset="1"> | 205 | <property stdset="1"> |
206 | <name>text</name> | 206 | <name>text</name> |
207 | <string>...</string> | 207 | <string>...</string> |
208 | </property> | 208 | </property> |
209 | <property stdset="1"> | 209 | <property stdset="1"> |
210 | <name>toggleButton</name> | 210 | <name>toggleButton</name> |
211 | <bool>true</bool> | 211 | <bool>true</bool> |
212 | </property> | 212 | </property> |
213 | <property stdset="1"> | 213 | <property stdset="1"> |
214 | <name>toggleButton</name> | 214 | <name>toggleButton</name> |
215 | <bool>true</bool> | 215 | <bool>true</bool> |
216 | </property> | 216 | </property> |
217 | </widget> | 217 | </widget> |
218 | <widget> | 218 | <widget> |
219 | <class>QToolButton</class> | 219 | <class>QToolButton</class> |
220 | <property stdset="1"> | 220 | <property stdset="1"> |
221 | <name>name</name> | 221 | <name>name</name> |
222 | <cstring>Connect_TB</cstring> | 222 | <cstring>Connect_TB</cstring> |
223 | </property> | 223 | </property> |
224 | <property stdset="1"> | 224 | <property stdset="1"> |
225 | <name>sizePolicy</name> | 225 | <name>sizePolicy</name> |
226 | <sizepolicy> | 226 | <sizepolicy> |
227 | <hsizetype>0</hsizetype> | 227 | <hsizetype>0</hsizetype> |
228 | <vsizetype>0</vsizetype> | 228 | <vsizetype>0</vsizetype> |
229 | </sizepolicy> | 229 | </sizepolicy> |
230 | </property> | 230 | </property> |
231 | <property stdset="1"> | 231 | <property stdset="1"> |
232 | <name>text</name> | 232 | <name>text</name> |
233 | <string>...</string> | 233 | <string>...</string> |
234 | </property> | 234 | </property> |
235 | <property stdset="1"> | 235 | <property stdset="1"> |
236 | <name>toggleButton</name> | 236 | <name>toggleButton</name> |
237 | <bool>true</bool> | 237 | <bool>true</bool> |
238 | </property> | 238 | </property> |
239 | <property stdset="1"> | 239 | <property stdset="1"> |
240 | <name>toggleButton</name> | 240 | <name>toggleButton</name> |
241 | <bool>true</bool> | 241 | <bool>true</bool> |
242 | </property> | 242 | </property> |
243 | </widget> | 243 | </widget> |
244 | </hbox> | 244 | </hbox> |
245 | </widget> | 245 | </widget> |
246 | <widget> | 246 | <widget> |
247 | <class>QIconView</class> | 247 | <class>QListBox</class> |
248 | <item> | ||
249 | <property> | ||
250 | <name>text</name> | ||
251 | <string>New Item</string> | ||
252 | </property> | ||
253 | <property> | ||
254 | <name>pixmap</name> | ||
255 | <pixmap>image0</pixmap> | ||
256 | </property> | ||
257 | </item> | ||
258 | <item> | ||
259 | <property> | ||
260 | <name>text</name> | ||
261 | <string>New Item</string> | ||
262 | </property> | ||
263 | <property> | ||
264 | <name>pixmap</name> | ||
265 | <pixmap>image0</pixmap> | ||
266 | </property> | ||
267 | </item> | ||
268 | <item> | ||
269 | <property> | ||
270 | <name>text</name> | ||
271 | <string>New Item</string> | ||
272 | </property> | ||
273 | <property> | ||
274 | <name>pixmap</name> | ||
275 | <pixmap>image0</pixmap> | ||
276 | </property> | ||
277 | </item> | ||
278 | <item> | ||
279 | <property> | ||
280 | <name>text</name> | ||
281 | <string>New Item</string> | ||
282 | </property> | ||
283 | <property> | ||
284 | <name>pixmap</name> | ||
285 | <pixmap>image0</pixmap> | ||
286 | </property> | ||
287 | </item> | ||
288 | <item> | ||
289 | <property> | ||
290 | <name>text</name> | ||
291 | <string>New Item</string> | ||
292 | </property> | ||
293 | <property> | ||
294 | <name>pixmap</name> | ||
295 | <pixmap>image0</pixmap> | ||
296 | </property> | ||
297 | </item> | ||
298 | <item> | ||
299 | <property> | ||
300 | <name>text</name> | ||
301 | <string>New Item</string> | ||
302 | </property> | ||
303 | <property> | ||
304 | <name>pixmap</name> | ||
305 | <pixmap>image0</pixmap> | ||
306 | </property> | ||
307 | </item> | ||
308 | <item> | ||
309 | <property> | ||
310 | <name>text</name> | ||
311 | <string>New Item</string> | ||
312 | </property> | ||
313 | <property> | ||
314 | <name>pixmap</name> | ||
315 | <pixmap>image0</pixmap> | ||
316 | </property> | ||
317 | </item> | ||
318 | <item> | ||
319 | <property> | ||
320 | <name>text</name> | ||
321 | <string>New Item</string> | ||
322 | </property> | ||
323 | <property> | ||
324 | <name>pixmap</name> | ||
325 | <pixmap>image0</pixmap> | ||
326 | </property> | ||
327 | </item> | ||
328 | <item> | ||
329 | <property> | ||
330 | <name>text</name> | ||
331 | <string>New Item</string> | ||
332 | </property> | ||
333 | <property> | ||
334 | <name>pixmap</name> | ||
335 | <pixmap>image0</pixmap> | ||
336 | </property> | ||
337 | </item> | ||
338 | <item> | ||
339 | <property> | ||
340 | <name>text</name> | ||
341 | <string>New Item</string> | ||
342 | </property> | ||
343 | <property> | ||
344 | <name>pixmap</name> | ||
345 | <pixmap>image0</pixmap> | ||
346 | </property> | ||
347 | </item> | ||
348 | <item> | ||
349 | <property> | ||
350 | <name>text</name> | ||
351 | <string>New Item</string> | ||
352 | </property> | ||
353 | <property> | ||
354 | <name>pixmap</name> | ||
355 | <pixmap>image0</pixmap> | ||
356 | </property> | ||
357 | </item> | ||
358 | <item> | ||
359 | <property> | ||
360 | <name>text</name> | ||
361 | <string>New Item</string> | ||
362 | </property> | ||
363 | <property> | ||
364 | <name>pixmap</name> | ||
365 | <pixmap>image0</pixmap> | ||
366 | </property> | ||
367 | </item> | ||
368 | <item> | ||
369 | <property> | ||
370 | <name>text</name> | ||
371 | <string>New Item</string> | ||
372 | </property> | ||
373 | <property> | ||
374 | <name>pixmap</name> | ||
375 | <pixmap>image0</pixmap> | ||
376 | </property> | ||
377 | </item> | ||
378 | <property stdset="1"> | 248 | <property stdset="1"> |
379 | <name>name</name> | 249 | <name>name</name> |
380 | <cstring>Profiles_IV</cstring> | 250 | <cstring>Profiles_LB</cstring> |
381 | </property> | ||
382 | <property stdset="1"> | ||
383 | <name>spacing</name> | ||
384 | <number>5</number> | ||
385 | </property> | ||
386 | <property stdset="1"> | ||
387 | <name>itemsMovable</name> | ||
388 | <bool>false</bool> | ||
389 | </property> | ||
390 | <property stdset="1"> | ||
391 | <name>showToolTips</name> | ||
392 | <bool>false</bool> | ||
393 | </property> | 251 | </property> |
394 | </widget> | 252 | </widget> |
395 | <widget> | 253 | <widget> |
396 | <class>QGroupBox</class> | 254 | <class>QGroupBox</class> |
397 | <property stdset="1"> | 255 | <property stdset="1"> |
398 | <name>name</name> | 256 | <name>name</name> |
399 | <cstring>CurProfile_GB</cstring> | 257 | <cstring>CurProfile_GB</cstring> |
400 | </property> | 258 | </property> |
401 | <property stdset="1"> | 259 | <property stdset="1"> |
260 | <name>sizePolicy</name> | ||
261 | <sizepolicy> | ||
262 | <hsizetype>5</hsizetype> | ||
263 | <vsizetype>1</vsizetype> | ||
264 | </sizepolicy> | ||
265 | </property> | ||
266 | <property stdset="1"> | ||
402 | <name>title</name> | 267 | <name>title</name> |
403 | <string></string> | 268 | <string></string> |
404 | </property> | 269 | </property> |
405 | <property> | 270 | <property> |
406 | <name>layoutMargin</name> | 271 | <name>layoutMargin</name> |
407 | </property> | 272 | </property> |
408 | <property> | 273 | <property> |
409 | <name>layoutSpacing</name> | 274 | <name>layoutSpacing</name> |
410 | </property> | 275 | </property> |
411 | <vbox> | 276 | <vbox> |
412 | <property stdset="1"> | 277 | <property stdset="1"> |
413 | <name>margin</name> | 278 | <name>margin</name> |
414 | <number>4</number> | 279 | <number>4</number> |
415 | </property> | 280 | </property> |
416 | <property stdset="1"> | 281 | <property stdset="1"> |
417 | <name>spacing</name> | 282 | <name>spacing</name> |
418 | <number>1</number> | 283 | <number>1</number> |
419 | </property> | 284 | </property> |
420 | <widget> | 285 | <widget> |
421 | <class>QLayoutWidget</class> | 286 | <class>QLayoutWidget</class> |
422 | <property stdset="1"> | 287 | <property stdset="1"> |
423 | <name>name</name> | 288 | <name>name</name> |
424 | <cstring>Layout3</cstring> | 289 | <cstring>Layout3</cstring> |
425 | </property> | 290 | </property> |
426 | <hbox> | 291 | <hbox> |
427 | <property stdset="1"> | 292 | <property stdset="1"> |
428 | <name>margin</name> | 293 | <name>margin</name> |
429 | <number>0</number> | 294 | <number>0</number> |
430 | </property> | 295 | </property> |
431 | <property stdset="1"> | 296 | <property stdset="1"> |
432 | <name>spacing</name> | 297 | <name>spacing</name> |
433 | <number>6</number> | 298 | <number>6</number> |
434 | </property> | 299 | </property> |
435 | <widget> | 300 | <widget> |
436 | <class>QLabel</class> | 301 | <class>QLabel</class> |
437 | <property stdset="1"> | 302 | <property stdset="1"> |
438 | <name>name</name> | 303 | <name>name</name> |
439 | <cstring>TextLabel2</cstring> | 304 | <cstring>TextLabel2</cstring> |
440 | </property> | 305 | </property> |
441 | <property stdset="1"> | 306 | <property stdset="1"> |
442 | <name>text</name> | 307 | <name>text</name> |
443 | <string>State</string> | 308 | <string>State</string> |
444 | </property> | 309 | </property> |
445 | </widget> | 310 | </widget> |
446 | <widget> | 311 | <widget> |
447 | <class>QLabel</class> | 312 | <class>QLabel</class> |
448 | <property stdset="1"> | 313 | <property stdset="1"> |
449 | <name>name</name> | 314 | <name>name</name> |
450 | <cstring>State_LBL</cstring> | 315 | <cstring>State_LBL</cstring> |
451 | </property> | 316 | </property> |
452 | <property stdset="1"> | 317 | <property stdset="1"> |
453 | <name>text</name> | 318 | <name>text</name> |
454 | <string>State</string> | 319 | <string>State</string> |
455 | </property> | 320 | </property> |
456 | <property stdset="1"> | 321 | <property stdset="1"> |
457 | <name>indent</name> | 322 | <name>indent</name> |
458 | <number>0</number> | 323 | <number>0</number> |
459 | </property> | 324 | </property> |
460 | </widget> | 325 | </widget> |
461 | <spacer> | 326 | <spacer> |
462 | <property> | 327 | <property> |
463 | <name>name</name> | 328 | <name>name</name> |
464 | <cstring>Spacer6</cstring> | 329 | <cstring>Spacer6</cstring> |
465 | </property> | 330 | </property> |
466 | <property stdset="1"> | 331 | <property stdset="1"> |
467 | <name>orientation</name> | 332 | <name>orientation</name> |
468 | <enum>Horizontal</enum> | 333 | <enum>Horizontal</enum> |
469 | </property> | 334 | </property> |
470 | <property stdset="1"> | 335 | <property stdset="1"> |
471 | <name>sizeType</name> | 336 | <name>sizeType</name> |
472 | <enum>Expanding</enum> | 337 | <enum>Expanding</enum> |
473 | </property> | 338 | </property> |
474 | <property> | 339 | <property> |
475 | <name>sizeHint</name> | 340 | <name>sizeHint</name> |
476 | <size> | 341 | <size> |
477 | <width>20</width> | 342 | <width>20</width> |
478 | <height>20</height> | 343 | <height>20</height> |
479 | </size> | 344 | </size> |
480 | </property> | 345 | </property> |
481 | </spacer> | 346 | </spacer> |
482 | </hbox> | 347 | </hbox> |
483 | </widget> | 348 | </widget> |
484 | <widget> | 349 | <widget> |
485 | <class>QLabel</class> | 350 | <class>QLabel</class> |
486 | <property stdset="1"> | 351 | <property stdset="1"> |
487 | <name>name</name> | 352 | <name>name</name> |
488 | <cstring>Description_LBL</cstring> | 353 | <cstring>Description_LBL</cstring> |
489 | </property> | 354 | </property> |
490 | <property stdset="1"> | 355 | <property stdset="1"> |
491 | <name>sizePolicy</name> | 356 | <name>sizePolicy</name> |
492 | <sizepolicy> | 357 | <sizepolicy> |
493 | <hsizetype>5</hsizetype> | 358 | <hsizetype>5</hsizetype> |
494 | <vsizetype>7</vsizetype> | 359 | <vsizetype>7</vsizetype> |
495 | </sizepolicy> | 360 | </sizepolicy> |
496 | </property> | 361 | </property> |
497 | <property stdset="1"> | 362 | <property stdset="1"> |
498 | <name>frameShape</name> | 363 | <name>frameShape</name> |
499 | <enum>NoFrame</enum> | 364 | <enum>NoFrame</enum> |
500 | </property> | 365 | </property> |
501 | <property stdset="1"> | 366 | <property stdset="1"> |
502 | <name>frameShadow</name> | 367 | <name>frameShadow</name> |
503 | <enum>Raised</enum> | 368 | <enum>Raised</enum> |
504 | </property> | 369 | </property> |
505 | <property stdset="1"> | 370 | <property stdset="1"> |
506 | <name>text</name> | 371 | <name>text</name> |
507 | <string></string> | 372 | <string></string> |
508 | </property> | 373 | </property> |
509 | <property stdset="1"> | 374 | <property stdset="1"> |
510 | <name>alignment</name> | 375 | <name>alignment</name> |
511 | <set>AlignTop|AlignLeft</set> | 376 | <set>AlignTop|AlignLeft</set> |
512 | </property> | 377 | </property> |
513 | <property> | 378 | <property> |
514 | <name>vAlign</name> | 379 | <name>vAlign</name> |
515 | </property> | 380 | </property> |
516 | </widget> | 381 | </widget> |
517 | </vbox> | 382 | </vbox> |
518 | </widget> | 383 | </widget> |
519 | </vbox> | 384 | </vbox> |
520 | </widget> | 385 | </widget> |
521 | <images> | ||
522 | <image> | ||
523 | <name>image0</name> | ||
524 | <data format="XPM.GZ" length="1347">789c7dd3c14ac4301405d07dbf22f4ed8a743ace0882f8098a4b415ca4c92475310a3a2e44fc777393a64df2dabed7452e1c6eb368778d787e7a10cdaefabac8cb9b126a909fa2d1dfe7f3cfcbebfd6f551fae857bf69dd8d75755dd0a251e3fde4f38933b53e707b10f518df18478e8b08803e271c21af1e6168b681165e7f688681055874594211a13a242347efc95da9688dad58946ca75e58d6be9e5ba0a46e92d351a952aa2d3b2495459989849f949546632b5688c32c65aeadde428ed0132da23306e4c5863f1ba017042738f6fc138a5fdbd0a135b2203ec7bca7b723022e23d19628601cb0d6f59e8612dce0c2b2641658fb5650b375a0795a2c2b8afcaaba4859ba852c4cda4364da9964daed64caa60c2475d9a590503c54d54d1d0a2096abb67541bf79955fc0debbfbbea1f81b84f0e</data> | ||
525 | </image> | ||
526 | </images> | ||
527 | <connections> | 386 | <connections> |
528 | <connection> | 387 | <connection> |
529 | <sender>Add_TB</sender> | 388 | <sender>Add_TB</sender> |
530 | <signal>clicked()</signal> | 389 | <signal>clicked()</signal> |
531 | <receiver>NetworkSettingsGUI</receiver> | 390 | <receiver>NetworkSettingsGUI</receiver> |
532 | <slot>SLOT_AddNode()</slot> | 391 | <slot>SLOT_AddNode()</slot> |
533 | </connection> | 392 | </connection> |
534 | <connection> | 393 | <connection> |
535 | <sender>Delete_TB</sender> | 394 | <sender>Delete_TB</sender> |
536 | <signal>clicked()</signal> | 395 | <signal>clicked()</signal> |
537 | <receiver>NetworkSettingsGUI</receiver> | 396 | <receiver>NetworkSettingsGUI</receiver> |
538 | <slot>SLOT_DeleteNode()</slot> | 397 | <slot>SLOT_DeleteNode()</slot> |
539 | </connection> | 398 | </connection> |
540 | <connection> | 399 | <connection> |
541 | <sender>CheckState_TB</sender> | 400 | <sender>CheckState_TB</sender> |
542 | <signal>clicked()</signal> | 401 | <signal>clicked()</signal> |
543 | <receiver>NetworkSettingsGUI</receiver> | 402 | <receiver>NetworkSettingsGUI</receiver> |
544 | <slot>SLOT_CheckState()</slot> | 403 | <slot>SLOT_CheckState()</slot> |
545 | </connection> | 404 | </connection> |
546 | <connection> | 405 | <connection> |
547 | <sender>Enable_TB</sender> | 406 | <sender>Enable_TB</sender> |
548 | <signal>clicked()</signal> | 407 | <signal>clicked()</signal> |
549 | <receiver>NetworkSettingsGUI</receiver> | 408 | <receiver>NetworkSettingsGUI</receiver> |
550 | <slot>SLOT_Enable()</slot> | 409 | <slot>SLOT_Enable()</slot> |
551 | </connection> | 410 | </connection> |
552 | <connection> | 411 | <connection> |
553 | <sender>Connect_TB</sender> | 412 | <sender>Connect_TB</sender> |
554 | <signal>clicked()</signal> | 413 | <signal>clicked()</signal> |
555 | <receiver>NetworkSettingsGUI</receiver> | 414 | <receiver>NetworkSettingsGUI</receiver> |
556 | <slot>SLOT_Connect()</slot> | 415 | <slot>SLOT_Connect()</slot> |
557 | </connection> | 416 | </connection> |
558 | <connection> | 417 | <connection> |
559 | <sender>On_TB</sender> | 418 | <sender>On_TB</sender> |
560 | <signal>clicked()</signal> | 419 | <signal>clicked()</signal> |
561 | <receiver>NetworkSettingsGUI</receiver> | 420 | <receiver>NetworkSettingsGUI</receiver> |
562 | <slot>SLOT_On()</slot> | 421 | <slot>SLOT_On()</slot> |
563 | </connection> | 422 | </connection> |
564 | <connection> | 423 | <connection> |
565 | <sender>GenConfig_TB</sender> | 424 | <sender>GenConfig_TB</sender> |
566 | <signal>clicked()</signal> | 425 | <signal>clicked()</signal> |
567 | <receiver>NetworkSettingsGUI</receiver> | 426 | <receiver>NetworkSettingsGUI</receiver> |
568 | <slot>SLOT_GenerateConfig()</slot> | 427 | <slot>SLOT_GenerateConfig()</slot> |
569 | </connection> | 428 | </connection> |
570 | <connection> | 429 | <connection> |
571 | <sender>Profiles_IV</sender> | 430 | <sender>Profiles_LB</sender> |
572 | <signal>selectionChanged(QIconViewItem*)</signal> | 431 | <signal>clicked(QListBoxItem*)</signal> |
573 | <receiver>NetworkSettingsGUI</receiver> | 432 | <receiver>NetworkSettingsGUI</receiver> |
574 | <slot>SLOT_ShowNode( QIconViewItem*)</slot> | 433 | <slot>SLOT_ShowNode( QListBoxItem*)</slot> |
575 | </connection> | 434 | </connection> |
576 | <connection> | 435 | <connection> |
577 | <sender>Profiles_IV</sender> | 436 | <sender>Profiles_LB</sender> |
578 | <signal>doubleClicked(QIconViewItem*)</signal> | 437 | <signal>currentChanged(QListBoxItem*)</signal> |
579 | <receiver>NetworkSettingsGUI</receiver> | 438 | <receiver>NetworkSettingsGUI</receiver> |
580 | <slot>SLOT_EditNode( QIconViewItem*)</slot> | 439 | <slot>SLOT_ShowNode( QListBoxItem*)</slot> |
581 | </connection> | 440 | </connection> |
582 | <connection> | 441 | <connection> |
583 | <sender>Profiles_IV</sender> | 442 | <sender>Profiles_LB</sender> |
584 | <signal>currentChanged(QIconViewItem*)</signal> | 443 | <signal>doubleClicked(QListBoxItem*)</signal> |
585 | <receiver>NetworkSettingsGUI</receiver> | 444 | <receiver>NetworkSettingsGUI</receiver> |
586 | <slot>SLOT_ShowNode( QIconViewItem*)</slot> | 445 | <slot>SLOT_EditNode( QListBoxItem *)</slot> |
587 | </connection> | 446 | </connection> |
588 | <slot access="public">SLOT_AddNode()</slot> | 447 | <slot access="public">SLOT_AddNode()</slot> |
589 | <slot access="public">SLOT_CheckState()</slot> | 448 | <slot access="public">SLOT_CheckState()</slot> |
590 | <slot access="public">SLOT_Connect()</slot> | 449 | <slot access="public">SLOT_Connect()</slot> |
591 | <slot access="public">SLOT_DeleteNode()</slot> | 450 | <slot access="public">SLOT_DeleteNode()</slot> |
592 | <slot access="public">SLOT_EditNode( QIconViewItem*)</slot> | 451 | <slot access="public">SLOT_EditNode( QListBoxItem *)</slot> |
593 | <slot access="public">SLOT_Enable()</slot> | 452 | <slot access="public">SLOT_Enable()</slot> |
594 | <slot access="public">SLOT_GenerateConfig()</slot> | 453 | <slot access="public">SLOT_GenerateConfig()</slot> |
595 | <slot access="public">SLOT_On()</slot> | 454 | <slot access="public">SLOT_On()</slot> |
596 | <slot access="public">SLOT_ShowNode( QIconViewItem*)</slot> | 455 | <slot access="public">SLOT_ShowNode( QListBoxItem*)</slot> |
597 | </connections> | 456 | </connections> |
598 | </UI> | 457 | </UI> |
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index 9b2ad3a..3f5e958 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -1,405 +1,406 @@ | |||
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", getenv("HOME") ); | 18 | CfgFile.sprintf( "%s/NETCONFIG", getenv("HOME") ); |
19 | 19 | ||
20 | // load settings | 20 | // load settings |
21 | Force = 0; | 21 | Force = 0; |
22 | IsModified = 0; | ||
22 | loadSettings(); | 23 | loadSettings(); |
23 | } | 24 | } |
24 | 25 | ||
25 | // saving is done by caller | 26 | // saving is done by caller |
26 | NetworkSettingsData::~NetworkSettingsData( void ) { | 27 | NetworkSettingsData::~NetworkSettingsData( void ) { |
27 | delete NSResources; | 28 | delete NSResources; |
28 | } | 29 | } |
29 | 30 | ||
30 | void NetworkSettingsData::loadSettings( void ) { | 31 | void NetworkSettingsData::loadSettings( void ) { |
31 | QString S; | 32 | QString S; |
32 | ANetNodeInstance* NNI; | 33 | ANetNodeInstance* NNI; |
33 | QString Attr, Value; | 34 | QString Attr, Value; |
34 | long idx; | 35 | long idx; |
35 | 36 | ||
36 | QFile F( CfgFile ); | 37 | QFile F( CfgFile ); |
37 | QTextStream TS( &F ); | 38 | QTextStream TS( &F ); |
38 | 39 | ||
39 | do { | 40 | do { |
40 | 41 | ||
41 | if( ! F.open(IO_ReadOnly) ) | 42 | if( ! F.open(IO_ReadOnly) ) |
42 | break; | 43 | break; |
43 | 44 | ||
44 | /* load the file -> | 45 | /* load the file -> |
45 | 46 | ||
46 | FORMAT : | 47 | FORMAT : |
47 | 48 | ||
48 | [NETNODETYPE] | 49 | [NETNODETYPE] |
49 | Entries ... | 50 | Entries ... |
50 | <EMPTYLINE> | 51 | <EMPTYLINE> |
51 | [connection] | 52 | [connection] |
52 | Name=Name | 53 | Name=Name |
53 | Node=Name | 54 | Node=Name |
54 | <EMPTYLINE> | 55 | <EMPTYLINE> |
55 | */ | 56 | */ |
56 | while( ! TS.atEnd() ) { | 57 | while( ! TS.atEnd() ) { |
57 | S = TS.readLine(); | 58 | S = TS.readLine(); |
58 | 59 | ||
59 | if ( S.isEmpty() || S[0] != '[' ) | 60 | if ( S.isEmpty() || S[0] != '[' ) |
60 | continue; | 61 | continue; |
61 | 62 | ||
62 | S = S.mid( 1, S.length()-2 ); | 63 | S = S.mid( 1, S.length()-2 ); |
63 | 64 | ||
64 | if( ! NSResources ) { | 65 | if( ! NSResources ) { |
65 | continue; | 66 | continue; |
66 | } | 67 | } |
67 | 68 | ||
68 | if( S == "connection" ) { | 69 | if( S == "connection" ) { |
69 | // load connections -> collections of nodes | 70 | // load connections -> collections of nodes |
70 | NodeCollection * NC = new NodeCollection( TS ); | 71 | NodeCollection * NC = new NodeCollection( TS ); |
71 | NSResources->addConnection( NC ); | 72 | NSResources->addConnection( NC ); |
72 | } else { | 73 | } else { |
73 | // load nodes | 74 | // load nodes |
74 | NNI = NSResources->createNodeInstance( S ); | 75 | NNI = NSResources->createNodeInstance( S ); |
75 | if( ! NNI ) { | 76 | if( ! NNI ) { |
76 | printf( "SKIPPING %s\n", S.latin1() ); | 77 | printf( "SKIPPING %s\n", S.latin1() ); |
77 | } | 78 | } |
78 | 79 | ||
79 | do { | 80 | do { |
80 | S = TS.readLine(); | 81 | S = TS.readLine(); |
81 | if( S.isEmpty() ) { | 82 | if( S.isEmpty() ) { |
82 | // empty line | 83 | // empty line |
83 | break; | 84 | break; |
84 | } | 85 | } |
85 | // node found ? | 86 | // node found ? |
86 | if( NNI ) { | 87 | if( NNI ) { |
87 | idx = S.find( '=' ); | 88 | idx = S.find( '=' ); |
88 | if( idx > 0 ) { | 89 | if( idx > 0 ) { |
89 | Attr = S.left( idx ); | 90 | Attr = S.left( idx ); |
90 | Value = S.mid( idx+1, S.length() ); | 91 | Value = S.mid( idx+1, S.length() ); |
91 | } else { | 92 | } else { |
92 | Value=""; | 93 | Value=""; |
93 | Attr = S; | 94 | Attr = S; |
94 | } | 95 | } |
95 | 96 | ||
96 | Value.stripWhiteSpace(); | 97 | Value.stripWhiteSpace(); |
97 | Attr.stripWhiteSpace(); | 98 | Attr.stripWhiteSpace(); |
98 | Attr.lower(); | 99 | Attr.lower(); |
99 | // dequote Attr | 100 | // dequote Attr |
100 | Value = deQuote(Value); | 101 | Value = deQuote(Value); |
101 | 102 | ||
102 | // set the attribute | 103 | // set the attribute |
103 | NNI->setAttribute( Attr, Value ); | 104 | NNI->setAttribute( Attr, Value ); |
104 | } | 105 | } |
105 | 106 | ||
106 | } while( 1 ); | 107 | } while( 1 ); |
107 | if( NNI ) { | 108 | if( NNI ) { |
108 | // loading from file -> exists | 109 | // loading from file -> exists |
109 | NNI->setNew( FALSE ); | 110 | NNI->setNew( FALSE ); |
110 | NSResources->addNodeInstance( NNI ); | 111 | NSResources->addNodeInstance( NNI ); |
111 | } | 112 | } |
112 | } | 113 | } |
113 | } | 114 | } |
114 | 115 | ||
115 | } while( 0 ); | 116 | } while( 0 ); |
116 | 117 | ||
117 | } | 118 | } |
118 | 119 | ||
119 | QString NetworkSettingsData::saveSettings( void ) { | 120 | QString NetworkSettingsData::saveSettings( void ) { |
120 | QString ErrS = ""; | 121 | QString ErrS = ""; |
121 | 122 | ||
122 | if( ! isModified() ) | 123 | if( ! isModified() ) |
123 | return ErrS; | 124 | return ErrS; |
124 | 125 | ||
125 | QString S; | 126 | QString S; |
126 | QFile F( CfgFile + ".bup" ); | 127 | QFile F( CfgFile + ".bup" ); |
127 | 128 | ||
128 | printf( "Saving settings to %s\n", CfgFile.latin1() ); | 129 | printf( "Saving settings to %s\n", CfgFile.latin1() ); |
129 | if( ! F.open( IO_WriteOnly | IO_Truncate ) ) { | 130 | if( ! F.open( IO_WriteOnly | IO_Truncate ) ) { |
130 | ErrS = qApp->translate( "NetworkSettings", | 131 | ErrS = qApp->translate( "NetworkSettings", |
131 | "<p>Could not save setup to %1 !</p>" ). | 132 | "<p>Could not save setup to %1 !</p>" ). |
132 | arg(CfgFile); | 133 | arg(CfgFile); |
133 | // problem | 134 | // problem |
134 | return ErrS; | 135 | return ErrS; |
135 | } | 136 | } |
136 | 137 | ||
137 | QTextStream TS( &F ); | 138 | QTextStream TS( &F ); |
138 | { Name2Connection_t & M = NSResources->connections(); | 139 | { Name2Connection_t & M = NSResources->connections(); |
139 | ANetNodeInstance * NNI; | 140 | ANetNodeInstance * NNI; |
140 | 141 | ||
141 | // for all connections | 142 | // for all connections |
142 | for( QDictIterator<NodeCollection> it(M); | 143 | for( QDictIterator<NodeCollection> it(M); |
143 | it.current(); | 144 | it.current(); |
144 | ++it ) { | 145 | ++it ) { |
145 | // all nodes in those connections | 146 | // all nodes in those connections |
146 | for( QListIterator<ANetNodeInstance> nit(*(it.current())); | 147 | for( QListIterator<ANetNodeInstance> nit(*(it.current())); |
147 | nit.current(); | 148 | nit.current(); |
148 | ++nit ) { | 149 | ++nit ) { |
149 | // header | 150 | // header |
150 | NNI = nit.current(); | 151 | NNI = nit.current(); |
151 | TS << '[' <<NNI->netNode()->nodeName() << ']' << endl; | 152 | TS << '[' <<NNI->netNode()->nodeName() << ']' << endl; |
152 | NNI->saveAttributes( TS ); | 153 | NNI->saveAttributes( TS ); |
153 | TS << endl; | 154 | TS << endl; |
154 | } | 155 | } |
155 | 156 | ||
156 | TS << "[connection]" << endl; | 157 | TS << "[connection]" << endl; |
157 | it.current()->save(TS); | 158 | it.current()->save(TS); |
158 | } | 159 | } |
159 | } | 160 | } |
160 | 161 | ||
161 | QDir D("."); | 162 | QDir D("."); |
162 | D.rename( CfgFile + ".bup", CfgFile ); | 163 | D.rename( CfgFile + ".bup", CfgFile ); |
163 | 164 | ||
164 | // | 165 | // |
165 | // proper files AND system files regenerated | 166 | // proper files AND system files regenerated |
166 | // | 167 | // |
167 | 168 | ||
168 | setModified( 0 ); | 169 | setModified( 0 ); |
169 | return ErrS; | 170 | return ErrS; |
170 | } | 171 | } |
171 | 172 | ||
172 | QString NetworkSettingsData::generateSettings( bool ForceReq ) { | 173 | QString NetworkSettingsData::generateSettings( bool ForceReq ) { |
173 | bool ForceIt; | 174 | bool ForceIt; |
174 | QString S = ""; | 175 | QString S = ""; |
175 | 176 | ||
176 | // include own force flag | 177 | // include own force flag |
177 | ForceIt = (Force) ? 1 : ForceReq; | 178 | ForceIt = (Force) ? 1 : ForceReq; |
178 | 179 | ||
179 | if( ! ForceIt && ! isModified() ) | 180 | if( ! ForceIt && ! isModified() ) |
180 | return S; | 181 | return S; |
181 | 182 | ||
182 | // regenerate system files | 183 | // regenerate system files |
183 | printf( "Generating settings from %s\n", CfgFile.latin1() ); | 184 | printf( "Generating settings from %s\n", CfgFile.latin1() ); |
184 | 185 | ||
185 | { Name2SystemFile_t & SFM = NSResources->systemFiles(); | 186 | { Name2SystemFile_t & SFM = NSResources->systemFiles(); |
186 | Name2Connection_t & M = NSResources->connections(); | 187 | Name2Connection_t & M = NSResources->connections(); |
187 | NodeCollection * NC; | 188 | NodeCollection * NC; |
188 | ANetNodeInstance * NNI; | 189 | ANetNodeInstance * NNI; |
189 | SystemFile * SF; | 190 | SystemFile * SF; |
190 | bool needToRegenerate = ForceIt; | 191 | bool needToRegenerate = ForceIt; |
191 | 192 | ||
192 | // | 193 | // |
193 | // check if we need to generate at least one of the system files | 194 | // check if we need to generate at least one of the system files |
194 | // | 195 | // |
195 | if( ! ForceIt ) { | 196 | if( ! ForceIt ) { |
196 | for( QDictIterator<SystemFile> sfit(SFM); | 197 | for( QDictIterator<SystemFile> sfit(SFM); |
197 | sfit.current(); | 198 | sfit.current(); |
198 | ++sfit ) { | 199 | ++sfit ) { |
199 | SF = sfit.current(); | 200 | SF = sfit.current(); |
200 | 201 | ||
201 | // check if there are nodes that are modified and require | 202 | // check if there are nodes that are modified and require |
202 | // data for this system file | 203 | // data for this system file |
203 | 204 | ||
204 | // for all connections | 205 | // for all connections |
205 | for( QDictIterator<NodeCollection> ncit(M); | 206 | for( QDictIterator<NodeCollection> ncit(M); |
206 | ncit.current(); | 207 | ncit.current(); |
207 | ++ncit ) { | 208 | ++ncit ) { |
208 | NC = ncit.current(); | 209 | NC = ncit.current(); |
209 | 210 | ||
210 | if( NC->isModified() ) { | 211 | if( NC->isModified() ) { |
211 | // does this connection 'touch' this system file ? | 212 | // does this connection 'touch' this system file ? |
212 | for( QListIterator<ANetNodeInstance> cncit(*NC); | 213 | for( QListIterator<ANetNodeInstance> cncit(*NC); |
213 | cncit.current(); | 214 | cncit.current(); |
214 | ++cncit ) { | 215 | ++cncit ) { |
215 | NNI = cncit.current(); | 216 | NNI = cncit.current(); |
216 | if( NNI->netNode()->hasDataFor( SF->name() ) && | 217 | if( NNI->netNode()->hasDataFor( SF->name() ) && |
217 | NNI->isModified() ) { | 218 | NNI->isModified() ) { |
218 | needToRegenerate = 1; | 219 | needToRegenerate = 1; |
219 | break; | 220 | break; |
220 | } | 221 | } |
221 | } | 222 | } |
222 | } | 223 | } |
223 | if( needToRegenerate ) | 224 | if( needToRegenerate ) |
224 | break; | 225 | break; |
225 | } | 226 | } |
226 | if( needToRegenerate ) | 227 | if( needToRegenerate ) |
227 | break; | 228 | break; |
228 | } | 229 | } |
229 | } | 230 | } |
230 | 231 | ||
231 | // we cannot renumber with a FORCE request since | 232 | // we cannot renumber with a FORCE request since |
232 | // we probably are NOT going to save the config | 233 | // we probably are NOT going to save the config |
233 | // e.g. when using --regen option | 234 | // e.g. when using --regen option |
234 | if( ! ForceReq && needToRegenerate ) { | 235 | if( ! ForceReq && needToRegenerate ) { |
235 | NSResources->renumberConnections(); | 236 | NSResources->renumberConnections(); |
236 | setModified(1); | 237 | setModified(1); |
237 | } | 238 | } |
238 | 239 | ||
239 | // | 240 | // |
240 | // generate files proper to each netnodeinstance | 241 | // generate files proper to each netnodeinstance |
241 | // | 242 | // |
242 | { Name2Instance_t & NNIs = NSResources->netNodeInstances(); | 243 | { Name2Instance_t & NNIs = NSResources->netNodeInstances(); |
243 | ANetNodeInstance * NNI; | 244 | ANetNodeInstance * NNI; |
244 | 245 | ||
245 | for( QDictIterator<ANetNodeInstance> NNIIt(NNIs); | 246 | for( QDictIterator<ANetNodeInstance> NNIIt(NNIs); |
246 | NNIIt.current(); | 247 | NNIIt.current(); |
247 | ++NNIIt | 248 | ++NNIIt |
248 | ){ | 249 | ){ |
249 | // for all nodes find those that are modified | 250 | // for all nodes find those that are modified |
250 | NNI = NNIIt.current(); | 251 | NNI = NNIIt.current(); |
251 | 252 | ||
252 | if( ForceIt || NNI->isModified() ) { | 253 | if( ForceIt || NNI->isModified() ) { |
253 | if( ! NNI->netNode()->generateProperFilesFor( NNI ) ) { | 254 | if( ! NNI->netNode()->generateProperFilesFor( NNI ) ) { |
254 | // problem generating | 255 | // problem generating |
255 | S = qApp->translate( "NetworkSettings", | 256 | S = qApp->translate( "NetworkSettings", |
256 | "<p>Cannot generate files proper to %1</p>" ). | 257 | "<p>Cannot generate files proper to %1</p>" ). |
257 | arg(NNI->netNode()->nodeName()) ; | 258 | arg(NNI->netNode()->nodeName()) ; |
258 | return S; | 259 | return S; |
259 | } | 260 | } |
260 | } | 261 | } |
261 | } | 262 | } |
262 | } | 263 | } |
263 | 264 | ||
264 | // | 265 | // |
265 | // generate system files | 266 | // generate system files |
266 | // | 267 | // |
267 | for( QDictIterator<SystemFile> sfit(SFM); | 268 | for( QDictIterator<SystemFile> sfit(SFM); |
268 | sfit.current(); | 269 | sfit.current(); |
269 | ++sfit ) { | 270 | ++sfit ) { |
270 | SF = sfit.current(); | 271 | SF = sfit.current(); |
271 | 272 | ||
272 | // | 273 | // |
273 | // regenerate current file | 274 | // regenerate current file |
274 | // | 275 | // |
275 | printf( "Generating %s\n", SF->name().latin1() ); | 276 | printf( "Generating %s\n", SF->name().latin1() ); |
276 | SF->open(); | 277 | SF->open(); |
277 | 278 | ||
278 | do { // so we can break; | 279 | do { // so we can break; |
279 | 280 | ||
280 | if( SF->preSection() ) { | 281 | if( SF->preSection() ) { |
281 | S = qApp->translate( "NetworkSettings", | 282 | S = qApp->translate( "NetworkSettings", |
282 | "<p>Error in preSection for file %1</p>" ). | 283 | "<p>Error in preSection for file %1</p>" ). |
283 | arg( SF->name() ); | 284 | arg( SF->name() ); |
284 | return S; | 285 | return S; |
285 | } | 286 | } |
286 | 287 | ||
287 | for( QDictIterator<NodeCollection> ncit(M); | 288 | for( QDictIterator<NodeCollection> ncit(M); |
288 | ncit.current(); | 289 | ncit.current(); |
289 | ++ncit ) { | 290 | ++ncit ) { |
290 | NC = ncit.current(); | 291 | NC = ncit.current(); |
291 | 292 | ||
292 | // get the netnode that serves as the device for this | 293 | // get the netnode that serves as the device for this |
293 | // connection | 294 | // connection |
294 | AsDevice * Dev = NC->device(); | 295 | AsDevice * Dev = NC->device(); |
295 | 296 | ||
296 | // generate 'entry' for every possible device this profile handles | 297 | // generate 'entry' for every possible device this profile handles |
297 | 298 | ||
298 | for( QListIterator<ANetNodeInstance> cncit(*NC); | 299 | for( QListIterator<ANetNodeInstance> cncit(*NC); |
299 | cncit.current(); | 300 | cncit.current(); |
300 | ++cncit ) { | 301 | ++cncit ) { |
301 | NNI = cncit.current(); | 302 | NNI = cncit.current(); |
302 | for( int i = 0; i < Dev->count(); i ++ ) { | 303 | for( int i = 0; i < Dev->count(); i ++ ) { |
303 | if( NNI->netNode()->hasDataFor( SF->name() ) ) { | 304 | if( NNI->netNode()->hasDataFor( SF->name() ) ) { |
304 | if( SF->preNodeSection( NNI, i ) ) { | 305 | if( SF->preNodeSection( NNI, i ) ) { |
305 | S = qApp->translate( "NetworkSettings", | 306 | S = qApp->translate( "NetworkSettings", |
306 | "<p>Error in preNodeSection for file %1 and node %2</p>" ). | 307 | "<p>Error in preNodeSection for file %1 and node %2</p>" ). |
307 | arg( SF->name() ). | 308 | arg( SF->name() ). |
308 | arg( NNI->netNode()->nodeName() ); | 309 | arg( NNI->netNode()->nodeName() ); |
309 | return S; | 310 | return S; |
310 | } | 311 | } |
311 | 312 | ||
312 | if( NNI->netNode()->generateDataForCommonFile(*SF,i,NNI) ) { | 313 | if( NNI->netNode()->generateDataForCommonFile(*SF,i,NNI) ) { |
313 | S = qApp->translate( "NetworkSettings", | 314 | S = qApp->translate( "NetworkSettings", |
314 | "<p>Error in node part for file %1 and node %2</p>" ). | 315 | "<p>Error in node part for file %1 and node %2</p>" ). |
315 | arg( SF->name() ). | 316 | arg( SF->name() ). |
316 | arg( NNI->netNode()->nodeName() ); | 317 | arg( NNI->netNode()->nodeName() ); |
317 | return S; | 318 | return S; |
318 | } | 319 | } |
319 | 320 | ||
320 | if( SF->postNodeSection( NNI, i ) ) { | 321 | if( SF->postNodeSection( NNI, i ) ) { |
321 | S = qApp->translate( "NetworkSettings", | 322 | S = qApp->translate( "NetworkSettings", |
322 | "<p>Error in postNodeSection for file %1 and node %2</p>" ). | 323 | "<p>Error in postNodeSection for file %1 and node %2</p>" ). |
323 | arg( SF->name() ). | 324 | arg( SF->name() ). |
324 | arg( NNI->netNode()->nodeName() ); | 325 | arg( NNI->netNode()->nodeName() ); |
325 | return S; | 326 | return S; |
326 | } | 327 | } |
327 | } | 328 | } |
328 | } | 329 | } |
329 | } | 330 | } |
330 | *SF << endl; | 331 | *SF << endl; |
331 | } | 332 | } |
332 | 333 | ||
333 | if( SF->postSection() ) { | 334 | if( SF->postSection() ) { |
334 | S = qApp->translate( "NetworkSettings", | 335 | S = qApp->translate( "NetworkSettings", |
335 | "<p>Error in postSection for file %1</p>" ). | 336 | "<p>Error in postSection for file %1</p>" ). |
336 | arg( SF->name() ); | 337 | arg( SF->name() ); |
337 | return S; | 338 | return S; |
338 | } | 339 | } |
339 | } while( 0 ); | 340 | } while( 0 ); |
340 | SF->close(); | 341 | SF->close(); |
341 | } | 342 | } |
342 | } | 343 | } |
343 | Force = 0; | 344 | Force = 0; |
344 | return S; | 345 | return S; |
345 | } | 346 | } |
346 | 347 | ||
347 | QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interface ) { | 348 | QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interface ) { |
348 | // collect connections that can work on top of this interface | 349 | // collect connections that can work on top of this interface |
349 | NodeCollection * NC; | 350 | NodeCollection * NC; |
350 | QList<NodeCollection> PossibleConnections; | 351 | QList<NodeCollection> PossibleConnections; |
351 | Name2Connection_t & M = NSResources->connections(); | 352 | Name2Connection_t & M = NSResources->connections(); |
352 | 353 | ||
353 | // for all connections | 354 | // for all connections |
354 | for( QDictIterator<NodeCollection> it(M); | 355 | for( QDictIterator<NodeCollection> it(M); |
355 | it.current(); | 356 | it.current(); |
356 | ++it ) { | 357 | ++it ) { |
357 | NC = it.current(); | 358 | NC = it.current(); |
358 | // check if this profile handles the requested interface | 359 | // check if this profile handles the requested interface |
359 | if( NC->handlesInterface( Interface ) && // if different Intf. | 360 | if( NC->handlesInterface( Interface ) && // if different Intf. |
360 | NC->state() != Disabled && // if not enabled | 361 | NC->state() != Disabled && // if not enabled |
361 | NC->state() != IsUp // if already used | 362 | NC->state() != IsUp // if already used |
362 | ) { | 363 | ) { |
363 | PossibleConnections.append( NC ); | 364 | PossibleConnections.append( NC ); |
364 | } | 365 | } |
365 | } | 366 | } |
366 | return PossibleConnections; | 367 | return PossibleConnections; |
367 | } | 368 | } |
368 | 369 | ||
369 | 370 | ||
370 | /* | 371 | /* |
371 | Called by the system to see if interface can be brought UP | 372 | Called by the system to see if interface can be brought UP |
372 | 373 | ||
373 | if allowed, echo Interface-allowed else Interface-disallowed | 374 | if allowed, echo Interface-allowed else Interface-disallowed |
374 | */ | 375 | */ |
375 | 376 | ||
376 | void NetworkSettingsData::canStart( const char * Interface ) { | 377 | void NetworkSettingsData::canStart( const char * Interface ) { |
377 | // load situation | 378 | // load situation |
378 | NodeCollection * NC = 0; | 379 | NodeCollection * NC = 0; |
379 | QList<NodeCollection> PossibleConnections; | 380 | QList<NodeCollection> PossibleConnections; |
380 | 381 | ||
381 | PossibleConnections = collectPossible( Interface ); | 382 | PossibleConnections = collectPossible( Interface ); |
382 | 383 | ||
383 | switch( PossibleConnections.count() ) { | 384 | switch( PossibleConnections.count() ) { |
384 | case 0 : // no connections | 385 | case 0 : // no connections |
385 | break; | 386 | break; |
386 | case 1 : // one connection | 387 | case 1 : // one connection |
387 | NC = PossibleConnections.first(); | 388 | NC = PossibleConnections.first(); |
388 | break; | 389 | break; |
389 | default : // need to ask user ? | 390 | default : // need to ask user ? |
390 | // are we connected to a server | 391 | // are we connected to a server |
391 | // system( "su %d networksettings2 --prompt %s\n", | 392 | // system( "su %d networksettings2 --prompt %s\n", |
392 | // "", Interface ); | 393 | // "", Interface ); |
393 | break; | 394 | break; |
394 | } | 395 | } |
395 | 396 | ||
396 | if( NC ) { | 397 | if( NC ) { |
397 | switch( NC->state() ) { | 398 | switch( NC->state() ) { |
398 | case Unchecked : | 399 | case Unchecked : |
399 | case Unknown : | 400 | case Unknown : |
400 | case Unavailable : | 401 | case Unavailable : |
401 | case Disabled : | 402 | case Disabled : |
402 | // this profile does not allow interface to be UP | 403 | // this profile does not allow interface to be UP |
403 | // -> try others | 404 | // -> try others |
404 | break; | 405 | break; |
405 | case Off : | 406 | case Off : |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.h b/noncore/settings/networksettings2/ppp/ppp_NN.h index a933523..3f9a338 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.h +++ b/noncore/settings/networksettings2/ppp/ppp_NN.h | |||
@@ -1,44 +1,44 @@ | |||
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 "ppp"; } | 18 | { return "Devices/ppp"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("PPP Connection"); } | 21 | { return tr("PPP Connection"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NNI.h b/noncore/settings/networksettings2/ppp/ppp_NNI.h index 08dca1d..a17721a 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NNI.h +++ b/noncore/settings/networksettings2/ppp/ppp_NNI.h | |||
@@ -1,43 +1,43 @@ | |||
1 | #ifndef PPP_H | 1 | #ifndef PPP_H |
2 | #define PPP_H | 2 | #define PPP_H |
3 | 3 | ||
4 | #include <netnode.h> | 4 | #include <netnode.h> |
5 | #include "pppdata.h" | 5 | #include "pppdata.h" |
6 | #include "ppprun.h" | 6 | #include "ppprun.h" |
7 | 7 | ||
8 | class PPPNetNode; | 8 | class PPPNetNode; |
9 | class PPPEdit; | 9 | class PPPEdit; |
10 | 10 | ||
11 | class APPP : public ANetNodeInstance { | 11 | class APPP : public ANetNodeInstance { |
12 | 12 | ||
13 | public : | 13 | public : |
14 | 14 | ||
15 | APPP( PPPNetNode * PNN ); | 15 | APPP( PPPNetNode * PNN ); |
16 | 16 | ||
17 | QWidget * edit( QWidget * parent ); | 17 | QWidget * edit( QWidget * parent ); |
18 | QString acceptable( void ); | 18 | QString acceptable( void ); |
19 | void commit( void ); | 19 | void commit( void ); |
20 | 20 | ||
21 | RuntimeInfo * runtime( void ) | 21 | RuntimeInfo * runtime( void ) |
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new PPPRun( this, Data ); | 23 | RT = new PPPRun( this, Data ); |
24 | return RT; | 24 | return RT->runtimeInfo(); |
25 | } | 25 | } |
26 | 26 | ||
27 | virtual void * data( void ) | 27 | virtual void * data( void ) |
28 | { return (void *)&Data; } | 28 | { return (void *)&Data; } |
29 | 29 | ||
30 | protected : | 30 | protected : |
31 | 31 | ||
32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 32 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
33 | virtual void saveSpecificAttribute( QTextStream & TS ); | 33 | virtual void saveSpecificAttribute( QTextStream & TS ); |
34 | 34 | ||
35 | private : | 35 | private : |
36 | 36 | ||
37 | PPPEdit * GUI; | 37 | PPPEdit * GUI; |
38 | PPPData Data; | 38 | PPPData Data; |
39 | PPPRun * RT; | 39 | PPPRun * RT; |
40 | 40 | ||
41 | }; | 41 | }; |
42 | 42 | ||
43 | #endif | 43 | #endif |
diff --git a/noncore/settings/networksettings2/ppp/ppprun.cpp b/noncore/settings/networksettings2/ppp/ppprun.cpp index 8933f85..4ac0c5a 100644 --- a/noncore/settings/networksettings2/ppp/ppprun.cpp +++ b/noncore/settings/networksettings2/ppp/ppprun.cpp | |||
@@ -1,77 +1,90 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | #include "ppprun.h" | 2 | #include "ppprun.h" |
3 | 3 | ||
4 | PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) : | ||
5 | AsConnection( NNI ), AsDevice( NNI ), Pat( "eth[0-9]" ) { | ||
6 | D = &Data; | ||
7 | } | ||
8 | |||
4 | void PPPRun::detectState( NodeCollection * NC ) { | 9 | void PPPRun::detectState( NodeCollection * NC ) { |
5 | if( isMyPPPDRunning( ) ) { | 10 | if( isMyPPPDRunning( ) ) { |
6 | if( isMyPPPUp() ) { | 11 | if( isMyPPPUp() ) { |
7 | NC->setCurrentState( IsUp ); | 12 | NC->setCurrentState( IsUp ); |
8 | } else { | 13 | } else { |
9 | NC->setCurrentState( Available ); | 14 | NC->setCurrentState( Available ); |
10 | } | 15 | } |
11 | } else { | 16 | } else { |
12 | NC->setCurrentState( Off ); // at least this | 17 | NC->setCurrentState( Off ); // at least this |
13 | // but could also be unavailable | 18 | // but could also be unavailable |
14 | netNode()->nextNode()->runtime()->detectState( NC ); | 19 | ANetNodeInstance * NNI; |
20 | RuntimeInfo * RI; | ||
21 | NNI = AsDevice::netNode(); | ||
22 | printf( "%p\n", NNI ); | ||
23 | NNI = NNI->nextNode(); | ||
24 | printf( "%p\n", NNI ); | ||
25 | RI = NNI->runtime(); | ||
26 | printf( "%p\n", RI ); | ||
27 | RI->detectState( NC ); | ||
15 | } | 28 | } |
16 | } | 29 | } |
17 | 30 | ||
18 | bool PPPRun::setState( NodeCollection * NC, Action_t A ) { | 31 | bool PPPRun::setState( NodeCollection * NC, Action_t A ) { |
19 | switch( A ) { | 32 | switch( A ) { |
20 | case Activate : | 33 | case Activate : |
21 | NC->setCurrentState( Available ); | 34 | NC->setCurrentState( Available ); |
22 | // no | 35 | // no |
23 | break; | 36 | break; |
24 | case Deactivate : | 37 | case Deactivate : |
25 | if( NC->currentState() == IsUp ) { | 38 | if( NC->currentState() == IsUp ) { |
26 | NC->state( Down ); | 39 | NC->state( Down ); |
27 | } | 40 | } |
28 | // cannot really disable | 41 | // cannot really disable |
29 | NC->setCurrentState( Available ); | 42 | NC->setCurrentState( Available ); |
30 | break; | 43 | break; |
31 | case Up : | 44 | case Up : |
32 | if( NC->currentState() != IsUp ) { | 45 | if( NC->currentState() != IsUp ) { |
33 | // start my PPPD | 46 | // start my PPPD |
34 | NC->setCurrentState( IsUp ); | 47 | NC->setCurrentState( IsUp ); |
35 | } | 48 | } |
36 | break; | 49 | break; |
37 | case Down : | 50 | case Down : |
38 | if( NC->currentState() == IsUp ) { | 51 | if( NC->currentState() == IsUp ) { |
39 | // stop my PPPD | 52 | // stop my PPPD |
40 | NC->setCurrentState( Available ); | 53 | NC->setCurrentState( Available ); |
41 | } | 54 | } |
42 | break; | 55 | break; |
43 | default : // FT | 56 | default : // FT |
44 | break; | 57 | break; |
45 | } | 58 | } |
46 | return 1; | 59 | return 1; |
47 | } | 60 | } |
48 | 61 | ||
49 | bool PPPRun::isMyPPPDRunning( void ) { | 62 | bool PPPRun::isMyPPPDRunning( void ) { |
50 | return 0; | 63 | return 0; |
51 | } | 64 | } |
52 | 65 | ||
53 | bool PPPRun::isMyPPPUp( void ) { | 66 | bool PPPRun::isMyPPPUp( void ) { |
54 | System & S = NSResources->system(); | 67 | System & S = NSResources->system(); |
55 | InterfaceInfo * best = 0, * Run; | 68 | InterfaceInfo * Run; |
56 | QRegExp R( "ppp[0-9]" ); | 69 | QRegExp R( "ppp[0-9]" ); |
57 | 70 | ||
58 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 71 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
59 | It.current(); | 72 | It.current(); |
60 | ++It ) { | 73 | ++It ) { |
61 | Run = It.current(); | 74 | Run = It.current(); |
62 | if( R.match( Run->Name ) >= 0 && | 75 | if( R.match( Run->Name ) >= 0 && |
63 | Run->IsPointToPoint | 76 | Run->IsPointToPoint |
64 | ) { | 77 | ) { |
65 | // this is a LAN card | 78 | // this is a LAN card |
66 | if( Run->assignedNode() == netNode() ) { | 79 | if( Run->assignedNode() == AsDevice::netNode() ) { |
67 | // assigned to us | 80 | // assigned to us |
68 | return 1; | 81 | return 1; |
69 | } | 82 | } |
70 | } | 83 | } |
71 | } | 84 | } |
72 | return 0; | 85 | return 0; |
73 | } | 86 | } |
74 | 87 | ||
75 | bool PPPRun::handlesInterface( const QString & S ) { | 88 | bool PPPRun::handlesInterface( const QString & S ) { |
76 | return Pat.match( S ) >= 0; | 89 | return Pat.match( S ) >= 0; |
77 | } | 90 | } |
diff --git a/noncore/settings/networksettings2/ppp/ppprun.h b/noncore/settings/networksettings2/ppp/ppprun.h index 76a05be..abb9176 100644 --- a/noncore/settings/networksettings2/ppp/ppprun.h +++ b/noncore/settings/networksettings2/ppp/ppprun.h | |||
@@ -1,37 +1,43 @@ | |||
1 | #ifndef PPPRUN_H | 1 | #ifndef PPPRUN_H |
2 | #define PPPRUN_H | 2 | #define PPPRUN_H |
3 | 3 | ||
4 | #include <qregexp.h> | 4 | #include <qregexp.h> |
5 | #include <asconnection.h> | 5 | #include <asconnection.h> |
6 | #include <asdevice.h> | ||
6 | #include "pppdata.h" | 7 | #include "pppdata.h" |
7 | 8 | ||
8 | class PPPRun : public AsConnection { | 9 | class PPPRun : public AsConnection, public AsDevice { |
9 | 10 | ||
10 | public : | 11 | public : |
11 | 12 | ||
12 | PPPRun( ANetNodeInstance * NNI, | 13 | PPPRun( ANetNodeInstance * NNI, |
13 | PPPData & Data ) : | 14 | PPPData & Data ); |
14 | AsConnection( NNI ), | 15 | virtual QString genNic( long NicNr ) |
15 | Pat( "eth[0-9]" ) | 16 | { QString S; return S.sprintf( "ppp%ld", NicNr ); } |
16 | { D = &Data; } | ||
17 | 17 | ||
18 | protected : | 18 | virtual AsDevice * device( void ) |
19 | { return AsDevice::asDevice(); } | ||
20 | virtual RuntimeInfo * runtimeInfo( void ) | ||
21 | { return ( AsConnection *)this; } | ||
22 | |||
23 | protected : | ||
19 | 24 | ||
20 | void detectState( NodeCollection * NC ); | 25 | void detectState( NodeCollection * NC ); |
21 | bool setState( NodeCollection * NC, Action_t A ); | 26 | bool setState( NodeCollection * NC, Action_t A ); |
22 | bool canSetState( State_t S, Action_t A ) | 27 | bool canSetState( State_t S, Action_t A ) |
23 | { return connection()->findNext( netNode() )->runtime()->canSetState( S,A ); } | 28 | { return AsDevice::connection()->findNext( |
29 | AsDevice::netNode() )->runtime()->canSetState( S,A ); } | ||
24 | 30 | ||
25 | bool handlesInterface( const QString & I ); | 31 | bool handlesInterface( const QString & I ); |
26 | 32 | ||
27 | private : | 33 | private : |
28 | 34 | ||
29 | bool isMyPPPDRunning( void ); | 35 | bool isMyPPPDRunning( void ); |
30 | bool isMyPPPUp( void ); | 36 | bool isMyPPPUp( void ); |
31 | 37 | ||
32 | PPPData_t * D; | 38 | PPPData_t * D; |
33 | QRegExp Pat; | 39 | QRegExp Pat; |
34 | 40 | ||
35 | }; | 41 | }; |
36 | 42 | ||
37 | #endif | 43 | #endif |
diff --git a/noncore/settings/networksettings2/profile/profile_NN.h b/noncore/settings/networksettings2/profile/profile_NN.h index 2b469c7..3c06947 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.h +++ b/noncore/settings/networksettings2/profile/profile_NN.h | |||
@@ -1,44 +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 "commprofile"; } | 18 | { return "Devices/commprofile"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("Regular profile"); } | 21 | { return tr("Regular profile"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/usb/usb_NN.h b/noncore/settings/networksettings2/usb/usb_NN.h index 3871afc..8b97452 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.h +++ b/noncore/settings/networksettings2/usb/usb_NN.h | |||
@@ -1,44 +1,44 @@ | |||
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 "usb"; } | 18 | { return "Devices/usb"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("USB Cable Connect"); } | 21 | { return tr("USB Cable Connect"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.h b/noncore/settings/networksettings2/vpn/vpn_NN.h index 5718961..a113ab9 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.h +++ b/noncore/settings/networksettings2/vpn/vpn_NN.h | |||
@@ -1,44 +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 "vpn"; } | 18 | { return "Devices/vpn"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("VPN Connection"); } | 21 | { return tr("VPN Connection"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NN.h b/noncore/settings/networksettings2/wlan/wlan_NN.h index d1d6ded..0728a79 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NN.h +++ b/noncore/settings/networksettings2/wlan/wlan_NN.h | |||
@@ -1,44 +1,44 @@ | |||
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 "wlan"; } | 18 | { return "Devices/wlan"; } |
19 | 19 | ||
20 | virtual const QString nodeName() | 20 | virtual const QString nodeName() |
21 | { return tr("WLan Device"); } | 21 | { return tr("WLan Device"); } |
22 | 22 | ||
23 | virtual const QString nodeDescription() ; | 23 | virtual const QString nodeDescription() ; |
24 | 24 | ||
25 | virtual ANetNodeInstance * createInstance( void ); | 25 | virtual ANetNodeInstance * createInstance( void ); |
26 | 26 | ||
27 | virtual const char ** needs( void ); | 27 | virtual const char ** needs( void ); |
28 | virtual const char * provides( void ); | 28 | virtual const char * provides( void ); |
29 | 29 | ||
30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); | 30 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ); |
31 | virtual bool hasDataFor( const QString & S ); | 31 | virtual bool hasDataFor( const QString & S ); |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); | 33 | SystemFile & SF, long DevNr, ANetNodeInstance * NNI ); |
34 | 34 | ||
35 | private: | 35 | private: |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | extern "C" | 39 | extern "C" |
40 | { | 40 | { |
41 | void create_plugin( QList<ANetNode> & PNN ); | 41 | void create_plugin( QList<ANetNode> & PNN ); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #endif | 44 | #endif |