r17555 by craig - Add plain download type that does not get unzipped just moved into place. Now use http://cgit.freedesktop.org/libreoffice/dictionaries/tree/dictionaries for dict source

scribus-commit scribus-commit at lists.scribus.net
Mon Jun 11 20:36:04 UTC 2012


Author: craig
Date: Mon Jun 11 20:36:03 2012
New Revision: 17555

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17555
Log:
Add plain download type that does not get unzipped just moved into place. Now use http://cgit.freedesktop.org/libreoffice/dictionaries/tree/dictionaries for dict source

Modified:
    trunk/Scribus/scribus/langmgr.cpp
    trunk/Scribus/scribus/ui/prefs_spelling.cpp
    trunk/Scribus/scribus/ui/prefs_spelling.h

Modified: trunk/Scribus/scribus/langmgr.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17555&path=/trunk/Scribus/scribus/langmgr.cpp
==============================================================================
--- trunk/Scribus/scribus/langmgr.cpp (original)
+++ trunk/Scribus/scribus/langmgr.cpp Mon Jun 11 20:36:03 2012
@@ -56,57 +56,64 @@
 	// TODO get rid of the redundant key, the english name.
 	// So internally language would always be manipulated as a code and otherwise presented translated.
 	langList.insert("af",       langPair("Afrikaans",           QObject::tr( "Afrikaans" )) );
+	langList.insert("af_ZA",    langPair("Afrikaans",           QObject::tr( "Afrikaans" )) );
+	langList.insert("an_ES",    langPair("Aragonese",           QObject::tr( "Aragonese" )) );
 	langList.insert("ar",       langPair("Arabic",              QObject::tr( "Arabic" )) );
-	langList.insert("sq",       langPair("Albanian",            QObject::tr( "Albanian" )) );
-	langList.insert("eu",       langPair("Basque",              QObject::tr( "Basque" )) );
+	langList.insert("be_BY",    langPair("Belarusian",          QObject::tr( "Belarusian" )) );
+	langList.insert("bg",       langPair("Bulgarian",           QObject::tr( "Bulgarian" )) );
+	langList.insert("bg_BG",    langPair("Bulgarian",           QObject::tr( "Bulgarian" )) );
 	langList.insert("bn",       langPair("Bengali",             QObject::tr( "Bengali" )) );
 	langList.insert("br",       langPair("Breton",              QObject::tr( "Breton" )) );
-	langList.insert("bg",       langPair("Bulgarian",           QObject::tr( "Bulgarian" )) );
 	langList.insert("ca",       langPair("Catalan",             QObject::tr( "Catalan" )) );
-	langList.insert("zh",       langPair("Chinese",             QObject::tr( "Chinese" )) );
-	langList.insert("zh_TW",    langPair("Chinese (Trad.)",     QObject::tr( "Chinese (Trad.)" )) );
-	langList.insert("hr",       langPair("Croatian",            QObject::tr( "Croatian" )) );
 	langList.insert("cs",       langPair("Czech",               QObject::tr( "Czech" )) );
 	langList.insert("cs_CZ",    langPair("Czech",               QObject::tr( "Czech" )) );
+	langList.insert("cy",       langPair("Welsh",               QObject::tr( "Welsh" )) );
 	langList.insert("da",       langPair("Danish",              QObject::tr( "Danish" )) );
 	langList.insert("da_DK",    langPair("Danish",              QObject::tr( "Danish" )) );
+	langList.insert("de",       langPair("German",              QObject::tr( "German" )) );
+	langList.insert("de_1901",  langPair("German (Trad.)",      QObject::tr( "German (Trad.)" )) );
+	langList.insert("de_CH",    langPair("German (Swiss)",      QObject::tr( "German (Swiss)" )) );
+	langList.insert("de_DE",    langPair("German",              QObject::tr( "German" )) );
 	langList.insert("dz",       langPair("Dzongkha",            QObject::tr( "Dzongkha" )) );
