author | zautrix <zautrix> | 2004-10-06 19:41:10 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-06 19:41:10 (UTC) |
commit | be3a5ea82c9a160eeeaad187a357c9a085fdb20a (patch) (side-by-side diff) | |
tree | 933c685c84430f5c19a0657239b5c8b50a88de05 /libkdepim | |
parent | 656636acfb8c607901c97c4f55129e29e1df9913 (diff) | |
download | kdepimpi-be3a5ea82c9a160eeeaad187a357c9a085fdb20a.zip kdepimpi-be3a5ea82c9a160eeeaad187a357c9a085fdb20a.tar.gz kdepimpi-be3a5ea82c9a160eeeaad187a357c9a085fdb20a.tar.bz2 |
bugfixes
-rw-r--r-- | libkdepim/phoneaccess.cpp | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp index c0bd6cc..357cd39 100644 --- a/libkdepim/phoneaccess.cpp +++ b/libkdepim/phoneaccess.cpp @@ -27,33 +27,33 @@ #include <qfile.h> #include <qtextstream.h> #include <qtextcodec.h> #include <qdir.h> #include <kmessagebox.h> #include <stdlib.h> #include "phoneaccess.h" void PhoneAccess::writeConfig( QString device, QString connection, QString model ) { #ifdef _WIN32_ QString fileName = qApp->applicationDirPath () +"\\gammurc"; #else QString fileName = QDir::homeDirPath() +"/.gammurc"; #endif //qDebug("save %d ", load ); - QString content; + QString content = "[gammu]\n";; bool write = false; bool addPort = true, addConnection = true, addModel = true; QFile file( fileName ); if ( QFile::exists( fileName) ) { if (!file.open( IO_ReadOnly ) ) { qDebug("Error: cannot open %s ", fileName.latin1() ); return; } QString line; while ( file.readLine( line, 1024 ) > 0 ) { //qDebug("*%s* ", line.latin1() ); if ( line.left(7 ) == "[gammu]" ) { ; } else if ( line.left(4 ) == "port" ) { if ( line == "port = " + device+"\n" ) { @@ -82,51 +82,45 @@ void PhoneAccess::writeConfig( QString device, QString connection, QString model } file.close(); } else { if ( ! connection.isEmpty() ) { addConnection = true; } if ( ! device.isEmpty() ) { addPort = true; } if ( ! model.isEmpty() ) { addModel = true; } } if ( addConnection ) { - if ( ! write ) - content += "[gammu]\n"; write = true; content += "connection = "; content += connection; content += "\n"; } if ( addPort ) { - if ( ! write ) - content += "[gammu]\n"; write = true; content += "port = "; content += device; content += "\n"; } if ( addModel ) { - if ( ! write ) - content += "[gammu]\n"; write = true; content += "model = "; content += model; content += "\n"; } if ( write ) { if (!file.open( IO_WriteOnly ) ) { qDebug("Error: cannot write file %s ", fileName.latin1() ); return; } qDebug("Writing file %s ", fileName.latin1() ); QTextStream ts( &file ); ts << content ; file.close(); } |