Diffstat (limited to 'noncore/apps/odict/odict.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/odict/odict.cpp | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 2028701..010545e 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -32,25 +32,25 @@ | |||
32 | #include <qaction.h> | 32 | #include <qaction.h> |
33 | #include <qtextbrowser.h> | 33 | #include <qtextbrowser.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | 35 | ||
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
38 | 38 | ||
39 | ODict::ODict() : QMainWindow() | 39 | ODict::ODict() : QMainWindow() |
40 | { | 40 | { |
41 | activated_name = QString::null; | 41 | activated_name = QString::null; |
42 | 42 | ||
43 | vbox = new QVBox( this ); | 43 | vbox = new QVBox( this ); |
44 | setCaption( tr( "OPIE-Dictionary" ) ); | 44 | setCaption( tr( "Opie-Dictionary" ) ); |
45 | setupMenus(); | 45 | setupMenus(); |
46 | 46 | ||
47 | QHBox *hbox = new QHBox( vbox ); | 47 | QHBox *hbox = new QHBox( vbox ); |
48 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); | 48 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); |
49 | query_label->show(); | 49 | query_label->show(); |
50 | query_le = new QLineEdit( hbox ); | 50 | query_le = new QLineEdit( hbox ); |
51 | query_co = new QComboBox( hbox ); | 51 | query_co = new QComboBox( hbox ); |
52 | connect( query_co , SIGNAL( activated(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) ); | 52 | connect( query_co , SIGNAL( activated(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) ); |
53 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); | 53 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); |
54 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); | 54 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); |
55 | 55 | ||
56 | top_name = new QLabel( vbox ); | 56 | top_name = new QLabel( vbox ); |
@@ -67,25 +67,24 @@ ODict::ODict() : QMainWindow() | |||
67 | } | 67 | } |
68 | 68 | ||
69 | void ODict::loadConfig() | 69 | void ODict::loadConfig() |
70 | { | 70 | { |
71 | /* | 71 | /* |
72 | * the name of the last used dictionary | 72 | * the name of the last used dictionary |
73 | */ | 73 | */ |
74 | QString lastname; | 74 | QString lastname; |
75 | 75 | ||
76 | Config cfg ( "odict" ); | 76 | Config cfg ( "odict" ); |
77 | cfg.setGroup( "generalsettings" ); | 77 | cfg.setGroup( "generalsettings" ); |
78 | casesens = cfg.readEntry( "casesens" ).toInt(); | 78 | casesens = cfg.readEntry( "casesens" ).toInt(); |
79 | regexp = cfg.readEntry( "regexp" ).toInt(); | ||
80 | 79 | ||
81 | QString lastDict = cfg.readEntry( "lastdict" ); | 80 | QString lastDict = cfg.readEntry( "lastdict" ); |
82 | int i = 0, e = 0; | 81 | int i = 0, e = 0; |
83 | 82 | ||
84 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); | 83 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); |
85 | query_co->clear(); | 84 | query_co->clear(); |
86 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) | 85 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) |
87 | { | 86 | { |
88 | QString name; | 87 | QString name; |
89 | cfg.setGroup( *it ); | 88 | cfg.setGroup( *it ); |
90 | name = cfg.readEntry( "Name" ); | 89 | name = cfg.readEntry( "Name" ); |
91 | query_co->insertItem( name ); | 90 | query_co->insertItem( name ); |
@@ -118,25 +117,24 @@ void ODict::lookupLanguageNames( QString dictname ) | |||
118 | { | 117 | { |
119 | Config cfg ( "odict" ); | 118 | Config cfg ( "odict" ); |
120 | cfg.setGroup( "Method_"+dictname ); | 119 | cfg.setGroup( "Method_"+dictname ); |
121 | top_name_content = cfg.readEntry( "Lang1" ); | 120 | top_name_content = cfg.readEntry( "Lang1" ); |
122 | bottom_name_content = cfg.readEntry( "Lang2" ); | 121 | bottom_name_content = cfg.readEntry( "Lang2" ); |
123 | } | 122 | } |
124 | 123 | ||
125 | void ODict::saveConfig() | 124 | void ODict::saveConfig() |
126 | { | 125 | { |
127 | Config cfg ( "odict" ); | 126 | Config cfg ( "odict" ); |
128 | cfg.setGroup( "generalsettings" ); | 127 | cfg.setGroup( "generalsettings" ); |
129 | cfg.writeEntry( "casesens" , casesens ); | 128 | cfg.writeEntry( "casesens" , casesens ); |
130 | cfg.writeEntry( "regexp" , regexp ); | ||
131 | cfg.writeEntry( "lastdict" , query_co->currentText() ); | 129 | cfg.writeEntry( "lastdict" , query_co->currentText() ); |
132 | } | 130 | } |
133 | 131 | ||
134 | void ODict::slotStartQuery() | 132 | void ODict::slotStartQuery() |
135 | { | 133 | { |
136 | QString querystring = query_le->text(); | 134 | QString querystring = query_le->text(); |
137 | if ( !querystring.isEmpty() ) | 135 | if ( !querystring.isEmpty() ) |
138 | { | 136 | { |
139 | /* | 137 | /* |
140 | * if the user has not yet defined a dictionary | 138 | * if the user has not yet defined a dictionary |
141 | */ | 139 | */ |
142 | if ( !query_co->currentText() ) | 140 | if ( !query_co->currentText() ) |
@@ -176,31 +174,24 @@ void ODict::slotSettings() | |||
176 | } | 174 | } |
177 | 175 | ||
178 | void ODict::slotSetParameter( int count ) | 176 | void ODict::slotSetParameter( int count ) |
179 | { | 177 | { |
180 | if ( count == 0 ) | 178 | if ( count == 0 ) |
181 | { | 179 | { |
182 | if ( casesens ) | 180 | if ( casesens ) |
183 | casesens = false; | 181 | casesens = false; |
184 | else | 182 | else |
185 | casesens = true; | 183 | casesens = true; |
186 | } | 184 | } |
187 | 185 | ||
188 | if ( count == 1 ) | ||
189 | { | ||
190 | if ( regexp ) | ||
191 | regexp = false; | ||
192 | else | ||
193 | regexp = true; | ||
194 | } | ||
195 | saveConfig(); | 186 | saveConfig(); |
196 | } | 187 | } |
197 | 188 | ||
198 | void ODict::slotMethodChanged( const QString& methodnumber ) | 189 | void ODict::slotMethodChanged( const QString& methodnumber ) |
199 | { | 190 | { |
200 | activated_name = methodnumber; | 191 | activated_name = methodnumber; |
201 | 192 | ||
202 | if ( activated_name != ding->loadedDict() ) | 193 | if ( activated_name != ding->loadedDict() ) |
203 | { | 194 | { |
204 | ding->loadDict(activated_name); | 195 | ding->loadDict(activated_name); |
205 | 196 | ||
206 | lookupLanguageNames( activated_name ); | 197 | lookupLanguageNames( activated_name ); |
@@ -213,18 +204,17 @@ void ODict::setupMenus() | |||
213 | { | 204 | { |
214 | menu = new QMenuBar( this ); | 205 | menu = new QMenuBar( this ); |
215 | 206 | ||
216 | settings = new QPopupMenu( menu ); | 207 | settings = new QPopupMenu( menu ); |
217 | setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 208 | setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
218 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 209 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
219 | setting_a->addTo( settings ); | 210 | setting_a->addTo( settings ); |
220 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); | 211 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); |
221 | 212 | ||
222 | parameter = new QPopupMenu( menu ); | 213 | parameter = new QPopupMenu( menu ); |
223 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); | 214 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); |
224 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); | 215 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); |
225 | parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); | ||
226 | parameter->insertSeparator(); | 216 | parameter->insertSeparator(); |
227 | 217 | ||
228 | menu->insertItem( tr( "Settings" ) , settings ); | 218 | menu->insertItem( tr( "Settings" ) , settings ); |
229 | menu->insertItem( tr( "Parameter" ) , parameter ); | 219 | menu->insertItem( tr( "Parameter" ) , parameter ); |
230 | } | 220 | } |