-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 | |||
@@ -1,105 +1,114 @@ | |||
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 | 30 | ||
31 | #include <opie/otabwidget.h> | 31 | #include <opie/otabwidget.h> |
32 | 32 | ||
33 | ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) | 33 | ConfigDlg::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 | ||
61 | /*add the tabs and maximize*/ | 62 | /*add the tabs and maximize*/ |
62 | tab->addTab( settings_tab, "pass", tr( "General Settings" ) ); | 63 | tab->addTab( settings_tab, "pass", tr( "General Settings" ) ); |
63 | tab->addTab( search_tab, "zoom", tr( "Searchmethods" ) ); | 64 | tab->addTab( search_tab, "zoom", tr( "Searchmethods" ) ); |
64 | showMaximized(); | 65 | showMaximized(); |
65 | } | 66 | } |
66 | 67 | ||
67 | void ConfigDlg::writeEntries() | 68 | void ConfigDlg::writeEntries() |
68 | { | 69 | { |
69 | qDebug( "richtig beendet" ); | 70 | qDebug( "richtig beendet" ); |
70 | } | 71 | } |
71 | 72 | ||
72 | void ConfigDlg::slotNewMethod() | 73 | void ConfigDlg::slotNewMethod() |
73 | { | 74 | { |
74 | SearchMethodDlg dlg( this, "SearchMethodDlg", true ); | 75 | SearchMethodDlg dlg( this, "SearchMethodDlg", true ); |
75 | if ( dlg.exec() == QDialog::Accepted ) | 76 | if ( dlg.exec() == QDialog::Accepted ) |
76 | { | 77 | { |
77 | dlg.saveItem(); | 78 | dlg.saveItem(); |
78 | QListViewItem *item = new QListViewItem( list ); | 79 | QListViewItem *item = new QListViewItem( list ); |
79 | item->setText( 0 , dlg.nameLE->text() ); | 80 | item->setText( 0 , dlg.nameLE->text() ); |
80 | } | 81 | } |
81 | else qDebug( "SearchMethodDlg abgebrochen" ); | 82 | else qDebug( "SearchMethodDlg abgebrochen" ); |
82 | } | 83 | } |
83 | 84 | ||
84 | void ConfigDlg::slotChangeMethod() | 85 | void ConfigDlg::slotChangeMethod() |
85 | { | 86 | { |
86 | if ( list->selectedItem() ) | 87 | if ( list->selectedItem() ) |
87 | { | 88 | { |
88 | SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); | 89 | SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); |
89 | if ( dlg.exec() == QDialog::Accepted ) | 90 | if ( dlg.exec() == QDialog::Accepted ) |
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 | ||
100 | void ConfigDlg::slotDeleteMethod() | 101 | void 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 | |||
108 | void 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 | |||
@@ -1,37 +1,39 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 6 | * ( at your option ) any later version. * |
7 | * * | 7 | * * |
8 | **************************************************************************/ | 8 | **************************************************************************/ |
9 | 9 | ||
10 | class QWidget; | 10 | class QWidget; |
11 | class OTabWidget; | 11 | class OTabWidget; |
12 | class QListView; | 12 | class QListView; |
13 | class QPushButton; | 13 | class QPushButton; |
14 | 14 | ||
15 | #include <qdialog.h> | 15 | #include <qdialog.h> |
16 | 16 | ||
17 | 17 | ||
18 | class ConfigDlg : public QDialog | 18 | class 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 | |||
@@ -1,107 +1,107 @@ | |||
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 "searchmethoddlg.h" | 17 | #include "searchmethoddlg.h" |
18 | 18 | ||
19 | #include <qdialog.h> | 19 | #include <qdialog.h> |
20 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | 22 | ||
23 | #include <qhbox.h> | 23 | #include <qhbox.h> |
24 | #include <qvbox.h> | 24 | #include <qvbox.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | 29 | ||
30 | #include <opie/ofileselector.h> | 30 | #include <opie/ofileselector.h> |
31 | #include <opie/ofiledialog.h> | 31 | #include <opie/ofiledialog.h> |
32 | 32 | ||
33 | SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal) | 33 | SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal) |
34 | { | 34 | { |
35 | 35 | ||
36 | QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" ); | 36 | QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" ); |
37 | QVBox *vbox = new QVBox( this ); | 37 | QVBox *vbox = new QVBox( this ); |
38 | 38 | ||
39 | QHBox *hbox1 = new QHBox( vbox ); | 39 | QHBox *hbox1 = new QHBox( vbox ); |
40 | QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 ); | 40 | QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 ); |
41 | nameLE = new QLineEdit( hbox1 ); | 41 | nameLE = new QLineEdit( hbox1 ); |
42 | 42 | ||
43 | QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox ); | 43 | QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox ); |
44 | QHBox *hbox2 = new QHBox( vbox ); | 44 | QHBox *hbox2 = new QHBox( vbox ); |
45 | dictFileLE = new QLineEdit( hbox2 ); | 45 | dictFileLE = new QLineEdit( hbox2 ); |
46 | QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 ); | 46 | QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 ); |
47 | connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) ); | 47 | connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) ); |
48 | 48 | ||
49 | QWidget *dummywidget = new QWidget( vbox ); | 49 | QWidget *dummywidget = new QWidget( vbox ); |
50 | QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget); | 50 | QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget); |
51 | QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget); | 51 | QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget); |
52 | QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget); | 52 | QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget); |
53 | lang1 = new QLineEdit( dummywidget ); | 53 | lang1 = new QLineEdit( dummywidget ); |
54 | lang2 = new QLineEdit( dummywidget ); | 54 | lang2 = new QLineEdit( dummywidget ); |
55 | trenner = new QLineEdit( dummywidget ); | 55 | trenner = new QLineEdit( dummywidget ); |
56 | trenner->setText( "::" ); | 56 | trenner->setText( "::" ); |
57 | 57 | ||
58 | QGridLayout *grid = new QGridLayout( dummywidget, 2,3 ); | 58 | QGridLayout *grid = new QGridLayout( dummywidget, 2,3 ); |
59 | grid->addWidget( lag1, 0,0 ); | 59 | grid->addWidget( lag1, 0,0 ); |
60 | grid->addWidget( devider, 0,1 ); | 60 | grid->addWidget( devider, 0,1 ); |
61 | grid->addWidget( lag2, 0,2 ); | 61 | grid->addWidget( lag2, 0,2 ); |
62 | grid->addWidget( lang1, 1,0 ); | 62 | grid->addWidget( lang1, 1,0 ); |
63 | grid->addWidget( trenner, 1,1 ); | 63 | grid->addWidget( trenner, 1,1 ); |
64 | grid->addWidget( lang2, 1,2 ); | 64 | grid->addWidget( lang2, 1,2 ); |
65 | 65 | ||
66 | vbox_layout->addWidget( vbox ); | 66 | vbox_layout->addWidget( vbox ); |
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 | ||
80 | void SearchMethodDlg::setupEntries( QString item ) | 80 | void 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 | ||
91 | void SearchMethodDlg::slotBrowse() | 91 | void 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 | ||
97 | void SearchMethodDlg::saveItem() | 97 | void 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 | } |