84 QString path = "Z:/resource/qt/translations/"; |
83 QString path = "Z:/resource/qt/translations/"; |
85 bool translatorLoaded = iTranslator.load("vmbx_"+lang, path); |
84 bool translatorLoaded = iTranslator.load("vmbx_"+lang, path); |
86 VMBLOGSTRING2("VmbxQtUiHandler::init load vmbx result %d", |
85 VMBLOGSTRING2("VmbxQtUiHandler::init load vmbx result %d", |
87 translatorLoaded) |
86 translatorLoaded) |
88 // Install vmbx localization |
87 // Install vmbx localization |
89 if (translatorLoaded && qApp) { |
88 if (translatorLoaded) { |
90 VMBLOGSTRING("VmbxQtUiHandler::init qApp !") |
89 VMBLOGSTRING("VmbxQtUiHandler::init qApp !") |
91 qApp->installTranslator(&iTranslator); |
90 qApp->installTranslator(&iTranslator); |
92 } |
91 } |
93 // Install common localization, for select type "cancel". |
92 // Install common localization, for select type "cancel". |
94 bool loaded = iCommonTranslator.load( "common_"+lang, path); |
93 bool loaded = iCommonTranslator.load( "common_"+lang, path); |
95 VMBLOGSTRING2("VmbxQtUiHandler::init load common result %d", |
94 VMBLOGSTRING2("VmbxQtUiHandler::init load common result %d", |
96 loaded) |
95 loaded) |
97 if (loaded && qApp) { |
96 if (loaded) { |
98 VMBLOGSTRING("VmbxQtUiHandler::init qApp !!") |
97 VMBLOGSTRING("VmbxQtUiHandler::init qApp !!") |
99 qApp->installTranslator(&iCommonTranslator); |
98 qApp->installTranslator(&iCommonTranslator); |
100 } |
99 } |
101 VMBLOGSTRING("VmbxQtUiHandler::init Exit") |
100 VMBLOGSTRING("VmbxQtUiHandler::init Exit") |
102 } |
101 } |
119 } else { |
118 } else { |
120 aResult = KErrCancel; |
119 aResult = KErrCancel; |
121 VMBLOGSTRING( "VmbxQtUiHandler::showVmbxQueryDialog type error" ) |
120 VMBLOGSTRING( "VmbxQtUiHandler::showVmbxQueryDialog type error" ) |
122 return; |
121 return; |
123 } |
122 } |
|
123 if (iQueryDialog) { |
|
124 delete iQueryDialog; |
|
125 iQueryDialog = 0; |
|
126 } |
|
127 |
|
128 |
124 iQueryDialog = new HbInputDialog(); |
129 iQueryDialog = new HbInputDialog(); |
125 iQueryDialog->setDismissPolicy(HbDialog::NoDismiss); |
130 iQueryDialog->setDismissPolicy(HbDialog::NoDismiss); |
126 iQueryDialog->setTimeout(HbDialog::NoTimeout); |
131 iQueryDialog->setTimeout(HbDialog::NoTimeout); |
127 |
132 |
128 iQueryDialog->setModal(true); |
133 iQueryDialog->setModal(true); |
129 // Set heading content |
134 // Set heading content |
130 iQueryDialog->setPromptText(header); |
135 iQueryDialog->setPromptText(header); |
131 |
136 |
132 // Set HbLineEdit Content |
137 // Set HbLineEdit Content |
133 iQueryDialog->lineEdit()->setText(aNumber); // default text |
138 iQueryDialog->lineEdit()->setText(aNumber); // default text |
134 iQueryDialog->lineEdit()->setFocus(); // Enable the VKB |
|
135 iQueryDialog->lineEdit()->setMaxLength(KVmbxPhoneCharMaxLength); |
139 iQueryDialog->lineEdit()->setMaxLength(KVmbxPhoneCharMaxLength); |
136 HbEditorInterface inputMode(iQueryDialog->lineEdit()); |
140 HbEditorInterface inputMode(iQueryDialog->lineEdit()); |
137 inputMode.setFilter(HbPhoneNumberFilter::instance()); |
141 inputMode.setFilter(HbPhoneNumberFilter::instance()); |
138 bool ret = connect(iQueryDialog->lineEdit(), SIGNAL(textChanged(QString)), |
142 bool ret = connect(iQueryDialog->lineEdit(), SIGNAL(textChanged(QString)), |
139 this, SLOT(updatePrimaryAction(QString))); |
143 this, SLOT(updatePrimaryAction(QString))); |
140 VMBLOGSTRING2( "VmbxQtUiHandler::showVmbxQueryDialog connect textChanged %d", ret) |
144 VMBLOGSTRING2( "VmbxQtUiHandler::showVmbxQueryDialog connect textChanged %d", ret) |
|
145 |
141 DialogWaiter waiter; |
146 DialogWaiter waiter; |
|
147 HbAction *primary = 0; |
|
148 if (iQueryDialog->actions().count()>= 1) { |
|
149 primary = qobject_cast<HbAction*>(iQueryDialog->actions().at(0)); |
|
150 } |
|
151 |
142 iQueryDialog->open(&waiter, SLOT(done(HbAction *))); |
152 iQueryDialog->open(&waiter, SLOT(done(HbAction *))); |
|
153 iQueryDialog->lineEdit()->setFocus(); // Enable the VKB |
|
154 |
143 HbAction *result = waiter.wait(); |
155 HbAction *result = waiter.wait(); |
144 if (result == iQueryDialog->primaryAction()) { |
156 if (result == primary) { |
145 VMBLOGSTRING( "VmbxQtUiHandler::showVmbxQueryDialog select OK" ) |
157 VMBLOGSTRING( "VmbxQtUiHandler::showVmbxQueryDialog select OK" ) |
146 // asign OK KEY value |
158 // asign OK KEY value |
147 aResult = KErrNone; |
159 aResult = KErrNone; |
148 aNumber = iQueryDialog->lineEdit()->text(); |
160 aNumber = iQueryDialog->lineEdit()->text(); |
149 } else { |
161 } else { |
150 aResult = KErrCancel; |
162 aResult = KErrCancel; |
151 } |
163 } |
|
164 |
|
165 disconnect(iQueryDialog->lineEdit(), SIGNAL(textChanged(QString)), |
|
166 this, SLOT(updatePrimaryAction(QString))); |
|
167 |
|
168 |
|
169 // TODO Delete Operation will case panic on EM |
152 delete iQueryDialog; |
170 delete iQueryDialog; |
153 iQueryDialog = 0; |
171 iQueryDialog = 0; |
|
172 |
154 VMBLOGSTRING2("VmbxQtUiHandler::showVmbxQueryDialog aResult = %d", aResult) |
173 VMBLOGSTRING2("VmbxQtUiHandler::showVmbxQueryDialog aResult = %d", aResult) |
155 VMBLOGSTRING("VmbxQtUiHandler::showVmbxQueryDialog Exit") |
174 VMBLOGSTRING("VmbxQtUiHandler::showVmbxQueryDialog Exit") |
156 } |
175 } |
157 |
176 |
158 // ---------------------------------------------------------------------------- |
177 // ---------------------------------------------------------------------------- |
180 list->addItem(hbTrId("txt_vmbx_list_video_mailbox")); |
199 list->addItem(hbTrId("txt_vmbx_list_video_mailbox")); |
181 // Set content widget |
200 // Set content widget |
182 defineListDialog->setContentWidget(list); |
201 defineListDialog->setContentWidget(list); |
183 |
202 |
184 // Sets the "Cancel"-action/button |
203 // Sets the "Cancel"-action/button |
185 HbAction *cancelAction = new HbAction(hbTrId( |
204 HbAction *cancelAction = |
186 "txt_common_button_cancel")); |
205 new HbAction(hbTrId("txt_common_button_cancel"),defineListDialog); |
187 defineListDialog->setSecondaryAction(cancelAction); |
206 defineListDialog->addAction(cancelAction); |
188 |
207 |
189 connect(list, SIGNAL(activated(HbListWidgetItem *)), |
208 connect(list, SIGNAL(activated(HbListWidgetItem *)), |
190 defineListDialog, SLOT(close())); |
209 defineListDialog, SLOT(close())); |
191 DialogWaiter waiter; |
210 DialogWaiter waiter; |
192 defineListDialog->open(&waiter, SLOT(done(HbAction *))); |
211 defineListDialog->open(&waiter, SLOT(done(HbAction *))); |
193 HbAction *result = waiter.wait(); |
212 HbAction *result = waiter.wait(); |
207 } |
226 } |
208 } |
227 } |
209 VMBLOGSTRING2("VmbxQtUiHandler::showDefineSelectionDialog: aType%d", aType) |
228 VMBLOGSTRING2("VmbxQtUiHandler::showDefineSelectionDialog: aType%d", aType) |
210 VMBLOGSTRING2("VmbxQtUiHandler::showDefineSelectionDialog: aResult%d", \ |
229 VMBLOGSTRING2("VmbxQtUiHandler::showDefineSelectionDialog: aResult%d", \ |
211 aResult) |
230 aResult) |
|
231 |
|
232 |
|
233 // TODO Delete Operation will case panic on EM |
212 delete defineListDialog; |
234 delete defineListDialog; |
213 defineListDialog = 0; |
235 defineListDialog = 0; |
|
236 |
214 VMBLOGSTRING("VmbxQtUiHandler::showDefineSelectionDialog Exit") |
237 VMBLOGSTRING("VmbxQtUiHandler::showDefineSelectionDialog Exit") |
215 } |
238 } |
216 |
239 |
217 // ---------------------------------------------------------------------------- |
240 // ---------------------------------------------------------------------------- |
218 // VmbxQtUiHandler::showCallSelectionDialog |
241 // VmbxQtUiHandler::showCallSelectionDialog |
278 default: |
301 default: |
279 break; |
302 break; |
280 } |
303 } |
281 } |
304 } |
282 // Sets the "Cancel"-action/button |
305 // Sets the "Cancel"-action/button |
283 HbAction *cancelAction = new HbAction(hbTrId( |
306 HbAction *cancelAction = |
284 "txt_common_button_cancel_toolbar")); |
307 new HbAction(hbTrId("txt_common_button_cancel"),callListDialog); |
285 callListDialog->setSecondaryAction(cancelAction); |
308 callListDialog->addAction(cancelAction); |
286 |
309 |
287 connect(list, SIGNAL(activated(HbListWidgetItem *)), |
310 connect(list, SIGNAL(activated(HbListWidgetItem *)), |
288 callListDialog, SLOT(close())); |
311 callListDialog, SLOT(close())); |
289 DialogWaiter waiter; |
312 DialogWaiter waiter; |
290 callListDialog->open(&waiter, SLOT(done(HbAction *))); |
313 callListDialog->open(&waiter, SLOT(done(HbAction *))); |
291 HbAction *action = waiter.wait(); |
314 HbAction *action = waiter.wait(); |
372 // (show information note). |
396 // (show information note). |
373 // ---------------------------------------------------------------------------- |
397 // ---------------------------------------------------------------------------- |
374 // |
398 // |
375 void VmbxQtUiHandler::updatePrimaryAction(const QString &aInput) |
399 void VmbxQtUiHandler::updatePrimaryAction(const QString &aInput) |
376 { |
400 { |
377 HbAction *ok = iQueryDialog->primaryAction(); |
401 if (iQueryDialog) { |
378 if (aInput.isEmpty() || aInput.contains(QRegExp("\\d\\d\\d"))){ |
402 QAction *ok = iQueryDialog->actions().at(0); |
379 if (!ok->isEnabled()){ |
403 if (ok) { |
380 ok->setEnabled(true); |
404 if ( aInput.isEmpty() || aInput.contains(QRegExp("\\d\\d\\d"))){ |
381 VMBLOGSTRING("VmbxQtUiHandler::updatePrimaryAction enable OK") |
405 if (!ok->isEnabled()){ |
|
406 ok->setEnabled(true); |
|
407 VMBLOGSTRING("VmbxQtUiHandler::updatePrimaryAction enable OK") |
|
408 } |
|
409 } else { |
|
410 if (ok->isEnabled()){ |
|
411 ok->setEnabled(false); |
|
412 VMBLOGSTRING("VmbxQtUiHandler::updatePrimaryAction disable OK") |
|
413 } |
|
414 } |
382 } |
415 } |
383 }else{ |
416 } |
384 if (ok->isEnabled()){ |
|
385 ok->setEnabled(false); |
|
386 VMBLOGSTRING("VmbxQtUiHandler::updatePrimaryAction disable OK") |
|
387 } |
|
388 } |
|
389 } |
417 } |
390 |
418 |
391 //End of file |
419 //End of file |