summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-04-15 21:15:12 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-04-15 21:15:12 (GMT)
commitca83968f235c731f3bd1eb38e3c97d38d34565a0 (patch)
tree257bab4ee7feeba0739325f214c3c977cb720c50
parentcf9358a739b3d12c575b572ef6bba7c64f4c4b4a (diff)
parent287d5e7b349dac0cfdb74e9747752fcadc432064 (diff)
downloadQt-ca83968f235c731f3bd1eb38e3c97d38d34565a0.zip
Qt-ca83968f235c731f3bd1eb38e3c97d38d34565a0.tar.gz
Qt-ca83968f235c731f3bd1eb38e3c97d38d34565a0.tar.bz2
Merge branch '4.5' of git@scm.dev.troll.no:qt/qt
-rw-r--r--tools/linguist/lupdate/ui.cpp24
-rw-r--r--tools/linguist/shared/profileevaluator.cpp11
2 files changed, 26 insertions, 9 deletions
diff --git a/tools/linguist/lupdate/ui.cpp b/tools/linguist/lupdate/ui.cpp
index 6b47969..935cac4 100644
--- a/tools/linguist/lupdate/ui.cpp
+++ b/tools/linguist/lupdate/ui.cpp
@@ -59,7 +59,7 @@ class UiReader : public QXmlDefaultHandler
{
public:
UiReader(Translator &translator, ConversionData &cd)
- : m_translator(translator), m_cd(cd), m_lineNumber(-1),
+ : m_translator(translator), m_cd(cd), m_lineNumber(-1), m_isTrString(false),
m_needUtf8(translator.codecName() != "UTF-8")
{}
@@ -80,6 +80,7 @@ private:
QString m_context;
QString m_source;
QString m_comment;
+ QString m_extracomment;
QXmlLocator *m_locator;
QString m_accum;
@@ -94,22 +95,27 @@ bool UiReader::startElement(const QString &namespaceURI,
Q_UNUSED(namespaceURI);
Q_UNUSED(localName);
- if (qName == QLatin1String("item")) {
+ if (qName == QLatin1String("item")) { // UI3 menu entries
flush();
- if (!atts.value(QLatin1String("text")).isEmpty())
+ if (!atts.value(QLatin1String("text")).isEmpty()) {
m_source = atts.value(QLatin1String("text"));
+ m_isTrString = true;
+ if (!m_cd.m_noUiLines)
+ m_lineNumber = m_locator->lineNumber();
+ }
} else if (qName == QLatin1String("string")) {
flush();
if (atts.value(QLatin1String("notr")).isEmpty() ||
atts.value(QLatin1String("notr")) != QLatin1String("true")) {
m_isTrString = true;
m_comment = atts.value(QLatin1String("comment"));
+ m_extracomment = atts.value(QLatin1String("extracomment"));
+ if (!m_cd.m_noUiLines)
+ m_lineNumber = m_locator->lineNumber();
} else {
m_isTrString = false;
}
}
- if (m_isTrString && !m_cd.m_noUiLines)
- m_lineNumber = m_locator->lineNumber();
m_accum.clear();
return true;
}
@@ -122,15 +128,15 @@ bool UiReader::endElement(const QString &namespaceURI,
m_accum.replace(QLatin1String("\r\n"), QLatin1String("\n"));
- if (qName == QLatin1String("class")) {
+ if (qName == QLatin1String("class")) { // UI "header"
if (m_context.isEmpty())
m_context = m_accum;
} else if (qName == QLatin1String("string") && m_isTrString) {
m_source = m_accum;
- } else if (qName == QLatin1String("comment")) {
+ } else if (qName == QLatin1String("comment")) { // FIXME: what's that?
m_comment = m_accum;
flush();
- } else if (qName == QLatin1String("function")) {
+ } else if (qName == QLatin1String("function")) { // UI3 embedded code
fetchtrInlinedCpp(m_accum, m_translator, m_context);
} else {
flush();
@@ -160,12 +166,14 @@ void UiReader::flush()
TranslatorMessage msg(m_context, m_source,
m_comment, QString(), m_cd.m_sourceFileName,
m_lineNumber, QStringList());
+ msg.setExtraComment(m_extracomment);
if (m_needUtf8 && msg.needs8Bit())
msg.setUtf8(true);
m_translator.extend(msg);
}
m_source.clear();
m_comment.clear();
+ m_extracomment.clear();
}
bool loadUI(Translator &translator, const QString &filename, ConversionData &cd)
diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp
index 14355b3..5c83f7e 100644
--- a/tools/linguist/shared/profileevaluator.cpp
+++ b/tools/linguist/shared/profileevaluator.cpp
@@ -367,6 +367,9 @@ void ProFileEvaluator::Private::insertVariable(const QString &line, int *i)
{
ProVariable::VariableOperator opkind;
+ if (m_proitem.isEmpty()) // Line starting with '=', like a conflict marker
+ return;
+
switch (m_proitem.at(m_proitem.length() - 1).unicode()) {
case '+':
m_proitem.chop(1);
@@ -2022,7 +2025,13 @@ ProFile *ProFileEvaluator::parsedProFile(const QString &fileName)
{
QFileInfo fi(fileName);
if (fi.exists()) {
- ProFile *pro = new ProFile(fi.absoluteFilePath());
+ QString fn = QDir::cleanPath(fi.absoluteFilePath());
+ foreach (const ProFile *pf, d->m_profileStack)
+ if (pf->fileName() == fn) {
+ errorMessage(d->format("circular inclusion of %1").arg(fn));
+ return 0;
+ }
+ ProFile *pro = new ProFile(fn);
if (d->read(pro))
return pro;
delete pro;