1.8.76 - Extended fileformat to ease tomboy export to vym
authorinsilmaril
Fri, 29 Jun 2007 09:43:53 +0000
changeset 529ce2abdbd0b65
parent 528 36d140349897
child 530 28be7520cb21
1.8.76 - Extended fileformat to ease tomboy export to vym
branchobj.cpp
branchobj.h
xml.cpp
     1.1 --- a/branchobj.cpp	Mon Jun 25 12:54:19 2007 +0000
     1.2 +++ b/branchobj.cpp	Fri Jun 29 09:43:53 2007 +0000
     1.3 @@ -697,6 +697,31 @@
     1.4      return NULL;
     1.5  }
     1.6  
     1.7 +LinkableMapObj* BranchObj::findID (QString sid)
     1.8 +{
     1.9 +	// Search branches
    1.10 +    LinkableMapObj *lmo;
    1.11 +	for (int i=0; i<branch.size(); ++i)
    1.12 +    {	
    1.13 +		lmo=branch.at(i)->findID (sid);
    1.14 +		if (lmo != NULL) return lmo;
    1.15 +    }
    1.16 +	
    1.17 +	// Search myself
    1.18 +	if (sid==id) return this;
    1.19 +
    1.20 +/*
    1.21 +	// Search float images
    1.22 +    for (int i=0; i<floatimage.size(); ++i )
    1.23 +		if (floatimage.at(i)->inBox(p) && 
    1.24 +			(floatimage.at(i) != excludeLMO) && 
    1.25 +			floatimage.at(i)->getParObj()!= excludeLMO &&
    1.26 +			floatimage.at(i)->isVisibleObj() 
    1.27 +		) return floatimage.at(i);
    1.28 +*/
    1.29 +    return NULL;
    1.30 +}
    1.31 +
    1.32  void BranchObj::setHeading(QString s)
    1.33  {
    1.34      heading->setText(s);	// set new heading
     2.1 --- a/branchobj.h	Mon Jun 25 12:54:19 2007 +0000
     2.2 +++ b/branchobj.h	Fri Jun 29 09:43:53 2007 +0000
     2.3 @@ -64,6 +64,7 @@
     2.4      virtual void calcBBoxSize();
     2.5  	virtual void setDockPos();
     2.6      virtual LinkableMapObj* findMapObj(QPointF,LinkableMapObj*);	// find MapObj 
     2.7 +    virtual LinkableMapObj* findID (QString sid);	// find Obj by ID string
     2.8      virtual void setHeading (QString);
     2.9  
    2.10  	virtual void setHideTmp (HideTmpMode);
    2.11 @@ -139,6 +140,7 @@
    2.12  	bool tmpUnscrolled;				// can only be true (temporary) for a scrolled subtree
    2.13  	bool includeImagesVer;			// include floatimages in bbox vertically
    2.14  	bool includeImagesHor;			// include floatimages in bbox horizontally
    2.15 +	QString id;						// IDstring, needed for xlinks (tomboy)
    2.16  
    2.17  };
    2.18  
     3.1 --- a/xml.cpp	Mon Jun 25 12:54:19 2007 +0000
     3.2 +++ b/xml.cpp	Fri Jun 29 09:43:53 2007 +0000
     3.3 @@ -479,6 +479,8 @@
     3.4  					return false;   // Couldn't read absPos
     3.5  			}           
     3.6  		}           
     3.7 +		if (!a.value( "id").isEmpty() ) 
     3.8 +			lastOO->setID (a.value ("id"));
     3.9  		if (!a.value( "url").isEmpty() ) 
    3.10  			lastOO->setURL (a.value ("url"));
    3.11  		if (!a.value( "vymLink").isEmpty() ) 
    3.12 @@ -614,6 +616,7 @@
    3.13  		xlo->setWidth(a.value ("width").toInt (&okx, 10));
    3.14  	}
    3.15  
    3.16 +	// Connecting by select string for compatibility with version < 1.8.76
    3.17  	if (!a.value( "beginBranch").isEmpty() ) 
    3.18  	{ 
    3.19  		if (!a.value( "endBranch").isEmpty() ) 
    3.20 @@ -632,6 +635,26 @@
    3.21  			success=true; // Not all branches there yet, no error
    3.22  		}           
    3.23  	}	
    3.24 +
    3.25 +	// object ID is used starting in version 1.8.76
    3.26 +	if (!a.value( "beginID").isEmpty() ) 
    3.27 +	{ 
    3.28 +		if (!a.value( "endID").isEmpty() ) 
    3.29 +		{
    3.30 +			LinkableMapObj *lmo=mc->findID (a.value( "beginBranch"));
    3.31 +			if (lmo && typeid (*lmo)==typeid (BranchObj))
    3.32 +			{
    3.33 +				xlo->setBegin ((BranchObj*)lmo);
    3.34 +				lmo=mc->findID (a.value( "endID"));
    3.35 +				if (lmo && typeid (*lmo)==typeid (BranchObj))
    3.36 +				{
    3.37 +					xlo->setEnd ((BranchObj*)(lmo));
    3.38 +					xlo->activate();
    3.39 +				}
    3.40 +			}
    3.41 +			success=true; // Not all branches there yet, no error
    3.42 +		}           
    3.43 +	}	
    3.44  	if (!success) delete (xlo);
    3.45  	return success;
    3.46  }