-rw-r--r-- | noncore/apps/odict/configdlg.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/odict/configdlg.h | 2 | ||||
-rw-r--r-- | noncore/apps/odict/searchmethoddlg.cpp | 4 |
3 files changed, 13 insertions, 2 deletions
diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp index 2056457..0f33ee8 100644 --- a/noncore/apps/odict/configdlg.cpp +++ b/noncore/apps/odict/configdlg.cpp @@ -21,48 +21,49 @@ #include <qpe/config.h> #include <qlayout.h> #include <qhbox.h> #include <qvbox.h> #include <qlabel.h> #include <qlistview.h> #include <qpushbutton.h> #include <qlineedit.h> #include <opie/otabwidget.h> ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) { setCaption( tr( "Options" ) ); QVBoxLayout *vbox_layout = new QVBoxLayout( this ); tab = new OTabWidget( this, "OTabWidget_tab", OTabWidget::Global, OTabWidget::Bottom ); vbox_layout->addWidget( tab ); /*general settings*/ settings_tab = new QWidget( tab , "settings_tab" ); /*searchmethods*/ search_tab = new QWidget( tab , "search_tab" ); + loadSearchMethodNames(); QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" ); QHBox *hbox = new QHBox( search_tab ); list = new QListView( hbox ); list->addColumn( tr( "Searchmethod" ) ); QVBox *vbox = new QVBox( hbox ); new_button = new QPushButton( "New" , vbox ); change_button = new QPushButton( "Change" , vbox ); delete_button = new QPushButton( "Delete" , vbox ); connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) ); connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() )); connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() )); vbox_layout_searchtab->addWidget( hbox ); /*add the tabs and maximize*/ tab->addTab( settings_tab, "pass", tr( "General Settings" ) ); tab->addTab( search_tab, "zoom", tr( "Searchmethods" ) ); showMaximized(); } void ConfigDlg::writeEntries() { @@ -82,24 +83,32 @@ void ConfigDlg::slotNewMethod() } 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 ); item->setText( 0 , dlg.nameLE->text() ); } else qDebug( "SearchMethodDlg abgebrochen" ); } else qDebug( "kein item angewählt" ); } void ConfigDlg::slotDeleteMethod() { if ( list->selectedItem() ) list->takeItem( list->selectedItem() ); else qDebug("no item selected"); } + +void ConfigDlg::loadSearchMethodNames() +{ + QListViewItem *item = new QListViewItem( list); + Config cfg( "odict" ); +//X cfg.setGroup( itemName ); +//X QString temp = cfg.readEntry( "Seperator" ); +} diff --git a/noncore/apps/odict/configdlg.h b/noncore/apps/odict/configdlg.h index e59b875..2b7d0a1 100644 --- a/noncore/apps/odict/configdlg.h +++ b/noncore/apps/odict/configdlg.h @@ -9,29 +9,31 @@ class QWidget; class OTabWidget; class QListView; class QPushButton; #include <qdialog.h> class ConfigDlg : public QDialog { Q_OBJECT public: ConfigDlg(QWidget *parent, const char *name, bool modal=FALSE ); void writeEntries(); private: OTabWidget *tab; QWidget *settings_tab, *search_tab; QListView *list; QPushButton *new_button, *change_button, *delete_button; + void loadSearchMethodNames(); + private slots: void slotNewMethod(); void slotChangeMethod(); void slotDeleteMethod(); }; diff --git a/noncore/apps/odict/searchmethoddlg.cpp b/noncore/apps/odict/searchmethoddlg.cpp index fcbdb8a..203c663 100644 --- a/noncore/apps/odict/searchmethoddlg.cpp +++ b/noncore/apps/odict/searchmethoddlg.cpp @@ -59,49 +59,49 @@ SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, grid->addWidget( lag1, 0,0 ); grid->addWidget( devider, 0,1 ); grid->addWidget( lag2, 0,2 ); grid->addWidget( lang1, 1,0 ); grid->addWidget( trenner, 1,1 ); grid->addWidget( lang2, 1,2 ); vbox_layout->addWidget( vbox ); showMaximized(); if( !itemname ) setCaption( tr( "New Searchmethod" ) ); else { setCaption( tr( "Change Searchmethod" ) ); itemName = itemname; setupEntries(itemname); } } void SearchMethodDlg::setupEntries( QString item ) { Config cfg( "odict" ); - cfg.setGroup( itemName ); + cfg.setGroup( "Method_"+itemName ); trenner->setText( cfg.readEntry( "Seperator" ) ); lang1->setText( cfg.readEntry( "Lang1" ) ); lang2->setText( cfg.readEntry( "Lang2" ) ); nameLE->setText( itemName ); dictFileLE->setText( cfg.readEntry( "file" ) ); } void SearchMethodDlg::slotBrowse() { itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,"/home/carsten" ); dictFileLE->setText( itemName ); } void SearchMethodDlg::saveItem() { QString name = nameLE->text(); Config cfg( "odict" ); - cfg.setGroup( name ); + cfg.setGroup( "Method_"+name ); cfg.writeEntry( "Name", name ); cfg.writeEntry( "Seperator", trenner->text() ); cfg.writeEntry( "Lang1", lang1->text() ); cfg.writeEntry( "Lang2", lang2->text() ); cfg.writeEntry( "file", dictFileLE->text() ); } |