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 | 26 | ||||
-rw-r--r-- | noncore/apps/odict/dingwidget.h | 2 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 6 |
3 files changed, 12 insertions, 22 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 | |||
@@ -34,17 +34,8 @@ | |||
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 ) |
@@ -68,6 +59,7 @@ void DingWidget::loadDict( QString name ) | |||
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() |
@@ -109,21 +101,17 @@ 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 ); |
@@ -135,6 +123,12 @@ BroswerContent DingWidget::parseInfo() | |||
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>"; |
137 | 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>"; | ||
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; |
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 | |||
@@ -29,6 +29,7 @@ class DingWidget | |||
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(); |
@@ -40,7 +41,6 @@ class DingWidget | |||
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; |
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 | |||
@@ -57,6 +57,7 @@ ODict::ODict() : QMainWindow() | |||
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 ); |
@@ -110,19 +111,14 @@ void ODict::slotStartQuery() | |||
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 | ||