void KEduVocDocument::renameUsage(const QString &oldName, const QString &newName){
d->m_usages[d->m_usages.indexOf(oldName)]=newName;
+
+ for ( int i = 0; i < d->m_vocabulary.count(); i++) {
+ foreach (int translationIndex, d->m_vocabulary[i].translationIndices()) {
+ int usageIndex = d->m_vocabulary[i].translation(translationIndex).usages().indexOf(oldName);
+ if ( usageIndex >= 0 ) {
+ d->m_vocabulary[i].translation(translationIndex).usages()[usageIndex] = newName;
+ }
+ }
+ }
}
void KEduVocDocument::removeUsage(const QString &name){
d->m_usages.removeAt(d->m_usages.indexOf(name));
+
+ for ( int i = 0; i < d->m_vocabulary.count(); i++) {
+ foreach (int translationIndex, d->m_vocabulary[i].translationIndices()) {
+ int usageIndex = d->m_vocabulary[i].translation(translationIndex).usages().indexOf(name);
+ if ( usageIndex >= 0 ) {
+ d->m_vocabulary[i].translation(translationIndex).usages().removeAt(usageIndex);
+ }
+ }
+ }
}
/**
* Rename a usage label.
+ * Actually changes the label in the vocabulary as well.
*
* @param oldName old name of the usage label
* @param newName new name of the usage label
/**
* Remove a usage label.
+ * Also removes the label from all translations.
*
* @param name new name of the usage label
*/