author | cniehaus <cniehaus> | 2003-01-11 18:28:09 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2003-01-11 18:28:09 (UTC) |
commit | e3fa5685865712ca930d9124b974506766e7b11e (patch) (unidiff) | |
tree | 377298838435ca45a23945660f687583788d4a97 | |
parent | fecbb2ca2714c1699a76036865e6e1120110ac1d (diff) | |
download | opie-e3fa5685865712ca930d9124b974506766e7b11e.zip opie-e3fa5685865712ca930d9124b974506766e7b11e.tar.gz opie-e3fa5685865712ca930d9124b974506766e7b11e.tar.bz2 |
check if the user want to serach casesensitive or not
-rw-r--r-- | noncore/apps/odict/dingwidget.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 12 |
2 files changed, 7 insertions, 10 deletions
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp index 7abad22..5b5d731 100644 --- a/noncore/apps/odict/dingwidget.cpp +++ b/noncore/apps/odict/dingwidget.cpp | |||
@@ -105,36 +105,37 @@ BroswerContent DingWidget::setText( QString word ) | |||
105 | return parseInfo(); | 105 | return parseInfo(); |
106 | } | 106 | } |
107 | 107 | ||
108 | void DingWidget::loadValues() | 108 | void DingWidget::loadValues() |
109 | { | 109 | { |
110 | Config cfg( "odict" ); | 110 | Config cfg( "odict" ); |
111 | cfg.setGroup( "Method_"+methodname ); | 111 | cfg.setGroup( "Method_"+methodname ); |
112 | //trenner = cfg.readEntry( "Seperator" ); | 112 | //trenner = cfg.readEntry( "Seperator" ); |
113 | } | 113 | } |
114 | 114 | ||
115 | BroswerContent DingWidget::parseInfo() | 115 | BroswerContent DingWidget::parseInfo() |
116 | { | 116 | { |
117 | QStringList search = lines.grep( queryword ); | 117 | QStringList search = lines.grep( queryword , isCaseSensitive ); |
118 | 118 | ||
119 | QString current; | 119 | QString current; |
120 | QString left; | 120 | QString left; |
121 | QString right; | 121 | QString right; |
122 | QString html_header = "<html><table>"; | 122 | QString html_header = "<html><table>"; |
123 | QString html_footer = "</table></html>"; | 123 | QString html_footer = "</table></html>"; |
124 | QString html_table_left = "<tr><td width='50'>"; | 124 | QString html_table_left = "<tr><td width='50'>"; |
125 | QString html_table_sep = "</td><td>"; | 125 | QString html_table_sep = "</td><td>"; |
126 | QString html_table_right = "</td></tr>"; | 126 | QString html_table_right = "</td></tr>"; |
127 | QRegExp reg_div( trenner ); | 127 | QRegExp reg_div( trenner ); |
128 | QRegExp reg_word( queryword ); | 128 | QRegExp reg_word( queryword ); |
129 | reg_word.setCaseSensitive( isCaseSensitive ); | ||
129 | QStringList toplist, bottomlist; | 130 | QStringList toplist, bottomlist; |
130 | QString substitute = "<strong>"+queryword+"</strong>"; | 131 | QString substitute = "<strong>"+queryword+"</strong>"; |
131 | 132 | ||
132 | /* Dieser Block ist von Patrik. Ich versuche einen neuen | 133 | /* Dieser Block ist von Patrik. Ich versuche einen neuen |
133 | * Ansatz. Zum einen ist HTML scheiße an dieser Stelle und | 134 | * Ansatz. Zum einen ist HTML scheiße an dieser Stelle und |
134 | * zum andern funktioniert der Code nicht so wie er sollte. | 135 | * zum andern funktioniert der Code nicht so wie er sollte. |
135 | QString substitute = "<a href=''>"+queryword+"</a>"; | 136 | QString substitute = "<a href=''>"+queryword+"</a>"; |
136 | 137 | ||
137 | for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) | 138 | for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) |
138 | { | 139 | { |
139 | current = *it; | 140 | current = *it; |
140 | left = current.left( current.find(reg_div) ); | 141 | left = current.left( current.find(reg_div) ); |
@@ -154,25 +155,25 @@ BroswerContent DingWidget::parseInfo() | |||
154 | //thats it, the lists are rendered. Lets put them in one string | 155 | //thats it, the lists are rendered. Lets put them in one string |
155 | s_strings.bottom = html_header + bottomlist.join( "<br>" ) + html_footer; | 156 | s_strings.bottom = html_header + bottomlist.join( "<br>" ) + html_footer; |
156 | s_strings.top = html_header + toplist.join( "<br>" ) + html_footer; | 157 | s_strings.top = html_header + toplist.join( "<br>" ) + html_footer; |
157 | */ | 158 | */ |
158 | 159 | ||
159 | for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) | 160 | for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) |
160 | { | 161 | { |
161 | current = *it; | 162 | current = *it; |
162 | left = current.left( current.find( trenner ) ); | 163 | left = current.left( current.find( trenner ) ); |
163 | 164 | ||
164 | right = current.right( current.length() - current.find(trenner) -2 ); | 165 | right = current.right( current.length() - current.find(trenner) -2 ); |
165 | 166 | ||
166 | if ( left.contains( queryword ) ) | 167 | if ( left.contains( queryword , isCaseSensitive ) ) |
167 | { | 168 | { |
168 | left.replace( queryword, substitute ); | 169 | left.replace( queryword, substitute ); |
169 | left = left + "-->" + right; | 170 | left = left + "-->" + right; |
170 | toplist.append( left ); | 171 | toplist.append( left ); |
171 | } | 172 | } |
172 | else | 173 | else |
173 | { | 174 | { |
174 | right.replace( queryword, substitute ); | 175 | right.replace( queryword, substitute ); |
175 | left = right + "-->" + left; | 176 | left = right + "-->" + left; |
176 | bottomlist.append( right ); | 177 | bottomlist.append( right ); |
177 | } | 178 | } |
178 | } | 179 | } |
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 549c40a..42604ee 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -85,65 +85,61 @@ void ODict::loadConfig() | |||
85 | void ODict::saveConfig() | 85 | void ODict::saveConfig() |
86 | { | 86 | { |
87 | Config cfg ( "odict" ); | 87 | Config cfg ( "odict" ); |
88 | cfg.setGroup( "generalsettings" ); | 88 | cfg.setGroup( "generalsettings" ); |
89 | cfg.writeEntry( "errtol" , errorTol ); | 89 | cfg.writeEntry( "errtol" , errorTol ); |
90 | cfg.writeEntry( "casesens" , casesens ); | 90 | cfg.writeEntry( "casesens" , casesens ); |
91 | cfg.writeEntry( "regexp" , regexp ); | 91 | cfg.writeEntry( "regexp" , regexp ); |
92 | cfg.writeEntry( "completewords" , completewords ); | 92 | cfg.writeEntry( "completewords" , completewords ); |
93 | } | 93 | } |
94 | 94 | ||
95 | void ODict::slotDisplayAbout() | 95 | void ODict::slotDisplayAbout() |
96 | { | 96 | { |
97 | QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030108" ) ); | 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 | } | 98 | } |
99 | 99 | ||
100 | void ODict::slotStartQuery() | 100 | void ODict::slotStartQuery() |
101 | { | 101 | { |
102 | QString querystring = query_le->text(); | 102 | QString querystring = query_le->text(); |
103 | //X qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1()); | 103 | //X qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1()); |
104 | //X if (querystring.isEmpty()){ | 104 | //X if (querystring.isEmpty()){ |
105 | //X qWarning("empty querystring"); | 105 | //X qWarning("empty querystring"); |
106 | //X return; | 106 | //X return; |
107 | //X } | 107 | //X } |
108 | //X if (!activated_name || activated_name.isEmpty()) | 108 | //X if (!activated_name || activated_name.isEmpty()) |
109 | //X QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") ); | 109 | //X QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") ); |
110 | //X else | 110 | //X else |
111 | //X { | 111 | //X { |
112 | |||
113 | if ( casesens ) qDebug( "casesens = TRUE" ); | ||
114 | else qDebug( "casesens = FALSE" ); | ||
112 | 115 | ||
113 | ding->setCaseSensitive( casesens ); | 116 | ding->setCaseSensitive( casesens ); |
114 | ding->setCompleteWord( completewords ); | 117 | ding->setCompleteWord( completewords ); |
115 | ding->setDict( activated_name ); | 118 | ding->setDict( activated_name ); |
116 | 119 | ||
117 | qDebug( " activated_name ist :" ); | ||
118 | qDebug( activated_name ); | ||
119 | |||
120 | qDebug( " loadedDict() ist :" ); | ||
121 | qDebug( ding->loadedDict() ); | ||
122 | if ( activated_name != ding->loadedDict() ) | 120 | if ( activated_name != ding->loadedDict() ) |
123 | { | 121 | { |
124 | qDebug( "ComboBox geändert" ); | 122 | qDebug( "ComboBox geändert" ); |
125 | ding->loadDict(activated_name); | 123 | ding->loadDict(activated_name); |
126 | } | 124 | } |
127 | else qDebug( "ComboBox war GLEICH" ); | 125 | else qDebug( "ComboBox war GLEICH" ); |
128 | 126 | ||
129 | BroswerContent test = ding->setText( querystring ); | 127 | BroswerContent test = ding->setText( querystring ); |
130 | 128 | ||
131 | browser_top->setText( test.top ); | 129 | browser_top->setText( test.top ); |
132 | browser_bottom->setText( test.bottom ); | 130 | browser_bottom->setText( test.bottom ); |
133 | 131 | ||
134 | qDebug( "Text sollte gesetzt sein..." ); | 132 | qDebug( "Text sollte gesetzt sein..." ); |
135 | |||
136 | //X } | 133 | //X } |
137 | |||
138 | } | 134 | } |
139 | 135 | ||
140 | 136 | ||
141 | void ODict::slotSetErrorcount( int count ) | 137 | void ODict::slotSetErrorcount( int count ) |
142 | { | 138 | { |
143 | errorTol = count; | 139 | errorTol = count; |
144 | } | 140 | } |
145 | 141 | ||
146 | void ODict::slotSettings() | 142 | void ODict::slotSettings() |
147 | { | 143 | { |
148 | ConfigDlg dlg( this, "Config" , true); | 144 | ConfigDlg dlg( this, "Config" , true); |
149 | if ( dlg.exec() == QDialog::Accepted ) | 145 | if ( dlg.exec() == QDialog::Accepted ) |