summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/odict.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp
index cc3148a..9f9a8d9 100644
--- a/noncore/apps/odict/odict.cpp
+++ b/noncore/apps/odict/odict.cpp
@@ -57,64 +57,88 @@ ODict::ODict() : QMainWindow()
57 57
58 ding = new DingWidget(); 58 ding = new DingWidget();
59 ding->loadValues(); 59 ding->loadValues();
60 60
61 loadConfig(); 61 loadConfig();
62 setCentralWidget( vbox ); 62 setCentralWidget( vbox );
63} 63}
64 64
65void ODict::loadConfig() 65void ODict::loadConfig()
66{ 66{
67 Config cfg ( "odict" ); 67 Config cfg ( "odict" );
68 cfg.setGroup( "generalsettings" ); 68 cfg.setGroup( "generalsettings" );
69 errorTol = cfg.readEntry( "errtol" ).toInt(); 69 errorTol = cfg.readEntry( "errtol" ).toInt();
70 casesens = cfg.readEntry( "casesens" ).toInt(); 70 casesens = cfg.readEntry( "casesens" ).toInt();
71 regexp = cfg.readEntry( "regexp" ).toInt(); 71 regexp = cfg.readEntry( "regexp" ).toInt();
72 completewords = cfg.readEntry( "completewords" ).toInt(); 72 completewords = cfg.readEntry( "completewords" ).toInt();
73 73
74 QStringList groupListCfg = cfg.groupList().grep( "Method_" ); 74 QStringList groupListCfg = cfg.groupList().grep( "Method_" );
75 query_co->clear(); 75 query_co->clear();
76 for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) 76 for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it )
77 { 77 {
78 cfg.setGroup( *it ); 78 cfg.setGroup( *it );
79 query_co->insertItem( cfg.readEntry( "Name" ) ); 79 query_co->insertItem( cfg.readEntry( "Name" ) );
80 } 80 }
81 slotMethodChanged(1 ); //FIXME: this line should not contain a integer 81 slotMethodChanged( 1 ); //FIXME: this line should not contain a integer
82} 82}
83 83
84 84
85void ODict::saveConfig() 85void ODict::saveConfig()
86{ 86{
87 Config cfg ( "odict" ); 87 Config cfg ( "odict" );
88 cfg.setGroup( "generalsettings" ); 88 cfg.setGroup( "generalsettings" );
89 cfg.writeEntry( "errtol" , errorTol ); 89 cfg.writeEntry( "errtol" , errorTol );
90 cfg.writeEntry( "casesens" , casesens ); 90 cfg.writeEntry( "casesens" , casesens );
91 cfg.writeEntry( "regexp" , regexp ); 91 cfg.writeEntry( "regexp" , regexp );
92 cfg.writeEntry( "completewords" , completewords ); 92 cfg.writeEntry( "completewords" , completewords );
93} 93}
94 94
95void ODict::slotStartQuery() 95void ODict::slotStartQuery()
96{ 96{
97 /*
98 * if the user has not yet defined a dictionary
99 */
100 if ( !query_co->currentText() )
101 {
102 switch ( QMessageBox::information( this, tr( "OPIE-Dictionary" ),
103 tr( "No dictionary defined" ),
104 tr( "&Define one" ),
105 tr( "&Cancel" ),
106 0, // Define a dict choosen
107 1 ) ) // Cancel choosen
108 {
109
110 case 0:
111 slotSettings();
112 break;
113 case 1: // stop here
114 return;
115 }
116 }
117
118 /*
119 * ok, the user has defined a dict
120 */
97 QString querystring = query_le->text(); 121 QString querystring = query_le->text();
98 ding->setCaseSensitive( casesens ); 122 ding->setCaseSensitive( casesens );
99 ding->setCompleteWord( completewords ); 123 ding->setCompleteWord( completewords );
100 ding->setDict( activated_name ); 124 ding->setDict( activated_name );
101 125
102 if ( activated_name != ding->loadedDict() ) 126 if ( activated_name != ding->loadedDict() )
103 ding->loadDict(activated_name); 127 ding->loadDict(activated_name);
104 128
105 BroswerContent test = ding->setText( querystring ); 129 BroswerContent test = ding->setText( querystring );
106 130
107 browser_top->setText( test.top ); 131 browser_top->setText( test.top );
108 browser_bottom->setText( test.bottom ); 132 browser_bottom->setText( test.bottom );
109} 133}
110 134
111 135
112void ODict::slotSetErrorcount( int count ) 136void ODict::slotSetErrorcount( int count )
113{ 137{
114 errorTol = count; 138 errorTol = count;
115} 139}
116 140
117void ODict::slotSettings() 141void ODict::slotSettings()
118{ 142{
119 ConfigDlg dlg( this, "Config" , true); 143 ConfigDlg dlg( this, "Config" , true);
120 if ( dlg.exec() == QDialog::Accepted ) 144 if ( dlg.exec() == QDialog::Accepted )