diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-04-15 21:15:12 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-04-15 21:15:12 (GMT) |
commit | ca83968f235c731f3bd1eb38e3c97d38d34565a0 (patch) | |
tree | 257bab4ee7feeba0739325f214c3c977cb720c50 /tools/linguist/lupdate | |
parent | cf9358a739b3d12c575b572ef6bba7c64f4c4b4a (diff) | |
parent | 287d5e7b349dac0cfdb74e9747752fcadc432064 (diff) | |
download | Qt-ca83968f235c731f3bd1eb38e3c97d38d34565a0.zip Qt-ca83968f235c731f3bd1eb38e3c97d38d34565a0.tar.gz Qt-ca83968f235c731f3bd1eb38e3c97d38d34565a0.tar.bz2 |
Merge branch '4.5' of git@scm.dev.troll.no:qt/qt
Diffstat (limited to 'tools/linguist/lupdate')
-rw-r--r-- | tools/linguist/lupdate/ui.cpp | 24 |
1 files changed, 16 insertions, 8 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) |