as late as possible*/
class Translation {
public:
+ Translation () { _bookmark = 0; }
//! \return word to be translated
virtual QString key() const = 0;
//! \return parsed raw format into html
virtual QString toHtml() const = 0;
+ //! \retrun whether given translation is taken from bookmarks
+ bool isBookmark() const {
+ return _bookmark;
+ }
+
+ //! \param b if true then translation is from bookmarks
+ void setBookmark(bool b) {
+ _bookmark = b;
+ }
+
+ protected:
+ bool _bookmark;
+
};
Q_DECLARE_METATYPE(Translation*);
stopped = false;
if(word.indexOf("*")==-1 && word.indexOf("?")== 0)
word+="%";
+ word = word.toLower();
word = word.replace("*", "%");
word = word.replace("?", "_");
word = removeAccents(word);
cur.addBindValue(limit);
cur.exec();
while(cur.next())
- translations.insert(new TranslationXdxf(cur.value(0).toString(),
- _infoNote, this));
+ translations.insert(new TranslationXdxf(
+ cur.value(0).toString().toLower(),
+ _infoNote, this));
return translations.toList();
}
QSet<Translation*> translations;
QFile dictionaryFile(path);
+ word = word.toLower();
word = removeAccents(word);
stopped = false;
ok=false; /*if key word is in the dictionary more that one */
}
if(ok) /*add key word to list*/
- translations<<(new TranslationXdxf(a,_infoNote,this));
+ translations<<(new TranslationXdxf(a.toLower(),
+ _infoNote,this));
i++;
if(i>=limit && limit!=0)
break;
QString result;
QString cacheFilePath = _settings->value("cache_path");
db.setDatabaseName(cacheFilePath);
+ key = key.toLower();
if(!db.open()) {
qDebug() << "Database error" << db.lastError().text() << endl;
QString XdxfPlugin::searchFile(QString key) {
+ key = key.toLower();
QFile dictionaryFile(path);
QString resultString("");
if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {