author | wimpie <wimpie> | 2005-01-05 02:42:18 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-05 02:42:18 (UTC) |
commit | bf65cf9aeb5dddcc4b0c0d702afd748d97e95d5e (patch) (side-by-side diff) | |
tree | ec61a57a8ace5c74e6cae46a676f40d849f4b9b1 /noncore/settings/networksettings2/opietooth2/OTGateway.cpp | |
parent | 2f343aab63dd30e97a893e3691501cdd55114e82 (diff) | |
download | opie-bf65cf9aeb5dddcc4b0c0d702afd748d97e95d5e.zip opie-bf65cf9aeb5dddcc4b0c0d702afd748d97e95d5e.tar.gz opie-bf65cf9aeb5dddcc4b0c0d702afd748d97e95d5e.tar.bz2 |
Slightly better layout for OTMainGUI.
Fixed segfault bug in disconnectNotify call (signal string could be NULL)
Diffstat (limited to 'noncore/settings/networksettings2/opietooth2/OTGateway.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/opietooth2/OTGateway.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp index 2d13ce9..6531cf6 100644 --- a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp +++ b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp @@ -123,103 +123,103 @@ OTDevice * OTGateway::getOTDevice( ) { // start bluetooth (if stopped) // return TRUE if started void OTGateway::SLOT_SetEnabled( bool Mode ) { if( Mode ) { SLOT_Enable(); return; } SLOT_Disable(); } void OTGateway::SLOT_Enable() { getOTDevice()->attach(); } void OTGateway::SLOT_Disable() { getOTDevice()->detach(); } bool OTGateway::needsEnabling() { return getOTDevice()->needsAttach(); } bool OTGateway::isEnabled() { if( getOTDevice()->deviceNr() >= 0 && driver( getOTDevice()->deviceNr() )->isUp() ) return TRUE; // else check system return getOTDevice()->isAttached(); } void OTGateway::SLOT_ShowError( const QString & S ) { owarn << S << oendl; if( ErrorConnectCount > 0 ) { // pass error emit error( QString( "<p>" ) + S + "</p>" ); return; } QMessageBox::warning( 0, tr("OTGateway error"), S ); } void OTGateway::connectNotify( const char * S ) { - if( strcmp( S, "error(const QString&)" ) == 0 ) { + if( S && strcmp( S, "error(const QString&)" ) == 0 ) { ErrorConnectCount ++; } } void OTGateway::disconnectNotify( const char * S ) { - if( strcmp( S, "error(const QString&)" ) == 0 ) { + if( S && strcmp( S, "error(const QString&)" ) == 0 ) { ErrorConnectCount --; } } void OTGateway::timerEvent( QTimerEvent * ) { OTDriver * D; unsigned int oldc = AllDrivers.count(); bool old; AllDrivers.update(); if( oldc != AllDrivers.count() ) { updateDrivers(); } else { for( unsigned int i = 0; i < AllDrivers.count(); i ++ ) { D = AllDrivers[i]; old = D->isUp(); if( D->currentState() >= 0 ) { if( old != D->isUp() ) { emit stateChange( D, D->isUp() ); } } else { // if one driver is unable to provide info // we refresh all devices updateDrivers(); return; } } } } void OTGateway::SLOT_Enabled( int id, bool Up ) { owarn << "device " << id << " state " << Up << oendl; if( Up ) { // device is up -> detect it updateDrivers(); if( (unsigned)id >= AllDrivers.count() ) { // to make sure that the driver really IS detected AllDrivers[id]->bringUp(); } } // if DOWN device already down emit deviceEnabled( Up ); } void OTGateway::updateDrivers( void ) { |