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

scribus-commit scribus-commit at lists.scribus.net
Sat Dec 15 21:28:29 UTC 2012


Author: jghali
Date: Sat Dec 15 21:28:29 2012
New Revision: 17960

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

Modified:
    trunk/Scribus/scribus/ui/scrapbookpalette.cpp

Modified: trunk/Scribus/scribus/ui/scrapbookpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17960&path=/trunk/Scribus/scribus/ui/scrapbookpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.cpp Sat Dec 15 21:28:29 2012
@@ -229,17 +229,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());
@@ -247,17 +244,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());
@@ -265,17 +259,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