xml.cpp
author insilmaril
Fri, 29 Dec 2006 13:52:17 +0000
changeset 413 c3f7beb4e9f4
parent 412 8059b6aa74d7
child 421 5522d1da7e37
permissions -rw-r--r--
Removed some FIXMEs. Added translations
     1 #include "xml.h"
     2 
     3 #include <QMessageBox>
     4 #include <QColor>
     5 #include <QTextStream>
     6 #include <iostream>
     7 
     8 #include "misc.h"
     9 #include "settings.h"
    10 #include "linkablemapobj.h"
    11 #include "version.h"
    12 
    13 static BranchObj *lastBranch;
    14 static FloatObj *lastFloat;
    15 static OrnamentedObj *lastOO;
    16 
    17 extern Settings settings;
    18 extern QString vymVersion;
    19 
    20 mapBuilderHandler::mapBuilderHandler() {}
    21 
    22 mapBuilderHandler::~mapBuilderHandler() {}
    23 
    24 QString mapBuilderHandler::errorProtocol() { return errorProt; }
    25 
    26 bool mapBuilderHandler::startDocument()
    27 {
    28     errorProt = "";
    29     state = StateInit;
    30     laststate = StateInit;
    31     branchDepth=0;
    32 	htmldata="";
    33 	isVymPart=false;
    34     return true;
    35 }
    36 
    37 
    38 QString mapBuilderHandler::parseHREF(QString href)
    39 {
    40 	QString type=href.section(":",0,0);
    41 	QString path=href.section(":",1,1);
    42 	if (!tmpDir.endsWith("/"))
    43 		return tmpDir + "/" + path;
    44 	else	
    45 		return tmpDir + path;
    46 }
    47 
    48 bool mapBuilderHandler::startElement  ( const QString&, const QString&,
    49                     const QString& eName, const QXmlAttributes& atts ) 
    50 {
    51     QColor col;
    52 	/* Testing
    53 	cout << "startElement <"<< eName.ascii()<<
    54 		">  state="<<state <<
    55 		"  laststate="<<laststate<<
    56 		"   loadMode="<<loadMode<<endl;
    57 	*/	
    58     if ( state == StateInit && (eName == "vymmap")  ) 
    59 	{
    60         state = StateMap;
    61 		if (!atts.value( "version").isEmpty() ) 
    62 		{
    63 			if (!checkVersion(atts.value("version")))
    64 				QMessageBox::warning( 0, "Warning: Version Problem" ,
    65 				   "<h3>Map is newer than VYM</h3>"
    66 				   "<p>The map you are just trying to load was "
    67 				   "saved using vym " +atts.value("version")+". "
    68 				   "The version of this vym is " + vymVersion + 
    69 				   ". If you run into problems after pressing "
    70 				   "the ok-button below, updating vym should help.");
    71 			else	   
    72 				mc->setVersion(atts.value( "version" ));
    73 
    74 		}
    75 		if (loadMode==NewMap || 
    76 			(loadMode==ImportReplace && me->getSelection()==mc))
    77 		{
    78 			if (!atts.value( "author").isEmpty() )
    79 			{
    80 				mc->setAuthor(atts.value( "author" ) );
    81 			}
    82 			if (!atts.value( "comment").isEmpty() )
    83 			{
    84 				mc->setComment (atts.value( "comment" ) );
    85 			}
    86 			if (!atts.value( "backgroundColor").isEmpty() )
    87 			{
    88 				col.setNamedColor(atts.value("backgroundColor"));
    89 				mc->getScene()->setBackgroundBrush(col);
    90 			}	    
    91 			if (!atts.value( "linkColorHint").isEmpty() ) 
    92 			{
    93 				if (atts.value("linkColorHint")=="HeadingColor")
    94 					me->setMapLinkColorHint(HeadingColor);
    95 				else
    96 					me->setMapLinkColorHint(DefaultColor);
    97 			}
    98 			if (!atts.value( "linkStyle").isEmpty() ) 
    99 			{
   100 				me->setMapLinkStyle(atts.value("linkStyle"));
   101 			}	
   102 			if (!atts.value( "linkColor").isEmpty() ) 
   103 			{
   104 				col.setNamedColor(atts.value("linkColor"));
   105 				me->setMapDefLinkColor(col);
   106 			}	
   107 			if (!atts.value( "defXLinkColor").isEmpty() ) 
   108 			{
   109 				col.setNamedColor(atts.value("defXLinkColor"));
   110 				me->setMapDefXLinkColor(col);
   111 			}	
   112 			if (!atts.value( "defXLinkWidth").isEmpty() ) 
   113 			{
   114 				me->setMapDefXLinkWidth(atts.value("defXLinkWidth").toInt ());
   115 			}	
   116 		}	
   117 	} else if ( eName == "select" && state == StateMap ) 
   118 	{
   119 		state=StateMapSelect;
   120 	} else if ( eName == "setting" && state == StateMap ) 
   121 	{
   122 		state=StateMapSetting;
   123 		if (loadMode==NewMap)
   124 			readSettingAttr (atts);
   125 	} else if ( eName == "mapcenter" && state == StateMap ) 
   126 	{
   127 		state=StateMapCenter;
   128 		if (loadMode==NewMap)
   129 		{	
   130 			// Really use the found mapcenter as MCO in a new map
   131 			lastBranch=mc;	// avoid empty pointer
   132 		} else
   133 		{
   134 			// Treat the found mapcenter as a branch 
   135 			// in an existing map
   136 			LinkableMapObj* lmo=me->getSelection();
   137 			if (lmo && (typeid(*lmo) == typeid(BranchObj) ) 
   138 			        || (typeid(*lmo) == typeid(MapCenterObj) ) )
   139 			{
   140 				lastBranch=(BranchObj*)lmo;
   141 				if (loadMode==ImportAdd)
   142 				{
   143 					lastBranch->addBranch();
   144 					lastBranch=lastBranch->getLastBranch();
   145 				} else
   146 					lastBranch->clear();
   147 			} else
   148 				return false;
   149 		}
   150 		readBranchAttr (atts);
   151 	} else if ( (eName == "standardflag" ||eName == "standardFlag") && state == StateMapCenter) 
   152 	{
   153 		state=StateMapCenterStandardFlag;
   154 	} else if ( eName == "heading" && state == StateMapCenter) 
   155 	{
   156 		state=StateMapCenterHeading;
   157 		if (!atts.value( "textColor").isEmpty() ) 
   158 		{
   159 			col.setNamedColor(atts.value("textColor"));
   160 			lastBranch->setColor(col );
   161 		}	    
   162 	} else if ( eName == "note" && state == StateMapCenter) 
   163 	{	// only for backward compatibility (<1.4.6). Use htmlnote now.
   164 		state=StateMapCenterNote;
   165 		if (!readNoteAttr (atts) ) return false;
   166 	} else if ( eName == "htmlnote" && state == StateMapCenter) 
   167 	{
   168 		laststate=state;
   169 		state=StateHtmlNote;
   170     } else if ( eName == "floatimage" && state == StateMapCenter ) 
   171 	{
   172 		state=StateMapCenterFloatImage;
   173         lastBranch->addFloatImage();
   174 		lastFloat=lastBranch->getLastFloatImage();
   175 		if (!readFloatImageAttr(atts)) return false;
   176 	} else if ( (eName == "branch"||eName=="floatimage") && state == StateMap) 
   177 	{
   178 		// This is used in vymparts, which have no mapcenter!
   179 		isVymPart=true;
   180 		LinkableMapObj* lmo=me->getSelection();
   181 		if (!lmo)
   182 		{
   183 			// If a vym part is _loaded_ (not imported), 
   184 			// selection==lmo==NULL
   185 			// Treat it like ImportAdd then...
   186 			loadMode=ImportAdd;
   187 			lmo=mc;
   188 		}	
   189 		if (lmo && (typeid(*lmo) == typeid(BranchObj) ) 
   190 				|| (typeid(*lmo) == typeid(MapCenterObj) ) )
   191 		{
   192 			lastBranch=(BranchObj*)(lmo);
   193 			if (eName=="branch")
   194 			{
   195 				state=StateBranch;
   196 				if (loadMode==ImportAdd)
   197 				{
   198 					lastBranch->addBranch();
   199 					lastBranch=lastBranch->getLastBranch();
   200 					
   201 				} else
   202 					lastBranch->clear();
   203 				branchDepth=1;
   204 				readBranchAttr (atts);
   205 			} else if (eName=="floatimage")
   206 			{
   207 				state=StateFloatImage;
   208 				lastBranch->addFloatImage();
   209 				lastFloat=lastBranch->getLastFloatImage();
   210 				if (!readFloatImageAttr(atts)) return false;
   211 			} else return false;
   212 		} else return false;
   213 	} else if ( eName == "branch" && state == StateMapCenter) 
   214 	{
   215 		state=StateBranch;
   216 		branchDepth=1;
   217 		lastBranch->addBranch();
   218 		lastBranch=lastBranch->getLastBranch();
   219 		readBranchAttr (atts);
   220 	} else if ( (eName=="standardflag" ||eName == "standardFlag") && state == StateBranch) 
   221 	{
   222 		state=StateBranchStandardFlag;
   223 	} else if ( eName == "heading" && state == StateBranch) 
   224 	{
   225 		state=StateBranchHeading;
   226 		if (!atts.value( "textColor").isEmpty() ) 
   227 		{
   228 			col.setNamedColor(atts.value("textColor"));
   229 			lastBranch->setColor(col );
   230 		}	    
   231     } else if ( eName == "note" && state == StateBranch) 
   232 	{
   233         state=StateBranchNote;
   234 		if (!readNoteAttr (atts) ) return false;
   235 	} else if ( eName == "htmlnote" && state == StateBranch) 
   236 	{
   237 		laststate=state;
   238 		state=StateHtmlNote;
   239 		no.clear();
   240 		if (!atts.value( "fonthint").isEmpty() ) 
   241 			no.setFontHint(atts.value ("fonthint") );
   242     } else if ( eName == "floatimage" && state == StateBranch ) 
   243 	{
   244 		state=StateBranchFloatImage;
   245         lastBranch->addFloatImage();
   246 		lastFloat=lastBranch->getLastFloatImage();
   247 		if (!readFloatImageAttr(atts)) return false;
   248     } else if ( eName == "xlink" && state == StateBranch ) 
   249 	{
   250 		state=StateBranchXLink;
   251 		if (!readXLinkAttr (atts)) return false;
   252     } else if ( eName == "branch" && state == StateBranch ) 
   253 	{
   254         lastBranch->addBranch();
   255 		lastBranch=lastBranch->getLastBranch();		
   256         branchDepth++;
   257 		readBranchAttr (atts);
   258     } else if ( eName == "html" && state == StateHtmlNote ) 
   259 	{
   260 		state=StateHtml;
   261 		htmldata="<"+eName;
   262 		readHtmlAttr(atts);
   263 		htmldata+=">";
   264     } else if ( state == StateHtml ) 
   265 	{
   266 		// accept all while in html mode,
   267 		htmldata+="<"+eName;
   268 		readHtmlAttr(atts);
   269 		htmldata+=">";
   270     } else
   271         return false;   // Error
   272     return true;
   273 }
   274 
   275 bool mapBuilderHandler::endElement  ( const QString&, const QString&, const QString &eName)
   276 {
   277 //	cout << "endElement </"<<eName<<">  state="<<state <<"  laststate="<<laststate<<endl;
   278     switch ( state ) 
   279 	{
   280         case StateMapSelect: state=StateMap;  return true;
   281         case StateMapSetting: state=StateMap;  return true;
   282         case StateMapCenter: state=StateMap;  return true;
   283         case StateMapCenterStandardFlag: state=StateMapCenter;  return true;
   284         case StateMapCenterHeading: state=StateMapCenter;  return true;
   285         case StateMapCenterNote: state=StateMapCenter;  return true;
   286         case StateMapCenterFloatImage: state=StateMapCenter;  return true;
   287         case StateFloatImage: state=StateMap; return true;
   288         case StateBranch: 
   289             if (branchDepth>1) 
   290 			{
   291                 branchDepth--;
   292                 state=StateBranch;
   293             } else  
   294 			{
   295                 branchDepth=0;
   296 				if (isVymPart)
   297 					state=StateMap;
   298 				else
   299 					state=StateMapCenter;
   300             }   
   301 			lastBranch=(BranchObj*)(lastBranch->getParObj());
   302              return true;
   303         case StateBranchStandardFlag: state=StateBranch;  return true;
   304         case StateBranchHeading: state=StateBranch;  return true;
   305         case StateBranchNote: state=StateBranch; return true;
   306         case StateBranchFloatImage: state=StateBranch;  return true;
   307         case StateBranchXLink: state=StateBranch;  return true;
   308         case StateHtmlNote: state=laststate; return true;
   309         case StateHtml: 
   310 			htmldata+="</"+eName+">";
   311 			if (eName=="html")
   312 			{
   313 				state=StateHtmlNote;  
   314 				htmldata.replace ("<br></br>","<br />");
   315 				no.setNote (htmldata);
   316 				lastBranch->setNote (no);
   317 				return true;
   318 			}	else
   319 			{
   320 				return true;
   321 			}	
   322         case StateMap: state=StateInit;  return true;
   323         default : 
   324 			// even for HTML includes, this should never be reached
   325 			return false;
   326     }   
   327 }
   328 
   329 bool mapBuilderHandler::characters   ( const QString& ch)
   330 {
   331 	//cout << "characters \""<<ch<<"\"  state="<<state <<"  laststate="<<laststate<<endl;
   332 
   333 	QString ch_org=quotemeta (ch);
   334     QString ch_simplified=ch.simplifyWhiteSpace();
   335     if ( ch_simplified.isEmpty() ) return true;
   336 
   337     switch ( state ) 
   338     {
   339         case StateInit: break;
   340         case StateMap: break; 
   341 		case StateMapSelect:
   342 			me->select(ch_simplified);
   343 			break;
   344 		case StateMapSetting:break;
   345         case StateMapCenter: break;
   346         case StateMapCenterStandardFlag: 
   347             lastBranch->activateStandardFlag(ch_simplified); 
   348             break;
   349         case StateMapCenterHeading: 
   350             lastBranch->setHeading(ch_simplified); 
   351             break;
   352         case StateMapCenterNote:
   353 			lastBranch->setNote(ch_simplified);
   354 			break;
   355         case StateBranch: break;
   356         case StateBranchStandardFlag: 
   357             lastBranch->activateStandardFlag(ch_simplified); 
   358             break;
   359         case StateBranchHeading: 
   360             lastBranch->setHeading(ch_simplified);
   361             break;
   362         case StateBranchNote: 
   363 			lastBranch->setNote(ch_simplified);
   364 			break;
   365         case StateBranchFloatImage: break;
   366         case StateHtmlNote: break;
   367         case StateHtml:
   368 			htmldata+=ch_org;
   369 			break;
   370         default: 
   371 			return false;
   372     }
   373     return true;
   374 }
   375 
   376 QString mapBuilderHandler::errorString() 
   377 {
   378     return "the document is not in the VYM file format";
   379 }
   380 
   381 bool mapBuilderHandler::fatalError( const QXmlParseException& exception ) 
   382 {
   383     errorProt += QString( "Fatal parsing error: %1 in line %2, column %3\n")
   384     .arg( exception.message() )
   385     .arg( exception.lineNumber() )
   386     .arg( exception.columnNumber() );
   387 	// Try to read the bogus line
   388 	errorProt+=QString("File is: %1\n").arg(inputFile);
   389 	QString s;
   390 	if (loadStringFromDisk (inputFile,s))
   391 	{
   392 		QStringList sl=QStringList::split ("\n",s);
   393 		int i=1;
   394 		QStringList::Iterator it = sl.begin();
   395 		while (i<exception.lineNumber()-1)
   396 		{
   397 			it++;
   398 			i++;
   399 		}
   400 		s=*it;
   401 		s.insert (exception.columnNumber()-1,"<ERROR>");
   402 		errorProt+=s;
   403     }
   404     return QXmlDefaultHandler::fatalError( exception );
   405 }
   406 
   407 void mapBuilderHandler::setMapEditor (MapEditor* e)
   408 {
   409     me=e;
   410 	mc=me->getMapCenter();
   411 }
   412 
   413 void mapBuilderHandler::setTmpDir (QString tp)
   414 {
   415 	tmpDir=tp;
   416 }
   417 
   418 void mapBuilderHandler::setInputFile (QString f)
   419 {
   420 	inputFile=f;
   421 }
   422 
   423 void mapBuilderHandler::setLoadMode (const LoadMode &lm)
   424 {
   425 	loadMode=lm;
   426 }
   427 
   428 bool mapBuilderHandler::readBranchAttr (const QXmlAttributes& a)
   429 {
   430 	lastOO=lastBranch;
   431 	if (!readOOAttr(a)) return false;
   432 
   433 	if (!a.value( "scrolled").isEmpty() )
   434 		lastBranch->toggleScroll();
   435 	if (!a.value( "frameType").isEmpty() ) 
   436 		lastBranch->setFrameType (a.value("frameType"));
   437 
   438 	if (!a.value( "incImgV").isEmpty() ) 
   439 	{	
   440 		if (a.value("incImgV")=="true")
   441 			lastBranch->setIncludeImagesVer(true);
   442 		else	
   443 			lastBranch->setIncludeImagesVer(false);
   444 	}	
   445 	if (!a.value( "incImgH").isEmpty() ) 
   446 	{	
   447 		if (a.value("incImgH")=="true")
   448 			lastBranch->setIncludeImagesHor(true);
   449 		else	
   450 			lastBranch->setIncludeImagesHor(false);
   451 	}	
   452 	return true;	
   453 }
   454 
   455 bool mapBuilderHandler::readOOAttr (const QXmlAttributes& a)
   456 {
   457 	if (lastOO)
   458 	{
   459 		bool okx,oky;
   460 		int x,y;
   461 		if (!a.value( "relPosX").isEmpty() ) 
   462 		{
   463 			if (!a.value( "relPosY").isEmpty() ) 
   464 			{
   465 				x=a.value("relPosX").toInt (&okx, 10);
   466 				y=a.value("relPosY").toInt (&oky, 10);
   467 				if (okx && oky  )
   468 				{
   469 					lastOO->setUseRelPos (true);
   470 					lastOO->move2RelPos (x,y);
   471 				}	
   472 				else
   473 					return false;   // Couldn't read relPos
   474 			}           
   475 		}           
   476 		if (!a.value( "absPosX").isEmpty() && loadMode==NewMap && branchDepth<2) 
   477 		{
   478 			if (!a.value( "absPosY").isEmpty() ) 
   479 			{
   480 				x=a.value("absPosX").toInt (&okx, 10);
   481 				y=a.value("absPosY").toInt (&oky, 10);
   482 				if (okx && oky  )
   483 					lastOO->move(x,y);
   484 				else
   485 					return false;   // Couldn't read absPos
   486 			}           
   487 		}           
   488 		if (!a.value( "url").isEmpty() ) 
   489 			lastOO->setURL (a.value ("url"));
   490 		if (!a.value( "vymLink").isEmpty() ) 
   491 			lastOO->setVymLink (a.value ("vymLink"));
   492 		if (!a.value( "hideInExport").isEmpty() ) 
   493 			if (a.value("hideInExport")=="true")
   494 				lastOO->setHideInExport(true);
   495 
   496 		if (!a.value( "hideLink").isEmpty()) 
   497 		{
   498 			if (a.value ("hideLink") =="true")
   499 				lastOO->setHideLinkUnselected(true);
   500 			else	
   501 				lastOO->setHideLinkUnselected(false);
   502 		}	
   503 	}
   504 	return true;	
   505 }
   506 
   507 bool mapBuilderHandler::readNoteAttr (const QXmlAttributes& a)
   508 {	// only for backward compatibility (<1.4.6). Use htmlnote now.
   509 	no.clear();
   510 	QString fn;
   511 	if (!a.value( "href").isEmpty() ) 
   512 	{
   513 		// Load note
   514 		fn=parseHREF(a.value ("href") );
   515 		QFile file (fn);
   516 		QString s;						// Reading a note
   517 
   518 		if ( !file.open( QIODevice::ReadOnly) )
   519 		{
   520 			qWarning ("mapBuilderHandler::readNoteAttr:  Couldn't load "+fn);
   521 			return false;
   522 		}	
   523 		QTextStream stream( &file );
   524 		QString lines;
   525 		while ( !stream.atEnd() ) {
   526 			lines += stream.readLine()+"\n"; 
   527 		}
   528 		file.close();
   529 
   530 		lines ="<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>"+lines + "</p></body></html>";
   531 		no.setNote (lines);
   532 	}		
   533 	if (!a.value( "fonthint").isEmpty() ) 
   534 		no.setFontHint(a.value ("fonthint") );
   535 	if (state == StateMapCenterNote) 	
   536 		mc->setNote(no);
   537 	else
   538 		lastBranch->setNote(no);
   539 	return true;
   540 }
   541 
   542 bool mapBuilderHandler::readFloatImageAttr (const QXmlAttributes& a)
   543 {
   544 	lastOO=lastFloat;
   545 	
   546 	//if (!readOOAttr(a)) return false;
   547 
   548 	if (!a.value( "useOrientation").isEmpty() ) 
   549 	{
   550 		if (a.value ("useOrientation") =="true")
   551 			lastFloat->setUseOrientation (true);
   552 		else	
   553 			lastFloat->setUseOrientation (false);
   554 	}	
   555 	if (!a.value( "href").isEmpty() )
   556 	{
   557 		// Load FloatImage
   558 		if (!lastFloat->load (parseHREF(a.value ("href") ) ))
   559 		{
   560 			QMessageBox::warning( 0, "Warning: " ,
   561 				"Couldn't load float image\n"+parseHREF(a.value ("href") ));
   562 			lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
   563 			lastFloat=NULL;
   564 			return true;
   565 		}
   566 		
   567 	}	
   568 	if (!a.value( "floatExport").isEmpty() ) 
   569 	{
   570 		// Only for compatibility. THis is not used since 1.7.11 
   571 		if (a.value ("floatExport") =="true")
   572 			lastFloat->setFloatExport(true);
   573 		else	
   574 			lastFloat->setFloatExport (false);
   575 	}	
   576 	if (!a.value( "zPlane").isEmpty() ) 
   577 		lastFloat->setZValue (a.value("zPlane").toInt ());
   578     int x,y;
   579     bool okx,oky;
   580 	if (!a.value( "relPosX").isEmpty() ) 
   581 	{
   582 		if (!a.value( "relPosY").isEmpty() ) 
   583 		{
   584 			// read relPos
   585 			x=a.value("relPosX").toInt (&okx, 10);
   586 			y=a.value("relPosY").toInt (&oky, 10);
   587 			if (okx && oky) 
   588 				
   589 				{
   590 					lastFloat->setRelPos (QPoint (x,y) );
   591 					// make sure floats in mapcenter are repositioned to relative pos
   592 					if (mc==lastBranch) mc->positionContents();
   593 				}
   594 			else
   595 				// Couldn't read relPos
   596 				return false;  
   597 		}           
   598 	}	
   599 	
   600 	if (!readOOAttr(a)) return false;
   601 
   602 	if (!a.value ("orgName").isEmpty() )
   603 	{
   604 		((FloatImageObj*)(lastFloat))->setOriginalFilename (a.value("orgName"));
   605 	}
   606 	return true;
   607 }
   608 
   609 bool mapBuilderHandler::readXLinkAttr (const QXmlAttributes& a)
   610 {
   611 	QColor col;
   612 	bool okx;
   613 	bool success=false;
   614 	XLinkObj *xlo=new XLinkObj (mc->getScene());
   615 	if (!a.value( "color").isEmpty() ) 
   616 	{
   617 		col.setNamedColor(a.value("color"));
   618 		xlo->setColor (col);
   619 	}
   620 
   621 	if (!a.value( "width").isEmpty() ) 
   622 	{
   623 		xlo->setWidth(a.value ("width").toInt (&okx, 10));
   624 	}
   625 
   626 	if (!a.value( "beginBranch").isEmpty() ) 
   627 	{ 
   628 		if (!a.value( "endBranch").isEmpty() ) 
   629 		{
   630 			LinkableMapObj *lmo=mc->findObjBySelect (a.value( "beginBranch"));
   631 			if (lmo && typeid (*lmo)==typeid (BranchObj))
   632 			{
   633 				xlo->setBegin ((BranchObj*)lmo);
   634 				lmo=mc->findObjBySelect (a.value( "endBranch"));
   635 				if (lmo && typeid (*lmo)==typeid (BranchObj))
   636 				{
   637 					xlo->setEnd ((BranchObj*)(lmo));
   638 					xlo->activate();
   639 				}
   640 			}
   641 			success=true; // Not all branches there yet, no error
   642 		}           
   643 	}	
   644 	if (!success) delete (xlo);
   645 	return success;
   646 }
   647 
   648 bool mapBuilderHandler::readHtmlAttr (const QXmlAttributes& a)
   649 {
   650 	for (int i=1; i<=a.count(); i++)
   651 		htmldata+=" "+a.localName(i-1)+"=\""+a.value(i-1)+"\"";
   652 	return true;
   653 }
   654 
   655 bool mapBuilderHandler::readSettingAttr (const QXmlAttributes& a)
   656 {
   657 	if (!a.value( "key").isEmpty() ) 
   658 	{
   659 		if (!a.value( "value").isEmpty() ) 
   660 			settings.setLocalEntry (me->getDestPath(), a.value ("key"), a.value ("value"));
   661 		else
   662 			return false;
   663 		
   664 	} else
   665 		return false;
   666 	
   667 	return true;
   668 }