author | cniehaus <cniehaus> | 2003-05-02 09:16:28 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2003-05-02 09:16:28 (UTC) |
commit | e4d80a4839a97f2554e880a25ee32d0388371ef3 (patch) (unidiff) | |
tree | 281d697d5805aeb4a8ceff47b1cd634debe4c538 | |
parent | 49dfb55bd22f5027fcbcbc55648efd4bce6c8fd6 (diff) | |
download | opie-e4d80a4839a97f2554e880a25ee32d0388371ef3.zip opie-e4d80a4839a97f2554e880a25ee32d0388371ef3.tar.gz opie-e4d80a4839a97f2554e880a25ee32d0388371ef3.tar.bz2 |
linebreak works :)
-rw-r--r-- | noncore/apps/odict/dingwidget.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp index f012333..4be6e71 100644 --- a/noncore/apps/odict/dingwidget.cpp +++ b/noncore/apps/odict/dingwidget.cpp | |||
@@ -105,45 +105,44 @@ BroswerContent DingWidget::setText( QString word ) | |||
105 | } | 105 | } |
106 | 106 | ||
107 | 107 | ||
108 | BroswerContent DingWidget::parseInfo() | 108 | BroswerContent DingWidget::parseInfo() |
109 | { | 109 | { |
110 | if ( isCompleteWord ) | 110 | if ( isCompleteWord ) |
111 | queryword = " " + queryword + " "; | 111 | queryword = " " + queryword + " "; |
112 | QStringList search = lines.grep( queryword , isCaseSensitive ); | 112 | QStringList search = lines.grep( queryword , isCaseSensitive ); |
113 | 113 | ||
114 | QString current; | 114 | QString current; |
115 | QString left; | 115 | QString left; |
116 | QString right; | 116 | QString right; |
117 | QRegExp reg_div( trenner ); | 117 | QRegExp reg_div( trenner ); |
118 | QRegExp reg_word( queryword ); | 118 | QRegExp reg_word( queryword ); |
119 | reg_word.setCaseSensitive( isCaseSensitive ); | 119 | reg_word.setCaseSensitive( isCaseSensitive ); |
120 | QStringList toplist, bottomlist; | 120 | QStringList toplist, bottomlist; |
121 | //QString substitute = "<strong>"+queryword+"</strong>"; | 121 | QString substitute = "<strong>"+queryword+"</strong>"; |
122 | QString substitute = queryword; | ||
123 | 122 | ||
124 | for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) | 123 | for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) |
125 | { | 124 | { |
126 | current = *it; | 125 | current = *it; |
127 | left = current.left( current.find( trenner ) ); | 126 | left = current.left( current.find( trenner ) ); |
128 | 127 | ||
129 | right = current.right( current.length() - current.find(trenner) - trenner.length() ); | 128 | right = current.right( current.length() - current.find(trenner) - trenner.length() ); |
130 | 129 | ||
131 | if ( left.contains( queryword , isCaseSensitive ) ) | 130 | if ( left.contains( queryword , isCaseSensitive ) ) |
132 | { | 131 | { |
133 | left.replace( queryword, substitute ); | 132 | left.replace( queryword, substitute ); |
134 | left = left + " --> " + right; | 133 | left = left + " --> " + right; |
135 | toplist.append( left ); | 134 | toplist.append( left ); |
136 | } | 135 | } |
137 | else | 136 | else |
138 | { | 137 | { |
139 | right.replace( queryword, substitute ); | 138 | right.replace( queryword, substitute ); |
140 | right = right + " --> " + left; | 139 | right = right + " --> " + left; |
141 | bottomlist.append( right ); | 140 | bottomlist.append( right ); |
142 | } | 141 | } |
143 | } | 142 | } |
144 | 143 | ||
145 | s_strings.top = toplist.join( "\n" ); | 144 | s_strings.top = toplist.join( "<br>" ); |
146 | s_strings.bottom = bottomlist.join( "\n" ); | 145 | s_strings.bottom = bottomlist.join( "<br>" ); |
147 | 146 | ||
148 | return s_strings; | 147 | return s_strings; |
149 | } | 148 | } |