Subversion Repositories Scribus

Compare Revisions

Regard whitespace Rev 16073 → Rev 16071

/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
124,17 → 124,10
}
// if (docBytes.left(16) == "<SCRIBUSUTF8NEW " && docBytes.left(35).contains("Version=\"1.3.4"))
// return true;
QRegExp regExp134("Version=\"1.3.[4-9]");
QRegExp regExp140("Version=\"1.4.[0-9]");
QRegExp regExp("Version=\"1.3.[4-9]");
int startElemPos = docBytes.left(512).indexOf("<SCRIBUSUTF8NEW ");
if (startElemPos >= 0)
{
bool is134 = ( regExp134.indexIn(docBytes.mid(startElemPos, 64)) >= 0 );
bool is140 = ( regExp140.indexIn(docBytes.mid(startElemPos, 64)) >= 0 );
return (is134 || is140);
return startElemPos >= 0 && (regExp.indexIn(docBytes.mid(startElemPos, 64)) >= 0);
}
return false;
}
 
QString Scribus134Format::readSLA(const QString & fileName)
{
153,20 → 146,14
loadRawText(fileName, docBytes);
}
QString docText("");
QRegExp regExp("Version=\"1.3.[4-9]");
int startElemPos = docBytes.left(512).indexOf("<SCRIBUSUTF8NEW ");
if (startElemPos >= 0)
{
QRegExp regExp134("Version=\"1.3.[4-9]");
QRegExp regExp140("Version=\"1.4.[0-9]");
bool is134 = ( regExp134.indexIn(docBytes.mid(startElemPos, 64)) >= 0 );
bool is140 = ( regExp140.indexIn(docBytes.mid(startElemPos, 64)) >= 0 );
if (is134 || is140)
if (startElemPos >= 0 && (regExp.indexIn(docBytes.mid(startElemPos, 64)) >= 0))
docText = QString::fromUtf8(docBytes);
else
return QString::null;
if (docText.endsWith(QChar(10)) || docText.endsWith(QChar(13)))
docText.truncate(docText.length()-1);
}
if (docText.isEmpty())
return QString::null;
return docText;
}