-rw-r--r-- | noncore/apps/odict/configdlg.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 8 |
2 files changed, 14 insertions, 3 deletions
diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp index 33296e3..89bc6f6 100644 --- a/noncore/apps/odict/configdlg.cpp +++ b/noncore/apps/odict/configdlg.cpp @@ -88,24 +88,31 @@ void ConfigDlg::slotChangeMethod() if ( list->selectedItem() ) { SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); if ( dlg.exec() == QDialog::Accepted ) { dlg.saveItem(); - QListViewItem *item = new QListViewItem( list ); + 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() ) + { + Config cfg ( "odict" ); + cfg.setGroup( "Method_"+list->selectedItem()->text(0) ); + cfg.clearGroup(); + //FIXME: this only removes the entries but not the group itself + list->takeItem( list->selectedItem() ); + } else qDebug("no item selected"); } void ConfigDlg::loadSearchMethodNames() { Config cfg( "odict" ); diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 1fbdb85..e0104eb 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp @@ -66,12 +66,13 @@ void ODict::loadConfig() errorTol = cfg.readEntry( "errtol" ).toInt(); casesens = cfg.readEntry( "casesens" ).toInt(); regexp = cfg.readEntry( "regexp" ).toInt(); completewords = cfg.readEntry( "completewords" ).toInt(); QStringList groupListCfg = cfg.groupList().grep( "Method_" ); + query_co->clear(); for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) { cfg.setGroup( *it ); query_co->insertItem( cfg.readEntry( "Name" ) ); } } @@ -86,21 +87,21 @@ void ODict::saveConfig() cfg.writeEntry( "regexp" , regexp ); cfg.writeEntry( "completewords" , completewords ); } void ODict::slotDisplayAbout() { - QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030103" ) ); + QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030104" ) ); } void ODict::slotStartQuery() { QString querystring = query_le->text(); qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1()); if (querystring.isEmpty()){ - qWarning("empty querysting"); + qWarning("empty querystring"); return; } if (!activated_name || activated_name.isEmpty()) QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") ); else DingWidget *ding = new DingWidget( querystring , browser_top, browser_bottom, activated_name ); @@ -113,13 +114,16 @@ void ODict::slotSetErrorcount( int count ) } void ODict::slotSettings() { ConfigDlg dlg( this, "Config" , true); if ( dlg.exec() == QDialog::Accepted ) + { dlg.writeEntries(); + loadConfig(); + } else qDebug( "abgebrochen" ); } void ODict::slotSetParameter( int count ) { if ( count == 0 ) |