Account for the country/language settings when checking for duplicates

When a file has the same alias but a different country or language setting
then it should not warn about it being a potential duplicate.

Task-number: QTBUG-19286
Change-Id: I60a9c422ff02214399bdea3791374a65c9f6c604
Reviewed-by: hjk <hjk121@nokiamail.com>
bb10
Andy Shaw 2014-10-10 12:04:17 +02:00 committed by hjk
parent 8c538d10da
commit 7c90778487
1 changed files with 11 additions and 4 deletions

View File

@ -610,11 +610,18 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file)
const QString filename = nodes.at(nodes.size()-1);
RCCFileInfo *s = new RCCFileInfo(file);
s->m_parent = parent;
if (parent->m_children.contains(filename)) {
foreach (const QString &fileName, m_fileNames)
qWarning("%s: Warning: potential duplicate alias detected: '%s'",
qPrintable(fileName), qPrintable(filename));
typedef QHash<QString, RCCFileInfo*>::const_iterator ChildConstIterator;
const ChildConstIterator cbegin = parent->m_children.constFind(filename);
const ChildConstIterator cend = parent->m_children.constEnd();
for (ChildConstIterator it = cbegin; it != cend; ++it) {
if (it.key() == filename && it.value()->m_language == s->m_language &&
it.value()->m_country == s->m_country) {
foreach (const QString &name, m_fileNames)
qWarning("%s: Warning: potential duplicate alias detected: '%s'",
qPrintable(name), qPrintable(filename));
break;
}
}
parent->m_children.insertMulti(filename, s);
return true;
}