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 | |||
@@ -71,30 +71,32 @@ void ConfigDlg::writeEntries() | |||
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 | } |
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 | |||
@@ -23,31 +23,30 @@ | |||
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 | { |
@@ -81,16 +80,17 @@ void DingWidget::setCompleteWord( bool cword ) | |||
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; |
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 | |||
@@ -39,17 +39,16 @@ | |||
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() ) ); |
@@ -91,40 +90,27 @@ void ODict::saveConfig() | |||
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 | ||
@@ -171,20 +157,20 @@ void ODict::slotMethodChanged( int /*methodnumber*/ ) | |||
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 ); |