From: Jakub Jaszczynski Date: Wed, 18 Aug 2010 09:34:12 +0000 (+0200) Subject: read color atribute in xdxfPlugin X-Git-Tag: 0.4~20^2~13 X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=c349006df02ffb4a4ddf9c4dfac4c69a4bf5bff9;p=mdictionary read color atribute in xdxfPlugin --- diff --git a/trunk/src/plugins/xdxf/src/xdxfplugin.cpp b/trunk/src/plugins/xdxf/src/xdxfplugin.cpp index ad8887c..53fc66d 100644 --- a/trunk/src/plugins/xdxf/src/xdxfplugin.cpp +++ b/trunk/src/plugins/xdxf/src/xdxfplugin.cpp @@ -128,7 +128,7 @@ QList XdxfPlugin::searchWordListFile(QString word, int limit) { int i=0; while(!dictionaryReader.atEnd() && !stopped){ dictionaryReader.readNextStartElement(); - if(dictionaryReader.name()=="ar"){ + if(dictionaryReader.name()=="ar") { while(dictionaryReader.name()!="k" && !dictionaryReader.atEnd()) dictionaryReader.readNextStartElement(); if(!dictionaryReader.atEnd()) @@ -210,48 +210,24 @@ QString XdxfPlugin::searchFile(QString key) { match = true; } } - else if(dictionaryReader.tokenType() == QXmlStreamReader::Characters) { - if(match) { - /* QString temp(dictionaryReader.text().toString()); - if(temp=="\n") - temp=dictionaryReader.readElementText(); - temp.replace("\n",""); - if(temp == ""){ - int i=0; - while(dictionaryReader.name()!="ar"&& - !dictionaryReader.atEnd()){ - dictionaryReader.readNext(); - if(dictionaryReader.name()!="" && - dictionaryReader.name()!="ar") { - if(dictionaryReader.tokenType()==QXmlStreamReader::EndElement) - temp+=tr(""); - i++; - } - temp+=dictionaryReader.text().toString(); - } - } - resultString+=temp.replace("\n","")+"\n"; - match=false; -*/ - QString temp(""); - while(dictionaryReader.name()!="ar" && !dictionaryReader.atEnd()) { - if(dictionaryReader.name()!="") { - if(dictionaryReader.tokenType()==QXmlStreamReader::EndElement) - temp+=tr(""); - } - temp+= dictionaryReader.text().toString(); - dictionaryReader.readNext(); + if(match) { + QString temp(""); + while(dictionaryReader.name()!="ar" && !dictionaryReader.atEnd()) { + if(dictionaryReader.name()!="" && dictionaryReader.name()!="k") { + if(dictionaryReader.tokenType()==QXmlStreamReader::EndElement) + temp+=tr(""); } - resultString+=tr("") + temp.replace("\n","") + tr(""); - match=false; + temp+= dictionaryReader.text().toString(); + dictionaryReader.readNext(); } + resultString+=tr("") + temp.replace("\n","") + tr(""); + match=false; } this->thread()->yieldCurrentThread(); } diff --git a/trunk/src/plugins/xdxf/tests/dict.xdxf b/trunk/src/plugins/xdxf/tests/dict.xdxf index d1b7d73..acd02f0 100644 --- a/trunk/src/plugins/xdxf/tests/dict.xdxf +++ b/trunk/src/plugins/xdxf/tests/dict.xdxf @@ -19,6 +19,5 @@ sto tysišc house dom -test -krowatest01 +testkrotest01krowa diff --git a/trunk/src/plugins/xdxf/tests/test.cpp b/trunk/src/plugins/xdxf/tests/test.cpp index 77b7d9d..45020ee 100644 --- a/trunk/src/plugins/xdxf/tests/test.cpp +++ b/trunk/src/plugins/xdxf/tests/test.cpp @@ -46,7 +46,7 @@ void XdxfTest::search() { QCOMPARE(xdxfPlugin->search("."), QString("kropka")); QCOMPARE(xdxfPlugin->search("1"), QString("one")); - QCOMPARE(xdxfPlugin->search("test"), QString("krowatest01")); + QCOMPARE(xdxfPlugin->search("test"), QString("krotest01krowa")); } void XdxfTest::searchWordList() {