Commit 743b5b74 authored by Leandro Melo's avatar Leandro Melo Committed by Erik Verbruggen

C++ editor: Normalize line endings for find usages

Find usages and related rely on functions that assume \n as line
ending. This is true for the preprocessed files, but not for the
original sources.

Change-Id: I61b7e05c0116504d11c7df4b1aa10d519b705336
Reviewed-on: http://codereview.qt.nokia.com/260Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@nokia.com>
parent c2955226
......@@ -79,7 +79,7 @@ static QString getSource(const QString &fileName,
return workingCopy.source(fileName);
} else {
Utils::FileReader reader;
if (!reader.fetch(fileName)) // ### FIXME error reporting
if (!reader.fetch(fileName, QFile::Text)) // ### FIXME error reporting
return QString();
return QString::fromLocal8Bit(reader.data()); // ### FIXME encoding
......
......@@ -68,7 +68,7 @@ void UiCodeModelSupport::init() const
QDateTime uiHeaderTime = uiHeaderFileInfo.exists() ? uiHeaderFileInfo.lastModified() : QDateTime();
if (uiHeaderTime.isValid() && (uiHeaderTime > sourceTime)) {
QFile file(m_fileName);
if (file.open(QFile::ReadOnly)) {
if (file.open(QFile::ReadOnly | QFile::Text)) {
if (debug)
qDebug()<<"ui*h file is more recent then source file, using information from ui*h file"<<m_fileName;
QTextStream stream(&file);
......@@ -81,7 +81,7 @@ void UiCodeModelSupport::init() const
if (debug)
qDebug()<<"ui*h file not found, or not recent enough, trying to create it on the fly";
QFile file(m_sourceName);
if (file.open(QFile::ReadOnly)) {
if (file.open(QFile::ReadOnly | QFile::Text)) {
QTextStream stream(&file);
const QString contents = stream.readAll();
if (runUic(contents)) {
......@@ -189,7 +189,7 @@ void UiCodeModelSupport::updateFromBuild()
qDebug()<<"found ui*h updating from it";
QFile file(m_fileName);
if (file.open(QFile::ReadOnly)) {
if (file.open(QFile::ReadOnly | QFile::Text)) {
QTextStream stream(&file);
m_contents = stream.readAll().toUtf8();
m_cacheTime = uiHeaderTime;
......
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