author | gints <gints> | 2005-01-02 12:23:29 (UTC) |
---|---|---|
committer | gints <gints> | 2005-01-02 12:23:29 (UTC) |
commit | 4604bcd95999c9f66f500d385494ab7767cbf3a4 (patch) (side-by-side diff) | |
tree | 74264959c8e7cfa06a11f825a7d84579579d60bb | |
parent | f6063d2168022a6b6c8617d9da4a781d7895cbae (diff) | |
download | opie-4604bcd95999c9f66f500d385494ab7767cbf3a4.zip opie-4604bcd95999c9f66f500d385494ab7767cbf3a4.tar.gz opie-4604bcd95999c9f66f500d385494ab7767cbf3a4.tar.bz2 |
Changes to force odict use UTF8 encoding. Please report if it cause problems with older dictionary files.
-rw-r--r-- | noncore/apps/odict/dingwidget.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp index ef36ee5..3eb1e45 100644 --- a/noncore/apps/odict/dingwidget.cpp +++ b/noncore/apps/odict/dingwidget.cpp @@ -1,105 +1,106 @@ /*************************************************************************** application: : ODict begin : December 2002 copyright : ( C ) 2002, 2003 by Carsten Niehaus email : cniehaus@handhelds.org **************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ #include "dingwidget.h" #include <qfile.h> #include <qpe/config.h> #include <qtextstream.h> DingWidget::DingWidget( ) { methodname = QString::null; trenner = QString::null; lines = 0L; } void DingWidget::loadDict( QString name ) { lines.clear(); //as we will load a new list we have to //remove the old one Config cfg( "odict" ); cfg.setGroup( "Method_" + name ); QFile file( cfg.readEntry( "file" ) ); if( file.open( IO_ReadOnly ) ) { QTextStream stream( &file ); + stream.setEncoding(QTextStream::UnicodeUTF8); while ( !stream.eof() ) { lines.append( stream.readLine() ); } file.close(); } setDict( name ); loadValues(); } QString DingWidget::loadedDict() const { return dictName; } void DingWidget::setCaseSensitive( bool caseS ) { isCaseSensitive = caseS; } void DingWidget::setDict( QString dict ) { methodname = dict; } void DingWidget::setQueryWord( QString qword ) { queryword = qword; } void DingWidget::loadValues() { if ( !methodname ) return; Config cfg( "odict" ); cfg.setGroup( "Method_" + methodname ); trenner = cfg.readEntry( "Seperator" ); lang1_name = cfg.readEntry( "Lang1" ); lang2_name = cfg.readEntry( "Lang2" ); } BroswerContent DingWidget::setText( QString word ) { queryword = word; return parseInfo(); } BroswerContent DingWidget::parseInfo() { QStringList search = lines.grep( queryword , isCaseSensitive ); QString current; QString left; QString right; QRegExp reg_div( trenner ); QRegExp reg_word( queryword ); reg_word.setCaseSensitive( isCaseSensitive ); QStringList toplist, bottomlist; QString substitute = "<strong>"+queryword+"</strong>"; |