Merge branch 'dev_itkonma'
[qtmeetings] / src / Domain / Configuration / Configuration.cpp
index 9872192..2a33998 100644 (file)
@@ -158,37 +158,37 @@ void Configuration::saveConnectionSettings( const QDomNode &aXML )
                if ( tagName == QString( "serverurl" ) )
                {
                        QDomText t = node.ownerDocument().createTextNode( iConnectionSettings->serverUrl().toString() );
-                       if ( e.childNodes().length() == 0 )
+                       if ( e.hasChildNodes() )
                        {
-                               e.appendChild( t );
+                               e.replaceChild( t, e.firstChild() );
                        }
                        else
                        {
-                               e.replaceChild( t, e.firstChild() );
+                               e.appendChild( e.firstChild() );
                        }
                }
                else if ( tagName == QString( "username" ) )
                {
                        QDomText t = node.ownerDocument().createTextNode( iConnectionSettings->username() );
-                       if ( e.childNodes().length() == 0 )
+                       if ( e.hasChildNodes() )
                        {
-                               e.appendChild( t );
+                               e.replaceChild( t, e.firstChild() );
                        }
                        else
                        {
-                               e.replaceChild( t, e.firstChild() );
+                               e.appendChild( e.firstChild() );
                        }
                }
                else if ( tagName == QString( "password" ) )
                {
                        QDomText t = node.ownerDocument().createTextNode( iConnectionSettings->password() );
-                       if ( e.childNodes().length() == 0 )
+                       if ( e.hasChildNodes() )
                        {
-                               e.appendChild( t );
+                               e.replaceChild( t, e.firstChild() );
                        }
                        else
                        {
-                               e.replaceChild( t, e.firstChild() );
+                               e.appendChild( e.firstChild() );
                        }
                }
                else if ( tagName == QString( "refreshinterval" ) )
@@ -202,7 +202,6 @@ 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; 
@@ -218,12 +217,13 @@ void Configuration::saveRooms( const QDomNode &aXML )
                node = root.removeChild(node);
                node = next;
        }
+
+       node = aXML;
        QList<Room*>::iterator i;
        for ( i = iRooms.begin(); i != iRooms.end(); ++i )
        {
                QDomElement tag = doc.createElement( "room" );
-               qDebug() << "write room: " << ( *i )->name() << " to node " << node.toElement().tagName();
-               root.appendChild( tag );
+               node.appendChild( tag );
 
                // First room in the list is a dafault room
                if ( i == iRooms.begin() )
@@ -463,7 +463,6 @@ QList<Room*> Configuration::readRooms( const QDomNode &aXML )
                                if ( tagName == QString( "name" ) )
                                {
                                        name = roomElem.text();
-                                       qDebug() << "got room: " << name;
                                }
                                else if ( tagName == QString( "address" ) )
                                {