# HG changeset patch
# User insilmaril
# Date 1246965687 0
# Node ID fe839bdfd10c2372caa4ec75dea9e898914a4fb3
# Parent  1fb50e79661c4cd663e92f79d22c183fbbc88dda
vymLinks working again

diff -r 1fb50e79661c -r fe839bdfd10c branchitem.cpp
--- a/branchitem.cpp	Tue Jul 07 09:34:24 2009 +0000
+++ b/branchitem.cpp	Tue Jul 07 11:21:27 2009 +0000
@@ -158,43 +158,6 @@
 {
 }
 
-void BranchItem::setVymLink(QString s)
-{
-	if (!s.isEmpty())
-	{
-		// We need the relative (from loading) 
-		// or absolute path (from User event)
-		// and build the absolute path.
-		// Note: If we have relative, use path of
-		// current map to build absolute path
-		QDir d(s);
-		if (!d.path().startsWith ("/"))
-		{
-			QString p=model->getDestPath();
-			int i=p.findRev("/",-1);
-			d.setPath(p.left(i)+"/"+s);
-			d.convertToAbs();
-		}
-		vymLink=d.path();
-		//FIXME-2 systemFlags->activate("vymLink");
-	}	
-	else	
-	{
-		//FIXME-2 systemFlags->deactivate("vymLink");
-		vymLink="";
-	}	
-	/* FIXME-2
-	calcBBoxSize();			// recalculate bbox
-    positionBBox();			// rearrange contents
-	forceReposition();
-	*/
-}
-
-QString BranchItem::getVymLink()
-{
-	return vymLink;
-}
-
 void BranchItem::setHeadingColor (QColor color)
 {
 	TreeItem::setHeadingColor (color);
diff -r 1fb50e79661c -r fe839bdfd10c branchitem.h
--- a/branchitem.h	Tue Jul 07 09:34:24 2009 +0000
+++ b/branchitem.h	Tue Jul 07 11:21:27 2009 +0000
@@ -1,7 +1,6 @@
 #ifndef BRANCHITEM_H
 #define BRANCHITEM_H
 
-//#include "treeitem.h"
 #include "mapitem.h"
 
 
@@ -22,12 +21,6 @@
 
 	virtual void updateVisibility();
 
-protected:
-	QString vymLink;
-public:	
-	virtual void setVymLink (QString);
-    virtual QString getVymLink ();
-
 	virtual void setHeadingColor (QColor color); //!Overloaded from TreeItem to update QGraphicsView
 
 protected:	
diff -r 1fb50e79661c -r fe839bdfd10c floatimageobj.cpp
--- a/floatimageobj.cpp	Tue Jul 07 09:34:24 2009 +0000
+++ b/floatimageobj.cpp	Tue Jul 07 11:21:27 2009 +0000
@@ -44,7 +44,6 @@
 	clickBox.setSize (QSizeF(icon->boundingRect().width(), icon->boundingRect().height()));filename="";
 	originalFilename="no original name available";
 	filetype="";
-	saveInMap=true;
 	useRelPos=true;
 
 	//Hide flags
@@ -58,7 +57,6 @@
 	filetype=other->filetype;
 	filename=other->filename;
 	originalFilename=other->originalFilename;
-	saveInMap=other->saveInMap;
     positionBBox();
 }
 
diff -r 1fb50e79661c -r fe839bdfd10c floatimageobj.h
--- a/floatimageobj.h	Tue Jul 07 09:34:24 2009 +0000
+++ b/floatimageobj.h	Tue Jul 07 11:21:27 2009 +0000
@@ -36,7 +36,6 @@
 
 protected:
 	ImageObj *icon;
-	bool saveInMap;
 	QString filetype;
 	QString filename;
 	QString originalFilename;
diff -r 1fb50e79661c -r fe839bdfd10c floatobj.cpp
--- a/floatobj.cpp	Tue Jul 07 09:34:24 2009 +0000
+++ b/floatobj.cpp	Tue Jul 07 11:21:27 2009 +0000
@@ -34,7 +34,6 @@
 using namespace std;
 void FloatObj::init () 
 {
-	floatExport=true;
 	zPlane=Z_ICON;
 	setLinkStyle (LinkableMapObj::Parabel);
 	//FIXME-2 setHideLinkUnselected(true);
@@ -57,16 +56,6 @@
 	return zPlane;
 }
 
