author | cniehaus <cniehaus> | 2003-05-02 13:41:37 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2003-05-02 13:41:37 (UTC) |
commit | b40991b25dd22c55cc80a9a9c4ae0adec103d575 (patch) (unidiff) | |
tree | a5d0ba564cf7809bdb603e0fcefac899f301c16c | |
parent | 6ba2bb2dde0c69ffeba860a9375bab82521e9304 (diff) | |
download | opie-b40991b25dd22c55cc80a9a9c4ae0adec103d575.zip opie-b40991b25dd22c55cc80a9a9c4ae0adec103d575.tar.gz opie-b40991b25dd22c55cc80a9a9c4ae0adec103d575.tar.bz2 |
bugfix
-rw-r--r-- | noncore/apps/odict/configdlg.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/odict/dingwidget.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 40 |
3 files changed, 18 insertions, 30 deletions
diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp index 89bc6f6..eba7dec 100644 --- a/noncore/apps/odict/configdlg.cpp +++ b/noncore/apps/odict/configdlg.cpp | |||
@@ -63,46 +63,48 @@ ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(pa | |||
63 | /*add the tabs and maximize*/ | 63 | /*add the tabs and maximize*/ |
64 | tab->addTab( settings_tab, "pass", tr( "General Settings" ) ); | 64 | tab->addTab( settings_tab, "pass", tr( "General Settings" ) ); |
65 | tab->addTab( search_tab, "zoom", tr( "Searchmethods" ) ); | 65 | tab->addTab( search_tab, "zoom", tr( "Searchmethods" ) ); |
66 | showMaximized(); | 66 | showMaximized(); |
67 | } | 67 | } |
68 | 68 | ||
69 | void ConfigDlg::writeEntries() | 69 | void ConfigDlg::writeEntries() |
70 | { | 70 | { |
71 | qDebug( "richtig beendet" ); | 71 | qDebug( "richtig beendet" ); |
72 | } | 72 | } |
73 | 73 | ||
74 | void ConfigDlg::slotNewMethod() | 74 | void ConfigDlg::slotNewMethod() |
75 | { | 75 | { |
76 | SearchMethodDlg dlg( this, "SearchMethodDlg", true ); | 76 | SearchMethodDlg dlg( this, "SearchMethodDlg", true ); |
77 | if ( dlg.exec() == QDialog::Accepted ) | 77 | if ( dlg.exec() == QDialog::Accepted ) |
78 | { | 78 | { |
79 | //if ( !dlg.nameLE->text() ) return; //XXX | ||
79 | dlg.saveItem(); | 80 | dlg.saveItem(); |
80 | QListViewItem *item = new QListViewItem( list ); | 81 | QListViewItem *item = new QListViewItem( list ); |
81 | item->setText( 0 , dlg.nameLE->text() ); | 82 | item->setText( 0 , dlg.nameLE->text() ); |
82 | } | 83 | } |
83 | else qDebug( "SearchMethodDlg abgebrochen" ); | 84 | else qDebug( "SearchMethodDlg abgebrochen" ); |
84 | } | 85 | } |
85 | 86 | ||
86 | void ConfigDlg::slotChangeMethod() | 87 | void ConfigDlg::slotChangeMethod() |
87 | { | 88 | { |
88 | if ( list->selectedItem() ) | 89 | if ( list->selectedItem() ) |
89 | { | 90 | { |
90 | SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); | 91 | SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); |
91 | if ( dlg.exec() == QDialog::Accepted ) | 92 | if ( dlg.exec() == QDialog::Accepted ) |
92 | { | 93 | { |
94 | //if ( !dlg.nameLE->text() ) return; //XXX geht vielleich nicht | ||
93 | dlg.saveItem(); | 95 | dlg.saveItem(); |
94 | QListViewItem *item = list->selectedItem(); | 96 | QListViewItem *item = list->selectedItem(); |
95 | item->setText( 0 , dlg.nameLE->text() ); | 97 | item->setText( 0 , dlg.nameLE->text() ); |
96 | } | 98 | } |
97 | else qDebug( "SearchMethodDlg abgebrochen" ); | 99 | else qDebug( "SearchMethodDlg abgebrochen" ); |
98 | } | 100 | } |
99 | else qDebug( "kein item angewählt" ); | 101 | else qDebug( "kein item angewählt" ); |
100 | } | 102 | } |
101 | 103 | ||
102 | void ConfigDlg::slotDeleteMethod() | 104 | void ConfigDlg::slotDeleteMethod() |
103 | { | 105 | { |
104 | if ( list->selectedItem() ) | 106 | if ( list->selectedItem() ) |
105 | { | 107 | { |
106 | Config cfg ( "odict" ); | 108 | Config cfg ( "odict" ); |
107 | cfg.setGroup( "Method_"+list->selectedItem()->text(0) ); | 109 | cfg.setGroup( "Method_"+list->selectedItem()->text(0) ); |
108 | cfg.clearGroup(); | 110 | cfg.clearGroup(); |
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp index 5c4b13b..abb5e75 100644 --- a/noncore/apps/odict/dingwidget.cpp +++ b/noncore/apps/odict/dingwidget.cpp | |||
@@ -15,47 +15,46 @@ | |||
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 | DingWidget::DingWidget( ) | 33 | DingWidget::DingWidget( ) |
34 | { | 34 | { |
35 | methodname = QString::null; | 35 | methodname = QString::null; |
36 | trenner = QString::null; | 36 | trenner = QString::null; |
37 | lines = 0L; | 37 | lines = 0L; |
38 | } | 38 | } |
39 | 39 | ||
40 | void DingWidget::loadDict( QString name ) | 40 | void DingWidget::loadDict( QString name ) |
41 | { | 41 | { |
42 | dictName = name; | 42 | dictName = name; |
43 | QString opie_dir = getenv("OPIEDIR"); | ||
44 | |||
45 | Config cfg( "odict" ); | 43 | Config cfg( "odict" ); |
44 | if ( !methodname ) return; | ||
46 | cfg.setGroup( "Method_" + methodname ); | 45 | cfg.setGroup( "Method_" + methodname ); |
47 | QFile file( cfg.readEntry( "file" ) ); | 46 | QFile file( cfg.readEntry( "file" ) ); |
48 | 47 | ||
49 | if( file.open( IO_ReadOnly ) ) | 48 | if( file.open( IO_ReadOnly ) ) |
50 | { | 49 | { |
51 | QTextStream stream( &file ); | 50 | QTextStream stream( &file ); |
52 | while ( !stream.eof() ) | 51 | while ( !stream.eof() ) |
53 | { | 52 | { |
54 | lines.append( stream.readLine() ); | 53 | lines.append( stream.readLine() ); |
55 | } | 54 | } |
56 | file.close(); | 55 | file.close(); |
57 | } | 56 | } |
58 | loadValues(); | 57 | loadValues(); |
59 | } | 58 | } |
60 | 59 | ||
61 | QString DingWidget::loadedDict() | 60 | QString DingWidget::loadedDict() |
@@ -73,32 +72,33 @@ void DingWidget::setDict( QString dict ) | |||
73 | methodname = dict; | 72 | methodname = dict; |
74 | } | 73 | } |
75 | 74 | ||
76 | void DingWidget::setCompleteWord( bool cword ) | 75 | void DingWidget::setCompleteWord( bool cword ) |
77 | { | 76 | { |
78 | isCompleteWord = cword; | 77 | isCompleteWord = cword; |
79 | } | 78 | } |
80 | 79 | ||
81 | void DingWidget::setQueryWord( QString qword ) | 80 | void DingWidget::setQueryWord( QString qword ) |
82 | { | 81 | { |
83 | queryword = qword; | 82 | queryword = qword; |
84 | } | 83 | } |
85 | 84 | ||
86 | 85 | ||
87 | void DingWidget::loadValues() | 86 | void DingWidget::loadValues() |
88 | { | 87 | { |
88 | if ( !methodname ) return; | ||
89 | Config cfg( "odict" ); | 89 | Config cfg( "odict" ); |
90 | cfg.setGroup( "Method_" + methodname ); | 90 | cfg.setGroup( "Method_" + methodname ); |
91 | trenner = cfg.readEntry( "Seperator" ); | 91 | trenner = cfg.readEntry( "Seperator" ); |
92 | } | 92 | } |
93 | 93 | ||
94 | BroswerContent DingWidget::setText( QString word ) | 94 | BroswerContent DingWidget::setText( QString word ) |
95 | { | 95 | { |
96 | queryword = word; | 96 | queryword = word; |
97 | return parseInfo(); | 97 | return parseInfo(); |
98 | } | 98 | } |
99 | 99 | ||
100 | 100 | ||
101 | BroswerContent DingWidget::parseInfo() | 101 | BroswerContent DingWidget::parseInfo() |
102 | { | 102 | { |
103 | if ( isCompleteWord ) | 103 | if ( isCompleteWord ) |
104 | queryword = " " + queryword + " "; | 104 | queryword = " " + queryword + " "; |
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index a404e89..cc3148a 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -31,33 +31,32 @@ | |||
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 | |||
48 | 47 | ||
49 | QHBox *hbox = new QHBox( vbox ); | 48 | QHBox *hbox = new QHBox( vbox ); |
50 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); | 49 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); |
51 | query_le = new QLineEdit( hbox ); | 50 | query_le = new QLineEdit( hbox ); |
52 | query_co = new QComboBox( hbox ); | 51 | query_co = new QComboBox( hbox ); |
53 | connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) ); | 52 | connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) ); |
54 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); | 53 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); |
55 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); | 54 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); |
56 | browser_top = new QTextBrowser( vbox ); | 55 | browser_top = new QTextBrowser( vbox ); |
57 | browser_bottom = new QTextBrowser( vbox ); | 56 | browser_bottom = new QTextBrowser( vbox ); |
58 | 57 | ||
59 | ding = new DingWidget(); | 58 | ding = new DingWidget(); |
60 | ding->loadValues(); | 59 | ding->loadValues(); |
61 | 60 | ||
62 | loadConfig(); | 61 | loadConfig(); |
63 | setCentralWidget( vbox ); | 62 | setCentralWidget( vbox ); |
@@ -83,56 +82,43 @@ void ODict::loadConfig() | |||
83 | } | 82 | } |
84 | 83 | ||
85 | 84 | ||
86 | void ODict::saveConfig() | 85 | void ODict::saveConfig() |
87 | { | 86 | { |
88 | Config cfg ( "odict" ); | 87 | Config cfg ( "odict" ); |
89 | cfg.setGroup( "generalsettings" ); | 88 | cfg.setGroup( "generalsettings" ); |
90 | cfg.writeEntry( "errtol" , errorTol ); | 89 | cfg.writeEntry( "errtol" , errorTol ); |
91 | cfg.writeEntry( "casesens" , casesens ); | 90 | cfg.writeEntry( "casesens" , casesens ); |
92 | cfg.writeEntry( "regexp" , regexp ); | 91 | cfg.writeEntry( "regexp" , regexp ); |
93 | cfg.writeEntry( "completewords" , completewords ); | 92 | cfg.writeEntry( "completewords" , completewords ); |
94 | } | 93 | } |
95 | 94 | ||
96 | void ODict::slotStartQuery() | 95 | void ODict::slotStartQuery() |
97 | { | 96 | { |
98 | QString querystring = query_le->text(); | 97 | QString querystring = query_le->text(); |
99 | //X qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1()); | 98 | ding->setCaseSensitive( casesens ); |
100 | //X if (querystring.isEmpty()){ | 99 | ding->setCompleteWord( completewords ); |
101 | //X qWarning("empty querystring"); | 100 | ding->setDict( activated_name ); |
102 | //X return; | 101 | |
103 | //X } | 102 | if ( activated_name != ding->loadedDict() ) |
104 | //X if (!activated_name || activated_name.isEmpty()) | 103 | ding->loadDict(activated_name); |
105 | //X QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") ); | 104 | |
106 | //X else | 105 | BroswerContent test = ding->setText( querystring ); |
107 | //X { | 106 | |
108 | 107 | browser_top->setText( test.top ); | |
109 | ding->setCaseSensitive( casesens ); | 108 | browser_bottom->setText( test.bottom ); |
110 | ding->setCompleteWord( completewords ); | ||
111 | ding->setDict( activated_name ); | ||
112 | |||
113 | if ( activated_name != ding->loadedDict() ) | ||
114 | ding->loadDict(activated_name); | ||
115 | |||
116 | BroswerContent test = ding->setText( querystring ); | ||
117 | |||
118 | browser_top->setText( test.top ); | ||
119 | browser_bottom->setText( test.bottom ); | ||
120 | |||
121 | qDebug( "Text sollte gesetzt sein..." ); | ||
122 | //X } | ||
123 | } | 109 | } |
124 | 110 | ||
125 | 111 | ||
126 | void ODict::slotSetErrorcount( int count ) | 112 | void ODict::slotSetErrorcount( int count ) |
127 | { | 113 | { |
128 | errorTol = count; | 114 | errorTol = count; |
129 | } | 115 | } |
130 | 116 | ||
131 | void ODict::slotSettings() | 117 | void ODict::slotSettings() |
132 | { | 118 | { |
133 | ConfigDlg dlg( this, "Config" , true); | 119 | ConfigDlg dlg( this, "Config" , true); |
134 | if ( dlg.exec() == QDialog::Accepted ) | 120 | if ( dlg.exec() == QDialog::Accepted ) |
135 | { | 121 | { |
136 | dlg.writeEntries(); | 122 | dlg.writeEntries(); |
137 | loadConfig(); | 123 | loadConfig(); |
138 | } | 124 | } |
@@ -163,36 +149,36 @@ void ODict::slotSetParameter( int count ) | |||
163 | else | 149 | else |
164 | regexp = true; | 150 | regexp = true; |
165 | } | 151 | } |
166 | else qWarning( "ERROR" ); | 152 | else qWarning( "ERROR" ); |
167 | } | 153 | } |
168 | 154 | ||
169 | void ODict::slotMethodChanged( int /*methodnumber*/ ) | 155 | void ODict::slotMethodChanged( int /*methodnumber*/ ) |
170 | { | 156 | { |
171 | activated_name = query_co->currentText(); | 157 | activated_name = query_co->currentText(); |
172 | } | 158 | } |
173 | 159 | ||
174 | void ODict::setupMenus() | 160 | void ODict::setupMenus() |
175 | { | 161 | { |
176 | menu = new QMenuBar( this ); | 162 | menu = new QMenuBar( this ); |
177 | 163 | ||
178 | settings = new QPopupMenu( menu ); | 164 | settings = new QPopupMenu( menu ); |
179 | setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); | 165 | setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
180 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 166 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
181 | setting_a->addTo( settings ); | 167 | setting_a->addTo( settings ); |
182 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); | 168 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); |
183 | 169 | ||
184 | parameter = new QPopupMenu( menu ); | 170 | parameter = new QPopupMenu( menu ); |
185 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); | 171 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); |
186 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); | 172 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); |
187 | parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ; | 173 | parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ; |
188 | parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); | 174 | parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); |
189 | parameter->insertSeparator(); | 175 | parameter->insertSeparator(); |
190 | error_tol_menu = new QPopupMenu( menu ); | 176 | error_tol_menu = new QPopupMenu( menu ); |
191 | error_tol_menu->setCheckable( TRUE ); | 177 | error_tol_menu->setCheckable( TRUE ); |
192 | connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) ); | 178 | connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) ); |
193 | 179 | ||
194 | error_tol_menu->insertItem( tr( "0 Errors" ), 0 ); | 180 | error_tol_menu->insertItem( tr( "0 Errors" ), 0 ); |
195 | error_tol_menu->insertItem( tr( "1 Errors" ), 1 ); | 181 | error_tol_menu->insertItem( tr( "1 Errors" ), 1 ); |
196 | error_tol_menu->insertItem( tr( "2 Errors" ), 2 ); | 182 | error_tol_menu->insertItem( tr( "2 Errors" ), 2 ); |
197 | error_tol_menu->insertItem( tr( "3 Errors" ), 3 ); | 183 | error_tol_menu->insertItem( tr( "3 Errors" ), 3 ); |
198 | error_tol_menu->insertItem( tr( "4 Errors" ), 4 ); | 184 | error_tol_menu->insertItem( tr( "4 Errors" ), 4 ); |