diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2 (patch) | |
tree | d3bb9f5d25a2dc09ca81adecf39621d871534297 /kgeography/src/divisioncapitalasker.cpp | |
download | tdeedu-ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2.tar.gz tdeedu-ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kgeography/src/divisioncapitalasker.cpp')
-rw-r--r-- | kgeography/src/divisioncapitalasker.cpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/kgeography/src/divisioncapitalasker.cpp b/kgeography/src/divisioncapitalasker.cpp new file mode 100644 index 00000000..0fcdb8b8 --- /dev/null +++ b/kgeography/src/divisioncapitalasker.cpp @@ -0,0 +1,75 @@ +/*************************************************************************** + * Copyright (C) 2004 by Albert Astals Cid * + * tsdgeos@terra.es * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include <klocale.h> + +#include <qradiobutton.h> + +#include "divisioncapitalasker.h" +#include "map.h" + +divisionCapitalAsker::divisionCapitalAsker(QWidget *parent, KGmap *m, QWidget *w, uint count) : boxAsker(parent, m, w, count) +{ + init(); +} + +bool divisionCapitalAsker::nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer) +{ + bool b; + if (isAnswer) + { + QString sw = i18n("There are two ways of dealing with the translation of \"The capital of %1 is...\". The first option simply replaces %1 with the translated name of the relevant region. If the grammar of your language allows this, choose this option by setting the translation of this message to 1, and leave untranslated the translations of \"The capital of %1 is...\" that have the placename embedded (or translate them as - if you wish to show the file as fully translated. The second option is to translate all messages in full - this is likely to be required in the case of highly-inflected languages like Russian. To choose this option, set the translation of this message to 0, and translate all the messages.", "0"); + if (sw == "1") + { + QString divisionName = i18n(p_map -> getFileName().utf8(), division.utf8()); + QString text = i18n("The capital of %1 is..."); + setQuestion(text.arg(divisionName)); + } + else + { + QString s = QString("The capital of %1 is...").arg(division); + setQuestion(i18n(p_map -> getFileName().utf8(), s.utf8())); + } + p_currentAnswer.setQuestion(i18n(p_map -> getFileName().utf8(), division.utf8())); + p_capital = p_map -> getDivisionCapital(division); + p_currentAnswer.setCorrectAnswer(i18n(p_map -> getFileName().utf8(), p_capital.utf8())); + p_rb[i] -> setText(i18n(p_map -> getFileName().utf8(), p_capital.utf8())); + b = true; + } + else + { + QString capital; + capital = p_map -> getDivisionCapital(division); + // There are crazy countries like Norway where two different divisions + // have the same capital, avoid asking + // The capital of Akershus is ... + // Oslo (true) + // Oslo (true) + // Lillehammer + // Moss + if (capital != p_capital) + { + p_rb[i] -> setText(i18n(p_map -> getFileName().utf8(), capital.utf8())); + b = true; + } + else b = false; + } + return b; +} + +void divisionCapitalAsker::setAnswerHook(int userSays) +{ + p_currentAnswer.setAnswer(p_rb[userSays] -> text()); +} + +QString divisionCapitalAsker::getQuestionHook() const +{ + return i18n("Capital of Division"); +} |