37 #include <hbinputregioncollector_p.h> |
37 #include <hbinputregioncollector_p.h> |
38 |
38 |
39 #include "hbinputspellquerydialog.h" |
39 #include "hbinputspellquerydialog.h" |
40 #include "hbinputmodehandler.h" |
40 #include "hbinputmodehandler.h" |
41 |
41 |
42 #define MAXUDBWORDSIZE 64 |
42 static const qint16 MAXUDBWORDSIZE = 64; |
43 |
43 |
44 HbInputSpellQuery::HbInputSpellQuery(HbInputMethod *inputMethod, HbInputPredictionHandler *predictionHandler) |
44 HbInputSpellQuery::HbInputSpellQuery(HbInputMethod *inputMethod, HbInputPredictionHandler *predictionHandler) |
45 : mOwner(inputMethod), mPredictionHandler(predictionHandler), mPrimaryAction(0) |
45 : mOwner(inputMethod), mPredictionHandler(predictionHandler), mPrimaryAction(0) |
46 { |
46 { |
47 setInputMode(HbInputDialog::TextInput); |
47 setInputMode(HbInputDialog::TextInput); |
107 return; |
107 return; |
108 } else { |
108 } else { |
109 mDidHandleFinish = true; |
109 mDidHandleFinish = true; |
110 } |
110 } |
111 |
111 |
112 bool isOk = false; |
112 HbSpellCloseReason closeReason = HbForceClose; |
113 bool isCancel = false; |
113 QString string = mSavedEditorText; |
114 bool isExternalClose = false; |
|
115 // action is null when input query is closed externally , for example by calling |
114 // action is null when input query is closed externally , for example by calling |
116 // HbDialog::close() function. |
115 // HbDialog::close() function. |
117 if (action) { |
116 if (action) { |
118 isOk = mPrimaryAction == action ? true : false; |
117 if(mPrimaryAction == action) { |
119 isCancel = mPrimaryAction != action ? true : false; |
118 closeReason = HbOkPressed; |
120 } else { |
119 string = value().toString(); |
121 isExternalClose = true; |
120 } else { |
|
121 closeReason = HbCancelPressed; |
|
122 } |
122 } |
123 } |
123 |
|
124 //Need to disable effects as asynchronous hide will commit the word otherwise. |
124 //Need to disable effects as asynchronous hide will commit the word otherwise. |
125 HbEffect::disable(this); |
125 HbEffect::disable(this); |
126 hide(); |
126 hide(); |
127 HbEffect::enable(this); |
127 HbEffect::enable(this); |
128 |
128 |
129 QString string = mSavedEditorText; |
129 mPredictionHandler->spellQueryDialogClosed(mSavedFocusObject,closeReason,string); |
130 bool status = false; |
|
131 if (isOk) { |
|
132 string = value().toString(); |
|
133 status = true; |
|
134 } else if (isCancel) { |
|
135 status = false; |
|
136 } else if (isExternalClose) { |
|
137 status = true; |
|
138 } |
|
139 mPredictionHandler->spellQueryDialogClosed(mSavedFocusObject,status,string); |
|
140 mSavedFocusObject = 0; |
130 mSavedFocusObject = 0; |
141 mSavedEditorText.clear(); |
131 mSavedEditorText.clear(); |
142 mPrimaryAction = 0; |
132 mPrimaryAction = 0; |
143 } |
133 } |
144 |
134 |