floatimageobj.cpp
changeset 336 5b6f2a396979
parent 312 d1d464798f08
child 366 e95081c21da2
     1.1 --- a/floatimageobj.cpp	Mon May 08 13:25:46 2006 +0000
     1.2 +++ b/floatimageobj.cpp	Wed May 31 12:27:39 2006 +0000
     1.3 @@ -95,6 +95,7 @@
     1.4  		positionBBox();
     1.5  		filename=fn;
     1.6  		filetype=QPixmap::imageFormat (fn);
     1.7 +		setOriginalFilename (fn);
     1.8  		return true;
     1.9  	} else
    1.10  		return false;
    1.11 @@ -109,6 +110,10 @@
    1.12  void FloatImageObj::setOriginalFilename(const QString & fn)
    1.13  {
    1.14  	originalFilename=fn;
    1.15 +
    1.16 +	// Set short name, too. Search from behind:
    1.17 +	int i=originalFilename.findRev("/");
    1.18 +	if (i>=0) originalFilename=originalFilename.remove (0,i+1);
    1.19  }
    1.20  
    1.21  QString FloatImageObj::getOriginalFilename()
    1.22 @@ -183,6 +188,8 @@
    1.23  
    1.24  	// And really save the image
    1.25  	icon->save (tmpdir + "/" + url, filetype);
    1.26 + 
    1.27 +	QString nameAttr=attribut ("orgName",originalFilename);
    1.28  
    1.29      return singleElement ("floatimage",  
    1.30  		getOrnAttr() 
    1.31 @@ -191,6 +198,7 @@
    1.32  		+exportAttr  
    1.33  		+zAttr  
    1.34  		+attribut ("href",QString ("file:")+url)
    1.35 +		+nameAttr
    1.36  	);	
    1.37  }
    1.38