r17959 by jghali - #11262: Scrapbook not working correctly with image frames if images are located on different drive than scrapbook

scribus-commit scribus-commit at lists.scribus.net
Sat Dec 15 21:27:52 UTC 2012


Author: jghali
Date: Sat Dec 15 21:27:52 2012
New Revision: 17959

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17959
Log:
#11262: Scrapbook not working correctly with image frames if images are located on different drive than scrapbook

Modified:
    branches/Version14x/Scribus/scribus/scrapbookpalette.cpp

Modified: branches/Version14x/Scribus/scribus/scrapbookpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17959&path=/branches/Version14x/Scribus/scribus/scrapbookpalette.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scrapbookpalette.cpp (original)
+++ branches/Version14x/Scribus/scribus/scrapbookpalette.cpp Sat Dec 15 21:27:52 2012
@@ -202,17 +202,14 @@
 				QString Pfile = pg.attribute("PFILE");
 				if (!Pfile.isEmpty())
 				{
-					if (static_cast<bool>(pg.attribute("relativePaths", "0").toInt()))
+					QFileInfo fi(Pfile);
+					if (fi.isAbsolute())
+						source = QDir::cleanPath(QDir::toNativeSeparators(Pfile));
+					else
 					{
 						QFileInfo pfi2(QDir::cleanPath(QDir::toNativeSeparators(dir+"/"+Pfile)));
 						source = pfi2.absoluteFilePath();
 					}
-					else
-					{
-						QFileInfo fi(Pfile);
-						source = QDir::cleanPath(QDir::toNativeSeparators(QDir::homePath()+"/"+Pfile));
-					}
-					QFileInfo fi(Pfile);
 					QString target = QDir::cleanPath(QDir::toNativeSeparators(dir + "/" + fid.baseName() + "/" + fi.fileName()));
 					copyFile(source, target);
 					pg.setAttribute("PFILE", fid.baseName() + "/" + fi.fileName());
@@ -220,17 +217,14 @@
 				QString Pfile2 = pg.attribute("PFILE2","");
 				if (!Pfile2.isEmpty())
 				{
-					if (static_cast<bool>(pg.attribute("relativePaths", "0").toInt()))
+					QFileInfo fi(Pfile2);
+					if (fi.isAbsolute())
+						source = QDir::cleanPath(QDir::toNativeSeparators(Pfile2));
+					else
 					{
 						QFileInfo pfi2(QDir::cleanPath(QDir::toNativeSeparators(dir+"/"+Pfile2)));
 						source = pfi2.absoluteFilePath();
 					}
-					else
-					{
-						QFileInfo fi(Pfile2);
-						source = QDir::cleanPath(QDir::toNativeSeparators(QDir::homePath()+"/"+Pfile));
-					}
-					QFileInfo fi(Pfile2);
 					QString target = QDir::cleanPath(QDir::toNativeSeparators(dir + "/" + fid.baseName() + "/" + fi.fileName()));
 					copyFile(source, target);
 					pg.setAttribute("PFILE2", fid.baseName() + "/" + fi.fileName());
@@ -238,17 +232,14 @@
 				QString Pfile3 = pg.attribute("PFILE3","");
 				if (!Pfile3.isEmpty())
 				{
-					if (static_cast<bool>(pg.attribute("relativePaths", "0").toInt()))
+					QFileInfo fi(Pfile3);
+					if (fi.isAbsolute())
+						source = QDir::cleanPath(QDir::toNativeSeparators(Pfile3));
+					else
 					{
 						QFileInfo pfi2(QDir::cleanPath(QDir::toNativeSeparators(dir+"/"+Pfile3)));
 						source = pfi2.absoluteFilePath();
 					}
-					else
-					{
-						QFileInfo fi(Pfile3);
-						source = QDir::cleanPath(QDir::toNativeSeparators(QDir::homePath()+"/"+Pfile3));
-					}
-					QFileInfo fi(Pfile3);
 					QString target = QDir::cleanPath(QDir::toNativeSeparators(dir + "/" + fid.baseName() + "/" + fi.fileName()));
 					copyFile(source, target);
 					pg.setAttribute("PFILE3", fid.baseName() + "/" + fi.fileName());




More information about the scribus-commit mailing list