80 mUiEngine = NULL; |
80 mUiEngine = NULL; |
81 } |
81 } |
82 } |
82 } |
83 |
83 |
84 /*! |
84 /*! |
85 Notification slot for engine signal about |
|
86 Voice Mailbox entries' changes |
|
87 */ |
|
88 void VmbxCpGroup::voiceMailboxEngineEntriesUpdated() |
|
89 { |
|
90 _DBGLOG("VmbxCpGroup::voiceMailboxEngineEntriesUpdated") |
|
91 // Consider is there need to pass the actual modified data |
|
92 // and mailbox type enum to slot (here) so only needed |
|
93 // data can be updated. |
|
94 updateAllMailboxesToUi(); |
|
95 } |
|
96 |
|
97 /*! |
|
98 Save default mailbox when user selection finished |
|
99 */ |
|
100 void VmbxCpGroup::saveDefaultMailbox(int aIndex) |
|
101 { |
|
102 if (0 == aIndex){ |
|
103 _DBGLOG("VmbxCpGroup::saveDefaultMailbox voice") |
|
104 }else if(1 == aIndex){ |
|
105 _DBGLOG("VmbxCpGroup::saveDefaultMailbox video") |
|
106 }else{ |
|
107 _DBGLOG("VmbxCpGroup::saveDefaultMailbox other") |
|
108 } |
|
109 } |
|
110 |
|
111 /*! |
|
112 Preparation before loading |
85 Preparation before loading |
113 */ |
86 */ |
114 void VmbxCpGroup::loadingPreparation(CpItemDataHelper &itemDataHelper) |
87 void VmbxCpGroup::loadingPreparation() |
115 { |
88 { |
116 _DBGLOG("VmbxCpGroup::loadingPreparation >") |
89 _DBGLOG("VmbxCpGroup::loadingPreparation >") |
117 |
90 |
118 // #Following code is reserved for TB10.2 |
91 ActionCustomItem *viewItem = new ActionCustomItem(); |
119 // Create default mailbox selection |
92 mItemHelper.addItemPrototype(viewItem); |
120 // appendChild takes ownership |
93 mItemHelper.connectToForm( |
121 //if (mUiEngine->isVideoSupport()){ |
94 SIGNAL(itemShown(QModelIndex)), this, SLOT(itemShown(QModelIndex))); |
122 // mDefaultMailboxEditor = new CpSettingFormItemData( |
95 |
123 // HbDataFormModelItem::ComboBoxItem, |
|
124 // hbTrId("Default mailbox"), |
|
125 // this); |
|
126 //itemDataHelper.addConnection( |
|
127 // mDefaultMailboxEditor, SIGNAL(currentIndexChanged(int)), |
|
128 // mUiEngine, SLOT(saveCsVoice1Number())); |
|
129 //QStringList list; |
|
130 //list.append(hbTrId("Voice")); |
|
131 //list.append(hbTrId("Video")); |
|
132 //mDefaultMailboxEditor->setContentWidgetData("items", QVariant(list)); |
|
133 //appendChild(mDefaultMailboxEditor); |
|
134 //} |
|
135 |
|
136 // Create cs voice primary editor |
96 // Create cs voice primary editor |
137 mCsVoice1Editor= new HbDataFormModelItem( |
97 mCsVoice1Editor= createDataFormModelItem(EVmbxVoice); |
138 CustomDataFormType, |
|
139 hbTrId("txt_phone_setlabel_default_mbx_val_voice")); |
|
140 _DBGLOG("VmbxCpGroup::loadingPreparation appendChild voice1 mailbox") |
|
141 |
|
142 QString voice1Number; |
|
143 mUiEngine->getCsVoice1Number(voice1Number); |
|
144 // Show voice line1 number on lineedit |
|
145 mCsVoice1Editor->setContentWidgetData(QString("text"), voice1Number); |
|
146 // Connect ui editing signals and allow ui control |
|
147 // eidting if vmbx allows editing |
|
148 if (mUiEngine->isVoiceWritable()) { |
|
149 // When click the lineedit, the query dialog would pop up. |
|
150 itemDataHelper.addConnection(mCsVoice1Editor, SIGNAL(clicked()), |
|
151 this, SLOT(queryCsVoiceNumber())); |
|
152 } else { |
|
153 // If not writable, Dim the voice editor |
|
154 mCsVoice1Editor->setEnabled(false); |
|
155 } |
|
156 // Add child |
|
157 appendChild(mCsVoice1Editor); |
|
158 |
|
159 // Create cs video primary editor |
|
160 if (mUiEngine->isVideoSupport()){ |
98 if (mUiEngine->isVideoSupport()){ |
161 mCsVideo1Editor= new HbDataFormModelItem( |
99 _DBGLOG("VmbxCpGroup::loadingPreparation create video1 mailbox") |
162 CustomDataFormType, |
100 mCsVideo1Editor= createDataFormModelItem(EVmbxVideo); |
163 hbTrId("txt_phone_setlabel_default_mbx_val_video")); |
101 } |
164 _DBGLOG("VmbxCpGroup::loadingPreparation appendChild video1 mailbox") |
102 _DBGLOG("VmbxCpGroup::loadingPreparation <") |
165 QString video1Number; |
103 } |
166 mUiEngine->getCsVideo1Number(video1Number); |
104 |
167 // Show video line1 number on lineedit |
105 HbDataFormModelItem* VmbxCpGroup::createDataFormModelItem( |
168 mCsVideo1Editor->setContentWidgetData(QString("text"), video1Number); |
106 const TVmbxType vmbxType) |
169 // Check video editing permission and connect signal |
107 { |
170 if (mUiEngine->isVideoWritable()) { |
108 _DBGLOG("VmbxCpGroup::createDataFormModelItem >") |
171 itemDataHelper.addConnection(mCsVideo1Editor, SIGNAL(clicked()), |
109 QString number(""); |
172 this, SLOT(queryCsVideoNumber())); |
110 HbDataFormModelItem *item = 0; |
173 } else { |
111 QString name(""); |
174 // If not writable, Dim the Video editor |
112 bool create(false); |
175 mCsVideo1Editor->setEnabled(false); |
113 if (EVmbxVoice == vmbxType) { |
|
114 _DBGLOG("VmbxCpGroup::createDataFormModelItem voice") |
|
115 name = hbTrId("txt_phone_setlabel_default_mbx_val_voice"); |
|
116 create = true; |
|
117 } else if (EVmbxVideo == vmbxType) { |
|
118 _DBGLOG("VmbxCpGroup::createDataFormModelItem video") |
|
119 name = hbTrId("txt_phone_setlabel_default_mbx_val_video"); |
|
120 create = true; |
|
121 } |
|
122 if (create) { |
|
123 item = new HbDataFormModelItem( |
|
124 static_cast<HbDataFormModelItem::DataItemType>( |
|
125 ActionCustomItem::VmbxEditItem),name); |
|
126 |
|
127 appendChild(item); |
|
128 |
|
129 if (EVmbxVoice == vmbxType) { |
|
130 if (mUiEngine->isVoiceWritable()) { |
|
131 _DBGLOG("VmbxCpGroup::createDataFormModelItem add voice") |
|
132 mItemHelper.addConnection(item, SIGNAL(editItemClicked()), |
|
133 this, SLOT(queryCsVoiceNumber())); |
|
134 }else { |
|
135 _DBGLOG("VmbxCpGroup::createDataFormModelItem voice no read") |
|
136 item->setEnabled(false); |
|
137 } |
|
138 } else if (EVmbxVideo == vmbxType) { |
|
139 if (mUiEngine->isVideoWritable()) { |
|
140 _DBGLOG("VmbxCpGroup::createDataFormModelItem add video") |
|
141 mItemHelper.addConnection(item, SIGNAL(editItemClicked()), |
|
142 this, SLOT(queryCsVideoNumber())); |
|
143 }else { |
|
144 _DBGLOG("VmbxCpGroup::createDataFormModelItem video no read") |
|
145 item->setEnabled(false); |
|
146 } |
176 } |
147 } |
177 appendChild( mCsVideo1Editor ); |
148 } |
178 } |
149 _DBGLOG("VmbxCpGroup::createDataFormModelItem <") |
179 // TODO: Create cs voice als editor |
150 return item; |
180 // TODO: Create cs video als editor |
151 } |
181 // TODO: Create all ps service editors |
|
182 |
|
183 updateAllMailboxesToUi(); |
|
184 |
|
185 // TODO: here check CS ALS editing permission and connnect signal |
|
186 // and enable editing |
|
187 |
|
188 // No need for Video ALS on UI, implement later if necessary. |
|
189 // Editing of PS Services is not allowed by default, disable ui editing |
|
190 // for them. |
|
191 |
|
192 _DBGLOG("VmbxCpGroup::loadingPreparation <") |
|
193 } |
|
194 |
|
195 /*! |
|
196 Update default mailbox |
|
197 */ |
|
198 void VmbxCpGroup::updateDefaultMailboxToUi() |
|
199 { |
|
200 _DBGLOG("VmbxCpGroup::updateDefaultMailboxToUi >") |
|
201 // Consider should you check here if the number |
|
202 // length of the default mailbox |
|
203 // and reset the default mailbox type selection to "none" if it is. |
|
204 // If you do so, remember to save the new value to engine. |
|
205 if (mDefaultMailboxEditor && mUiEngine) { |
|
206 // TODO: Need a new API to save default mailbox |
|
207 } |
|
208 _DBGLOG("VmbxCpGroup::updateDefaultMailboxToUi <") |
|
209 } |
|
210 |
|
211 /*! |
|
212 Update Cs voice primary |
|
213 */ |
|
214 void VmbxCpGroup::updateCsVoice1ToUi() |
|
215 { |
|
216 _DBGLOG("VmbxCpGroup::updateCsVoice1ToUi") |
|
217 if (mCsVoice1Editor && mUiEngine) { |
|
218 QString newUiValue(""); |
|
219 mUiEngine->getCsVoice1Number(newUiValue); |
|
220 _DBGLOG2("VmbxCpGroup::updateCsVoice1ToUi\ |
|
221 newUiValue=", newUiValue) |
|
222 mCsVoice1Editor->setContentWidgetData("text", newUiValue); |
|
223 } |
|
224 } |
|
225 |
|
226 /*! |
|
227 update Cs video primary |
|
228 */ |
|
229 void VmbxCpGroup::updateCsVideo1ToUi() |
|
230 { |
|
231 _DBGLOG("VmbxCpGroup::updateCsVideo1ToUi >") |
|
232 if (mCsVideo1Editor && mUiEngine){ |
|
233 QString newUiValue(""); |
|
234 mUiEngine->getCsVideo1Number(newUiValue); |
|
235 _DBGLOG2("VmbxCpGroup::updateCsVideo1ToUi\ |
|
236 newUiValue=", newUiValue) |
|
237 mCsVideo1Editor->setContentWidgetData("text", newUiValue); |
|
238 } |
|
239 _DBGLOG("VmbxCpGroup::updateCsVideo1ToUi <") |
|
240 } |
|
241 |
|
242 /*! |
|
243 Update all mailboxes |
|
244 */ |
|
245 void VmbxCpGroup::updateAllMailboxesToUi() |
|
246 { |
|
247 _DBGLOG("VmbxCpGroup::updateAllMailboxesToUi >") |
|
248 updateCsVoice1ToUi(); |
|
249 if (mUiEngine->isVideoSupport()) { |
|
250 updateDefaultMailboxToUi(); |
|
251 updateCsVideo1ToUi(); |
|
252 } |
|
253 _DBGLOG("VmbxCpGroup::updateAllMailboxesToUi <") |
|
254 } |
|
255 |
152 |
256 /*! |
153 /*! |
257 Query voice number |
154 Query voice number |
258 */ |
155 */ |
259 void VmbxCpGroup::queryCsVoiceNumber() |
156 void VmbxCpGroup::queryCsVoiceNumber() |
281 mCsVideo1Editor->setEnabled(false); |
178 mCsVideo1Editor->setEnabled(false); |
282 QString number; |
179 QString number; |
283 int result = mUiEngine->queryVideoNumber(number); |
180 int result = mUiEngine->queryVideoNumber(number); |
284 _DBGLOG2("VmbxCpGroup::queryCsVideoNumber result=", result) |
181 _DBGLOG2("VmbxCpGroup::queryCsVideoNumber result=", result) |
285 if (KErrNone == result) { |
182 if (KErrNone == result) { |
286 mCsVideo1Editor->setContentWidgetData(QString("text"), number); |
|
287 _DBGLOG2("VmbxCpGroup::queryCsVideoNumber >, number=", number) |
183 _DBGLOG2("VmbxCpGroup::queryCsVideoNumber >, number=", number) |
288 mUiEngine->setCsVideo1Number(number); |
184 mUiEngine->setCsVideoNumber(number); |
|
185 UpdateWidgetContent(mCsVideo1Index, number); |
289 } |
186 } |
290 mCsVideo1Editor->setEnabled(true); |
187 mCsVideo1Editor->setEnabled(true); |
291 _DBGLOG("VmbxCpGroup::queryCsVideoNumber <") |
188 _DBGLOG("VmbxCpGroup::queryCsVideoNumber <") |
292 } |
189 } |
293 |
190 |
294 /*! |
191 /*! |
295 Update number when vmbx number changed by OTA,OMA etc. |
192 Update number when vmbx number changed by OTA,OMA etc. |
296 */ |
193 */ |
297 void VmbxCpGroup::vmbxNumberChanged(const TVmbxType vmbxType) |
194 void VmbxCpGroup::updateVmbxNumber(const TVmbxType vmbxType) |
298 { |
195 { |
299 _DBGLOG("VmbxCpGroup::vmbxNumberChanged >") |
196 _DBGLOG("VmbxCpGroup::updateVmbxNumber >") |
300 // Update cs voice number |
197 |
|
198 QString number(""); |
301 if (EVmbxVoice == vmbxType) { |
199 if (EVmbxVoice == vmbxType) { |
302 updateCsVoice1ToUi(); |
200 if (mCsVideo1Editor && mUiEngine){ |
303 // Update cs video number |
201 mUiEngine->getCsVoiceNumber(number); |
|
202 _DBGLOG2("VmbxCpGroup::updateVmbxNumber\ |
|
203 number=", number) |
|
204 UpdateWidgetContent(mCsVoice1Index, number); |
|
205 } |
304 } else if (EVmbxVideo == vmbxType) { |
206 } else if (EVmbxVideo == vmbxType) { |
305 updateCsVideo1ToUi(); |
207 if (mCsVideo1Editor && mUiEngine){ |
306 } |
208 mUiEngine->getCsVideoNumber(number); |
307 _DBGLOG("VmbxCpGroup::vmbxNumberChanged <") |
209 _DBGLOG2("VmbxCpGroup::updateVmbxNumber\ |
|
210 newUiValue=", number) |
|
211 UpdateWidgetContent(mCsVideo1Index, number); |
|
212 } |
|
213 } |
|
214 _DBGLOG("VmbxCpGroup::updateVmbxNumber <") |
|
215 } |
|
216 |
|
217 /*! |
|
218 slot for item has been shown on the UI |
|
219 */ |
|
220 void VmbxCpGroup::itemShown(const QModelIndex &item) |
|
221 { |
|
222 _DBGLOG("VmbxCpGroup::itemShown >") |
|
223 |
|
224 HbDataFormModelItem* modelItem = mItemHelper.modelItemFromModelIndex(item); |
|
225 |
|
226 if (modelItem == mCsVoice1Editor ) { |
|
227 _DBGLOG("VmbxCpGroup::itemShown voice") |
|
228 mCsVoice1Index = item; |
|
229 updateVmbxNumber(EVmbxVoice); |
|
230 }else if (modelItem == mCsVideo1Editor ) { |
|
231 _DBGLOG("VmbxCpGroup::itemShown video") |
|
232 mCsVideo1Index = item; |
|
233 updateVmbxNumber(EVmbxVideo); |
|
234 } |
|
235 _DBGLOG("VmbxCpGroup::itemShown <") |
|
236 } |
|
237 |
|
238 /*! |
|
239 Update the vmbx number to the UI |
|
240 */ |
|
241 void VmbxCpGroup::UpdateWidgetContent(const QModelIndex &item, |
|
242 const QString &string) |
|
243 { |
|
244 _DBGLOG("VmbxCpGroup::UpdateWidgetContent >") |
|
245 HbLineEdit* widget = static_cast<HbLineEdit *>( |
|
246 mItemHelper.widgetFromModelIndex(item)); |
|
247 if (widget) { |
|
248 _DBGLOG("VmbxCpGroup::UpdateWidgetContent widegt found") |
|
249 widget->setText(string); |
|
250 } |
|
251 if (item == mCsVoice1Index) { |
|
252 mCsVoice1Editor->setContentWidgetData("setText", string); |
|
253 } else if (item == mCsVideo1Index) { |
|
254 mCsVideo1Editor->setContentWidgetData("setText", string); |
|
255 } |
|
256 _DBGLOG("VmbxCpGroup::UpdateWidgetContent <") |
|
257 |
308 } |
258 } |
309 |
259 |
310 //End of file |
260 //End of file |