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 | |||
@@ -1,184 +1,185 @@ | |||
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(); | 39 | loadValues(); |
40 | 40 | ||
41 | //X qDebug( topbrowser ); | 41 | //X qDebug( topbrowser ); |
42 | //X qDebug( top ); | 42 | //X qDebug( top ); |
43 | //X | 43 | //X |
44 | //X topbrowser = "blahbalh"; | 44 | //X topbrowser = "blahbalh"; |
45 | //X | 45 | //X |
46 | //X qDebug( topbrowser ); | 46 | //X qDebug( topbrowser ); |
47 | //X qDebug( top ); | 47 | //X qDebug( top ); |
48 | } | 48 | } |
49 | 49 | ||
50 | void DingWidget::loadDict( QString name ) | 50 | void DingWidget::loadDict( QString name ) |
51 | { | 51 | { |
52 | qDebug( "MUSS ich wirklich aufgerufen werder? schreit loadDict" ); | 52 | qDebug( "MUSS ich wirklich aufgerufen werder? schreit loadDict" ); |
53 | qDebug( "Starte mit dem loadedDict(...)" ); | 53 | qDebug( "Starte mit dem loadedDict(...)" ); |
54 | dictName = name; | 54 | dictName = name; |
55 | qDebug( "bin in loadedDict() und lade das Dict:" ); | 55 | qDebug( "bin in loadedDict() und lade das Dict:" ); |
56 | qDebug( dictName ); | 56 | qDebug( dictName ); |
57 | QString opie_dir = getenv("OPIEDIR"); | 57 | QString opie_dir = getenv("OPIEDIR"); |
58 | QFile file( opie_dir+"/noncore/apps/odict/eng_ita.dic" ); | 58 | QFile file( opie_dir+"/noncore/apps/odict/eng_ita.dic" ); |
59 | //FIXME:this should of course be not hardcoded ;) | 59 | //FIXME:this should of course be not hardcoded ;) |
60 | 60 | ||
61 | if( file.open( IO_ReadOnly ) ) | 61 | if( file.open( IO_ReadOnly ) ) |
62 | { | 62 | { |
63 | QTextStream stream( &file ); | 63 | QTextStream stream( &file ); |
64 | while ( !stream.eof() ) | 64 | while ( !stream.eof() ) |
65 | { | 65 | { |
66 | lines.append( stream.readLine() ); | 66 | lines.append( stream.readLine() ); |
67 | } | 67 | } |
68 | file.close(); | 68 | file.close(); |
69 | } | 69 | } |
70 | qDebug( "loadedDict(...) ist beended" ); | 70 | qDebug( "loadedDict(...) ist beended" ); |
71 | } | 71 | } |
72 | 72 | ||
73 | QString DingWidget::loadedDict() | 73 | QString DingWidget::loadedDict() |
74 | { | 74 | { |
75 | qDebug( dictName ); | 75 | qDebug( dictName ); |
76 | qDebug( "^ ^ ^ ^ ^ ^ ^ war der dictName" ); | 76 | qDebug( "^ ^ ^ ^ ^ ^ ^ war der dictName" ); |
77 | return dictName; | 77 | return dictName; |
78 | } | 78 | } |
79 | 79 | ||
80 | void DingWidget::setCaseSensitive( bool caseS ) | 80 | void DingWidget::setCaseSensitive( bool caseS ) |
81 | { | 81 | { |
82 | isCaseSensitive = caseS; | 82 | isCaseSensitive = caseS; |
83 | } | 83 | } |
84 | 84 | ||
85 | void DingWidget::setDict( QString dict ) | 85 | void DingWidget::setDict( QString dict ) |
86 | { | 86 | { |
87 | methodname = dict; | 87 | methodname = dict; |
88 | } | 88 | } |
89 | 89 | ||
90 | void DingWidget::setCompleteWord( bool cword ) | 90 | void DingWidget::setCompleteWord( bool cword ) |
91 | { | 91 | { |
92 | isCompleteWord = cword; | 92 | isCompleteWord = cword; |
93 | } | 93 | } |
94 | 94 | ||
95 | void DingWidget::setQueryWord( QString qword ) | 95 | void DingWidget::setQueryWord( QString qword ) |
96 | { | 96 | { |
97 | queryword = qword; | 97 | queryword = qword; |
98 | } | 98 | } |
99 | 99 | ||
100 | BroswerContent DingWidget::setText( QString word ) | 100 | BroswerContent DingWidget::setText( QString word ) |
101 | { | 101 | { |
102 | queryword = word; | 102 | queryword = word; |
103 | qDebug( queryword ); | 103 | qDebug( queryword ); |
104 | qDebug( "^ ^ ^ ^ ^ ^ ^ war das gesuchte Word"); | 104 | qDebug( "^ ^ ^ ^ ^ ^ ^ war das gesuchte 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) ); |
141 | right = current.right( current.length() - current.find(reg_div) - 1 ); | 142 | right = current.right( current.length() - current.find(reg_div) - 1 ); |
142 | if ( left.contains( reg_word ) ) | 143 | if ( left.contains( reg_word ) ) |
143 | { | 144 | { |
144 | left.replace( queryword, substitute ); | 145 | left.replace( queryword, substitute ); |
145 | toplist.append( html_table_left + left + html_table_sep + right + html_table_right ); | 146 | toplist.append( html_table_left + left + html_table_sep + right + html_table_right ); |
146 | } | 147 | } |
147 | else | 148 | else |
148 | { | 149 | { |
149 | right.replace( reg_word, substitute ); | 150 | right.replace( reg_word, substitute ); |
150 | bottomlist.append( html_table_left + right + html_table_sep + left + html_table_right ); | 151 | bottomlist.append( html_table_left + right + html_table_sep + left + html_table_right ); |
151 | } | 152 | } |
152 | } | 153 | } |
153 | 154 | ||
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 | } |
179 | 180 | ||
180 | s_strings.bottom = bottomlist.join( "\n" ); | 181 | s_strings.bottom = bottomlist.join( "\n" ); |
181 | s_strings.top = toplist.join( "\n" ); | 182 | s_strings.top = toplist.join( "\n" ); |
182 | 183 | ||
183 | return s_strings; | 184 | return s_strings; |
184 | } | 185 | } |
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 | |||
@@ -1,223 +1,219 @@ | |||
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 "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 | 60 | ||
61 | loadConfig(); | 61 | loadConfig(); |
62 | setCentralWidget( vbox ); | 62 | setCentralWidget( vbox ); |
63 | } | 63 | } |
64 | 64 | ||
65 | void ODict::loadConfig() | 65 | void ODict::loadConfig() |
66 | { | 66 | { |
67 | Config cfg ( "odict" ); | 67 | Config cfg ( "odict" ); |
68 | cfg.setGroup( "generalsettings" ); | 68 | cfg.setGroup( "generalsettings" ); |
69 | errorTol = cfg.readEntry( "errtol" ).toInt(); | 69 | errorTol = cfg.readEntry( "errtol" ).toInt(); |
70 | casesens = cfg.readEntry( "casesens" ).toInt(); | 70 | casesens = cfg.readEntry( "casesens" ).toInt(); |
71 | regexp = cfg.readEntry( "regexp" ).toInt(); | 71 | regexp = cfg.readEntry( "regexp" ).toInt(); |
72 | completewords = cfg.readEntry( "completewords" ).toInt(); | 72 | completewords = cfg.readEntry( "completewords" ).toInt(); |
73 | 73 | ||
74 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); | 74 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); |
75 | query_co->clear(); | 75 | query_co->clear(); |
76 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) | 76 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) |
77 | { | 77 | { |
78 | cfg.setGroup( *it ); | 78 | cfg.setGroup( *it ); |
79 | query_co->insertItem( cfg.readEntry( "Name" ) ); | 79 | query_co->insertItem( cfg.readEntry( "Name" ) ); |
80 | } | 80 | } |
81 | slotMethodChanged(1 ); //FIXME: this line should not contain a integer | 81 | slotMethodChanged(1 ); //FIXME: this line should not contain a integer |
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
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 ) |
150 | { | 146 | { |
151 | dlg.writeEntries(); | 147 | dlg.writeEntries(); |
152 | loadConfig(); | 148 | loadConfig(); |
153 | } | 149 | } |
154 | else qDebug( "abgebrochen" ); | 150 | else qDebug( "abgebrochen" ); |
155 | } | 151 | } |
156 | 152 | ||
157 | void ODict::slotSetParameter( int count ) | 153 | void ODict::slotSetParameter( int count ) |
158 | { | 154 | { |
159 | if ( count == 0 ) | 155 | if ( count == 0 ) |
160 | { | 156 | { |
161 | if ( casesens ) | 157 | if ( casesens ) |
162 | casesens = false; | 158 | casesens = false; |
163 | else | 159 | else |
164 | casesens = true; | 160 | casesens = true; |
165 | } | 161 | } |
166 | 162 | ||
167 | if ( count == 1 ) | 163 | if ( count == 1 ) |
168 | { | 164 | { |
169 | if ( completewords ) | 165 | if ( completewords ) |
170 | completewords = false; | 166 | completewords = false; |
171 | else | 167 | else |
172 | completewords = true; | 168 | completewords = true; |
173 | } | 169 | } |
174 | if ( count == 2 ) | 170 | if ( count == 2 ) |
175 | { | 171 | { |
176 | if ( regexp ) | 172 | if ( regexp ) |
177 | regexp = false; | 173 | regexp = false; |
178 | else | 174 | else |
179 | regexp = true; | 175 | regexp = true; |
180 | } | 176 | } |
181 | else qWarning( "ERROR" ); | 177 | else qWarning( "ERROR" ); |
182 | } | 178 | } |
183 | 179 | ||
184 | void ODict::slotMethodChanged( int /*methodnumber*/ ) | 180 | void ODict::slotMethodChanged( int /*methodnumber*/ ) |
185 | { | 181 | { |
186 | activated_name = query_co->currentText(); | 182 | activated_name = query_co->currentText(); |
187 | } | 183 | } |
188 | 184 | ||
189 | void ODict::setupMenus() | 185 | void ODict::setupMenus() |
190 | { | 186 | { |
191 | menu = new QMenuBar( this ); | 187 | menu = new QMenuBar( this ); |
192 | 188 | ||
193 | settings = new QPopupMenu( menu ); | 189 | settings = new QPopupMenu( menu ); |
194 | setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); | 190 | setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); |
195 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 191 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
196 | setting_a->addTo( settings ); | 192 | setting_a->addTo( settings ); |
197 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); | 193 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); |
198 | 194 | ||
199 | parameter = new QPopupMenu( menu ); | 195 | parameter = new QPopupMenu( menu ); |
200 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); | 196 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); |
201 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); | 197 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); |
202 | parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ; | 198 | parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ; |
203 | parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); | 199 | parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); |
204 | parameter->insertSeparator(); | 200 | parameter->insertSeparator(); |
205 | error_tol_menu = new QPopupMenu( menu ); | 201 | error_tol_menu = new QPopupMenu( menu ); |
206 | error_tol_menu->setCheckable( TRUE ); | 202 | error_tol_menu->setCheckable( TRUE ); |
207 | connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) ); | 203 | connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) ); |
208 | 204 | ||
209 | error_tol_menu->insertItem( tr( "0 Errors" ), 0 ); | 205 | error_tol_menu->insertItem( tr( "0 Errors" ), 0 ); |
210 | error_tol_menu->insertItem( tr( "1 Errors" ), 1 ); | 206 | error_tol_menu->insertItem( tr( "1 Errors" ), 1 ); |
211 | error_tol_menu->insertItem( tr( "2 Errors" ), 2 ); | 207 | error_tol_menu->insertItem( tr( "2 Errors" ), 2 ); |
212 | error_tol_menu->insertItem( tr( "3 Errors" ), 3 ); | 208 | error_tol_menu->insertItem( tr( "3 Errors" ), 3 ); |
213 | error_tol_menu->insertItem( tr( "4 Errors" ), 4 ); | 209 | error_tol_menu->insertItem( tr( "4 Errors" ), 4 ); |
214 | error_tol_menu->insertItem( tr( "Until Hit" ), 5 ); | 210 | error_tol_menu->insertItem( tr( "Until Hit" ), 5 ); |
215 | parameter->insertItem( tr( "&Error tolerance" ), error_tol_menu ); | 211 | parameter->insertItem( tr( "&Error tolerance" ), error_tol_menu ); |
216 | 212 | ||
217 | help = new QPopupMenu( menu ); | 213 | help = new QPopupMenu( menu ); |
218 | help->insertItem("&About",this,SLOT( slotDisplayAbout() )); | 214 | help->insertItem("&About",this,SLOT( slotDisplayAbout() )); |
219 | 215 | ||
220 | menu->insertItem( tr( "Settings" ) , settings ); | 216 | menu->insertItem( tr( "Settings" ) , settings ); |
221 | menu->insertItem( tr( "Parameter" ) , parameter ); | 217 | menu->insertItem( tr( "Parameter" ) , parameter ); |
222 | menu->insertItem( tr( "Help" ) , help ); | 218 | menu->insertItem( tr( "Help" ) , help ); |
223 | } | 219 | } |