diff -r bab96b7ed1a4 -r f39ed5e045e0 phoneuis/bubblemanager2/tsrc/bubbletest2/bubbletester/bubbledata.cpp --- a/phoneuis/bubblemanager2/tsrc/bubbletest2/bubbletester/bubbledata.cpp Tue Jun 15 14:14:38 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/*! -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Animated icon. -* -*/ - -#include -#include -#include -#include "bubbledata.h" - -BubbleData::BubbleData( QObject *parent ) : QObject(parent) -{ - QFile file(":/testdata.xml"); - - if (!file.open(QFile::ReadOnly | QFile::Text)) { - QMessageBox::critical((QWidget*)parent, tr("Bubble tester"), - tr("Cannot read testdata.xml") ); - return; - } - - createDomFromFile(&file); -} - -void BubbleData::createDomFromFile(QIODevice *device) -{ - QString errorStr; - int errorLine; - int errorColumn; - - if (!mDomDocument.setContent(device, true, &errorStr, &errorLine, - &errorColumn)) { - QMessageBox::information((QWidget*)parent(), tr("Bubble tester"), - tr("Parse error at line %1, column %2:\n%3") - .arg(errorLine) - .arg(errorColumn) - .arg(errorStr)); - } -} - -QString BubbleData::dataField( const QString& bubble, const QString& fieldName ) -{ - QString text(""); - QDomElement elem = bubbleElement(bubble); - - if (!elem.isNull()) { - QDomNodeList list = elem.elementsByTagName(fieldName); - - if (list.count()) { - QDomNode node = list.at(0); - if (node.isElement()) { - QDomElement e = node.toElement(); - text = e.text(); - } - } - } - - return text; -} - -QDomElement BubbleData::bubbleElement(const QString& bubble) -{ - QDomNodeList list = mDomDocument.elementsByTagName("bubble"); - - QDomElement elem; - - for (int i=0; i