summaryrefslogtreecommitdiff
authorcniehaus <cniehaus>2003-04-30 20:42:51 (UTC)
committer cniehaus <cniehaus>2003-04-30 20:42:51 (UTC)
commit30c685f9da06d19c993e9bdb74f349dabbde063e (patch) (unidiff)
treea6b0a6e220a6d523dd57b45feb755ce64bd84a8e
parent5aa8548fd812e4a9b942d6c858c68840fe58f871 (diff)
downloadopie-30c685f9da06d19c993e9bdb74f349dabbde063e.zip
opie-30c685f9da06d19c993e9bdb74f349dabbde063e.tar.gz
opie-30c685f9da06d19c993e9bdb74f349dabbde063e.tar.bz2
juhu, it is working again
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/dingwidget.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp
index 16164ed..f012333 100644
--- a/noncore/apps/odict/dingwidget.cpp
+++ b/noncore/apps/odict/dingwidget.cpp
@@ -73,76 +73,77 @@ void DingWidget::setCaseSensitive( bool caseS )
73 isCaseSensitive = caseS; 73 isCaseSensitive = caseS;
74} 74}
75 75
76void DingWidget::setDict( QString dict ) 76void DingWidget::setDict( QString dict )
77{ 77{
78 methodname = dict; 78 methodname = dict;
79} 79}
80 80
81void DingWidget::setCompleteWord( bool cword ) 81void DingWidget::setCompleteWord( bool cword )
82{ 82{
83 isCompleteWord = cword; 83 isCompleteWord = cword;
84} 84}
85 85
86void DingWidget::setQueryWord( QString qword ) 86void DingWidget::setQueryWord( QString qword )
87{ 87{
88 queryword = qword; 88 queryword = qword;
89} 89}
90 90
91 91
92void DingWidget::loadValues() 92void DingWidget::loadValues()
93{ 93{
94 Config cfg( "odict" ); 94 Config cfg( "odict" );
95 cfg.setGroup( "Method_" + methodname ); 95 cfg.setGroup( "Method_" + methodname );
96 trenner = cfg.readEntry( "Seperator" ); 96 trenner = cfg.readEntry( "Seperator" );
97} 97}
98 98
99BroswerContent DingWidget::setText( QString word ) 99BroswerContent DingWidget::setText( QString word )
100{ 100{
101 queryword = word; 101 queryword = word;
102 qDebug( queryword ); 102 qDebug( queryword );
103 qDebug( "^ ^ ^ ^ ^ ^ ^ war das gesuchte Word"); 103 qDebug( "^ ^ ^ ^ ^ ^ ^ war das gesuchte Word");
104 return parseInfo(); 104 return parseInfo();
105} 105}
106 106
107 107
108BroswerContent DingWidget::parseInfo() 108BroswerContent 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;
122 123
123 for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) 124 for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it )
124 { 125 {
125 current = *it; 126 current = *it;
126 left = current.left( current.find( trenner ) ); 127 left = current.left( current.find( trenner ) );
127 128
128 right = current.right( current.length() - current.find(trenner) - trenner.length() ); 129 right = current.right( current.length() - current.find(trenner) - trenner.length() );
129 130
130 if ( left.contains( queryword , isCaseSensitive ) ) 131 if ( left.contains( queryword , isCaseSensitive ) )
131 { 132 {
132 left.replace( queryword, substitute ); 133 left.replace( queryword, substitute );
133 left = left + " -- " + right; 134 left = left + " --> " + right;
134 toplist.append( left ); 135 toplist.append( left );
135 } 136 }
136 else 137 else
137 { 138 {
138 right.replace( queryword, substitute ); 139 right.replace( queryword, substitute );
139 left = right + " -- " + left; 140 right = right + " --> " + left;
140 bottomlist.append( right ); 141 bottomlist.append( right );
141 } 142 }
142 } 143 }
143 144
144 s_strings.top = toplist.join( "\n" ); 145 s_strings.top = toplist.join( "\n" );
145 s_strings.bottom = bottomlist.join( "\n" ); 146 s_strings.bottom = bottomlist.join( "\n" );
146 147
147 return s_strings; 148 return s_strings;
148} 149}