Commit 60f29122 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.NodeMetaInfoReader: adding overwrite mode



When componets provide a .metainfo file in their
subdirectories this is more dynamic and we
have to overwrite entires.

Change-Id: I00a56d8e0382ce97bec4dedc80a665a93a71d415
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent abee2502
......@@ -53,7 +53,7 @@ class MetaInfoReader : protected QmlJS::SimpleAbstractStreamReader
public:
MetaInfoReader(const MetaInfo &metaInfo);
void readMetaInfoFile(const QString &path);
void readMetaInfoFile(const QString &path, bool overwriteDuplicates = false);
QStringList errors();
......@@ -112,6 +112,8 @@ private:
QString m_currentPropertyName;
QString m_currentPropertyType;
QVariant m_currentPropertyValue;
bool m_overwriteDuplicates;
};
}
......
......@@ -55,11 +55,13 @@ MetaInfoReader::MetaInfoReader(const MetaInfo &metaInfo)
: m_parserState(Undefined),
m_metaInfo(metaInfo)
{
m_overwriteDuplicates = false;
}
void MetaInfoReader::readMetaInfoFile(const QString &path)
void MetaInfoReader::readMetaInfoFile(const QString &path, bool overwriteDuplicates)
{
m_documentPath = path;
m_overwriteDuplicates = overwriteDuplicates;
m_parserState = ParsingDocument;
if (!SimpleAbstractStreamReader::readFile(path)) {
qWarning() << "readMetaInfoFile()" << path;
......@@ -296,7 +298,7 @@ void MetaInfoReader::insertItemLibraryEntry()
}
try {
m_metaInfo.itemLibraryInfo()->addEntry(m_currentEntry);
m_metaInfo.itemLibraryInfo()->addEntry(m_currentEntry, m_overwriteDuplicates);
} catch (InvalidMetaInfoException &) {
addError(tr("Invalid or duplicate item library entry %1").arg(m_currentEntry.name()), currentSourceLocation());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment