author | gints <gints> | 2005-01-02 12:23:29 (UTC) |
---|---|---|
committer | gints <gints> | 2005-01-02 12:23:29 (UTC) |
commit | 4604bcd95999c9f66f500d385494ab7767cbf3a4 (patch) (unidiff) | |
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 | |||
@@ -10,64 +10,65 @@ | |||
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 <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | 22 | ||
23 | DingWidget::DingWidget( ) | 23 | DingWidget::DingWidget( ) |
24 | { | 24 | { |
25 | methodname = QString::null; | 25 | methodname = QString::null; |
26 | trenner = QString::null; | 26 | trenner = QString::null; |
27 | lines = 0L; | 27 | lines = 0L; |
28 | } | 28 | } |
29 | 29 | ||
30 | void DingWidget::loadDict( QString name ) | 30 | void DingWidget::loadDict( QString name ) |
31 | { | 31 | { |
32 | lines.clear(); //as we will load a new list we have to | 32 | lines.clear(); //as we will load a new list we have to |
33 | //remove the old one | 33 | //remove the old one |
34 | 34 | ||
35 | Config cfg( "odict" ); | 35 | Config cfg( "odict" ); |
36 | cfg.setGroup( "Method_" + name ); | 36 | cfg.setGroup( "Method_" + name ); |
37 | QFile file( cfg.readEntry( "file" ) ); | 37 | QFile file( cfg.readEntry( "file" ) ); |
38 | 38 | ||
39 | if( file.open( IO_ReadOnly ) ) | 39 | if( file.open( IO_ReadOnly ) ) |
40 | { | 40 | { |
41 | QTextStream stream( &file ); | 41 | QTextStream stream( &file ); |
42 | stream.setEncoding(QTextStream::UnicodeUTF8); | ||
42 | while ( !stream.eof() ) | 43 | while ( !stream.eof() ) |
43 | { | 44 | { |
44 | lines.append( stream.readLine() ); | 45 | lines.append( stream.readLine() ); |
45 | } | 46 | } |
46 | file.close(); | 47 | file.close(); |
47 | } | 48 | } |
48 | 49 | ||
49 | setDict( name ); | 50 | setDict( name ); |
50 | 51 | ||
51 | loadValues(); | 52 | loadValues(); |
52 | } | 53 | } |
53 | 54 | ||
54 | QString DingWidget::loadedDict() const | 55 | QString DingWidget::loadedDict() const |
55 | { | 56 | { |
56 | return dictName; | 57 | return dictName; |
57 | } | 58 | } |
58 | 59 | ||
59 | void DingWidget::setCaseSensitive( bool caseS ) | 60 | void DingWidget::setCaseSensitive( bool caseS ) |
60 | { | 61 | { |
61 | isCaseSensitive = caseS; | 62 | isCaseSensitive = caseS; |
62 | } | 63 | } |
63 | 64 | ||
64 | void DingWidget::setDict( QString dict ) | 65 | void DingWidget::setDict( QString dict ) |
65 | { | 66 | { |
66 | methodname = dict; | 67 | methodname = dict; |
67 | } | 68 | } |
68 | 69 | ||
69 | void DingWidget::setQueryWord( QString qword ) | 70 | void DingWidget::setQueryWord( QString qword ) |
70 | { | 71 | { |
71 | queryword = qword; | 72 | queryword = qword; |
72 | } | 73 | } |
73 | 74 | ||