author | wimpie <wimpie> | 2005-01-11 22:10:59 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-11 22:10:59 (UTC) |
commit | b0afa096730ac7893fcd25873f6fd09fcef32a95 (patch) (unidiff) | |
tree | fc462fb9413e104b777f9f6d1439f4147e6c1350 | |
parent | 96678694f8952f60d0a895cede2b621404b4bfb8 (diff) | |
download | opie-b0afa096730ac7893fcd25873f6fd09fcef32a95.zip opie-b0afa096730ac7893fcd25873f6fd09fcef32a95.tar.gz opie-b0afa096730ac7893fcd25873f6fd09fcef32a95.tar.bz2 |
Changes now ok
this works again
8 files changed, 19 insertions, 17 deletions
diff --git a/noncore/settings/networksettings2/cable/cable_NN.cpp b/noncore/settings/networksettings2/cable/cable_NN.cpp index 3f34bb2..4085b22 100644 --- a/noncore/settings/networksettings2/cable/cable_NN.cpp +++ b/noncore/settings/networksettings2/cable/cable_NN.cpp | |||
@@ -1,52 +1,52 @@ | |||
1 | #include "cable_NN.h" | 1 | #include "cable_NN.h" |
2 | #include "cable_NNI.h" | 2 | #include "cable_NNI.h" |
3 | 3 | ||
4 | #include "netnodeinterface.h" | 4 | #include "netnodeinterface.h" |
5 | 5 | ||
6 | static const char * CableNeeds[] = | 6 | static const char * CableNeeds[] = |
7 | { 0 | 7 | { 0 |
8 | }; | 8 | }; |
9 | 9 | ||
10 | static const char * CableProvides[] = | 10 | static const char * CableProvides[] = |
11 | { "line", | 11 | { "line", |
12 | 0 | 12 | 0 |
13 | }; | 13 | }; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Constructor, find all of the possible interfaces | 16 | * Constructor, find all of the possible interfaces |
17 | */ | 17 | */ |
18 | CableNetNode::CableNetNode() : ANetNode(tr("Cable NetworkSetup")) { | 18 | CableNetNode::CableNetNode() : ANetNode(tr("Cable connection")) { |
19 | } | 19 | } |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Delete any interfaces that we own. | 22 | * Delete any interfaces that we own. |
23 | */ | 23 | */ |
24 | CableNetNode::~CableNetNode(){ | 24 | CableNetNode::~CableNetNode(){ |
25 | } | 25 | } |
26 | 26 | ||
27 | const QString CableNetNode::nodeDescription(){ | 27 | const QString CableNetNode::nodeDescription(){ |
28 | return tr("\ | 28 | return tr("\ |
29 | <p>Sets up a wired serial or parallel.</p>\ | 29 | <p>Sets up a wired serial or parallel.</p>\ |
30 | " | 30 | " |
31 | ); | 31 | ); |
32 | } | 32 | } |
33 | 33 | ||
34 | ANetNodeInstance * CableNetNode::createInstance( void ) { | 34 | ANetNodeInstance * CableNetNode::createInstance( void ) { |
35 | return new ACable( this ); | 35 | return new ACable( this ); |
36 | } | 36 | } |
37 | 37 | ||
38 | const char ** CableNetNode::needs( void ) { | 38 | const char ** CableNetNode::needs( void ) { |
39 | return CableNeeds; | 39 | return CableNeeds; |
40 | } | 40 | } |
41 | 41 | ||
42 | const char ** CableNetNode::provides( void ) { | 42 | const char ** CableNetNode::provides( void ) { |
43 | return CableProvides; | 43 | return CableProvides; |
44 | } | 44 | } |
45 | 45 | ||
46 | void CableNetNode::setSpecificAttribute( QString & , QString & ) { | 46 | void CableNetNode::setSpecificAttribute( QString & , QString & ) { |
47 | } | 47 | } |
48 | 48 | ||
49 | void CableNetNode::saveSpecificAttribute( QTextStream & ) { | 49 | void CableNetNode::saveSpecificAttribute( QTextStream & ) { |
50 | } | 50 | } |
51 | 51 | ||
52 | OPIE_NS2_PLUGIN( NetNodeInterface_T<CableNetNode> ) | 52 | OPIE_NS2_PLUGIN( NetNodeInterface_T<CableNetNode> ) |
diff --git a/noncore/settings/networksettings2/gprs/GPRS_NN.cpp b/noncore/settings/networksettings2/gprs/GPRS_NN.cpp index 374cf5a..e9553a6 100644 --- a/noncore/settings/networksettings2/gprs/GPRS_NN.cpp +++ b/noncore/settings/networksettings2/gprs/GPRS_NN.cpp | |||
@@ -1,78 +1,78 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <netnode.h> | 3 | #include <netnode.h> |
4 | #include "GPRS_NN.h" | 4 | #include "GPRS_NN.h" |
5 | #include "GPRS_NNI.h" | 5 | #include "GPRS_NNI.h" |
6 | 6 | ||
7 | #include "netnodeinterface.h" | 7 | #include "netnodeinterface.h" |
8 | 8 | ||
9 | static const char * GPRSNeeds[] = | 9 | static const char * GPRSNeeds[] = |
10 | { "GPRS", | 10 | { "GPRS", |
11 | 0 | 11 | 0 |
12 | }; | 12 | }; |
13 | 13 | ||
14 | static const char * GPRSProvides[] = | 14 | static const char * GPRSProvides[] = |
15 | { "NetworkSetup", | 15 | { "connection", |
16 | 0 | 16 | 0 |
17 | }; | 17 | }; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Constructor, find all of the possible interfaces | 20 | * Constructor, find all of the possible interfaces |
21 | */ | 21 | */ |
22 | GPRSNetNode::GPRSNetNode() : ANetNode(tr("GPRS capable device")) { | 22 | GPRSNetNode::GPRSNetNode() : ANetNode(tr("GPRS capable device")) { |
23 | NSResources->addSystemFile( | 23 | NSResources->addSystemFile( |
24 | "pap-secrets", "/etc/ppp/pap-secrets", 0 ); | 24 | "pap-secrets", "/etc/ppp/pap-secrets", 0 ); |
25 | } | 25 | } |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Delete any interfaces that we own. | 28 | * Delete any interfaces that we own. |
29 | */ | 29 | */ |
30 | GPRSNetNode::~GPRSNetNode(){ | 30 | GPRSNetNode::~GPRSNetNode(){ |
31 | } | 31 | } |
32 | 32 | ||
33 | const QString GPRSNetNode::nodeDescription(){ | 33 | const QString GPRSNetNode::nodeDescription(){ |
34 | return tr("\ | 34 | return tr("\ |
35 | <p>provides access to a GPRS capable device.</p>\ | 35 | <p>provides access to a GPRS capable device.</p>\ |
36 | " | 36 | " |
37 | ); | 37 | ); |
38 | } | 38 | } |
39 | 39 | ||
40 | ANetNodeInstance * GPRSNetNode::createInstance( void ) { | 40 | ANetNodeInstance * GPRSNetNode::createInstance( void ) { |
41 | return new AGPRSDevice( this ); | 41 | return new AGPRSDevice( this ); |
42 | } | 42 | } |
43 | 43 | ||
44 | bool GPRSNetNode::hasDataForFile( SystemFile & S ) { | 44 | bool GPRSNetNode::hasDataForFile( SystemFile & S ) { |
45 | return S.name() == "pap-secrets"; | 45 | return S.name() == "pap-secrets"; |
46 | } | 46 | } |
47 | 47 | ||
48 | short GPRSNetNode::generateFile( SystemFile & , | 48 | short GPRSNetNode::generateFile( SystemFile & , |
49 | ANetNodeInstance * , | 49 | ANetNodeInstance * , |
50 | long ) { | 50 | long ) { |
51 | 51 | ||
52 | return 0; | 52 | return 0; |
53 | } | 53 | } |
54 | 54 | ||
55 | const char ** GPRSNetNode::needs( void ) { | 55 | const char ** GPRSNetNode::needs( void ) { |
56 | return GPRSNeeds; | 56 | return GPRSNeeds; |
57 | } | 57 | } |
58 | 58 | ||
59 | const char ** GPRSNetNode::provides( void ) { | 59 | const char ** GPRSNetNode::provides( void ) { |
60 | return GPRSProvides; | 60 | return GPRSProvides; |
61 | } | 61 | } |
62 | 62 | ||
63 | void GPRSNetNode::setSpecificAttribute( QString & , QString & ) { | 63 | void GPRSNetNode::setSpecificAttribute( QString & , QString & ) { |
64 | } | 64 | } |
65 | 65 | ||
66 | void GPRSNetNode::saveSpecificAttribute( QTextStream & ) { | 66 | void GPRSNetNode::saveSpecificAttribute( QTextStream & ) { |
67 | } | 67 | } |
68 | 68 | ||
69 | QStringList GPRSNetNode::properFiles( void ) { | 69 | QStringList GPRSNetNode::properFiles( void ) { |
70 | QStringList SL; | 70 | QStringList SL; |
71 | 71 | ||
72 | SL << "peers"; | 72 | SL << "peers"; |
73 | SL << "chatscripts"; | 73 | SL << "chatscripts"; |
74 | SL << "extra"; | 74 | SL << "extra"; |
75 | return SL; | 75 | return SL; |
76 | } | 76 | } |
77 | 77 | ||
78 | OPIE_NS2_PLUGIN( NetNodeInterface_T<GPRSNetNode> ) | 78 | OPIE_NS2_PLUGIN( NetNodeInterface_T<GPRSNetNode> ) |
diff --git a/noncore/settings/networksettings2/network/network_NN.cpp b/noncore/settings/networksettings2/network/network_NN.cpp index 80a7fac..2fa31bd 100644 --- a/noncore/settings/networksettings2/network/network_NN.cpp +++ b/noncore/settings/networksettings2/network/network_NN.cpp | |||
@@ -1,95 +1,95 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <resources.h> | 2 | #include <resources.h> |
3 | #include <netnode.h> | 3 | #include <netnode.h> |
4 | #include "network_NN.h" | 4 | #include "network_NN.h" |
5 | #include "network_NNI.h" | 5 | #include "network_NNI.h" |
6 | 6 | ||
7 | #include "netnodeinterface.h" | 7 | #include "netnodeinterface.h" |
8 | 8 | ||
9 | static const char * NetworkNeeds[] = | 9 | static const char * NetworkNeeds[] = |
10 | { "device", | 10 | { "device", |
11 | 0 | 11 | 0 |
12 | }; | 12 | }; |
13 | 13 | ||
14 | static const char * NetworkProvides[] = | 14 | static const char * NetworkProvides[] = |
15 | { "NetworkSetup", | 15 | { "connection", |
16 | 0 | 16 | 0 |
17 | }; | 17 | }; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Constructor, find all of the possible interfaces | 20 | * Constructor, find all of the possible interfaces |
21 | */ | 21 | */ |
22 | NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { | 22 | NetworkNetNode::NetworkNetNode() : ANetNode(tr("IP Configuration")) { |
23 | 23 | ||
24 | NSResources->addSystemFile( | 24 | NSResources->addSystemFile( |
25 | "interfaces", "/etc/network/interfaces", 1 ); | 25 | "interfaces", "/etc/network/interfaces", 1 ); |
26 | } | 26 | } |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Delete any interfaces that we own. | 29 | * Delete any interfaces that we own. |
30 | */ | 30 | */ |
31 | NetworkNetNode::~NetworkNetNode(){ | 31 | NetworkNetNode::~NetworkNetNode(){ |
32 | } | 32 | } |
33 | 33 | ||
34 | const QString NetworkNetNode::nodeDescription(){ | 34 | const QString NetworkNetNode::nodeDescription(){ |
35 | return tr("\ | 35 | return tr("\ |
36 | <p>Sets up TCP/IP options.</p>\ | 36 | <p>Sets up TCP/IP options.</p>\ |
37 | <p>Use this to configure the TCP/IP protocol</p>\ | 37 | <p>Use this to configure the TCP/IP protocol</p>\ |
38 | " | 38 | " |
39 | ); | 39 | ); |
40 | } | 40 | } |
41 | 41 | ||
42 | ANetNodeInstance * NetworkNetNode::createInstance( void ) { | 42 | ANetNodeInstance * NetworkNetNode::createInstance( void ) { |
43 | return new ANetwork( this ); | 43 | return new ANetwork( this ); |
44 | } | 44 | } |
45 | 45 | ||
46 | bool NetworkNetNode::hasDataForFile( SystemFile & S ) { | 46 | bool NetworkNetNode::hasDataForFile( SystemFile & S ) { |
47 | return S.name() == "interfaces"; | 47 | return S.name() == "interfaces"; |
48 | } | 48 | } |
49 | 49 | ||
50 | short NetworkNetNode::generateFile( SystemFile & SF, | 50 | short NetworkNetNode::generateFile( SystemFile & SF, |
51 | ANetNodeInstance * NNI, | 51 | ANetNodeInstance * NNI, |
52 | long DevNr ) { | 52 | long DevNr ) { |
53 | 53 | ||
54 | if( DevNr < 0 ) { | 54 | if( DevNr < 0 ) { |
55 | // generate device specific but common part | 55 | // generate device specific but common part |
56 | return 1; | 56 | return 1; |
57 | } | 57 | } |
58 | 58 | ||
59 | QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); | 59 | QString NIC = NNI->runtime()->device()->netNode()->nodeClass()->genNic( DevNr ); |
60 | 60 | ||
61 | if( SF.name() == "interfaces" ) { | 61 | if( SF.name() == "interfaces" ) { |
62 | Log(("Generate entry for %s in %s\n", NIC.latin1(), SF.name().latin1() )); | 62 | Log(("Generate entry for %s in %s\n", NIC.latin1(), SF.name().latin1() )); |
63 | // generate mapping stanza for this interface | 63 | // generate mapping stanza for this interface |
64 | SF << "# check if " | 64 | SF << "# check if " |
65 | << NIC | 65 | << NIC |
66 | << " can be brought UP" | 66 | << " can be brought UP" |
67 | << endl; | 67 | << endl; |
68 | SF << "mapping " | 68 | SF << "mapping " |
69 | << NIC | 69 | << NIC |
70 | << endl; | 70 | << endl; |
71 | SF << " script " | 71 | SF << " script " |
72 | << QPEApplication::qpeDir() | 72 | << QPEApplication::qpeDir() |
73 | << "bin/networksettings2-request" | 73 | << "bin/networksettings2-request" |
74 | << endl | 74 | << endl |
75 | << endl; | 75 | << endl; |
76 | return 0; | 76 | return 0; |
77 | } | 77 | } |
78 | return 1; | 78 | return 1; |
79 | } | 79 | } |
80 | 80 | ||
81 | const char ** NetworkNetNode::needs( void ) { | 81 | const char ** NetworkNetNode::needs( void ) { |
82 | return NetworkNeeds; | 82 | return NetworkNeeds; |
83 | } | 83 | } |
84 | 84 | ||
85 | const char ** NetworkNetNode::provides( void ) { | 85 | const char ** NetworkNetNode::provides( void ) { |
86 | return NetworkProvides; | 86 | return NetworkProvides; |
87 | } | 87 | } |
88 | 88 | ||
89 | void NetworkNetNode::setSpecificAttribute( QString & , QString & ) { | 89 | void NetworkNetNode::setSpecificAttribute( QString & , QString & ) { |
90 | } | 90 | } |
91 | 91 | ||
92 | void NetworkNetNode::saveSpecificAttribute( QTextStream & ) { | 92 | void NetworkNetNode::saveSpecificAttribute( QTextStream & ) { |
93 | } | 93 | } |
94 | 94 | ||
95 | OPIE_NS2_PLUGIN( NetNodeInterface_T<NetworkNetNode> ) | 95 | OPIE_NS2_PLUGIN( NetNodeInterface_T<NetworkNetNode> ) |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp index 0e72c25..2dd91f8 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.cpp +++ b/noncore/settings/networksettings2/networksettings2/resources.cpp | |||
@@ -1,481 +1,483 @@ | |||
1 | #include <unistd.h> | 1 | #include <unistd.h> |
2 | #include <errno.h> | 2 | #include <errno.h> |
3 | #include <fcntl.h> | 3 | #include <fcntl.h> |
4 | #include <pwd.h> | 4 | #include <pwd.h> |
5 | #include <qpixmap.h> | 5 | #include <qpixmap.h> |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | 8 | ||
9 | #include <qpe/qlibrary.h> | 9 | #include <qpe/qlibrary.h> |
10 | #include <qpe/qpeapplication.h> | 10 | #include <qpe/qpeapplication.h> |
11 | 11 | ||
12 | #include <opie2/odebug.h> | 12 | #include <opie2/odebug.h> |
13 | #include <opie2/opluginloader.h> | 13 | #include <opie2/opluginloader.h> |
14 | 14 | ||
15 | #include <qtopia/resource.h> | 15 | #include <qtopia/resource.h> |
16 | 16 | ||
17 | #include "netnode.h" | 17 | #include "netnode.h" |
18 | #include "resources.h" | 18 | #include "resources.h" |
19 | #include "netnodeinterface.h" | 19 | #include "netnodeinterface.h" |
20 | 20 | ||
21 | #define PLUGINDIR "plugins/networksettings2" | 21 | #define PLUGINDIR "plugins/networksettings2" |
22 | #define ICONDIR "/pics/networksettings2/" | 22 | #define ICONDIR "/pics/networksettings2/" |
23 | 23 | ||
24 | // single resources instance | 24 | // single resources instance |
25 | TheNSResources * _NSResources = 0; | 25 | TheNSResources * _NSResources = 0; |
26 | 26 | ||
27 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), | 27 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), |
28 | NetworkSetupsMap(), DanglingNetworkSetupsMap() { | 28 | NetworkSetupsMap(), DanglingNetworkSetupsMap() { |
29 | 29 | ||
30 | _NSResources = this; | 30 | _NSResources = this; |
31 | 31 | ||
32 | detectCurrentUser(); | 32 | detectCurrentUser(); |
33 | 33 | ||
34 | // load available netnodes | 34 | // load available netnodes |
35 | 35 | ||
36 | Plugins = 0; | 36 | Plugins = 0; |
37 | findAvailableNetNodes(); | 37 | findAvailableNetNodes(); |
38 | 38 | ||
39 | // compile provides and needs lists | 39 | // compile provides and needs lists |
40 | { const char ** NeedsRun; | 40 | { const char ** NeedsRun; |
41 | QDictIterator<ANetNode> OuterIt( AllNodeTypes ); | 41 | QDictIterator<ANetNode> OuterIt( AllNodeTypes ); |
42 | bool Done; | 42 | bool Done; |
43 | 43 | ||
44 | for ( ; OuterIt.current(); ++OuterIt ) { | 44 | for ( ; OuterIt.current(); ++OuterIt ) { |
45 | // find needs list | 45 | // find needs list |
46 | ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList; | 46 | ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList; |
47 | ANetNode::NetNodeList & NNL = *(NNLP); | 47 | ANetNode::NetNodeList & NNL = *(NNLP); |
48 | 48 | ||
49 | // must iterate this way to avoid duplication pointers | 49 | // must iterate this way to avoid duplication pointers |
50 | for ( QDictIterator<ANetNode> InnerIt( AllNodeTypes ); | 50 | for ( QDictIterator<ANetNode> InnerIt( AllNodeTypes ); |
51 | InnerIt.current(); ++InnerIt ) { | 51 | InnerIt.current(); ++InnerIt ) { |
52 | 52 | ||
53 | if( InnerIt.current() == OuterIt.current() ) | 53 | if( InnerIt.current() == OuterIt.current() ) |
54 | // avoid recursive | 54 | // avoid recursive |
55 | continue; | 55 | continue; |
56 | 56 | ||
57 | const char ** Provides = InnerIt.current()->provides(); | 57 | const char ** Provides = InnerIt.current()->provides(); |
58 | NeedsRun = OuterIt.current()->needs(); | 58 | NeedsRun = OuterIt.current()->needs(); |
59 | 59 | ||
60 | for( ; *NeedsRun; NeedsRun ++ ) { | 60 | for( ; *NeedsRun; NeedsRun ++ ) { |
61 | const char ** PRun; | 61 | const char ** PRun; |
62 | PRun = Provides; | 62 | PRun = Provides; |
63 | for( ; *PRun; PRun ++ ) { | 63 | for( ; *PRun; PRun ++ ) { |
64 | if( strcmp( *PRun, *NeedsRun ) == 0 ) { | 64 | if( strcmp( *PRun, *NeedsRun ) == 0 ) { |
65 | // inner provides what outer needs | 65 | // inner provides what outer needs |
66 | NNL.resize( NNL.size() + 1 ); | 66 | NNL.resize( NNL.size() + 1 ); |
67 | NNL[NNL.size()-1] = InnerIt.current(); | 67 | NNL[NNL.size()-1] = InnerIt.current(); |
68 | Done = 1; // break from 2 loops | 68 | Done = 1; // break from 2 loops |
69 | break; | 69 | break; |
70 | } | 70 | } |
71 | } | 71 | } |
72 | } | 72 | } |
73 | } | 73 | } |
74 | OuterIt.current()->setAlternatives( NNLP ); | 74 | OuterIt.current()->setAlternatives( NNLP ); |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | // define built in Node types to Description map | 78 | // define built in Node types to Description map |
79 | addNodeType( "device", tr( "Network Device" ), | 79 | addNodeType( "device", tr( "Network Device" ), |
80 | tr( "<p>Devices that can handle IP packets</p>" ) ); | 80 | tr( "<p>Devices that can handle IP packets</p>" ) ); |
81 | addNodeType( "line", tr( "Character device" ), | 81 | addNodeType( "line", tr( "Character device" ), |
82 | tr( "<p>Devices that can handle single bytes</p>" ) ); | 82 | tr( "<p>Devices that can handle single bytes</p>" ) ); |
83 | addNodeType( "NetworkSetup", tr( "IP NetworkSetup" ), | 83 | addNodeType( "NetworkSetup", tr( "IP NetworkSetup" ), |
84 | tr( "<p>Nodes that provide working IP NetworkSetups</p>" ) ); | 84 | tr( "<p>Nodes that provide working IP NetworkSetups</p>" ) ); |
85 | addNodeType( "fullsetup", tr( "NetworkSetup Profile" ), | 85 | addNodeType( "fullsetup", tr( "NetworkSetup Profile" ), |
86 | tr( "<p>Fully configured NetworkSetup profile</p>" ) ); | 86 | tr( "<p>Fully configured NetworkSetup profile</p>" ) ); |
87 | addNodeType( "GPRS", tr( "NetworkSetup to GPRS device" ), | 87 | addNodeType( "GPRS", tr( "NetworkSetup to GPRS device" ), |
88 | tr( "<p>NetworkSetup to a GPRS capable device</p>" ) ); | 88 | tr( "<p>NetworkSetup to a GPRS capable device</p>" ) ); |
89 | 89 | ||
90 | // get access to the system | 90 | // get access to the system |
91 | TheSystem = new System(); | 91 | TheSystem = new System(); |
92 | 92 | ||
93 | } | 93 | } |
94 | 94 | ||
95 | TheNSResources::~TheNSResources( void ) { | 95 | TheNSResources::~TheNSResources( void ) { |
96 | 96 | ||
97 | if( Plugins ) { | 97 | if( Plugins ) { |
98 | delete Plugins; | 98 | delete Plugins; |
99 | delete PluginManager; | 99 | delete PluginManager; |
100 | } | 100 | } |
101 | delete TheSystem; | 101 | delete TheSystem; |
102 | 102 | ||
103 | } | 103 | } |
104 | 104 | ||
105 | void TheNSResources::addNodeType( const QString & ID, | 105 | void TheNSResources::addNodeType( const QString & ID, |
106 | const QString & Name, | 106 | const QString & Name, |
107 | const QString & Descr ) { | 107 | const QString & Descr ) { |
108 | if( NodeTypeNameMap[ID].isEmpty() ) { | 108 | if( NodeTypeNameMap[ID].isEmpty() ) { |
109 | NodeTypeNameMap.insert( ID, Name ); | 109 | NodeTypeNameMap.insert( ID, Name ); |
110 | NodeTypeDescriptionMap.insert( ID, Descr ); | 110 | NodeTypeDescriptionMap.insert( ID, Descr ); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | void TheNSResources::addSystemFile( const QString & ID, | 114 | void TheNSResources::addSystemFile( const QString & ID, |
115 | const QString & P, | 115 | const QString & P, |
116 | bool KDI ) { | 116 | bool KDI ) { |
117 | if( ! SystemFiles.find( ID ) ) { | 117 | if( ! SystemFiles.find( ID ) ) { |
118 | // new system file | 118 | // new system file |
119 | SystemFiles.insert( ID, new SystemFile( ID, P, KDI ) ); | 119 | SystemFiles.insert( ID, new SystemFile( ID, P, KDI ) ); |
120 | } // else existed | 120 | } // else existed |
121 | } | 121 | } |
122 | 122 | ||
123 | void TheNSResources::busy( bool ) { | 123 | void TheNSResources::busy( bool ) { |
124 | /* | 124 | /* |
125 | if( B ) { | 125 | if( B ) { |
126 | ShowWait->show(); | 126 | ShowWait->show(); |
127 | qApp->process | 127 | qApp->process |
128 | } else { | 128 | } else { |
129 | ShowWait->hide(); | 129 | ShowWait->hide(); |
130 | } | 130 | } |
131 | */ | 131 | */ |
132 | } | 132 | } |
133 | 133 | ||
134 | void TheNSResources::findAvailableNetNodes( void ){ | 134 | void TheNSResources::findAvailableNetNodes( void ){ |
135 | 135 | ||
136 | Plugins = new OPluginLoader( "networksettings2" ); | 136 | Plugins = new OPluginLoader( "networksettings2" ); |
137 | Plugins->setAutoDelete( true ); | 137 | Plugins->setAutoDelete( true ); |
138 | 138 | ||
139 | PluginManager = new OPluginManager( Plugins ); | 139 | PluginManager = new OPluginManager( Plugins ); |
140 | PluginManager->load(); | 140 | PluginManager->load(); |
141 | 141 | ||
142 | if( Plugins->isInSafeMode() ) { | 142 | if( Plugins->isInSafeMode() ) { |
143 | QMessageBox::information( | 143 | QMessageBox::information( |
144 | 0, | 144 | 0, |
145 | tr( "Today Error"), | 145 | tr( "Today Error"), |
146 | tr( "<qt>The plugin '%1' caused Today to crash." | 146 | tr( "<qt>The plugin '%1' caused Today to crash." |
147 | " It could be that the plugin is not properly" | 147 | " It could be that the plugin is not properly" |
148 | " installed.<br>Today tries to continue loading" | 148 | " installed.<br>Today tries to continue loading" |
149 | " plugins.</qt>" ) | 149 | " plugins.</qt>" ) |
150 | .arg( PluginManager->crashedPlugin().name())); | 150 | .arg( PluginManager->crashedPlugin().name())); |
151 | } | 151 | } |
152 | 152 | ||
153 | // Get All Plugins | 153 | // Get All Plugins |
154 | OPluginLoader::List allplugins = Plugins->filtered(); | 154 | OPluginLoader::List allplugins = Plugins->filtered(); |
155 | QString lang = ::getenv("LANG"); | 155 | QString lang = ::getenv("LANG"); |
156 | 156 | ||
157 | for( OPluginLoader::List::Iterator it = allplugins.begin(); | 157 | for( OPluginLoader::List::Iterator it = allplugins.begin(); |
158 | it != allplugins.end(); | 158 | it != allplugins.end(); |
159 | ++it ) { | 159 | ++it ) { |
160 | 160 | ||
161 | // check if this plugin supports the proper interface | 161 | // check if this plugin supports the proper interface |
162 | NetNodeInterface * interface = | 162 | NetNodeInterface * interface = |
163 | Plugins->load<NetNodeInterface>( *it, IID_NetworkSettings2 ); | 163 | Plugins->load<NetNodeInterface>( *it, IID_NetworkSettings2 ); |
164 | 164 | ||
165 | if( ! interface ) { | 165 | if( ! interface ) { |
166 | Log(( "Plugin %s from %s does not support proper interface\n", | 166 | Log(( "Plugin %s from %s does not support proper interface\n", |
167 | (*it).name().latin1(), (*it).path().latin1() )); | 167 | (*it).name().latin1(), (*it).path().latin1() )); |
168 | continue; | 168 | continue; |
169 | } | 169 | } |
170 | 170 | ||
171 | // add the nodes in this plugin to the dictionary | 171 | // add the nodes in this plugin to the dictionary |
172 | { QList<ANetNode> PNN; | 172 | { QList<ANetNode> PNN; |
173 | 173 | ||
174 | interface->create_plugin( PNN ); | 174 | interface->create_plugin( PNN ); |
175 | 175 | ||
176 | if( PNN.isEmpty() ) { | 176 | if( PNN.isEmpty() ) { |
177 | Log(( "Plugin %s from %s does offer any nodes\n", | 177 | Log(( "Plugin %s from %s does offer any nodes\n", |
178 | (*it).name().latin1(), (*it).path().latin1() )); | 178 | (*it).name().latin1(), (*it).path().latin1() )); |
179 | delete interface; | 179 | delete interface; |
180 | continue; | 180 | continue; |
181 | } | 181 | } |
182 | 182 | ||
183 | // merge this node with global node | 183 | // merge this node with global node |
184 | for( QListIterator<ANetNode> it(PNN); | 184 | for( QListIterator<ANetNode> nnit(PNN); |
185 | it.current(); | 185 | nnit.current(); |
186 | ++it ) { | 186 | ++nnit ) { |
187 | AllNodeTypes.insert( it.current()->name(), it.current() ); | 187 | Log(( "Found node type %s in plugin %s\n", |
188 | nnit.current()->name(), (*it).name().latin1() )); | ||
189 | AllNodeTypes.insert( nnit.current()->name(), nnit.current() ); | ||
188 | } | 190 | } |
189 | } | 191 | } |
190 | 192 | ||
191 | // load the translation | 193 | // load the translation |
192 | QTranslator *trans = new QTranslator(qApp); | 194 | QTranslator *trans = new QTranslator(qApp); |
193 | QString fn = QPEApplication::qpeDir()+ | 195 | QString fn = QPEApplication::qpeDir()+ |
194 | "/i18n/"+lang+"/"+ (*it).name() + ".qm"; | 196 | "/i18n/"+lang+"/"+ (*it).name() + ".qm"; |
195 | 197 | ||
196 | if( trans->load( fn ) ) | 198 | if( trans->load( fn ) ) |
197 | qApp->installTranslator( trans ); | 199 | qApp->installTranslator( trans ); |
198 | else | 200 | else |
199 | delete trans; | 201 | delete trans; |
200 | } | 202 | } |
201 | 203 | ||
202 | } | 204 | } |
203 | 205 | ||
204 | // used to find unique NetworkSetup number | 206 | // used to find unique NetworkSetup number |
205 | int TheNSResources::assignNetworkSetupNumber( void ) { | 207 | int TheNSResources::assignNetworkSetupNumber( void ) { |
206 | bool found = 1; | 208 | bool found = 1; |
207 | for( int trial = 0; ; trial ++ ) { | 209 | for( int trial = 0; ; trial ++ ) { |
208 | found = 1; | 210 | found = 1; |
209 | for( QDictIterator<NetworkSetup> it(NetworkSetupsMap); | 211 | for( QDictIterator<NetworkSetup> it(NetworkSetupsMap); |
210 | it.current(); | 212 | it.current(); |
211 | ++it ) { | 213 | ++it ) { |
212 | if( it.current()->number() == trial ) { | 214 | if( it.current()->number() == trial ) { |
213 | found = 0; | 215 | found = 0; |
214 | break; | 216 | break; |
215 | } | 217 | } |
216 | } | 218 | } |
217 | 219 | ||
218 | if( found ) { | 220 | if( found ) { |
219 | Log(("Assign profile number %d\n", trial )); | 221 | Log(("Assign profile number %d\n", trial )); |
220 | return trial; | 222 | return trial; |
221 | } | 223 | } |
222 | } | 224 | } |
223 | } | 225 | } |
224 | 226 | ||
225 | QPixmap TheNSResources::getPixmap( const QString & QS ) { | 227 | QPixmap TheNSResources::getPixmap( const QString & QS ) { |
226 | QPixmap P; | 228 | QPixmap P; |
227 | QString S("networksettings2/"); | 229 | QString S("networksettings2/"); |
228 | S += QS; | 230 | S += QS; |
229 | P = Resource::loadPixmap( S ); | 231 | P = Resource::loadPixmap( S ); |
230 | if( P.isNull() ) { | 232 | if( P.isNull() ) { |
231 | Log(( "Cannot load %s\n", S.latin1() )); | 233 | Log(( "Cannot load %s\n", S.latin1() )); |
232 | } | 234 | } |
233 | return ( P.isNull() ) ? QPixmap() : P; | 235 | return ( P.isNull() ) ? QPixmap() : P; |
234 | } | 236 | } |
235 | 237 | ||
236 | QString TheNSResources::tr( const char * s ) { | 238 | QString TheNSResources::tr( const char * s ) { |
237 | return qApp->translate( "resource", s ); | 239 | return qApp->translate( "resource", s ); |
238 | } | 240 | } |
239 | 241 | ||
240 | const QString & TheNSResources::netNode2Name( const char * s ) { | 242 | const QString & TheNSResources::netNode2Name( const char * s ) { |
241 | return NodeTypeNameMap[s]; | 243 | return NodeTypeNameMap[s]; |
242 | } | 244 | } |
243 | 245 | ||
244 | const QString & TheNSResources::netNode2Description( const char * s ) { | 246 | const QString & TheNSResources::netNode2Description( const char * s ) { |
245 | return NodeTypeDescriptionMap[s]; | 247 | return NodeTypeDescriptionMap[s]; |
246 | } | 248 | } |
247 | 249 | ||
248 | void TheNSResources::addNetworkSetup( NetworkSetup * NC, bool Dangling ) { | 250 | void TheNSResources::addNetworkSetup( NetworkSetup * NC, bool Dangling ) { |
249 | ANetNodeInstance * NNI; | 251 | ANetNodeInstance * NNI; |
250 | Log(( "Add NetworkSetup %s, Dangling %d\n", | 252 | Log(( "Add NetworkSetup %s, Dangling %d\n", |
251 | NC->name().latin1(), Dangling )); | 253 | NC->name().latin1(), Dangling )); |
252 | if( Dangling ) { | 254 | if( Dangling ) { |
253 | DanglingNetworkSetupsMap.insert( NC->name(), NC ); | 255 | DanglingNetworkSetupsMap.insert( NC->name(), NC ); |
254 | } else { | 256 | } else { |
255 | NetworkSetupsMap.insert( NC->name(), NC ); | 257 | NetworkSetupsMap.insert( NC->name(), NC ); |
256 | } | 258 | } |
257 | 259 | ||
258 | // add (new) nodes to NodeList | 260 | // add (new) nodes to NodeList |
259 | for( QListIterator<ANetNodeInstance> it(*NC); | 261 | for( QListIterator<ANetNodeInstance> it(*NC); |
260 | it.current(); | 262 | it.current(); |
261 | ++it ) { | 263 | ++it ) { |
262 | NNI = it.current(); | 264 | NNI = it.current(); |
263 | if( findNodeInstance( NNI->name() ) == 0 ) { | 265 | if( findNodeInstance( NNI->name() ) == 0 ) { |
264 | // new item | 266 | // new item |
265 | addNodeInstance( NNI ); | 267 | addNodeInstance( NNI ); |
266 | } | 268 | } |
267 | } | 269 | } |
268 | } | 270 | } |
269 | 271 | ||
270 | void TheNSResources::removeNetworkSetup( const QString & N ) { | 272 | void TheNSResources::removeNetworkSetup( const QString & N ) { |
271 | NetworkSetup * NC = findNetworkSetup( N ); | 273 | NetworkSetup * NC = findNetworkSetup( N ); |
272 | if( ! NC ) | 274 | if( ! NC ) |
273 | return; | 275 | return; |
274 | 276 | ||
275 | // delete netnodes in this NetworkSetup | 277 | // delete netnodes in this NetworkSetup |
276 | ANetNodeInstance * NNI; | 278 | ANetNodeInstance * NNI; |
277 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { | 279 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { |
278 | removeNodeInstance( NNI->name() ); | 280 | removeNodeInstance( NNI->name() ); |
279 | } | 281 | } |
280 | if( NetworkSetupsMap.find( N ) ) { | 282 | if( NetworkSetupsMap.find( N ) ) { |
281 | NetworkSetupsMap.remove( N ); | 283 | NetworkSetupsMap.remove( N ); |
282 | } else { | 284 | } else { |
283 | DanglingNetworkSetupsMap.remove( N ); | 285 | DanglingNetworkSetupsMap.remove( N ); |
284 | } | 286 | } |
285 | 287 | ||
286 | } | 288 | } |
287 | 289 | ||
288 | // dangling NetworkSetups are filtered out | 290 | // dangling NetworkSetups are filtered out |
289 | NetworkSetup * TheNSResources::findNetworkSetup( const QString & S ) { | 291 | NetworkSetup * TheNSResources::findNetworkSetup( const QString & S ) { |
290 | return NetworkSetupsMap[ S ]; | 292 | return NetworkSetupsMap[ S ]; |
291 | } | 293 | } |
292 | 294 | ||
293 | NetworkSetup * TheNSResources::getNetworkSetup( int nr ) { | 295 | NetworkSetup * TheNSResources::getNetworkSetup( int nr ) { |
294 | for( QDictIterator<NetworkSetup> it(NetworkSetupsMap); | 296 | for( QDictIterator<NetworkSetup> it(NetworkSetupsMap); |
295 | it.current(); | 297 | it.current(); |
296 | ++it ) { | 298 | ++it ) { |
297 | if( it.current()->number() == nr ) { | 299 | if( it.current()->number() == nr ) { |
298 | return it.current(); | 300 | return it.current(); |
299 | } | 301 | } |
300 | } | 302 | } |
301 | return 0; | 303 | return 0; |
302 | } | 304 | } |
303 | /* | 305 | /* |
304 | void TheNSResources::renumberNetworkSetups( void ) { | 306 | void TheNSResources::renumberNetworkSetups( void ) { |
305 | Name2NetworkSetup_t & M = NSResources->NetworkSetups(); | 307 | Name2NetworkSetup_t & M = NSResources->NetworkSetups(); |
306 | NetworkSetup * NC; | 308 | NetworkSetup * NC; |
307 | 309 | ||
308 | // for all NetworkSetups | 310 | // for all NetworkSetups |
309 | NetworkSetup::resetMaxNr(); | 311 | NetworkSetup::resetMaxNr(); |
310 | for( QDictIterator<NetworkSetup> it(M); | 312 | for( QDictIterator<NetworkSetup> it(M); |
311 | it.current(); | 313 | it.current(); |
312 | ++it ) { | 314 | ++it ) { |
313 | NC = it.current(); | 315 | NC = it.current(); |
314 | NC->setNumber( NC->maxNetworkSetupNumber()+1 ); | 316 | NC->setNumber( NC->maxNetworkSetupNumber()+1 ); |
315 | NC->setModified( 1 ); | 317 | NC->setModified( 1 ); |
316 | } | 318 | } |
317 | } | 319 | } |
318 | */ | 320 | */ |
319 | 321 | ||
320 | typedef struct EnvVars { | 322 | typedef struct EnvVars { |
321 | char * Name; | 323 | char * Name; |
322 | int Len; | 324 | int Len; |
323 | } EnvVar_t; | 325 | } EnvVar_t; |
324 | 326 | ||
325 | #define AnEV(x) x, sizeof(x)-1 | 327 | #define AnEV(x) x, sizeof(x)-1 |
326 | 328 | ||
327 | static EnvVar_t EV[] = { | 329 | static EnvVar_t EV[] = { |
328 | AnEV( "HOME" ), | 330 | AnEV( "HOME" ), |
329 | AnEV( "LOGNAME" ), | 331 | AnEV( "LOGNAME" ), |
330 | AnEV( "USER" ), | 332 | AnEV( "USER" ), |
331 | AnEV( "LD_LIBRARY_PATH" ), | 333 | AnEV( "LD_LIBRARY_PATH" ), |
332 | AnEV( "PATH" ), | 334 | AnEV( "PATH" ), |
333 | AnEV( "QTDIR" ), | 335 | AnEV( "QTDIR" ), |
334 | AnEV( "OPIEDIR" ), | 336 | AnEV( "OPIEDIR" ), |
335 | AnEV( "SHELL" ), | 337 | AnEV( "SHELL" ), |
336 | { NULL, 0 } | 338 | { NULL, 0 } |
337 | }; | 339 | }; |
338 | 340 | ||
339 | void TheNSResources::detectCurrentUser( void ) { | 341 | void TheNSResources::detectCurrentUser( void ) { |
340 | // find current running qpe | 342 | // find current running qpe |
341 | QString QPEEnvFile = ""; | 343 | QString QPEEnvFile = ""; |
342 | 344 | ||
343 | CurrentUser.UserName = ""; | 345 | CurrentUser.UserName = ""; |
344 | CurrentUser.HomeDir = ""; | 346 | CurrentUser.HomeDir = ""; |
345 | 347 | ||
346 | if( getenv( "OPIEDIR" ) == 0 ) { | 348 | if( getenv( "OPIEDIR" ) == 0 ) { |
347 | // nothing known | 349 | // nothing known |
348 | { // open proc dir and find all dirs in it | 350 | { // open proc dir and find all dirs in it |
349 | QRegExp R("[0-9]+"); | 351 | QRegExp R("[0-9]+"); |
350 | QDir ProcDir( "/proc" ); | 352 | QDir ProcDir( "/proc" ); |
351 | QFileInfo FI; | 353 | QFileInfo FI; |
352 | QStringList EL = ProcDir.entryList( QDir::Dirs ); | 354 | QStringList EL = ProcDir.entryList( QDir::Dirs ); |
353 | 355 | ||
354 | // print it out | 356 | // print it out |
355 | for ( QStringList::Iterator it = EL.begin(); | 357 | for ( QStringList::Iterator it = EL.begin(); |
356 | it != EL.end(); | 358 | it != EL.end(); |
357 | ++it ) { | 359 | ++it ) { |
358 | if( R.match( (*it) ) >= 0 ) { | 360 | if( R.match( (*it) ) >= 0 ) { |
359 | QString S = ProcDir.path()+"/"+ (*it); | 361 | QString S = ProcDir.path()+"/"+ (*it); |
360 | S.append( "/exe" ); | 362 | S.append( "/exe" ); |
361 | FI.setFile( S ); | 363 | FI.setFile( S ); |
362 | // get the link | 364 | // get the link |
363 | S = FI.readLink(); | 365 | S = FI.readLink(); |
364 | if( S.right( 8 ) == "/bin/qpe" ) { | 366 | if( S.right( 8 ) == "/bin/qpe" ) { |
365 | // found running qpe | 367 | // found running qpe |
366 | QPEEnvFile.sprintf( ProcDir.path()+ "/" + (*it) + "/environ" ); | 368 | QPEEnvFile.sprintf( ProcDir.path()+ "/" + (*it) + "/environ" ); |
367 | break; | 369 | break; |
368 | } | 370 | } |
369 | } | 371 | } |
370 | } | 372 | } |
371 | } | 373 | } |
372 | 374 | ||
373 | if( QPEEnvFile.isEmpty() ) { | 375 | if( QPEEnvFile.isEmpty() ) { |
374 | // could not find qpe | 376 | // could not find qpe |
375 | Log(("Could not find qpe\n" )); | 377 | Log(("Could not find qpe\n" )); |
376 | return; | 378 | return; |
377 | } | 379 | } |
378 | 380 | ||
379 | // FI now contains path ProcDir to the cmd dir | 381 | // FI now contains path ProcDir to the cmd dir |
380 | { char * Buf = 0; | 382 | { char * Buf = 0; |
381 | char TB[1024]; | 383 | char TB[1024]; |
382 | long BufSize = 0; | 384 | long BufSize = 0; |
383 | int fd; | 385 | int fd; |
384 | int rd; | 386 | int rd; |
385 | 387 | ||
386 | fd = open( QPEEnvFile.latin1(), O_RDONLY ); | 388 | fd = open( QPEEnvFile.latin1(), O_RDONLY ); |
387 | if( fd < 0 ) { | 389 | if( fd < 0 ) { |
388 | Log(("Could not open %s : %d\n", | 390 | Log(("Could not open %s : %d\n", |
389 | QPEEnvFile.latin1(), errno )); | 391 | QPEEnvFile.latin1(), errno )); |
390 | return; | 392 | return; |
391 | } | 393 | } |
392 | 394 | ||
393 | while( (rd = read( fd, TB, sizeof(TB) ) ) > 0 ) { | 395 | while( (rd = read( fd, TB, sizeof(TB) ) ) > 0 ) { |
394 | Buf = (char *)realloc( Buf, BufSize+rd ); | 396 | Buf = (char *)realloc( Buf, BufSize+rd ); |
395 | memcpy( Buf+BufSize, TB, rd ); | 397 | memcpy( Buf+BufSize, TB, rd ); |
396 | BufSize += rd; | 398 | BufSize += rd; |
397 | } | 399 | } |
398 | 400 | ||
399 | char * Data = Buf; | 401 | char * Data = Buf; |
400 | char * DataEnd = Data+BufSize-1; | 402 | char * DataEnd = Data+BufSize-1; |
401 | 403 | ||
402 | // get env items out of list | 404 | // get env items out of list |
403 | while( Data < DataEnd ) { | 405 | while( Data < DataEnd ) { |
404 | 406 | ||
405 | EnvVar_t * Run = EV; | 407 | EnvVar_t * Run = EV; |
406 | while( Run->Name ) { | 408 | while( Run->Name ) { |
407 | if( strncmp( Data, Run->Name, Run->Len ) == 0 && | 409 | if( strncmp( Data, Run->Name, Run->Len ) == 0 && |
408 | Data[Run->Len] == '=' | 410 | Data[Run->Len] == '=' |
409 | ) { | 411 | ) { |
410 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); | 412 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); |
411 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = | 413 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = |
412 | strdup( Data ); | 414 | strdup( Data ); |
413 | 415 | ||
414 | if( strcmp( Run->Name, "OPIEDIR" ) == 0 ) { | 416 | if( strcmp( Run->Name, "OPIEDIR" ) == 0 ) { |
415 | // put OPIEDIR in env | 417 | // put OPIEDIR in env |
416 | putenv( CurrentUser.EnvList[CurrentUser.EnvList.size()-1] ); | 418 | putenv( CurrentUser.EnvList[CurrentUser.EnvList.size()-1] ); |
417 | } else if( strcmp( Run->Name, "HOME" ) == 0 ) { | 419 | } else if( strcmp( Run->Name, "HOME" ) == 0 ) { |
418 | CurrentUser.HomeDir = Data+5; | 420 | CurrentUser.HomeDir = Data+5; |
419 | } else if( strcmp( Run->Name, "LOGNAME" ) == 0 ) { | 421 | } else if( strcmp( Run->Name, "LOGNAME" ) == 0 ) { |
420 | CurrentUser.UserName = Data+8; | 422 | CurrentUser.UserName = Data+8; |
421 | } | 423 | } |
422 | break; | 424 | break; |
423 | } | 425 | } |
424 | Run ++; | 426 | Run ++; |
425 | } | 427 | } |
426 | 428 | ||
427 | Data += strlen( Data )+1; | 429 | Data += strlen( Data )+1; |
428 | } | 430 | } |
429 | 431 | ||
430 | free( Buf ); | 432 | free( Buf ); |
431 | 433 | ||
432 | if( ! CurrentUser.UserName.isEmpty() ) { | 434 | if( ! CurrentUser.UserName.isEmpty() ) { |
433 | // find user info | 435 | // find user info |
434 | struct passwd pwd; | 436 | struct passwd pwd; |
435 | struct passwd * pwdres; | 437 | struct passwd * pwdres; |
436 | 438 | ||
437 | if( getpwnam_r( CurrentUser.UserName.latin1(), | 439 | if( getpwnam_r( CurrentUser.UserName.latin1(), |
438 | &pwd, TB, sizeof(TB), &pwdres ) || | 440 | &pwd, TB, sizeof(TB), &pwdres ) || |
439 | pwdres == 0 ) { | 441 | pwdres == 0 ) { |
440 | Log(("Could not determine user %s : %d\n", | 442 | Log(("Could not determine user %s : %d\n", |
441 | CurrentUser.UserName.latin1(), errno )); | 443 | CurrentUser.UserName.latin1(), errno )); |
442 | return; | 444 | return; |
443 | } | 445 | } |
444 | CurrentUser.Uid = pwd.pw_uid; | 446 | CurrentUser.Uid = pwd.pw_uid; |
445 | CurrentUser.Gid = pwd.pw_gid; | 447 | CurrentUser.Gid = pwd.pw_gid; |
446 | } else{ | 448 | } else{ |
447 | CurrentUser.Uid = | 449 | CurrentUser.Uid = |
448 | CurrentUser.Gid = -1; | 450 | CurrentUser.Gid = -1; |
449 | } | 451 | } |
450 | } | 452 | } |
451 | 453 | ||
452 | } else { | 454 | } else { |
453 | char * X; | 455 | char * X; |
454 | QString S; | 456 | QString S; |
455 | 457 | ||
456 | EnvVar_t * Run = EV; | 458 | EnvVar_t * Run = EV; |
457 | while( Run->Name ) { | 459 | while( Run->Name ) { |
458 | 460 | ||
459 | if( ( X = getenv( Run->Name ) ) ) { | 461 | if( ( X = getenv( Run->Name ) ) ) { |
460 | Log(( "Env : %s = %s\n", Run->Name, X )); | 462 | Log(( "Env : %s = %s\n", Run->Name, X )); |
461 | 463 | ||
462 | S.sprintf( "%s=%s", Run->Name, X ); | 464 | S.sprintf( "%s=%s", Run->Name, X ); |
463 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); | 465 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); |
464 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = | 466 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = |
465 | strdup( S.latin1() ); | 467 | strdup( S.latin1() ); |
466 | 468 | ||
467 | if( strcmp( Run->Name, "LOGNAME" ) == 0 ) { | 469 | if( strcmp( Run->Name, "LOGNAME" ) == 0 ) { |
468 | CurrentUser.UserName = X; | 470 | CurrentUser.UserName = X; |
469 | } else if( strcmp( Run->Name, "HOME" ) == 0 ) { | 471 | } else if( strcmp( Run->Name, "HOME" ) == 0 ) { |
470 | CurrentUser.HomeDir = X; | 472 | CurrentUser.HomeDir = X; |
471 | } // regulare env var | 473 | } // regulare env var |
472 | } else { | 474 | } else { |
473 | Log(("Could not determine %s\n", Run->Name )); | 475 | Log(("Could not determine %s\n", Run->Name )); |
474 | } | 476 | } |
475 | Run ++; | 477 | Run ++; |
476 | } | 478 | } |
477 | 479 | ||
478 | CurrentUser.Uid = getuid(); | 480 | CurrentUser.Uid = getuid(); |
479 | CurrentUser.Gid = getgid(); | 481 | CurrentUser.Gid = getgid(); |
480 | } | 482 | } |
481 | } | 483 | } |
diff --git a/noncore/settings/networksettings2/ppp/ppp_NN.cpp b/noncore/settings/networksettings2/ppp/ppp_NN.cpp index 884168c..6c1387d 100644 --- a/noncore/settings/networksettings2/ppp/ppp_NN.cpp +++ b/noncore/settings/networksettings2/ppp/ppp_NN.cpp | |||
@@ -1,83 +1,83 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <resources.h> | 2 | #include <resources.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include "ppp_NN.h" | 4 | #include "ppp_NN.h" |
5 | #include "ppp_NNI.h" | 5 | #include "ppp_NNI.h" |
6 | 6 | ||
7 | #include "netnodeinterface.h" | 7 | #include "netnodeinterface.h" |
8 | 8 | ||
9 | QStringList * PPPNetNode::ProperFiles = 0; | 9 | QStringList * PPPNetNode::ProperFiles = 0; |
10 | 10 | ||
11 | static const char * PPPNeeds[] = | 11 | static const char * PPPNeeds[] = |
12 | { "modem", | 12 | { "modem", |
13 | 0 | 13 | 0 |
14 | }; | 14 | }; |
15 | 15 | ||
16 | static const char * PPPProvides[] = | 16 | static const char * PPPProvides[] = |
17 | { "NetworkSetup", | 17 | { "connection", |
18 | 0 | 18 | 0 |
19 | }; | 19 | }; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Constructor, find all of the possible interfaces | 22 | * Constructor, find all of the possible interfaces |
23 | */ | 23 | */ |
24 | PPPNetNode::PPPNetNode() : ANetNode(tr("PPP NetworkSetup")) { | 24 | PPPNetNode::PPPNetNode() : ANetNode(tr("PPP connection")) { |
25 | 25 | ||
26 | NSResources->addSystemFile( | 26 | NSResources->addSystemFile( |
27 | "pap-secrets", "/etc/ppp/pap-secrets", 0 ); | 27 | "pap-secrets", "/etc/ppp/pap-secrets", 0 ); |
28 | NSResources->addSystemFile( | 28 | NSResources->addSystemFile( |
29 | "chap-secrets", "/etc/ppp/chap-secrets", 0 ); | 29 | "chap-secrets", "/etc/ppp/chap-secrets", 0 ); |
30 | } | 30 | } |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Delete any interfaces that we own. | 33 | * Delete any interfaces that we own. |
34 | */ | 34 | */ |
35 | PPPNetNode::~PPPNetNode(){ | 35 | PPPNetNode::~PPPNetNode(){ |
36 | } | 36 | } |
37 | 37 | ||
38 | const QString PPPNetNode::nodeDescription(){ | 38 | const QString PPPNetNode::nodeDescription(){ |
39 | return tr("\ | 39 | return tr("\ |
40 | <p>Sets up IP using PPP.</p>\ | 40 | <p>Sets up IP using PPP.</p>\ |
41 | <p>Use this for dialup devices or serial setups</p>\ | 41 | <p>Use this for dialup devices or serial setups</p>\ |
42 | " | 42 | " |
43 | ); | 43 | ); |
44 | } | 44 | } |
45 | 45 | ||
46 | ANetNodeInstance * PPPNetNode::createInstance( void ) { | 46 | ANetNodeInstance * PPPNetNode::createInstance( void ) { |
47 | return new APPP( this ); | 47 | return new APPP( this ); |
48 | } | 48 | } |
49 | 49 | ||
50 | const char ** PPPNetNode::needs( void ) { | 50 | const char ** PPPNetNode::needs( void ) { |
51 | return PPPNeeds; | 51 | return PPPNeeds; |
52 | } | 52 | } |
53 | 53 | ||
54 | const char ** PPPNetNode::provides( void ) { | 54 | const char ** PPPNetNode::provides( void ) { |
55 | return PPPProvides; | 55 | return PPPProvides; |
56 | } | 56 | } |
57 | 57 | ||
58 | QStringList PPPNetNode::properFiles( void ) { | 58 | QStringList PPPNetNode::properFiles( void ) { |
59 | QStringList SL; | 59 | QStringList SL; |
60 | SL << "peers" << "chatscripts"; | 60 | SL << "peers" << "chatscripts"; |
61 | return SL; | 61 | return SL; |
62 | } | 62 | } |
63 | 63 | ||
64 | // need to generate : | 64 | // need to generate : |
65 | // /etc/ppp/pap-secrets | 65 | // /etc/ppp/pap-secrets |
66 | // /etc/ppp/pap-secrets | 66 | // /etc/ppp/pap-secrets |
67 | bool PPPNetNode::hasDataForFile( SystemFile & S ) { | 67 | bool PPPNetNode::hasDataForFile( SystemFile & S ) { |
68 | return S.name() == "pap-secrets" || | 68 | return S.name() == "pap-secrets" || |
69 | S.name() == "chap-secrets" ; | 69 | S.name() == "chap-secrets" ; |
70 | } | 70 | } |
71 | 71 | ||
72 | QString PPPNetNode::genNic( long NicNr ) { | 72 | QString PPPNetNode::genNic( long NicNr ) { |
73 | QString S; | 73 | QString S; |
74 | return S.sprintf( "ppp%ld", NicNr ); | 74 | return S.sprintf( "ppp%ld", NicNr ); |
75 | } | 75 | } |
76 | 76 | ||
77 | void PPPNetNode::setSpecificAttribute( QString & , QString & ) { | 77 | void PPPNetNode::setSpecificAttribute( QString & , QString & ) { |
78 | } | 78 | } |
79 | 79 | ||
80 | void PPPNetNode::saveSpecificAttribute( QTextStream & ) { | 80 | void PPPNetNode::saveSpecificAttribute( QTextStream & ) { |
81 | } | 81 | } |
82 | 82 | ||
83 | OPIE_NS2_PLUGIN( NetNodeInterface_T<PPPNetNode> ) | 83 | OPIE_NS2_PLUGIN( NetNodeInterface_T<PPPNetNode> ) |
diff --git a/noncore/settings/networksettings2/profile/profile_NN.cpp b/noncore/settings/networksettings2/profile/profile_NN.cpp index 007f4a5..1e6912e 100644 --- a/noncore/settings/networksettings2/profile/profile_NN.cpp +++ b/noncore/settings/networksettings2/profile/profile_NN.cpp | |||
@@ -1,58 +1,58 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | #include "profile_NN.h" | 2 | #include "profile_NN.h" |
3 | #include "profile_NNI.h" | 3 | #include "profile_NNI.h" |
4 | 4 | ||
5 | #include "netnodeinterface.h" | 5 | #include "netnodeinterface.h" |
6 | 6 | ||
7 | static const char * ProfileNeeds[] = | 7 | static const char * ProfileNeeds[] = |
8 | { "NetworkSetup", | 8 | { "connection", |
9 | 0 | 9 | 0 |
10 | }; | 10 | }; |
11 | static const char * ProfileProvides[] = | 11 | static const char * ProfileProvides[] = |
12 | { "fullsetup", | 12 | { "fullsetup", |
13 | 0 | 13 | 0 |
14 | }; | 14 | }; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Constructor, find all of the possible interfaces | 17 | * Constructor, find all of the possible interfaces |
18 | */ | 18 | */ |
19 | ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular NetworkSetup profile")) { | 19 | ProfileNetNode::ProfileNetNode() : ANetNode( tr("Regular connection profile")) { |
20 | 20 | ||
21 | NSResources->addSystemFile( | 21 | NSResources->addSystemFile( |
22 | "interfaces", "/etc/network/interfaces", 1 ); | 22 | "interfaces", "/etc/network/interfaces", 1 ); |
23 | 23 | ||
24 | } | 24 | } |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Delete any interfaces that we own. | 27 | * Delete any interfaces that we own. |
28 | */ | 28 | */ |
29 | ProfileNetNode::~ProfileNetNode(){ | 29 | ProfileNetNode::~ProfileNetNode(){ |
30 | } | 30 | } |
31 | 31 | ||
32 | const QString ProfileNetNode::nodeDescription(){ | 32 | const QString ProfileNetNode::nodeDescription(){ |
33 | return tr("\ | 33 | return tr("\ |
34 | <p>Define use of an IP NetworkSetup.</p>\ | 34 | <p>Define use of an IP connection.</p>\ |
35 | <p>Configure if and when this NetworkSetup needs to be established</p>\ | 35 | <p>Configure if and when this connection needs to be established</p>\ |
36 | " | 36 | " |
37 | ); | 37 | ); |
38 | } | 38 | } |
39 | 39 | ||
40 | ANetNodeInstance * ProfileNetNode::createInstance( void ) { | 40 | ANetNodeInstance * ProfileNetNode::createInstance( void ) { |
41 | return new AProfile( this ); | 41 | return new AProfile( this ); |
42 | } | 42 | } |
43 | 43 | ||
44 | const char ** ProfileNetNode::needs( void ) { | 44 | const char ** ProfileNetNode::needs( void ) { |
45 | return ProfileNeeds; | 45 | return ProfileNeeds; |
46 | } | 46 | } |
47 | 47 | ||
48 | const char ** ProfileNetNode::provides( void ) { | 48 | const char ** ProfileNetNode::provides( void ) { |
49 | return ProfileProvides; | 49 | return ProfileProvides; |
50 | } | 50 | } |
51 | 51 | ||
52 | void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { | 52 | void ProfileNetNode::setSpecificAttribute( QString & , QString & ) { |
53 | } | 53 | } |
54 | 54 | ||
55 | void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { | 55 | void ProfileNetNode::saveSpecificAttribute( QTextStream & ) { |
56 | } | 56 | } |
57 | 57 | ||
58 | OPIE_NS2_PLUGIN( NetNodeInterface_T<ProfileNetNode> ) | 58 | OPIE_NS2_PLUGIN( NetNodeInterface_T<ProfileNetNode> ) |
diff --git a/noncore/settings/networksettings2/usb/usb_NN.cpp b/noncore/settings/networksettings2/usb/usb_NN.cpp index 6e2597c..6d90ae0 100644 --- a/noncore/settings/networksettings2/usb/usb_NN.cpp +++ b/noncore/settings/networksettings2/usb/usb_NN.cpp | |||
@@ -1,60 +1,60 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | #include "usb_NN.h" | 2 | #include "usb_NN.h" |
3 | #include "usb_NNI.h" | 3 | #include "usb_NNI.h" |
4 | 4 | ||
5 | #include "netnodeinterface.h" | 5 | #include "netnodeinterface.h" |
6 | 6 | ||
7 | static const char * USBNeeds[] = | 7 | static const char * USBNeeds[] = |
8 | { 0 | 8 | { 0 |
9 | }; | 9 | }; |
10 | 10 | ||
11 | static const char * USBProvides[] = | 11 | static const char * USBProvides[] = |
12 | { "device", | 12 | { "device", |
13 | 0 | 13 | 0 |
14 | }; | 14 | }; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Constructor, find all of the possible interfaces | 17 | * Constructor, find all of the possible interfaces |
18 | */ | 18 | */ |
19 | USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) { | 19 | USBNetNode::USBNetNode() : ANetNode(tr("USB Cable Connect")) { |
20 | NSResources->addSystemFile( | 20 | NSResources->addSystemFile( |
21 | "interfaces", "/etc/network/interfaces", 1 ); | 21 | "interfaces", "/etc/network/interfaces", 1 ); |
22 | } | 22 | } |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Delete any interfaces that we own. | 25 | * Delete any interfaces that we own. |
26 | */ | 26 | */ |
27 | USBNetNode::~USBNetNode(){ | 27 | USBNetNode::~USBNetNode(){ |
28 | } | 28 | } |
29 | 29 | ||
30 | const QString USBNetNode::nodeDescription(){ | 30 | const QString USBNetNode::nodeDescription(){ |
31 | return tr("\ | 31 | return tr("\ |
32 | <p>Configure Ethernet over USB.</p>\ | 32 | <p>Configure Ethernet over USB.</p>\ |
33 | <p>Use this for a computer to computer USB cable NetworkSetup</p>\ | 33 | <p>Use this for a computer to computer USB cable connection</p>\ |
34 | " | 34 | " |
35 | ); | 35 | ); |
36 | } | 36 | } |
37 | 37 | ||
38 | ANetNodeInstance * USBNetNode::createInstance( void ) { | 38 | ANetNodeInstance * USBNetNode::createInstance( void ) { |
39 | return new AUSB( this ); | 39 | return new AUSB( this ); |
40 | } | 40 | } |
41 | 41 | ||
42 | const char ** USBNetNode::needs( void ) { | 42 | const char ** USBNetNode::needs( void ) { |
43 | return USBNeeds; | 43 | return USBNeeds; |
44 | } | 44 | } |
45 | 45 | ||
46 | const char ** USBNetNode::provides( void ) { | 46 | const char ** USBNetNode::provides( void ) { |
47 | return USBProvides; | 47 | return USBProvides; |
48 | } | 48 | } |
49 | 49 | ||
50 | QString USBNetNode::genNic( long ) { | 50 | QString USBNetNode::genNic( long ) { |
51 | return QString( "usbf" ); | 51 | return QString( "usbf" ); |
52 | } | 52 | } |
53 | 53 | ||
54 | void USBNetNode::setSpecificAttribute( QString & , QString & ) { | 54 | void USBNetNode::setSpecificAttribute( QString & , QString & ) { |
55 | } | 55 | } |
56 | 56 | ||
57 | void USBNetNode::saveSpecificAttribute( QTextStream & ) { | 57 | void USBNetNode::saveSpecificAttribute( QTextStream & ) { |
58 | } | 58 | } |
59 | 59 | ||
60 | OPIE_NS2_PLUGIN( NetNodeInterface_T<USBNetNode> ) | 60 | OPIE_NS2_PLUGIN( NetNodeInterface_T<USBNetNode> ) |
diff --git a/noncore/settings/networksettings2/vpn/vpn_NN.cpp b/noncore/settings/networksettings2/vpn/vpn_NN.cpp index 7c2e77b..beb9215 100644 --- a/noncore/settings/networksettings2/vpn/vpn_NN.cpp +++ b/noncore/settings/networksettings2/vpn/vpn_NN.cpp | |||
@@ -1,52 +1,52 @@ | |||
1 | #include "vpn_NN.h" | 1 | #include "vpn_NN.h" |
2 | #include "vpn_NNI.h" | 2 | #include "vpn_NNI.h" |
3 | 3 | ||
4 | #include "netnodeinterface.h" | 4 | #include "netnodeinterface.h" |
5 | 5 | ||
6 | static const char * VPNNeeds[] = | 6 | static const char * VPNNeeds[] = |
7 | { 0 | 7 | { 0 |
8 | }; | 8 | }; |
9 | 9 | ||
10 | static const char * VPNProvides[] = | 10 | static const char * VPNProvides[] = |
11 | { "NetworkSetup", | 11 | { "connection", |
12 | 0 | 12 | 0 |
13 | }; | 13 | }; |
14 | /** | 14 | /** |
15 | * Constructor, find all of the possible interfaces | 15 | * Constructor, find all of the possible interfaces |
16 | */ | 16 | */ |
17 | VPNNetNode::VPNNetNode() : ANetNode(tr("VPN NetworkSetup")) { | 17 | VPNNetNode::VPNNetNode() : ANetNode(tr("VPN connection")) { |
18 | } | 18 | } |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * Delete any interfaces that we own. | 21 | * Delete any interfaces that we own. |
22 | */ | 22 | */ |
23 | VPNNetNode::~VPNNetNode(){ | 23 | VPNNetNode::~VPNNetNode(){ |
24 | } | 24 | } |
25 | 25 | ||
26 | const QString VPNNetNode::nodeDescription(){ | 26 | const QString VPNNetNode::nodeDescription(){ |
27 | return tr("\ | 27 | return tr("\ |
28 | <p>Configure private IP NetworkSetup.</p>\ | 28 | <p>Configure private IP connection.</p>\ |
29 | <p>Defines Secure tunnels over non secure IP sessions</p>\ | 29 | <p>Defines Secure tunnels over non secure IP sessions</p>\ |
30 | " | 30 | " |
31 | ); | 31 | ); |
32 | } | 32 | } |
33 | 33 | ||
34 | ANetNodeInstance * VPNNetNode::createInstance( void ) { | 34 | ANetNodeInstance * VPNNetNode::createInstance( void ) { |
35 | return new AVPN( this ); | 35 | return new AVPN( this ); |
36 | } | 36 | } |
37 | 37 | ||
38 | const char ** VPNNetNode::needs( void ) { | 38 | const char ** VPNNetNode::needs( void ) { |
39 | return VPNNeeds; | 39 | return VPNNeeds; |
40 | } | 40 | } |
41 | 41 | ||
42 | const char ** VPNNetNode::provides( void ) { | 42 | const char ** VPNNetNode::provides( void ) { |
43 | return VPNProvides; | 43 | return VPNProvides; |
44 | } | 44 | } |
45 | 45 | ||
46 | void VPNNetNode::setSpecificAttribute( QString & , QString & ) { | 46 | void VPNNetNode::setSpecificAttribute( QString & , QString & ) { |
47 | } | 47 | } |
48 | 48 | ||
49 | void VPNNetNode::saveSpecificAttribute( QTextStream & ) { | 49 | void VPNNetNode::saveSpecificAttribute( QTextStream & ) { |
50 | } | 50 | } |
51 | 51 | ||
52 | OPIE_NS2_PLUGIN( NetNodeInterface_T<VPNNetNode> ) | 52 | OPIE_NS2_PLUGIN( NetNodeInterface_T<VPNNetNode> ) |