-void FloatObj::setFloatExport(const bool& b)
-{
-	floatExport=b;
-}
-
-bool FloatObj::getFloatExport()
-{
-	return floatExport;
-}
-
 void FloatObj::move (double x, double y)
 {
 	MapObj::move(x,y);
diff -r 1fb50e79661c -r fe839bdfd10c floatobj.h
--- a/floatobj.h	Tue Jul 07 09:34:24 2009 +0000
+++ b/floatobj.h	Tue Jul 07 11:21:27 2009 +0000
@@ -18,8 +18,6 @@
 	virtual bool load (const QString&)=0;
 	virtual void setZValue(const int&);		// set zPlane
 	virtual int zValue();
-	virtual void setFloatExport (const bool &);
-	virtual bool getFloatExport ();
 
 	virtual void move (double,double);
 	virtual void move (QPointF);
@@ -30,7 +28,6 @@
 	virtual QRectF getBBoxSizeWithChildren();	// return size of BBox including children  
 
 protected:
-	bool floatExport;
 	int zPlane;
 };
 
diff -r 1fb50e79661c -r fe839bdfd10c imageitem.cpp
--- a/imageitem.cpp	Tue Jul 07 09:34:24 2009 +0000
+++ b/imageitem.cpp	Tue Jul 07 11:21:27 2009 +0000
@@ -103,29 +103,7 @@
 
 	saveCounter++;
 	
-	/* FIXME-3 QString useOrientAttr;
-	if (useOrientation)
-		useOrientAttr=attribut ("useOrientation","true");
-	else	
-		useOrientAttr=attribut ("useOrientation","false");
-		*/
-		
-	/*FIXME-3 QString saveInMapAttr;
-	if (saveInMap)
-		saveInMapAttr=attribut ("saveInMap","true");
-	else	
-		
-		saveInMapAttr=attribut ("saveInMap","false");
-		*/
-
-	/* FIXME-3 QString exportAttr;
-	if (floatExport)
-		exportAttr=attribut ("floatExport","true");
-	else	
-		exportAttr=attribut ("floatExport","false");
-	*/	
-
-
+	
 	QString zAttr=attribut ("zValue",QString().setNum(zValue));
 	QString url;
 
@@ -139,9 +117,6 @@
     return singleElement ("floatimage",  
 		getMapAttr() 
 		+getGeneralAttr()
-//		+useOrientAttr 
-//		+saveInMapAttr 
-//		+exportAttr  
 		+zAttr  
 		+attribut ("href",QString ("file:")+url)
 		+nameAttr
diff -r 1fb50e79661c -r fe839bdfd10c linkablemapobj.cpp
--- a/linkablemapobj.cpp	Tue Jul 07 09:34:24 2009 +0000
+++ b/linkablemapobj.cpp	Tue Jul 07 11:21:27 2009 +0000
@@ -86,7 +86,6 @@
 	// Rel Positions
 	relPos=QPointF(0,0);
 	useRelPos=false;
-	useOrientation=true;
 
 	// Crossreference to treemodel
 	treeItem=NULL;
@@ -99,7 +98,6 @@
     setLinkStyle(other->style);
     setLinkColor (other->linkcolor);
 	relPos=other->relPos;
-	useOrientation=other->useOrientation;
 	treeItem=other->treeItem;
 }
 
@@ -552,15 +550,6 @@
     return parPos;
 }
 
-void LinkableMapObj::setUseOrientation (const bool &b)
-{	
-	if (useOrientation!=b)
-	{
-		useOrientation=b;
-		requestReposition();
-	}	
-}
-
 LinkableMapObj::Orientation LinkableMapObj::getOrientation()
 {
     return orientation;
diff -r 1fb50e79661c -r fe839bdfd10c linkablemapobj.h
--- a/linkablemapobj.h	Tue Jul 07 09:34:24 2009 +0000
+++ b/linkablemapobj.h	Tue Jul 07 11:21:27 2009 +0000
@@ -70,8 +70,6 @@
 	virtual void setRelPos();				// set relPos to current parentPos
 	virtual void setRelPos(const QPointF&);	
 	virtual QPointF getRelPos();
-	virtual void setUseOrientation (const bool &);
-
 
 	virtual qreal getTopPad();
 	virtual qreal getLeftPad();
@@ -147,7 +145,6 @@
 
 	QPointF	 relPos;				// position relative to childPos of parent
 	bool useRelPos;
-	bool useOrientation;
 
 	TreeItem *treeItem;				// Crossrefence to treemodel
 };
diff -r 1fb50e79661c -r fe839bdfd10c mapeditor.cpp
--- a/mapeditor.cpp	Tue Jul 07 09:34:24 2009 +0000
+++ b/mapeditor.cpp	Tue Jul 07 11:21:27 2009 +0000
@@ -703,7 +703,7 @@
 				else	
 					mainWindow->editOpenURL();
 			}	
