xml-vym.cpp
author insilmaril
Wed, 20 May 2009 15:40:14 +0000
changeset 772 e3f722759c7e
parent 768 382a444f5b0c
child 773 340bc29da9a0
permissions -rw-r--r--
Fixed segfault when closing a map
     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 
    16 static FloatObj *lastFloat;
    17 static OrnamentedObj *lastOO;
    18 
    19 extern Main *mainWindow;
    20 extern Settings settings;
    21 extern QString vymVersion;
    22 
    23 bool parseVYMHandler::startDocument()
    24 {
    25     errorProt = "";
    26     state = StateInit;
    27     laststate = StateInit;
    28 	stateStack.clear();
    29 	stateStack.append(StateInit);
    30 	htmldata="";
    31 	isVymPart=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=branchesCurrent=0;
    52 
    53 		if (loadMode==NewMap )
    54 		{
    55 			// Create mapCenter
    56 			model->clear();
    57 			lastBranchItem=NULL;
    58 
    59 			if (!atts.value( "author").isEmpty() )
    60 				model->setAuthor(atts.value( "author" ) );
    61 			if (!atts.value( "comment").isEmpty() )
    62 				model->setComment (atts.value( "comment" ) );
    63 			if (!atts.value( "branchCount").isEmpty() )
    64 			{
    65 				branchesTotal=atts.value("branchCount").toInt();
    66 				if (branchesTotal>10)
    67 				{
    68 					mainWindow->setProgressMinimum (0);
    69 					mainWindow->setProgressMaximum (branchesTotal);
    70 					mainWindow->setProgressValue(0);
    71 				}
    72 			} else
    73 			{
    74 				mainWindow->setProgressMinimum (0);
    75 				mainWindow->setProgressMaximum (0);
    76 				mainWindow->setProgressValue(0);
    77 			}
    78 
    79 				
    80 			if (!atts.value( "backgroundColor").isEmpty() )
    81 			{
    82 				col.setNamedColor(atts.value("backgroundColor"));
    83 				model->getScene()->setBackgroundBrush(col);
    84 			}	    
    85 			if (!atts.value( "selectionColor").isEmpty() )
    86 			{
    87 				col.setNamedColor(atts.value("selectionColor"));
    88 				model->setSelectionColor(col);
    89 			}	    
    90 			if (!atts.value( "linkColorHint").isEmpty() ) 
    91 			{
    92 				if (atts.value("linkColorHint")=="HeadingColor")
    93 					model->setMapLinkColorHint(LinkableMapObj::HeadingColor);
    94 				else
    95 					model->setMapLinkColorHint(LinkableMapObj::DefaultColor);
    96 			}
    97 			if (!atts.value( "linkStyle").isEmpty() ) 
    98 				model->setMapLinkStyle(atts.value("linkStyle"));
    99 			if (!atts.value( "linkColor").isEmpty() ) 
   100 			{
   101 				col.setNamedColor(atts.value("linkColor"));
   102 				model->setMapDefLinkColor(col);
   103 			}	
   104 			if (!atts.value( "defXLinkColor").isEmpty() ) 
   105 			{
   106 				col.setNamedColor(atts.value("defXLinkColor"));
   107 				model->setMapDefXLinkColor(col);
   108 			}	
   109 			if (!atts.value( "defXLinkWidth").isEmpty() ) 
   110 				model->setMapDefXLinkWidth(atts.value("defXLinkWidth").toInt ());
   111 		}	
   112 		// Check version
   113 		if (!atts.value( "version").isEmpty() ) 
   114 		{
   115 			if (!checkVersion(atts.value("version")))
   116 				QMessageBox::warning( 0, "Warning: Version Problem" ,
   117 				   "<h3>Map is newer than VYM</h3>"
   118 				   "<p>The map you are just trying to load was "
   119 				   "saved using vym " +atts.value("version")+". "
   120 				   "The version of this vym is " + vymVersion + 
   121 				   ". If you run into problems after pressing "
   122 				   "the ok-button below, updating vym should help.");
   123 			else	   
   124 				model->setVersion(atts.value( "version" ));
   125 
   126 		}
   127 
   128 	} else if ( eName == "select" && state == StateMap ) 
   129 	{
   130 		state=StateMapSelect;
   131 	} else if ( eName == "setting" && state == StateMap ) 
   132 	{
   133 		state=StateMapSetting;
   134 		if (loadMode==NewMap)
   135 			readSettingAttr (atts);
   136 	} else if ( eName == "mapcenter" && state == StateMap ) 
   137 	{
   138 		state=StateMapCenter;
   139 		if (loadMode==NewMap)
   140 		{	
   141 			// Really use the found mapcenter as MCO in a new map
   142 
   143 			lastBranchItem=(BranchItem*)model->createMapCenter(); 
   144 		} else
   145 		{
   146 			// Treat the found mapcenter as a branch 
   147 			// in an existing map
   148 			BranchItem *bi=model->getSelectedBranchItem();
   149 			if (bi)
   150 			{
   151 				lastBranchItem=bi;
   152 				if (loadMode==ImportAdd)
   153 				{
   154 					model->createBranch();
   155 					lastBranchItem=model->getSelectedBranchItem();
   156 				} //else
   157 					//FIXME-3 lastBranch->clear();
   158 			} else
   159 				return false;
   160 		}
   161 		readBranchAttr (atts);
   162 	} else if ( 
   163 		(eName == "standardflag" ||eName == "standardFlag") && 
   164 		(state == StateMapCenter || state==StateBranch)) 
   165 	{
   166 		state=StateStandardFlag;
   167 	} else if ( eName == "heading" && (state == StateMapCenter||state==StateBranch)) 
   168 	{
   169 		laststate=state;
   170 		state=StateHeading;
   171 		if (!atts.value( "textColor").isEmpty() ) 
   172 		{
   173 			col.setNamedColor(atts.value("textColor"));
   174 			lastBranchItem->setHeadingColor(col );
   175 		}	    
   176 	} else if ( eName == "note" && 
   177 				(state == StateMapCenter ||state==StateBranch))
   178 	{	// only for backward compatibility (<1.4.6). Use htmlnote now.
   179 		state=StateNote;
   180 		if (!readNoteAttr (atts) ) return false;
   181 	} else if ( eName == "htmlnote" && state == StateMapCenter) 
   182 	{
   183 		laststate=state;
   184 		state=StateHtmlNote;
   185     } else if ( eName == "floatimage" && 
   186 				(state == StateMapCenter ||state==StateBranch)) 
   187 	{
   188 		state=StateFloatImage;
   189         //FIXME-2lastBranch->addFloatImage();
   190 		//FIXME-2lastFloat=lastBranch->getLastFloatImage();
   191 		if (!readFloatImageAttr(atts)) return false;
   192 	} else if ( (eName == "branch"||eName=="floatimage") && state == StateMap) 
   193 	{
   194 		// This is used in vymparts, which have no mapcenter!
   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 		}	
   207 		if (ti && ti->isBranchLikeType() )
   208 		{
   209 			lastBranchItem=(BranchItem*)ti;
   210 			if (eName=="branch")
   211 			{
   212 				state=StateBranch;
   213 				if (loadMode==ImportAdd)
   214 				{
   215 					model->createBranch();
   216 					lastBranchItem=model->getSelectedBranchItem();
   217 					
   218 				} else
   219 					//FIXME-2 lastBranch->clear();
   220 				readBranchAttr (atts);
   221 			} else if (eName=="floatimage")
   222 			{
   223 				state=StateFloatImage;
   224 				//FIXME-2 lastBranch->addFloatImage();
   225 				//FIXME-2 lastFloat=lastBranch->getLastFloatImage();
   226 				if (!readFloatImageAttr(atts)) return false;
   227 			} else return false;
   228 		} else return false;
   229 	} else if ( eName == "branch" && state == StateMapCenter) 
   230 	{
   231 		state=StateBranch;
   232 		lastBranchItem=model->createBranch();
   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 == "branch" && state == StateBranch ) 
   251 	{
   252 		lastBranchItem=model->createBranch();
   253 		readBranchAttr (atts);
   254     } else if ( eName == "html" && state == StateHtmlNote ) 
   255 	{
   256 		state=StateHtml;
   257 		htmldata="<"+eName;
   258 		readHtmlAttr(atts);
   259 		htmldata+=">";
   260     } else if ( state == StateHtml ) 
   261 	{
   262 		// accept all while in html mode,
   263 		htmldata+="<"+eName;
   264 		readHtmlAttr(atts);
   265 		htmldata+=">";
   266     } else
   267         return false;   // Error
   268     return true;
   269 }
   270 
   271 bool parseVYMHandler::endElement  ( const QString&, const QString&, const QString &eName)
   272 {
   273 	/* Testing
   274 	cout << "endElement </" <<qPrintable(eName)
   275 		<<">  state=" <<state 
   276 		<<"  laststate=" <<laststate
   277 		<<"  stateStack="<<stateStack.last() 
   278 		<<endl;
   279 	*/
   280     switch ( state ) 
   281 	{
   282 		case StateMap:
   283 			mainWindow->removeProgressBar();
   284 			break;
   285         case StateMapCenter: 
   286 			model->selectParent();
   287 			model->emitDataHasChanged (lastBranchItem);
   288 			lastBranchItem=model->getSelectedBranchItem();
   289 			lastBranchItem->setLastSelectedBranch (0);	// Reset last selected to first child branch
   290             break;
   291         case StateBranch: 
   292 			model->selectParent();
   293 			model->emitDataHasChanged (lastBranchItem);
   294 			lastBranchItem=model->getSelectedBranchItem();
   295 			lastBranchItem->setLastSelectedBranch (0);	// Reset last selected to first child branch
   296             break;
   297         case StateHtml: 
   298 			htmldata+="</"+eName+">";
   299 			if (eName=="html")
   300 			{
   301 				state=StateHtmlNote;  
   302 				htmldata.replace ("<br></br>","<br />");
   303 				no.setNote (htmldata);
   304 				lastBranchItem->setNoteObj (no);
   305 			}	
   306 			break;
   307 		default: 
   308 			break;
   309     }  
   310 	state=stateStack.takeLast();	
   311 	return true;
   312 }
   313 
   314 bool parseVYMHandler::characters   ( const QString& ch)
   315 {
   316 	//cout << "characters \""<<ch.toStdString()<<"\"  state="<<state <<"  laststate="<<laststate<<endl;
   317 
   318 	QString ch_org=quotemeta (ch);
   319     QString ch_simplified=ch.simplifyWhiteSpace();
   320     if ( ch_simplified.isEmpty() ) return true;
   321 
   322     switch ( state ) 
   323     {
   324         case StateInit: break;
   325         case StateMap: break; 
   326 		case StateMapSelect:
   327 			model->select(ch_simplified);
   328 			break;
   329 		case StateMapSetting:break;
   330         case StateMapCenter: break;
   331         case StateNote:
   332 			lastBranchItem->setNote(ch_simplified);
   333 			break;
   334         case StateBranch: break;
   335         case StateStandardFlag: 
   336             lastBranchItem->activateStandardFlag(ch_simplified); 
   337             break;
   338         case StateFloatImage: break;
   339         case StateHtmlNote: break;
   340         case StateHtml:
   341 			htmldata+=ch_org;
   342 			break;
   343         case StateHeading: 
   344             model->setHeading(ch_simplified);
   345             break;
   346         default: 
   347 			return false;
   348     }
   349     return true;
   350 }
   351 
   352 QString parseVYMHandler::errorString() 
   353 {
   354     return "the document is not in the VYM file format";
   355 }
   356 
   357 bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a)	//FIXME-2
   358 {
   359 	mainWindow->setProgressValue (branchesCurrent++);
   360 
   361 	if (!readOOAttr(a)) return false;
   362 
   363 	if (!a.value( "scrolled").isEmpty() )
   364 		lastBranchItem->toggleScroll();
   365 /*
   366 	if (!a.value( "frameType").isEmpty() ) 
   367 		lastOO->setFrameType (a.value("frameType")); //Compatibility 1.8.1
   368 
   369 	if (!a.value( "incImgV").isEmpty() ) 
   370 	{	
   371 		if (a.value("incImgV")=="true")
   372 			lastBranch->setIncludeImagesVer(true);
   373 		else	
   374 			lastBranch->setIncludeImagesVer(false);
   375 	}	
   376 	if (!a.value( "incImgH").isEmpty() ) 
   377 	{	
   378 		if (a.value("incImgH")=="true")
   379 			lastBranch->setIncludeImagesHor(true);
   380 		else	
   381 			lastBranch->setIncludeImagesHor(false);
   382 	}	
   383 */	
   384 	return true;	
   385 }
   386 
   387 bool parseVYMHandler::readFrameAttr (const QXmlAttributes& a)
   388 {
   389 	bool ok;
   390 	int x;
   391 	if (lastOO)
   392 	{
   393 		if (!a.value( "frameType").isEmpty() ) 
   394 			lastOO->setFrameType (a.value("frameType"));
   395 		if (!a.value( "penColor").isEmpty() ) 
   396 			lastOO->setFramePenColor (a.value("penColor"));
   397 		if (!a.value( "brushColor").isEmpty() ) 
   398 			lastOO->setFrameBrushColor (a.value("brushColor"));
   399 		if (!a.value( "padding").isEmpty() ) 
   400 		{
   401 			x=a.value("padding").toInt(&ok);
   402 			if (ok) lastOO->setFramePadding(x);
   403 		}	
   404 		if (!a.value( "borderWidth").isEmpty() ) 
   405 		{
   406 			x=a.value("borderWidth").toInt(&ok);
   407 			if (ok) lastOO->setFrameBorderWidth(x);
   408 		}	
   409 	}		
   410 	return true;
   411 }
   412 
   413 bool parseVYMHandler::readOOAttr (const QXmlAttributes& a)
   414 {
   415 	if (lastBranchItem)
   416 	{
   417 		bool okx,oky;
   418 		float x,y;
   419 		if (!a.value( "relPosX").isEmpty() ) 
   420 		{
   421 			if (!a.value( "relPosY").isEmpty() ) 
   422 			{
   423 				x=a.value("relPosX").toFloat (&okx);
   424 				y=a.value("relPosY").toFloat (&oky);
   425 				if (okx && oky  )
   426 					lastBranchItem->setRelPos (QPointF(x,y));
   427 				else
   428 					return false;   // Couldn't read relPos
   429 			}           
   430 		}           
   431 		if (!a.value( "absPosX").isEmpty() && loadMode==NewMap ) 
   432 		{
   433 			if (!a.value( "absPosY").isEmpty() ) 
   434 			{
   435 				x=a.value("absPosX").toFloat (&okx);
   436 				y=a.value("absPosY").toFloat (&oky);
   437 				if (okx && oky  )
   438 					lastBranchItem->setAbsPos (QPointF(x,y));
   439 				else
   440 					return false;   // Couldn't read absPos
   441 			}           
   442 		}           
   443 		//if (!a.value( "id").isEmpty() ) 
   444 		//	lastBranchItem->setID (a.value ("id"));
   445 			
   446 		if (!a.value( "url").isEmpty() ) 
   447 			lastBranchItem->setURL (a.value ("url"));
   448 		if (!a.value( "vymLink").isEmpty() ) 
   449 			lastBranchItem->setVymLink (a.value ("vymLink"));
   450 		if (!a.value( "hideInExport").isEmpty() ) 
   451 			if (a.value("hideInExport")=="true")
   452 				lastBranchItem->setHideInExport(true);
   453 
   454 		/* FIXME-2
   455 		if (!a.value( "hideLink").isEmpty()) 
   456 		{
   457 			if (a.value ("hideLink") =="true")
   458 				lastOO->setHideLinkUnselected(true);
   459 			else	
   460 				lastOO->setHideLinkUnselected(false);
   461 		}	
   462 		*/
   463 	}
   464 	return true;	
   465 }
   466 
   467 bool parseVYMHandler::readNoteAttr (const QXmlAttributes& a)
   468 {	// only for backward compatibility (<1.4.6). Use htmlnote now.
   469 	no.clear();
   470 	QString fn;
   471 	if (!a.value( "href").isEmpty() ) 
   472 	{
   473 		// Load note
   474 		fn=parseHREF(a.value ("href") );
   475 		QFile file (fn);
   476 		QString s;						// Reading a note
   477 
   478 		if ( !file.open( QIODevice::ReadOnly) )
   479 		{
   480 			qWarning ("parseVYMHandler::readNoteAttr:  Couldn't load "+fn);
   481 			return false;
   482 		}	
   483 		QTextStream stream( &file );
   484 		QString lines;
   485 		while ( !stream.atEnd() ) {
   486 			lines += stream.readLine()+"\n"; 
   487 		}
   488 		file.close();
   489 
   490 		lines ="<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>"+lines + "</p></body></html>";
   491 		no.setNote (lines);
   492 	}		
   493 	if (!a.value( "fonthint").isEmpty() ) 
   494 		no.setFontHint(a.value ("fonthint") );
   495 	lastBranchItem->setNoteObj(no);
   496 	return true;
   497 }
   498 
   499 bool parseVYMHandler::readFloatImageAttr (const QXmlAttributes& a)
   500 {
   501 	lastOO=lastFloat;
   502 	
   503 	//if (!readOOAttr(a)) return false;
   504 
   505 	if (!a.value( "useOrientation").isEmpty() ) 
   506 	{
   507 		if (a.value ("useOrientation") =="true")
   508 			lastFloat->setUseOrientation (true);
   509 		else	
   510 			lastFloat->setUseOrientation (false);
   511 	}	
   512 	if (!a.value( "href").isEmpty() )
   513 	{
   514 		// Load FloatImage
   515 		if (!lastFloat->load (parseHREF(a.value ("href") ) ))
   516 		{
   517 			QMessageBox::warning( 0, "Warning: " ,
   518 				"Couldn't load float image\n"+parseHREF(a.value ("href") ));
   519 			//FIXME-2 lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
   520 			lastFloat=NULL;
   521 			return true;
   522 		}
   523 		
   524 	}	
   525 	if (!a.value( "floatExport").isEmpty() ) 
   526 	{
   527 		// Only for compatibility. THis is not used since 1.7.11 
   528 		if (a.value ("floatExport") =="true")
   529 			lastFloat->setFloatExport(true);
   530 		else	
   531 			lastFloat->setFloatExport (false);
   532 	}	
   533 	if (!a.value( "zPlane").isEmpty() ) 
   534 		lastFloat->setZValue (a.value("zPlane").toInt ());
   535     float x,y;
   536     bool okx,oky;
   537 	if (!a.value( "relPosX").isEmpty() ) 
   538 	{
   539 		if (!a.value( "relPosY").isEmpty() ) 
   540 		{
   541 			// read relPos
   542 			x=a.value("relPosX").toFloat (&okx);
   543 			y=a.value("relPosY").toFloat (&oky);
   544 			if (okx && oky) 
   545 				
   546 				{
   547 					lastFloat->setRelPos (QPointF (x,y) );
   548 					// make sure floats in mapcenter are repositioned to relative pos
   549 					//FIXME-2 if (lastBranchItem->depth()==0) lastBranch->positionContents();
   550 				}
   551 			else
   552 				// Couldn't read relPos
   553 				return false;  
   554 		}           
   555 	}	
   556 	
   557 	if (!readOOAttr(a)) return false;
   558 
   559 	if (!a.value ("orgName").isEmpty() )
   560 	{
   561 		((FloatImageObj*)(lastFloat))->setOriginalFilename (a.value("orgName"));
   562 	}
   563 	return true;
   564 }
   565 
   566 bool parseVYMHandler::readXLinkAttr (const QXmlAttributes& a)
   567 {
   568 	QColor col;
   569 	bool okx;
   570 	bool success=false;
   571 	XLinkObj *xlo=new XLinkObj (model->getScene());
   572 	if (!a.value( "color").isEmpty() ) 
   573 	{
   574 		col.setNamedColor(a.value("color"));
   575 		xlo->setColor (col);
   576 	}
   577 
   578 	if (!a.value( "width").isEmpty() ) 
   579 	{
   580 		xlo->setWidth(a.value ("width").toInt (&okx, 10));
   581 	}
   582 
   583 	// Connecting by select string for compatibility with version < 1.8.76
   584 	if (!a.value( "beginBranch").isEmpty() ) 
   585 	{ 
   586 		if (!a.value( "endBranch").isEmpty() ) 
   587 		{
   588 			TreeItem *ti=model->findBySelectString (a.value( "beginBranch"));
   589 			if (ti && ti->isBranchLikeType())
   590 			{
   591 			/* FIXME-2 xLinks
   592 				xlo->setBegin ((BranchObj*)lmo);
   593 				lmo=model->findBySelectString (a.value( "endBranch"));
   594 				if (lmo && typeid (*lmo)==typeid (BranchObj))
   595 				{
   596 					xlo->setEnd ((BranchObj*)(lmo));
   597 					xlo->activate();
   598 					success=true;
   599 				}
   600 			*/
   601 			}
   602 		}           
   603 	}	
   604 
   605 	// object ID is used starting in version 1.8.76
   606 	/* FIXME-2 xLinks
   607 	if (!a.value( "beginID").isEmpty() ) 
   608 	{ 
   609 		if (!a.value( "endID").isEmpty() ) 
   610 		{
   611 			LinkableMapObj *lmo=model->findID (a.value( "beginID"));
   612 			if (lmo && typeid (*lmo)==typeid (BranchObj))
   613 			{
   614 				xlo->setBegin ((BranchObj*)lmo);
   615 				lmo=model->findID (a.value( "endID"));
   616 				if (lmo && typeid (*lmo)==typeid (BranchObj))
   617 				{
   618 					xlo->setEnd ((BranchObj*)(lmo));
   619 					xlo->activate();
   620 					success=true;
   621 				}
   622 			}
   623 		}           
   624 	}	
   625 	*/
   626 	if (!success) delete (xlo);
   627 	return true;	// xLinks can only be established at the "end branch", return true
   628 }
   629 
   630 bool parseVYMHandler::readHtmlAttr (const QXmlAttributes& a)
   631 {
   632 	for (int i=1; i<=a.count(); i++)
   633 		htmldata+=" "+a.localName(i-1)+"=\""+a.value(i-1)+"\"";
   634 	return true;
   635 }
   636 
   637 bool parseVYMHandler::readSettingAttr (const QXmlAttributes& a)
   638 {
   639 	if (!a.value( "key").isEmpty() ) 
   640 	{
   641 		if (!a.value( "value").isEmpty() ) 
   642 			settings.setLocalEntry (model->getDestPath(), a.value ("key"), a.value ("value"));
   643 		else
   644 			return false;
   645 		
   646 	} else
   647 		return false;
   648 	
   649 	return true;
   650 }