xml-vym.cpp
author insilmaril
Wed, 03 Jun 2009 20:37:17 +0000
changeset 775 6e4b586aa88a
parent 773 340bc29da9a0
child 776 25e634a7e1dc
permissions -rw-r--r--
Unscrolling temporary works again
     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 					lastBranchItem=model->createBranch(lastBranchItem);
   155 				} //else
   156 					//FIXME-3 lastBranch->clear();
   157 			} else
   158 				return false;
   159 		}
   160 		readBranchAttr (atts);
   161 	} else if ( 
   162 		(eName == "standardflag" ||eName == "standardFlag") && 
   163 		(state == StateMapCenter || state==StateBranch)) 
   164 	{
   165 		state=StateStandardFlag;
   166 	} else if ( eName == "heading" && (state == StateMapCenter||state==StateBranch)) 
   167 	{
   168 		laststate=state;
   169 		state=StateHeading;
   170 		if (!atts.value( "textColor").isEmpty() ) 
   171 		{
   172 			col.setNamedColor(atts.value("textColor"));
   173 			lastBranchItem->setHeadingColor(col );
   174 		}	    
   175 	} else if ( eName == "note" && 
   176 				(state == StateMapCenter ||state==StateBranch))
   177 	{	// only for backward compatibility (<1.4.6). Use htmlnote now.
   178 		state=StateNote;
   179 		if (!readNoteAttr (atts) ) return false;
   180 	} else if ( eName == "htmlnote" && state == StateMapCenter) 
   181 	{
   182 		laststate=state;
   183 		state=StateHtmlNote;
   184     } else if ( eName == "floatimage" && 
   185 				(state == StateMapCenter ||state==StateBranch)) 
   186 	{
   187 		state=StateFloatImage;
   188         //FIXME-2 lastBranch->addFloatImage();
   189 		//FIXME-2 lastFloat=lastBranch->getLastFloatImage();
   190 		if (!readFloatImageAttr(atts)) return false;
   191 	} else if ( (eName == "branch"||eName=="floatimage") && state == StateMap) 
   192 	{
   193 		// This is used in vymparts, which have no mapcenter!
   194 		isVymPart=true;
   195 		TreeItem *ti=model->getSelectedItem();
   196 		if (!ti)
   197 		{
   198 			// If a vym part is _loaded_ (not imported), 
   199 			// selection==lmo==NULL
   200 			// Treat it like ImportAdd then...
   201 			loadMode=ImportAdd;
   202 			// FIXME-3 lmo=model->first()->getLMO();		
   203 			// Do we really have no MCO when loading?????
   204 			cout << "xml-vym aborted\n";
   205 		}	
   206 		if (ti && ti->isBranchLikeType() )
   207 		{
   208 			lastBranchItem=(BranchItem*)ti;
   209 			if (eName=="branch")
   210 			{
   211 				state=StateBranch;
   212 				if (loadMode==ImportAdd)
   213 				{
   214 					lastBranchItem=model->createBranch(lastBranchItem);
   215 					
   216 				} else
   217 					//FIXME-2 lastBranch->clear();
   218 				readBranchAttr (atts);
   219 			} else if (eName=="floatimage")
   220 			{
   221 				state=StateFloatImage;
   222 				//FIXME-2 lastBranch->addFloatImage();
   223 				//FIXME-2 lastFloat=lastBranch->getLastFloatImage();
   224 				if (!readFloatImageAttr(atts)) return false;
   225 			} else return false;
   226 		} else return false;
   227 	} else if ( eName == "branch" && state == StateMapCenter) 
   228 	{
   229 		state=StateBranch;
   230 		lastBranchItem=model->createBranch(lastBranchItem);
   231 		readBranchAttr (atts);
   232 	} else if ( eName == "htmlnote" && state == StateBranch) 
   233 	{
   234 		laststate=state;
   235 		state=StateHtmlNote;
   236 		no.clear();
   237 		if (!atts.value( "fonthint").isEmpty() ) 
   238 			no.setFontHint(atts.value ("fonthint") );
   239 	} else if ( eName == "frame" && (state == StateBranch||state==StateMapCenter)) 
   240 	{
   241 		laststate=state;
   242 		state=StateFrame;
   243 		if (!readFrameAttr(atts)) return false;
   244     } else if ( eName == "xlink" && state == StateBranch ) 
   245 	{
   246 		state=StateBranchXLink;
   247 		if (!readXLinkAttr (atts)) return false;
   248     } else if ( eName == "branch" && state == StateBranch ) 
   249 	{
   250 		lastBranchItem=model->createBranch(lastBranchItem);
   251 		readBranchAttr (atts);
   252     } else if ( eName == "html" && state == StateHtmlNote ) 
   253 	{
   254 		state=StateHtml;
   255 		htmldata="<"+eName;
   256 		readHtmlAttr(atts);
   257 		htmldata+=">";
   258     } else if ( state == StateHtml ) 
   259 	{
   260 		// accept all while in html mode,
   261 		htmldata+="<"+eName;
   262 		readHtmlAttr(atts);
   263 		htmldata+=">";
   264     } else
   265         return false;   // Error
   266     return true;
   267 }
   268 
   269 bool parseVYMHandler::endElement  ( const QString&, const QString&, const QString &eName)
   270 {
   271 	/* Testing
   272 	cout << "endElement </" <<qPrintable(eName)
   273 		<<">  state=" <<state 
   274 		<<"  laststate=" <<laststate
   275 		<<"  stateStack="<<stateStack.last() 
   276 		<<endl;
   277 	*/
   278     switch ( state ) 
   279 	{
   280 		case StateMap:
   281 			mainWindow->removeProgressBar();
   282 			break;
   283         case StateMapCenter: 
   284 			model->selectParent();
   285 			model->emitDataHasChanged (lastBranchItem);
   286 			lastBranchItem=(BranchItem*)(lastBranchItem->parent());
   287 			lastBranchItem->setLastSelectedBranch (0);	// Reset last selected to first child branch
   288             break;
   289         case StateBranch: 
   290 			model->selectParent();
   291 			model->emitDataHasChanged (lastBranchItem);
   292 			lastBranchItem=(BranchItem*)(lastBranchItem->parent());
   293 			lastBranchItem->setLastSelectedBranch (0);	// Reset last selected to first child branch
   294             break;
   295         case StateHtml: 
   296 			htmldata+="</"+eName+">";
   297 			if (eName=="html")
   298 			{
   299 				state=StateHtmlNote;  
   300 				htmldata.replace ("<br></br>","<br />");
   301 				no.setNote (htmldata);
   302 				lastBranchItem->setNoteObj (no);
   303 			}	
   304 			break;
   305 		default: 
   306 			break;
   307     }  
   308 	state=stateStack.takeLast();	
   309 	return true;
   310 }
   311 
   312 bool parseVYMHandler::characters   ( const QString& ch)
   313 {
   314 	//cout << "characters \""<<ch.toStdString()<<"\"  state="<<state <<"  laststate="<<laststate<<endl;
   315 
   316 	QString ch_org=quotemeta (ch);
   317     QString ch_simplified=ch.simplifyWhiteSpace();
   318     if ( ch_simplified.isEmpty() ) return true;
   319 
   320     switch ( state ) 
   321     {
   322         case StateInit: break;
   323         case StateMap: break; 
   324 		case StateMapSelect:
   325 			model->select(ch_simplified);
   326 			break;
   327 		case StateMapSetting:break;
   328         case StateMapCenter: break;
   329         case StateNote:
   330 			lastBranchItem->setNote(ch_simplified);
   331 			break;
   332         case StateBranch: break;
   333         case StateStandardFlag: 
   334             lastBranchItem->activateStandardFlag(ch_simplified); 
   335             break;
   336         case StateFloatImage: break;
   337         case StateHtmlNote: break;
   338         case StateHtml:
   339 			htmldata+=ch_org;
   340 			break;
   341         case StateHeading: 
   342             lastBranchItem->setHeading(ch_simplified);
   343             break;
   344         default: 
   345 			return false;
   346     }
   347     return true;
   348 }
   349 
   350 QString parseVYMHandler::errorString() 
   351 {
   352     return "the document is not in the VYM file format";
   353 }
   354 
   355 bool parseVYMHandler::readBranchAttr (const QXmlAttributes& a)	//FIXME-2
   356 {
   357 	mainWindow->setProgressValue (branchesCurrent++);
   358 
   359 	if (!readOOAttr(a)) return false;
   360 
   361 	if (!a.value( "scrolled").isEmpty() )
   362 		lastBranchItem->toggleScroll();
   363 /*
   364 	if (!a.value( "frameType").isEmpty() ) 
   365 		lastOO->setFrameType (a.value("frameType")); //Compatibility 1.8.1
   366 
   367 	if (!a.value( "incImgV").isEmpty() ) 
   368 	{	
   369 		if (a.value("incImgV")=="true")
   370 			lastBranch->setIncludeImagesVer(true);
   371 		else	
   372 			lastBranch->setIncludeImagesVer(false);
   373 	}	
   374 	if (!a.value( "incImgH").isEmpty() ) 
   375 	{	
   376 		if (a.value("incImgH")=="true")
   377 			lastBranch->setIncludeImagesHor(true);
   378 		else	
   379 			lastBranch->setIncludeImagesHor(false);
   380 	}	
   381 */	
   382 	return true;	
   383 }
   384 
   385 bool parseVYMHandler::readFrameAttr (const QXmlAttributes& a)
   386 {
   387 	bool ok;
   388 	int x;
   389 	if (lastOO)
   390 	{
   391 		if (!a.value( "frameType").isEmpty() ) 
   392 			lastOO->setFrameType (a.value("frameType"));
   393 		if (!a.value( "penColor").isEmpty() ) 
   394 			lastOO->setFramePenColor (a.value("penColor"));
   395 		if (!a.value( "brushColor").isEmpty() ) 
   396 			lastOO->setFrameBrushColor (a.value("brushColor"));
   397 		if (!a.value( "padding").isEmpty() ) 
   398 		{
   399 			x=a.value("padding").toInt(&ok);
   400 			if (ok) lastOO->setFramePadding(x);
   401 		}	
   402 		if (!a.value( "borderWidth").isEmpty() ) 
   403 		{
   404 			x=a.value("borderWidth").toInt(&ok);
   405 			if (ok) lastOO->setFrameBorderWidth(x);
   406 		}	
   407 	}		
   408 	return true;
   409 }
   410 
   411 bool parseVYMHandler::readOOAttr (const QXmlAttributes& a)
   412 {
   413 	if (lastBranchItem)
   414 	{
   415 		bool okx,oky;
   416 		float x,y;
   417 		if (!a.value( "relPosX").isEmpty() ) 
   418 		{
   419 			if (!a.value( "relPosY").isEmpty() ) 
   420 			{
   421 				x=a.value("relPosX").toFloat (&okx);
   422 				y=a.value("relPosY").toFloat (&oky);
   423 				if (okx && oky  )
   424 					lastBranchItem->setRelPos (QPointF(x,y));
   425 				else
   426 					return false;   // Couldn't read relPos
   427 			}           
   428 		}           
   429 		if (!a.value( "absPosX").isEmpty() && loadMode==NewMap ) 
   430 		{
   431 			if (!a.value( "absPosY").isEmpty() ) 
   432 			{
   433 				x=a.value("absPosX").toFloat (&okx);
   434 				y=a.value("absPosY").toFloat (&oky);
   435 				if (okx && oky  )
   436 					lastBranchItem->setAbsPos (QPointF(x,y));
   437 				else
   438 					return false;   // Couldn't read absPos
   439 			}           
   440 		}           
   441 		//if (!a.value( "id").isEmpty() ) 
   442 		//	lastBranchItem->setID (a.value ("id"));
   443 			
   444 		if (!a.value( "url").isEmpty() ) 
   445 			lastBranchItem->setURL (a.value ("url"));
   446 		if (!a.value( "vymLink").isEmpty() ) 
   447 			lastBranchItem->setVymLink (a.value ("vymLink"));
   448 		if (!a.value( "hideInExport").isEmpty() ) 
   449 			if (a.value("hideInExport")=="true")
   450 				lastBranchItem->setHideInExport(true);
   451 
   452 		/* FIXME-2
   453 		if (!a.value( "hideLink").isEmpty()) 
   454 		{
   455 			if (a.value ("hideLink") =="true")
   456 				lastOO->setHideLinkUnselected(true);
   457 			else	
   458 				lastOO->setHideLinkUnselected(false);
   459 		}	
   460 		*/
   461 	}
   462 	return true;	
   463 }
   464 
   465 bool parseVYMHandler::readNoteAttr (const QXmlAttributes& a)
   466 {	// only for backward compatibility (<1.4.6). Use htmlnote now.
   467 	no.clear();
   468 	QString fn;
   469 	if (!a.value( "href").isEmpty() ) 
   470 	{
   471 		// Load note
   472 		fn=parseHREF(a.value ("href") );
   473 		QFile file (fn);
   474 		QString s;						// Reading a note
   475 
   476 		if ( !file.open( QIODevice::ReadOnly) )
   477 		{
   478 			qWarning ("parseVYMHandler::readNoteAttr:  Couldn't load "+fn);
   479 			return false;
   480 		}	
   481 		QTextStream stream( &file );
   482 		QString lines;
   483 		while ( !stream.atEnd() ) {
   484 			lines += stream.readLine()+"\n"; 
   485 		}
   486 		file.close();
   487 
   488 		lines ="<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>"+lines + "</p></body></html>";
   489 		no.setNote (lines);
   490 	}		
   491 	if (!a.value( "fonthint").isEmpty() ) 
   492 		no.setFontHint(a.value ("fonthint") );
   493 	lastBranchItem->setNoteObj(no);
   494 	return true;
   495 }
   496 
   497 bool parseVYMHandler::readFloatImageAttr (const QXmlAttributes& a)
   498 {
   499 	lastOO=lastFloat;
   500 	
   501 	//if (!readOOAttr(a)) return false;
   502 
   503 	if (!a.value( "useOrientation").isEmpty() ) 
   504 	{
   505 		if (a.value ("useOrientation") =="true")
   506 			lastFloat->setUseOrientation (true);
   507 		else	
   508 			lastFloat->setUseOrientation (false);
   509 	}	
   510 	if (!a.value( "href").isEmpty() )
   511 	{
   512 		// Load FloatImage
   513 		if (!lastFloat->load (parseHREF(a.value ("href") ) ))
   514 		{
   515 			QMessageBox::warning( 0, "Warning: " ,
   516 				"Couldn't load float image\n"+parseHREF(a.value ("href") ));
   517 			//FIXME-2 lastBranch->removeFloatImage(((FloatImageObj*)(lastFloat)));
   518 			lastFloat=NULL;
   519 			return true;
   520 		}
   521 		
   522 	}	
   523 	if (!a.value( "floatExport").isEmpty() ) 
   524 	{
   525 		// Only for compatibility. THis is not used since 1.7.11 
   526 		if (a.value ("floatExport") =="true")
   527 			lastFloat->setFloatExport(true);
   528 		else	
   529 			lastFloat->setFloatExport (false);
   530 	}	
   531 	if (!a.value( "zPlane").isEmpty() ) 
   532 		lastFloat->setZValue (a.value("zPlane").toInt ());
   533     float x,y;
   534     bool okx,oky;
   535 	if (!a.value( "relPosX").isEmpty() ) 
   536 	{
   537 		if (!a.value( "relPosY").isEmpty() ) 
   538 		{
   539 			// read relPos
   540 			x=a.value("relPosX").toFloat (&okx);
   541 			y=a.value("relPosY").toFloat (&oky);
   542 			if (okx && oky) 
   543 				
   544 				{
   545 					lastFloat->setRelPos (QPointF (x,y) );
   546 					// make sure floats in mapcenter are repositioned to relative pos
   547 					//FIXME-2 if (lastBranchItem->depth()==0) lastBranch->positionContents();
   548 				}
   549 			else
   550 				// Couldn't read relPos
   551 				return false;  
   552 		}           
   553 	}	
   554 	
   555 	if (!readOOAttr(a)) return false;
   556 
   557 	if (!a.value ("orgName").isEmpty() )
   558 	{
   559 		((FloatImageObj*)(lastFloat))->setOriginalFilename (a.value("orgName"));
   560 	}
   561 	return true;
   562 }
   563 
   564 bool parseVYMHandler::readXLinkAttr (const QXmlAttributes& a)
   565 {
   566 	QColor col;
   567 	bool okx;
   568 	bool success=false;
   569 	XLinkObj *xlo=new XLinkObj (model->getScene());
   570 	if (!a.value( "color").isEmpty() ) 
   571 	{
   572 		col.setNamedColor(a.value("color"));
   573 		xlo->setColor (col);
   574 	}
   575 
   576 	if (!a.value( "width").isEmpty() ) 
   577 	{
   578 		xlo->setWidth(a.value ("width").toInt (&okx, 10));
   579 	}
   580 
   581 	// Connecting by select string for compatibility with version < 1.8.76
   582 	if (!a.value( "beginBranch").isEmpty() ) 
   583 	{ 
   584 		if (!a.value( "endBranch").isEmpty() ) 
   585 		{
   586 			TreeItem *ti=model->findBySelectString (a.value( "beginBranch"));
   587 			if (ti && ti->isBranchLikeType())
   588 			{
   589 			/* FIXME-2 xLinks
   590 				xlo->setBegin ((BranchObj*)lmo);
   591 				lmo=model->findBySelectString (a.value( "endBranch"));
   592 				if (lmo && typid (*lmo)==typid (BranchObj))
   593 				{
   594 					xlo->setEnd ((BranchObj*)(lmo));
   595 					xlo->activate();
   596 					success=true;
   597 				}
   598 			*/
   599 			}
   600 		}           
   601 	}	
   602 
   603 	// object ID is used starting in version 1.8.76
   604 	/* FIXME-2 xLinks
   605 	if (!a.value( "beginID").isEmpty() ) 
   606 	{ 
   607 		if (!a.value( "endID").isEmpty() ) 
   608 		{
   609 			LinkableMapObj *lmo=model->findID (a.value( "beginID"));
   610 			if (lmo && typid (*lmo)==typid (BranchObj))
   611 			{
   612 				xlo->setBegin ((BranchObj*)lmo);
   613 				lmo=model->findID (a.value( "endID"));
   614 				if (lmo && typid (*lmo)==typid (BranchObj))
   615 				{
   616 					xlo->setEnd ((BranchObj*)(lmo));
   617 					xlo->activate();
   618 					success=true;
   619 				}
   620 			}
   621 		}           
   622 	}	
   623 	*/
   624 	if (!success) delete (xlo);
   625 	return true;	// xLinks can only be established at the "end branch", return true
   626 }
   627 
   628 bool parseVYMHandler::readHtmlAttr (const QXmlAttributes& a)
   629 {
   630 	for (int i=1; i<=a.count(); i++)
   631 		htmldata+=" "+a.localName(i-1)+"=\""+a.value(i-1)+"\"";
   632 	return true;
   633 }
   634 
   635 bool parseVYMHandler::readSettingAttr (const QXmlAttributes& a)
   636 {
   637 	if (!a.value( "key").isEmpty() ) 
   638 	{
   639 		if (!a.value( "value").isEmpty() ) 
   640 			settings.setLocalEntry (model->getDestPath(), a.value ("key"), a.value ("value"));
   641 		else
   642 			return false;
   643 		
   644 	} else
   645 		return false;
   646 	
   647 	return true;
   648 }