X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2FDomain%2FConfiguration%2FConfiguration.cpp;h=9872192283a2bb98034c42f364f041826d832647;hb=904796ae12788d3192c28fb259c96f92c14cbb9c;hp=0076e232702db8857725af968e2c4f730ba3fc02;hpb=83a9dd48d2482f6418c3ee24ddc994b723a1ef9f;p=qtmeetings diff --git a/src/Domain/Configuration/Configuration.cpp b/src/Domain/Configuration/Configuration.cpp index 0076e23..9872192 100644 --- a/src/Domain/Configuration/Configuration.cpp +++ b/src/Domain/Configuration/Configuration.cpp @@ -155,21 +155,41 @@ void Configuration::saveConnectionSettings( const QDomNode &aXML ) { QDomElement e = node.toElement(); QString tagName = e.tagName().toLower(); - if ( tagName == QString( "serverurl" ) ) { QDomText t = node.ownerDocument().createTextNode( iConnectionSettings->serverUrl().toString() ); - e.replaceChild( t, e.firstChild() ); + if ( e.childNodes().length() == 0 ) + { + e.appendChild( t ); + } + else + { + e.replaceChild( t, e.firstChild() ); + } } else if ( tagName == QString( "username" ) ) { QDomText t = node.ownerDocument().createTextNode( iConnectionSettings->username() ); - e.replaceChild( t, e.firstChild() ); + if ( e.childNodes().length() == 0 ) + { + e.appendChild( t ); + } + else + { + e.replaceChild( t, e.firstChild() ); + } } else if ( tagName == QString( "password" ) ) { QDomText t = node.ownerDocument().createTextNode( iConnectionSettings->password() ); - e.replaceChild( t, e.firstChild() ); + if ( e.childNodes().length() == 0 ) + { + e.appendChild( t ); + } + else + { + e.replaceChild( t, e.firstChild() ); + } } else if ( tagName == QString( "refreshinterval" ) ) { @@ -182,6 +202,7 @@ void Configuration::saveConnectionSettings( const QDomNode &aXML ) void Configuration::saveRooms( const QDomNode &aXML ) { + qDebug() << "saveRooms"; //! List of rooms must be cleared and rewritten again QDomDocument doc = aXML.ownerDocument(); QDomNode root = aXML; @@ -190,19 +211,19 @@ void Configuration::saveRooms( const QDomNode &aXML ) int count = root.childNodes().count(); QDomNode node = root.firstChild(); QDomNode next; - for (int i=0; i::iterator i; for ( i = iRooms.begin(); i != iRooms.end(); ++i ) { QDomElement tag = doc.createElement( "room" ); - node.appendChild( tag ); + qDebug() << "write room: " << ( *i )->name() << " to node " << node.toElement().tagName(); + root.appendChild( tag ); // First room in the list is a dafault room if ( i == iRooms.begin() ) @@ -442,6 +463,7 @@ QList Configuration::readRooms( const QDomNode &aXML ) if ( tagName == QString( "name" ) ) { name = roomElem.text(); + qDebug() << "got room: " << name; } else if ( tagName == QString( "address" ) ) { @@ -619,7 +641,7 @@ DateTimeSettings * Configuration::readDateTimeSettings( const QDomNode &aXML ) bool success = false; unsigned int weekDayTmp = e.text().toUInt( &success ); - if( success && weekDayTmp >= 0 && weekDayTmp < 7) + if( success && weekDayTmp < 7 ) { dayOfWeek = (DateTimeSettings::weekDay)weekDayTmp; }