summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/configdlg.cpp5
-rw-r--r--noncore/apps/odict/configdlg.h3
-rw-r--r--noncore/apps/odict/dingwidget.cpp19
-rw-r--r--noncore/apps/odict/dingwidget.h4
-rw-r--r--noncore/apps/odict/odict.cpp106
-rw-r--r--noncore/apps/odict/odict.h8
-rw-r--r--noncore/apps/odict/searchmethoddlg.cpp2
-rw-r--r--noncore/apps/odict/searchmethoddlg.h1
8 files changed, 86 insertions, 62 deletions
diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp
index 1608486..400298d 100644
--- a/noncore/apps/odict/configdlg.cpp
+++ b/noncore/apps/odict/configdlg.cpp
@@ -68,7 +68,2 @@ ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(pa
68 68
69void ConfigDlg::writeEntries()
70{
71 //XXX wozu gibt es diese Methode?
72}
73
74void ConfigDlg::slotNewMethod() 69void ConfigDlg::slotNewMethod()
diff --git a/noncore/apps/odict/configdlg.h b/noncore/apps/odict/configdlg.h
index 2b7d0a1..e3ef3ce 100644
--- a/noncore/apps/odict/configdlg.h
+++ b/noncore/apps/odict/configdlg.h
@@ -16,3 +16,2 @@ class QPushButton;
16 16
17
18class ConfigDlg : public QDialog 17class ConfigDlg : public QDialog
@@ -24,4 +23,2 @@ class ConfigDlg : public QDialog
24 23
25 void writeEntries();
26
27 private: 24 private:
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp
index 0707bfb..ed67abf 100644
--- a/noncore/apps/odict/dingwidget.cpp
+++ b/noncore/apps/odict/dingwidget.cpp
@@ -20,7 +20,2 @@
20#include <qpe/config.h> 20#include <qpe/config.h>
21#include <qhbox.h>
22#include <qlabel.h>
23#include <qpushbutton.h>
24#include <qlineedit.h>
25#include <qmainwindow.h>
26#include <qstring.h> 21#include <qstring.h>
@@ -29,4 +24,2 @@
29#include <qregexp.h> 24#include <qregexp.h>
30#include <qtextbrowser.h>
31//#include <stdlib.h> // for getenv
32 25
@@ -41,7 +34,12 @@ void DingWidget::loadDict( QString name )
41{ 34{
35 qDebug( "bin in DingWidget::loadDict(). name ist:" );
36 qDebug( name );
37
42 dictName = name; 38 dictName = name;
43 Config cfg( "odict" ); 39 Config cfg( "odict" );
44 if ( !methodname ) return; 40 if ( !methodname ) { return; }
45 cfg.setGroup( "Method_" + methodname ); 41 cfg.setGroup( "Method_" + methodname );
46 QFile file( cfg.readEntry( "file" ) ); 42 QFile file( cfg.readEntry( "file" ) );
43
44 qDebug( cfg.readEntry( "file" ) );
47 45
@@ -57,5 +55,6 @@ void DingWidget::loadDict( QString name )
57 loadValues(); 55 loadValues();
56
58} 57}
59 58
60QString DingWidget::loadedDict() 59QString DingWidget::loadedDict() const
61{ 60{
@@ -104,2 +103,4 @@ BroswerContent DingWidget::parseInfo()
104{ 103{
104 qDebug( "bin in DingWidget::parseInfo()" );
105
105 if ( isCompleteWord ) 106 if ( isCompleteWord )
diff --git a/noncore/apps/odict/dingwidget.h b/noncore/apps/odict/dingwidget.h
index d8466cb..dbb55e2 100644
--- a/noncore/apps/odict/dingwidget.h
+++ b/noncore/apps/odict/dingwidget.h
@@ -28,3 +28,3 @@ class DingWidget
28 void loadDict( QString ); 28 void loadDict( QString );
29 QString loadedDict(); 29 QString loadedDict() const;
30 void setQueryWord( QString ); 30 void setQueryWord( QString );
@@ -36,2 +36,3 @@ class DingWidget
36 36
37 bool isCaseSensitive;
37 private: 38 private:
@@ -41,3 +42,2 @@ class DingWidget
41 bool isCompleteWord; 42 bool isCompleteWord;
42 bool isCaseSensitive;
43 43
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp
index cb9c4e0..0745f53 100644
--- a/noncore/apps/odict/odict.cpp
+++ b/noncore/apps/odict/odict.cpp
@@ -55,5 +55,8 @@ ODict::ODict() : QMainWindow()
55 connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); 55 connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) );
56
56 top_name = new QLabel( vbox ); 57 top_name = new QLabel( vbox );
58 top_name->setAlignment( AlignHCenter );
57 browser_top = new QTextBrowser( vbox ); 59 browser_top = new QTextBrowser( vbox );
58 bottom_name = new QLabel( vbox ); 60 bottom_name = new QLabel( vbox );
61 bottom_name->setAlignment( AlignHCenter );
59 browser_bottom = new QTextBrowser( vbox ); 62 browser_bottom = new QTextBrowser( vbox );
@@ -69,5 +72,9 @@ void ODict::loadConfig()
69{ 72{
73 /*
74 * the name of the last used dictionary
75 */
76 QString lastname;
77
70 Config cfg ( "odict" ); 78 Config cfg ( "odict" );
71 cfg.setGroup( "generalsettings" ); 79 cfg.setGroup( "generalsettings" );
72 errorTol = cfg.readEntry( "errtol" ).toInt();
73 casesens = cfg.readEntry( "casesens" ).toInt(); 80 casesens = cfg.readEntry( "casesens" ).toInt();
@@ -76,2 +83,5 @@ void ODict::loadConfig()
76 83
84 QString lastDict = cfg.readEntry( "lastdict" );
85 int i = 0, e = 0;
86
77 QStringList groupListCfg = cfg.groupList().grep( "Method_" ); 87 QStringList groupListCfg = cfg.groupList().grep( "Method_" );
@@ -80,8 +90,36 @@ void ODict::loadConfig()
80 { 90 {
91 QString name;
81 cfg.setGroup( *it ); 92 cfg.setGroup( *it );
82 query_co->insertItem( cfg.readEntry( "Name" ) ); 93 name = cfg.readEntry( "Name" );
94 query_co->insertItem( name );
95
96 /*
97 * this check is to look up what dictionary has been used the
98 * last time
99 */
100 if ( lastDict == name )
101 {
102 e = i;
103 lastname = name;
104 }
105 i++;
83 } 106 }
84 //XXXslotMethodChanged( "1" ); //FIXME: this line should not contain a integer 107 /*
108 * now set the two names of the dictionary and the correct QComboBox-Entry
109 */
110
111 lookupLanguageNames( lastname );
112
113 query_co->setCurrentItem( e );
114 top_name->setText( top_name_content );
115 bottom_name->setText( bottom_name_content );
85} 116}
86 117
118void ODict::lookupLanguageNames( QString dictname )
119{
120 Config cfg ( "odict" );
121 cfg.setGroup( "Method_"+dictname );
122 top_name_content = cfg.readEntry( "Lang1" );
123 bottom_name_content = cfg.readEntry( "Lang2" );
124}
87 125
@@ -91,3 +129,2 @@ void ODict::saveConfig()
91 cfg.setGroup( "generalsettings" ); 129 cfg.setGroup( "generalsettings" );
92 cfg.writeEntry( "errtol" , errorTol );
93 cfg.writeEntry( "casesens" , casesens ); 130 cfg.writeEntry( "casesens" , casesens );
@@ -95,2 +132,3 @@ void ODict::saveConfig()
95 cfg.writeEntry( "completewords" , completewords ); 132 cfg.writeEntry( "completewords" , completewords );
133 cfg.writeEntry( "lastdict" , query_co->currentText() );
96} 134}
@@ -99,3 +137,6 @@ void ODict::slotStartQuery()
99{ 137{
100 if ( !query_le->text( ).isEmpty() ) 138 qDebug( "bin in slotStartQuery()" );
139
140 QString querystring = query_le->text();
141 if ( !querystring.isEmpty() )
101 { 142 {
@@ -113,3 +154,2 @@ void ODict::slotStartQuery()
113 { 154 {
114
115 case 0: 155 case 0:
@@ -125,10 +165,11 @@ void ODict::slotStartQuery()
125 */ 165 */
126 QString querystring = query_le->text();
127 ding->setCaseSensitive( casesens ); 166 ding->setCaseSensitive( casesens );
128 ding->setCompleteWord( completewords ); 167 ding->setCompleteWord( completewords );
168
169 qDebug( "activated_name ist:" );
170 qDebug( activated_name );
171
129 ding->setDict( activated_name ); 172 ding->setDict( activated_name );
130 top_name->setText( ding->lang1_name );
131 bottom_name->setText( ding->lang2_name );
132 173
133 if ( activated_name != ding->loadedDict() ) 174 //X if ( activated_name != ding->loadedDict() )
134 ding->loadDict(activated_name); 175 ding->loadDict(activated_name);
@@ -137,2 +178,7 @@ void ODict::slotStartQuery()
137 178
179 qDebug( querystring );
180 if ( ding->isCaseSensitive )
181 qDebug( "ist CS");
182 else qDebug( "kein CS" );
183
138 browser_top->setText( test.top ); 184 browser_top->setText( test.top );
@@ -142,8 +188,2 @@ void ODict::slotStartQuery()
142 188
143
144void ODict::slotSetErrorcount( int count )
145{
146 errorTol = count;
147}
148
149void ODict::slotSettings() 189void ODict::slotSettings()
@@ -152,6 +192,3 @@ void ODict::slotSettings()
152 if ( dlg.exec() == QDialog::Accepted ) 192 if ( dlg.exec() == QDialog::Accepted )
153 { 193 saveConfig();
154 dlg.writeEntries();
155 loadConfig();
156 }
157} 194}
@@ -182,3 +219,3 @@ void ODict::slotSetParameter( int count )
182 } 219 }
183 else qWarning( "ERROR" ); 220 saveConfig();
184} 221}
@@ -189,9 +226,13 @@ void ODict::slotMethodChanged( const QString& methodnumber )
189 226
190 if ( activated_name != ding->loadedDict() ) 227 qDebug( "activated_name in slotMethodChanged() ist:" );
191 ding->loadDict(activated_name); 228 qDebug( activated_name );
192 229
193 top_name->setText( ding->lang1_name ); 230 //X if ( activated_name != ding->loadedDict() )
194 top_name->setAlignment( AlignHCenter ); 231 {
195 bottom_name->setText( ding->lang2_name ); 232 ding->loadDict(activated_name);
196 bottom_name->setAlignment( AlignHCenter ); 233
234 lookupLanguageNames( activated_name );
235 top_name->setText( top_name_content );
236 bottom_name->setText( bottom_name_content );
237 }
197} 238}
@@ -214,13 +255,2 @@ void ODict::setupMenus()
214 parameter->insertSeparator(); 255 parameter->insertSeparator();
215 error_tol_menu = new QPopupMenu( menu );
216 error_tol_menu->setCheckable( TRUE );
217 connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) );
218
219 error_tol_menu->insertItem( tr( "0 Errors" ), 0 );
220 error_tol_menu->insertItem( tr( "1 Errors" ), 1 );
221 error_tol_menu->insertItem( tr( "2 Errors" ), 2 );
222 error_tol_menu->insertItem( tr( "3 Errors" ), 3 );
223 error_tol_menu->insertItem( tr( "4 Errors" ), 4 );
224 error_tol_menu->insertItem( tr( "Until Hit" ), 5 );
225 parameter->insertItem( tr( "&Error tolerance" ), error_tol_menu );
226 256
diff --git a/noncore/apps/odict/odict.h b/noncore/apps/odict/odict.h
index b9a0778..9c037ea 100644
--- a/noncore/apps/odict/odict.h
+++ b/noncore/apps/odict/odict.h
@@ -38,3 +38,3 @@ class ODict : public QMainWindow
38 private: 38 private:
39 QPopupMenu *help, *settings, *parameter, *error_tol_menu; 39 QPopupMenu *help, *settings, *parameter;
40 QMenuBar *menu; 40 QMenuBar *menu;
@@ -51,3 +51,2 @@ class ODict : public QMainWindow
51 51
52 int errorTol;
53 bool casesens, completewords, regexp; 52 bool casesens, completewords, regexp;
@@ -60,2 +59,6 @@ class ODict : public QMainWindow
60 *top_name; 59 *top_name;
60
61 QString top_name_content, bottom_name_content;
62
63 void lookupLanguageNames( QString );
61 64
@@ -63,3 +66,2 @@ class ODict : public QMainWindow
63 void slotStartQuery(); 66 void slotStartQuery();
64 void slotSetErrorcount( int );
65 void slotSettings(); 67 void slotSettings();
diff --git a/noncore/apps/odict/searchmethoddlg.cpp b/noncore/apps/odict/searchmethoddlg.cpp
index 8a14703..99cd8db 100644
--- a/noncore/apps/odict/searchmethoddlg.cpp
+++ b/noncore/apps/odict/searchmethoddlg.cpp
@@ -93,3 +93,3 @@ void SearchMethodDlg::slotBrowse()
93{ 93{
94 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,QDir::homeDirPath()); 94 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,QDir::homeDirPath());
95 dictFileLE->setText( itemName ); 95 dictFileLE->setText( itemName );
diff --git a/noncore/apps/odict/searchmethoddlg.h b/noncore/apps/odict/searchmethoddlg.h
index d98842f..706bbc1 100644
--- a/noncore/apps/odict/searchmethoddlg.h
+++ b/noncore/apps/odict/searchmethoddlg.h
@@ -19,3 +19,2 @@ class QString;
19 19
20
21class SearchMethodDlg : public QDialog 20class SearchMethodDlg : public QDialog