[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdeedu/klatin/klatin
From: George Wright <gwright () kde ! org>
Date: 2004-08-16 19:19:26
Message-ID: 20040816191926.86D6394A3 () office ! kde ! org
[Download RAW message or body]
CVS commit by gwright:
Fix bug regarding loading files and them being removed, some coding style fixes and \
changed some credits
M +0 -3 klatin.kcfg 1.10
M +31 -4 klatinvocab.cpp 1.36
M +7 -7 main.cpp 1.27
--- kdeedu/klatin/klatin/klatin.kcfg #1.9:1.10
@@ -19,7 +19,4 @@
m_language = "en";
}
- //later, scan for present languages
- //if (m_language!="it")
- // m_language = "en";
kdDebug()<< m_language \
<<endl; </code>
--- kdeedu/klatin/klatin/klatinvocab.cpp #1.35:1.36
@@ -16,4 +16,5 @@
***************************************************************************/
+#include <qdir.h>
#include <qlabel.h>
#include <qlistview.h>
@@ -86,9 +87,35 @@ void KLatinVocab::parseVocab(QString cus
QFile check(fileName);
- // If not then inform user and crash out
+ // If not then regenerate working default
+ if (check.exists() == FALSE) {
+ KConfigBase *globalConf = KGlobal::config();
+ globalConf->setGroup("Locale");
+
+ QString language = globalConf->readEntry("Language", "en");
+ language = language.left(2);
+
+ QString fileNameLang = locate("data", "klatin/data/vocabs/");
+ fileNameLang += language;
+
+ QDir checkLang(fileNameLang);
+
+ if (checkLang.exists() == FALSE) {
+ language = "en";
+ }
+
+ QDir vocabDirectory(fileNameLang, "*.kvtml");
+
+ QString defaultFile = (fileNameLang + "/" + vocabDirectory[0]);
+
+ check.setName(defaultFile);
+
if (check.exists() == FALSE) {
check.close();
- KMessageBox::error(0, i18n("Could not load vocabulary file; there is \
either a problem with your KLatin installation or there is no i18n support for this \
language."), i18n("Error with KLatin")); + \
KMessageBox::error(0, i18n("Could not load vocabulary file; there is a problem with \
your KLatin installation."), i18n("Error with KLatin")); exit(0);
+ } else {
+ fileName = defaultFile;
+ Settings::setDefaultFile(defaultFile);
+ }
}
--- kdeedu/klatin/klatin/main.cpp #1.26:1.27
@@ -41,20 +41,20 @@ int main(int argc, char *argv[])
aboutData.addAuthor("Anne-Marie Mahfouf",I18N_NOOP("Co-maintainer, bug \
fixes, documentation"), "annma@kde.org");
aboutData.addAuthor("Neil Stevens",I18N_NOOP("Vocabulary shuffling code"), \
"neil@hakubi.us");
- aboutData.addAuthor("Jason Harris",I18N_NOOP("SVG icon"), \
"jharris@30doradus.org");
- aboutData.addAuthor("Pino Toscano",I18N_NOOP("Italian Vocabulary Data \
Translation"), "toscano.pino@tiscali.it"); + aboutData.addCredit("Jason \
Harris",I18N_NOOP("SVG icon"), "jharris@30doradus.org"); + \
aboutData.addCredit("Pino Toscano",I18N_NOOP("Italian Vocabulary Data Translation"), \
"toscano.pino@tiscali.it"); KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KApplication a;
+
KLatin *klatin = new KLatin();
- if (a.isRestored())
- {
+
+ if (a.isRestored()) {
RESTORE(KLatin);
- }
- else
- {
+ } else {
a.setMainWidget(klatin);
klatin->show();
}
+
return a.exec();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic