Commit 775e1234 authored by Laurent Montel's avatar Laurent Montel 😁

fix some clazy warning

parent 7b13aa3e
......@@ -97,11 +97,11 @@ void KEduVocDocumentTest::createTmpTestFileOfType(KEduVocDocument::FileType file
{
KEduVocDocument::ErrorCode result = m_documentTemplate.saveAs(tmpTestFileUrl(), fileType);
if (result != KEduVocDocument::NoError) {
QStringList errorStrings = QStringList() << "NoError" << "Unknown" << "InvalidXml"
<< "FileTypeUnknown" << "FileCannotWrite" << "FileWriterFailed" << "FileCannotRead"
<< "FileReaderFailed"<< "FileDoesNotExist" << "FileLocked" << "FileCannotLock"
<< "FileIsReadOnly";
QString failText =QString("Temporary test file could not be saved. (Error code = %1)");
QStringList errorStrings = QStringList() << QStringLiteral("NoError") << QStringLiteral("Unknown") << QStringLiteral("InvalidXml")
<< QStringLiteral("FileTypeUnknown") << QStringLiteral("FileCannotWrite") << QStringLiteral("FileWriterFailed") << QStringLiteral("FileCannotRead")
<< QStringLiteral("FileReaderFailed")<< QStringLiteral("FileDoesNotExist") << QStringLiteral("FileLocked") << QStringLiteral("FileCannotLock")
<< QStringLiteral("FileIsReadOnly");
QString failText =QStringLiteral("Temporary test file could not be saved. (Error code = %1)");
failText = failText.arg(errorStrings.value(result));
QFAIL(failText.toLocal8Bit().constData());
}
......
......@@ -35,7 +35,7 @@ void KEduVocTextTest::testAssignmentOperator()
QCOMPARE(isEqual(t1, t2), true);
t1.setText("foo");
t1.setText(QStringLiteral("foo"));
QCOMPARE(isEqual(t1, t2), false);
t2 = t1;
QCOMPARE(isEqual(t1, t2), true);
......@@ -82,9 +82,9 @@ void KEduVocTextTest::testEqualToOperator()
QCOMPARE(t1 == t2, true);
t1.setText("foo");
t1.setText(QStringLiteral("foo"));
QCOMPARE(t1 == t2, false);
t2.setText("foo");
t2.setText(QStringLiteral("foo"));
QCOMPARE(t1 == t2, true);
t1.setPreGrade(1);
......
......@@ -129,18 +129,18 @@ public:
XMLGenerator::XMLGenerator()
: QDomDocument()
, generator( "Parse KVTML2 Unit Tests")
, author( "Parse KVTML2 Test Author" )
, license( "test license" )
, comment( "comment" )
, date( "2014-01-01" )
, category( "test document" )
, title( "Parse KVTML2 Test Title" )
, lang0name( "English" )
, lang0loc( "en" )
, lang1name( "German" )
, lang1loc( "de" )
, generator( QStringLiteral("Parse KVTML2 Unit Tests"))
, author( QStringLiteral("Parse KVTML2 Test Author") )
, license( QStringLiteral("test license") )
, comment( QStringLiteral("comment") )
, date( QStringLiteral("2014-01-01") )
, category( QStringLiteral("test document") )
, title( QStringLiteral("Parse KVTML2 Test Title") )
, lang0name( QStringLiteral("English") )
, lang0loc( QStringLiteral("en") )
, lang1name( QStringLiteral("German") )
, lang1loc( QStringLiteral("de") )
, m_buffer( 0 )
, myType( KEduVocDocument::Kvtml )
......@@ -161,12 +161,12 @@ QIODevice * XMLGenerator::toQIODevice()
}
XMLGenerator & XMLGenerator::preamble() {
this -> setContent( QString( "<!DOCTYPE kvtml PUBLIC \"kvtml2.dtd\" \"http://edu.kde.org/kvtml/kvtml2.dtd\">\n" ) , true, 0, 0, 0);
this->appendChild( this->createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) );
this -> setContent( QStringLiteral( "<!DOCTYPE kvtml PUBLIC \"kvtml2.dtd\" \"http://edu.kde.org/kvtml/kvtml2.dtd\">\n" ) , true, 0, 0, 0);
this->appendChild( this->createProcessingInstruction( QStringLiteral("xml"), QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"") ) );
QDomElement domElementKvtml = this->createElement( KVTML_TAG );
this->appendChild( domElementKvtml );
domElementKvtml.setAttribute( KVTML_VERSION, ( QString ) "2.0" );
domElementKvtml.setAttribute( KVTML_VERSION, ( QString ) QStringLiteral("2.0") );
return *this;
}
......@@ -207,7 +207,7 @@ XMLGenerator & XMLGenerator::minimalHeader() {
XMLGenerator & XMLGenerator::blankIdentifier(const int ii) {
QDomElement id = this->createElement( KVTML_IDENTIFIER );
QString str;
id.setAttribute("id", str.setNum( ii ) );
id.setAttribute(QStringLiteral("id"), str.setNum( ii ) );
elementsByTagName(KVTML_IDENTIFIERS).at( 0 ).appendChild( id );
return *this;
}
......@@ -222,7 +222,7 @@ XMLGenerator & XMLGenerator::addLocale(const int ii) {
XMLGenerator &XMLGenerator::blankEntry(int entryId)
{
QDomElement elem = this->createElement(KVTML_ENTRY);
elem.setAttribute("id", QString::number(entryId));
elem.setAttribute(QStringLiteral("id"), QString::number(entryId));
elementsByTagName(KVTML_ENTRIES).at(0).appendChild(elem);
return *this;
}
......@@ -230,7 +230,7 @@ XMLGenerator &XMLGenerator::blankEntry(int entryId)
XMLGenerator &XMLGenerator::blankTranslation(int translationId)
{
QDomElement elem = this->createElement(KVTML_TRANSLATION);
elem.setAttribute("id", QString::number(translationId));
elem.setAttribute(QStringLiteral("id"), QString::number(translationId));
elementsByTagName(KVTML_ENTRY).at(0).appendChild(elem);
return *this;
}
......@@ -268,7 +268,7 @@ XMLGenerator &XMLGenerator::blankContainer()
XMLGenerator &XMLGenerator::addContainerEntry(int entryId)
{
QDomElement elem = this->createElement(KVTML_ENTRY);
elem.setAttribute("id", QString::number(entryId));
elem.setAttribute(QStringLiteral("id"), QString::number(entryId));
elementsByTagName(KVTML_CONTAINER).at(0).appendChild(elem);
return *this;
}
......
......@@ -84,7 +84,7 @@ private :
void PaukerReaderTest::init() {
oneGoodDoc = \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n \
QStringLiteral("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n \
<!--This is a lesson file for Pauker (http://pauker.sourceforge.net)-->\n \
<Lesson LessonFormat=\"1.7\">\n \
<Description>Some Description</Description>\n \
......@@ -98,7 +98,7 @@ void PaukerReaderTest::init() {
</ReverseSide>\n \
</Card>\n \
</Batch>\n \
</Lesson>\n" ;
</Lesson>\n") ;
oneBadDoc = oneGoodDoc + "\ninvalid XML characters ";
myType = KEduVocDocument::Pauker;
......
......@@ -66,7 +66,7 @@ private :
void VokabelnReaderTest::init() {
oneGoodDoc =
QString( "\"A Title of S0me Sort\n" ) \
QStringLiteral( "\"A Title of S0me Sort\n" ) \
+ "en - de\n" \
+ "Still more text\",3,456,789\n" \
+ "0\n" \
......@@ -105,7 +105,7 @@ void VokabelnReaderTest::init() {
+ "\"Extra Lesson Title\"\n";
oneBadDoc =
QString( "\"A Title of S0me Sort\n" ) \
QStringLiteral( "\"A Title of S0me Sort\n" ) \
+ "en - de\n" \
+ "Still more text\",3,456,789\n" \
+ "0\n" \
......
......@@ -93,16 +93,16 @@ public:
};
WQLGenerator::WQLGenerator()
: headerText( "WordQuiz\n5\n")
, fontTag( "[Font Info]" )
, gridTag( "[Grid Info]" )
, vocabTag( "[Vocabulary]" )
, lang0loc( "en" )
, lang1loc( "de" )
, word0Left( "dog" )
, word0Right( "Hund" )
: headerText( QStringLiteral("WordQuiz\n5\n"))
, fontTag( QStringLiteral("[Font Info]") )
, gridTag( QStringLiteral("[Grid Info]") )
, vocabTag( QStringLiteral("[Vocabulary]") )
, lang0loc( QStringLiteral("en") )
, lang1loc( QStringLiteral("de") )
, word0Left( QStringLiteral("dog") )
, word0Right( QStringLiteral("Hund") )
, m_buffer( 0 )
, m_string( "" )
, m_string( QLatin1String("") )
, myType( KEduVocDocument::Wql )
{
......
......@@ -66,7 +66,7 @@ private :
void XdxfReaderTest::init() {
oneGoodDoc = \
QString( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" )
QStringLiteral( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" )
+ "<!DOCTYPE xdxf SYSTEM \"http://xdxf.sourceforge.net/xdxf_lousy.dtd\">\n"
+ "<xdxf lang_from=\"GER\" lang_to=\"SPA\" format=\"visual\">\net"
+ "<full_name>German Spanish</full_name>\n"
......
......@@ -53,7 +53,7 @@ bool KEduVocCsvWriter::writeDoc( KEduVocDocument *doc, const QString &generator
for ( int e = 0; e < m_doc->lesson()->entryCount(KEduVocLesson::Recursive); e++ ) {
expression = m_doc->lesson()->entries(KEduVocLesson::Recursive).value( e );
currentRow = "";
currentRow = QLatin1String("");
bool sep = false;
for ( int i = 0; i < idCount; i++ ) {
......
......@@ -152,14 +152,14 @@ void KEduVocDocument::KEduVocDocumentPrivate::init()
m_sizeHints.clear();
m_dirty = false;
m_isReadOnly = false;
m_queryorg = "";
m_querytrans = "";
m_queryorg = QLatin1String("");
m_querytrans = QLatin1String("");
m_autosave->setManagedFile( QUrl() );
m_author = "";
m_title = "";
m_comment = "";
m_version = "";
m_generator = "";
m_author = QLatin1String("");
m_title = QLatin1String("");
m_comment = QLatin1String("");
m_version = QLatin1String("");
m_generator = QLatin1String("");
m_csvDelimiter = QString( '\t' );
m_usages.clear();
m_license.clear();
......@@ -868,9 +868,9 @@ QString KEduVocDocument::pattern( FileDialogMode mode )
}
}
if ( mode == Reading ) {
newfilters.prepend( allext.join( " " ) + '|' + i18n( "All supported documents" ) );
newfilters.prepend( allext.join( QStringLiteral(" ") ) + '|' + i18n( "All supported documents" ) );
}
return newfilters.join( ";;" );
return newfilters.join( QStringLiteral(";;") );
}
QString KEduVocDocument::errorDescription( int errorCode )
......
......@@ -44,7 +44,7 @@ KEduVocIdentifier::KEduVocIdentifier()
: d( new Private )
{
///@todo maybe the user locale would be more appropriate
d->m_locale = "en";
d->m_locale = QStringLiteral("en");
}
KEduVocIdentifier::~KEduVocIdentifier()
......
......@@ -58,12 +58,12 @@ bool KEduVocKvtml2Writer::createXmlDocument( KEduVocDocument *doc, const QString
{
m_doc = doc;
m_domDoc = QDomDocument( "kvtml PUBLIC \"kvtml2.dtd\" \"http://edu.kde.org/kvtml/kvtml2.dtd\"" );
m_domDoc.appendChild( m_domDoc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) );
QDomElement domElementKvtml = m_domDoc.createElement( "kvtml" );
m_domDoc = QDomDocument( QStringLiteral("kvtml PUBLIC \"kvtml2.dtd\" \"http://edu.kde.org/kvtml/kvtml2.dtd\"") );
m_domDoc.appendChild( m_domDoc.createProcessingInstruction( QStringLiteral("xml"), QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"") ) );
QDomElement domElementKvtml = m_domDoc.createElement( QStringLiteral("kvtml") );
m_domDoc.appendChild( domElementKvtml );
domElementKvtml.setAttribute( KVTML_VERSION, ( QString ) "2.0" );
domElementKvtml.setAttribute( KVTML_VERSION, ( QString ) QStringLiteral("2.0") );
// information group
QDomElement currentElement = m_domDoc.createElement( KVTML_INFORMATION );
......@@ -145,7 +145,7 @@ bool KEduVocKvtml2Writer::writeInformation( QDomElement &informationElement, con
}
QDate today = QDate::currentDate();
informationElement.appendChild( newTextElement( KVTML_DATE, today.toString(QLatin1String("yyyy-MM-dd")) ) );
informationElement.appendChild( newTextElement( KVTML_DATE, today.toString(QStringLiteral("yyyy-MM-dd")) ) );
// category
if ( !m_doc->category().isEmpty() ) {
......
......@@ -28,8 +28,8 @@
#include <QDebug>
const QString KEduVocKvtmlCompability::KVTML_1_USER_DEFINED = QString( "#" );
const QString KEduVocKvtmlCompability::KVTML_1_SEPERATOR = QString( ":" );
const QString KEduVocKvtmlCompability::KVTML_1_USER_DEFINED = QStringLiteral( "#" );
const QString KEduVocKvtmlCompability::KVTML_1_SEPERATOR = QStringLiteral( ":" );
KEduVocKvtmlCompability::KEduVocKvtmlCompability()
......@@ -46,32 +46,32 @@ KEduVocKvtmlCompability::KEduVocKvtmlCompability()
void KEduVocKvtmlCompability::initOldTypeLists()
{
m_oldMainTypeNames.clear();
m_oldMainTypeNames.insert( "v", i18nc( "@item:inlistbox The grammatical type of a word", "Verb" ) );
m_oldMainTypeNames.insert( "n", i18nc( "@item:inlistbox The grammatical type of a word", "Noun" ) );
m_oldMainTypeNames.insert( "nm", i18nc( "@item:inlistbox The grammatical type of a word", "Name" ) );
m_oldMainTypeNames.insert( "ar", i18nc( "@item:inlistbox The grammatical type of a word", "Article" ) );
m_oldMainTypeNames.insert( "aj", i18nc( "@item:inlistbox The grammatical type of a word", "Adjective" ) );
m_oldMainTypeNames.insert( "av", i18nc( "@item:inlistbox The grammatical type of a word", "Adverb" ) );
m_oldMainTypeNames.insert( "pr", i18nc( "@item:inlistbox The grammatical type of a word", "Pronoun" ) );
m_oldMainTypeNames.insert( "ph", i18nc( "@item:inlistbox The grammatical type of an entry", "Phrase" ) );
m_oldMainTypeNames.insert( "num", i18nc( "@item:inlistbox The grammatical type of a word", "Numeral" ) );
m_oldMainTypeNames.insert( "con", i18nc( "@item:inlistbox The grammatical type of a word", "Conjunction" ) );
m_oldMainTypeNames.insert( "pre", i18nc( "@item:inlistbox The grammatical type of a word", "Preposition" ) );
m_oldMainTypeNames.insert( "qu", i18nc( "@item:inlistbox The grammatical type of an entry", "Question" ) );
m_oldMainTypeNames.insert( QStringLiteral("v"), i18nc( "@item:inlistbox The grammatical type of a word", "Verb" ) );
m_oldMainTypeNames.insert( QStringLiteral("n"), i18nc( "@item:inlistbox The grammatical type of a word", "Noun" ) );
m_oldMainTypeNames.insert( QStringLiteral("nm"), i18nc( "@item:inlistbox The grammatical type of a word", "Name" ) );
m_oldMainTypeNames.insert( QStringLiteral("ar"), i18nc( "@item:inlistbox The grammatical type of a word", "Article" ) );
m_oldMainTypeNames.insert( QStringLiteral("aj"), i18nc( "@item:inlistbox The grammatical type of a word", "Adjective" ) );
m_oldMainTypeNames.insert( QStringLiteral("av"), i18nc( "@item:inlistbox The grammatical type of a word", "Adverb" ) );
m_oldMainTypeNames.insert( QStringLiteral("pr"), i18nc( "@item:inlistbox The grammatical type of a word", "Pronoun" ) );
m_oldMainTypeNames.insert( QStringLiteral("ph"), i18nc( "@item:inlistbox The grammatical type of an entry", "Phrase" ) );
m_oldMainTypeNames.insert( QStringLiteral("num"), i18nc( "@item:inlistbox The grammatical type of a word", "Numeral" ) );
m_oldMainTypeNames.insert( QStringLiteral("con"), i18nc( "@item:inlistbox The grammatical type of a word", "Conjunction" ) );
m_oldMainTypeNames.insert( QStringLiteral("pre"), i18nc( "@item:inlistbox The grammatical type of a word", "Preposition" ) );
m_oldMainTypeNames.insert( QStringLiteral("qu"), i18nc( "@item:inlistbox The grammatical type of an entry", "Question" ) );
m_oldSubTypeNames.clear();
m_oldSubTypeNames.insert( "ord", i18nc( "@item:inlistbox A subtype of the grammatical word type: Numeral Ordinal (first, second, third, ...)","Ordinal" ) );
m_oldSubTypeNames.insert( "crd", i18nc( "@item:inlistbox A subtype of the grammatical word type: Numeral Cardinal (one, two, three, ...)","Cardinal" ) );
m_oldSubTypeNames.insert( "def", i18nc( "@item:inlistbox A subtype of the grammatical word type: Article (the)","Definite" ) );
m_oldSubTypeNames.insert( "ind", i18nc( "@item:inlistbox A subtype of the grammatical word type: Article (a)","Indefinite" ) );
m_oldSubTypeNames.insert( "re", i18nc( "@item:inlistbox A subtype of the grammatical word type: Verb with regular conjugation","Regular" ) );
m_oldSubTypeNames.insert( "ir", i18nc( "@item:inlistbox A subtype of the grammatical word type: Verb with irregular conjugation","Irregular" ) );
m_oldSubTypeNames.insert( "pos", i18nc( "@item:inlistbox A subtype of the grammatical word type: Pronoun (my, your, his, her...)", "Possessive" ) );
m_oldSubTypeNames.insert( "per", i18nc( "@item:inlistbox A subtype of the grammatical word type: Pronoun (I, you, he...)", "Personal" ) );
m_oldSubTypeNames.insert( "m", i18nc( "@item:inlistbox A subtype of the grammatical word type: Noun", "Male" ) );
m_oldSubTypeNames.insert( "f", i18nc( "@item:inlistbox A subtype of the grammatical word type: Noun", "Female" ) );
m_oldSubTypeNames.insert( "s", i18nc( "@item:inlistbox A subtype of the grammatical word type: Noun", "Neutral" ) );
m_oldSubTypeNames.insert( QStringLiteral("ord"), i18nc( "@item:inlistbox A subtype of the grammatical word type: Numeral Ordinal (first, second, third, ...)","Ordinal" ) );
m_oldSubTypeNames.insert( QStringLiteral("crd"), i18nc( "@item:inlistbox A subtype of the grammatical word type: Numeral Cardinal (one, two, three, ...)","Cardinal" ) );
m_oldSubTypeNames.insert( QStringLiteral("def"), i18nc( "@item:inlistbox A subtype of the grammatical word type: Article (the)","Definite" ) );
m_oldSubTypeNames.insert( QStringLiteral("ind"), i18nc( "@item:inlistbox A subtype of the grammatical word type: Article (a)","Indefinite" ) );
m_oldSubTypeNames.insert( QStringLiteral("re"), i18nc( "@item:inlistbox A subtype of the grammatical word type: Verb with regular conjugation","Regular" ) );
m_oldSubTypeNames.insert( QStringLiteral("ir"), i18nc( "@item:inlistbox A subtype of the grammatical word type: Verb with irregular conjugation","Irregular" ) );
m_oldSubTypeNames.insert( QStringLiteral("pos"), i18nc( "@item:inlistbox A subtype of the grammatical word type: Pronoun (my, your, his, her...)", "Possessive" ) );
m_oldSubTypeNames.insert( QStringLiteral("per"), i18nc( "@item:inlistbox A subtype of the grammatical word type: Pronoun (I, you, he...)", "Personal" ) );
m_oldSubTypeNames.insert( QStringLiteral("m"), i18nc( "@item:inlistbox A subtype of the grammatical word type: Noun", "Male" ) );
m_oldSubTypeNames.insert( QStringLiteral("f"), i18nc( "@item:inlistbox A subtype of the grammatical word type: Noun", "Female" ) );
m_oldSubTypeNames.insert( QStringLiteral("s"), i18nc( "@item:inlistbox A subtype of the grammatical word type: Noun", "Neutral" ) );
}
......@@ -80,7 +80,7 @@ KEduVocWordType* KEduVocKvtmlCompability::typeFromOldFormat(KEduVocWordType* par
// check if it's user defined
if ( typeSubtypeString.length() >= 2 && typeSubtypeString.left( 1 ) == QM_USER_TYPE ) {
// they started counting at 1, we need to know which index we are dealing with:
int selfDefinedTypeIndex = typeSubtypeString.right( typeSubtypeString.count()-1 ).toInt() -1;
int selfDefinedTypeIndex = typeSubtypeString.rightRef( typeSubtypeString.count()-1 ).toInt() -1;
return static_cast<KEduVocWordType*>(parent->childContainer(selfDefinedTypeIndex));
}
......@@ -98,11 +98,11 @@ KEduVocWordType* KEduVocKvtmlCompability::typeFromOldFormat(KEduVocWordType* par
// convert from pre-0.5 versions (I guess we can just leave that in here.
// I seriously doubt that any such documents exist...
if ( mainType == "1" ) {
if ( mainType == QLatin1String("1") ) {
mainType = QM_VERB;
} else if ( mainType == "2" ) {
} else if ( mainType == QLatin1String("2") ) {
mainType = QM_NOUN;
} else if ( mainType == "3" ) {
} else if ( mainType == QLatin1String("3") ) {
mainType = QM_NAME;
}
......@@ -175,13 +175,13 @@ if ( oldType.length() >= 2 && type.left( 1 ) == QM_USER_TYPE ) {
void KEduVocKvtmlCompability::initOldTenses()
{
m_oldTenses["PrSi"] = i18n( "Simple Present" );
m_oldTenses["PrPr"] = i18n( "Present Progressive" );
m_oldTenses["PrPe"] = i18n( "Present Perfect" );
m_oldTenses["PaSi"] = i18n( "Simple Past" );
m_oldTenses["PaPr"] = i18n( "Past Progressive" );
m_oldTenses["PaPa"] = i18n( "Past Participle" );
m_oldTenses["FuSi"] = i18n( "Future" );
m_oldTenses[QStringLiteral("PrSi")] = i18n( "Simple Present" );
m_oldTenses[QStringLiteral("PrPr")] = i18n( "Present Progressive" );
m_oldTenses[QStringLiteral("PrPe")] = i18n( "Present Perfect" );
m_oldTenses[QStringLiteral("PaSi")] = i18n( "Simple Past" );
m_oldTenses[QStringLiteral("PaPr")] = i18n( "Past Progressive" );
m_oldTenses[QStringLiteral("PaPa")] = i18n( "Past Participle" );
m_oldTenses[QStringLiteral("FuSi")] = i18n( "Future" );
}
......
......@@ -42,7 +42,7 @@ public:
@param msg the message to return
@return string of the file that will generate the error */
static QString makeDummyString(KEduVocDocument::ErrorCode error
, const QString & msg = "Dummy Reader Error")
, const QString & msg = QStringLiteral("Dummy Reader Error"))
//Note: This should be defined in the cpp file, but I was having linker problems
{
QString out;
......@@ -93,7 +93,7 @@ private :
static QString mTag()
//Note: This should be defined in the cpp file, but I was having linker problems
{
return QString( "kvocdocdummyreadertestelement" );
return QStringLiteral( "kvocdocdummyreadertestelement" );
}
/**
......
......@@ -38,7 +38,7 @@ KEduVocCsvReader::KEduVocCsvReader( QIODevice & file )
// the file must be already open
m_inputFile = &file;
m_errorMessage = "";
m_errorMessage = QLatin1String("");
}
KEduVocDocument::FileType KEduVocCsvReader::fileTypeHandled()
......
......@@ -47,7 +47,7 @@ bool KEduVocKvtml2Reader::isParsable()
QString line2( ts.readLine() );
m_inputFile->seek( 0 );
return ( ( line1.startsWith(QString::fromLatin1("<?xml")) )
return ( ( line1.startsWith(QLatin1String("<?xml")) )
&& ( line2.indexOf( KVTML_TAG, 0 ) > 0 ) );
}
......@@ -60,7 +60,7 @@ KEduVocDocument::ErrorCode KEduVocKvtml2Reader::read(KEduVocDocument &doc)
{
m_doc = &doc;
QDomDocument domDoc( "KEduVocDocument" );
QDomDocument domDoc( QStringLiteral("KEduVocDocument") );
if ( !domDoc.setContent( m_inputFile, &m_errorMessage ) )
return KEduVocDocument::InvalidXml;
......
......@@ -36,7 +36,7 @@
KEduVocKvtmlReader::KEduVocKvtmlReader(QIODevice & file)
: m_inputFile( &file )
{
m_errorMessage = "";
m_errorMessage = QLatin1String("");
qDebug() << "KEduVocKvtmlReader for kvtml version 1 files started.";
}
......@@ -47,7 +47,7 @@ bool KEduVocKvtmlReader::isParsable()
QString line2( ts.readLine() );
m_inputFile->seek( 0 );
return ( ( line1.startsWith(QString::fromLatin1("<?xml")) )
return ( ( line1.startsWith(QLatin1String("<?xml")) )
&& ( line2.indexOf( KV_DOCTYPE, 0 ) > 0 ) );
}
......@@ -57,7 +57,7 @@ KEduVocDocument::ErrorCode KEduVocKvtmlReader::read(KEduVocDocument &doc)
m_cols = 0;
m_lines = 0;
QDomDocument domDoc( "KEduVocDocument" );
QDomDocument domDoc( QStringLiteral("KEduVocDocument") );
if ( !domDoc.setContent( m_inputFile, &m_errorMessage ) )
return KEduVocDocument::InvalidXml;
......@@ -288,53 +288,53 @@ bool KEduVocKvtmlReader::readArticle( QDomElement &domElementParent )
//---------
// Children
QString fem_def = "";
QString mal_def = "";
QString nat_def = "";
QString fem_indef = "";
QString mal_indef = "";
QString nat_indef = "";
QString fem_def = QLatin1String("");
QString mal_def = QLatin1String("");
QString nat_def = QLatin1String("");
QString fem_indef = QLatin1String("");
QString mal_indef = QLatin1String("");
QString nat_indef = QLatin1String("");
article = currentElement.firstChildElement( KV_ART_FD );
if ( !article.isNull() ) {
fem_def = article.text();
if ( fem_def.isNull() )
fem_def = "";
fem_def = QLatin1String("");
}
article = currentElement.firstChildElement( KV_ART_FI );
if ( !article.isNull() ) {
fem_indef = article.text();
if ( fem_indef.isNull() )
fem_indef = "";
fem_indef = QLatin1String("");
}
article = currentElement.firstChildElement( KV_ART_MD );
if ( !article.isNull() ) {
mal_def = article.text();
if ( mal_def.isNull() )
mal_def = "";
mal_def = QLatin1String("");
}
article = currentElement.firstChildElement( KV_ART_MI );
if ( !article.isNull() ) {
mal_indef = article.text();
if ( mal_indef.isNull() )
mal_indef = "";
mal_indef = QLatin1String("");
}
article = currentElement.firstChildElement( KV_ART_ND );
if ( !article.isNull() ) {
nat_def = article.text();
if ( nat_def.isNull() )
nat_def = "";
nat_def = QLatin1String("");
}
article = currentElement.firstChildElement( KV_ART_NI );
if ( !article.isNull() ) {
nat_indef = article.text();
if ( nat_indef.isNull() )
nat_indef = "";
nat_indef = QLatin1String("");
}
KEduVocArticle article;
......@@ -773,7 +773,7 @@ bool KEduVocKvtmlReader::readExpressionChildAttributes( QDomElement &domElementE
int pos;
QDomAttr attribute;
lang = "";
lang = QLatin1String("");
attribute = domElementExpressionChild.attributeNode( KV_LANG );
if ( !attribute.isNull() )
lang = attribute.value();
......@@ -789,8 +789,8 @@ bool KEduVocKvtmlReader::readExpressionChildAttributes( QDomElement &domElementE
if ( !attribute.isNull() ) {
QString s = attribute.value();
if (( pos = s.indexOf( ';' ) ) >= 1 ) {
grade = s.left( pos ).toInt();
rev_grade = s.mid( pos + 1, s.length() ).toInt();
grade = s.leftRef( pos ).toInt();
rev_grade = s.midRef( pos + 1, s.length() ).toInt();
} else
grade = s.toInt();
}
......@@ -801,8 +801,8 @@ bool KEduVocKvtmlReader::readExpressionChildAttributes( QDomElement &domElementE
if ( !attribute.isNull() ) {
QString s = attribute.value();
if (( pos = s.indexOf( ';' ) ) >= 1 ) {
count = s.left( pos ).toInt();
rev_count = s.mid( pos + 1, s.length() ).toInt();
count = s.leftRef( pos ).toInt();
rev_count = s.midRef( pos + 1, s.length() ).toInt();
} else
count = s.toInt();
}
......@@ -813,8 +813,8 @@ bool KEduVocKvtmlReader::readExpressionChildAttributes( QDomElement &domElementE
if ( !attribute.isNull() ) {
QString s = attribute.value();
if (( pos = s.indexOf( ';' ) ) >= 1 ) {
bcount = s.left( pos ).toInt();
rev_bcount = s.mid( pos + 1, s.length() ).toInt();
bcount = s.leftRef( pos ).toInt();
rev_bcount = s.midRef( pos + 1, s.length() ).toInt();
} else
bcount = s.toInt();
}
......@@ -825,8 +825,8 @@ bool KEduVocKvtmlReader::readExpressionChildAttributes( QDomElement &domElementE
if ( !attribute.isNull() ) {
QString s = attribute.value();
if (( pos = s.indexOf( ';' ) ) >= 1 ) {
date.setTime_t( s.left( pos ).toInt() );
rev_date.setTime_t( s.mid( pos + 1, s.length() ).toInt() );
date.setTime_t( s.leftRef( pos ).toInt() );
rev_date.setTime_t( s.midRef( pos + 1, s.length() ).toInt() );
} else
date.setTime_t( s.toInt() );
}
......@@ -836,37 +836,37 @@ bool KEduVocKvtmlReader::readExpressionChildAttributes( QDomElement &domElementE
//this format is deprecated and ignored.
}
remark = "";
remark = QLatin1String("");
attribute = domElementExpressionChild.attributeNode( KV_REMARK );
if ( !attribute.isNull() )
remark = attribute.value();
faux_ami_f = "";
faux_ami_f = QLatin1String("");
attribute = domElementExpressionChild.attributeNode( KV_FAUX_AMI_F );
if ( !attribute.isNull() )
faux_ami_f = attribute.value();
faux_ami_t = "";
faux_ami_t = QLatin1String("");
attribute = domElementExpressionChild.attributeNode( KV_FAUX_AMI_T );
if ( !attribute.isNull() )
faux_ami_t = attribute.value();
synonym = "";
synonym = QLatin1String("");
attribute = domElementExpressionChild.attributeNode( KV_SYNONYM );
if ( !attribute.isNull() )
synonym = attribute.value();
example = "";
example = QLatin1String("");
attribute = domElementExpressionChild.attributeNode( KV_EXAMPLE );
if ( !attribute.isNull() )
example = attribute.value();
paraphrase = "";
paraphrase = QLatin1String("");
attribute = domElementExpressionChild.attributeNode( KV_PARAPHRASE );
if ( !attribute.isNull() )
paraphrase = attribute.value();
antonym = "";
antonym = QLatin1String("");
attribute = domElementExpressionChild.attributeNode( KV_ANTONYM );
if ( !attribute.isNull() )
antonym = attribute.value();
......@@ -877,12 +877,12 @@ bool KEduVocKvtmlReader::readExpressionChildAttributes( QDomElement &domElementE
type = attribute.value();
}
pronunciation = "";
pronunciation = QLatin1String("");
attribute = domElementExpressionChild.attributeNode( KV_PRONUNCE );
if ( !attribute.isNull() )
pronunciation = attribute.value();