- QFile file (xmlFile);
- if (file.exists() && file.open(IO_ReadOnly)) {
- file.close();
-
- SMESHGUI_XmlHandler* aXmlHandler = new SMESHGUI_XmlHandler();
- ASSERT(aXmlHandler);
-
- QXmlInputSource source (file);
- QXmlSimpleReader reader;
- reader.setContentHandler(aXmlHandler);
- reader.setErrorHandler(aXmlHandler);
- bool ok = reader.parse(source);
- file.close();
- if (ok) {
- myHypothesesMap.insert( aXmlHandler->myHypothesesMap.begin(),
- aXmlHandler->myHypothesesMap.end() );
- myAlgorithmsMap.insert( aXmlHandler->myAlgorithmsMap.begin(),
- aXmlHandler->myAlgorithmsMap.end() );
- myListOfHypothesesSets.splice( myListOfHypothesesSets.begin(),
- aXmlHandler->myListOfHypothesesSets );
- }
- else {
- SUIT_MessageBox::error1(SMESHGUI::desktop(),
- QObject::tr("INF_PARSE_ERROR"),
- QObject::tr(aXmlHandler->errorProtocol()),
- QObject::tr("SMESH_BUT_OK"));
- }
- }
- else {
- if (aNoAccessFiles.isEmpty())
- aNoAccessFiles = xmlFile;
- else
- aNoAccessFiles += ", " + xmlFile;
- }
+ QFile file (xmlFile);
+ if (file.exists() && file.open(QIODevice::ReadOnly)) {
+ file.close();
+
+ SMESHGUI_XmlHandler* aXmlHandler = new SMESHGUI_XmlHandler();
+ ASSERT(aXmlHandler);
+
+ QXmlInputSource source (&file);
+ QXmlSimpleReader reader;
+ reader.setContentHandler(aXmlHandler);
+ reader.setErrorHandler(aXmlHandler);
+ bool ok = reader.parse(source);
+ file.close();
+ if (ok) {
+ myHypothesesMap.unite( aXmlHandler->myHypothesesMap );
+ myAlgorithmsMap.unite( aXmlHandler->myAlgorithmsMap );
+ QList<HypothesesSet*>::iterator it, pos = myListOfHypothesesSets.begin();
+ for ( it = aXmlHandler->myListOfHypothesesSets.begin();
+ it != aXmlHandler->myListOfHypothesesSets.end();
+ ++it ) {
+ myListOfHypothesesSets.insert( pos, *it );
+ }
+ }
+ else {
+ SUIT_MessageBox::critical(SMESHGUI::desktop(),
+ QObject::tr("INF_PARSE_ERROR"),
+ QObject::tr(aXmlHandler->errorProtocol().toLatin1().data()));
+ }
+ delete aXmlHandler;
+ }
+ else {
+ if (aNoAccessFiles.isEmpty())
+ aNoAccessFiles = xmlFile;
+ else
+ aNoAccessFiles += ", " + xmlFile;
+ }