summaryrefslogtreecommitdiff
path: root/noncore/apps/odict/odict.cpp
Unidiff
Diffstat (limited to 'noncore/apps/odict/odict.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/odict.cpp6
1 files changed, 1 insertions, 5 deletions
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
@@ -40,95 +40,95 @@ 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
70void ODict::loadConfig() 69void 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
117void ODict::lookupLanguageNames( QString dictname ) 117void 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
125void ODict::saveConfig() 125void 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
134void ODict::slotStartQuery() 134void ODict::slotStartQuery()
@@ -178,52 +178,48 @@ void ODict::slotSettings()
178void ODict::slotSetParameter( int count ) 178void 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
198void ODict::slotMethodChanged( const QString& methodnumber ) 198void 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
216void ODict::setupMenus() 212void 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 &reg. expressions" ), 2 ); 225 parameter->insertItem( tr( "Allow &reg. expressions" ), 2 );