-rw-r--r-- | noncore/apps/odict/odict.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 9f9a8d9..cb9c4e0 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -46,13 +46,16 @@ ODict::ODict() : QMainWindow() | |||
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 ); query_label->show(); | 49 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); |
50 | query_label->show(); | ||
50 | query_le = new QLineEdit( hbox ); | 51 | query_le = new QLineEdit( hbox ); |
51 | query_co = new QComboBox( hbox ); | 52 | query_co = new QComboBox( hbox ); |
52 | connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) ); | 53 | connect( query_co , SIGNAL( activated(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) ); |
53 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); | 54 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); |
54 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); | 55 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); |
56 | top_name = new QLabel( vbox ); | ||
55 | browser_top = new QTextBrowser( vbox ); | 57 | browser_top = new QTextBrowser( vbox ); |
58 | bottom_name = new QLabel( vbox ); | ||
56 | browser_bottom = new QTextBrowser( vbox ); | 59 | browser_bottom = new QTextBrowser( vbox ); |
57 | 60 | ||
58 | ding = new DingWidget(); | 61 | ding = new DingWidget(); |
@@ -78,7 +81,7 @@ void ODict::loadConfig() | |||
78 | cfg.setGroup( *it ); | 81 | cfg.setGroup( *it ); |
79 | query_co->insertItem( cfg.readEntry( "Name" ) ); | 82 | query_co->insertItem( cfg.readEntry( "Name" ) ); |
80 | } | 83 | } |
81 | slotMethodChanged( 1 ); //FIXME: this line should not contain a integer | 84 | //XXXslotMethodChanged( "1" ); //FIXME: this line should not contain a integer |
82 | } | 85 | } |
83 | 86 | ||
84 | 87 | ||
@@ -94,6 +97,8 @@ void ODict::saveConfig() | |||
94 | 97 | ||
95 | void ODict::slotStartQuery() | 98 | void ODict::slotStartQuery() |
96 | { | 99 | { |
100 | if ( !query_le->text( ).isEmpty() ) | ||
101 | { | ||
97 | /* | 102 | /* |
98 | * if the user has not yet defined a dictionary | 103 | * if the user has not yet defined a dictionary |
99 | */ | 104 | */ |
@@ -122,6 +127,8 @@ void ODict::slotStartQuery() | |||
122 | ding->setCaseSensitive( casesens ); | 127 | ding->setCaseSensitive( casesens ); |
123 | ding->setCompleteWord( completewords ); | 128 | ding->setCompleteWord( completewords ); |
124 | ding->setDict( activated_name ); | 129 | ding->setDict( activated_name ); |
130 | top_name->setText( ding->lang1_name ); | ||
131 | bottom_name->setText( ding->lang2_name ); | ||
125 | 132 | ||
126 | if ( activated_name != ding->loadedDict() ) | 133 | if ( activated_name != ding->loadedDict() ) |
127 | ding->loadDict(activated_name); | 134 | ding->loadDict(activated_name); |
@@ -131,6 +138,7 @@ void ODict::slotStartQuery() | |||
131 | browser_top->setText( test.top ); | 138 | browser_top->setText( test.top ); |
132 | browser_bottom->setText( test.bottom ); | 139 | browser_bottom->setText( test.bottom ); |
133 | } | 140 | } |
141 | } | ||
134 | 142 | ||
135 | 143 | ||
136 | void ODict::slotSetErrorcount( int count ) | 144 | void ODict::slotSetErrorcount( int count ) |
@@ -146,7 +154,6 @@ void ODict::slotSettings() | |||
146 | dlg.writeEntries(); | 154 | dlg.writeEntries(); |
147 | loadConfig(); | 155 | loadConfig(); |
148 | } | 156 | } |
149 | else qDebug( "abgebrochen" ); | ||
150 | } | 157 | } |
151 | 158 | ||
152 | void ODict::slotSetParameter( int count ) | 159 | void ODict::slotSetParameter( int count ) |
@@ -176,9 +183,17 @@ void ODict::slotSetParameter( int count ) | |||
176 | else qWarning( "ERROR" ); | 183 | else qWarning( "ERROR" ); |
177 | } | 184 | } |
178 | 185 | ||
179 | void ODict::slotMethodChanged( int /*methodnumber*/ ) | 186 | void ODict::slotMethodChanged( const QString& methodnumber ) |
180 | { | 187 | { |
181 | activated_name = query_co->currentText(); | 188 | activated_name = methodnumber; |
189 | |||
190 | if ( activated_name != ding->loadedDict() ) | ||
191 | ding->loadDict(activated_name); | ||
192 | |||
193 | top_name->setText( ding->lang1_name ); | ||
194 | top_name->setAlignment( AlignHCenter ); | ||
195 | bottom_name->setText( ding->lang2_name ); | ||
196 | bottom_name->setAlignment( AlignHCenter ); | ||
182 | } | 197 | } |
183 | 198 | ||
184 | void ODict::setupMenus() | 199 | void ODict::setupMenus() |