-rw-r--r-- | noncore/apps/odict/configdlg.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/odict/dingwidget.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/odict/searchmethoddlg.cpp | 3 |
4 files changed, 0 insertions, 15 deletions
diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp index b12a395..7fa6008 100644 --- a/noncore/apps/odict/configdlg.cpp +++ b/noncore/apps/odict/configdlg.cpp | |||
@@ -1,95 +1,91 @@ | |||
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 <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | 22 | ||
23 | #include <qdialog.h> | ||
24 | #include <qlayout.h> | 23 | #include <qlayout.h> |
25 | #include <qhbox.h> | ||
26 | #include <qvbox.h> | 24 | #include <qvbox.h> |
27 | #include <qlabel.h> | ||
28 | #include <qlistview.h> | 25 | #include <qlistview.h> |
29 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
30 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
31 | #include <qstringlist.h> | ||
32 | 28 | ||
33 | ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) | 29 | ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) |
34 | { | 30 | { |
35 | setCaption( tr( "Options" ) ); | 31 | setCaption( tr( "Options" ) ); |
36 | QVBoxLayout *vbox_layout = new QVBoxLayout( this ); | 32 | QVBoxLayout *vbox_layout = new QVBoxLayout( this ); |
37 | search_tab = new QWidget( this , "search_tab" ); | 33 | search_tab = new QWidget( this , "search_tab" ); |
38 | QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" ); | 34 | QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" ); |
39 | 35 | ||
40 | QHBox *hbox = new QHBox( search_tab ); | 36 | QHBox *hbox = new QHBox( search_tab ); |
41 | list = new QListView( hbox ); | 37 | list = new QListView( hbox ); |
42 | list->addColumn( tr( "Searchmethod" ) ); | 38 | list->addColumn( tr( "Searchmethod" ) ); |
43 | loadSearchMethodNames(); | 39 | loadSearchMethodNames(); |
44 | 40 | ||
45 | QVBox *vbox = new QVBox( hbox ); | 41 | QVBox *vbox = new QVBox( hbox ); |
46 | new_button = new QPushButton( tr( "New" ) , vbox ); | 42 | new_button = new QPushButton( tr( "New" ) , vbox ); |
47 | change_button = new QPushButton( tr( "Change" ) , vbox ); | 43 | change_button = new QPushButton( tr( "Change" ) , vbox ); |
48 | delete_button = new QPushButton( tr( "Delete" ) , vbox ); | 44 | delete_button = new QPushButton( tr( "Delete" ) , vbox ); |
49 | connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) ); | 45 | connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) ); |
50 | connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() )); | 46 | connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() )); |
51 | connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() )); | 47 | connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() )); |
52 | 48 | ||
53 | vbox_layout_searchtab->addWidget( hbox ); | 49 | vbox_layout_searchtab->addWidget( hbox ); |
54 | 50 | ||
55 | vbox_layout->addWidget( search_tab ); | 51 | vbox_layout->addWidget( search_tab ); |
56 | 52 | ||
57 | QPEApplication::execDialog( this ); | 53 | QPEApplication::execDialog( this ); |
58 | } | 54 | } |
59 | 55 | ||
60 | void ConfigDlg::slotNewMethod() | 56 | void ConfigDlg::slotNewMethod() |
61 | { | 57 | { |
62 | SearchMethodDlg dlg( this, "SearchMethodDlg", true ); | 58 | SearchMethodDlg dlg( this, "SearchMethodDlg", true ); |
63 | if ( dlg.exec() == QDialog::Accepted ) | 59 | if ( dlg.exec() == QDialog::Accepted ) |
64 | { | 60 | { |
65 | dlg.saveItem(); | 61 | dlg.saveItem(); |
66 | QListViewItem *item = new QListViewItem( list ); | 62 | QListViewItem *item = new QListViewItem( list ); |
67 | item->setText( 0 , dlg.nameLE->text() ); | 63 | item->setText( 0 , dlg.nameLE->text() ); |
68 | } | 64 | } |
69 | } | 65 | } |
70 | 66 | ||
71 | void ConfigDlg::slotChangeMethod() | 67 | void ConfigDlg::slotChangeMethod() |
72 | { | 68 | { |
73 | if ( list->selectedItem() ) | 69 | if ( list->selectedItem() ) |
74 | { | 70 | { |
75 | SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); | 71 | SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); |
76 | if ( dlg.exec() == QDialog::Accepted ) | 72 | if ( dlg.exec() == QDialog::Accepted ) |
77 | { | 73 | { |
78 | dlg.saveItem(); | 74 | dlg.saveItem(); |
79 | QListViewItem *item = list->selectedItem(); | 75 | QListViewItem *item = list->selectedItem(); |
80 | item->setText( 0 , dlg.nameLE->text() ); | 76 | item->setText( 0 , dlg.nameLE->text() ); |
81 | } | 77 | } |
82 | } | 78 | } |
83 | } | 79 | } |
84 | 80 | ||
85 | void ConfigDlg::slotDeleteMethod() | 81 | void ConfigDlg::slotDeleteMethod() |
86 | { | 82 | { |
87 | if ( list->selectedItem() ) | 83 | if ( list->selectedItem() ) |
88 | { | 84 | { |
89 | Config cfg ( "odict" ); | 85 | Config cfg ( "odict" ); |
90 | cfg.setGroup( "Method_"+list->selectedItem()->text(0) ); | 86 | cfg.setGroup( "Method_"+list->selectedItem()->text(0) ); |
91 | cfg.clearGroup(); | 87 | cfg.clearGroup(); |
92 | //FIXME: this only removes the entries but not the group itself | 88 | //FIXME: this only removes the entries but not the group itself |
93 | 89 | ||
94 | list->takeItem( list->selectedItem() ); | 90 | list->takeItem( list->selectedItem() ); |
95 | } | 91 | } |
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp index c804385..ef36ee5 100644 --- a/noncore/apps/odict/dingwidget.cpp +++ b/noncore/apps/odict/dingwidget.cpp | |||
@@ -1,88 +1,85 @@ | |||
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 "dingwidget.h" | 17 | #include "dingwidget.h" |
18 | 18 | ||
19 | #include <qfile.h> | 19 | #include <qfile.h> |
20 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
21 | #include <qstring.h> | ||
22 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
23 | #include <qstringlist.h> | ||
24 | #include <qregexp.h> | ||
25 | 22 | ||
26 | DingWidget::DingWidget( ) | 23 | DingWidget::DingWidget( ) |
27 | { | 24 | { |
28 | methodname = QString::null; | 25 | methodname = QString::null; |
29 | trenner = QString::null; | 26 | trenner = QString::null; |
30 | lines = 0L; | 27 | lines = 0L; |
31 | } | 28 | } |
32 | 29 | ||
33 | void DingWidget::loadDict( QString name ) | 30 | void DingWidget::loadDict( QString name ) |
34 | { | 31 | { |
35 | lines.clear(); //as we will load a new list we have to | 32 | lines.clear(); //as we will load a new list we have to |
36 | //remove the old one | 33 | //remove the old one |
37 | 34 | ||
38 | Config cfg( "odict" ); | 35 | Config cfg( "odict" ); |
39 | cfg.setGroup( "Method_" + name ); | 36 | cfg.setGroup( "Method_" + name ); |
40 | QFile file( cfg.readEntry( "file" ) ); | 37 | QFile file( cfg.readEntry( "file" ) ); |
41 | 38 | ||
42 | if( file.open( IO_ReadOnly ) ) | 39 | if( file.open( IO_ReadOnly ) ) |
43 | { | 40 | { |
44 | QTextStream stream( &file ); | 41 | QTextStream stream( &file ); |
45 | while ( !stream.eof() ) | 42 | while ( !stream.eof() ) |
46 | { | 43 | { |
47 | lines.append( stream.readLine() ); | 44 | lines.append( stream.readLine() ); |
48 | } | 45 | } |
49 | file.close(); | 46 | file.close(); |
50 | } | 47 | } |
51 | 48 | ||
52 | setDict( name ); | 49 | setDict( name ); |
53 | 50 | ||
54 | loadValues(); | 51 | loadValues(); |
55 | } | 52 | } |
56 | 53 | ||
57 | QString DingWidget::loadedDict() const | 54 | QString DingWidget::loadedDict() const |
58 | { | 55 | { |
59 | return dictName; | 56 | return dictName; |
60 | } | 57 | } |
61 | 58 | ||
62 | void DingWidget::setCaseSensitive( bool caseS ) | 59 | void DingWidget::setCaseSensitive( bool caseS ) |
63 | { | 60 | { |
64 | isCaseSensitive = caseS; | 61 | isCaseSensitive = caseS; |
65 | } | 62 | } |
66 | 63 | ||
67 | void DingWidget::setDict( QString dict ) | 64 | void DingWidget::setDict( QString dict ) |
68 | { | 65 | { |
69 | methodname = dict; | 66 | methodname = dict; |
70 | } | 67 | } |
71 | 68 | ||
72 | void DingWidget::setQueryWord( QString qword ) | 69 | void DingWidget::setQueryWord( QString qword ) |
73 | { | 70 | { |
74 | queryword = qword; | 71 | queryword = qword; |
75 | } | 72 | } |
76 | 73 | ||
77 | 74 | ||
78 | void DingWidget::loadValues() | 75 | void DingWidget::loadValues() |
79 | { | 76 | { |
80 | if ( !methodname ) return; | 77 | if ( !methodname ) return; |
81 | Config cfg( "odict" ); | 78 | Config cfg( "odict" ); |
82 | cfg.setGroup( "Method_" + methodname ); | 79 | cfg.setGroup( "Method_" + methodname ); |
83 | trenner = cfg.readEntry( "Seperator" ); | 80 | trenner = cfg.readEntry( "Seperator" ); |
84 | 81 | ||
85 | lang1_name = cfg.readEntry( "Lang1" ); | 82 | lang1_name = cfg.readEntry( "Lang1" ); |
86 | lang2_name = cfg.readEntry( "Lang2" ); | 83 | lang2_name = cfg.readEntry( "Lang2" ); |
87 | } | 84 | } |
88 | 85 | ||
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 9718c5c..d5c6d75 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -1,95 +1,90 @@ | |||
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 "odict.h" | 17 | #include "odict.h" |
18 | #include "configdlg.h" | 18 | #include "configdlg.h" |
19 | #include "dingwidget.h" | 19 | #include "dingwidget.h" |
20 | 20 | ||
21 | #include <qlayout.h> | ||
22 | #include <qpopupmenu.h> | ||
23 | #include <qmenubar.h> | 21 | #include <qmenubar.h> |
24 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
25 | #include <qhbox.h> | ||
26 | #include <qvbox.h> | 23 | #include <qvbox.h> |
27 | #include <qlabel.h> | 24 | #include <qlabel.h> |
28 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
29 | #include <qlineedit.h> | 26 | #include <qlineedit.h> |
30 | #include <qmainwindow.h> | ||
31 | #include <qstring.h> | ||
32 | #include <qaction.h> | 27 | #include <qaction.h> |
33 | #include <qtextbrowser.h> | 28 | #include <qtextbrowser.h> |
34 | #include <qcombobox.h> | 29 | #include <qcombobox.h> |
35 | 30 | ||
36 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
37 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
38 | 33 | ||
39 | ODict::ODict(QWidget* parent, const char* name, WFlags fl ) : QMainWindow(parent, name, fl ) | 34 | ODict::ODict(QWidget* parent, const char* name, WFlags fl ) : QMainWindow(parent, name, fl ) |
40 | { | 35 | { |
41 | activated_name = QString::null; | 36 | activated_name = QString::null; |
42 | 37 | ||
43 | vbox = new QVBox( this ); | 38 | vbox = new QVBox( this ); |
44 | setCaption( tr( "Opie-Dictionary" ) ); | 39 | setCaption( tr( "Opie-Dictionary" ) ); |
45 | setupMenus(); | 40 | setupMenus(); |
46 | 41 | ||
47 | QHBox *hbox = new QHBox( vbox ); | 42 | QHBox *hbox = new QHBox( vbox ); |
48 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); | 43 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); |
49 | query_label->show(); | 44 | query_label->show(); |
50 | query_le = new QLineEdit( hbox ); | 45 | query_le = new QLineEdit( hbox ); |
51 | query_co = new QComboBox( hbox ); | 46 | query_co = new QComboBox( hbox ); |
52 | connect( query_co , SIGNAL( activated(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) ); | 47 | connect( query_co , SIGNAL( activated(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) ); |
53 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); | 48 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); |
54 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); | 49 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); |
55 | 50 | ||
56 | top_name = new QLabel( vbox ); | 51 | top_name = new QLabel( vbox ); |
57 | top_name->setAlignment( AlignHCenter ); | 52 | top_name->setAlignment( AlignHCenter ); |
58 | browser_top = new QTextBrowser( vbox ); | 53 | browser_top = new QTextBrowser( vbox ); |
59 | bottom_name = new QLabel( vbox ); | 54 | bottom_name = new QLabel( vbox ); |
60 | bottom_name->setAlignment( AlignHCenter ); | 55 | bottom_name->setAlignment( AlignHCenter ); |
61 | browser_bottom = new QTextBrowser( vbox ); | 56 | browser_bottom = new QTextBrowser( vbox ); |
62 | 57 | ||
63 | ding = new DingWidget(); | 58 | ding = new DingWidget(); |
64 | 59 | ||
65 | loadConfig(); | 60 | loadConfig(); |
66 | setCentralWidget( vbox ); | 61 | setCentralWidget( vbox ); |
67 | } | 62 | } |
68 | 63 | ||
69 | void ODict::loadConfig() | 64 | void ODict::loadConfig() |
70 | { | 65 | { |
71 | /* | 66 | /* |
72 | * the name of the last used dictionary | 67 | * the name of the last used dictionary |
73 | */ | 68 | */ |
74 | QString lastname; | 69 | QString lastname; |
75 | 70 | ||
76 | Config cfg ( "odict" ); | 71 | Config cfg ( "odict" ); |
77 | cfg.setGroup( "generalsettings" ); | 72 | cfg.setGroup( "generalsettings" ); |
78 | casesens = cfg.readEntry( "casesens" ).toInt(); | 73 | casesens = cfg.readEntry( "casesens" ).toInt(); |
79 | 74 | ||
80 | QString lastDict = cfg.readEntry( "lastdict" ); | 75 | QString lastDict = cfg.readEntry( "lastdict" ); |
81 | int i = 0, e = 0; | 76 | int i = 0, e = 0; |
82 | 77 | ||
83 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); | 78 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); |
84 | query_co->clear(); | 79 | query_co->clear(); |
85 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) | 80 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) |
86 | { | 81 | { |
87 | QString name; | 82 | QString name; |
88 | cfg.setGroup( *it ); | 83 | cfg.setGroup( *it ); |
89 | name = cfg.readEntry( "Name" ); | 84 | name = cfg.readEntry( "Name" ); |
90 | query_co->insertItem( name ); | 85 | query_co->insertItem( name ); |
91 | 86 | ||
92 | /* | 87 | /* |
93 | * this check is to look up what dictionary has been used the | 88 | * this check is to look up what dictionary has been used the |
94 | * last time | 89 | * last time |
95 | */ | 90 | */ |
diff --git a/noncore/apps/odict/searchmethoddlg.cpp b/noncore/apps/odict/searchmethoddlg.cpp index abe2966..f71cfd8 100644 --- a/noncore/apps/odict/searchmethoddlg.cpp +++ b/noncore/apps/odict/searchmethoddlg.cpp | |||
@@ -1,95 +1,92 @@ | |||
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 <opie2/ofileselector.h> | 19 | #include <opie2/ofileselector.h> |
20 | #include <opie2/ofiledialog.h> | 20 | #include <opie2/ofiledialog.h> |
21 | 21 | ||
22 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | 24 | ||
25 | #include <qdialog.h> | ||
26 | #include <qlayout.h> | 25 | #include <qlayout.h> |
27 | #include <qhbox.h> | ||
28 | #include <qvbox.h> | 26 | #include <qvbox.h> |
29 | #include <qlabel.h> | 27 | #include <qlabel.h> |
30 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
31 | #include <qstring.h> | ||
32 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
33 | #include <qdir.h> | 30 | #include <qdir.h> |
34 | 31 | ||
35 | using Opie::OFileDialog; | 32 | using Opie::OFileDialog; |
36 | using Opie::OFileSelector; | 33 | using Opie::OFileSelector; |
37 | 34 | ||
38 | SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal) | 35 | SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal) |
39 | { | 36 | { |
40 | 37 | ||
41 | QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" ); | 38 | QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" ); |
42 | QVBox *vbox = new QVBox( this ); | 39 | QVBox *vbox = new QVBox( this ); |
43 | 40 | ||
44 | QHBox *hbox1 = new QHBox( vbox ); | 41 | QHBox *hbox1 = new QHBox( vbox ); |
45 | QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 ); | 42 | QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 ); |
46 | nameLE = new QLineEdit( hbox1 ); | 43 | nameLE = new QLineEdit( hbox1 ); |
47 | 44 | ||
48 | QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox ); | 45 | QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox ); |
49 | QHBox *hbox2 = new QHBox( vbox ); | 46 | QHBox *hbox2 = new QHBox( vbox ); |
50 | dictFileLE = new QLineEdit( hbox2 ); | 47 | dictFileLE = new QLineEdit( hbox2 ); |
51 | QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 ); | 48 | QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 ); |
52 | connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) ); | 49 | connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) ); |
53 | 50 | ||
54 | QWidget *dummywidget = new QWidget( vbox ); | 51 | QWidget *dummywidget = new QWidget( vbox ); |
55 | QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget); | 52 | QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget); |
56 | QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget); | 53 | QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget); |
57 | QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget); | 54 | QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget); |
58 | lang1 = new QLineEdit( dummywidget ); | 55 | lang1 = new QLineEdit( dummywidget ); |
59 | lang2 = new QLineEdit( dummywidget ); | 56 | lang2 = new QLineEdit( dummywidget ); |
60 | trenner = new QLineEdit( dummywidget ); | 57 | trenner = new QLineEdit( dummywidget ); |
61 | trenner->setText( "::" ); | 58 | trenner->setText( "::" ); |
62 | 59 | ||
63 | QGridLayout *grid = new QGridLayout( dummywidget, 2,3 ); | 60 | QGridLayout *grid = new QGridLayout( dummywidget, 2,3 ); |
64 | grid->addWidget( lag1, 0,0 ); | 61 | grid->addWidget( lag1, 0,0 ); |
65 | grid->addWidget( devider, 0,1 ); | 62 | grid->addWidget( devider, 0,1 ); |
66 | grid->addWidget( lag2, 0,2 ); | 63 | grid->addWidget( lag2, 0,2 ); |
67 | grid->addWidget( lang1, 1,0 ); | 64 | grid->addWidget( lang1, 1,0 ); |
68 | grid->addWidget( trenner, 1,1 ); | 65 | grid->addWidget( trenner, 1,1 ); |
69 | grid->addWidget( lang2, 1,2 ); | 66 | grid->addWidget( lang2, 1,2 ); |
70 | 67 | ||
71 | vbox_layout->addWidget( vbox ); | 68 | vbox_layout->addWidget( vbox ); |
72 | 69 | ||
73 | QPEApplication::execDialog ( this ); | 70 | QPEApplication::execDialog ( this ); |
74 | 71 | ||
75 | if( !itemname ) | 72 | if( !itemname ) |
76 | setCaption( tr( "New Searchmethod" ) ); | 73 | setCaption( tr( "New Searchmethod" ) ); |
77 | else | 74 | else |
78 | { | 75 | { |
79 | setCaption( tr( "Change Searchmethod" ) ); | 76 | setCaption( tr( "Change Searchmethod" ) ); |
80 | itemName = itemname; | 77 | itemName = itemname; |
81 | setupEntries(itemname); | 78 | setupEntries(itemname); |
82 | } | 79 | } |
83 | } | 80 | } |
84 | 81 | ||
85 | void SearchMethodDlg::setupEntries( QString item ) | 82 | void SearchMethodDlg::setupEntries( QString item ) |
86 | { | 83 | { |
87 | Config cfg( "odict" ); | 84 | Config cfg( "odict" ); |
88 | cfg.setGroup( "Method_"+itemName ); | 85 | cfg.setGroup( "Method_"+itemName ); |
89 | trenner->setText( cfg.readEntry( "Seperator" ) ); | 86 | trenner->setText( cfg.readEntry( "Seperator" ) ); |
90 | lang1->setText( cfg.readEntry( "Lang1" ) ); | 87 | lang1->setText( cfg.readEntry( "Lang1" ) ); |
91 | lang2->setText( cfg.readEntry( "Lang2" ) ); | 88 | lang2->setText( cfg.readEntry( "Lang2" ) ); |
92 | nameLE->setText( itemName ); | 89 | nameLE->setText( itemName ); |
93 | dictFileLE->setText( cfg.readEntry( "file" ) ); | 90 | dictFileLE->setText( cfg.readEntry( "file" ) ); |
94 | } | 91 | } |
95 | 92 | ||