summaryrefslogtreecommitdiff
path: root/noncore/apps/odict/configdlg.cpp
Unidiff
Diffstat (limited to 'noncore/apps/odict/configdlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/configdlg.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp
index eba7dec..1608486 100644
--- a/noncore/apps/odict/configdlg.cpp
+++ b/noncore/apps/odict/configdlg.cpp
@@ -47,82 +47,76 @@ ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(pa
47 47
48 QHBox *hbox = new QHBox( search_tab ); 48 QHBox *hbox = new QHBox( search_tab );
49 list = new QListView( hbox ); 49 list = new QListView( hbox );
50 list->addColumn( tr( "Searchmethod" ) ); 50 list->addColumn( tr( "Searchmethod" ) );
51 loadSearchMethodNames(); 51 loadSearchMethodNames();
52 52
53 QVBox *vbox = new QVBox( hbox ); 53 QVBox *vbox = new QVBox( hbox );
54 new_button = new QPushButton( "New" , vbox ); 54 new_button = new QPushButton( "New" , vbox );
55 change_button = new QPushButton( "Change" , vbox ); 55 change_button = new QPushButton( "Change" , vbox );
56 delete_button = new QPushButton( "Delete" , vbox ); 56 delete_button = new QPushButton( "Delete" , vbox );
57 connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) ); 57 connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) );
58 connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() )); 58 connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() ));
59 connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() )); 59 connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() ));
60 60
61 vbox_layout_searchtab->addWidget( hbox ); 61 vbox_layout_searchtab->addWidget( hbox );
62 62
63 /*add the tabs and maximize*/ 63 /*add the tabs and maximize*/
64 tab->addTab( settings_tab, "pass", tr( "General Settings" ) ); 64 tab->addTab( settings_tab, "pass", tr( "General Settings" ) );
65 tab->addTab( search_tab, "zoom", tr( "Searchmethods" ) ); 65 tab->addTab( search_tab, "zoom", tr( "Searchmethods" ) );
66 showMaximized(); 66 showMaximized();
67} 67}
68 68
69void ConfigDlg::writeEntries() 69void ConfigDlg::writeEntries()
70{ 70{
71 qDebug( "richtig beendet" ); 71 //XXX wozu gibt es diese Methode?
72} 72}
73 73
74void ConfigDlg::slotNewMethod() 74void ConfigDlg::slotNewMethod()
75{ 75{
76 SearchMethodDlg dlg( this, "SearchMethodDlg", true ); 76 SearchMethodDlg dlg( this, "SearchMethodDlg", true );
77 if ( dlg.exec() == QDialog::Accepted ) 77 if ( dlg.exec() == QDialog::Accepted )
78 { 78 {
79 //if ( !dlg.nameLE->text() ) return; //XXX
80 dlg.saveItem(); 79 dlg.saveItem();
81 QListViewItem *item = new QListViewItem( list ); 80 QListViewItem *item = new QListViewItem( list );
82 item->setText( 0 , dlg.nameLE->text() ); 81 item->setText( 0 , dlg.nameLE->text() );
83 } 82 }
84 else qDebug( "SearchMethodDlg abgebrochen" );
85} 83}
86 84
87void ConfigDlg::slotChangeMethod() 85void ConfigDlg::slotChangeMethod()
88{ 86{
89 if ( list->selectedItem() ) 87 if ( list->selectedItem() )
90 { 88 {
91 SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); 89 SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) );
92 if ( dlg.exec() == QDialog::Accepted ) 90 if ( dlg.exec() == QDialog::Accepted )
93 { 91 {
94 //if ( !dlg.nameLE->text() ) return; //XXX geht vielleich nicht
95 dlg.saveItem(); 92 dlg.saveItem();
96 QListViewItem *item = list->selectedItem(); 93 QListViewItem *item = list->selectedItem();
97 item->setText( 0 , dlg.nameLE->text() ); 94 item->setText( 0 , dlg.nameLE->text() );
98 } 95 }
99 else qDebug( "SearchMethodDlg abgebrochen" );
100 } 96 }
101 else qDebug( "kein item angewählt" );
102} 97}
103 98
104void ConfigDlg::slotDeleteMethod() 99void ConfigDlg::slotDeleteMethod()
105{ 100{
106 if ( list->selectedItem() ) 101 if ( list->selectedItem() )
107 { 102 {
108 Config cfg ( "odict" ); 103 Config cfg ( "odict" );
109 cfg.setGroup( "Method_"+list->selectedItem()->text(0) ); 104 cfg.setGroup( "Method_"+list->selectedItem()->text(0) );
110 cfg.clearGroup(); 105 cfg.clearGroup();
111 //FIXME: this only removes the entries but not the group itself 106 //FIXME: this only removes the entries but not the group itself
112 107
113 list->takeItem( list->selectedItem() ); 108 list->takeItem( list->selectedItem() );
114 } 109 }
115 else qDebug("no item selected");
116} 110}
117 111
118void ConfigDlg::loadSearchMethodNames() 112void ConfigDlg::loadSearchMethodNames()
119{ 113{
120 Config cfg( "odict" ); 114 Config cfg( "odict" );
121 QStringList groupListCfg = cfg.groupList().grep( "Method_" ); 115 QStringList groupListCfg = cfg.groupList().grep( "Method_" );
122 for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) 116 for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it )
123 { 117 {
124 QListViewItem *item = new QListViewItem( list ); 118 QListViewItem *item = new QListViewItem( list );
125 cfg.setGroup( *it ); 119 cfg.setGroup( *it );
126 item->setText( 0 , cfg.readEntry( "Name" ) ); 120 item->setText( 0 , cfg.readEntry( "Name" ) );
127 } 121 }
128} 122}