summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/.cvsignore29
-rw-r--r--noncore/settings/networksettings2/main.cpp3
2 files changed, 31 insertions, 1 deletions
diff --git a/noncore/settings/networksettings2/.cvsignore b/noncore/settings/networksettings2/.cvsignore
new file mode 100644
index 0000000..e000724
--- a/dev/null
+++ b/noncore/settings/networksettings2/.cvsignore
@@ -0,0 +1,29 @@
1*.moc
2*.moc.o
3*.o
4.deps
5.libs
6.moc.cpp
7.moc.o
8.o
9Makefile*
10addconnection.cpp
11addconnection.h
12interfaceadvanced.cpp
13interfaceadvanced.h
14interfaceinformation.cpp
15interfaceinformation.h
16interfacesetup.cpp
17interfacesetup.h
18mainwindow.cpp
19mainwindow.h
20moc_*.cpp
21networksetup
22systemadvanced.cpp
23systemadvanced.h
24hosts.h
25hosts.cpp
26vpn.h
27vpn.cpp
28dns.h
29dns.cpp
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp
index e2c00f6..30d1270 100644
--- a/noncore/settings/networksettings2/main.cpp
+++ b/noncore/settings/networksettings2/main.cpp
@@ -1,132 +1,133 @@
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 4
5#include <qpe/qpeapplication.h> 5#include <qpe/qpeapplication.h>
6 6
7#include <opie/oapplicationfactory.h> 7#include <opie2/oapplicationfactory.h>
8using namespace Opie::Core;
8 9
9#ifdef GONE 10#ifdef GONE
10 11
11OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> ) 12OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
12 13
13#else 14#else
14 15
15// just standard GUI 16// just standard GUI
16#define ACT_GUI 0 17#define ACT_GUI 0
17// used by interfaces to request for allow of up/down 18// used by interfaces to request for allow of up/down
18#define ACT_REQUEST 1 19#define ACT_REQUEST 1
19// regenerate config files 20// regenerate config files
20#define ACT_REGEN 2 21#define ACT_REGEN 2
21// used by interfaces to request user prompt 22// used by interfaces to request user prompt
22#define ACT_PROMPT 3 23#define ACT_PROMPT 3
23 24
24int main( int argc, char * argv[] ) { 25int main( int argc, char * argv[] ) {
25 int rv = 0; 26 int rv = 0;
26 int Action = ACT_GUI; 27 int Action = ACT_GUI;
27 // could be overruled by -qws 28 // could be overruled by -qws
28 QApplication::Type GuiType = QApplication::GuiClient; 29 QApplication::Type GuiType = QApplication::GuiClient;
29 30
30#ifdef _WS_QWS_ 31#ifdef _WS_QWS_
31 QPEApplication * TheApp; 32 QPEApplication * TheApp;
32#else 33#else
33 QApplication * TheApp; 34 QApplication * TheApp;
34#endif 35#endif
35 36
36 for ( int i = 1; i < argc; i ++ ) { 37 for ( int i = 1; i < argc; i ++ ) {
37 int rmv; 38 int rmv;
38 rmv = 0; 39 rmv = 0;
39 if( strcmp( argv[i], "--regen" ) == 0 ) { 40 if( strcmp( argv[i], "--regen" ) == 0 ) {
40 Action = ACT_REGEN; 41 Action = ACT_REGEN;
41 GuiType = QApplication::Tty; 42 GuiType = QApplication::Tty;
42 rmv = 1; 43 rmv = 1;
43 } else if( strcmp( argv[i], "--prompt" ) == 0 ) { 44 } else if( strcmp( argv[i], "--prompt" ) == 0 ) {
44 Action = ACT_PROMPT; 45 Action = ACT_PROMPT;
45 rmv = 1; 46 rmv = 1;
46 } 47 }
47 if( rmv ) { 48 if( rmv ) {
48 memmove( argv+i, argv+i+rmv, 49 memmove( argv+i, argv+i+rmv,
49 sizeof( char * ) * (argc-i-rmv) ); 50 sizeof( char * ) * (argc-i-rmv) );
50 i --; 51 i --;
51 argc -= rmv; 52 argc -= rmv;
52 } 53 }
53 } 54 }
54 55
55 if( strstr( argv[0], "-request" ) ) { 56 if( strstr( argv[0], "-request" ) ) {
56 // called from system to request something 57 // called from system to request something
57 GuiType = QApplication::Tty; 58 GuiType = QApplication::Tty;
58 Action = ACT_REQUEST; 59 Action = ACT_REQUEST;
59 } 60 }
60 61
61 // Start Qt 62 // Start Qt
62#ifdef _WS_QWS_ 63#ifdef _WS_QWS_
63 // because QPEApplication does not handle GuiType well 64 // because QPEApplication does not handle GuiType well
64 if( GuiType == QApplication::Tty ) { 65 if( GuiType == QApplication::Tty ) {
65 // this cast is NOT correct but we do not use 66 // this cast is NOT correct but we do not use
66 // TheApp anymore ... 67 // TheApp anymore ...
67 TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType ); 68 TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType );
68 } else { 69 } else {
69 TheApp = new QPEApplication( argc, argv, GuiType ); 70 TheApp = new QPEApplication( argc, argv, GuiType );
70 } 71 }
71#else 72#else
72 TheApp = new QApplication( argc, argv, GuiType ); 73 TheApp = new QApplication( argc, argv, GuiType );
73#endif 74#endif
74 75
75 // init qt with app widget 76 // init qt with app widget
76 77
77 switch( Action ) { 78 switch( Action ) {
78 case ACT_REQUEST : 79 case ACT_REQUEST :
79 { NetworkSettingsData NS; 80 { NetworkSettingsData NS;
80 if( NS.canStart( argv[1] ) ) { 81 if( NS.canStart( argv[1] ) ) {
81 QString S; 82 QString S;
82 S.sprintf( QPEApplication::qpeDir()+ 83 S.sprintf( QPEApplication::qpeDir()+
83 "/bin/networksettings2" ); 84 "/bin/networksettings2" );
84 char * MyArgv[4]; 85 char * MyArgv[4];
85 MyArgv[0] = "networksettings2"; 86 MyArgv[0] = "networksettings2";
86 MyArgv[1] = "--prompt"; 87 MyArgv[1] = "--prompt";
87 MyArgv[2] = argv[1]; 88 MyArgv[2] = argv[1];
88 MyArgv[3] = NULL; 89 MyArgv[3] = NULL;
89 NSResources->system().execAsUser( S, MyArgv ); 90 NSResources->system().execAsUser( S, MyArgv );
90 // if we come here , failed 91 // if we come here , failed
91 printf( "%s-cNN-disallowed", argv[1] ); 92 printf( "%s-cNN-disallowed", argv[1] );
92 } 93 }
93 } 94 }
94 break; 95 break;
95 case ACT_REGEN : 96 case ACT_REGEN :
96 { NetworkSettingsData NS; 97 { NetworkSettingsData NS;
97 // regen returns 0 if OK 98 // regen returns 0 if OK
98 rv = (NS.regenerate()) ? 1 : 0; 99 rv = (NS.regenerate()) ? 1 : 0;
99 } 100 }
100 break; 101 break;
101 case ACT_PROMPT : 102 case ACT_PROMPT :
102 { ActivateProfile AP(argv[1]); 103 { ActivateProfile AP(argv[1]);
103 if( AP.exec() == QDialog::Accepted ) { 104 if( AP.exec() == QDialog::Accepted ) {
104 printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() ); 105 printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() );
105 } else { 106 } else {
106 printf( "%s-cNN-disallowed", argv[1] ); 107 printf( "%s-cNN-disallowed", argv[1] );
107 } 108 }
108 } 109 }
109 break; 110 break;
110 case ACT_GUI : 111 case ACT_GUI :
111 { QWidget * W = new NetworkSettings(0); 112 { QWidget * W = new NetworkSettings(0);
112 TheApp->setMainWidget( W ); 113 TheApp->setMainWidget( W );
113 W->show(); 114 W->show();
114#ifdef _WS_QWS_ 115#ifdef _WS_QWS_
115 W->showMaximized(); 116 W->showMaximized();
116#else 117#else
117 W->resize( W->sizeHint() ); 118 W->resize( W->sizeHint() );
118#endif 119#endif
119 rv = TheApp->exec(); 120 rv = TheApp->exec();
120 delete W; 121 delete W;
121 } 122 }
122 break; 123 break;
123 } 124 }
124 125
125 return rv; 126 return rv;
126} 127}
127 128
128#endif 129#endif
129 130
130 131
131// main.cpp 132// main.cpp
132 133