xml-vym.cpp
author insilmaril
Mon, 14 Jun 2010 13:59:17 +0000
changeset 848 e265f07f2173
parent 847 43268373032d
permissions -rw-r--r--
Fixed tmp relink, colored headings in TreeView
     1 #include "xml-vym.h"
     2 
     3 #include <QMessageBox>
     4 #include <QColor>
     5 #include <QTextStream>
     6 #include <iostream>
     7 #include <typeinfo>
     8 
     9 #include "branchitem.h"
    10 #include "misc.h"
    11 #include "settings.h"
    12 #include "linkablemapobj.h"
    13 #include "mainwindow.h"
    14 #include "version.h"
    15 #include "xlinkitem.h"
    16 
    17 
    18 extern Main *mainWindow;
    19 extern Settings settings;
    20 extern QString vymVersion;
    21 
    22 bool parseVYMHandler::startDocument()
    23 {
    24     errorProt = "";
    25     state = StateInit;
    26     laststate = StateInit;
    27 	stateStack.clear();
    28 	stateStack.append(StateInit);
    29 	htmldata="";
    30 	isVymPart=false;
    31 	useProgress=false;
    32     return true;
    33 }
    34 
    35 bool parseVYMHandler::startElement  ( const QString&, const QString&,
    36                     const QString& eName, const QXmlAttributes& atts ) 
    37 {
    38     QColor col;
    39 	/* Testing
    40 	cout << "startElement <"<< qPrintable(eName)
    41 		<<">  state="<<state 
    42 		<<"  laststate="<<stateStack.last()
    43 		<<"   loadMode="<<loadMode
    44 	//	<<"       line="<<QXmlDefaultHandler::lineNumber()
    45 		<<endl;
    46 	*/	
    47 	stateStack.append (state);	
    48     if ( state == StateInit && (eName == "vymmap")  ) 
    49 	{
    50         state = StateMap;
    51 		branchesTotal=0;			//FIXME-3 what if we load a .vyp ?
    52 		branchesCounter=0;
    53 
    54 		if (loadMode==NewMap )
    55 		{
    56 			// Create mapCenter
    57 			model->clear();
    58 			lastBranch=NULL;
    59 
    60 			if (!atts.value( "author").isEmpty() )
    61 				model->setAuthor(atts.value( "author" ) );
    62 			if (!atts.value( "comment").isEmpty() )
    63 				model->setComment (atts.value( "comment" ) );
    64 			if (!atts.value( "branchCount").isEmpty() )
    65 			{
    66 				branchesTotal=atts.value("branchCount").toInt();
    67 				if (branchesTotal>10)
    68 				{
    69 					useProgress=true;
    70 					mainWindow->setProgressMaximum (branchesTotal);
    71 				}
    72 			} 
    73 				
    74 			if (!atts.value( "backgroundColor").isEmpty() )
    75 			{
    76 				col.setNamedColor(atts.value("backgroundColor"));
    77 				model->getScene()->setBackgroundBrush(col);
    78 			}	    
    79 			if (!atts.value( "selectionColor").isEmpty() )
    80 			{
    81 				col.setNamedColor(atts.value("selectionColor"));
    82 				model->setSelectionColor(col);
    83 			}	    
    84 			if (!atts.value( "linkColorHint").isEmpty() ) 
    85 			{
    86 				if (atts.value("linkColorHint")=="HeadingColor")
    87 					model->setMapLinkColorHint(LinkableMapObj::HeadingColor);
    88 				else
    89 					model->setMapLinkColorHint(LinkableMapObj::DefaultColor);
    90 			}
    91 			if (!atts.value( "linkStyle").isEmpty() ) 
    92 				model->setMapLinkStyle(atts.value("linkStyle"));
    93 			if (!atts.value( "linkColor").isEmpty() ) 
    94 			{
    95 				col.setNamedColor(atts.value("linkColor"));
    96 				model->setMapDefLinkColor(col);
    97 			}	
    98 			if (!atts.value( "defXLinkColor").isEmpty() ) 
    99 			{
   100 				col.setNamedColor(atts.value("defXLinkColor"));
   101 				model->setMapDefXLinkColor(col);
   102 			}	
   103 			if (!atts.value( "defXLinkWidth").isEmpty() ) 
   104 				model->setMapDefXLinkWidth(atts.value("defXLinkWidth").toInt ());
   105 			if (!atts.value( "mapZoomFactor").isEmpty() ) 
   106 				model->setMapZoomFactor(atts.value("mapZoomFactor").toDouble());
   107 		}	
   108 		// Check version
   109 		if (!atts.value( "version").isEmpty() ) 
   110 		{
   111 			if (!checkVersion(atts.value("version")))
   112 				QMessageBox::warning( 0, "Warning: Version Problem" ,
   113 				   "<h3>Map is newer than VYM</h3>"
   114 				   "<p>The map you are just trying to load was "
   115 				   "saved using vym " +atts.value("version")+". "
   116 				   "The version of this vym is " + vymVersion + 
   117 				   ". If you run into problems after pressing "
   118 				   "the ok-button below, updating vym should help.");
   119 			else	   
   120 				model->setVersion(atts.value( "version" ));
   121 
   122 		}
   123 
   124 	} else if ( eName == "select" && state == StateMap ) 
   125 	{
   126 		state=StateMapSelect;
   127 	} else if ( eName == "setting" && state == StateMap ) 
   128 	{
   129 		state=StateMapSetting;
   130 		if (loadMode==NewMap)
   131 			readSettingAttr (atts);
   132 	} else if ( eName == "mapcenter" && state == StateMap ) 
   133 	{
   134 		state=StateMapCenter;
   135 		if (loadMode==NewMap)
   136 		{	
   137 			// Really use the found mapcenter as MCO in a new map
   138 			lastBranch=model->createMapCenter(); 
   139 		} else
   140 		{
   141 			// Treat the found mapcenter as a branch 
   142 			// in an existing map
   143 			BranchItem *bi=model->getSelectedBranch();	
   144 			if (bi)
   145 			{
   146 				lastBranch=bi;
   147 				if (loadMode==ImportAdd)
   148 				{
   149 					// Import Add
   150 					lastBranch=model->createBranch(lastBranch);
   151 				} else  
   152 				{
   153 					// Import Replace 
   154 					// Parser should not be called with ImportReplace any longer,
   155 					// that's done in VymModel now.
   156 					qDebug()<<"xml-vym:  ImportReplace  ?!"; 
   157 				}
   158 			} else
   159 				// add mapCenter without parent
   160 				lastBranch=model->createMapCenter(); 
   161 		}		
   162 		readBranchAttr (atts);
   163 	} else if ( 
   164 		(eName == "standardflag" ||eName == "standardFlag") && 
   165 		(state == StateMapCenter || state==StateBranch)) 
   166 	{
   167 		state=StateStandardFlag;
   168 	} else if ( eName == "heading" && (state == StateMapCenter||state==StateBranch)) 
   169 	{
   170 		laststate=state;
   171 		state=StateHeading;
   172 		if (!atts.value( "textColor").isEmpty() ) 
   173 		{
   174 			col.setNamedColor(atts.value("textColor"));
   175 			lastBranch->setHeadingColor(col );
   176 		}	    
   177 	} else if ( eName == "note" && 
   178 				(state == StateMapCenter ||state==StateBranch))
   179 	{	// only for backward compatibility (<1.4.6). Use htmlnote now.
   180 		state=StateNote;
   181 		if (!readNoteAttr (atts) ) return false;
   182 	} else if ( eName == "htmlnote" && state == StateMapCenter) 
   183 	{
   184 		laststate=state;
   185 		state=StateHtmlNote;
   186     } else if ( eName == "floatimage" && 
   187 				(state == StateMapCenter ||state==StateBranch)) 
   188 	{
   189 		state=StateImage;
   190 		lastImage=model->createImage(lastBranch);
   191 		if (!readImageAttr(atts)) return false;
   192 	} else if ( (eName == "branch"||eName=="floatimage") && state == StateMap) 
   193 	{
   194 		// This is used in vymparts, which have no mapcenter or for undo
   195 		isVymPart=true;
   196 		TreeItem *ti=model->getSelectedItem();
   197 		if (!ti)
   198 		{
   199 			// If a vym part is _loaded_ (not imported), 
   200 			// selection==lmo==NULL
   201 			// Treat it like ImportAdd then...
   202 			loadMode=ImportAdd;
   203 			// FIXME-3 lmo=model->first()->getLMO();		
   204 			// Do we really have no MCO when loading?????
   205 			cout << "xml-vym aborted\n";
   206 			return false;
   207 		}	
   208 		if (ti && ti->isBranchLikeType() )
   209 		{
   210 			lastBranch=(BranchItem*)ti;
   211 			if (eName=="branch")
   212 			{
   213 				state=StateBranch;
   214 				if (loadMode==ImportAdd)
   215 				{
   216 					lastBranch=model->createBranch(lastBranch);
   217 					if (insertPos>=0)
   218 						model->relinkBranch (lastBranch,(BranchItem*)ti,insertPos);
   219 				} else
   220 					model->clearItem (lastBranch);
   221 				readBranchAttr (atts);
   222 			} else if (eName=="floatimage")
   223 			{
   224 				state=StateImage;
   225 				lastImage=model->createImage (lastBranch);
   226 				if (!readImageAttr(atts)) return false;
   227 			} else return false;
   228 		} else return false;
   229 	} else if ( eName == "branch" && state == StateMapCenter) 
   230 	{
   231 		state=StateBranch;
   232 		lastBranch=model->createBranch(lastBranch);
   233 		readBranchAttr (atts);
   234 	} else if ( eName == "htmlnote" && state == StateBranch) 
   235 	{
   236 		laststate=state;
   237 		state=StateHtmlNote;
   238 		no.clear();
   239 		if (!atts.value( "fonthint").isEmpty() ) 
   240 			no.setFontHint(atts.value ("fonthint") );
   241 	} else if ( eName == "frame" && (state == StateBranch||state==StateMapCenter)) 
   242 	{
   243 		laststate=state;
   244 		state=StateFrame;
   245 		if (!readFrameAttr(atts)) return false;
   246     } else if ( eName == "xlink" && state == StateBranch ) 
   247 	{
   248 		state=StateBranchXLink;
   249 		if (!readXLinkAttr (atts)) return false;
   250     } else if ( eName == "xlink" && state == StateMap) 
   251 	{
   252 		state=StateLink;
   253 		if (!readLinkNewAttr (atts)) return false;
   254     } else if ( eName == "branch" && state == StateBranch ) 
   255 	{
   256 		lastBranch=model->createBranch(lastBranch);
   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 parseVYMHandler::endElement  ( const QString&, const QString&, const QString &eName)
   276 {
   277 	/* Testing
   278 	cout << "endElement </" <<qPrintable(eName)
   279 		<<">  state=" <<state 
   280 	//	<<"  laststate=" <<laststate
   281 	//	<<"  stateStack="<<stateStack.last() 
   282 	//	<<"  selString="<<model->getSelectString().toStdString()
   283 		<<endl;
   284 	*/
   285     switch ( state ) 
   286 	{
   287 		case StateMap:
   288 			mainWindow->removeProgressCounter(); 
   289 			break;
   290         case StateMapCenter: 
   291 			model->emitDataHasChanged (lastBranch);
   292 			lastBranch=(BranchItem*)(lastBranch->parent());
   293 		//	lastBranch->setLastSelectedBranch (0);	// Reset last selected to first child branch
   294             break;
   295         case StateBranch: 
   296 			// Empty branches may not be scrolled 
   297 			// (happens if bookmarks are imported)
   298 			if (lastBranch->isScrolled() && lastBranch->branchCount()==0) 
   299 				lastBranch->unScroll();
   300 			model->emitDataHasChanged (lastBranch);
   301 
   302 			lastBranch=(BranchItem*)(lastBranch->parent());
   303 			lastBranch->setLastSelectedBranch (0);	// Reset last selected to first child branch
   304             break;
   305         case StateHtml: 
   306 			htmldata+="</"+eName+">";
   307 			if (eName=="html")
   308 			{
   309 				state=StateHtmlNote;  
   310 				htmldata.replace ("<br></br>","<br />");
   311 				no.setNote (htmldata);
   312 				lastBranch->setNoteObj (no);
   313 			}	
   314 			break;
   315 		default: 
   316 			break;
   317     }  
   318 	state=stateStack.takeLast();	
   319 	return true;
   320 }
   321 
   322 bool parseVYMHandler::characters   ( const QString& ch)
   323 {
   324 	//cout << "characters \""<<ch.toStdString()<<"\"  state="<<state <<"  laststate="<<laststate<<endl;
   325 
   326 	QString ch_org=quotemeta (ch);
   327     QString ch_simplified=ch.simplifyWhiteSpace();
   328     if ( ch_simplified.isEmpty() ) return true;
   329 
   330     switch ( state ) 
   331     {
   332         case StateInit: break;
   333         case StateMap: break; 
   334 		case StateMapSelect:
   335 			model->select(ch_simplified);
   336 			break;
   337 		case StateMapSetting:break;
   338         case StateMapCenter: break;
   339         case StateNote:
   340 			lastBranch->setNote(ch_simplified);
   341 			break;
   342         case StateBranch: break;
   343         case StateStandardFlag: 
   344             lastBranch->activateStandardFlag(ch_simplified); 
   345             break;
   346         case StateImage: break;
   347         case StateHtmlNote: break;
   348         case StateHtml:
   349 			htmldata+=ch_org;
   350 			break;
   351         case StateHeading: 
   352             lastBranch->setHeading(ch_simplified);
   353             break;
   354         default: 
   355 			return false;
   356     }
   357     return true;
   358 }
   359 
   360 QString parseVYMHandler::errorString() 
   361 {
   362     return "the document is not in the VYM file format";
   363 }
   364 
   365 bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a)	
   366 {
   367 	branchesCounter++;
   368 	if (useProgress) 
   369 		mainWindow->addProgressValue ((float)branchesCounter/branchesTotal);	
   370 
   371 	lastMI=lastBranch;
   372 
   373 	if (!readOOAttr(a)) return false;
   374 
   375 	if (!a.value( "scrolled").isEmpty() )
   376 		lastBranch->toggleScroll();	
   377 		// (interesting for import of KDE bookmarks)
   378 
   379 /*	if (!a.value( "frameType").isEmpty() )  FIXME-3
   380 		lastOO->setFrameType (a.value("frameType")); //Compatibility 1.8.1
   381 
   382 */	
   383 	if (!a.value( "incImgV").isEmpty() ) 
   384 	{	
   385 		if (a.value("incImgV")=="true")
   386 			lastBranch->setIncludeImagesVer(true);
   387 		else	
   388 			lastBranch->setIncludeImagesVer(false);
   389 	}	
   390 	if (!a.value( "incImgH").isEmpty() ) 
   391 	{	
   392 		if (a.value("incImgH")=="true")
   393 			lastBranch->setIncludeImagesHor(true);
   394 		else	
   395 			lastBranch->setIncludeImagesHor(false);
   396 	}	
   397 	return true;	
   398 }
   399 
   400 bool parseVYMHandler::readFrameAttr (const QXmlAttributes& a)	// FIXME-4 does not work if there is no lmo for treeitem
   401 {
   402 	if (lastMI)
   403 	{
   404 		OrnamentedObj* oo=(OrnamentedObj*)(lastMI->getLMO()); 
   405 		if (oo)
   406 		{
   407 			bool ok;
   408 			int x;
   409 			{
   410 				if (!a.value( "frameType").isEmpty() ) 
   411 					oo->setFrameType (a.value("frameType"));
   412 				if (!a.value( "penColor").isEmpty() ) 
   413 					oo->setFramePenColor (a.value("penColor"));
   414 				if (!a.value( "brushColor").isEmpty() ) 
   415 					oo->setFrameBrushColor (a.value("brushColor"));
   416 				if (!a.value( "padding").isEmpty() ) 
   417 				{
   418 					x=a.value("padding").toInt(&ok);
   419 					if (ok) oo->setFramePadding(x);
   420 				}	
   421 				if (!a.value( "borderWidth").isEmpty() ) 
   422 				{
   423 					x=a.value("borderWidth").toInt(&ok);
   424 					if (ok) oo->setFrameBorderWidth(x);
   425 				}	
   426 			}		
   427 			return true;
   428 		}
   429 	}
   430 	return false;
   431 }
   432 
   433 bool parseVYMHandler::readOOAttr (const QXmlAttributes& a)
   434 {
   435 	if (lastMI)
   436 	{
   437 		bool okx,oky;
   438 		float x,y;
   439 		if (!a.value( "relPosX").isEmpty() ) 
   440 		{
   441 			if (!a.value( "relPosY").isEmpty() ) 
   442 			{
   443 				x=a.value("relPosX").toFloat (&okx);
   444 				y=a.value("relPosY").toFloat (&oky);
   445 				if (okx && oky  )
   446 					lastMI->setRelPos (QPointF(x,y));
   447 				else
   448 					return false;   // Couldn't read relPos
   449 			}           
   450 		}           
   451 		if (!a.value( "absPosX").isEmpty() ) 
   452 		{
   453 			if (!a.value( "absPosY").isEmpty() ) 
   454 			{
   455 				x=a.value("absPosX").toFloat (&okx);
   456 				y=a.value("absPosY").toFloat (&oky);
   457 				if (okx && oky  )
   458 					lastMI->setAbsPos (QPointF(x,y));
   459 				else
   460 					return false;   // Couldn't read absPos
   461 			}           
   462 		}           
   463 		if (!a.value( "url").isEmpty() ) 
   464 			lastMI->setURL (a.value ("url"));
   465 		if (!a.value( "vymLink").isEmpty() ) 
   466 			lastMI->setVymLink (a.value ("vymLink"));
   467 		if (!a.value( "hideInExport").isEmpty() ) 
   468 			if (a.value("hideInExport")=="true")
   469 				lastMI->setHideInExport(true);
   470 
   471 		if (!a.value( "hideLink").isEmpty()) 
   472 		{
   473 			if (a.value ("hideLink") =="true")
   474 				lastMI->setHideLinkUnselected(true);
   475 			else	
   476 				lastMI->setHideLinkUnselected(false);
   477 		}	
   478 	}
   479 	return true;	
   480 }
   481 
   482 bool parseVYMHandler::readNoteAttr (const QXmlAttributes& a)
   483 {	// only for backward compatibility (<1.4.6). Use htmlnote now.
   484 	no.clear();
   485 	QString fn;
   486 	if (!a.value( "href").isEmpty() ) 
   487 	{
   488 		// Load note
   489 		fn=parseHREF(a.value ("href") );
   490 		QFile file (fn);
   491 		QString s;						// Reading a note
   492 
   493 		if ( !file.open( QIODevice::ReadOnly) )
   494 		{
   495 			qWarning ("parseVYMHandler::readNoteAttr:  Couldn't load "+fn);
   496 			return false;
   497 		}	
   498 		QTextStream stream( &file );
   499 		QString lines;
   500 		while ( !stream.atEnd() ) {
   501 			lines += stream.readLine()+"\n"; 
   502 		}
   503 		file.close();
   504 
   505 		lines ="<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>"+lines + "</p></body></html>";
   506 		no.setNote (lines);
   507 	}		
   508 	if (!a.value( "fonthint").isEmpty() ) 
   509 		no.setFontHint(a.value ("fonthint") );
   510 	lastBranch->setNoteObj(no);
   511 	return true;
   512 }
   513 
   514 bool parseVYMHandler::readImageAttr (const QXmlAttributes& a)
   515 {
   516 	lastMI=lastImage;
   517 	
   518 	if (!readOOAttr(a)) return false;  
   519 
   520 	if (!a.value( "href").isEmpty() )
   521 	{
   522 		// Load Image
   523 		if (!lastImage->load (parseHREF(a.value ("href") ) ))
   524 		{
   525 			QMessageBox::warning( 0, "Warning: " ,
   526 				"Couldn't load image\n"+parseHREF(a.value ("href") ));
   527 			lastImage=NULL;
   528 			return true;
   529 		}
   530 		
   531 	}	
   532 	if (!a.value( "zPlane").isEmpty() ) 
   533 		lastImage->setZValue (a.value("zPlane").toInt ());
   534     float x,y;
   535     bool okx,oky;
   536 	if (!a.value( "relPosX").isEmpty() ) 
   537 	{
   538 		if (!a.value( "relPosY").isEmpty() ) 
   539 		{
   540 			// read relPos
   541 			x=a.value("relPosX").toFloat (&okx);
   542 			y=a.value("relPosY").toFloat (&oky);
   543 			if (okx && oky) 
   544 				lastImage->setRelPos (QPointF (x,y) );
   545 			else
   546 				// Couldn't read relPos
   547 				return false;  
   548 		}           
   549 	}	
   550 	
   551 	//FIXME-3 if (!readOOAttr(a)) return false;
   552 
   553 	if (!a.value ("originalName").isEmpty() )
   554 	{
   555 		lastImage->setOriginalFilename (a.value("originalName"));
   556 	}
   557 	return true;
   558 }
   559 
   560 bool parseVYMHandler::readXLinkAttr (const QXmlAttributes& a) 
   561 {
   562 	// Format of links was changed several times:
   563 	//
   564 	// object ID is used starting in version 1.8.76
   565 	// (before there was beginBranch and endBranch)
   566 	//
   567 	// Starting in 1.13.2 xlinks are no longer subitems of branches,
   568 	// but listed at the end of the data in a map. This make handling 
   569 	// of links much safer and easier
   570 
   571 	if (!a.value( "beginID").isEmpty() ) 
   572 	{ 
   573 		if (!a.value( "endID").isEmpty() ) 
   574 		{
   575 			TreeItem *beginBI=model->findBySelectString (a.value( "beginID"));
   576 			TreeItem   *endBI=model->findBySelectString (a.value( "endID"));
   577 			if (beginBI && endBI && beginBI->isBranchLikeType() && endBI->isBranchLikeType() )
   578 			{
   579 				Link *li=new Link (model);
   580 				li->setBeginBranch ( (BranchItem*)beginBI );
   581 				li->setEndBranch ( (BranchItem*)endBI);
   582 
   583 				if (!a.value( "color").isEmpty() ) 
   584 				{
   585 					QColor col;
   586 					col.setNamedColor(a.value("color"));
   587 					li->setColor (col);
   588 				}
   589 
   590 				if (!a.value( "width").isEmpty() ) 
   591 				{
   592 					bool okx;
   593 					li->setWidth(a.value ("width").toInt (&okx, 10));
   594 				}
   595 				model->createLink (li,true);	// create MO by default
   596 			}
   597 		}           
   598 	}	
   599 	return true;	
   600 }
   601 
   602 bool parseVYMHandler::readLinkNewAttr (const QXmlAttributes& a)	
   603 {
   604 	// object ID is used starting in version 1.8.76
   605 	// (before there was beginBranch and endBranch)
   606 
   607 	// Beginning in 1.13.2 xLinks are no longer parts of branches, but
   608 	// a separate list after all the mapCenters within <vymmap> ... </vymmap>
   609 
   610 	if (!a.value( "beginID").isEmpty() ) 
   611 	{ 
   612 		if (!a.value( "endID").isEmpty() ) 
   613 		{
   614 			TreeItem *beginBI=model->findBySelectString (a.value( "beginID"));
   615 			TreeItem   *endBI=model->findBySelectString (a.value( "endID"));
   616 			if (beginBI && endBI && beginBI->isBranchLikeType() && endBI->isBranchLikeType() )
   617 			{
   618 				Link *li=new Link (model);
   619 				li->setBeginBranch ( (BranchItem*)beginBI );
   620 				li->setEndBranch ( (BranchItem*)endBI);
   621 
   622 				if (!a.value( "color").isEmpty() ) 
   623 				{
   624 					QColor col;
   625 					col.setNamedColor(a.value("color"));
   626 					li->setColor (col);
   627 				}
   628 
   629 				if (!a.value( "width").isEmpty() ) 
   630 				{
   631 					bool okx;
   632 					li->setWidth(a.value ("width").toInt (&okx, 10));
   633 				}
   634 				model->createLink (li,true);	// create MO by default
   635 			}
   636 		}           
   637 	}	
   638 	return true;	
   639 }
   640 
   641 bool parseVYMHandler::readHtmlAttr (const QXmlAttributes& a)
   642 {
   643 	for (int i=1; i<=a.count(); i++)
   644 		htmldata+=" "+a.localName(i-1)+"=\""+a.value(i-1)+"\"";
   645 	return true;
   646 }
   647 
   648 bool parseVYMHandler::readSettingAttr (const QXmlAttributes& a)
   649 {
   650 	if (!a.value( "key").isEmpty() ) 
   651 	{
   652 		if (!a.value( "value").isEmpty() ) 
   653 			settings.setLocalEntry (model->getDestPath(), a.value ("key"), a.value ("value"));
   654 		else
   655 			return false;
   656 		
   657 	} else
   658 		return false;
   659 	
   660 	return true;
   661 }