-rw-r--r-- | noncore/apps/odict/configdlg.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp index 0f33ee8..33296e3 100644 --- a/noncore/apps/odict/configdlg.cpp +++ b/noncore/apps/odict/configdlg.cpp | |||
@@ -1,114 +1,119 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : ODict | 2 | application: : ODict |
3 | 3 | ||
4 | begin : December 2002 | 4 | begin : December 2002 |
5 | copyright : ( C ) 2002, 2003 by Carsten Niehaus | 5 | copyright : ( C ) 2002, 2003 by Carsten Niehaus |
6 | email : cniehaus@handhelds.org | 6 | email : cniehaus@handhelds.org |
7 | **************************************************************************/ | 7 | **************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | #include "configdlg.h" | 17 | #include "configdlg.h" |
18 | #include "searchmethoddlg.h" | 18 | #include "searchmethoddlg.h" |
19 | 19 | ||
20 | #include <qdialog.h> | 20 | #include <qdialog.h> |
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | 23 | ||
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qlistview.h> | 27 | #include <qlistview.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
30 | #include <qstringlist.h> | ||
30 | 31 | ||
31 | #include <opie/otabwidget.h> | 32 | #include <opie/otabwidget.h> |
32 | 33 | ||
33 | ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) | 34 | ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) |
34 | { | 35 | { |
35 | setCaption( tr( "Options" ) ); | 36 | setCaption( tr( "Options" ) ); |
36 | QVBoxLayout *vbox_layout = new QVBoxLayout( this ); | 37 | QVBoxLayout *vbox_layout = new QVBoxLayout( this ); |
37 | tab = new OTabWidget( this, "OTabWidget_tab", OTabWidget::Global, OTabWidget::Bottom ); | 38 | tab = new OTabWidget( this, "OTabWidget_tab", OTabWidget::Global, OTabWidget::Bottom ); |
38 | vbox_layout->addWidget( tab ); | 39 | vbox_layout->addWidget( tab ); |
39 | 40 | ||
40 | /*general settings*/ | 41 | /*general settings*/ |
41 | settings_tab = new QWidget( tab , "settings_tab" ); | 42 | settings_tab = new QWidget( tab , "settings_tab" ); |
42 | 43 | ||
43 | /*searchmethods*/ | 44 | /*searchmethods*/ |
44 | search_tab = new QWidget( tab , "search_tab" ); | 45 | search_tab = new QWidget( tab , "search_tab" ); |
45 | loadSearchMethodNames(); | ||
46 | QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" ); | 46 | QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" ); |
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 | 52 | ||
52 | QVBox *vbox = new QVBox( hbox ); | 53 | QVBox *vbox = new QVBox( hbox ); |
53 | new_button = new QPushButton( "New" , vbox ); | 54 | new_button = new QPushButton( "New" , vbox ); |
54 | change_button = new QPushButton( "Change" , vbox ); | 55 | change_button = new QPushButton( "Change" , vbox ); |
55 | delete_button = new QPushButton( "Delete" , vbox ); | 56 | delete_button = new QPushButton( "Delete" , vbox ); |
56 | connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) ); | 57 | connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) ); |
57 | connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() )); | 58 | connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() )); |
58 | connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() )); | 59 | connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() )); |
59 | 60 | ||
60 | vbox_layout_searchtab->addWidget( hbox ); | 61 | vbox_layout_searchtab->addWidget( hbox ); |
61 | 62 | ||
62 | /*add the tabs and maximize*/ | 63 | /*add the tabs and maximize*/ |
63 | tab->addTab( settings_tab, "pass", tr( "General Settings" ) ); | 64 | tab->addTab( settings_tab, "pass", tr( "General Settings" ) ); |
64 | tab->addTab( search_tab, "zoom", tr( "Searchmethods" ) ); | 65 | tab->addTab( search_tab, "zoom", tr( "Searchmethods" ) ); |
65 | showMaximized(); | 66 | showMaximized(); |
66 | } | 67 | } |
67 | 68 | ||
68 | void ConfigDlg::writeEntries() | 69 | void ConfigDlg::writeEntries() |
69 | { | 70 | { |
70 | qDebug( "richtig beendet" ); | 71 | qDebug( "richtig beendet" ); |
71 | } | 72 | } |
72 | 73 | ||
73 | void ConfigDlg::slotNewMethod() | 74 | void ConfigDlg::slotNewMethod() |
74 | { | 75 | { |
75 | SearchMethodDlg dlg( this, "SearchMethodDlg", true ); | 76 | SearchMethodDlg dlg( this, "SearchMethodDlg", true ); |
76 | if ( dlg.exec() == QDialog::Accepted ) | 77 | if ( dlg.exec() == QDialog::Accepted ) |
77 | { | 78 | { |
78 | dlg.saveItem(); | 79 | dlg.saveItem(); |
79 | QListViewItem *item = new QListViewItem( list ); | 80 | QListViewItem *item = new QListViewItem( list ); |
80 | item->setText( 0 , dlg.nameLE->text() ); | 81 | item->setText( 0 , dlg.nameLE->text() ); |
81 | } | 82 | } |
82 | else qDebug( "SearchMethodDlg abgebrochen" ); | 83 | else qDebug( "SearchMethodDlg abgebrochen" ); |
83 | } | 84 | } |
84 | 85 | ||
85 | void ConfigDlg::slotChangeMethod() | 86 | void ConfigDlg::slotChangeMethod() |
86 | { | 87 | { |
87 | if ( list->selectedItem() ) | 88 | if ( list->selectedItem() ) |
88 | { | 89 | { |
89 | SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); | 90 | SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); |
90 | if ( dlg.exec() == QDialog::Accepted ) | 91 | if ( dlg.exec() == QDialog::Accepted ) |
91 | { | 92 | { |
92 | dlg.saveItem(); | 93 | dlg.saveItem(); |
93 | QListViewItem *item = new QListViewItem( list ); | 94 | QListViewItem *item = new QListViewItem( list ); |
94 | item->setText( 0 , dlg.nameLE->text() ); | 95 | item->setText( 0 , dlg.nameLE->text() ); |
95 | } | 96 | } |
96 | else qDebug( "SearchMethodDlg abgebrochen" ); | 97 | else qDebug( "SearchMethodDlg abgebrochen" ); |
97 | } | 98 | } |
98 | else qDebug( "kein item angewählt" ); | 99 | else qDebug( "kein item angewählt" ); |
99 | } | 100 | } |
100 | 101 | ||
101 | void ConfigDlg::slotDeleteMethod() | 102 | void ConfigDlg::slotDeleteMethod() |
102 | { | 103 | { |
103 | if ( list->selectedItem() ) | 104 | if ( list->selectedItem() ) |
104 | list->takeItem( list->selectedItem() ); | 105 | list->takeItem( list->selectedItem() ); |
105 | else qDebug("no item selected"); | 106 | else qDebug("no item selected"); |
106 | } | 107 | } |
107 | 108 | ||
108 | void ConfigDlg::loadSearchMethodNames() | 109 | void ConfigDlg::loadSearchMethodNames() |
109 | { | 110 | { |
110 | QListViewItem *item = new QListViewItem( list); | ||
111 | Config cfg( "odict" ); | 111 | Config cfg( "odict" ); |
112 | //X cfg.setGroup( itemName ); | 112 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); |
113 | //X QString temp = cfg.readEntry( "Seperator" ); | 113 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) |
114 | { | ||
115 | QListViewItem *item = new QListViewItem( list ); | ||
116 | cfg.setGroup( *it ); | ||
117 | item->setText( 0 , cfg.readEntry( "Name" ) ); | ||
118 | } | ||
114 | } | 119 | } |