-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 @@ -82,36 +82,43 @@ void ConfigDlg::slotNewMethod() } else qDebug( "SearchMethodDlg abgebrochen" ); } 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" ); QStringList groupListCfg = cfg.groupList().grep( "Method_" ); for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) { QListViewItem *item = new QListViewItem( list ); cfg.setGroup( *it ); item->setText( 0 , cfg.readEntry( "Name" ) ); 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 @@ -60,72 +60,76 @@ ODict::ODict() : QMainWindow() } void ODict::loadConfig() { Config cfg ( "odict" ); cfg.setGroup( "generalsettings" ); 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" ) ); } } 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::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 ); } void ODict::slotSetErrorcount( int count ) { errorTol = 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 ) { if ( casesens ) casesens = false; else casesens = true; } |