summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings2/system.cpp7
-rw-r--r--noncore/settings/networksettings2/opie-networksettings2.control2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTSniffGUI.ui15
-rw-r--r--noncore/settings/networksettings2/opietooth2/Opietooth.cpp46
-rw-r--r--noncore/settings/networksettings2/opietooth2/Opietooth.h2
5 files changed, 43 insertions, 29 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp
index 9512579..e642c08 100644
--- a/noncore/settings/networksettings2/networksettings2/system.cpp
+++ b/noncore/settings/networksettings2/networksettings2/system.cpp
@@ -23,48 +23,49 @@
23#include <qapplication.h> 23#include <qapplication.h>
24 24
25#include "resources.h" 25#include "resources.h"
26#include "system.h" 26#include "system.h"
27 27
28#define PROCNETDEV "/proc/net/dev" 28#define PROCNETDEV "/proc/net/dev"
29 29
30#ifndef ARPHRD_IEEE80211 30#ifndef ARPHRD_IEEE80211
31#define ARPHRD_IEEE80211 801 31#define ARPHRD_IEEE80211 801
32#endif 32#endif
33 33
34static char Dig2Hex[] = { 34static char Dig2Hex[] = {
35 '0', '1', '2', '3', 35 '0', '1', '2', '3',
36 '4', '5', '6', '7', 36 '4', '5', '6', '7',
37 '8', '9', 'A', 'B', 37 '8', '9', 'A', 'B',
38 'C', 'D', 'E', 'F' 38 'C', 'D', 'E', 'F'
39}; 39};
40 40
41// get HIGH nibble of byte 41// get HIGH nibble of byte
42#define HN(x) Dig2Hex[(((x)&0xf0)>>4)] 42#define HN(x) Dig2Hex[(((x)&0xf0)>>4)]
43// get LOW nibble of byte 43// get LOW nibble of byte
44#define LN(x) Dig2Hex[((x)&0x0f)] 44#define LN(x) Dig2Hex[((x)&0x0f)]
45 45
46System::System( void ) : QObject(), ProbedInterfaces() { 46System::System( void ) : QObject(), ProbedInterfaces() {
47 ProcDevNet = 0;
47} 48}
48 49
49System::~System( void ) { 50System::~System( void ) {
50 if( ProcDevNet ) 51 if( ProcDevNet )
51 delete ProcDevNet; 52 delete ProcDevNet;
52} 53}
53 54
54QDict<InterfaceInfo> & System::interfaces( void ) { 55QDict<InterfaceInfo> & System::interfaces( void ) {
55 if( ProbedInterfaces.count() == 0 ) { 56 if( ProbedInterfaces.count() == 0 ) {
56 probeInterfaces(); 57 probeInterfaces();
57 } 58 }
58 return ProbedInterfaces; 59 return ProbedInterfaces;
59} 60}
60 61
61int System::runAsRoot( QStringList & S, MyProcess * Prc ) { 62int System::runAsRoot( QStringList & S, MyProcess * Prc ) {
62 char * usr = getenv("USER"); 63 char * usr = getenv("USER");
63 64
64 if( S.count() == 0 ) { 65 if( S.count() == 0 ) {
65 // loophole to start shell 66 // loophole to start shell
66 return 8888; 67 return 8888;
67 } 68 }
68 if( usr == 0 || strcmp( usr, "root" ) ) { 69 if( usr == 0 || strcmp( usr, "root" ) ) {
69 // unknown or non-root user -> use SUDO 70 // unknown or non-root user -> use SUDO
70 S.prepend( "sudo" ); 71 S.prepend( "sudo" );
@@ -88,101 +89,101 @@ int System::runAsRoot( QStringList & S, MyProcess * Prc ) {
88 this, 89 this,
89 SIGNAL( stdoutLine( const QString & ) ) ); 90 SIGNAL( stdoutLine( const QString & ) ) );
90 91
91 connect( P, 92 connect( P,
92 SIGNAL( stderrLine( const QString & ) ), 93 SIGNAL( stderrLine( const QString & ) ),
93 this, 94 this,
94 SIGNAL( stderrLine( const QString & ) ) ); 95 SIGNAL( stderrLine( const QString & ) ) );
95 96
96 connect( P, 97 connect( P,
97 SIGNAL(processExited(MyProcess*) ), 98 SIGNAL(processExited(MyProcess*) ),
98 this, SLOT 99 this, SLOT
99 (SLOT_ProcessExited(MyProcess*) ) ); 100 (SLOT_ProcessExited(MyProcess*) ) );
100 } 101 }
101 102
102 P->process() << S; 103 P->process() << S;
103 104
104 Log(("Executing %s\n", S.join( " " ).latin1() )); 105 Log(("Executing %s\n", S.join( " " ).latin1() ));
105 106
106 if( ! P->process().start( OProcess::DontCare, 107 if( ! P->process().start( OProcess::DontCare,
107 OProcess::AllOutput ) ) { 108 OProcess::AllOutput ) ) {
108 owarn << "Error starting " << S << oendl; 109 owarn << "Error starting " << S << oendl;
109 if( ! Prc ) 110 if( ! Prc )
110 delete P; 111 delete P;
111 // error starting app 112 // error starting app
112 return 1; 113 return 0;
113 } 114 }
114 owarn << "Started " << S << oendl; 115 owarn << "Started " << S << oendl;
115 } 116 }
116 117
117 // all is fine 118 // all is fine
118 return 0; 119 return 1;
119} 120}
120 121
121int System::execAsUser( QStringList & SL ) { 122int System::execAsUser( QStringList & SL ) {
122 MyProcess * P = new MyProcess(); 123 MyProcess * P = new MyProcess();
123 CurrentQPEUser CU = NSResources->currentUser(); 124 CurrentQPEUser CU = NSResources->currentUser();
124 char * usr = getenv("USER"); 125 char * usr = getenv("USER");
125 126
126 if( strcmp( usr, "root" ) == 0 ) { 127 if( strcmp( usr, "root" ) == 0 ) {
127 // find user running qpe 128 // find user running qpe
128 if( CU.UserName.isEmpty() ) { 129 if( CU.UserName.isEmpty() ) {
129 // if we come here, the exec was not successfull 130 // if we come here, the exec was not successfull
130 Log(("User not known \n" )); 131 Log(("User not known \n" ));
131 return 0; 132 return 0;
132 } 133 }
133 } 134 }
134 135
135 // now we are ready to exec the requested command 136 // now we are ready to exec the requested command
136 setuid( CU.Uid ); 137 setuid( CU.Uid );
137 setgid( CU.Gid ); 138 setgid( CU.Gid );
138 139
139 for( unsigned int i = 0 ; i < CU.EnvList.count() ; i ++ ) { 140 for( unsigned int i = 0 ; i < CU.EnvList.count() ; i ++ ) {
140 QString X; 141 QString X;
141 QStringList SL; 142 QStringList SL;
142 X = CU.EnvList[i]; 143 X = CU.EnvList[i];
143 SL = QStringList::split( "=", X ); 144 SL = QStringList::split( "=", X );
144 P->process().setEnvironment( SL[0], SL[1] ); 145 P->process().setEnvironment( SL[0], SL[1] );
145 } 146 }
146 147
147 P->process() << SL; 148 P->process() << SL;
148 149
149 emit processEvent( tr("Command : ") + SL.join( " " ) ); 150 emit processEvent( tr("Command : ") + SL.join( " " ) );
150 151
151 Log(("Executing as user %s : %s\n", 152 Log(("Executing as user %s : %s\n",
152 CU.UserName.latin1(), 153 CU.UserName.latin1(),
153 SL.join( " " ).latin1() )); 154 SL.join( " " ).latin1() ));
154 155
155 int rv = ( P->process().start( OProcess::DontCare, 156 int rv = ( P->process().start( OProcess::DontCare,
156 OProcess::NoCommunication ) ); 157 OProcess::NoCommunication ) );
157 delete P; 158 delete P;
158 159
159 if( rv ) { 160 if( rv ) {
160 // if we come here, the exec was not successfull 161 // if we come here, the exec was not successfull
161 Log(("Could not exec : %d\n", errno )); 162 Log(("Could not exec : %d\n", errno ));
162 } 163 }
163 164
164 return rv; 165 return ! rv;
165} 166}
166 167
167void System::SLOT_ProcessExited( MyProcess * P ) { 168void System::SLOT_ProcessExited( MyProcess * P ) {
168 QString R; 169 QString R;
169 170
170 for( QValueListConstIterator<QCString> it = P->process().args().begin(); 171 for( QValueListConstIterator<QCString> it = P->process().args().begin();
171 it != P->process().args().end(); 172 it != P->process().args().end();
172 ++it ) { 173 ++it ) {
173 R += (*it); 174 R += (*it);
174 R += " "; 175 R += " ";
175 } 176 }
176 177
177 R += "Returned with " + QString().setNum( P->process().exitStatus() ); 178 R += "Returned with " + QString().setNum( P->process().exitStatus() );
178 emit processEvent( R ); 179 emit processEvent( R );
179 delete P; 180 delete P;
180} 181}
181 182
182void System::refreshStatistics( InterfaceInfo & I ) { 183void System::refreshStatistics( InterfaceInfo & I ) {
183 if( ! ProcDevNet ) { 184 if( ! ProcDevNet ) {
184 return; 185 return;
185 } 186 }
186 // cannot seek on dev 187 // cannot seek on dev
187 ProcDevNet->close(); 188 ProcDevNet->close();
188 ProcDevNet->open( IO_ReadOnly ); 189 ProcDevNet->open( IO_ReadOnly );
diff --git a/noncore/settings/networksettings2/opie-networksettings2.control b/noncore/settings/networksettings2/opie-networksettings2.control
index e4bd29c..874833c 100644
--- a/noncore/settings/networksettings2/opie-networksettings2.control
+++ b/noncore/settings/networksettings2/opie-networksettings2.control
@@ -1,10 +1,10 @@
1Package: opie-networksettings2 1Package: opie-networksettings2
2Files: bin/networksettings2 apps/Settings/networksettings2.desktop pics/networksettings2/*.png lib/libnetworksettings2.so* pics/networksettings2/Devices/*.png 2Files: bin/networksettings2 apps/Settings/networksettings2.desktop pics/networksettings2/*.png lib/libnetworksettings2.so* pics/networksettings2/Devices/*.png etc/NS2templates/* etc/NS2templates/*/*
3Priority: optional 3Priority: optional
4Section: opie/settings 4Section: opie/settings
5Maintainer: wim delvaux <wimpie@handhelds.org> 5Maintainer: wim delvaux <wimpie@handhelds.org>
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal, libopietooth2 7Depends: task-opie-minimal, libopietooth2
8Description: Network settings. 8Description: Network settings.
9Replaces: opie-networksetup 9Replaces: opie-networksetup
10Version: $QPE_VERSION$EXTRAVERSION 10Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/settings/networksettings2/opietooth2/OTSniffGUI.ui b/noncore/settings/networksettings2/opietooth2/OTSniffGUI.ui
index 9ef540e..ec0b387 100644
--- a/noncore/settings/networksettings2/opietooth2/OTSniffGUI.ui
+++ b/noncore/settings/networksettings2/opietooth2/OTSniffGUI.ui
@@ -1,56 +1,59 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>OTSniffGUI</class> 2<class>OTSniffGUI</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>OTSniffGUI</cstring> 7 <cstring>OTSniffGUI</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>274</width> 14 <width>274</width>
15 <height>160</height> 15 <height>173</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>Bluetooth Sniffing</string> 20 <string>Bluetooth Sniffing</string>
21 </property> 21 </property>
22 <property> 22 <property>
23 <name>layoutMargin</name> 23 <name>layoutMargin</name>
24 </property> 24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
25 <vbox> 28 <vbox>
26 <property stdset="1"> 29 <property stdset="1">
27 <name>margin</name> 30 <name>margin</name>
28 <number>3</number> 31 <number>3</number>
29 </property> 32 </property>
30 <property stdset="1"> 33 <property stdset="1">
31 <name>spacing</name> 34 <name>spacing</name>
32 <number>6</number> 35 <number>2</number>
33 </property> 36 </property>
34 <widget> 37 <widget>
35 <class>QLayoutWidget</class> 38 <class>QLayoutWidget</class>
36 <property stdset="1"> 39 <property stdset="1">
37 <name>name</name> 40 <name>name</name>
38 <cstring>Layout3</cstring> 41 <cstring>Layout3</cstring>
39 </property> 42 </property>
40 <hbox> 43 <hbox>
41 <property stdset="1"> 44 <property stdset="1">
42 <name>margin</name> 45 <name>margin</name>
43 <number>0</number> 46 <number>0</number>
44 </property> 47 </property>
45 <property stdset="1"> 48 <property stdset="1">
46 <name>spacing</name> 49 <name>spacing</name>
47 <number>6</number> 50 <number>6</number>
48 </property> 51 </property>
49 <widget> 52 <widget>
50 <class>QLabel</class> 53 <class>QLabel</class>
51 <property stdset="1"> 54 <property stdset="1">
52 <name>name</name> 55 <name>name</name>
53 <cstring>TextLabel1</cstring> 56 <cstring>TextLabel1</cstring>
54 </property> 57 </property>
55 <property stdset="1"> 58 <property stdset="1">
56 <name>sizePolicy</name> 59 <name>sizePolicy</name>
@@ -103,56 +106,52 @@
103 <enum>Expanding</enum> 106 <enum>Expanding</enum>
104 </property> 107 </property>
105 <property> 108 <property>
106 <name>sizeHint</name> 109 <name>sizeHint</name>
107 <size> 110 <size>
108 <width>20</width> 111 <width>20</width>
109 <height>20</height> 112 <height>20</height>
110 </size> 113 </size>
111 </property> 114 </property>
112 </spacer> 115 </spacer>
113 <widget> 116 <widget>
114 <class>QCheckBox</class> 117 <class>QCheckBox</class>
115 <property stdset="1"> 118 <property stdset="1">
116 <name>name</name> 119 <name>name</name>
117 <cstring>EnableTrace_CB</cstring> 120 <cstring>EnableTrace_CB</cstring>
118 </property> 121 </property>
119 <property stdset="1"> 122 <property stdset="1">
120 <name>text</name> 123 <name>text</name>
121 <string>Trace</string> 124 <string>Trace</string>
122 </property> 125 </property>
123 </widget> 126 </widget>
124 </hbox> 127 </hbox>
125 </widget> 128 </widget>
126 <widget> 129 <widget>
127 <class>QListBox</class> 130 <class>QTextView</class>
128 <property stdset="1"> 131 <property stdset="1">
129 <name>name</name> 132 <name>name</name>
130 <cstring>Output_LB</cstring> 133 <cstring>Output_TV</cstring>
131 </property>
132 <property stdset="1">
133 <name>selectionMode</name>
134 <enum>NoSelection</enum>
135 </property> 134 </property>
136 </widget> 135 </widget>
137 <widget> 136 <widget>
138 <class>QLayoutWidget</class> 137 <class>QLayoutWidget</class>
139 <property stdset="1"> 138 <property stdset="1">
140 <name>name</name> 139 <name>name</name>
141 <cstring>Layout3</cstring> 140 <cstring>Layout3</cstring>
142 </property> 141 </property>
143 <hbox> 142 <hbox>
144 <property stdset="1"> 143 <property stdset="1">
145 <name>margin</name> 144 <name>margin</name>
146 <number>0</number> 145 <number>0</number>
147 </property> 146 </property>
148 <property stdset="1"> 147 <property stdset="1">
149 <name>spacing</name> 148 <name>spacing</name>
150 <number>6</number> 149 <number>6</number>
151 </property> 150 </property>
152 <widget> 151 <widget>
153 <class>QPushButton</class> 152 <class>QPushButton</class>
154 <property stdset="1"> 153 <property stdset="1">
155 <name>name</name> 154 <name>name</name>
156 <cstring>Save_But</cstring> 155 <cstring>Save_But</cstring>
157 </property> 156 </property>
158 <property stdset="1"> 157 <property stdset="1">
diff --git a/noncore/settings/networksettings2/opietooth2/Opietooth.cpp b/noncore/settings/networksettings2/opietooth2/Opietooth.cpp
index 5a890da..b14cc2f 100644
--- a/noncore/settings/networksettings2/opietooth2/Opietooth.cpp
+++ b/noncore/settings/networksettings2/opietooth2/Opietooth.cpp
@@ -1,48 +1,50 @@
1#include <opie2/odebug.h> 1#include <opie2/odebug.h>
2#include <opie2/oledbox.h> 2#include <opie2/oledbox.h>
3#include <opie2/ofiledialog.h> 3#include <opie2/ofiledialog.h>
4 4
5using namespace Opie::Core; 5using namespace Opie::Core;
6using namespace Opie::Ui; 6using namespace Opie::Ui;
7 7
8#include <qpe/resource.h> 8#include <qpe/resource.h>
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qcheckbox.h> 10#include <qcheckbox.h>
11#include <qcombobox.h> 11#include <qcombobox.h>
12#include <qdialog.h> 12#include <qdialog.h>
13#include <qdir.h> 13#include <qdir.h>
14#include <qfile.h> 14#include <qfile.h>
15#include <qgroupbox.h> 15#include <qgroupbox.h>
16#include <qheader.h> 16#include <qheader.h>
17#include <qlabel.h> 17#include <qlabel.h>
18#include <qlayout.h> 18#include <qlayout.h>
19#include <qlistbox.h> 19#include <qlistbox.h>
20#include <qlistview.h> 20#include <qlistview.h>
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include <qprogressbar.h> 22#include <qprogressbar.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qscrollbar.h>
24#include <qtextstream.h> 25#include <qtextstream.h>
26#include <qtextview.h>
25 27
26#include <Opietooth.h> 28#include <Opietooth.h>
27#include <OTDriver.h> 29#include <OTDriver.h>
28#include <OTPeer.h> 30#include <OTPeer.h>
29#include <OTGateway.h> 31#include <OTGateway.h>
30#include <OTSDPAttribute.h> 32#include <OTSDPAttribute.h>
31#include <OTSDPService.h> 33#include <OTSDPService.h>
32#include <OTInquiry.h> 34#include <OTInquiry.h>
33 35
34#include <system.h> 36#include <system.h>
35 37
36using namespace Opietooth2; 38using namespace Opietooth2;
37 39
38namespace Opietooth2 { 40namespace Opietooth2 {
39 41
40class PeerLVI : public QListViewItem { 42class PeerLVI : public QListViewItem {
41 43
42public : 44public :
43 45
44 PeerLVI( OTPeer * P, QListView * it ) : QListViewItem (it) { 46 PeerLVI( OTPeer * P, QListView * it ) : QListViewItem (it) {
45 Peer = P; 47 Peer = P;
46 } 48 }
47 ~PeerLVI( void ) { 49 ~PeerLVI( void ) {
48 } 50 }
@@ -99,106 +101,118 @@ public :
99 LinkKey = Ch; 101 LinkKey = Ch;
100 } 102 }
101 ~LinkKeyLVI( void ) { 103 ~LinkKeyLVI( void ) {
102 } 104 }
103 105
104 inline int index( void ) 106 inline int index( void )
105 { return LinkKey; } 107 { return LinkKey; }
106 108
107private : 109private :
108 110
109 int LinkKey; 111 int LinkKey;
110}; 112};
111}; 113};
112 114
113// 115//
114// 116//
115// 117//
116// 118//
117// 119//
118 120
119OTSniffing::OTSniffing( QWidget * parent ) : OTSniffGUI( parent ) { 121OTSniffing::OTSniffing( QWidget * parent ) : OTSniffGUI( parent ) {
120 122
121 OT = OTGateway::getOTGateway(); 123 OT = OTGateway::getOTGateway();
122 HciDump = 0; 124 HciDump = 0;
123 Sys = new System();
124} 125}
125 126
126OTSniffing::~OTSniffing() { 127OTSniffing::~OTSniffing() {
127 printf( "CLOSE \n" ); 128 SLOT_Trace( 0 );
128 if ( HciDump ) {
129 HciDump->process().kill();
130 delete HciDump;
131 }
132 delete Sys;
133} 129}
134 130
135void OTSniffing::SLOT_Trace( bool ) { 131void OTSniffing::SLOT_Trace( bool Run ) {
132
133 if( ! Run ) {
134 if ( HciDump ) {
135 HciDump->process().kill();
136 delete HciDump;
137 }
138 HciDump = 0;
139 return;
140 }
141
136 HciDump = new MyProcess(); 142 HciDump = new MyProcess();
137 QStringList SL; 143 QStringList SL;
138 144
139 SL << "hcidump"; 145 SL << "/usr/sbin/hcidump";
140 switch( DataFormat_CB->currentItem() ) { 146 switch( DataFormat_CB->currentItem() ) {
141 case 0 : // Hex 147 case 0 : // Hex
142 SL << "-x"; 148 SL << "-x";
143 break; 149 break;
144 case 1 : // Ascii 150 case 1 : // Ascii
145 SL << "-a"; 151 SL << "-a";
146 break; 152 break;
147 case 2 : // both 153 case 2 : // both
148 SL << "-X"; 154 SL << "-X";
149 break; 155 break;
150 } 156 }
151 157
152 SL << "-i"; 158 SL << "-i";
153 SL << OT->scanWith()->devname(); 159 SL << OT->scanWith()->devname();
154 160
155 connect( HciDump, 161 connect( HciDump,
156 SIGNAL( stdoutLine( const QString & ) ), 162 SIGNAL( stdoutLine( const QString & ) ),
157 this, 163 this,
158 SLOT( SLOT_Show( const QString & ) ) ); 164 SLOT( SLOT_Show( const QString & ) ) );
159 165
160 connect( HciDump, 166 connect( HciDump,
161 SIGNAL(processExited(MyProcess*) ), 167 SIGNAL(processExited(MyProcess*) ),
162 this, 168 this,
163 SLOT( SLOT_ProcessExited(MyProcess*) ) ); 169 SLOT( SLOT_ProcessExited(MyProcess*) ) );
164 170
165 if( ! Sys->runAsRoot( SL, HciDump ) ) { 171 HciDump->process() << SL;
172
173 if( ! HciDump->process().start( OProcess::DontCare,
174 OProcess::AllOutput )
175 ) {
166 QMessageBox::warning(0, 176 QMessageBox::warning(0,
167 tr("Run hcidump"), 177 tr("Run hcidump"),
168 tr("Cannot start %1").arg(SL.join(" ")) 178 tr("Cannot start %1").arg(SL.join(" "))
169 ); 179 );
170 delete HciDump; 180 delete HciDump;
171 HciDump = 0; 181 HciDump = 0;
172 } 182 }
173 183
174} 184}
175 185
176void OTSniffing::SLOT_Show( const QString & S ) { 186void OTSniffing::SLOT_Show( const QString & S ) {
177 printf( "%s\n", S.latin1() ); 187 printf( "%s\n", S.latin1() );
178 Output_LB->insertItem( S ); 188 Output_TV->setText( Output_TV->text() + S + "\n" );
179 Output_LB->setCurrentItem( Output_LB->count()-1 ); 189
180 Output_LB->ensureCurrentVisible(); 190 QScrollBar *scroll = Output_TV->verticalScrollBar();
191 scroll->setValue(scroll->maxValue());
192 //Output_LB->insertItem( S );
193 //Output_LB->setCurrentItem( Output_LB->count()-1 );
194 //Output_LB->ensureCurrentVisible();
181} 195}
182 196
183void OTSniffing::SLOT_ProcessExited( MyProcess * ) { 197void OTSniffing::SLOT_ProcessExited( MyProcess * ) {
184 printf( "Exited\n" ); 198 printf( "Exited\n" );
185 delete HciDump; 199 delete HciDump;
186 HciDump = 0; 200 HciDump = 0;
187} 201}
188 202
189void OTSniffing::SLOT_Save( void ) { 203void OTSniffing::SLOT_Save( void ) {
190 QString S = OFileDialog::getSaveFileName( 204 QString S = OFileDialog::getSaveFileName(
191 OFileSelector::Extended, 205 OFileSelector::Extended,
192 QDir::home().path(), 206 QDir::home().path(),
193 QString::null, 207 QString::null,
194 MimeTypes(), 208 MimeTypes(),
195 this ); 209 this );
196 210
197 if( ! S.isEmpty() ) { 211 if( ! S.isEmpty() ) {
198 QFile F( S ); 212 QFile F( S );
199 if( ! F.open( IO_WriteOnly ) ) { 213 if( ! F.open( IO_WriteOnly ) ) {
200 QMessageBox::warning(0, 214 QMessageBox::warning(0,
201 tr("Save log"), 215 tr("Save log"),
202 tr("Cannot open %1").arg(S) 216 tr("Cannot open %1").arg(S)
203 ); 217 );
204 return; 218 return;
@@ -207,54 +221,56 @@ void OTSniffing::SLOT_Save( void ) {
207 TS << S << endl; 221 TS << S << endl;
208 } 222 }
209} 223}
210 224
211void OTSniffing::SLOT_Load( void ) { 225void OTSniffing::SLOT_Load( void ) {
212 QString S = OFileDialog::getOpenFileName( 226 QString S = OFileDialog::getOpenFileName(
213 OFileSelector::Extended, 227 OFileSelector::Extended,
214 QDir::home().path(), 228 QDir::home().path(),
215 QString::null, 229 QString::null,
216 MimeTypes(), 230 MimeTypes(),
217 this ); 231 this );
218 232
219 if( ! S.isEmpty() ) { 233 if( ! S.isEmpty() ) {
220 QFile F( S ); 234 QFile F( S );
221 if( ! F.open( IO_ReadOnly ) ) { 235 if( ! F.open( IO_ReadOnly ) ) {
222 QMessageBox::warning(0, 236 QMessageBox::warning(0,
223 tr("Save log"), 237 tr("Save log"),
224 tr("Cannot open %1").arg(S) 238 tr("Cannot open %1").arg(S)
225 ); 239 );
226 return; 240 return;
227 } 241 }
228 QTextStream TS ( &F ); 242 QTextStream TS ( &F );
229 SLOT_ClearLog(); 243 SLOT_ClearLog();
230 S = TS.read(); 244 S = TS.read();
231 Output_LB->insertStringList( QStringList::split( "\n", S ) ); 245 // Output_LB->insertStringList( QStringList::split( "\n", S ) );
246 Output_TV->setText( S );
232 } 247 }
233} 248}
234 249
235void OTSniffing::SLOT_ClearLog( void ) { 250void OTSniffing::SLOT_ClearLog( void ) {
236 Output_LB->clear(); 251 // Output_LB->clear();
252 Output_TV->setText( "" );
237} 253}
238 254
239// 255//
240// 256//
241// 257//
242// 258//
243// 259//
244 260
245OTPairing::OTPairing( QWidget * parent, OTIcons * _IC ) : 261OTPairing::OTPairing( QWidget * parent, OTIcons * _IC ) :
246 OTPairingGUI( parent ) { 262 OTPairingGUI( parent ) {
247 263
248 OT = OTGateway::getOTGateway(); 264 OT = OTGateway::getOTGateway();
249 Icons = (_IC ) ? _IC : new OTIcons(); 265 Icons = (_IC ) ? _IC : new OTIcons();
250 MyIcons = (_IC == 0 ); 266 MyIcons = (_IC == 0 );
251 267
252 // unpairing can only be done if bluetooth is disabled 268 // unpairing can only be done if bluetooth is disabled
253 Unpair_But->setEnabled( ! OT->isEnabled() ); 269 Unpair_But->setEnabled( ! OT->isEnabled() );
254 if( ! OT->isEnabled() ) { 270 if( ! OT->isEnabled() ) {
255 Unpair_LBL->hide(); 271 Unpair_LBL->hide();
256 } else { 272 } else {
257 Unpair_LBL->show(); 273 Unpair_LBL->show();
258 } 274 }
259 275
260 // open linkkey file and load pairs 276 // open linkkey file and load pairs
diff --git a/noncore/settings/networksettings2/opietooth2/Opietooth.h b/noncore/settings/networksettings2/opietooth2/Opietooth.h
index 2b20975..e66787f 100644
--- a/noncore/settings/networksettings2/opietooth2/Opietooth.h
+++ b/noncore/settings/networksettings2/opietooth2/Opietooth.h
@@ -1,78 +1,76 @@
1#ifndef OPIETOOTH_H 1#ifndef OPIETOOTH_H
2#define OPIETOOTH_H 2#define OPIETOOTH_H
3 3
4#include <OTIcons.h> 4#include <OTIcons.h>
5 5
6class MyProcess; 6class MyProcess;
7class System;
8 7
9namespace Opie { 8namespace Opie {
10 9
11 namespace Ui { 10 namespace Ui {
12 11
13 class OLedBox; 12 class OLedBox;
14 13
15 }; 14 };
16 15
17}; 16};
18 17
19#include <OTSniffGUI.h> 18#include <OTSniffGUI.h>
20namespace Opietooth2 { 19namespace Opietooth2 {
21 20
22class OTGateway; 21class OTGateway;
23class OTDriver; 22class OTDriver;
24class OTInquiry; 23class OTInquiry;
25class OTPeer; 24class OTPeer;
26class PeerLVI; 25class PeerLVI;
27 26
28class OTSniffing : public OTSniffGUI { 27class OTSniffing : public OTSniffGUI {
29 28
30 Q_OBJECT 29 Q_OBJECT
31 30
32public : 31public :
33 32
34 OTSniffing( QWidget * parent ); 33 OTSniffing( QWidget * parent );
35 ~OTSniffing(); 34 ~OTSniffing();
36 35
37private slots : 36private slots :
38 37
39 void SLOT_Trace( bool ); 38 void SLOT_Trace( bool );
40 void SLOT_ClearLog( void ); 39 void SLOT_ClearLog( void );
41 void SLOT_Load( void ); 40 void SLOT_Load( void );
42 void SLOT_Save( void ); 41 void SLOT_Save( void );
43 void SLOT_ProcessExited( MyProcess * ); 42 void SLOT_ProcessExited( MyProcess * );
44 void SLOT_Show( const QString & ); 43 void SLOT_Show( const QString & );
45 44
46signals : 45signals :
47 46
48protected : 47protected :
49 48
50private : 49private :
51 50
52 OTGateway * OT; 51 OTGateway * OT;
53 MyProcess * HciDump; 52 MyProcess * HciDump;
54 System * Sys;
55}; 53};
56}; 54};
57 55
58#include <OTPairingGUI.h> 56#include <OTPairingGUI.h>
59 57
60namespace Opietooth2 { 58namespace Opietooth2 {
61class OTPairing : public OTPairingGUI { 59class OTPairing : public OTPairingGUI {
62 60
63 Q_OBJECT 61 Q_OBJECT
64 62
65public : 63public :
66 64
67 OTPairing( QWidget * parent, 65 OTPairing( QWidget * parent,
68 OTIcons * _Ic = 0 ); 66 OTIcons * _Ic = 0 );
69 ~OTPairing(); 67 ~OTPairing();
70 68
71private slots : 69private slots :
72 70
73 void SLOT_Unpair( void ); 71 void SLOT_Unpair( void );
74 72
75signals : 73signals :
76 74
77protected : 75protected :
78 76