summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/configdlg.cpp9
-rw-r--r--noncore/apps/odict/configdlg.h2
-rw-r--r--noncore/apps/odict/searchmethoddlg.cpp4
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
@@ -29,32 +29,33 @@
29#include <qlineedit.h> 29#include <qlineedit.h>
30 30
31#include <opie/otabwidget.h> 31#include <opie/otabwidget.h>
32 32
33ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) 33ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal)
34{ 34{
35 setCaption( tr( "Options" ) ); 35 setCaption( tr( "Options" ) );
36 QVBoxLayout *vbox_layout = new QVBoxLayout( this ); 36 QVBoxLayout *vbox_layout = new QVBoxLayout( this );
37 tab = new OTabWidget( this, "OTabWidget_tab", OTabWidget::Global, OTabWidget::Bottom ); 37 tab = new OTabWidget( this, "OTabWidget_tab", OTabWidget::Global, OTabWidget::Bottom );
38 vbox_layout->addWidget( tab ); 38 vbox_layout->addWidget( tab );
39 39
40 /*general settings*/ 40 /*general settings*/
41 settings_tab = new QWidget( tab , "settings_tab" ); 41 settings_tab = new QWidget( tab , "settings_tab" );
42 42
43 /*searchmethods*/ 43 /*searchmethods*/
44 search_tab = new QWidget( tab , "search_tab" ); 44 search_tab = new QWidget( tab , "search_tab" );
45 loadSearchMethodNames();
45 QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" ); 46 QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" );
46 47
47 QHBox *hbox = new QHBox( search_tab ); 48 QHBox *hbox = new QHBox( search_tab );
48 list = new QListView( hbox ); 49 list = new QListView( hbox );
49 list->addColumn( tr( "Searchmethod" ) ); 50 list->addColumn( tr( "Searchmethod" ) );
50 51
51 QVBox *vbox = new QVBox( hbox ); 52 QVBox *vbox = new QVBox( hbox );
52 new_button = new QPushButton( "New" , vbox ); 53 new_button = new QPushButton( "New" , vbox );
53 change_button = new QPushButton( "Change" , vbox ); 54 change_button = new QPushButton( "Change" , vbox );
54 delete_button = new QPushButton( "Delete" , vbox ); 55 delete_button = new QPushButton( "Delete" , vbox );
55 connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) ); 56 connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) );
56 connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() )); 57 connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() ));
57 connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() )); 58 connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() ));
58 59
59 vbox_layout_searchtab->addWidget( hbox ); 60 vbox_layout_searchtab->addWidget( hbox );
60 61
@@ -90,16 +91,24 @@ void ConfigDlg::slotChangeMethod()
90 { 91 {
91 dlg.saveItem(); 92 dlg.saveItem();
92 QListViewItem *item = new QListViewItem( list ); 93 QListViewItem *item = new QListViewItem( list );
93 item->setText( 0 , dlg.nameLE->text() ); 94 item->setText( 0 , dlg.nameLE->text() );
94 } 95 }
95 else qDebug( "SearchMethodDlg abgebrochen" ); 96 else qDebug( "SearchMethodDlg abgebrochen" );
96 } 97 }
97 else qDebug( "kein item angewählt" ); 98 else qDebug( "kein item angewählt" );
98} 99}
99 100
100void ConfigDlg::slotDeleteMethod() 101void ConfigDlg::slotDeleteMethod()
101{ 102{
102 if ( list->selectedItem() ) 103 if ( list->selectedItem() )
103 list->takeItem( list->selectedItem() ); 104 list->takeItem( list->selectedItem() );
104 else qDebug("no item selected"); 105 else qDebug("no item selected");
105} 106}
107
108void ConfigDlg::loadSearchMethodNames()
109{
110 QListViewItem *item = new QListViewItem( list);
111 Config cfg( "odict" );
112 //X cfg.setGroup( itemName );
113 //X QString temp = cfg.readEntry( "Seperator" );
114}
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
@@ -17,21 +17,23 @@ class QPushButton;
17 17
18class ConfigDlg : public QDialog 18class ConfigDlg : public QDialog
19{ 19{
20 Q_OBJECT 20 Q_OBJECT
21 21
22 public: 22 public:
23 ConfigDlg(QWidget *parent, const char *name, bool modal=FALSE ); 23 ConfigDlg(QWidget *parent, const char *name, bool modal=FALSE );
24 24
25 void writeEntries(); 25 void writeEntries();
26 26
27 private: 27 private:
28 OTabWidget *tab; 28 OTabWidget *tab;
29 QWidget *settings_tab, *search_tab; 29 QWidget *settings_tab, *search_tab;
30 QListView *list; 30 QListView *list;
31 QPushButton *new_button, *change_button, *delete_button; 31 QPushButton *new_button, *change_button, *delete_button;
32 32
33 void loadSearchMethodNames();
34
33 private slots: 35 private slots:
34 void slotNewMethod(); 36 void slotNewMethod();
35 void slotChangeMethod(); 37 void slotChangeMethod();
36 void slotDeleteMethod(); 38 void slotDeleteMethod();
37}; 39};
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
@@ -67,41 +67,41 @@ SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal,
67 67
68 showMaximized(); 68 showMaximized();
69 69
70 if( !itemname ) 70 if( !itemname )
71 setCaption( tr( "New Searchmethod" ) ); 71 setCaption( tr( "New Searchmethod" ) );
72 else 72 else
73 { 73 {
74 setCaption( tr( "Change Searchmethod" ) ); 74 setCaption( tr( "Change Searchmethod" ) );
75 itemName = itemname; 75 itemName = itemname;
76 setupEntries(itemname); 76 setupEntries(itemname);
77 } 77 }
78} 78}
79 79
80void SearchMethodDlg::setupEntries( QString item ) 80void SearchMethodDlg::setupEntries( QString item )
81{ 81{
82 Config cfg( "odict" ); 82 Config cfg( "odict" );
83 cfg.setGroup( itemName ); 83 cfg.setGroup( "Method_"+itemName );
84 trenner->setText( cfg.readEntry( "Seperator" ) ); 84 trenner->setText( cfg.readEntry( "Seperator" ) );
85 lang1->setText( cfg.readEntry( "Lang1" ) ); 85 lang1->setText( cfg.readEntry( "Lang1" ) );
86 lang2->setText( cfg.readEntry( "Lang2" ) ); 86 lang2->setText( cfg.readEntry( "Lang2" ) );
87 nameLE->setText( itemName ); 87 nameLE->setText( itemName );
88 dictFileLE->setText( cfg.readEntry( "file" ) ); 88 dictFileLE->setText( cfg.readEntry( "file" ) );
89} 89}
90 90
91void SearchMethodDlg::slotBrowse() 91void SearchMethodDlg::slotBrowse()
92{ 92{
93 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,"/home/carsten" ); 93 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,"/home/carsten" );
94 dictFileLE->setText( itemName ); 94 dictFileLE->setText( itemName );
95} 95}
96 96
97void SearchMethodDlg::saveItem() 97void SearchMethodDlg::saveItem()
98{ 98{
99 QString name = nameLE->text(); 99 QString name = nameLE->text();
100 Config cfg( "odict" ); 100 Config cfg( "odict" );
101 cfg.setGroup( name ); 101 cfg.setGroup( "Method_"+name );
102 cfg.writeEntry( "Name", name ); 102 cfg.writeEntry( "Name", name );
103 cfg.writeEntry( "Seperator", trenner->text() ); 103 cfg.writeEntry( "Seperator", trenner->text() );
104 cfg.writeEntry( "Lang1", lang1->text() ); 104 cfg.writeEntry( "Lang1", lang1->text() );
105 cfg.writeEntry( "Lang2", lang2->text() ); 105 cfg.writeEntry( "Lang2", lang2->text() );
106 cfg.writeEntry( "file", dictFileLE->text() ); 106 cfg.writeEntry( "file", dictFileLE->text() );
107} 107}