--- a/vmbx/vmbxengine/src/vmbxqtuihandler.cpp Thu May 27 13:23:05 2010 +0300
+++ b/vmbx/vmbxengine/src/vmbxqtuihandler.cpp Fri Jun 11 14:07:16 2010 +0300
@@ -18,9 +18,8 @@
// qt
#include <QString>
+#include <QRegExp>
#include <QCoreApplication>
-#include <QRegExp>
-
#include <hbinputdialog.h>
#include <hblabel.h>
#include <hbaction.h>
@@ -86,7 +85,7 @@
VMBLOGSTRING2("VmbxQtUiHandler::init load vmbx result %d",
translatorLoaded)
// Install vmbx localization
- if (translatorLoaded && qApp) {
+ if (translatorLoaded) {
VMBLOGSTRING("VmbxQtUiHandler::init qApp !")
qApp->installTranslator(&iTranslator);
}
@@ -94,7 +93,7 @@
bool loaded = iCommonTranslator.load( "common_"+lang, path);
VMBLOGSTRING2("VmbxQtUiHandler::init load common result %d",
loaded)
- if (loaded && qApp) {
+ if (loaded) {
VMBLOGSTRING("VmbxQtUiHandler::init qApp !!")
qApp->installTranslator(&iCommonTranslator);
}
@@ -121,6 +120,12 @@
VMBLOGSTRING( "VmbxQtUiHandler::showVmbxQueryDialog type error" )
return;
}
+ if (iQueryDialog) {
+ delete iQueryDialog;
+ iQueryDialog = 0;
+ }
+
+
iQueryDialog = new HbInputDialog();
iQueryDialog->setDismissPolicy(HbDialog::NoDismiss);
iQueryDialog->setTimeout(HbDialog::NoTimeout);
@@ -131,17 +136,24 @@
// Set HbLineEdit Content
iQueryDialog->lineEdit()->setText(aNumber); // default text
- iQueryDialog->lineEdit()->setFocus(); // Enable the VKB
iQueryDialog->lineEdit()->setMaxLength(KVmbxPhoneCharMaxLength);
HbEditorInterface inputMode(iQueryDialog->lineEdit());
inputMode.setFilter(HbPhoneNumberFilter::instance());
bool ret = connect(iQueryDialog->lineEdit(), SIGNAL(textChanged(QString)),
this, SLOT(updatePrimaryAction(QString)));
VMBLOGSTRING2( "VmbxQtUiHandler::showVmbxQueryDialog connect textChanged %d", ret)
+
DialogWaiter waiter;
+ HbAction *primary = 0;
+ if (iQueryDialog->actions().count()>= 1) {
+ primary = qobject_cast<HbAction*>(iQueryDialog->actions().at(0));
+ }
+
iQueryDialog->open(&waiter, SLOT(done(HbAction *)));
+ iQueryDialog->lineEdit()->setFocus(); // Enable the VKB
+
HbAction *result = waiter.wait();
- if (result == iQueryDialog->primaryAction()) {
+ if (result == primary) {
VMBLOGSTRING( "VmbxQtUiHandler::showVmbxQueryDialog select OK" )
// asign OK KEY value
aResult = KErrNone;
@@ -149,8 +161,15 @@
} else {
aResult = KErrCancel;
}
+
+ disconnect(iQueryDialog->lineEdit(), SIGNAL(textChanged(QString)),
+ this, SLOT(updatePrimaryAction(QString)));
+
+
+ // TODO Delete Operation will case panic on EM
delete iQueryDialog;
iQueryDialog = 0;
+
VMBLOGSTRING2("VmbxQtUiHandler::showVmbxQueryDialog aResult = %d", aResult)
VMBLOGSTRING("VmbxQtUiHandler::showVmbxQueryDialog Exit")
}
@@ -182,10 +201,10 @@
defineListDialog->setContentWidget(list);
// Sets the "Cancel"-action/button
- HbAction *cancelAction = new HbAction(hbTrId(
- "txt_common_button_cancel"));
- defineListDialog->setSecondaryAction(cancelAction);
-
+ HbAction *cancelAction =
+ new HbAction(hbTrId("txt_common_button_cancel"),defineListDialog);
+ defineListDialog->addAction(cancelAction);
+
connect(list, SIGNAL(activated(HbListWidgetItem *)),
defineListDialog, SLOT(close()));
DialogWaiter waiter;
@@ -209,8 +228,12 @@
VMBLOGSTRING2("VmbxQtUiHandler::showDefineSelectionDialog: aType%d", aType)
VMBLOGSTRING2("VmbxQtUiHandler::showDefineSelectionDialog: aResult%d", \
aResult)
+
+
+ // TODO Delete Operation will case panic on EM
delete defineListDialog;
defineListDialog = 0;
+
VMBLOGSTRING("VmbxQtUiHandler::showDefineSelectionDialog Exit")
}
@@ -280,10 +303,10 @@
}
}
// Sets the "Cancel"-action/button
- HbAction *cancelAction = new HbAction(hbTrId(
- "txt_common_button_cancel_toolbar"));
- callListDialog->setSecondaryAction(cancelAction);
-
+ HbAction *cancelAction =
+ new HbAction(hbTrId("txt_common_button_cancel"),callListDialog);
+ callListDialog->addAction(cancelAction);
+
connect(list, SIGNAL(activated(HbListWidgetItem *)),
callListDialog, SLOT(close()));
DialogWaiter waiter;
@@ -358,7 +381,8 @@
msgBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
}
msgBox->setText(noteText);
- msgBox->removeAction(msgBox->primaryAction());
+ msgBox->setTimeout( HbDialog::StandardTimeout );
+ msgBox->clearActions();
DialogWaiter waiter;
msgBox->open(&waiter, SLOT(done(HbAction *)));
waiter.wait();
@@ -374,18 +398,22 @@
//
void VmbxQtUiHandler::updatePrimaryAction(const QString &aInput)
{
- HbAction *ok = iQueryDialog->primaryAction();
- if (aInput.isEmpty() || aInput.contains(QRegExp("\\d\\d\\d"))){
- if (!ok->isEnabled()){
- ok->setEnabled(true);
- VMBLOGSTRING("VmbxQtUiHandler::updatePrimaryAction enable OK")
+ if (iQueryDialog) {
+ QAction *ok = iQueryDialog->actions().at(0);
+ if (ok) {
+ if ( aInput.isEmpty() || aInput.contains(QRegExp("\\d\\d\\d"))){
+ if (!ok->isEnabled()){
+ ok->setEnabled(true);
+ VMBLOGSTRING("VmbxQtUiHandler::updatePrimaryAction enable OK")
+ }
+ } else {
+ if (ok->isEnabled()){
+ ok->setEnabled(false);
+ VMBLOGSTRING("VmbxQtUiHandler::updatePrimaryAction disable OK")
+ }
+ }
}
- }else{
- if (ok->isEnabled()){
- ok->setEnabled(false);
- VMBLOGSTRING("VmbxQtUiHandler::updatePrimaryAction disable OK")
- }
- }
+ }
}
//End of file