-	langList.insert("nl",       langPair("Dutch",               QObject::tr( "Dutch" )) );
+	langList.insert("el",       langPair("Greek",               QObject::tr( "Greek" )) );
 	langList.insert("en",       langPair("English",             QObject::tr( "English" )) );
-	langList.insert("en_AU",    langPair("English (Australian)",QObject::tr( "English (Australian)" )) );
-	langList.insert("en_CA",    langPair("English (Canadian)",  QObject::tr( "English (Canadian)" )) );
-	langList.insert("en_GB",    langPair("English (British)",   QObject::tr( "English (British)" )) );
-	langList.insert("en_NZ",    langPair("English (New Zealand)",   QObject::tr( "English (New Zealand)" )) );
-	langList.insert("en_US",    langPair("English (American)",  QObject::tr( "English (American)" )) );
-	langList.insert("en_ZA",    langPair("English (South African)",  QObject::tr( "English (South African)" )) );
+	langList.insert("en_AU",    langPair("English (Australia)", QObject::tr( "English (Australia)" )) );
+	langList.insert("en_CA",    langPair("English (Canada)",    QObject::tr( "English (Canada)" )) );
+	langList.insert("en_GB",    langPair("English (UK)",        QObject::tr( "English (UK)" )) );
+	langList.insert("en_NZ",    langPair("English (New Zealand)", QObject::tr( "English (New Zealand)" )) );
+	langList.insert("en_US",    langPair("English (USA)",       QObject::tr( "English (USA)" )) );
+	langList.insert("en_ZA",    langPair("English (South Africa)", QObject::tr( "English (South Africa)" )) );
 	langList.insert("eo",       langPair("Esperanto",           QObject::tr( "Esperanto" )) );
+	langList.insert("es",       langPair("Spanish",             QObject::tr( "Spanish" )) );
+	langList.insert("es_AR",    langPair("Spanish (Argentina)", QObject::tr( "Spanish (Argentina)" )) );
+	langList.insert("es_ES",    langPair("Spanish",             QObject::tr( "Spanish" )) );
+	langList.insert("es_LA",    langPair("Spanish (Latin)",     QObject::tr( "Spanish (Latin)" )) );
 	langList.insert("et",       langPair("Estonian",            QObject::tr( "Estonian" )) );
-	langList.insert("de",       langPair("German",              QObject::tr( "German" )) );
-	langList.insert("de_CH",    langPair("German (Swiss)",      QObject::tr( "German (Swiss)" )) );
-	langList.insert("de_1901",  langPair("German (Trad.)",      QObject::tr( "German (Trad.)" )) );
+	langList.insert("eu",       langPair("Basque",              QObject::tr( "Basque" )) );
 	langList.insert("fi",       langPair("Finnish",             QObject::tr( "Finnish" )) );
 	langList.insert("fr",       langPair("French",              QObject::tr( "French" )) );
 	langList.insert("fr_FR",    langPair("French",              QObject::tr( "French" )) );
 	langList.insert("gl",       langPair("Galician",            QObject::tr( "Galician" )) );
-	langList.insert("el",       langPair("Greek",               QObject::tr( "Greek" )) );
 	langList.insert("he",       langPair("Hebrew",              QObject::tr( "Hebrew" )) );
+	langList.insert("hr",       langPair("Croatian",            QObject::tr( "Croatian" )) );
 	langList.insert("hu",       langPair("Hungarian",           QObject::tr( "Hungarian" )) );
 	langList.insert("ia",       langPair("Latin",               QObject::tr( "Latin" )) );
+	langList.insert("id",       langPair("Indonesian",          QObject::tr( "Indonesian" )) );
 	langList.insert("is",       langPair("Icelandic",           QObject::tr( "Icelandic" )) );
-	langList.insert("id",       langPair("Indonesian",          QObject::tr( "Indonesian" )) );
 	langList.insert("it",       langPair("Italian",             QObject::tr( "Italian" )) );
