-rw-r--r-- | noncore/apps/odict/dingwidget.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/odict/dingwidget.h | 3 | ||||
-rw-r--r-- | noncore/apps/odict/odict.cpp | 6 |
3 files changed, 8 insertions, 10 deletions
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp index 55a716d..c804385 100644 --- a/noncore/apps/odict/dingwidget.cpp +++ b/noncore/apps/odict/dingwidget.cpp | |||
@@ -1,132 +1,135 @@ | |||
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> | 21 | #include <qstring.h> |
22 | #include <qtextstream.h> | 22 | #include <qtextstream.h> |
23 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
24 | #include <qregexp.h> | 24 | #include <qregexp.h> |
25 | 25 | ||
26 | DingWidget::DingWidget( ) | 26 | DingWidget::DingWidget( ) |
27 | { | 27 | { |
28 | methodname = QString::null; | 28 | methodname = QString::null; |
29 | trenner = QString::null; | 29 | trenner = QString::null; |
30 | lines = 0L; | 30 | lines = 0L; |
31 | } | 31 | } |
32 | 32 | ||
33 | void DingWidget::loadDict( QString name ) | 33 | void DingWidget::loadDict( QString name ) |
34 | { | 34 | { |
35 | lines.clear(); //as we will load a new list we have to | 35 | lines.clear(); //as we will load a new list we have to |
36 | //remove the old one | 36 | //remove the old one |
37 | qDebug( "DingWidget::loadDict( ... )" ); | ||
38 | 37 | ||
39 | Config cfg( "odict" ); | 38 | Config cfg( "odict" ); |
40 | cfg.setGroup( "Method_" + name ); | 39 | cfg.setGroup( "Method_" + name ); |
41 | QFile file( cfg.readEntry( "file" ) ); | 40 | QFile file( cfg.readEntry( "file" ) ); |
42 | 41 | ||
43 | if( file.open( IO_ReadOnly ) ) | 42 | if( file.open( IO_ReadOnly ) ) |
44 | { | 43 | { |
45 | QTextStream stream( &file ); | 44 | QTextStream stream( &file ); |
46 | while ( !stream.eof() ) | 45 | while ( !stream.eof() ) |
47 | { | 46 | { |
48 | lines.append( stream.readLine() ); | 47 | lines.append( stream.readLine() ); |
49 | } | 48 | } |
50 | file.close(); | 49 | file.close(); |
51 | } | 50 | } |
51 | |||
52 | setDict( name ); | ||
53 | |||
52 | loadValues(); | 54 | loadValues(); |
53 | } | 55 | } |
54 | 56 | ||
55 | QString DingWidget::loadedDict() const | 57 | QString DingWidget::loadedDict() const |
56 | { | 58 | { |
57 | return dictName; | 59 | return dictName; |
58 | } | 60 | } |
59 | 61 | ||
60 | void DingWidget::setCaseSensitive( bool caseS ) | 62 | void DingWidget::setCaseSensitive( bool caseS ) |
61 | { | 63 | { |
62 | isCaseSensitive = caseS; | 64 | isCaseSensitive = caseS; |
63 | } | 65 | } |
64 | 66 | ||
65 | void DingWidget::setDict( QString dict ) | 67 | void DingWidget::setDict( QString dict ) |
66 | { | 68 | { |
67 | methodname = dict; | 69 | methodname = dict; |
68 | } | 70 | } |
69 | 71 | ||
70 | void DingWidget::setQueryWord( QString qword ) | 72 | void DingWidget::setQueryWord( QString qword ) |
71 | { | 73 | { |
72 | queryword = qword; | 74 | queryword = qword; |
73 | } | 75 | } |
74 | 76 | ||
75 | 77 | ||
76 | void DingWidget::loadValues() | 78 | void DingWidget::loadValues() |
77 | { | 79 | { |
78 | if ( !methodname ) return; | 80 | if ( !methodname ) return; |
79 | Config cfg( "odict" ); | 81 | Config cfg( "odict" ); |
80 | cfg.setGroup( "Method_" + methodname ); | 82 | cfg.setGroup( "Method_" + methodname ); |
81 | trenner = cfg.readEntry( "Seperator" ); | 83 | trenner = cfg.readEntry( "Seperator" ); |
84 | |||
82 | lang1_name = cfg.readEntry( "Lang1" ); | 85 | lang1_name = cfg.readEntry( "Lang1" ); |
83 | lang2_name = cfg.readEntry( "Lang2" ); | 86 | lang2_name = cfg.readEntry( "Lang2" ); |
84 | } | 87 | } |
85 | 88 | ||
86 | BroswerContent DingWidget::setText( QString word ) | 89 | BroswerContent DingWidget::setText( QString word ) |
87 | { | 90 | { |
88 | queryword = word; | 91 | queryword = word; |
89 | return parseInfo(); | 92 | return parseInfo(); |
90 | } | 93 | } |
91 | 94 | ||
92 | 95 | ||
93 | BroswerContent DingWidget::parseInfo() | 96 | BroswerContent DingWidget::parseInfo() |
94 | { | 97 | { |
95 | QStringList search = lines.grep( queryword , isCaseSensitive ); | 98 | QStringList search = lines.grep( queryword , isCaseSensitive ); |
96 | 99 | ||
97 | QString current; | 100 | QString current; |
98 | QString left; | 101 | QString left; |
99 | QString right; | 102 | QString right; |
100 | QRegExp reg_div( trenner ); | 103 | QRegExp reg_div( trenner ); |
101 | QRegExp reg_word( queryword ); | 104 | QRegExp reg_word( queryword ); |
102 | reg_word.setCaseSensitive( isCaseSensitive ); | 105 | reg_word.setCaseSensitive( isCaseSensitive ); |
103 | QStringList toplist, bottomlist; | 106 | QStringList toplist, bottomlist; |
104 | QString substitute = "<strong>"+queryword+"</strong>"; | 107 | QString substitute = "<strong>"+queryword+"</strong>"; |
105 | 108 | ||
106 | for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) | 109 | for( QStringList::Iterator it = search.begin() ; it != search.end() ; ++it ) |
107 | { | 110 | { |
108 | current = *it; | 111 | current = *it; |
109 | left = current.left( current.find( trenner ) ); | 112 | left = current.left( current.find( trenner ) ); |
110 | 113 | ||
111 | right = current.right( current.length() - current.find(trenner) - trenner.length() ); | 114 | right = current.right( current.length() - current.find(trenner) - trenner.length() ); |
112 | 115 | ||
113 | if ( left.contains( queryword , isCaseSensitive ) ) | 116 | if ( left.contains( queryword , isCaseSensitive ) ) |
114 | { | 117 | { |
115 | left.replace( queryword, substitute ); | 118 | left.replace( queryword, substitute ); |
116 | left = left + " --> " + right; | 119 | left = left + " --> " + right; |
117 | toplist.append( left ); | 120 | toplist.append( left ); |
118 | } | 121 | } |
119 | else | 122 | else if( right.contains( queryword , isCaseSensitive ) ) |
120 | { | 123 | { |
121 | right.replace( queryword, substitute ); | 124 | right.replace( queryword, substitute ); |
122 | right = right + " --> " + left; | 125 | right = right + " --> " + left; |
123 | bottomlist.append( right ); | 126 | bottomlist.append( right ); |
124 | } | 127 | } |
125 | } | 128 | } |
126 | 129 | ||
127 | s_strings.top = toplist.join( "<br>" ); | 130 | s_strings.top = toplist.join( "<br>" ); |
128 | s_strings.bottom = bottomlist.join( "<br>" ); | 131 | s_strings.bottom = bottomlist.join( "<br>" ); |
129 | 132 | ||
130 | return s_strings; | 133 | return s_strings; |
131 | } | 134 | } |
132 | 135 | ||
diff --git a/noncore/apps/odict/dingwidget.h b/noncore/apps/odict/dingwidget.h index dbb55e2..9163a43 100644 --- a/noncore/apps/odict/dingwidget.h +++ b/noncore/apps/odict/dingwidget.h | |||
@@ -1,50 +1,49 @@ | |||
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 | ||
13 | struct BroswerContent | 13 | struct BroswerContent |
14 | { | 14 | { |
15 | QString top; | 15 | QString top; |
16 | QString bottom; | 16 | QString bottom; |
17 | }; | 17 | }; |
18 | 18 | ||
19 | class DingWidget | 19 | class 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 ); | ||
28 | void loadDict( QString ); | 27 | void loadDict( QString ); |
29 | QString loadedDict() const; | 28 | QString loadedDict() const; |
30 | void setQueryWord( QString ); | 29 | void setQueryWord( QString ); |
31 | void setDict( QString ); | 30 | void setDict( QString ); |
32 | void loadValues(); | 31 | void loadValues(); |
33 | 32 | ||
34 | QString lang1_name, | 33 | QString lang1_name, |
35 | lang2_name; | 34 | lang2_name; |
36 | 35 | ||
37 | bool isCaseSensitive; | 36 | bool isCaseSensitive; |
37 | |||
38 | private: | 38 | private: |
39 | BroswerContent parseInfo(); | 39 | BroswerContent parseInfo(); |
40 | 40 | ||
41 | BroswerContent s_strings; | 41 | BroswerContent s_strings; |
42 | bool isCompleteWord; | ||
43 | 42 | ||
44 | QString dictName; | 43 | QString dictName; |
45 | 44 | ||
46 | QString search_word; | 45 | QString search_word; |
47 | QString queryword; | 46 | QString queryword; |
48 | QString methodname; | 47 | QString methodname; |
49 | QString trenner; | 48 | QString trenner; |
50 | }; | 49 | }; |
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index c1de6ac..2028701 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -16,219 +16,215 @@ | |||
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 <qhbox.h> | 25 | #include <qhbox.h> |
26 | #include <qvbox.h> | 26 | #include <qvbox.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
30 | #include <qmainwindow.h> | 30 | #include <qmainwindow.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qaction.h> | 32 | #include <qaction.h> |
33 | #include <qtextbrowser.h> | 33 | #include <qtextbrowser.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | 35 | ||
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
38 | 38 | ||
39 | ODict::ODict() : QMainWindow() | 39 | ODict::ODict() : QMainWindow() |
40 | { | 40 | { |
41 | activated_name = QString::null; | 41 | activated_name = QString::null; |
42 | 42 | ||
43 | vbox = new QVBox( this ); | 43 | vbox = new QVBox( this ); |
44 | setCaption( tr( "OPIE-Dictionary" ) ); | 44 | setCaption( tr( "OPIE-Dictionary" ) ); |
45 | setupMenus(); | 45 | setupMenus(); |
46 | 46 | ||
47 | QHBox *hbox = new QHBox( vbox ); | 47 | QHBox *hbox = new QHBox( vbox ); |
48 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); | 48 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); |
49 | query_label->show(); | 49 | query_label->show(); |
50 | query_le = new QLineEdit( hbox ); | 50 | query_le = new QLineEdit( hbox ); |
51 | query_co = new QComboBox( hbox ); | 51 | query_co = new QComboBox( hbox ); |
52 | connect( query_co , SIGNAL( activated(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) ); | 52 | connect( query_co , SIGNAL( activated(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) ); |
53 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); | 53 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); |
54 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); | 54 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); |
55 | 55 | ||
56 | top_name = new QLabel( vbox ); | 56 | top_name = new QLabel( vbox ); |
57 | top_name->setAlignment( AlignHCenter ); | 57 | top_name->setAlignment( AlignHCenter ); |
58 | browser_top = new QTextBrowser( vbox ); | 58 | browser_top = new QTextBrowser( vbox ); |
59 | bottom_name = new QLabel( vbox ); | 59 | bottom_name = new QLabel( vbox ); |
60 | bottom_name->setAlignment( AlignHCenter ); | 60 | bottom_name->setAlignment( AlignHCenter ); |
61 | browser_bottom = new QTextBrowser( vbox ); | 61 | browser_bottom = new QTextBrowser( vbox ); |
62 | 62 | ||
63 | ding = new DingWidget(); | 63 | ding = new DingWidget(); |
64 | ding->loadValues(); | ||
65 | 64 | ||
66 | loadConfig(); | 65 | loadConfig(); |
67 | setCentralWidget( vbox ); | 66 | setCentralWidget( vbox ); |
68 | } | 67 | } |
69 | 68 | ||
70 | void ODict::loadConfig() | 69 | void ODict::loadConfig() |
71 | { | 70 | { |
72 | /* | 71 | /* |
73 | * the name of the last used dictionary | 72 | * the name of the last used dictionary |
74 | */ | 73 | */ |
75 | QString lastname; | 74 | QString lastname; |
76 | 75 | ||
77 | Config cfg ( "odict" ); | 76 | Config cfg ( "odict" ); |
78 | cfg.setGroup( "generalsettings" ); | 77 | cfg.setGroup( "generalsettings" ); |
79 | casesens = cfg.readEntry( "casesens" ).toInt(); | 78 | casesens = cfg.readEntry( "casesens" ).toInt(); |
80 | regexp = cfg.readEntry( "regexp" ).toInt(); | 79 | regexp = cfg.readEntry( "regexp" ).toInt(); |
81 | 80 | ||
82 | QString lastDict = cfg.readEntry( "lastdict" ); | 81 | QString lastDict = cfg.readEntry( "lastdict" ); |
83 | int i = 0, e = 0; | 82 | int i = 0, e = 0; |
84 | 83 | ||
85 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); | 84 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); |
86 | query_co->clear(); | 85 | query_co->clear(); |
87 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) | 86 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) |
88 | { | 87 | { |
89 | QString name; | 88 | QString name; |
90 | cfg.setGroup( *it ); | 89 | cfg.setGroup( *it ); |
91 | name = cfg.readEntry( "Name" ); | 90 | name = cfg.readEntry( "Name" ); |
92 | query_co->insertItem( name ); | 91 | query_co->insertItem( name ); |
93 | 92 | ||
94 | /* | 93 | /* |
95 | * this check is to look up what dictionary has been used the | 94 | * this check is to look up what dictionary has been used the |
96 | * last time | 95 | * last time |
97 | */ | 96 | */ |
98 | if ( lastDict == name ) | 97 | if ( lastDict == name ) |
99 | { | 98 | { |
100 | e = i; | 99 | e = i; |
101 | lastname = name; | 100 | lastname = name; |
102 | } | 101 | } |
103 | i++; | 102 | i++; |
104 | } | 103 | } |
105 | /* | 104 | /* |
106 | * now set the two names of the dictionary and the correct QComboBox-Entry | 105 | * now set the two names of the dictionary and the correct QComboBox-Entry |
107 | */ | 106 | */ |
108 | 107 | ||
109 | lookupLanguageNames( lastname ); | 108 | lookupLanguageNames( lastname ); |
110 | ding->loadDict( lastname ); | 109 | ding->loadDict( lastname ); |
110 | ding->loadValues(); | ||
111 | 111 | ||
112 | query_co->setCurrentItem( e ); | 112 | query_co->setCurrentItem( e ); |
113 | top_name->setText( top_name_content ); | 113 | top_name->setText( top_name_content ); |
114 | bottom_name->setText( bottom_name_content ); | 114 | bottom_name->setText( bottom_name_content ); |
115 | } | 115 | } |
116 | 116 | ||
117 | void ODict::lookupLanguageNames( QString dictname ) | 117 | void ODict::lookupLanguageNames( QString dictname ) |
118 | { | 118 | { |
119 | Config cfg ( "odict" ); | 119 | Config cfg ( "odict" ); |
120 | cfg.setGroup( "Method_"+dictname ); | 120 | cfg.setGroup( "Method_"+dictname ); |
121 | top_name_content = cfg.readEntry( "Lang1" ); | 121 | top_name_content = cfg.readEntry( "Lang1" ); |
122 | bottom_name_content = cfg.readEntry( "Lang2" ); | 122 | bottom_name_content = cfg.readEntry( "Lang2" ); |
123 | } | 123 | } |
124 | 124 | ||
125 | void ODict::saveConfig() | 125 | void ODict::saveConfig() |
126 | { | 126 | { |
127 | Config cfg ( "odict" ); | 127 | Config cfg ( "odict" ); |
128 | cfg.setGroup( "generalsettings" ); | 128 | cfg.setGroup( "generalsettings" ); |
129 | cfg.writeEntry( "casesens" , casesens ); | 129 | cfg.writeEntry( "casesens" , casesens ); |
130 | cfg.writeEntry( "regexp" , regexp ); | 130 | cfg.writeEntry( "regexp" , regexp ); |
131 | cfg.writeEntry( "lastdict" , query_co->currentText() ); | 131 | cfg.writeEntry( "lastdict" , query_co->currentText() ); |
132 | } | 132 | } |
133 | 133 | ||
134 | void ODict::slotStartQuery() | 134 | void ODict::slotStartQuery() |
135 | { | 135 | { |
136 | QString querystring = query_le->text(); | 136 | QString querystring = query_le->text(); |
137 | if ( !querystring.isEmpty() ) | 137 | if ( !querystring.isEmpty() ) |
138 | { | 138 | { |
139 | /* | 139 | /* |
140 | * if the user has not yet defined a dictionary | 140 | * if the user has not yet defined a dictionary |
141 | */ | 141 | */ |
142 | if ( !query_co->currentText() ) | 142 | if ( !query_co->currentText() ) |
143 | { | 143 | { |
144 | switch ( QMessageBox::information( this, tr( "OPIE-Dictionary" ), | 144 | switch ( QMessageBox::information( this, tr( "OPIE-Dictionary" ), |
145 | tr( "No dictionary defined" ), | 145 | tr( "No dictionary defined" ), |
146 | tr( "&Define one" ), | 146 | tr( "&Define one" ), |
147 | tr( "&Cancel" ), | 147 | tr( "&Cancel" ), |
148 | 0, // Define a dict | 148 | 0, // Define a dict |
149 | 1 ) ) // Cancel choosen | 149 | 1 ) ) // Cancel choosen |
150 | { | 150 | { |
151 | case 0: | 151 | case 0: |
152 | slotSettings(); | 152 | slotSettings(); |
153 | break; | 153 | break; |
154 | case 1: // stop here | 154 | case 1: // stop here |
155 | return; | 155 | return; |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | /* | 159 | /* |
160 | * ok, the user has defined a dict | 160 | * ok, the user has defined a dict |
161 | */ | 161 | */ |
162 | ding->setCaseSensitive( casesens ); | 162 | ding->setCaseSensitive( casesens ); |
163 | 163 | ||
164 | BroswerContent test = ding->setText( querystring ); | 164 | BroswerContent test = ding->setText( querystring ); |
165 | 165 | ||
166 | browser_top->setText( test.top ); | 166 | browser_top->setText( test.top ); |
167 | browser_bottom->setText( test.bottom ); | 167 | browser_bottom->setText( test.bottom ); |
168 | } | 168 | } |
169 | } | 169 | } |
170 | 170 | ||
171 | void ODict::slotSettings() | 171 | void ODict::slotSettings() |
172 | { | 172 | { |
173 | ConfigDlg dlg( this, "Config" , true); | 173 | ConfigDlg dlg( this, "Config" , true); |
174 | if ( dlg.exec() == QDialog::Accepted ) | 174 | if ( dlg.exec() == QDialog::Accepted ) |
175 | saveConfig(); | 175 | saveConfig(); |
176 | } | 176 | } |
177 | 177 | ||
178 | void ODict::slotSetParameter( int count ) | 178 | void ODict::slotSetParameter( int count ) |
179 | { | 179 | { |
180 | if ( count == 0 ) | 180 | if ( count == 0 ) |
181 | { | 181 | { |
182 | if ( casesens ) | 182 | if ( casesens ) |
183 | casesens = false; | 183 | casesens = false; |
184 | else | 184 | else |
185 | casesens = true; | 185 | casesens = true; |
186 | } | 186 | } |
187 | 187 | ||
188 | if ( count == 1 ) | 188 | if ( count == 1 ) |
189 | { | 189 | { |
190 | if ( regexp ) | 190 | if ( regexp ) |
191 | regexp = false; | 191 | regexp = false; |
192 | else | 192 | else |
193 | regexp = true; | 193 | regexp = true; |
194 | } | 194 | } |
195 | saveConfig(); | 195 | saveConfig(); |
196 | } | 196 | } |
197 | 197 | ||
198 | void ODict::slotMethodChanged( const QString& methodnumber ) | 198 | void ODict::slotMethodChanged( const QString& methodnumber ) |
199 | { | 199 | { |
200 | activated_name = methodnumber; | 200 | activated_name = methodnumber; |
201 | 201 | ||
202 | qDebug( "activated_name in slotMethodChanged() ist:" ); | ||
203 | qDebug( activated_name ); | ||
204 | qDebug( ding->loadedDict() ); | ||
205 | |||
206 | if ( activated_name != ding->loadedDict() ) | 202 | if ( activated_name != ding->loadedDict() ) |
207 | { | 203 | { |
208 | ding->loadDict(activated_name); | 204 | ding->loadDict(activated_name); |
209 | 205 | ||
210 | lookupLanguageNames( activated_name ); | 206 | lookupLanguageNames( activated_name ); |
211 | top_name->setText( top_name_content ); | 207 | top_name->setText( top_name_content ); |
212 | bottom_name->setText( bottom_name_content ); | 208 | bottom_name->setText( bottom_name_content ); |
213 | } | 209 | } |
214 | } | 210 | } |
215 | 211 | ||
216 | void ODict::setupMenus() | 212 | void ODict::setupMenus() |
217 | { | 213 | { |
218 | menu = new QMenuBar( this ); | 214 | menu = new QMenuBar( this ); |
219 | 215 | ||
220 | settings = new QPopupMenu( menu ); | 216 | settings = new QPopupMenu( menu ); |
221 | setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 217 | setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
222 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 218 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
223 | setting_a->addTo( settings ); | 219 | setting_a->addTo( settings ); |
224 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); | 220 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); |
225 | 221 | ||
226 | parameter = new QPopupMenu( menu ); | 222 | parameter = new QPopupMenu( menu ); |
227 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); | 223 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); |
228 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); | 224 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); |
229 | parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); | 225 | parameter->insertItem( tr( "Allow ®. expressions" ), 2 ); |
230 | parameter->insertSeparator(); | 226 | parameter->insertSeparator(); |
231 | 227 | ||
232 | menu->insertItem( tr( "Settings" ) , settings ); | 228 | menu->insertItem( tr( "Settings" ) , settings ); |
233 | menu->insertItem( tr( "Parameter" ) , parameter ); | 229 | menu->insertItem( tr( "Parameter" ) , parameter ); |
234 | } | 230 | } |