r19823 by craig - Add a little hack for allowing Blokk font to be downloaded

scribus-commit scribus-commit at lists.scribus.net
Mon Feb 16 23:14:45 UTC 2015


Author: craig
Date: Mon Feb 16 23:14:45 2015
New Revision: 19823

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19823
Log:
Add a little hack for allowing Blokk font to be downloaded

Modified:
    trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
    trunk/Scribus/scribus/downloadmanager/scdlmgr.h
    trunk/Scribus/scribus/ui/resourcemanager.cpp

Modified: trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19823&path=/trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp (original)
+++ trunk/Scribus/scribus/downloadmanager/scdlmgr.cpp Mon Feb 16 23:14:45 2015
@@ -30,7 +30,7 @@
 		delete thread;
 }
 
-void ScDLManager::addURL(const QUrl &url, bool overwrite, const QString& downloadLocation, const QString& destinationLocation)
+void ScDLManager::addURL(const QUrl &url, bool overwrite, const QString& downloadLocation, const QString& destinationLocation, const QString& destinationName)
 {
 	DownloadData d;
 	d.id=dlID++;
@@ -38,13 +38,14 @@
 	d.url=url;
 	d.downloadLocation=downloadLocation;
 	d.destinationLocation=destinationLocation;
+	d.destinationName=destinationName;
 	d.state=DownloadData::New;
 	fileList.append(d);
 
 	thread->addURL(url, overwrite, downloadLocation, destinationLocation);
 }
 
-void ScDLManager::addURL(const QString &url, bool overwrite, const QString &downloadLocation, const QString& destinationLocation)
+void ScDLManager::addURL(const QString &url, bool overwrite, const QString &downloadLocation, const QString& destinationLocation, const QString& destinationName)
 {
 	DownloadData d;
 	d.id=dlID++;
@@ -52,6 +53,7 @@
 	d.url=url;
 	d.downloadLocation=downloadLocation;
 	d.destinationLocation=destinationLocation;
+	d.destinationName=destinationName;
 	d.state=DownloadData::New;
 	fileList.append(d);
 
@@ -68,6 +70,7 @@
 		d.url=s;
 		d.downloadLocation=downloadLocation;
 		d.destinationLocation=destinationLocation;
+		d.destinationName="";
 		d.state=DownloadData::New;
 		fileList.append(d);
 	}
@@ -146,7 +149,10 @@
 					else
 					{
 						//qDebug()<<"Need to move"<<i.value().name<<"from"<<i.value().downloadLocation<<"to"<<i.value().destinationLocation;
-						moveFile(i.value().downloadLocation+i.value().name, i.value().destinationLocation+i.value().name);
+						QString newName=i.value().name;
+						if (!i.value().destinationName.isEmpty())
+							newName=i.value().destinationName;
+						moveFile(i.value().downloadLocation+i.value().name, i.value().destinationLocation+newName);
 					}
 				}
 				break;

Modified: trunk/Scribus/scribus/downloadmanager/scdlmgr.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19823&path=/trunk/Scribus/scribus/downloadmanager/scdlmgr.h
==============================================================================
--- trunk/Scribus/scribus/downloadmanager/scdlmgr.h (original)
+++ trunk/Scribus/scribus/downloadmanager/scdlmgr.h Mon Feb 16 23:14:45 2015
@@ -23,8 +23,8 @@
 		~ScDLManager();
 //TODO: Add download groups so different parts of Scribus can be downloading at the same time
 
-		void addURL(const QUrl &url, bool overwrite, const QString &downloadLocation, const QString& destinationLocation);
-		void addURL(const QString &url, bool overwrite, const QString &downloadLocation, const QString& destinationLocation);
+		void addURL(const QUrl &url, bool overwrite, const QString &downloadLocation, const QString& destinationLocation, const QString& destinationName="");
+		void addURL(const QString &url, bool overwrite, const QString &downloadLocation, const QString& destinationLocation, const QString& destinationName="");
 		void addURLs(const QStringList &urlList, bool overwrite, const QString &downloadLocation, const QString& destinationLocation);
 		void startDownloads();
 

Modified: trunk/Scribus/scribus/ui/resourcemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19823&path=/trunk/Scribus/scribus/ui/resourcemanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/resourcemanager.cpp (original)
+++ trunk/Scribus/scribus/ui/resourcemanager.cpp Mon Feb 16 23:14:45 2015
@@ -244,6 +244,7 @@
 					d.lang=e.attribute("language");
 					d.license=e.attribute("license");
 					d.filetype=e.attribute("filetype");
+					d.movetofile=e.attribute("movetofilename");
 					d.type=e.attribute("type").toUpper();
 					QUrl url(d.url);
 					if (url.isValid() && !url.isEmpty() && !url.host().isEmpty())
@@ -611,7 +612,7 @@
 	}
 	if (filesToDownload.isEmpty())
 		return;
-	qDebug()<<filesToDownload;
+	//qDebug()<<filesToDownload;
 	downloadButton->setEnabled(false);
 	downloadList.clear();
 	downloadProgressBar->setValue(0);
@@ -650,7 +651,7 @@
 						foreach (QString s, plainURLs)
 						{
 							//qDebug()<<"Requesting:"<<d.url+"/"+s;
-							ScQApp->dlManager()->addURL(d.url+"/"+s, true, ScPaths::downloadDir(), destinationFolder);
+							ScQApp->dlManager()->addURL(d.url+"/"+s, true, ScPaths::downloadDir(), destinationFolder, d.files);
 							++dlCount;
 						}
 						downloadList.append(d);




More information about the scribus-commit mailing list