Diffstat (limited to 'noncore/apps/odict/dingwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/odict/dingwidget.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp index 0707bfb..ed67abf 100644 --- a/noncore/apps/odict/dingwidget.cpp +++ b/noncore/apps/odict/dingwidget.cpp @@ -9,64 +9,63 @@ /*************************************************************************** * * * 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 <qhbox.h> -#include <qlabel.h> -#include <qpushbutton.h> -#include <qlineedit.h> -#include <qmainwindow.h> #include <qstring.h> #include <qtextstream.h> #include <qstringlist.h> #include <qregexp.h> -#include <qtextbrowser.h> -//#include <stdlib.h> // for getenv DingWidget::DingWidget( ) { methodname = QString::null; trenner = QString::null; lines = 0L; } void DingWidget::loadDict( QString name ) { + qDebug( "bin in DingWidget::loadDict(). name ist:" ); + qDebug( name ); + dictName = name; Config cfg( "odict" ); - if ( !methodname ) return; + if ( !methodname ) { return; } cfg.setGroup( "Method_" + methodname ); QFile file( cfg.readEntry( "file" ) ); + + qDebug( cfg.readEntry( "file" ) ); if( file.open( IO_ReadOnly ) ) { QTextStream stream( &file ); while ( !stream.eof() ) { lines.append( stream.readLine() ); } file.close(); } loadValues(); + } -QString DingWidget::loadedDict() +QString DingWidget::loadedDict() const { return dictName; } void DingWidget::setCaseSensitive( bool caseS ) { isCaseSensitive = caseS; } void DingWidget::setDict( QString dict ) { methodname = dict; @@ -93,24 +92,26 @@ void DingWidget::loadValues() lang2_name = cfg.readEntry( "Lang2" ); } BroswerContent DingWidget::setText( QString word ) { queryword = word; return parseInfo(); } BroswerContent DingWidget::parseInfo() { + qDebug( "bin in DingWidget::parseInfo()" ); + if ( isCompleteWord ) queryword = " " + queryword + " "; 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>"; |