+	langList.insert("it_IT",    langPair("Italian",             QObject::tr( "Italian" )) );
 	langList.insert("ja",       langPair("Japanese",            QObject::tr( "Japanese" )) );
 	langList.insert("km",       langPair("Khmer",               QObject::tr( "Khmer" )) );
 	langList.insert("ko",       langPair("Korean",              QObject::tr( "Korean" )) );
 	langList.insert("ku",       langPair("Kurdish",             QObject::tr( "Kurdish" )) );
+	langList.insert("la",       langPair("Latin",               QObject::tr( "Latin" )) );
+	langList.insert("lb",       langPair("Luxembourgish",       QObject::tr( "Luxembourgish" )) );
 	langList.insert("lo",       langPair("Lao",                 QObject::tr( "Lao" )) );
-	langList.insert("la",       langPair("Latin",               QObject::tr( "Latin" )) );
 	langList.insert("lt",       langPair("Lithuanian",          QObject::tr( "Lithuanian" )) );
 	langList.insert("lt_LT",    langPair("Lithuanian",          QObject::tr( "Lithuanian" )) );
-	langList.insert("lu",       langPair("Luxembourgish",       QObject::tr( "Luxembourgish" )) );
-	//We might need &#00E5; for this accented a
 	langList.insert("nb",       langPair("Norwegian (Bokmål)",  QObject::trUtf8( "Norwegian (Bokm\303\245l)" )) );
 	langList.insert("nb_NO",    langPair("Norwegian (Bokmål)",  QObject::trUtf8( "Norwegian (Bokm\303\245l)" )) );
+	langList.insert("nl",       langPair("Dutch",               QObject::tr( "Dutch" )) );
 	langList.insert("nn",       langPair("Norwegian (Nnyorsk)", QObject::tr( "Norwegian (Nnyorsk)" )) );
 	langList.insert("nn_NO",    langPair("Norwegian (Nnyorsk)", QObject::tr( "Norwegian (Nnyorsk)" )) );
 	langList.insert("no",       langPair("Norwegian",           QObject::tr( "Norwegian" )) );
@@ -118,13 +125,10 @@
 	langList.insert("ro",       langPair("Romanian",            QObject::tr( "Romanian" )) );
 	langList.insert("ru",       langPair("Russian",             QObject::tr( "Russian" )) );
 	langList.insert("sa",       langPair("Sanskrit",            QObject::tr( "Sanskrit" )) );
-	langList.insert("es",       langPair("Spanish",             QObject::tr( "Spanish" )) );
-	langList.insert("es_AR",    langPair("Spanish (Argentina)", QObject::tr( "Spanish (Argentina)" )) );
-	langList.insert("es_ES",    langPair("Spanish",             QObject::tr( "Spanish" )) );
-	langList.insert("es_LA",    langPair("Spanish (Latin)",     QObject::tr( "Spanish (Latin)" )) );
 	langList.insert("sk",       langPair("Slovak",              QObject::tr( "Slovak" )) );
 	langList.insert("sk_SK",    langPair("Slovak",              QObject::tr( "Slovak" )) );
 	langList.insert("sl",       langPair("Slovenian",           QObject::tr( "Slovenian" )) );
+	langList.insert("sq",       langPair("Albanian",            QObject::tr( "Albanian" )) );
 	langList.insert("sr",       langPair("Serbian",             QObject::tr( "Serbian" )) );
 	langList.insert("sv",       langPair("Swedish",             QObject::tr( "Swedish" )) );
 	langList.insert("th",       langPair("Thai",                QObject::tr( "Thai" )) );
@@ -134,7 +138,9 @@
 	langList.insert("uk",       langPair("Ukranian",            QObject::tr( "Ukranian" )) );
 	langList.insert("uk_UA",    langPair("Ukranian",            QObject::tr( "Ukranian" )) );
 	langList.insert("vi",       langPair("Vietnamese",          QObject::tr( "Vietnamese" )) );
-	langList.insert("cy",       langPair("Welsh",               QObject::tr( "Welsh" )) );
+	langList.insert("zh",       langPair("Chinese",             QObject::tr( "Chinese" )) );
+	langList.insert("zh_TW",    langPair("Chinese (Trad.)",     QObject::tr( "Chinese (Trad.)" )) );
+
 }
 
 void LanguageManager::generateInstalledLangList()

