Now it will actually be possible to remove translations.
Use KEduVocExpression->translationIndices() to get the translations that are present.
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=705446
if (!s.simplified().isEmpty()) {
KEduVocExpression expression(s, separator);
- languageCount = qMax(languageCount, expression.translationCount());
+ languageCount = qMax(languageCount, expression.translationIndices().count());
m_doc->appendEntry(&expression);
}
}
QString s1;
QString s2;
int cmp;
- for (int i = 0; i < exp->translationCount(); i++) {
+ foreach (int i, exp->translationIndices()) {
s1 = exp->translation(i).translation();
s2 = y.exp->translation(i).translation();
}
-int KEduVocExpression::translationCount() const
-{
- /// @todo: maybe this should go away? it is very rare with QMap
- // the minus 1 is because traditionally it used to be original + translations
- /// @todo get rid of the minus one. but for now this implies too many other changes.
- return d->m_translations.size();
-}
-
void KEduVocExpression::removeTranslation(int index)
{
/// @todo IMPLEMENT ME - this will be really easy to implement as soon as the translation class contains all this rubbish.
bool KEduVocExpression::uniqueType() const
{
-/// @todo use .keys() instead of translationCount()!
bool unique = true;
QString type0 = d->m_translations[0].type();
- for (int i = 1; i < translationCount(); i++)
- if (type0 != d->m_translations[i].type())
+ foreach (int i, translationIndices()) {
+ if (type0 != d->m_translations[i].type()) {
unique = false;
+ }
+ }
return unique;
}
*/
void removeTranslation(int index);
- /** returns number of max. translations of all expressions
- @todo kill this - will be wrong. We now should have a Identifiers class to handle this kind of stuff
- */
- int translationCount() const;
/**
* Get a mutable reference to the translation
}
// loop through translations
- for (int trans = 0; trans < thisEntry->translationCount(); ++trans)
- {
+ foreach (int trans, thisEntry->translationIndices()) {
// write translations
QDomElement translation = m_domDoc.createElement(KVTML_TRANSLATION);
translation.setAttribute(KVTML_ID, QString::number(trans));