aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/generichighlighter/definitiondownloader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/texteditor/generichighlighter/definitiondownloader.cpp')
-rw-r--r--src/plugins/texteditor/generichighlighter/definitiondownloader.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/texteditor/generichighlighter/definitiondownloader.cpp b/src/plugins/texteditor/generichighlighter/definitiondownloader.cpp
index b051e8caaac..bba85593e43 100644
--- a/src/plugins/texteditor/generichighlighter/definitiondownloader.cpp
+++ b/src/plugins/texteditor/generichighlighter/definitiondownloader.cpp
@@ -88,8 +88,18 @@ void DefinitionDownloader::saveData(QNetworkReply *reply)
const QString &fileName =
urlPath.right(urlPath.length() - urlPath.lastIndexOf(QLatin1Char('/')) - 1);
Utils::FileSaver saver(m_localPath + fileName, QIODevice::Text);
- saver.write(reply->readAll());
+ const QByteArray data = reply->readAll();
+ saver.write(data);
m_status = saver.finalize() ? Ok: WriteError;
+ QString content = QString::fromUtf8(data);
+ QRegExp reference(QLatin1String("context\\s*=\\s*\"[^\"]*##([^\"]+)\""));
+ int index = -1;
+ forever {
+ index = reference.indexIn(content, index + 1);
+ if (index == -1)
+ break;
+ emit foundReferencedDefinition(reference.cap(1));
+ }
}
DefinitionDownloader::Status DefinitionDownloader::status() const