Modified: trunk/Scribus/scribus/ui/prefs_spelling.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17555&path=/trunk/Scribus/scribus/ui/prefs_spelling.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_spelling.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_spelling.cpp Mon Jun 11 20:36:03 2012
@@ -24,6 +24,7 @@
 #include "scribus.h" //FIXME: for the ScCore call (remove this call)
 #include "util_icon.h"
 #include "util.h"
+#include "util_file.h"
 
 #include "scribusapp.h"
 #include "scpaths.h"
@@ -78,9 +79,21 @@
 	{
 		if (dlLangs.contains(d.lang))
 		{
-			ScQApp->dlManager()->addURL(d.url, true, downloadLocation);
-			downloadList.append(d);
-			++i;
+			if (d.filetype=="zip")
+			{
+				ScQApp->dlManager()->addURL(d.url, true, downloadLocation);
+				downloadList.append(d);
+				++i;
+			}
+			if (d.filetype=="plain")
+			{
+				//qDebug()<<d.url<<d.files;
+				QStringList plainURLs(d.files.split(";", QString::SkipEmptyParts));
+				foreach (QString s, plainURLs)
+					ScQApp->dlManager()->addURL(d.url+"/"+s, true, downloadLocation);
+				downloadList.append(d);
+				++i;
+			}
 		}
 	}
 	if (i>0)
@@ -147,17 +160,31 @@
 	foreach(DictData d, downloadList)
 	{
 		QString basename = QFileInfo(d.url).fileName();
-		QString filename=downloadLocation+"/"+basename;
+		QString filename=downloadLocation+basename;
 		//qDebug()<<filename;
-		FileUnzip* fun = new FileUnzip(filename);
-		QStringList files=d.files.split(";", QString::SkipEmptyParts);
-		foreach (QString s, files)
+		if (d.filetype=="zip")
 		{
-			qDebug()<<"Unzipping"<<userDictDir+s;
-			QString data=fun->getFileToPath(s, userDictDir);
-		}
-		delete fun;
-	}
+			//qDebug()<<"zip data found"<<filename;
+			FileUnzip* fun = new FileUnzip(filename);
+			QStringList files=d.files.split(";", QString::SkipEmptyParts);
+			foreach (QString s, files)
+			{
+				//qDebug()<<"Unzipping"<<userDictDir+s;
+				QString data=fun->getFileToPath(s, userDictDir);
+			}
+			delete fun;
+		}
+		if (d.filetype=="plain")
+		{
+			QStringList files=d.files.split(";", QString::SkipEmptyParts);
+			foreach (QString s, files)
+			{
+				//qDebug()<<"plain data found"<<downloadLocation<<userDictDir<<s;
+				moveFile(downloadLocation+s, userDictDir+s);
+			}
+		}
+	}
+
 	updateDictList();
 }
 
@@ -189,7 +216,7 @@
 		if( !e.isNull() ) {
 			if (e.tagName()=="dictionary")
 			{
-				if (e.hasAttribute("type"))
+				if (e.hasAttribute("type") && e.hasAttribute("filetype"))
 				{
 					if (e.attribute("type")=="spell")
 					{
@@ -201,6 +228,7 @@
 						d.version=e.attribute("version");
 						d.lang=e.attribute("language");
 						d.license=e.attribute("license");
+						d.filetype=e.attribute("filetype");
 						QUrl url(d.url);
 						if (url.isValid() && !url.isEmpty() && !url.host().isEmpty())
 							dictList.append(d);

Modified: trunk/Scribus/scribus/ui/prefs_spelling.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17555&path=/trunk/Scribus/scribus/ui/prefs_spelling.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_spelling.h (original)
+++ trunk/Scribus/scribus/ui/prefs_spelling.h Mon Jun 11 20:36:03 2012
@@ -25,6 +25,7 @@
 				QString url;
 				QString desc;
 				QString license;
+				QString filetype;
 				bool download;
 		};
 	Q_OBJECT




More information about the scribus-commit mailing list