summaryrefslogtreecommitdiff
authorcniehaus <cniehaus>2003-05-10 13:16:54 (UTC)
committer cniehaus <cniehaus>2003-05-10 13:16:54 (UTC)
commit8bf3021bf5e86f7f6f6083606d77427adc8d13a7 (patch) (unidiff)
tree821e9798a7d388fe57ccf2e8cdc796bb147ca780
parent882b5190d02c33aa8c893e8aa54bf3d38ac255c8 (diff)
downloadopie-8bf3021bf5e86f7f6f6083606d77427adc8d13a7.zip
opie-8bf3021bf5e86f7f6f6083606d77427adc8d13a7.tar.gz
opie-8bf3021bf5e86f7f6f6083606d77427adc8d13a7.tar.bz2
quite some changes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/configdlg.cpp5
-rw-r--r--noncore/apps/odict/configdlg.h3
-rw-r--r--noncore/apps/odict/dingwidget.cpp19
-rw-r--r--noncore/apps/odict/dingwidget.h4
-rw-r--r--noncore/apps/odict/odict.cpp106
-rw-r--r--noncore/apps/odict/odict.h8
-rw-r--r--noncore/apps/odict/searchmethoddlg.cpp2
-rw-r--r--noncore/apps/odict/searchmethoddlg.h1
8 files changed, 86 insertions, 62 deletions
diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp
index 1608486..400298d 100644
--- a/noncore/apps/odict/configdlg.cpp
+++ b/noncore/apps/odict/configdlg.cpp
@@ -1,122 +1,117 @@
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#include <qstringlist.h>
31 31
32#include <opie/otabwidget.h> 32#include <opie/otabwidget.h>
33 33
34ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) 34ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal)
35{ 35{
36 setCaption( tr( "Options" ) ); 36 setCaption( tr( "Options" ) );
37 QVBoxLayout *vbox_layout = new QVBoxLayout( this ); 37 QVBoxLayout *vbox_layout = new QVBoxLayout( this );
38 tab = new OTabWidget( this, "OTabWidget_tab", OTabWidget::Global, OTabWidget::Bottom ); 38 tab = new OTabWidget( this, "OTabWidget_tab", OTabWidget::Global, OTabWidget::Bottom );
39 vbox_layout->addWidget( tab ); 39 vbox_layout->addWidget( tab );
40 40
41 /*general settings*/ 41 /*general settings*/
42 settings_tab = new QWidget( tab , "settings_tab" ); 42 settings_tab = new QWidget( tab , "settings_tab" );
43 43
44 /*searchmethods*/ 44 /*searchmethods*/
45 search_tab = new QWidget( tab , "search_tab" ); 45 search_tab = new QWidget( tab , "search_tab" );
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 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()
70{
71 //XXX wozu gibt es diese Methode?
72}
73
74void ConfigDlg::slotNewMethod() 69void ConfigDlg::slotNewMethod()
75{ 70{
76 SearchMethodDlg dlg( this, "SearchMethodDlg", true ); 71 SearchMethodDlg dlg( this, "SearchMethodDlg", true );
77 if ( dlg.exec() == QDialog::Accepted ) 72 if ( dlg.exec() == QDialog::Accepted )
78 { 73 {
79 dlg.saveItem(); 74 dlg.saveItem();
80 QListViewItem *item = new QListViewItem( list ); 75 QListViewItem *item = new QListViewItem( list );
81 item->setText( 0 , dlg.nameLE->text() ); 76 item->setText( 0 , dlg.nameLE->text() );
82 } 77 }
83} 78}
84 79
85void ConfigDlg::slotChangeMethod() 80void ConfigDlg::slotChangeMethod()
86{ 81{
87 if ( list->selectedItem() ) 82 if ( list->selectedItem() )
88 { 83 {
89 SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); 84 SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) );
90 if ( dlg.exec() == QDialog::Accepted ) 85 if ( dlg.exec() == QDialog::Accepted )
91 { 86 {
92 dlg.saveItem(); 87 dlg.saveItem();
93 QListViewItem *item = list->selectedItem(); 88 QListViewItem *item = list->selectedItem();
94 item->setText( 0 , dlg.nameLE->text() ); 89 item->setText( 0 , dlg.nameLE->text() );
95 } 90 }
96 } 91 }
97} 92}
98 93
99void ConfigDlg::slotDeleteMethod() 94void ConfigDlg::slotDeleteMethod()
100{ 95{
101 if ( list->selectedItem() ) 96 if ( list->selectedItem() )
102 { 97 {
103 Config cfg ( "odict" ); 98 Config cfg ( "odict" );
104 cfg.setGroup( "Method_"+list->selectedItem()->text(0) ); 99 cfg.setGroup( "Method_"+list->selectedItem()->text(0) );
105 cfg.clearGroup(); 100 cfg.clearGroup();
106 //FIXME: this only removes the entries but not the group itself 101 //FIXME: this only removes the entries but not the group itself
107 102
108 list->takeItem( list->selectedItem() ); 103 list->takeItem( list->selectedItem() );
109 } 104 }
110} 105}
111 106
112void ConfigDlg::loadSearchMethodNames() 107void ConfigDlg::loadSearchMethodNames()
113{ 108{
114 Config cfg( "odict" ); 109 Config cfg( "odict" );
115 QStringList groupListCfg = cfg.groupList().grep( "Method_" ); 110 QStringList groupListCfg = cfg.groupList().grep( "Method_" );
116 for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) 111 for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it )
117 { 112 {
118 QListViewItem *item = new QListViewItem( list ); 113 QListViewItem *item = new QListViewItem( list );
119 cfg.setGroup( *it ); 114 cfg.setGroup( *it );
120 item->setText( 0 , cfg.readEntry( "Name" ) ); 115 item->setText( 0 , cfg.readEntry( "Name" ) );
121 } 116 }
122} 117}
diff --git a/noncore/apps/odict/configdlg.h b/noncore/apps/odict/configdlg.h
index 2b7d0a1..e3ef3ce 100644
--- a/noncore/apps/odict/configdlg.h
+++ b/noncore/apps/odict/configdlg.h
@@ -1,39 +1,36 @@
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
10class QWidget; 10class QWidget;
11class OTabWidget; 11class OTabWidget;
12class QListView; 12class QListView;
13class QPushButton; 13class QPushButton;
14 14
15#include <qdialog.h> 15#include <qdialog.h>
16 16
17
18class ConfigDlg : public QDialog 17class ConfigDlg : public QDialog
19{ 18{
20 Q_OBJECT 19 Q_OBJECT
21 20
22 public: 21 public:
23 ConfigDlg(QWidget *parent, const char *name, bool modal=FALSE ); 22 ConfigDlg(QWidget *parent, const char *name, bool modal=FALSE );
24 23
25 void writeEntries();
26
27 private: 24 private:
28 OTabWidget *tab; 25 OTabWidget *tab;
29 QWidget *settings_tab, *search_tab; 26 QWidget *settings_tab, *search_tab;
30 QListView *list; 27 QListView *list;
31 QPushButton *new_button, *change_button, *delete_button; 28 QPushButton *new_button, *change_button, *delete_button;
32 29
33 void loadSearchMethodNames(); 30 void loadSearchMethodNames();
34 31
35 private slots: 32 private slots:
36 void slotNewMethod(); 33 void slotNewMethod();
37 void slotChangeMethod(); 34 void slotChangeMethod();
38 void slotDeleteMethod(); 35 void slotDeleteMethod();
39}; 36};
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp
index 0707bfb..ed67abf 100644
--- a/noncore/apps/odict/dingwidget.cpp
+++ b/noncore/apps/odict/dingwidget.cpp
@@ -1,143 +1,144 @@
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 <qhbox.h>
22#include <qlabel.h>
23#include <qpushbutton.h>
24#include <qlineedit.h>
25#include <qmainwindow.h>
26#include <qstring.h> 21#include <qstring.h>
27#include <qtextstream.h> 22#include <qtextstream.h>
28#include <qstringlist.h> 23#include <qstringlist.h>
29#include <qregexp.h> 24#include <qregexp.h>
30#include <qtextbrowser.h>
31//#include <stdlib.h> // for getenv
32 25
33DingWidget::DingWidget( ) 26DingWidget::DingWidget( )
34{ 27{
35 methodname = QString::null; 28 methodname = QString::null;
36 trenner = QString::null; 29 trenner = QString::null;
37 lines = 0L; 30 lines = 0L;
38} 31}
39 32
40void DingWidget::loadDict( QString name ) 33void DingWidget::loadDict( QString name )
41{ 34{
35 qDebug( "bin in DingWidget::loadDict(). name ist:" );
36 qDebug( name );
37
42 dictName = name; 38 dictName = name;
43 Config cfg( "odict" ); 39 Config cfg( "odict" );
44 if ( !methodname ) return; 40 if ( !methodname ) { return; }
45 cfg.setGroup( "Method_" + methodname ); 41 cfg.setGroup( "Method_" + methodname );
46 QFile file( cfg.readEntry( "file" ) ); 42 QFile file( cfg.readEntry( "file" ) );
43
44 qDebug( cfg.readEntry( "file" ) );
47 45
48 if( file.open( IO_ReadOnly ) ) 46 if( file.open( IO_ReadOnly ) )
49 { 47 {
50 QTextStream stream( &file ); 48 QTextStream stream( &file );
51 while ( !stream.eof() ) 49 while ( !stream.eof() )
52 { 50 {
53 lines.append( stream.readLine() ); 51 lines.append( stream.readLine() );
54 } 52 }
55 file.close(); 53 file.close();
56 } 54 }
57 loadValues(); 55 loadValues();
56
58} 57}
59 58
60QString DingWidget::loadedDict() 59QString DingWidget::loadedDict() const
61{ 60{
62 return dictName; 61 return dictName;
63} 62}
64 63
65void DingWidget::setCaseSensitive( bool caseS ) 64void DingWidget::setCaseSensitive( bool caseS )
66{ 65{
67 isCaseSensitive = caseS; 66 isCaseSensitive = caseS;
68} 67}
69 68
70void DingWidget::setDict( QString dict ) 69void DingWidget::setDict( QString dict )
71{ 70{
72 methodname = dict; 71 methodname = dict;
73} 72}
74 73
75void DingWidget::setCompleteWord( bool cword ) 74void DingWidget::setCompleteWord( bool cword )
76{ 75{
77 isCompleteWord = cword; 76 isCompleteWord = cword;
78} 77}
79 78
80void DingWidget::setQueryWord( QString qword ) 79void DingWidget::setQueryWord( QString qword )
81{ 80{
82 queryword = qword; 81 queryword = qword;
83} 82}
84 83
85 84
86void DingWidget::loadValues() 85void DingWidget::loadValues()
87{ 86{
88 if ( !methodname ) return; 87 if ( !methodname ) return;
89 Config cfg( "odict" ); 88 Config cfg( "odict" );
90 cfg.setGroup( "Method_" + methodname ); 89 cfg.setGroup( "Method_" + methodname );
91 trenner = cfg.readEntry( "Seperator" ); 90 trenner = cfg.readEntry( "Seperator" );
92 lang1_name = cfg.readEntry( "Lang1" ); 91 lang1_name = cfg.readEntry( "Lang1" );
93 lang2_name = cfg.readEntry( "Lang2" ); 92 lang2_name = cfg.readEntry( "Lang2" );
94} 93}
95 94
96BroswerContent DingWidget::setText( QString word ) 95BroswerContent DingWidget::setText( QString word )
97{ 96{
98 queryword = word; 97 queryword = word;
99 return parseInfo(); 98 return parseInfo();
100} 99}
101 100
102 101
103BroswerContent DingWidget::parseInfo() 102BroswerContent DingWidget::parseInfo()
104{ 103{
104 qDebug( "bin in DingWidget::parseInfo()" );
105
105 if ( isCompleteWord ) 106 if ( isCompleteWord )
106 queryword = " " + queryword + " "; 107 queryword = " " + queryword + " ";
107 QStringList search = lines.grep( queryword , isCaseSensitive ); 108 QStringList search = lines.grep( queryword , isCaseSensitive );
108 109
109 QString current; 110 QString current;
110 QString left; 111 QString left;
111 QString right; 112 QString right;
112 QRegExp reg_div( trenner ); 113 QRegExp reg_div( trenner );
113 QRegExp reg_word( queryword ); 114 QRegExp reg_word( queryword );
114 reg_word.setCaseSensitive( isCaseSensitive ); 115 reg_word.setCaseSensitive( isCaseSensitive );
115 QStringList toplist, bottomlist; 116 QStringList toplist, bottomlist;
116 QString substitute = "<strong>"+queryword+"</strong>"; 117 QString substitute = "<strong>"+queryword+"</strong>";
117 118
118 for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) 119 for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it )
119 { 120 {
120 current = *it; 121 current = *it;
121 left = current.left( current.find( trenner ) ); 122 left = current.left( current.find( trenner ) );
122 123
123 right = current.right( current.length() - current.find(trenner) - trenner.length() ); 124 right = current.right( current.length() - current.find(trenner) - trenner.length() );
124 125
125 if ( left.contains( queryword , isCaseSensitive ) ) 126 if ( left.contains( queryword , isCaseSensitive ) )
126 { 127 {
127 left.replace( queryword, substitute ); 128 left.replace( queryword, substitute );
128 left = left + " --> " + right; 129 left = left + " --> " + right;
129 toplist.append( left ); 130 toplist.append( left );
130 } 131 }
131 else 132 else
132 { 133 {
133 right.replace( queryword, substitute ); 134 right.replace( queryword, substitute );
134 right = right + " --> " + left; 135 right = right + " --> " + left;
135 bottomlist.append( right ); 136 bottomlist.append( right );
136 } 137 }
137 } 138 }
138 139
139 s_strings.top = toplist.join( "<br>" ); 140 s_strings.top = toplist.join( "<br>" );
140 s_strings.bottom = bottomlist.join( "<br>" ); 141 s_strings.bottom = bottomlist.join( "<br>" );
141 142
142 return s_strings; 143 return s_strings;
143} 144}
diff --git a/noncore/apps/odict/dingwidget.h b/noncore/apps/odict/dingwidget.h
index d8466cb..dbb55e2 100644
--- a/noncore/apps/odict/dingwidget.h
+++ b/noncore/apps/odict/dingwidget.h
@@ -1,50 +1,50 @@
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#include <qstringlist.h> 10#include <qstringlist.h>
11#include <qstring.h> 11#include <qstring.h>
12 12
13struct BroswerContent 13struct BroswerContent
14{ 14{
15 QString top; 15 QString top;
16 QString bottom; 16 QString bottom;
17}; 17};
18 18
19class DingWidget 19class DingWidget
20{ 20{
21 public: 21 public:
22 DingWidget(); 22 DingWidget();
23 23
24 BroswerContent setText( QString ); 24 BroswerContent setText( QString );
25 QStringList lines; 25 QStringList lines;
26 void setCaseSensitive( bool ); 26 void setCaseSensitive( bool );
27 void setCompleteWord( bool ); 27 void setCompleteWord( bool );
28 void loadDict( QString ); 28 void loadDict( QString );
29 QString loadedDict(); 29 QString loadedDict() const;
30 void setQueryWord( QString ); 30 void setQueryWord( QString );
31 void setDict( QString ); 31 void setDict( QString );
32 void loadValues(); 32 void loadValues();
33 33
34 QString lang1_name, 34 QString lang1_name,
35 lang2_name; 35 lang2_name;
36 36
37 bool isCaseSensitive;
37 private: 38 private:
38 BroswerContent parseInfo(); 39 BroswerContent parseInfo();
39 40
40 BroswerContent s_strings; 41 BroswerContent s_strings;
41 bool isCompleteWord; 42 bool isCompleteWord;
42 bool isCaseSensitive;
43 43
44 QString dictName; 44 QString dictName;
45 45
46 QString search_word; 46 QString search_word;
47 QString queryword; 47 QString queryword;
48 QString methodname; 48 QString methodname;
49 QString trenner; 49 QString trenner;
50}; 50};
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp
index cb9c4e0..0745f53 100644
--- a/noncore/apps/odict/odict.cpp
+++ b/noncore/apps/odict/odict.cpp
@@ -1,229 +1,259 @@
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> 21#include <qlayout.h>
22#include <qpopupmenu.h> 22#include <qpopupmenu.h>
23#include <qmenubar.h> 23#include <qmenubar.h>
24#include <qmessagebox.h> 24#include <qmessagebox.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qhbox.h> 26#include <qhbox.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qlineedit.h> 30#include <qlineedit.h>
31#include <qmainwindow.h> 31#include <qmainwindow.h>
32#include <qstring.h> 32#include <qstring.h>
33#include <qaction.h> 33#include <qaction.h>
34#include <qtextbrowser.h> 34#include <qtextbrowser.h>
35#include <qcombobox.h> 35#include <qcombobox.h>
36 36
37#include <qpe/resource.h> 37#include <qpe/resource.h>
38 38
39 39
40ODict::ODict() : QMainWindow() 40ODict::ODict() : QMainWindow()
41{ 41{
42 activated_name = QString::null; 42 activated_name = QString::null;
43 43
44 vbox = new QVBox( this ); 44 vbox = new QVBox( this );
45 setCaption( tr( "OPIE-Dictionary" ) ); 45 setCaption( tr( "OPIE-Dictionary" ) );
46 setupMenus(); 46 setupMenus();
47 47
48 QHBox *hbox = new QHBox( vbox ); 48 QHBox *hbox = new QHBox( vbox );
49 QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); 49 QLabel* query_label = new QLabel( tr( "Query:" ) , hbox );
50 query_label->show(); 50 query_label->show();
51 query_le = new QLineEdit( hbox ); 51 query_le = new QLineEdit( hbox );
52 query_co = new QComboBox( hbox ); 52 query_co = new QComboBox( hbox );
53 connect( query_co , SIGNAL( activated(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) ); 53 connect( query_co , SIGNAL( activated(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) );
54 ok_button = new QPushButton( tr( "&Ok" ), hbox ); 54 ok_button = new QPushButton( tr( "&Ok" ), hbox );
55 connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); 55 connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) );
56
56 top_name = new QLabel( vbox ); 57 top_name = new QLabel( vbox );
58 top_name->setAlignment( AlignHCenter );
57 browser_top = new QTextBrowser( vbox ); 59 browser_top = new QTextBrowser( vbox );
58 bottom_name = new QLabel( vbox ); 60 bottom_name = new QLabel( vbox );
61 bottom_name->setAlignment( AlignHCenter );
59 browser_bottom = new QTextBrowser( vbox ); 62 browser_bottom = new QTextBrowser( vbox );
60 63
61 ding = new DingWidget(); 64 ding = new DingWidget();
62 ding->loadValues(); 65 ding->loadValues();
63 66
64 loadConfig(); 67 loadConfig();
65 setCentralWidget( vbox ); 68 setCentralWidget( vbox );
66} 69}
67 70
68void ODict::loadConfig() 71void ODict::loadConfig()
69{ 72{
73 /*
74 * the name of the last used dictionary
75 */
76 QString lastname;
77
70 Config cfg ( "odict" ); 78 Config cfg ( "odict" );
71 cfg.setGroup( "generalsettings" ); 79 cfg.setGroup( "generalsettings" );
72 errorTol = cfg.readEntry( "errtol" ).toInt();
73 casesens = cfg.readEntry( "casesens" ).toInt(); 80 casesens = cfg.readEntry( "casesens" ).toInt();
74 regexp = cfg.readEntry( "regexp" ).toInt(); 81 regexp = cfg.readEntry( "regexp" ).toInt();
75 completewords = cfg.readEntry( "completewords" ).toInt(); 82 completewords = cfg.readEntry( "completewords" ).toInt();
76 83
84 QString lastDict = cfg.readEntry( "lastdict" );
85 int i = 0, e = 0;
86
77 QStringList groupListCfg = cfg.groupList().grep( "Method_" ); 87 QStringList groupListCfg = cfg.groupList().grep( "Method_" );
78 query_co->clear(); 88 query_co->clear();
79 for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) 89 for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it )
80 { 90 {
91 QString name;
81 cfg.setGroup( *it ); 92 cfg.setGroup( *it );
82 query_co->insertItem( cfg.readEntry( "Name" ) ); 93 name = cfg.readEntry( "Name" );
94 query_co->insertItem( name );
95
96 /*
97 * this check is to look up what dictionary has been used the
98 * last time
99 */
100 if ( lastDict == name )
101 {
102 e = i;
103 lastname = name;
104 }
105 i++;
83 } 106 }
84 //XXXslotMethodChanged( "1" ); //FIXME: this line should not contain a integer 107 /*
108 * now set the two names of the dictionary and the correct QComboBox-Entry
109 */
110
111 lookupLanguageNames( lastname );
112
113 query_co->setCurrentItem( e );
114 top_name->setText( top_name_content );
115 bottom_name->setText( bottom_name_content );
85} 116}
86 117
118void ODict::lookupLanguageNames( QString dictname )
119{
120 Config cfg ( "odict" );
121 cfg.setGroup( "Method_"+dictname );
122 top_name_content = cfg.readEntry( "Lang1" );
123 bottom_name_content = cfg.readEntry( "Lang2" );
124}
87 125
88void ODict::saveConfig() 126void ODict::saveConfig()
89{ 127{
90 Config cfg ( "odict" ); 128 Config cfg ( "odict" );
91 cfg.setGroup( "generalsettings" ); 129 cfg.setGroup( "generalsettings" );
92 cfg.writeEntry( "errtol" , errorTol );
93 cfg.writeEntry( "casesens" , casesens ); 130 cfg.writeEntry( "casesens" , casesens );
94 cfg.writeEntry( "regexp" , regexp ); 131 cfg.writeEntry( "regexp" , regexp );
95 cfg.writeEntry( "completewords" , completewords ); 132 cfg.writeEntry( "completewords" , completewords );
133 cfg.writeEntry( "lastdict" , query_co->currentText() );
96} 134}
97 135
98void ODict::slotStartQuery() 136void ODict::slotStartQuery()
99{ 137{
100 if ( !query_le->text( ).isEmpty() ) 138 qDebug( "bin in slotStartQuery()" );
139
140 QString querystring = query_le->text();
141 if ( !querystring.isEmpty() )
101 { 142 {
102 /* 143 /*
103 * if the user has not yet defined a dictionary 144 * if the user has not yet defined a dictionary
104 */ 145 */
105 if ( !query_co->currentText() ) 146 if ( !query_co->currentText() )
106 { 147 {
107 switch ( QMessageBox::information( this, tr( "OPIE-Dictionary" ), 148 switch ( QMessageBox::information( this, tr( "OPIE-Dictionary" ),
108 tr( "No dictionary defined" ), 149 tr( "No dictionary defined" ),
109 tr( "&Define one" ), 150 tr( "&Define one" ),
110 tr( "&Cancel" ), 151 tr( "&Cancel" ),
111 0, // Define a dict choosen 152 0, // Define a dict choosen
112 1 ) ) // Cancel choosen 153 1 ) ) // Cancel choosen
113 { 154 {
114
115 case 0: 155 case 0:
116 slotSettings(); 156 slotSettings();
117 break; 157 break;
118 case 1: // stop here 158 case 1: // stop here
119 return; 159 return;
120 } 160 }
121 } 161 }
122 162
123 /* 163 /*
124 * ok, the user has defined a dict 164 * ok, the user has defined a dict
125 */ 165 */
126 QString querystring = query_le->text();
127 ding->setCaseSensitive( casesens ); 166 ding->setCaseSensitive( casesens );
128 ding->setCompleteWord( completewords ); 167 ding->setCompleteWord( completewords );
168
169 qDebug( "activated_name ist:" );
170 qDebug( activated_name );
171
129 ding->setDict( activated_name ); 172 ding->setDict( activated_name );
130 top_name->setText( ding->lang1_name );
131 bottom_name->setText( ding->lang2_name );
132 173
133 if ( activated_name != ding->loadedDict() ) 174 //X if ( activated_name != ding->loadedDict() )
134 ding->loadDict(activated_name); 175 ding->loadDict(activated_name);
135 176
136 BroswerContent test = ding->setText( querystring ); 177 BroswerContent test = ding->setText( querystring );
137 178
179 qDebug( querystring );
180 if ( ding->isCaseSensitive )
181 qDebug( "ist CS");
182 else qDebug( "kein CS" );
183
138 browser_top->setText( test.top ); 184 browser_top->setText( test.top );
139 browser_bottom->setText( test.bottom ); 185 browser_bottom->setText( test.bottom );
140 } 186 }
141} 187}
142 188
143
144void ODict::slotSetErrorcount( int count )
145{
146 errorTol = count;
147}
148
149void ODict::slotSettings() 189void ODict::slotSettings()
150{ 190{
151 ConfigDlg dlg( this, "Config" , true); 191 ConfigDlg dlg( this, "Config" , true);
152 if ( dlg.exec() == QDialog::Accepted ) 192 if ( dlg.exec() == QDialog::Accepted )
153 { 193 saveConfig();
154 dlg.writeEntries();
155 loadConfig();
156 }
157} 194}
158 195
159void ODict::slotSetParameter( int count ) 196void ODict::slotSetParameter( int count )
160{ 197{
161 if ( count == 0 ) 198 if ( count == 0 )
162 { 199 {
163 if ( casesens ) 200 if ( casesens )
164 casesens = false; 201 casesens = false;
165 else 202 else
166 casesens = true; 203 casesens = true;
167 } 204 }
168 205
169 if ( count == 1 ) 206 if ( count == 1 )
170 { 207 {
171 if ( completewords ) 208 if ( completewords )
172 completewords = false; 209 completewords = false;
173 else 210 else
174 completewords = true; 211 completewords = true;
175 } 212 }
176 if ( count == 2 ) 213 if ( count == 2 )
177 { 214 {
178 if ( regexp ) 215 if ( regexp )
179 regexp = false; 216 regexp = false;
180 else 217 else
181 regexp = true; 218 regexp = true;
182 } 219 }
183 else qWarning( "ERROR" ); 220 saveConfig();
184} 221}
185 222
186void ODict::slotMethodChanged( const QString& methodnumber ) 223void ODict::slotMethodChanged( const QString& methodnumber )
187{ 224{
188 activated_name = methodnumber; 225 activated_name = methodnumber;
189 226
190 if ( activated_name != ding->loadedDict() ) 227 qDebug( "activated_name in slotMethodChanged() ist:" );
191 ding->loadDict(activated_name); 228 qDebug( activated_name );
192 229
193 top_name->setText( ding->lang1_name ); 230 //X if ( activated_name != ding->loadedDict() )
194 top_name->setAlignment( AlignHCenter ); 231 {
195 bottom_name->setText( ding->lang2_name ); 232 ding->loadDict(activated_name);
196 bottom_name->setAlignment( AlignHCenter ); 233
234 lookupLanguageNames( activated_name );
235 top_name->setText( top_name_content );
236 bottom_name->setText( bottom_name_content );
237 }
197} 238}
198 239
199void ODict::setupMenus() 240void ODict::setupMenus()
200{ 241{
201 menu = new QMenuBar( this ); 242 menu = new QMenuBar( this );
202 243
203 settings = new QPopupMenu( menu ); 244 settings = new QPopupMenu( menu );
204 setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 245 setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
205 connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 246 connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
206 setting_a->addTo( settings ); 247 setting_a->addTo( settings );
207 setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); 248 setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 );
208 249
209 parameter = new QPopupMenu( menu ); 250 parameter = new QPopupMenu( menu );
210 connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); 251 connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) );
211 parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); 252 parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 );
212 parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ; 253 parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ;
213 parameter->insertItem( tr( "Allow &reg. expressions" ), 2 ); 254 parameter->insertItem( tr( "Allow &reg. expressions" ), 2 );
214 parameter->insertSeparator(); 255 parameter->insertSeparator();
215 error_tol_menu = new QPopupMenu( menu );
216 error_tol_menu->setCheckable( TRUE );
217 connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) );
218
219 error_tol_menu->insertItem( tr( "0 Errors" ), 0 );
220 error_tol_menu->insertItem( tr( "1 Errors" ), 1 );
221 error_tol_menu->insertItem( tr( "2 Errors" ), 2 );
222 error_tol_menu->insertItem( tr( "3 Errors" ), 3 );
223 error_tol_menu->insertItem( tr( "4 Errors" ), 4 );
224 error_tol_menu->insertItem( tr( "Until Hit" ), 5 );
225 parameter->insertItem( tr( "&Error tolerance" ), error_tol_menu );
226 256
227 menu->insertItem( tr( "Settings" ) , settings ); 257 menu->insertItem( tr( "Settings" ) , settings );
228 menu->insertItem( tr( "Parameter" ) , parameter ); 258 menu->insertItem( tr( "Parameter" ) , parameter );
229} 259}
diff --git a/noncore/apps/odict/odict.h b/noncore/apps/odict/odict.h
index b9a0778..9c037ea 100644
--- a/noncore/apps/odict/odict.h
+++ b/noncore/apps/odict/odict.h
@@ -1,68 +1,70 @@
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#include <qmainwindow.h> 10#include <qmainwindow.h>
11 11
12class QLabel; 12class QLabel;
13class QVBox; 13class QVBox;
14class QPopupMenu; 14class QPopupMenu;
15class QMenuBar; 15class QMenuBar;
16class QHBox; 16class QHBox;
17class QPushButton; 17class QPushButton;
18class QLineEdit; 18class QLineEdit;
19class QAction; 19class QAction;
20class QVBoxLayout; 20class QVBoxLayout;
21class QActionGroup; 21class QActionGroup;
22class DingWidget; 22class DingWidget;
23class QTextBrowser; 23class QTextBrowser;
24class QComboBox; 24class QComboBox;
25class DingWidget; 25class DingWidget;
26 26
27class ODict : public QMainWindow 27class ODict : public QMainWindow
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30 30
31 public: 31 public:
32 ODict(); 32 ODict();
33 QVBox *vbox; 33 QVBox *vbox;
34 QTextBrowser *browser_top, 34 QTextBrowser *browser_top,
35 *browser_bottom; 35 *browser_bottom;
36 DingWidget *ding; 36 DingWidget *ding;
37 37
38 private: 38 private:
39 QPopupMenu *help, *settings, *parameter, *error_tol_menu; 39 QPopupMenu *help, *settings, *parameter;
40 QMenuBar *menu; 40 QMenuBar *menu;
41 QHBox *hbox; 41 QHBox *hbox;
42 QLineEdit *query_le; 42 QLineEdit *query_le;
43 QComboBox *query_co; 43 QComboBox *query_co;
44 QPushButton *ok_button; 44 QPushButton *ok_button;
45 45
46 QVBoxLayout *vbox_layout; 46 QVBoxLayout *vbox_layout;
47 47
48 QAction *setting_a, *setting_b; 48 QAction *setting_a, *setting_b;
49 49
50 void setupMenus(); 50 void setupMenus();
51 51
52 int errorTol;
53 bool casesens, completewords, regexp; 52 bool casesens, completewords, regexp;
54 53
55 void loadConfig(); 54 void loadConfig();
56 void saveConfig(); 55 void saveConfig();
57 56
58 QString activated_name; 57 QString activated_name;
59 QLabel *bottom_name, 58 QLabel *bottom_name,
60 *top_name; 59 *top_name;
60
61 QString top_name_content, bottom_name_content;
62
63 void lookupLanguageNames( QString );
61 64
62 private slots: 65 private slots:
63 void slotStartQuery(); 66 void slotStartQuery();
64 void slotSetErrorcount( int );
65 void slotSettings(); 67 void slotSettings();
66 void slotSetParameter( int ); 68 void slotSetParameter( int );
67 void slotMethodChanged( const QString& ); 69 void slotMethodChanged( const QString& );
68}; 70};
diff --git a/noncore/apps/odict/searchmethoddlg.cpp b/noncore/apps/odict/searchmethoddlg.cpp
index 8a14703..99cd8db 100644
--- a/noncore/apps/odict/searchmethoddlg.cpp
+++ b/noncore/apps/odict/searchmethoddlg.cpp
@@ -1,108 +1,108 @@
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#include <qdir.h> 29#include <qdir.h>
30 30
31#include <opie/ofileselector.h> 31#include <opie/ofileselector.h>
32#include <opie/ofiledialog.h> 32#include <opie/ofiledialog.h>
33 33
34SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal) 34SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal)
35{ 35{
36 36
37 QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" ); 37 QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" );
38 QVBox *vbox = new QVBox( this ); 38 QVBox *vbox = new QVBox( this );
39 39
40 QHBox *hbox1 = new QHBox( vbox ); 40 QHBox *hbox1 = new QHBox( vbox );
41 QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 ); 41 QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 );
42 nameLE = new QLineEdit( hbox1 ); 42 nameLE = new QLineEdit( hbox1 );
43 43
44 QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox ); 44 QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox );
45 QHBox *hbox2 = new QHBox( vbox ); 45 QHBox *hbox2 = new QHBox( vbox );
46 dictFileLE = new QLineEdit( hbox2 ); 46 dictFileLE = new QLineEdit( hbox2 );
47 QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 ); 47 QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 );
48 connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) ); 48 connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) );
49 49
50 QWidget *dummywidget = new QWidget( vbox ); 50 QWidget *dummywidget = new QWidget( vbox );
51 QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget); 51 QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget);
52 QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget); 52 QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget);
53 QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget); 53 QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget);
54 lang1 = new QLineEdit( dummywidget ); 54 lang1 = new QLineEdit( dummywidget );
55 lang2 = new QLineEdit( dummywidget ); 55 lang2 = new QLineEdit( dummywidget );
56 trenner = new QLineEdit( dummywidget ); 56 trenner = new QLineEdit( dummywidget );
57 trenner->setText( "::" ); 57 trenner->setText( "::" );
58 58
59 QGridLayout *grid = new QGridLayout( dummywidget, 2,3 ); 59 QGridLayout *grid = new QGridLayout( dummywidget, 2,3 );
60 grid->addWidget( lag1, 0,0 ); 60 grid->addWidget( lag1, 0,0 );
61 grid->addWidget( devider, 0,1 ); 61 grid->addWidget( devider, 0,1 );
62 grid->addWidget( lag2, 0,2 ); 62 grid->addWidget( lag2, 0,2 );
63 grid->addWidget( lang1, 1,0 ); 63 grid->addWidget( lang1, 1,0 );
64 grid->addWidget( trenner, 1,1 ); 64 grid->addWidget( trenner, 1,1 );
65 grid->addWidget( lang2, 1,2 ); 65 grid->addWidget( lang2, 1,2 );
66 66
67 vbox_layout->addWidget( vbox ); 67 vbox_layout->addWidget( vbox );
68 68
69 showMaximized(); 69 showMaximized();
70 70
71 if( !itemname ) 71 if( !itemname )
72 setCaption( tr( "New Searchmethod" ) ); 72 setCaption( tr( "New Searchmethod" ) );
73 else 73 else
74 { 74 {
75 setCaption( tr( "Change Searchmethod" ) ); 75 setCaption( tr( "Change Searchmethod" ) );
76 itemName = itemname; 76 itemName = itemname;
77 setupEntries(itemname); 77 setupEntries(itemname);
78 } 78 }
79} 79}
80 80
81void SearchMethodDlg::setupEntries( QString item ) 81void SearchMethodDlg::setupEntries( QString item )
82{ 82{
83 Config cfg( "odict" ); 83 Config cfg( "odict" );
84 cfg.setGroup( "Method_"+itemName ); 84 cfg.setGroup( "Method_"+itemName );
85 trenner->setText( cfg.readEntry( "Seperator" ) ); 85 trenner->setText( cfg.readEntry( "Seperator" ) );
86 lang1->setText( cfg.readEntry( "Lang1" ) ); 86 lang1->setText( cfg.readEntry( "Lang1" ) );
87 lang2->setText( cfg.readEntry( "Lang2" ) ); 87 lang2->setText( cfg.readEntry( "Lang2" ) );
88 nameLE->setText( itemName ); 88 nameLE->setText( itemName );
89 dictFileLE->setText( cfg.readEntry( "file" ) ); 89 dictFileLE->setText( cfg.readEntry( "file" ) );
90} 90}
91 91
92void SearchMethodDlg::slotBrowse() 92void SearchMethodDlg::slotBrowse()
93{ 93{
94 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,QDir::homeDirPath()); 94 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,QDir::homeDirPath());
95 dictFileLE->setText( itemName ); 95 dictFileLE->setText( itemName );
96} 96}
97 97
98void SearchMethodDlg::saveItem() 98void SearchMethodDlg::saveItem()
99{ 99{
100 QString name = nameLE->text(); 100 QString name = nameLE->text();
101 Config cfg( "odict" ); 101 Config cfg( "odict" );
102 cfg.setGroup( "Method_"+name ); 102 cfg.setGroup( "Method_"+name );
103 cfg.writeEntry( "Name", name ); 103 cfg.writeEntry( "Name", name );
104 cfg.writeEntry( "Seperator", trenner->text() ); 104 cfg.writeEntry( "Seperator", trenner->text() );
105 cfg.writeEntry( "Lang1", lang1->text() ); 105 cfg.writeEntry( "Lang1", lang1->text() );
106 cfg.writeEntry( "Lang2", lang2->text() ); 106 cfg.writeEntry( "Lang2", lang2->text() );
107 cfg.writeEntry( "file", dictFileLE->text() ); 107 cfg.writeEntry( "file", dictFileLE->text() );
108} 108}
diff --git a/noncore/apps/odict/searchmethoddlg.h b/noncore/apps/odict/searchmethoddlg.h
index d98842f..706bbc1 100644
--- a/noncore/apps/odict/searchmethoddlg.h
+++ b/noncore/apps/odict/searchmethoddlg.h
@@ -1,40 +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
10class QWidget; 10class QWidget;
11class QLineEdit; 11class QLineEdit;
12class OTabWidget; 12class OTabWidget;
13class QListView; 13class QListView;
14class QPushButton; 14class QPushButton;
15class QLabel; 15class QLabel;
16class QString; 16class QString;
17 17
18#include <qdialog.h> 18#include <qdialog.h>
19 19
20
21class SearchMethodDlg : public QDialog 20class SearchMethodDlg : public QDialog
22{ 21{
23 Q_OBJECT 22 Q_OBJECT
24 23
25 public: 24 public:
26 SearchMethodDlg(QWidget *parent, const char *name, bool modal=FALSE, QString itemname=0 ); 25 SearchMethodDlg(QWidget *parent, const char *name, bool modal=FALSE, QString itemname=0 );
27 26
28 QString itemName; 27 QString itemName;
29 QLineEdit *nameLE; 28 QLineEdit *nameLE;
30 QLineEdit *lang1, *lang2, *trenner; 29 QLineEdit *lang1, *lang2, *trenner;
31 void saveItem(); 30 void saveItem();
32 31
33 private: 32 private:
34 QLineEdit *dictFileLE; 33 QLineEdit *dictFileLE;
35 void setupEntries( QString ); 34 void setupEntries( QString );
36 35
37 private slots: 36 private slots:
38 void slotBrowse(); 37 void slotBrowse();
39 38
40}; 39};