Diffstat (limited to 'noncore/apps/odict/dingwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/odict/dingwidget.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp index c54cf56..ac7c321 100644 --- a/noncore/apps/odict/dingwidget.cpp +++ b/noncore/apps/odict/dingwidget.cpp | |||
@@ -8,55 +8,57 @@ | |||
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | #include "dingwidget.h" | 17 | #include "dingwidget.h" |
18 | 18 | ||
19 | #include <qfile.h> | 19 | #include <qfile.h> |
20 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
21 | #include <qhbox.h> | 21 | #include <qhbox.h> |
22 | #include <qlabel.h> | 22 | #include <qlabel.h> |
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | #include <qlineedit.h> | 24 | #include <qlineedit.h> |
25 | #include <qmainwindow.h> | 25 | #include <qmainwindow.h> |
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qtextstream.h> | 27 | #include <qtextstream.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | #include <qtextbrowser.h> | 30 | #include <qtextbrowser.h> |
31 | 31 | ||
32 | DingWidget::DingWidget(QWidget *parent, QString word, QTextBrowser *browser) : QWidget(parent) | 32 | DingWidget::DingWidget(QWidget *parent, QString word, QTextBrowser *browser_top, QTextBrowser *browser_bottom) : QWidget(parent) |
33 | { | 33 | { |
34 | QFile file( "/home/carsten/opie/opie/noncore/apps/odict/eng_ita.dic" ); | 34 | QFile file( "/home/carsten/opie/opie/noncore/apps/odict/eng_ita.dic" ); |
35 | QStringList lines; | 35 | QStringList lines; |
36 | 36 | ||
37 | if( file.open( IO_ReadOnly ) ) | 37 | if( file.open( IO_ReadOnly ) ) |
38 | { | 38 | { |
39 | QTextStream stream( &file ); | 39 | QTextStream stream( &file ); |
40 | while ( !stream.eof() ) | 40 | while ( !stream.eof() ) |
41 | { | 41 | { |
42 | lines.append( stream.readLine() ); | 42 | lines.append( stream.readLine() ); |
43 | } | 43 | } |
44 | file.close(); | 44 | file.close(); |
45 | } | 45 | } |
46 | 46 | ||
47 | lines = lines.grep( word ); | 47 | lines = lines.grep( word ); |
48 | 48 | ||
49 | //X for( QStringList::Iterator it = lines.begin() ; it != lines.end() ; ++it ) | 49 | //X for( QStringList::Iterator it = lines.begin() ; it != lines.end() ; ++it ) |
50 | //X { | 50 | //X { |
51 | //X qDebug( *it ); | 51 | //X qDebug( *it ); |
52 | //X } | 52 | //X } |
53 | browser->setText( parseInfo( lines ) ); | 53 | QString top, bottom; |
54 | |||
55 | parseInfo( lines, top , bottom ); | ||
56 | browser_top->setText( top ); | ||
57 | browser_bottom->setText( bottom ); | ||
54 | } | 58 | } |
55 | 59 | ||
56 | QString DingWidget::parseInfo( QStringList &lines ) | 60 | void DingWidget::parseInfo( QStringList &lines, QString &top, QString &bottom ) |
57 | { | 61 | { |
58 | QString parsed = 0; | 62 | top = "blah"; |
59 | QStringList temp = lines; | 63 | bottom = lines.join( "\n" ); |
60 | parsed = temp.first(); | ||
61 | return parsed; | ||
62 | } | 64 | } |