45 #include "hbinputprediction12keyhandler_p.h" |
45 #include "hbinputprediction12keyhandler_p.h" |
46 |
46 |
47 #define HbDeltaHeight 3.0 |
47 #define HbDeltaHeight 3.0 |
48 #define MAXUDBWORDSIZE 64 |
48 #define MAXUDBWORDSIZE 64 |
49 |
49 |
50 HbInputSpellQuery::HbInputSpellQuery(HbInputPrediction12KeyHandlerPrivate *owner) : mOwner(owner) |
50 HbInputSpellQuery::HbInputSpellQuery(HbInputPrediction12KeyHandlerPrivate *owner) : mOwner(owner), mPrimaryAction(0) |
51 { |
51 { |
52 } |
52 } |
53 |
53 |
54 void HbInputSpellQuery::launch(QString editorText) |
54 void HbInputSpellQuery::launch(QString editorText) |
55 { |
55 { |
95 mSavedFocusObject = focusObject->object(); |
95 mSavedFocusObject = focusObject->object(); |
96 mSavedEditorText = editorText; |
96 mSavedEditorText = editorText; |
97 //setAttribute(Qt::WA_DeleteOnClose); |
97 //setAttribute(Qt::WA_DeleteOnClose); |
98 mDidHandleFinish = false; |
98 mDidHandleFinish = false; |
99 open(this,SLOT(dialogClosed(HbAction*))); |
99 open(this,SLOT(dialogClosed(HbAction*))); |
|
100 mPrimaryAction = qobject_cast<HbAction*>(actions().first()); |
100 } |
101 } |
101 |
102 |
102 void HbInputSpellQuery::dialogClosed(HbAction* action) |
103 void HbInputSpellQuery::dialogClosed(HbAction* action) |
103 { |
104 { |
104 //There are multiple dialog closed event received. This will make sure we handle finish |
105 //There are multiple dialog closed event received. This will make sure we handle finish |
105 //only once |
106 //only once |
106 if(mDidHandleFinish) { |
107 if(mDidHandleFinish) { |
107 return; |
108 return; |
108 } else { |
109 } else { |
109 mDidHandleFinish = true; |
110 mDidHandleFinish = true; |
110 } |
111 } |
111 |
112 |
112 bool isOk = false; |
113 bool isOk = false; |
113 bool isCancel = false; |
114 bool isCancel = false; |
114 bool isExternalClose = false; |
115 bool isExternalClose = false; |
115 // action is null when input query is closed externally , for example by calling |
116 // action is null when input query is closed externally , for example by calling |
116 // HbDialog::close() function. |
117 // HbDialog::close() function. |
117 if (action) { |
118 if (action) { |
118 isOk = (action->text() == actions().at(0)->text())? true : false; |
119 isOk = mPrimaryAction == action ? true : false; |
119 isCancel = (action->text() == actions().at(1)->text())? true:false; |
120 isCancel = mPrimaryAction != action ? true : false; |
120 } else { |
121 } else { |
121 isExternalClose = true; |
122 isExternalClose = true; |
122 } |
123 } |
123 |
124 |
124 //Need to disable effects as asynchronous hide will commit the word otherwise. |
125 //Need to disable effects as asynchronous hide will commit the word otherwise. |
125 HbEffect::disable(this); |
126 HbEffect::disable(this); |
126 hide(); |
127 hide(); |
127 HbEffect::enable(this); |
128 HbEffect::enable(this); |
128 |
129 |
129 HbInputFocusObject *newFocusObject = new HbInputFocusObject(mSavedFocusObject); |
130 HbInputFocusObject *newFocusObject = new HbInputFocusObject(mSavedFocusObject); |
130 newFocusObject->releaseFocus(); |
131 newFocusObject->releaseFocus(); |
131 newFocusObject->setFocus(); |
132 newFocusObject->setFocus(); |
132 |
133 |
133 HbAbstractEdit *abstractEdit = qobject_cast<HbAbstractEdit*>(mSavedFocusObject); |
134 HbAbstractEdit *abstractEdit = qobject_cast<HbAbstractEdit*>(mSavedFocusObject); |
134 |
135 |