author | cniehaus <cniehaus> | 2003-01-12 16:16:13 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2003-01-12 16:16:13 (UTC) |
commit | aa4f80fdc2d78bfe1c1d4cb8ec1d852115d00fc7 (patch) (unidiff) | |
tree | d102e440196aea471b3ed8d0357934a1a9f2e385 | |
parent | 6e7d82135cdab0190739d2ddf84cd2211d18d00b (diff) | |
download | opie-aa4f80fdc2d78bfe1c1d4cb8ec1d852115d00fc7.zip opie-aa4f80fdc2d78bfe1c1d4cb8ec1d852115d00fc7.tar.gz opie-aa4f80fdc2d78bfe1c1d4cb8ec1d852115d00fc7.tar.bz2 |
Make search for only complete words working. Removing qDebug-lines. Fix a
bug (the seperator has not been loaded).
-rw-r--r-- | noncore/apps/odict/dingwidget.cpp | 28 | ||||
-rw-r--r-- | noncore/apps/odict/dingwidget.h | 2 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 6 |
3 files changed, 13 insertions, 23 deletions
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp index 5b5d731..cfef84d 100644 --- a/noncore/apps/odict/dingwidget.cpp +++ b/noncore/apps/odict/dingwidget.cpp | |||
@@ -1,184 +1,178 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : ODict | 2 | application: : ODict |
3 | 3 | ||
4 | begin : December 2002 | 4 | begin : December 2002 |
5 | copyright : ( C ) 2002, 2003 by Carsten Niehaus | 5 | copyright : ( C ) 2002, 2003 by Carsten Niehaus |
6 | email : cniehaus@handhelds.org | 6 | email : cniehaus@handhelds.org |
7 | **************************************************************************/ | 7 | **************************************************************************/ |
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 | #include <stdlib.h> // for getenv | 31 | #include <stdlib.h> // for getenv |
32 | 32 | ||
33 | 33 | ||
34 | DingWidget::DingWidget( ) | 34 | DingWidget::DingWidget( ) |
35 | { | 35 | { |
36 | methodname = QString::null; | 36 | methodname = QString::null; |
37 | trenner = "::";//QString::null; | 37 | trenner = QString::null; |
38 | lines = 0L; | 38 | lines = 0L; |
39 | loadValues(); | ||
40 | |||
41 | //X qDebug( topbrowser ); | ||
42 | //X qDebug( top ); | ||
43 | //X | ||
44 | //X topbrowser = "blahbalh"; | ||
45 | //X | ||
46 | //X qDebug( topbrowser ); | ||
47 | //X qDebug( top ); | ||
48 | } | 39 | } |
49 | 40 | ||
50 | void DingWidget::loadDict( QString name ) | 41 | void DingWidget::loadDict( QString name ) |
51 | { | 42 | { |
52 | qDebug( "MUSS ich wirklich aufgerufen werder? schreit loadDict" ); | 43 | qDebug( "MUSS ich wirklich aufgerufen werder? schreit loadDict" ); |
53 | qDebug( "Starte mit dem loadedDict(...)" ); | 44 | qDebug( "Starte mit dem loadedDict(...)" ); |
54 | dictName = name; | 45 | dictName = name; |
55 | qDebug( "bin in loadedDict() und lade das Dict:" ); | 46 | qDebug( "bin in loadedDict() und lade das Dict:" ); |
56 | qDebug( dictName ); | 47 | qDebug( dictName ); |
57 | QString opie_dir = getenv("OPIEDIR"); | 48 | QString opie_dir = getenv("OPIEDIR"); |
58 | QFile file( opie_dir+"/noncore/apps/odict/eng_ita.dic" ); | 49 | QFile file( opie_dir+"/noncore/apps/odict/eng_ita.dic" ); |
59 | //FIXME:this should of course be not hardcoded ;) | 50 | //FIXME:this should of course be not hardcoded ;) |
60 | 51 | ||
61 | if( file.open( IO_ReadOnly ) ) | 52 | if( file.open( IO_ReadOnly ) ) |
62 | { | 53 | { |
63 | QTextStream stream( &file ); | 54 | QTextStream stream( &file ); |
64 | while ( !stream.eof() ) | 55 | while ( !stream.eof() ) |
65 | { | 56 | { |
66 | lines.append( stream.readLine() ); | 57 | lines.append( stream.readLine() ); |
67 | } | 58 | } |
68 | file.close(); | 59 | file.close(); |
69 | } | 60 | } |
70 | qDebug( "loadedDict(...) ist beended" ); | 61 | qDebug( "loadedDict(...) ist beended" ); |
62 | loadValues(); | ||
71 | } | 63 | } |
72 | 64 | ||
73 | QString DingWidget::loadedDict() | 65 | QString DingWidget::loadedDict() |
74 | { | 66 | { |
75 | qDebug( dictName ); | 67 | qDebug( dictName ); |
76 | qDebug( "^ ^ ^ ^ ^ ^ ^ war der dictName" ); | 68 | qDebug( "^ ^ ^ ^ ^ ^ ^ war der dictName" ); |
77 | return dictName; | 69 | return dictName; |
78 | } | 70 | } |
79 | 71 | ||
80 | void DingWidget::setCaseSensitive( bool caseS ) | 72 | void DingWidget::setCaseSensitive( bool caseS ) |
81 | { | 73 | { |
82 | isCaseSensitive = caseS; | 74 | isCaseSensitive = caseS; |
83 | } | 75 | } |
84 | 76 | ||
85 | void DingWidget::setDict( QString dict ) | 77 | void DingWidget::setDict( QString dict ) |
86 | { | 78 | { |
87 | methodname = dict; | 79 | methodname = dict; |
88 | } | 80 | } |
89 | 81 | ||
90 | void DingWidget::setCompleteWord( bool cword ) | 82 | void DingWidget::setCompleteWord( bool cword ) |
91 | { | 83 | { |
92 | isCompleteWord = cword; | 84 | isCompleteWord = cword; |
93 | } | 85 | } |
94 | 86 | ||
95 | void DingWidget::setQueryWord( QString qword ) | 87 | void DingWidget::setQueryWord( QString qword ) |
96 | { | 88 | { |
97 | queryword = qword; | 89 | queryword = qword; |
98 | } | 90 | } |
99 | 91 | ||
100 | BroswerContent DingWidget::setText( QString word ) | 92 | BroswerContent DingWidget::setText( QString word ) |
101 | { | 93 | { |
102 | queryword = word; | 94 | queryword = word; |
103 | qDebug( queryword ); | 95 | qDebug( queryword ); |
104 | qDebug( "^ ^ ^ ^ ^ ^ ^ war das gesuchte Word"); | 96 | qDebug( "^ ^ ^ ^ ^ ^ ^ war das gesuchte Word"); |
105 | return parseInfo(); | 97 | return parseInfo(); |
106 | } | 98 | } |
107 | 99 | ||
108 | void DingWidget::loadValues() | 100 | void DingWidget::loadValues() |
109 | { | 101 | { |
110 | Config cfg( "odict" ); | 102 | Config cfg( "odict" ); |
111 | cfg.setGroup( "Method_"+methodname ); | 103 | cfg.setGroup( "Method_" + methodname ); |
112 | //trenner = cfg.readEntry( "Seperator" ); | 104 | trenner = cfg.readEntry( "Seperator" ); |
113 | } | 105 | } |
114 | 106 | ||
115 | BroswerContent DingWidget::parseInfo() | 107 | BroswerContent DingWidget::parseInfo() |
116 | { | 108 | { |
109 | if ( isCompleteWord ) queryword = " " + queryword + " "; | ||
117 | QStringList search = lines.grep( queryword , isCaseSensitive ); | 110 | QStringList search = lines.grep( queryword , isCaseSensitive ); |
118 | 111 | ||
119 | QString current; | 112 | QString current; |
120 | QString left; | 113 | QString left; |
121 | QString right; | 114 | QString right; |
122 | QString html_header = "<html><table>"; | ||
123 | QString html_footer = "</table></html>"; | ||
124 | QString html_table_left = "<tr><td width='50'>"; | ||
125 | QString html_table_sep = "</td><td>"; | ||
126 | QString html_table_right = "</td></tr>"; | ||
127 | QRegExp reg_div( trenner ); | 115 | QRegExp reg_div( trenner ); |
128 | QRegExp reg_word( queryword ); | 116 | QRegExp reg_word( queryword ); |
129 | reg_word.setCaseSensitive( isCaseSensitive ); | 117 | reg_word.setCaseSensitive( isCaseSensitive ); |
130 | QStringList toplist, bottomlist; | 118 | QStringList toplist, bottomlist; |
131 | QString substitute = "<strong>"+queryword+"</strong>"; | 119 | QString substitute = "<strong>"+queryword+"</strong>"; |
132 | 120 | ||
133 | /* Dieser Block ist von Patrik. Ich versuche einen neuen | 121 | /* Dieser Block ist von Patrik. Ich versuche einen neuen |
134 | * Ansatz. Zum einen ist HTML scheiße an dieser Stelle und | 122 | * Ansatz. Zum einen ist HTML scheiße an dieser Stelle und |
135 | * zum andern funktioniert der Code nicht so wie er sollte. | 123 | * zum andern funktioniert der Code nicht so wie er sollte. |
136 | QString substitute = "<a href=''>"+queryword+"</a>"; | 124 | QString substitute = "<a href=''>"+queryword+"</a>"; |
125 | |||
126 | QString html_header = "<html><table>"; | ||
127 | QString html_footer = "</table></html>"; | ||
128 | QString html_table_left = "<tr><td width='50'>"; | ||
129 | QString html_table_sep = "</td><td>"; | ||
130 | QString html_table_right = "</td></tr>"; | ||
137 | 131 | ||
138 | for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) | 132 | for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) |
139 | { | 133 | { |
140 | current = *it; | 134 | current = *it; |
141 | left = current.left( current.find(reg_div) ); | 135 | left = current.left( current.find(reg_div) ); |
142 | right = current.right( current.length() - current.find(reg_div) - 1 ); | 136 | right = current.right( current.length() - current.find(reg_div) - 1 ); |
143 | if ( left.contains( reg_word ) ) | 137 | if ( left.contains( reg_word ) ) |
144 | { | 138 | { |
145 | left.replace( queryword, substitute ); | 139 | left.replace( queryword, substitute ); |
146 | toplist.append( html_table_left + left + html_table_sep + right + html_table_right ); | 140 | toplist.append( html_table_left + left + html_table_sep + right + html_table_right ); |
147 | } | 141 | } |
148 | else | 142 | else |
149 | { | 143 | { |
150 | right.replace( reg_word, substitute ); | 144 | right.replace( reg_word, substitute ); |
151 | bottomlist.append( html_table_left + right + html_table_sep + left + html_table_right ); | 145 | bottomlist.append( html_table_left + right + html_table_sep + left + html_table_right ); |
152 | } | 146 | } |
153 | } | 147 | } |
154 | 148 | ||
155 | //thats it, the lists are rendered. Lets put them in one string | 149 | //thats it, the lists are rendered. Lets put them in one string |
156 | s_strings.bottom = html_header + bottomlist.join( "<br>" ) + html_footer; | 150 | s_strings.bottom = html_header + bottomlist.join( "<br>" ) + html_footer; |
157 | s_strings.top = html_header + toplist.join( "<br>" ) + html_footer; | 151 | s_strings.top = html_header + toplist.join( "<br>" ) + html_footer; |
158 | */ | 152 | */ |
159 | 153 | ||
160 | for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) | 154 | for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) |
161 | { | 155 | { |
162 | current = *it; | 156 | current = *it; |
163 | left = current.left( current.find( trenner ) ); | 157 | left = current.left( current.find( trenner ) ); |
164 | 158 | ||
165 | right = current.right( current.length() - current.find(trenner) -2 ); | 159 | right = current.right( current.length() - current.find(trenner) -2 ); |
166 | 160 | ||
167 | if ( left.contains( queryword , isCaseSensitive ) ) | 161 | if ( left.contains( queryword , isCaseSensitive ) ) |
168 | { | 162 | { |
169 | left.replace( queryword, substitute ); | 163 | left.replace( queryword, substitute ); |
170 | left = left + "-->" + right; | 164 | left = left + "-->" + right; |
171 | toplist.append( left ); | 165 | toplist.append( left ); |
172 | } | 166 | } |
173 | else | 167 | else |
174 | { | 168 | { |
175 | right.replace( queryword, substitute ); | 169 | right.replace( queryword, substitute ); |
176 | left = right + "-->" + left; | 170 | left = right + "-->" + left; |
177 | bottomlist.append( right ); | 171 | bottomlist.append( right ); |
178 | } | 172 | } |
179 | } | 173 | } |
180 | 174 | ||
181 | s_strings.bottom = bottomlist.join( "\n" ); | 175 | s_strings.bottom = bottomlist.join( "\n" ); |
182 | s_strings.top = toplist.join( "\n" ); | 176 | s_strings.top = toplist.join( "\n" ); |
183 | 177 | ||
184 | return s_strings; | 178 | return s_strings; |
diff --git a/noncore/apps/odict/dingwidget.h b/noncore/apps/odict/dingwidget.h index ba37009..74f40c9 100644 --- a/noncore/apps/odict/dingwidget.h +++ b/noncore/apps/odict/dingwidget.h | |||
@@ -1,47 +1,47 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 6 | * ( at your option ) any later version. * |
7 | * * | 7 | * * |
8 | **************************************************************************/ | 8 | **************************************************************************/ |
9 | 9 | ||
10 | #include <qstringlist.h> | 10 | #include <qstringlist.h> |
11 | #include <qstring.h> | 11 | #include <qstring.h> |
12 | 12 | ||
13 | struct BroswerContent | 13 | struct BroswerContent |
14 | { | 14 | { |
15 | QString top; | 15 | QString top; |
16 | QString bottom; | 16 | QString bottom; |
17 | }; | 17 | }; |
18 | 18 | ||
19 | class DingWidget | 19 | class DingWidget |
20 | { | 20 | { |
21 | public: | 21 | public: |
22 | DingWidget(); | 22 | DingWidget(); |
23 | 23 | ||
24 | BroswerContent setText( QString ); | 24 | BroswerContent setText( QString ); |
25 | QStringList lines; | 25 | QStringList lines; |
26 | void setCaseSensitive( bool ); | 26 | void setCaseSensitive( bool ); |
27 | void setCompleteWord( bool ); | 27 | void setCompleteWord( bool ); |
28 | void loadDict( QString ); | 28 | void loadDict( QString ); |
29 | QString loadedDict(); | 29 | QString loadedDict(); |
30 | void setQueryWord( QString ); | 30 | void setQueryWord( QString ); |
31 | void setDict( QString ); | 31 | void setDict( QString ); |
32 | void loadValues(); | ||
32 | 33 | ||
33 | private: | 34 | private: |
34 | BroswerContent parseInfo(); | 35 | BroswerContent parseInfo(); |
35 | 36 | ||
36 | BroswerContent s_strings; | 37 | BroswerContent s_strings; |
37 | bool isCompleteWord; | 38 | bool isCompleteWord; |
38 | bool isCaseSensitive; | 39 | bool isCaseSensitive; |
39 | 40 | ||
40 | QString dictName; | 41 | QString dictName; |
41 | 42 | ||
42 | QString search_word; | 43 | QString search_word; |
43 | void loadValues(); | ||
44 | QString queryword; | 44 | QString queryword; |
45 | QString methodname; | 45 | QString methodname; |
46 | QString trenner; | 46 | QString trenner; |
47 | }; | 47 | }; |
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 42604ee..78c3f90 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -12,162 +12,158 @@ | |||
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 "odict.h" | 17 | #include "odict.h" |
18 | #include "configdlg.h" | 18 | #include "configdlg.h" |
19 | #include "dingwidget.h" | 19 | #include "dingwidget.h" |
20 | 20 | ||
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qpopupmenu.h> | 22 | #include <qpopupmenu.h> |
23 | #include <qmenubar.h> | 23 | #include <qmenubar.h> |
24 | #include <qmessagebox.h> | 24 | #include <qmessagebox.h> |
25 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
26 | #include <qhbox.h> | 26 | #include <qhbox.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qmainwindow.h> | 31 | #include <qmainwindow.h> |
32 | #include <qstring.h> | 32 | #include <qstring.h> |
33 | #include <qaction.h> | 33 | #include <qaction.h> |
34 | #include <qtextbrowser.h> | 34 | #include <qtextbrowser.h> |
35 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
36 | 36 | ||
37 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
38 | 38 | ||
39 | 39 | ||
40 | ODict::ODict() : QMainWindow() | 40 | ODict::ODict() : QMainWindow() |
41 | { | 41 | { |
42 | activated_name = QString::null; | 42 | activated_name = QString::null; |
43 | 43 | ||
44 | vbox = new QVBox( this ); | 44 | vbox = new QVBox( this ); |
45 | setCaption( tr( "OPIE-Dictionary" ) ); | 45 | setCaption( tr( "OPIE-Dictionary" ) ); |
46 | setupMenus(); | 46 | setupMenus(); |
47 | 47 | ||
48 | 48 | ||
49 | QHBox *hbox = new QHBox( vbox ); | 49 | QHBox *hbox = new QHBox( vbox ); |
50 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); | 50 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); |
51 | query_le = new QLineEdit( hbox ); | 51 | query_le = new QLineEdit( hbox ); |
52 | query_co = new QComboBox( hbox ); | 52 | query_co = new QComboBox( hbox ); |
53 | connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) ); | 53 | connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) ); |
54 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); | 54 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); |
55 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); | 55 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); |
56 | browser_top = new QTextBrowser( vbox ); | 56 | browser_top = new QTextBrowser( vbox ); |
57 | browser_bottom = new QTextBrowser( vbox ); | 57 | browser_bottom = new QTextBrowser( vbox ); |
58 | 58 | ||
59 | ding = new DingWidget(); | 59 | ding = new DingWidget(); |
60 | ding->loadValues(); | ||
60 | 61 | ||
61 | loadConfig(); | 62 | loadConfig(); |
62 | setCentralWidget( vbox ); | 63 | setCentralWidget( vbox ); |
63 | } | 64 | } |
64 | 65 | ||
65 | void ODict::loadConfig() | 66 | void ODict::loadConfig() |
66 | { | 67 | { |
67 | Config cfg ( "odict" ); | 68 | Config cfg ( "odict" ); |
68 | cfg.setGroup( "generalsettings" ); | 69 | cfg.setGroup( "generalsettings" ); |
69 | errorTol = cfg.readEntry( "errtol" ).toInt(); | 70 | errorTol = cfg.readEntry( "errtol" ).toInt(); |
70 | casesens = cfg.readEntry( "casesens" ).toInt(); | 71 | casesens = cfg.readEntry( "casesens" ).toInt(); |
71 | regexp = cfg.readEntry( "regexp" ).toInt(); | 72 | regexp = cfg.readEntry( "regexp" ).toInt(); |
72 | completewords = cfg.readEntry( "completewords" ).toInt(); | 73 | completewords = cfg.readEntry( "completewords" ).toInt(); |
73 | 74 | ||
74 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); | 75 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); |
75 | query_co->clear(); | 76 | query_co->clear(); |
76 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) | 77 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) |
77 | { | 78 | { |
78 | cfg.setGroup( *it ); | 79 | cfg.setGroup( *it ); |
79 | query_co->insertItem( cfg.readEntry( "Name" ) ); | 80 | query_co->insertItem( cfg.readEntry( "Name" ) ); |
80 | } | 81 | } |
81 | slotMethodChanged(1 ); //FIXME: this line should not contain a integer | 82 | slotMethodChanged(1 ); //FIXME: this line should not contain a integer |
82 | } | 83 | } |
83 | 84 | ||
84 | 85 | ||
85 | void ODict::saveConfig() | 86 | void ODict::saveConfig() |
86 | { | 87 | { |
87 | Config cfg ( "odict" ); | 88 | Config cfg ( "odict" ); |
88 | cfg.setGroup( "generalsettings" ); | 89 | cfg.setGroup( "generalsettings" ); |
89 | cfg.writeEntry( "errtol" , errorTol ); | 90 | cfg.writeEntry( "errtol" , errorTol ); |
90 | cfg.writeEntry( "casesens" , casesens ); | 91 | cfg.writeEntry( "casesens" , casesens ); |
91 | cfg.writeEntry( "regexp" , regexp ); | 92 | cfg.writeEntry( "regexp" , regexp ); |
92 | cfg.writeEntry( "completewords" , completewords ); | 93 | cfg.writeEntry( "completewords" , completewords ); |
93 | } | 94 | } |
94 | 95 | ||
95 | void ODict::slotDisplayAbout() | 96 | void ODict::slotDisplayAbout() |
96 | { | 97 | { |
97 | QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030111" ) ); | 98 | QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030111" ) ); |
98 | } | 99 | } |
99 | 100 | ||
100 | void ODict::slotStartQuery() | 101 | void ODict::slotStartQuery() |
101 | { | 102 | { |
102 | QString querystring = query_le->text(); | 103 | QString querystring = query_le->text(); |
103 | //X qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1()); | 104 | //X qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1()); |
104 | //X if (querystring.isEmpty()){ | 105 | //X if (querystring.isEmpty()){ |
105 | //X qWarning("empty querystring"); | 106 | //X qWarning("empty querystring"); |
106 | //X return; | 107 | //X return; |
107 | //X } | 108 | //X } |
108 | //X if (!activated_name || activated_name.isEmpty()) | 109 | //X if (!activated_name || activated_name.isEmpty()) |
109 | //X QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") ); | 110 | //X QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") ); |
110 | //X else | 111 | //X else |
111 | //X { | 112 | //X { |
112 | 113 | ||
113 | if ( casesens ) qDebug( "casesens = TRUE" ); | ||
114 | else qDebug( "casesens = FALSE" ); | ||
115 | |||
116 | ding->setCaseSensitive( casesens ); | 114 | ding->setCaseSensitive( casesens ); |
117 | ding->setCompleteWord( completewords ); | 115 | ding->setCompleteWord( completewords ); |
118 | ding->setDict( activated_name ); | 116 | ding->setDict( activated_name ); |
119 | 117 | ||
120 | if ( activated_name != ding->loadedDict() ) | 118 | if ( activated_name != ding->loadedDict() ) |
121 | { | 119 | { |
122 | qDebug( "ComboBox geändert" ); | ||
123 | ding->loadDict(activated_name); | 120 | ding->loadDict(activated_name); |
124 | } | 121 | } |
125 | else qDebug( "ComboBox war GLEICH" ); | ||
126 | 122 | ||
127 | BroswerContent test = ding->setText( querystring ); | 123 | BroswerContent test = ding->setText( querystring ); |
128 | 124 | ||
129 | browser_top->setText( test.top ); | 125 | browser_top->setText( test.top ); |
130 | browser_bottom->setText( test.bottom ); | 126 | browser_bottom->setText( test.bottom ); |
131 | 127 | ||
132 | qDebug( "Text sollte gesetzt sein..." ); | 128 | qDebug( "Text sollte gesetzt sein..." ); |
133 | //X } | 129 | //X } |
134 | } | 130 | } |
135 | 131 | ||
136 | 132 | ||
137 | void ODict::slotSetErrorcount( int count ) | 133 | void ODict::slotSetErrorcount( int count ) |
138 | { | 134 | { |
139 | errorTol = count; | 135 | errorTol = count; |
140 | } | 136 | } |
141 | 137 | ||
142 | void ODict::slotSettings() | 138 | void ODict::slotSettings() |
143 | { | 139 | { |
144 | ConfigDlg dlg( this, "Config" , true); | 140 | ConfigDlg dlg( this, "Config" , true); |
145 | if ( dlg.exec() == QDialog::Accepted ) | 141 | if ( dlg.exec() == QDialog::Accepted ) |
146 | { | 142 | { |
147 | dlg.writeEntries(); | 143 | dlg.writeEntries(); |
148 | loadConfig(); | 144 | loadConfig(); |
149 | } | 145 | } |
150 | else qDebug( "abgebrochen" ); | 146 | else qDebug( "abgebrochen" ); |
151 | } | 147 | } |
152 | 148 | ||
153 | void ODict::slotSetParameter( int count ) | 149 | void ODict::slotSetParameter( int count ) |
154 | { | 150 | { |
155 | if ( count == 0 ) | 151 | if ( count == 0 ) |
156 | { | 152 | { |
157 | if ( casesens ) | 153 | if ( casesens ) |
158 | casesens = false; | 154 | casesens = false; |
159 | else | 155 | else |
160 | casesens = true; | 156 | casesens = true; |
161 | } | 157 | } |
162 | 158 | ||
163 | if ( count == 1 ) | 159 | if ( count == 1 ) |
164 | { | 160 | { |
165 | if ( completewords ) | 161 | if ( completewords ) |
166 | completewords = false; | 162 | completewords = false; |
167 | else | 163 | else |
168 | completewords = true; | 164 | completewords = true; |
169 | } | 165 | } |
170 | if ( count == 2 ) | 166 | if ( count == 2 ) |
171 | { | 167 | { |
172 | if ( regexp ) | 168 | if ( regexp ) |
173 | regexp = false; | 169 | regexp = false; |