diff options
author | craig <craig@11d20701-8431-0410-a711-e3c959e3b870> | 2012-06-11 20:35:49 +0000 |
---|---|---|
committer | craig <craig@11d20701-8431-0410-a711-e3c959e3b870> | 2012-06-11 20:35:49 +0000 |
commit | cb22b1ee9cd50064c08dfac8db5e7cb4310c6040 (patch) | |
tree | ba8ce32fedda993ea7568c1c6fee1cd95134993d /scribus | |
parent | d77ce5bf6743ed2007f75f9bbdde6c1c538f14a2 (diff) | |
download | scribus-cb22b1ee9cd50064c08dfac8db5e7cb4310c6040.tar.gz scribus-cb22b1ee9cd50064c08dfac8db5e7cb4310c6040.tar.xz scribus-cb22b1ee9cd50064c08dfac8db5e7cb4310c6040.zip |
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
git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17554 11d20701-8431-0410-a711-e3c959e3b870
Diffstat (limited to 'scribus')
-rw-r--r-- | scribus/hysettings.cpp | 50 | ||||
-rw-r--r-- | scribus/hysettings.h | 1 | ||||
-rw-r--r-- | scribus/langmgr.cpp | 55 | ||||
-rw-r--r-- | scribus/ui/downloaddictionaries.h | 1 |
4 files changed, 71 insertions, 36 deletions
diff --git a/scribus/hysettings.cpp b/scribus/hysettings.cpp index edd7cf1..9f569a3 100644 --- a/scribus/hysettings.cpp +++ b/scribus/hysettings.cpp @@ -12,7 +12,7 @@ for which a new license (GPL+exception) is in place. #include "scribusdoc.h" #include "util_icon.h" #include "util.h" -#include "ui/downloaddictionaries.h" +#include "util_file.h" #include "scpaths.h" #include <QDomDocument> #include <QHeaderView> @@ -182,9 +182,21 @@ void HySettings::downloadSpellDicts() { 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) @@ -251,16 +263,29 @@ void HySettings::downloadSpellDictsFinished() 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()<<"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->getFile(s, userDictDir); + } + delete fun; + } + if (d.filetype=="plain") { - qDebug()<<"Unzipping"<<userDictDir+s; - QString data=fun->getFile(s, userDictDir); + QStringList files=d.files.split(";", QString::SkipEmptyParts); + foreach (QString s, files) + { + //qDebug()<<"plain data found"<<downloadLocation<<userDictDir<<s; + moveFile(downloadLocation+s, userDictDir+s); + } } - delete fun; } updateDictList(); } @@ -293,7 +318,7 @@ void HySettings::setAvailDictsXMLFile(QString availDictsXMLDataFile) if( !e.isNull() ) { if (e.tagName()=="dictionary") { - if (e.hasAttribute("type")) + if (e.hasAttribute("type") && e.hasAttribute("filetype")) { if (e.attribute("type")=="spell") { @@ -305,6 +330,7 @@ void HySettings::setAvailDictsXMLFile(QString availDictsXMLDataFile) 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); diff --git a/scribus/hysettings.h b/scribus/hysettings.h index 53020ee..e135a7c 100644 --- a/scribus/hysettings.h +++ b/scribus/hysettings.h @@ -26,6 +26,7 @@ class SCRIBUS_API HySettings : public QWidget, Ui::hysettingsBase QString url; QString desc; QString license; + QString filetype; bool download; }; diff --git a/scribus/langmgr.cpp b/scribus/langmgr.cpp index d3b49cc..bf404f1 100644 --- a/scribus/langmgr.cpp +++ b/scribus/langmgr.cpp @@ -56,56 +56,64 @@ void LanguageManager::generateLangList() // 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_AU", langPair("English (Australia)", QObject::tr( "English (Australian)" )) ); + langList.insert("en_CA", langPair("English (Canada)", QObject::tr( "English (Canadian)" )) ); + 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 (American)", QObject::tr( "English (American)" )) ); + langList.insert("en_US", langPair("English (USA)", QObject::tr( "English (USA)" )) ); langList.insert("en_ZA", langPair("English (South African)", QObject::tr( "English (South African)" )) ); 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("is", langPair("Icelandic", QObject::tr( "Icelandic" )) ); langList.insert("id", langPair("Indonesian", QObject::tr( "Indonesian" )) ); + langList.insert("is", langPair("Icelandic", QObject::tr( "Icelandic" )) ); 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("lo", langPair("Lao", QObject::tr( "Lao" )) ); 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("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 �E5; 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" )) ); @@ -117,13 +125,10 @@ void LanguageManager::generateLangList() 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" )) ); @@ -133,7 +138,9 @@ void LanguageManager::generateLangList() 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() diff --git a/scribus/ui/downloaddictionaries.h b/scribus/ui/downloaddictionaries.h index d1366c8..60afb97 100644 --- a/scribus/ui/downloaddictionaries.h +++ b/scribus/ui/downloaddictionaries.h @@ -26,6 +26,7 @@ class SCRIBUS_API DownloadDictionaries : public QDialog, Ui::DownloadDictionarie QString url; QString desc; QString license; + QString filetype; bool download; }; |