branchitem.cpp
changeset 847 43268373032d
parent 845 b98c1793bb8b
     1.1 --- a/branchitem.cpp	Fri Apr 09 14:24:04 2010 +0000
     1.2 +++ b/branchitem.cpp	Wed Jun 09 13:14:08 2010 +0000
     1.3 @@ -1,13 +1,13 @@
     1.4 +#include "branchitem.h"
     1.5 +
     1.6  #include "attributeitem.h"
     1.7 -#include "branchitem.h"
     1.8  #include "branchobj.h"
     1.9  #include "vymmodel.h"
    1.10 +#include "xlink.h"
    1.11  #include "xlinkitem.h"
    1.12  
    1.13  #include <QDir>
    1.14  
    1.15 -using namespace std;
    1.16 -
    1.17  BranchItem::BranchItem(const QList<QVariant> &data, TreeItem *parent):MapItem (data,parent)
    1.18  {
    1.19  	//qDebug()<< "Constr. BranchItem";
    1.20 @@ -31,7 +31,7 @@
    1.21  
    1.22  BranchItem::~BranchItem()
    1.23  {
    1.24 -	qDebug()<< "Destr. BranchItem "<<getHeading();
    1.25 +	//qDebug()<< "Destr. BranchItem this="<<this<<"  "<<getHeading();
    1.26  	if (lmo) 
    1.27  	{
    1.28  		delete lmo;
    1.29 @@ -69,7 +69,7 @@
    1.30  	branchCounter++;
    1.31  }
    1.32  
    1.33 -QString BranchItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset) //FIXME-3 Check if everything is saved...
    1.34 +QString BranchItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset, QList <Link*> &tmpLinks ) //FIXME-3 Check if everything is saved...
    1.35  {
    1.36  	// Cloudy stuff can be hidden during exports
    1.37  	if (hidden) return QString();
    1.38 @@ -140,27 +140,15 @@
    1.39  	TreeItem *ti=getBranchNum(i);
    1.40  	while (ti)
    1.41  	{
    1.42 -		s+=getBranchNum(i)->saveToDir(tmpdir,prefix,offset);
    1.43 +		s+=getBranchNum(i)->saveToDir(tmpdir,prefix,offset,tmpLinks);
    1.44  		i++;
    1.45  		ti=getBranchNum(i);
    1.46  	}	
    1.47  
    1.48 -	// Save XLinks 
    1.49 -	QString ol;	// old link
    1.50 -	QString cl;	// current link
    1.51 +	// Mark Links for save
    1.52  	for (int i=0; i<xlinkCount(); ++i)
    1.53 -	{
    1.54 -		cl=getXLinkNum(i)->saveToDir();
    1.55 -		if (cl!=ol)
    1.56 -		{
    1.57 -			s+=cl;
    1.58 -			ol=cl;
    1.59 -		} else
    1.60 -		{
    1.61 -			qWarning (QString("BranchItem::saveToDir  Ignoring of duplicate xLink in %1").arg(getHeading()));
    1.62 -			qWarning ()<<"this="<<this<< " i="<<i<<" "<<getXLinkNum(i)<<"  "<<getXLinkNum(i-1);
    1.63 -		}
    1.64 -	}	
    1.65 +		if (!tmpLinks.contains (getXLinkNum (i)->getLink() )) 
    1.66 +			tmpLinks.append (getXLinkNum(i)->getLink() );
    1.67  
    1.68      decIndent();
    1.69      s+=endElement   (elementName);