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 @@ -45,4 +45,5 @@ static char Dig2Hex[] = { System::System( void ) : QObject(), ProbedInterfaces() { + ProcDevNet = 0; } @@ -110,5 +111,5 @@ int System::runAsRoot( QStringList & S, MyProcess * Prc ) { delete P; // error starting app - return 1; + return 0; } owarn << "Started " << S << oendl; @@ -116,5 +117,5 @@ int System::runAsRoot( QStringList & S, MyProcess * Prc ) { // all is fine - return 0; + return 1; } @@ -162,5 +163,5 @@ int System::execAsUser( QStringList & SL ) { } - return rv; + return ! rv; } 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,4 +1,4 @@ Package: opie-networksettings2 -Files: bin/networksettings2 apps/Settings/networksettings2.desktop pics/networksettings2/*.png lib/libnetworksettings2.so* pics/networksettings2/Devices/*.png +Files: bin/networksettings2 apps/Settings/networksettings2.desktop pics/networksettings2/*.png lib/libnetworksettings2.so* pics/networksettings2/Devices/*.png etc/NS2templates/* etc/NS2templates/*/* Priority: optional Section: opie/settings 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 @@ -13,5 +13,5 @@ <y>0</y> <width>274</width> - <height>160</height> + <height>173</height> </rect> </property> @@ -23,4 +23,7 @@ <name>layoutMargin</name> </property> + <property> + <name>layoutSpacing</name> + </property> <vbox> <property stdset="1"> @@ -30,5 +33,5 @@ <property stdset="1"> <name>spacing</name> - <number>6</number> + <number>2</number> </property> <widget> @@ -125,12 +128,8 @@ </widget> <widget> - <class>QListBox</class> + <class>QTextView</class> <property stdset="1"> <name>name</name> - <cstring>Output_LB</cstring> - </property> - <property stdset="1"> - <name>selectionMode</name> - <enum>NoSelection</enum> + <cstring>Output_TV</cstring> </property> </widget> 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 @@ -22,5 +22,7 @@ using namespace Opie::Ui; #include <qprogressbar.h> #include <qpushbutton.h> +#include <qscrollbar.h> #include <qtextstream.h> +#include <qtextview.h> #include <Opietooth.h> @@ -121,21 +123,25 @@ OTSniffing::OTSniffing( QWidget * parent ) : OTSniffGUI( parent ) { OT = OTGateway::getOTGateway(); HciDump = 0; - Sys = new System(); } OTSniffing::~OTSniffing() { - printf( "CLOSE \n" ); - if ( HciDump ) { - HciDump->process().kill(); - delete HciDump; - } - delete Sys; + SLOT_Trace( 0 ); } -void OTSniffing::SLOT_Trace( bool ) { +void OTSniffing::SLOT_Trace( bool Run ) { + + if( ! Run ) { + if ( HciDump ) { + HciDump->process().kill(); + delete HciDump; + } + HciDump = 0; + return; + } + HciDump = new MyProcess(); QStringList SL; - SL << "hcidump"; + SL << "/usr/sbin/hcidump"; switch( DataFormat_CB->currentItem() ) { case 0 : // Hex @@ -163,5 +169,9 @@ void OTSniffing::SLOT_Trace( bool ) { SLOT( SLOT_ProcessExited(MyProcess*) ) ); - if( ! Sys->runAsRoot( SL, HciDump ) ) { + HciDump->process() << SL; + + if( ! HciDump->process().start( OProcess::DontCare, + OProcess::AllOutput ) + ) { QMessageBox::warning(0, tr("Run hcidump"), @@ -176,7 +186,11 @@ void OTSniffing::SLOT_Trace( bool ) { void OTSniffing::SLOT_Show( const QString & S ) { printf( "%s\n", S.latin1() ); - Output_LB->insertItem( S ); - Output_LB->setCurrentItem( Output_LB->count()-1 ); - Output_LB->ensureCurrentVisible(); + Output_TV->setText( Output_TV->text() + S + "\n" ); + + QScrollBar *scroll = Output_TV->verticalScrollBar(); + scroll->setValue(scroll->maxValue()); + //Output_LB->insertItem( S ); + //Output_LB->setCurrentItem( Output_LB->count()-1 ); + //Output_LB->ensureCurrentVisible(); } @@ -229,10 +243,12 @@ void OTSniffing::SLOT_Load( void ) { SLOT_ClearLog(); S = TS.read(); - Output_LB->insertStringList( QStringList::split( "\n", S ) ); + // Output_LB->insertStringList( QStringList::split( "\n", S ) ); + Output_TV->setText( S ); } } void OTSniffing::SLOT_ClearLog( void ) { - Output_LB->clear(); + // Output_LB->clear(); + Output_TV->setText( "" ); } 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 @@ -5,5 +5,4 @@ class MyProcess; -class System; namespace Opie { @@ -52,5 +51,4 @@ private : OTGateway * OT; MyProcess * HciDump; - System * Sys; }; }; |