-rw-r--r-- | libkdepim/phoneaccess.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp index c0bd6cc..357cd39 100644 --- a/libkdepim/phoneaccess.cpp +++ b/libkdepim/phoneaccess.cpp @@ -39,9 +39,9 @@ void PhoneAccess::writeConfig( QString device, QString connection, QString model #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) ) { @@ -52,9 +52,9 @@ void PhoneAccess::writeConfig( QString device, QString connection, QString model 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" ) { content += line ; @@ -92,29 +92,23 @@ void PhoneAccess::writeConfig( QString device, QString connection, QString model 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"; |