-			else if (foname=="vymLink")
+			else if (foname=="system-vymLink")
 			{
 				mainWindow->editOpenVymLink();
 				// tabWidget may change, better return now
diff -r 1fb50e79661c -r fe839bdfd10c treeitem.cpp
--- a/treeitem.cpp	Tue Jul 07 09:34:24 2009 +0000
+++ b/treeitem.cpp	Tue Jul 07 11:21:27 2009 +0000
@@ -689,10 +689,14 @@
 
 QString TreeItem::getGeneralAttr()
 {
+	QString s;
 	if (hideExport)
-		 return attribut("hideInExport","true");
-	else
-		return QString();
+		 s+=attribut("hideInExport","true");
+	if (!url.isEmpty())
+		s+=attribut ("url",url);
+	if (!vymLink.isEmpty())
+		s+=attribut ("vymLink",vymLink);
+	return s;	
 }
 
 
diff -r 1fb50e79661c -r fe839bdfd10c vymmodel.cpp
--- a/vymmodel.cpp	Tue Jul 07 09:34:24 2009 +0000
+++ b/vymmodel.cpp	Tue Jul 07 11:21:27 2009 +0000
@@ -2641,13 +2641,13 @@
 void VymModel::setVymLink (const QString &s)	// FIXME-3 no savestate?
 {
 	// Internal function, no saveState needed
-	BranchItem *bi=getSelectedBranchItem();
-	if (bi)
+	TreeItem *selti=getSelectedItem();
+	if (selti)
 	{
-		bi->setVymLink(s);
+		selti->setVymLink(s);
 		reposition();
-		updateActions();
-		//emitSelectionChanged();
+		emitDataHasChanged (selti);
+		emitShowSelection();
 	}
 }
 
diff -r 1fb50e79661c -r fe839bdfd10c xml-vym.cpp
--- a/xml-vym.cpp	Tue Jul 07 09:34:24 2009 +0000
+++ b/xml-vym.cpp	Tue Jul 07 11:21:27 2009 +0000
@@ -418,7 +418,7 @@
 
 bool parseVYMHandler::readOOAttr (const QXmlAttributes& a)
 {
-	if (lastMI)	//FIXME-1  below lastBranch is used, not lastMI. So it might not work for images
+	if (lastMI)
 	{
 		bool okx,oky;
 		float x,y;
@@ -429,7 +429,7 @@
 				x=a.value("relPosX").toFloat (&okx);
 				y=a.value("relPosY").toFloat (&oky);
 				if (okx && oky  )
-					lastBranch->setRelPos (QPointF(x,y));
+					lastMI->setRelPos (QPointF(x,y));
 				else
 					return false;   // Couldn't read relPos
 			}           
@@ -441,21 +441,21 @@
 				x=a.value("absPosX").toFloat (&okx);
 				y=a.value("absPosY").toFloat (&oky);
 				if (okx && oky  )
-					lastBranch->setAbsPos (QPointF(x,y));
+					lastMI->setAbsPos (QPointF(x,y));
 				else
 					return false;   // Couldn't read absPos
 			}           
 		}           
 		//if (!a.value( "id").isEmpty() ) 
-		//	lastBranch->setID (a.value ("id"));
+		//	lastMI->setID (a.value ("id"));		// FIXME-3
 			
 		if (!a.value( "url").isEmpty() ) 
-			lastBranch->setURL (a.value ("url"));
+			lastMI->setURL (a.value ("url"));
 		if (!a.value( "vymLink").isEmpty() ) 
-			lastBranch->setVymLink (a.value ("vymLink"));
+			lastMI->setVymLink (a.value ("vymLink"));
 		if (!a.value( "hideInExport").isEmpty() ) 
 			if (a.value("hideInExport")=="true")
-				lastBranch->setHideInExport(true);
+				lastMI->setHideInExport(true);
 
 		if (!a.value( "hideLink").isEmpty()) 
 		{
@@ -504,16 +504,8 @@
 {
 	lastMI=lastImage;
 	
-	//if (!readOOAttr(a)) return false;
+	//if (!readOOAttr(a)) return false;   FIXME-3
 
-	/* FIXME-1 if (!a.value( "useOrientation").isEmpty() ) 
-	{
-		if (a.value ("useOrientation") =="true")
-			lastImage->setUseOrientation (true);
-		else	
-			lastImage->setUseOrientation (false);
-	}	
-	*/
 	if (!a.value( "href").isEmpty() )
 	{
 		// Load Image