author | harlekin <harlekin> | 2002-06-28 16:46:52 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-28 16:46:52 (UTC) |
commit | 986a23a683f53ab612be03b56dd9bc7c1aeb3651 (patch) (side-by-side diff) | |
tree | 6447f2738d30aff40126b327272effdf8745597b | |
parent | e72d93a703f4b38109f8f02ec96a759d93b8f91c (diff) | |
download | opie-986a23a683f53ab612be03b56dd9bc7c1aeb3651.zip opie-986a23a683f53ab612be03b56dd9bc7c1aeb3651.tar.gz opie-986a23a683f53ab612be03b56dd9bc7c1aeb3651.tar.bz2 |
update
-rw-r--r-- | noncore/net/opietooth/manager/hciconfwrapper.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/noncore/net/opietooth/manager/hciconfwrapper.cpp b/noncore/net/opietooth/manager/hciconfwrapper.cpp index db6a326..7b2497a 100644 --- a/noncore/net/opietooth/manager/hciconfwrapper.cpp +++ b/noncore/net/opietooth/manager/hciconfwrapper.cpp @@ -46,70 +46,69 @@ namespace OpieTooth { void HciConfWrapper::setAuth( bool enable) { if ( enable ) { setValue( "auth" , "enable" ); } else { setValue( "auth" , "disable" ); } } void HciConfWrapper::setEncrypt( bool enable) { if ( enable ) { setValue( "encrypt" , "enable" ); } else { setValue( "encrypt" , "disable" ); } } void HciConfWrapper::setValue(const QString &key, const QString &value ) { QFile f( m_fileName ); QFile f2( m_fileName ); if ( !f.open( IO_ReadOnly) ) { qDebug("Could not open readonly"); return; } if ( !f2.open( IO_ReadWrite ) ) { qDebug("Just readonly - not enough"); return; } QStringList list; qDebug(m_fileName); QTextStream stream ( &f); QTextStream outstream (&f2); QString str; while ( !(str=stream.readLine()).isNull() ) { //qDebug(str); if( (str.contains(key)) > 0 ) { qDebug("Found"); - // still need look if its commented out!!! + // still need to look if its commented out!!! str.simplifyWhiteSpace(); qDebug( key ); if (str.startsWith("#")) { - outstream << (key + " " + value + ";\n"); + str = (key + " " + value + ";"); } else { - str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";\n"); + str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";"); } qDebug( str ); - outstream << str; - } else { - outstream << str + "\n"; } + + outstream << str << endl; } f.close(); f2.flush(); f2.close(); } } |