-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 @@ -67,38 +67,40 @@ ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(pa } void ConfigDlg::writeEntries() { qDebug( "richtig beendet" ); } void ConfigDlg::slotNewMethod() { SearchMethodDlg dlg( this, "SearchMethodDlg", true ); if ( dlg.exec() == QDialog::Accepted ) { + //if ( !dlg.nameLE->text() ) return; //XXX dlg.saveItem(); QListViewItem *item = new QListViewItem( list ); item->setText( 0 , dlg.nameLE->text() ); } else qDebug( "SearchMethodDlg abgebrochen" ); } void ConfigDlg::slotChangeMethod() { if ( list->selectedItem() ) { SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); if ( dlg.exec() == QDialog::Accepted ) { + //if ( !dlg.nameLE->text() ) return; //XXX geht vielleich nicht dlg.saveItem(); QListViewItem *item = list->selectedItem(); item->setText( 0 , dlg.nameLE->text() ); } else qDebug( "SearchMethodDlg abgebrochen" ); } else qDebug( "kein item angewählt" ); } void ConfigDlg::slotDeleteMethod() { if ( list->selectedItem() ) 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 @@ -19,39 +19,38 @@ #include <qfile.h> #include <qpe/config.h> #include <qhbox.h> #include <qlabel.h> #include <qpushbutton.h> #include <qlineedit.h> #include <qmainwindow.h> #include <qstring.h> #include <qtextstream.h> #include <qstringlist.h> #include <qregexp.h> #include <qtextbrowser.h> -#include <stdlib.h> // for getenv +//#include <stdlib.h> // for getenv DingWidget::DingWidget( ) { methodname = QString::null; trenner = QString::null; lines = 0L; } void DingWidget::loadDict( QString name ) { dictName = name; - QString opie_dir = getenv("OPIEDIR"); - Config cfg( "odict" ); + if ( !methodname ) return; cfg.setGroup( "Method_" + methodname ); QFile file( cfg.readEntry( "file" ) ); if( file.open( IO_ReadOnly ) ) { QTextStream stream( &file ); while ( !stream.eof() ) { lines.append( stream.readLine() ); } file.close(); } @@ -77,24 +76,25 @@ void DingWidget::setCompleteWord( bool cword ) { isCompleteWord = cword; } void DingWidget::setQueryWord( QString qword ) { queryword = qword; } void DingWidget::loadValues() { + if ( !methodname ) return; Config cfg( "odict" ); cfg.setGroup( "Method_" + methodname ); trenner = cfg.readEntry( "Seperator" ); } BroswerContent DingWidget::setText( QString word ) { queryword = word; return parseInfo(); } 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 @@ -35,25 +35,24 @@ #include <qcombobox.h> #include <qpe/resource.h> ODict::ODict() : QMainWindow() { activated_name = QString::null; vbox = new QVBox( this ); setCaption( tr( "OPIE-Dictionary" ) ); setupMenus(); - QHBox *hbox = new QHBox( vbox ); QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); query_le = new QLineEdit( hbox ); query_co = new QComboBox( hbox ); connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) ); ok_button = new QPushButton( tr( "&Ok" ), hbox ); connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); browser_top = new QTextBrowser( vbox ); browser_bottom = new QTextBrowser( vbox ); ding = new DingWidget(); @@ -87,48 +86,35 @@ void ODict::saveConfig() { Config cfg ( "odict" ); cfg.setGroup( "generalsettings" ); cfg.writeEntry( "errtol" , errorTol ); cfg.writeEntry( "casesens" , casesens ); cfg.writeEntry( "regexp" , regexp ); cfg.writeEntry( "completewords" , completewords ); } void ODict::slotStartQuery() { QString querystring = query_le->text(); -//X qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1()); -//X if (querystring.isEmpty()){ -//X qWarning("empty querystring"); -//X return; -//X } -//X if (!activated_name || activated_name.isEmpty()) -//X QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") ); -//X else -//X { - - ding->setCaseSensitive( casesens ); - ding->setCompleteWord( completewords ); - ding->setDict( activated_name ); - - if ( activated_name != ding->loadedDict() ) - ding->loadDict(activated_name); - - BroswerContent test = ding->setText( querystring ); - - browser_top->setText( test.top ); - browser_bottom->setText( test.bottom ); - - qDebug( "Text sollte gesetzt sein..." ); -//X } + ding->setCaseSensitive( casesens ); + ding->setCompleteWord( completewords ); + ding->setDict( activated_name ); + + if ( activated_name != ding->loadedDict() ) + ding->loadDict(activated_name); + + BroswerContent test = ding->setText( querystring ); + + browser_top->setText( test.top ); + browser_bottom->setText( test.bottom ); } void ODict::slotSetErrorcount( int count ) { errorTol = count; } void ODict::slotSettings() { ConfigDlg dlg( this, "Config" , true); if ( dlg.exec() == QDialog::Accepted ) @@ -167,28 +153,28 @@ void ODict::slotSetParameter( int count ) } void ODict::slotMethodChanged( int /*methodnumber*/ ) { activated_name = query_co->currentText(); } void ODict::setupMenus() { menu = new QMenuBar( this ); settings = new QPopupMenu( menu ); - setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); + setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); setting_a->addTo( settings ); - setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); + setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); parameter = new QPopupMenu( menu ); connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ; parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); parameter->insertSeparator(); error_tol_menu = new QPopupMenu( menu ); error_tol_menu->setCheckable( TRUE ); connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) ); error_tol_menu->insertItem( tr( "0 Errors" ), 0 ); |