FreeCalypso > hg > fc-tourmaline
comparison src/ui/bmi/mmiBookSDNWindow.c @ 142:ec9f955fc487
mmiBook*.c: bogotab fixes
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 14 Nov 2020 08:43:59 +0000 |
parents | c0052fe355d3 |
children |
comparison
equal
deleted
inserted
replaced
141:67b91d34f75e | 142:ec9f955fc487 |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 | 2 |
3 CONDAT (UK) | 3 CONDAT (UK) |
4 | 4 |
5 ******************************************************************************** | 5 ******************************************************************************** |
6 | 6 |
7 This software product is the property of Condat (UK) Ltd and may not be | 7 This software product is the property of Condat (UK) Ltd and may not be |
8 disclosed to any third party without the express permission of the owner. | 8 disclosed to any third party without the express permission of the owner. |
9 | 9 |
10 ******************************************************************************** | 10 ******************************************************************************** |
11 | 11 |
12 $Project name: Basic MMI | 12 $Project name: Basic MMI |
13 $Project code: BMI (6349) | 13 $Project code: BMI (6349) |
14 $Module: PhoneBook | 14 $Module: PhoneBook |
15 $File: MmiBookSDNWindow.c | 15 $File: MmiBookSDNWindow.c |
16 $Revision: 1.0 | 16 $Revision: 1.0 |
17 | 17 |
18 $Author: Condat(UK) | 18 $Author: Condat(UK) |
19 $Date: 25/10/00 | 19 $Date: 25/10/00 |
20 | 20 |
21 ******************************************************************************** | 21 ******************************************************************************** |
22 | 22 |
23 Description: | 23 Description: |
24 | 24 |
30 CRR: 25302 - xpradipg 10 Nov 2004 | 30 CRR: 25302 - xpradipg 10 Nov 2004 |
31 Description: Should be able to select the number fro the phonebook while | 31 Description: Should be able to select the number fro the phonebook while |
32 sending MMS/EMS. | 32 sending MMS/EMS. |
33 Solution: The new feature to select the number from phonebook while sending | 33 Solution: The new feature to select the number from phonebook while sending |
34 MMS/EMS is added | 34 MMS/EMS is added |
35 25/10/00 Original Condat(UK) BMI version. | 35 25/10/00 Original Condat(UK) BMI version. |
36 | 36 |
37 $End | 37 $End |
38 | 38 |
39 *******************************************************************************/ | 39 *******************************************************************************/ |
40 | |
41 | 40 |
42 | 41 |
43 | 42 |
44 /******************************************************************************* | 43 /******************************************************************************* |
45 | 44 |
89 #include "mfw_nm.h" | 88 #include "mfw_nm.h" |
90 #include "mfw_phb.h" | 89 #include "mfw_phb.h" |
91 #include "mfw_mme.h" | 90 #include "mfw_mme.h" |
92 #include "mfw_sat.h" | 91 #include "mfw_sat.h" |
93 #include "mfw_sms.h" | 92 #include "mfw_sms.h" |
94 #include "mfw_cnvt.h" //GW Added for 'mfw_SIM2GsmStr' | 93 #include "mfw_cnvt.h" //GW Added for 'mfw_SIM2GsmStr' |
95 | 94 |
96 #include "dspl.h" | 95 #include "dspl.h" |
97 | 96 |
98 #include "ksd.h" | 97 #include "ksd.h" |
99 #include "psa.h" | 98 #include "psa.h" |
101 #include "MmiMain.h" | 100 #include "MmiMain.h" |
102 #include "MmiBookController.h" | 101 #include "MmiBookController.h" |
103 #include "MmiDummy.h" | 102 #include "MmiDummy.h" |
104 #include "MmiDialogs.h" | 103 #include "MmiDialogs.h" |
105 #include "MmiLists.h" | 104 #include "MmiLists.h" |
106 | |
107 | 105 |
108 | 106 |
109 #include "MmiMenu.h" | 107 #include "MmiMenu.h" |
110 #include "mmiCall.h" | 108 #include "mmiCall.h" |
111 #include "Mmiicons.h" | 109 #include "Mmiicons.h" |
128 #include "MmiBookShared.h" | 126 #include "MmiBookShared.h" |
129 | 127 |
130 #include "mmiColours.h" | 128 #include "mmiColours.h" |
131 | 129 |
132 | 130 |
133 | |
134 | |
135 /******************************************************************************* | 131 /******************************************************************************* |
136 | 132 |
137 Private methods | 133 Private methods |
138 | 134 |
139 *******************************************************************************/ | 135 *******************************************************************************/ |
140 | 136 |
141 /******************************************************************************* | 137 /******************************************************************************* |
142 | 138 |
143 $Function: bookSDN | 139 $Function: bookSDN |
144 | 140 |
145 $Description: window dialog function | 141 $Description: window dialog function |
146 | 142 |
147 $Returns: none. | 143 $Returns: none. |
148 | 144 |
149 $Arguments: win, window handle | 145 $Arguments: win, window handle |
150 event, event to be handled | 146 event, event to be handled |
151 value, not used | 147 value, not used |
152 parameter, not used | 148 parameter, not used |
153 | 149 |
154 *******************************************************************************/ | 150 *******************************************************************************/ |
155 | 151 |
156 static void bookSDN( T_MFW_HND win, USHORT event, SHORT value, void * parameter ) | 152 static void bookSDN( T_MFW_HND win, USHORT event, SHORT value, void * parameter ) |
157 { | 153 { |
158 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data; | 154 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data; |
159 tBookStandard *data = (tBookStandard *)win_data->user; | 155 tBookStandard *data = (tBookStandard *)win_data->user; |
160 MfwMnu *mnu; | 156 MfwMnu *mnu; |
161 tMmiPhbData *my; | 157 tMmiPhbData *my; |
162 | 158 |
163 TRACE_FUNCTION ("bookSDN()"); | 159 TRACE_FUNCTION ("bookSDN()"); |
164 | 160 |
165 /* Guard against bad incoming data | 161 /* Guard against bad incoming data |
166 */ | 162 */ |
167 if ( ! data ) | 163 if ( ! data ) |
168 return; | 164 return; |
169 | 165 |
170 /* Grab the current phonebook data element, we use this a lot | 166 /* Grab the current phonebook data element, we use this a lot |
171 */ | 167 */ |
172 my = &data->phbk->current; | 168 my = &data->phbk->current; |
173 | 169 |
174 /* simple event handler, dealing with the messages we know about | 170 /* simple event handler, dealing with the messages we know about |
175 */ | 171 */ |
176 switch (event) | 172 switch (event) |
177 { | 173 { |
178 case SEARCH_INIT: | 174 case SEARCH_INIT: |
179 { | 175 { |
180 /* Search initialise, no action required | 176 /* Search initialise, no action required |
181 */ | 177 */ |
182 } | 178 } |
183 break; | 179 break; |
184 | 180 |
185 case SEARCH_SCROLL_UP: | 181 case SEARCH_SCROLL_UP: |
186 { | 182 { |
187 /* Scroll up event we need to deal with correctly | 183 /* Scroll up event we need to deal with correctly |
188 */ | 184 */ |
189 if ( ( my->index==1 ) && ( my->selectedName == 0 ) ) | 185 if ( ( my->index==1 ) && ( my->selectedName == 0 ) ) |
190 { | 186 { |
191 /* select the correct boundary for the list | 187 /* select the correct boundary for the list |
192 */ | 188 */ |
193 my->selectedName = my->status.used_entries; | 189 my->selectedName = my->status.used_entries; |
194 if ( my->selectedName > MAX_SEARCH_NAME ) | 190 if ( my->selectedName > MAX_SEARCH_NAME ) |
195 my->selectedName = MAX_SEARCH_NAME; | 191 my->selectedName = MAX_SEARCH_NAME; |
196 | 192 |
197 /* and subtract one cos we are dealing with an array starting | 193 /* and subtract one cos we are dealing with an array starting |
198 at zero | 194 at zero |
199 */ | 195 */ |
200 my->selectedName--; | 196 my->selectedName--; |
201 | 197 |
202 /* and calculate the correct index value | 198 /* and calculate the correct index value |
203 */ | 199 */ |
204 my->index = my->status.used_entries - my->selectedName; | 200 my->index = my->status.used_entries - my->selectedName; |
205 | 201 |
206 } | 202 } |
207 else | 203 else |
208 { | 204 { |
209 if ( my->selectedName == 0 ) | 205 if ( my->selectedName == 0 ) |
210 my->index--; | 206 my->index--; |
211 else | 207 else |
212 my->selectedName--; | 208 my->selectedName--; |
213 } | 209 } |
214 | 210 |
215 /* update menu structures | 211 /* update menu structures |
216 */ | 212 */ |
217 mnu = (MfwMnu *)mfwControl( data->menu ); | 213 mnu = (MfwMnu *)mfwControl( data->menu ); |
218 mnu->lCursor[ mnu->level ] = my->selectedName; | 214 mnu->lCursor[ mnu->level ] = my->selectedName; |
219 | 215 |
220 /* and go find the name | 216 /* and go find the name |
221 */ | 217 */ |
222 bookFindName( MAX_SEARCH_NAME, &data->phbk->current ); | 218 bookFindName( MAX_SEARCH_NAME, &data->phbk->current ); |
223 } | 219 } |
224 break; | 220 break; |
225 | 221 |
226 case SEARCH_SCROLL_DOWN: | 222 case SEARCH_SCROLL_DOWN: |
227 { | 223 { |
228 /* scroll down event is a bit easier than the scroll up | 224 /* scroll down event is a bit easier than the scroll up |
229 */ | 225 */ |
230 if ( (my->index + my->selectedName) == my->status.used_entries ) | 226 if ( (my->index + my->selectedName) == my->status.used_entries ) |
231 { | 227 { |
232 my->index = 1; | 228 my->index = 1; |
233 my->selectedName = 0; | 229 my->selectedName = 0; |
234 } | 230 } |
235 else | 231 else |
236 { | 232 { |
237 if ( my->selectedName == (MAX_SEARCH_NAME - 1) ) | 233 if ( my->selectedName == (MAX_SEARCH_NAME - 1) ) |
238 my->index++; | 234 my->index++; |
239 else | 235 else |
240 my->selectedName++; | 236 my->selectedName++; |
241 } | 237 } |
242 | 238 |
243 /* update menu structures | 239 /* update menu structures |
244 */ | 240 */ |
245 mnu = (MfwMnu *)mfwControl( data->menu ); | 241 mnu = (MfwMnu *)mfwControl( data->menu ); |
246 mnu->lCursor[ mnu->level ] = my->selectedName; | 242 mnu->lCursor[ mnu->level ] = my->selectedName; |
247 | 243 |
248 /* and go find the name | 244 /* and go find the name |
249 */ | 245 */ |
250 bookFindName( MAX_SEARCH_NAME, &data->phbk->current ); | 246 bookFindName( MAX_SEARCH_NAME, &data->phbk->current ); |
251 } | 247 } |
252 break; | 248 break; |
253 | 249 |
254 case SEARCH_STRING: | 250 case SEARCH_STRING: |
255 { | 251 { |
256 /* search for the current element selected in our buffer | 252 /* search for the current element selected in our buffer |
257 */ | 253 */ |
258 my->index = my->index + my->selectedName; | 254 my->index = my->index + my->selectedName; |
259 | 255 |
260 if ( bookSearchName( data->edtBuf, MAX_SEARCH_NAME, &data->phbk->current ) == MFW_PHB_OK ) | 256 if ( bookSearchName( data->edtBuf, MAX_SEARCH_NAME, &data->phbk->current ) == MFW_PHB_OK ) |
261 { | 257 { |
262 if ( my->index > (my->status.used_entries - MAX_SEARCH_NAME + 1) ) | 258 if ( my->index > (my->status.used_entries - MAX_SEARCH_NAME + 1) ) |
263 { | 259 { |
264 /* need to reorganise a bit here | 260 /* need to reorganise a bit here |
265 */ | 261 */ |
266 if ( my->status.used_entries > MAX_SEARCH_NAME ) | 262 if ( my->status.used_entries > MAX_SEARCH_NAME ) |
267 { | 263 { |
268 my->selectedName = my->index - my->status.used_entries; | 264 my->selectedName = my->index - my->status.used_entries; |
269 my->selectedName += MAX_SEARCH_NAME - 1; | 265 my->selectedName += MAX_SEARCH_NAME - 1; |
270 my->index -= my->selectedName; | 266 my->index -= my->selectedName; |
271 } | 267 } |
272 else | 268 else |
273 { | 269 { |
274 my->selectedName = my->index - 1; | 270 my->selectedName = my->index - 1; |
275 my->index = 1; | 271 my->index = 1; |
276 } | 272 } |
277 | 273 |
278 /* find the appropriate name | 274 /* find the appropriate name |
279 */ | 275 */ |
280 bookFindName( MAX_SEARCH_NAME, &data->phbk->current ); | 276 bookFindName( MAX_SEARCH_NAME, &data->phbk->current ); |
281 } | 277 } |
282 else | 278 else |
283 data->phbk->current.selectedName = 0; | 279 data->phbk->current.selectedName = 0; |
284 | 280 |
285 /* update menu structures | 281 /* update menu structures |
286 */ | 282 */ |
287 mnu = (MfwMnu *)mfwControl(data->menu); | 283 mnu = (MfwMnu *)mfwControl(data->menu); |
288 mnu->lCursor[mnu->level] = data->phbk->current.selectedName; | 284 mnu->lCursor[mnu->level] = data->phbk->current.selectedName; |
289 } | 285 } |
290 } | 286 } |
291 break; | 287 break; |
292 | 288 |
293 case SEARCH_UPDATE: | 289 case SEARCH_UPDATE: |
294 { | 290 { |
295 /* Update search message | 291 /* Update search message |
296 */ | 292 */ |
297 my->index = 1; | 293 my->index = 1; |
298 my->selectedName = 0; | 294 my->selectedName = 0; |
299 memset( data->edtBuf, '\0', sizeof( data->edtBuf ) ); | 295 memset( data->edtBuf, '\0', sizeof( data->edtBuf ) ); |
300 /* SPR#1428 - SH - New Editor changes */ | 296 /* SPR#1428 - SH - New Editor changes */ |
301 #ifdef NEW_EDITOR | 297 #ifdef NEW_EDITOR |
302 ATB_edit_Reset( data->editor ); | 298 ATB_edit_Reset( data->editor ); |
303 #else /* NEW_EDITOR */ | 299 #else /* NEW_EDITOR */ |
304 edtReset( data->edt ); | 300 edtReset( data->edt ); |
305 #endif /* NEW_EDITOR */ | 301 #endif /* NEW_EDITOR */ |
306 | 302 |
307 /* deal with the new search using the method above | 303 /* deal with the new search using the method above |
308 */ | 304 */ |
309 SEND_EVENT( win, SEARCH_STRING, 0, 0 ); | 305 SEND_EVENT( win, SEARCH_STRING, 0, 0 ); |
310 } | 306 } |
311 break; | 307 break; |
312 | 308 |
313 /* SPR#1428 - SH - New Editor: added event so we can | 309 /* SPR#1428 - SH - New Editor: added event so we can |
314 * prompt a redraw when required. */ | 310 * prompt a redraw when required. */ |
315 #ifdef NEW_EDITOR | 311 #ifdef NEW_EDITOR |
316 case SEARCH_REDRAW: | 312 case SEARCH_REDRAW: |
317 win_show(data->win); | 313 win_show(data->win); |
318 break; | 314 break; |
319 #endif | 315 #endif |
320 | 316 |
321 default: | 317 default: |
322 { | 318 { |
323 /* no default handler, just ignore any other messages | 319 /* no default handler, just ignore any other messages |
324 */ | 320 */ |
325 } | 321 } |
326 break; | 322 break; |
327 | 323 |
328 } | 324 } |
329 | 325 |
330 } | 326 } |
331 | 327 |
332 | 328 |
333 | 329 /******************************************************************************* |
334 | 330 |
335 /******************************************************************************* | 331 $Function: bookSDNWinCB |
336 | 332 |
337 $Function: bookSDNWinCB | 333 $Description: Window call back function |
338 | 334 |
339 $Description: Window call back function | 335 $Returns: status indicating if event handled or not |
340 | 336 |
341 $Returns: status indicating if event handled or not | 337 $Arguments: e, event, w, window handle |
342 | |
343 $Arguments: e, event, w, window handle | |
344 | 338 |
345 *******************************************************************************/ | 339 *******************************************************************************/ |
346 | 340 |
347 static int bookSDNWinCB( MfwEvt e, MfwWin *w ) | 341 static int bookSDNWinCB( MfwEvt e, MfwWin *w ) |
348 { | 342 { |
349 tBookStandard *data = (tBookStandard *)w->user; | 343 tBookStandard *data = (tBookStandard *)w->user; |
350 | 344 |
351 char *ElemPtr, *NumPtr; | 345 char *ElemPtr, *NumPtr; |
352 | 346 |
353 /* x0045876, 14-Aug-2006 (WR - "Position" was set but never used) */ | 347 /* x0045876, 14-Aug-2006 (WR - "Position" was set but never used) */ |
354 /* int leftKey, rightKey, ElemSize, i, Position; */ | 348 /* int leftKey, rightKey, ElemSize, i, Position; */ |
355 int leftKey, rightKey, ElemSize, i; | 349 int leftKey, rightKey, ElemSize, i; |
356 | 350 |
357 TRACE_FUNCTION ("phbk_sdn_win_cb()"); | 351 TRACE_FUNCTION ("phbk_sdn_win_cb()"); |
358 | 352 |
359 switch (e) | 353 switch (e) |
360 { | 354 { |
361 case MfwWinVisible: | 355 case MfwWinVisible: |
362 { | 356 { |
363 /* Paint function, clear the screen and paint in each | 357 /* Paint function, clear the screen and paint in each |
364 of our controls | 358 of our controls |
365 */ | 359 */ |
366 dspl_ClearAll(); | 360 dspl_ClearAll(); |
367 | 361 |
368 /* SPR#1428 - SH - New Editor changes */ | 362 /* SPR#1428 - SH - New Editor changes */ |
369 #ifdef NEW_EDITOR | 363 #ifdef NEW_EDITOR |
370 ATB_edit_Show(data->editor); | 364 ATB_edit_Show(data->editor); |
371 #else /* NEW_EDITOR */ | 365 #else /* NEW_EDITOR */ |
372 edtShow(data->edt); | 366 edtShow(data->edt); |
373 #endif /* NEW_EDITOR */ | 367 #endif /* NEW_EDITOR */ |
374 | 368 |
375 /* Populate the names screen buffer | 369 /* Populate the names screen buffer |
376 */ | 370 */ |
377 for (i=0;i<MAX_SEARCH_NAME;i++) | 371 for (i=0;i<MAX_SEARCH_NAME;i++) |
378 { | 372 { |
379 /* Grab info for this element | 373 /* Grab info for this element |
380 */ | 374 */ |
381 ElemPtr = MmiBookCallList(i); | 375 ElemPtr = MmiBookCallList(i); |
382 ElemSize = MmiBookCallListSize(i); | 376 ElemSize = MmiBookCallListSize(i); |
383 | 377 |
384 /* Decide on whether to use number or name | 378 /* Decide on whether to use number or name |
385 */ | 379 */ |
386 #ifdef NO_ASCIIZ | 380 #ifdef NO_ASCIIZ |
387 NumPtr = (char*)data->phbk->current.entry[i].name.data; | 381 NumPtr = (char*)data->phbk->current.entry[i].name.data; |
388 #else | 382 #else |
389 NumPtr = (char*)data->phbk->current.entry[i].name; | 383 NumPtr = (char*)data->phbk->current.entry[i].name; |
390 #endif | 384 #endif |
391 | 385 |
392 if ( *NumPtr == '\0' ) | 386 if ( *NumPtr == '\0' ) |
393 { | 387 { |
394 NumPtr = (char*)data->phbk->current.entry[i].number; | 388 NumPtr = (char*)data->phbk->current.entry[i].number; |
395 /* x0045876, 14-Aug-2006 (WR - "Position" was set but never used) */ | 389 /* x0045876, 14-Aug-2006 (WR - "Position" was set but never used) */ |
396 /* Position = POS_END; */ | 390 /* Position = POS_END; */ |
397 } | 391 } |
398 /* BEGIN: x0045876, 14-Aug-2006 (WR - "Position" was set but never used) */ | 392 /* BEGIN: x0045876, 14-Aug-2006 (WR - "Position" was set but never used) */ |
399 /* | 393 /* |
400 else | 394 else |
401 Position = POS_BEGIN; | 395 Position = POS_BEGIN; |
402 */ | 396 */ |
403 /* END: x0045876, 14-Aug-2006 (WR - "Position" was set but never used) */ | 397 /* END: x0045876, 14-Aug-2006 (WR - "Position" was set but never used) */ |
404 | 398 |
405 /* Clear the buffer, then fill it with the required value | 399 /* Clear the buffer, then fill it with the required value |
406 */ | 400 */ |
407 memset( ElemPtr, '\0', ElemSize ); | 401 memset( ElemPtr, '\0', ElemSize ); |
408 /*mc, SPR 1442, replaced old truncation function with new one*/ | 402 /*mc, SPR 1442, replaced old truncation function with new one*/ |
409 resources_truncate_to_screen_width(NumPtr, 0, ElemPtr, ElemSize,SCREEN_SIZE_X, FALSE); | 403 resources_truncate_to_screen_width(NumPtr, 0, ElemPtr, ElemSize,SCREEN_SIZE_X, FALSE); |
410 } | 404 } |
411 | 405 |
412 /* Show the menu and stick up the find prompt | 406 /* Show the menu and stick up the find prompt |
413 */ | 407 */ |
414 mnuUnhide(data->menu); | 408 mnuUnhide(data->menu); |
415 PROMPT( MmiBookMenuArea().px, Mmi_layout_line(SECOND_LAST_LINE_TOP), 0, TxtFind ); | 409 PROMPT( MmiBookMenuArea().px, Mmi_layout_line(SECOND_LAST_LINE_TOP), 0, TxtFind ); |
416 | 410 |
417 /* The softkeys are dependant on how we got here | 411 /* The softkeys are dependant on how we got here |
418 */ | 412 */ |
419 //CRR: 25302 - xpradipg 10 Nov 2004 | 413 //CRR: 25302 - xpradipg 10 Nov 2004 |
420 //check also if phonebook is invoked by MMS/EMS | 414 //check also if phonebook is invoked by MMS/EMS |
421 if ( ( data->phbk->fromSMS ) || ( data->phbk->fromSMSSC )|| (data->phbk->fromMmsEms) ||( data->phbk->current.status.book == PHB_SDN ) ) | 415 if ( ( data->phbk->fromSMS ) || ( data->phbk->fromSMSSC )|| (data->phbk->fromMmsEms) ||( data->phbk->current.status.book == PHB_SDN ) ) |
422 { | 416 { |
423 leftKey = TxtSoftSelect; | 417 leftKey = TxtSoftSelect; |
424 rightKey = TxtSoftBack; | 418 rightKey = TxtSoftBack; |
425 } | 419 } |
426 else | 420 else |
427 { | 421 { |
428 leftKey = TxtSoftCall; | 422 leftKey = TxtSoftCall; |
429 rightKey = TxtSoftOptions; | 423 rightKey = TxtSoftOptions; |
430 } | 424 } |
431 displaySoftKeys( leftKey, rightKey ); | 425 displaySoftKeys( leftKey, rightKey ); |
432 } | 426 } |
433 break; | 427 break; |
434 | 428 |
435 default: | 429 default: |
436 { | 430 { |
437 /* Default handler, just return zero and let the next handler in the | 431 /* Default handler, just return zero and let the next handler in the |
438 chain deal with the event if required | 432 chain deal with the event if required |
439 */ | 433 */ |
440 return 0; | 434 return 0; |
441 } | 435 } |
442 } | 436 } |
443 | 437 |
444 /* return non-zero status indicating we have dealt with the event | 438 /* return non-zero status indicating we have dealt with the event |
445 */ | 439 */ |
446 return MFW_EVENT_CONSUMED; | 440 return MFW_EVENT_CONSUMED; |
447 } | 441 } |
448 | 442 |
449 | 443 |
450 | 444 /******************************************************************************* |
451 | 445 |
452 /******************************************************************************* | 446 $Function: bookSDNKbdCB |
453 | 447 |
454 $Function: bookSDNKbdCB | 448 $Description: Keyboard handler |
455 | 449 |
456 $Description: Keyboard handler | 450 $Returns: stats indicating if event handled or not |
457 | |
458 $Returns: stats indicating if event handled or not | |
459 (Always MFW_EVENT_CONSUMED) | 451 (Always MFW_EVENT_CONSUMED) |
460 | 452 |
461 $Arguments: e, event, k, keyboard handle | 453 $Arguments: e, event, k, keyboard handle |
462 | 454 |
463 *******************************************************************************/ | 455 *******************************************************************************/ |
464 | 456 |
465 static int bookSDNKbdCB( MfwEvt e, MfwKbd *k ) | 457 static int bookSDNKbdCB( MfwEvt e, MfwKbd *k ) |
466 { | 458 { |
467 T_MFW_HND win = mfwParent(mfw_header()); | 459 T_MFW_HND win = mfwParent(mfw_header()); |
468 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | 460 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; |
469 tBookStandard *data = (tBookStandard *)win_data->user; | 461 tBookStandard *data = (tBookStandard *)win_data->user; |
470 tBookMessageEvents MyEvent = SEARCH_STRING; | 462 tBookMessageEvents MyEvent = SEARCH_STRING; |
471 char *Number; | 463 char *Number; |
472 | 464 |
473 // int i = 0; // RAVI | 465 // int i = 0; // RAVI |
474 | 466 |
475 TRACE_FUNCTION ("bookSDNKbdCB()"); | 467 TRACE_FUNCTION ("bookSDNKbdCB()"); |
476 | 468 |
477 /* SPR#1428 - SH - New Editor changes */ | 469 /* SPR#1428 - SH - New Editor changes */ |
478 #ifdef NEW_EDITOR | 470 #ifdef NEW_EDITOR |
479 AUI_entry_EventKey(data->entry_data, e, k); | 471 AUI_entry_EventKey(data->entry_data, e, k); |
480 #else /* NEW_EDITOR */ | 472 #else /* NEW_EDITOR */ |
481 /* Make sure we have the correct editor enabled | 473 /* Make sure we have the correct editor enabled |
482 * (unnecessary for NEW_EDITOR) */ | 474 * (unnecessary for NEW_EDITOR) */ |
483 if ( activeEditor() != data->edt ) | 475 if ( activeEditor() != data->edt ) |
484 editActivate( data->edt, TRUE ); | 476 editActivate( data->edt, TRUE ); |
485 editEventKey( e, k ); | 477 editEventKey( e, k ); |
486 #endif /* NEW_EDITOR */ | 478 #endif /* NEW_EDITOR */ |
487 | 479 |
488 /* Handle the events we need to deal with here | 480 /* Handle the events we need to deal with here |
489 */ | 481 */ |
490 switch (k->code) | 482 switch (k->code) |
491 { | 483 { |
492 case KCD_MNUUP: | 484 case KCD_MNUUP: |
493 { | 485 { |
494 /* Scroll up event, just mark our event as such and it'll | 486 /* Scroll up event, just mark our event as such and it'll |
495 be dealt with in due course | 487 be dealt with in due course |
496 */ | 488 */ |
497 MyEvent = SEARCH_SCROLL_UP; | 489 MyEvent = SEARCH_SCROLL_UP; |
498 } | 490 } |
499 break; | 491 break; |
500 | 492 |
501 case KCD_MNUDOWN: | 493 case KCD_MNUDOWN: |
502 { | 494 { |
503 /* Scroll down event, just mark our event as such and it'll | 495 /* Scroll down event, just mark our event as such and it'll |
504 be dealt with in due course | 496 be dealt with in due course |
505 */ | 497 */ |
506 MyEvent = SEARCH_SCROLL_DOWN; | 498 MyEvent = SEARCH_SCROLL_DOWN; |
507 } | 499 } |
508 break; | 500 break; |
509 | 501 |
510 case KCD_CALL: | 502 case KCD_CALL: |
511 case KCD_LEFT: | 503 case KCD_LEFT: |
512 { | 504 { |
513 /* left key is a select, we either need to send the number | 505 /* left key is a select, we either need to send the number |
514 back to the parent window, or call it | 506 back to the parent window, or call it |
515 */ | 507 */ |
516 Number = (char *) data->phbk->current.entry[ data->phbk->current.selectedName ].number; | 508 Number = (char *) data->phbk->current.entry[ data->phbk->current.selectedName ].number; |
517 | 509 |
518 if ( data->phbk->fromSMS ) | 510 if ( data->phbk->fromSMS ) |
519 SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, 0, (UBYTE *) Number ); | 511 SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, 0, (UBYTE *) Number ); |
520 if ( data->phbk->fromSMSSC ) | 512 if ( data->phbk->fromSMSSC ) |
521 SEND_EVENT( data->phbk->parent_win, SMSSC_PHBK_NUMBER, 0, (UBYTE *) Number ); | 513 SEND_EVENT( data->phbk->parent_win, SMSSC_PHBK_NUMBER, 0, (UBYTE *) Number ); |
522 else if(data->phbk->fromDivert ) | 514 else if(data->phbk->fromDivert ) |
523 SEND_EVENT( data->phbk->parent_win, DIVERT_PHBK_NUMBER, 0, (UBYTE *) Number ); | 515 SEND_EVENT( data->phbk->parent_win, DIVERT_PHBK_NUMBER, 0, (UBYTE *) Number ); |
524 else if(data->phbk->fromDeflect )/*SPR 1392, send event to call dialogue*/ | 516 else if(data->phbk->fromDeflect )/*SPR 1392, send event to call dialogue*/ |
525 SEND_EVENT( data->phbk->parent_win, DEFLECT_PHBK_NUMBER, 0, (UBYTE *) Number ); | 517 SEND_EVENT( data->phbk->parent_win, DEFLECT_PHBK_NUMBER, 0, (UBYTE *) Number ); |
526 //CRR: 25302 - xpradipg 10 Nov 2004 | 518 //CRR: 25302 - xpradipg 10 Nov 2004 |
527 //send even if invoked by MMS/EMS | 519 //send even if invoked by MMS/EMS |
528 else if(data->phbk->fromMmsEms) | 520 else if(data->phbk->fromMmsEms) |
529 SEND_EVENT( data->phbk->parent_win, MMS_EMS_PHBK_NUMBER, 0, (UBYTE *) Number ); | 521 SEND_EVENT( data->phbk->parent_win, MMS_EMS_PHBK_NUMBER, 0, (UBYTE *) Number ); |
530 else | 522 else |
531 callNumber( (UBYTE *) Number ); | 523 callNumber( (UBYTE *) Number ); |
532 | 524 |
533 /* Having dealt with the number, we destroy our phone book | 525 /* Having dealt with the number, we destroy our phone book |
534 context and exit the handler early | 526 context and exit the handler early |
535 */ | 527 */ |
536 bookPhonebookDestroy( data->phbk->win ); | 528 bookPhonebookDestroy( data->phbk->win ); |
537 return MFW_EVENT_CONSUMED; | 529 return MFW_EVENT_CONSUMED; |
538 } | 530 } |
539 //break; // RAVI | 531 //break; // RAVI |
540 | 532 |
541 case KCD_RIGHT: | 533 case KCD_RIGHT: |
542 { | 534 { |
543 /* Right key is a cancel | 535 /* Right key is a cancel |
544 */ | 536 */ |
545 bookSDNDestroy( data->win ); | 537 bookSDNDestroy( data->win ); |
546 data->phbk->search_win = 0; | 538 data->phbk->search_win = 0; |
547 return MFW_EVENT_CONSUMED; | 539 return MFW_EVENT_CONSUMED; |
548 } | 540 } |
549 // break; // RAVI | 541 // break; // RAVI |
550 | 542 |
551 case KCD_HUP: | 543 case KCD_HUP: |
552 { | 544 { |
553 /* Clear key deletes the last character, or if none left will | 545 /* Clear key deletes the last character, or if none left will |
554 take us out of here | 546 take us out of here |
555 */ | 547 */ |
556 if ( data->edtBuf[0] == '\0' ) | 548 if ( data->edtBuf[0] == '\0' ) |
557 { | 549 { |
558 bookSDNDestroy( data->win ); | 550 bookSDNDestroy( data->win ); |
559 data->phbk->search_win = 0; | 551 data->phbk->search_win = 0; |
560 return MFW_EVENT_CONSUMED; | 552 return MFW_EVENT_CONSUMED; |
561 } | 553 } |
562 else | 554 else |
563 { | 555 { |
564 /* Delete last character entered | 556 /* Delete last character entered |
565 */ | 557 */ |
566 /* SPR#1428 - SH - New Editor changes */ | 558 /* SPR#1428 - SH - New Editor changes */ |
567 #ifdef NEW_EDITOR | 559 #ifdef NEW_EDITOR |
568 ATB_edit_DeleteLeft(data->editor, TRUE); /* SPR#2342 */ | 560 ATB_edit_DeleteLeft(data->editor, TRUE); /* SPR#2342 */ |
569 #else /* NEW_EDITOR */ | 561 #else /* NEW_EDITOR */ |
570 edtChar( data->edt, ecBack ); | 562 edtChar( data->edt, ecBack ); |
571 #endif /* NEW_EDITOR */ | 563 #endif /* NEW_EDITOR */ |
572 } | 564 } |
573 } | 565 } |
574 break; | 566 break; |
575 | 567 |
576 default: | 568 default: |
577 { | 569 { |
578 /* No default processing required | 570 /* No default processing required |
579 */ | 571 */ |
580 } | 572 } |
581 break; | 573 break; |
582 } | 574 } |
583 | 575 |
584 /* Initiate a new search based on the current settings, MyEvent | 576 /* Initiate a new search based on the current settings, MyEvent |
585 will have been set accordingly | 577 will have been set accordingly |
586 */ | 578 */ |
587 SEND_EVENT( data->win, MyEvent, 0, 0 ); | 579 SEND_EVENT( data->win, MyEvent, 0, 0 ); |
588 winShow( data->win ); | 580 winShow( data->win ); |
589 | 581 |
590 /* And make sure no calling routines try to do anything with the | 582 /* And make sure no calling routines try to do anything with the |
591 event we have just dealt with | 583 event we have just dealt with |
592 */ | 584 */ |
593 return MFW_EVENT_CONSUMED; | 585 return MFW_EVENT_CONSUMED; |
594 } | 586 } |
595 | 587 |
596 | 588 |
597 | 589 /******************************************************************************* |
598 | 590 |
599 /******************************************************************************* | 591 $Function: bookSDNKeyLongCB |
600 | 592 |
601 $Function: bookSDNKeyLongCB | 593 $Description: long keyboard event handler |
602 | 594 |
603 $Description: long keyboard event handler | 595 $Returns: MFW_EVENT_CONSUMED always |
604 | 596 |
605 $Returns: MFW_EVENT_CONSUMED always | 597 $Arguments: e, event to handle, k, keyboard handle |
606 | |
607 $Arguments: e, event to handle, k, keyboard handle | |
608 | 598 |
609 *******************************************************************************/ | 599 *******************************************************************************/ |
610 | 600 |
611 static int bookSDNKeyLongCB( MfwEvt e, MfwKbd *k ) | 601 static int bookSDNKeyLongCB( MfwEvt e, MfwKbd *k ) |
612 { | 602 { |
613 T_MFW_HND win = mfwParent(mfw_header()); | 603 T_MFW_HND win = mfwParent(mfw_header()); |
614 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | 604 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; |
615 tBookStandard *data = (tBookStandard *)win_data->user; | 605 tBookStandard *data = (tBookStandard *)win_data->user; |
616 | 606 |
617 /* Just checks for clear and long being set, if so it will | 607 /* Just checks for clear and long being set, if so it will |
618 destroy the window | 608 destroy the window |
619 */ | 609 */ |
620 if ( (e & KEY_CLEAR) && (e & KEY_LONG) ) | 610 if ( (e & KEY_CLEAR) && (e & KEY_LONG) ) |
621 { | 611 { |
622 bookSDNDestroy( win ); | 612 bookSDNDestroy( win ); |
623 data->phbk->search_win = 0; | 613 data->phbk->search_win = 0; |
624 } | 614 } |
625 | 615 |
626 /* Force event consumed always, prevents default behaviour | 616 /* Force event consumed always, prevents default behaviour |
627 kicking in | 617 kicking in |
628 */ | 618 */ |
629 return MFW_EVENT_CONSUMED; | 619 return MFW_EVENT_CONSUMED; |
630 } | 620 } |
631 | 621 |
632 | 622 |
633 | 623 /******************************************************************************* |
634 | 624 |
635 /******************************************************************************* | 625 $Function: bookSDNCreate |
636 | 626 |
637 $Function: bookSDNCreate | 627 $Description: Creates the Service numbers widow |
638 | 628 |
639 $Description: Creates the Service numbers widow | 629 $Returns: Window Handle, or NULL if unsuccessfull |
640 | 630 |
641 $Returns: Window Handle, or NULL if unsuccessfull | 631 $Arguments: Parent, handle of the parent window |
642 | |
643 $Arguments: Parent, handle of the parent window | |
644 | 632 |
645 *******************************************************************************/ | 633 *******************************************************************************/ |
646 | 634 |
647 static T_MFW_HND bookSDNCreate( MfwHnd parent ) | 635 static T_MFW_HND bookSDNCreate( MfwHnd parent ) |
648 { | 636 { |
649 T_MFW_WIN *win_data; | 637 T_MFW_WIN *win_data; |
650 tBookStandard *data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) ); | 638 tBookStandard *data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) ); |
651 T_MFW_WIN *parent_win_data = ((T_MFW_HDR *)parent)->data; | 639 T_MFW_WIN *parent_win_data = ((T_MFW_HDR *)parent)->data; |
652 T_phbk* phbk = (T_phbk *)parent_win_data->user; | 640 T_phbk* phbk = (T_phbk *)parent_win_data->user; |
653 | 641 |
654 TRACE_FUNCTION( "bookSDNCreate()" ); | 642 TRACE_FUNCTION( "bookSDNCreate()" ); |
655 | 643 |
656 /* Create the window | 644 /* Create the window |
657 */ | 645 */ |
658 if ( ( data->win = win_create (parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookSDNWinCB ) ) == NULL ) | 646 if ( ( data->win = win_create (parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookSDNWinCB ) ) == NULL ) |
659 return NULL; | 647 return NULL; |
660 | 648 |
661 /*SPR 2123, MC allocate memory for phonebook list*/ | 649 /*SPR 2123, MC allocate memory for phonebook list*/ |
662 if (create_mmi_phonebook_names_list() == NULL) | 650 if (create_mmi_phonebook_names_list() == NULL) |
663 return NULL; | 651 return NULL; |
664 | 652 |
665 /* set up the basic window elements, dialog and user data pointers | 653 /* set up the basic window elements, dialog and user data pointers |
666 */ | 654 */ |
667 data->mmi_control.dialog = (T_DIALOG_FUNC)bookSDN; | 655 data->mmi_control.dialog = (T_DIALOG_FUNC)bookSDN; |
668 data->mmi_control.data = data; | 656 data->mmi_control.data = data; |
669 win_data = ((T_MFW_HDR *)data->win)->data; | 657 win_data = ((T_MFW_HDR *)data->win)->data; |
670 win_data->user = (void *)data; | 658 win_data->user = (void *)data; |
671 data->parent_win = parent; | 659 data->parent_win = parent; |
672 | 660 |
673 /* Create keyboard and menu handlers to be associated with | 661 /* Create keyboard and menu handlers to be associated with |
674 this window | 662 this window |
675 */ | 663 */ |
676 data->kbd = kbdCreate( data->win, KEY_ALL, (MfwCb) bookSDNKbdCB ); | 664 data->kbd = kbdCreate( data->win, KEY_ALL, (MfwCb) bookSDNKbdCB ); |
677 data->kbd_long = kbdCreate( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookSDNKeyLongCB ); | 665 data->kbd_long = kbdCreate( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookSDNKeyLongCB ); |
678 data->menu = mnuCreate( data->win, MmiBookMenuDetailsList(), 0, 0 ); | 666 data->menu = mnuCreate( data->win, MmiBookMenuDetailsList(), 0, 0 ); |
679 | 667 |
680 /* Set basic edit attributes structure and create an editor | 668 /* Set basic edit attributes structure and create an editor |
681 associated with these attributes | 669 associated with these attributes |
682 */ | 670 */ |
683 /* SPR#1428 - SH - New Editor changes */ | 671 /* SPR#1428 - SH - New Editor changes */ |
684 #ifdef NEW_EDITOR | 672 #ifdef NEW_EDITOR |
685 AUI_edit_SetAttr( &data->editor_attr, BOOKSDN_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT, ED_MODE_ALPHA, ED_CURSOR_BAR, ATB_DCS_ASCII, (UBYTE*) data->edtBuf, MAX_SEARCH_CHAR); | 673 AUI_edit_SetAttr( &data->editor_attr, BOOKSDN_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT, ED_MODE_ALPHA, ED_CURSOR_BAR, ATB_DCS_ASCII, (UBYTE*) data->edtBuf, MAX_SEARCH_CHAR); |
686 data->editor = ATB_edit_Create(&data->editor_attr,0); | 674 data->editor = ATB_edit_Create(&data->editor_attr,0); |
687 data->entry_data = AUI_entry_Create(data->win, data->editor, SEARCH_REDRAW); | 675 data->entry_data = AUI_entry_Create(data->win, data->editor, SEARCH_REDRAW); |
688 ATB_edit_Init(data->editor); | 676 ATB_edit_Init(data->editor); |
689 #else /* NEW_EDITOR */ | 677 #else /* NEW_EDITOR */ |
690 bookSetEditAttributes( BOOKSDN_EDITOR, COLOUR_EDITOR_XX , 0, edtCurBar1, 0, (char*) data->edtBuf, MAX_SEARCH_CHAR, &data->attr ); | 678 bookSetEditAttributes( BOOKSDN_EDITOR, COLOUR_EDITOR_XX , 0, edtCurBar1, 0, (char*) data->edtBuf, MAX_SEARCH_CHAR, &data->attr ); |
691 data->edt = edtCreate( data->win, &data->attr, 0, 0 ); | 679 data->edt = edtCreate( data->win, &data->attr, 0, 0 ); |
692 #endif /* NEW_EDITOR */ | 680 #endif /* NEW_EDITOR */ |
693 | 681 |
694 /* Show the menu | 682 /* Show the menu |
695 */ | 683 */ |
696 mnuUnhide(data->menu); | 684 mnuUnhide(data->menu); |
697 | 685 |
698 /* associate the phonebook handler | 686 /* associate the phonebook handler |
699 */ | 687 */ |
700 data->phbk = phbk; | 688 data->phbk = phbk; |
701 | 689 |
702 /* and return the newly created window handle | 690 /* and return the newly created window handle |
703 */ | 691 */ |
704 return data->win; | 692 return data->win; |
705 } | 693 } |
706 | 694 |
707 | 695 |
708 | |
709 | |
710 | |
711 /******************************************************************************* | 696 /******************************************************************************* |
712 | 697 |
713 Public methods | 698 Public methods |
714 | 699 |
715 *******************************************************************************/ | 700 *******************************************************************************/ |
716 | 701 |
717 /******************************************************************************* | 702 /******************************************************************************* |
718 | 703 |
719 $Function: bookSDNStart | 704 $Function: bookSDNStart |
720 | 705 |
721 $Description: This is the entry point for the service numbers window handler | 706 $Description: This is the entry point for the service numbers window handler |
722 | 707 |
723 $Returns: handle of window we are creating | 708 $Returns: handle of window we are creating |
724 | 709 |
725 $Arguments: Parent, handle of the parent window | 710 $Arguments: Parent, handle of the parent window |
726 | 711 |
727 *******************************************************************************/ | 712 *******************************************************************************/ |
728 | 713 |
729 T_MFW_HND bookSDNStart( MfwHnd parent ) | 714 T_MFW_HND bookSDNStart( MfwHnd parent ) |
730 { | 715 { |
731 T_MFW_HND win; | 716 T_MFW_HND win; |
732 T_MFW_WIN *win_data; | 717 T_MFW_WIN *win_data; |
733 tBookStandard *data; | 718 tBookStandard *data; |
734 MfwMnu *mnu; | 719 MfwMnu *mnu; |
735 | 720 |
736 TRACE_FUNCTION( "bookSDNCreate()" ); | 721 TRACE_FUNCTION( "bookSDNCreate()" ); |
737 | 722 |
738 /* We can't actually create the window if the phone book is | 723 /* We can't actually create the window if the phone book is |
739 still loading, so we will deal with this up front | 724 still loading, so we will deal with this up front |
740 */ | 725 */ |
741 if ( phb_get_mode() == PHB_LOADING ) | 726 if ( phb_get_mode() == PHB_LOADING ) |
742 { | 727 { |
743 bookShowInformation( idle_get_window(), TxtPleaseWait ,NULL, NULL ); | 728 bookShowInformation( idle_get_window(), TxtPleaseWait ,NULL, NULL ); |
744 return NULL; | 729 return NULL; |
745 } | 730 } |
746 | 731 |
747 /* Create the basic window, dealing with errors here and just terminating | 732 /* Create the basic window, dealing with errors here and just terminating |
748 if we can't create the window correctly. | 733 if we can't create the window correctly. |
749 */ | 734 */ |
750 if ( ( win = bookSDNCreate( parent ) ) == NULL ) | 735 if ( ( win = bookSDNCreate( parent ) ) == NULL ) |
751 return NULL; | 736 return NULL; |
752 | 737 |
753 /* Okay, we have created the window, so set up our internal | 738 /* Okay, we have created the window, so set up our internal |
754 working pointers and check if the current phone book has | 739 working pointers and check if the current phone book has |
755 some entries in it | 740 some entries in it |
756 */ | 741 */ |
757 win_data = ((T_MFW_HDR *) win)->data; | 742 win_data = ((T_MFW_HDR *) win)->data; |
758 data = (tBookStandard *)win_data->user; | 743 data = (tBookStandard *)win_data->user; |
759 data->phbk->current.status.book = PHB_SDN; | 744 data->phbk->current.status.book = PHB_SDN; |
760 | 745 |
761 /* we need to determine if there are any entries in the phone book | 746 /* we need to determine if there are any entries in the phone book |
762 before we allow the service number windows to be displayed, we | 747 before we allow the service number windows to be displayed, we |
763 do this by searching for an empty name | 748 do this by searching for an empty name |
764 */ | 749 */ |
765 bookGetCurrentStatus( &data->phbk->current.status ); | 750 bookGetCurrentStatus( &data->phbk->current.status ); |
766 memset( data->edtBuf, '\0' , sizeof( data->edtBuf ) ); | 751 memset( data->edtBuf, '\0' , sizeof( data->edtBuf ) ); |
767 data->phbk->current.index = 1; | 752 data->phbk->current.index = 1; |
768 data->phbk->current.selectedName = 0; | 753 data->phbk->current.selectedName = 0; |
769 bookFindName( MAX_SEARCH_NAME, &data->phbk->current ); | 754 bookFindName( MAX_SEARCH_NAME, &data->phbk->current ); |
770 | 755 |
771 /* If the current index is still zero then we have been unable to | 756 /* If the current index is still zero then we have been unable to |
772 find an entry, in this case we need to shutdown the service | 757 find an entry, in this case we need to shutdown the service |
773 numbers window, since we can't do anything with it. | 758 numbers window, since we can't do anything with it. |
774 */ | 759 */ |
775 if ( data->phbk->current.index == 0 ) | 760 if ( data->phbk->current.index == 0 ) |
776 { | 761 { |
777 bookSDNDestroy( win ); | 762 bookSDNDestroy( win ); |
778 data->phbk->search_win = 0; | 763 data->phbk->search_win = 0; |
779 bookShowInformation( idle_get_window(), TxtEmptyList ,NULL, NULL ); | 764 bookShowInformation( idle_get_window(), TxtEmptyList ,NULL, NULL ); |
780 return 0; | 765 return 0; |
781 } | 766 } |
782 | 767 |
783 /* We are still running, so set up the menu and edit structures | 768 /* We are still running, so set up the menu and edit structures |
784 accordingly, and display the window | 769 accordingly, and display the window |
785 */ | 770 */ |
786 mnu = (MfwMnu *) mfwControl( data->menu ); | 771 mnu = (MfwMnu *) mfwControl( data->menu ); |
787 mnu->lCursor[ mnu->level ] = data->phbk->current.selectedName; | 772 mnu->lCursor[ mnu->level ] = data->phbk->current.selectedName; |
788 | 773 |
789 /* SPR#1428 - SH - New Editor: editActivate no longer needed */ | 774 /* SPR#1428 - SH - New Editor: editActivate no longer needed */ |
790 #ifndef NEW_EDITOR | 775 #ifndef NEW_EDITOR |
791 editActivate( data->edt, 1 ); | 776 editActivate( data->edt, 1 ); |
792 #endif | 777 #endif |
793 winShow( data->win ); | 778 winShow( data->win ); |
794 | 779 |
795 /* return the pointer to the window | 780 /* return the pointer to the window |
796 */ | 781 */ |
797 return win; | 782 return win; |
798 } | 783 } |
799 | 784 |
800 | 785 |
801 | 786 /******************************************************************************* |
802 /******************************************************************************* | 787 |
803 | 788 $Function: bookFindNameInSDNPhonebook |
804 $Function: bookFindNameInSDNPhonebook | 789 |
805 | 790 $Description: This routine performs the FindNameInPhoneBook functionality, |
806 $Description: This routine performs the FindNameInPhoneBook functionality, | 791 tuned to the particular requirements of the service numbers |
807 tuned to the particular requirements of the service numbers | 792 phonebook. |
808 phonebook. | 793 |
809 | 794 $Returns: handle of window we are creating |
810 $Returns: handle of window we are creating | 795 |
811 | 796 $Arguments: Parent, handle of the parent window |
812 $Arguments: Parent, handle of the parent window | |
813 | 797 |
814 *******************************************************************************/ | 798 *******************************************************************************/ |
815 | 799 |
816 int bookFindNameInSDNPhonebook( const char* p_pszNumber, T_MFW_PHB_ENTRY* p_pEntry ) | 800 int bookFindNameInSDNPhonebook( const char* p_pszNumber, T_MFW_PHB_ENTRY* p_pEntry ) |
817 { | 801 { |
818 T_MFW_PHB_LIST phb_list; | 802 T_MFW_PHB_LIST phb_list; |
819 #ifdef NO_ASCIIZ | 803 #ifdef NO_ASCIIZ |
820 T_MFW_PHB_TEXT p_pszNumberText; | 804 T_MFW_PHB_TEXT p_pszNumberText; |
821 #endif | 805 #endif |
822 SHORT phb_index=0; | 806 SHORT phb_index=0; |
823 /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/ | 807 /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/ |
824 UBYTE l_name[MAX_ALPHA_LEN]; | 808 UBYTE l_name[MAX_ALPHA_LEN]; |
825 int status; | 809 int status; |
826 char bfr[80]; | 810 char bfr[80]; |
827 TRACE_FUNCTION("bookFindNameInSDNPhonebook()"); | 811 TRACE_FUNCTION("bookFindNameInSDNPhonebook()"); |
828 | 812 |
829 /* guard against dodgy input data | 813 /* guard against dodgy input data |
830 */ | 814 */ |
831 if( ( p_pszNumber == NULL ) || ( p_pEntry == NULL ) ) | 815 if( ( p_pszNumber == NULL ) || ( p_pEntry == NULL ) ) |
832 return 0; | 816 return 0; |
833 if ( strlen(p_pszNumber) < 1) | 817 if ( strlen(p_pszNumber) < 1) |
834 return (0); | 818 return (0); |
835 /* initialise the search structures | 819 /* initialise the search structures |
836 */ | 820 */ |
837 memset(p_pEntry, 0, sizeof(T_MFW_PHB_ENTRY)); | 821 memset(p_pEntry, 0, sizeof(T_MFW_PHB_ENTRY)); |
838 memset(&phb_list, 0, sizeof(phb_list)); | 822 memset(&phb_list, 0, sizeof(phb_list)); |
839 phb_list.entry = p_pEntry; | 823 phb_list.entry = p_pEntry; |
840 phb_list.num_entries = 1; | 824 phb_list.num_entries = 1; |
841 phb_list.book = PHB_SDN; | 825 phb_list.book = PHB_SDN; |
842 | 826 |
843 //GW Set up data structure for NO_ASCIIZ | 827 //GW Set up data structure for NO_ASCIIZ |
844 #ifdef NO_ASCIIZ | 828 #ifdef NO_ASCIIZ |
845 p_pszNumberText.dcs = MFW_DCS_8bits; | 829 p_pszNumberText.dcs = MFW_DCS_8bits; |
846 p_pszNumberText.len = strlen(p_pszNumber); | 830 p_pszNumberText.len = strlen(p_pszNumber); |
847 strcpy((char*)p_pszNumberText.data, p_pszNumber); | 831 strcpy((char*)p_pszNumberText.data, p_pszNumber); |
848 #endif | 832 #endif |
849 | 833 |
850 /* see what we can find using the standard search routine for | 834 /* see what we can find using the standard search routine for |
851 any phone book, giving the service numbers book as a parameter | 835 any phone book, giving the service numbers book as a parameter |
852 */ | 836 */ |
853 | 837 |
854 #ifdef NO_ASCIIZ | 838 #ifdef NO_ASCIIZ |
855 status = phb_find_entries( (UBYTE)PHB_SDN, &phb_index, (UBYTE)MFW_PHB_NUMBER, 1, &p_pszNumberText, &phb_list ); | 839 status = phb_find_entries( (UBYTE)PHB_SDN, &phb_index, (UBYTE)MFW_PHB_NUMBER, 1, &p_pszNumberText, &phb_list ); |
856 #else | 840 #else |
857 status = phb_find_entries( PHB_SDN, &phb_index, MFW_PHB_NUMBER, 1, (char *) p_pszNumber, &phb_list ); | 841 status = phb_find_entries( PHB_SDN, &phb_index, MFW_PHB_NUMBER, 1, (char *) p_pszNumber, &phb_list ); |
858 #endif | 842 #endif |
859 sprintf(bfr,"len:%2d , name: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",p_pEntry->name.len); | 843 sprintf(bfr,"len:%2d , name: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",p_pEntry->name.len); |
860 memcpy(&bfr[16], p_pEntry->name.data, PHB_MAX_LEN); | 844 memcpy(&bfr[16], p_pEntry->name.data, PHB_MAX_LEN); |
861 TRACE_FUNCTION(bfr); | 845 TRACE_FUNCTION(bfr); |
862 sprintf(bfr,"number:'%s'",p_pEntry->number); | 846 sprintf(bfr,"number:'%s'",p_pEntry->number); |
863 TRACE_FUNCTION(bfr); | 847 TRACE_FUNCTION(bfr); |
864 | 848 |
865 if (status != MFW_PHB_OK) | 849 if (status != MFW_PHB_OK) |
866 { | 850 { |
867 phb_list.result = MFW_NO_ENTRY; | 851 phb_list.result = MFW_NO_ENTRY; |
868 TRACE_FUNCTION("bookFindNameInSDNPhonebook()- status error"); | 852 TRACE_FUNCTION("bookFindNameInSDNPhonebook()- status error"); |
869 } | 853 } |
870 | 854 |
871 /* convert the returned data to manageable information | 855 /* convert the returned data to manageable information |
872 */ | 856 */ |
873 | 857 |
874 #ifdef NO_ASCIIZ | 858 #ifdef NO_ASCIIZ |
875 //GW Check that conversion returned a valid string | 859 //GW Check that conversion returned a valid string |
876 //GW Testing for 0 is stupid but since the macros PASSED and FAILED that are used by the procedure are not in the header (duh!) we can't use them. | 860 //GW Testing for 0 is stupid but since the macros PASSED and FAILED that are used by the procedure are not in the header (duh!) we can't use them. |
877 /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/ | 861 /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/ |
878 if (mfw_SIM2GsmStr( p_pEntry->name.len, p_pEntry->name.data, MAX_ALPHA_LEN, l_name ) == 0) | 862 if (mfw_SIM2GsmStr( p_pEntry->name.len, p_pEntry->name.data, MAX_ALPHA_LEN, l_name ) == 0) |
879 memcpy(p_pEntry->name.data, l_name, MAX_ALPHA_LEN); | 863 memcpy(p_pEntry->name.data, l_name, MAX_ALPHA_LEN); |
880 | 864 |
881 p_pEntry->name.data[0] = 0x00; | 865 p_pEntry->name.data[0] = 0x00; |
882 | 866 |
883 #else | 867 #else |
884 bookGsm2Alpha( p_pEntry->name ); | 868 bookGsm2Alpha( p_pEntry->name ); |
885 | 869 |
886 #endif | 870 #endif |
887 | 871 |
888 /* if we couldn't find any information, null out the return | 872 /* if we couldn't find any information, null out the return |
889 structure, this will stop people who don't check the return | 873 structure, this will stop people who don't check the return |
890 status from getting sensible information | 874 status from getting sensible information |
891 */ | 875 */ |
892 if( phb_list.result != MFW_ENTRY_EXIST ) | 876 if( phb_list.result != MFW_ENTRY_EXIST ) |
893 memset(p_pEntry, 0, sizeof(T_MFW_PHB_ENTRY)); | 877 memset(p_pEntry, 0, sizeof(T_MFW_PHB_ENTRY)); |
894 | 878 |
895 /* return status depends on result of search | 879 /* return status depends on result of search |
896 */ | 880 */ |
897 return ( phb_list.result == MFW_ENTRY_EXIST ); | 881 return ( phb_list.result == MFW_ENTRY_EXIST ); |
898 } | 882 } |
899 | 883 |
900 | 884 |
901 | 885 /******************************************************************************* |
902 | 886 |
903 | 887 $Function: bookSDNDestroy |
904 | 888 |
905 /******************************************************************************* | 889 $Description: destroys the Service Numbers window |
906 | 890 |
907 $Function: bookSDNDestroy | 891 $Returns: none. |
908 | 892 |
909 $Description: destroys the Service Numbers window | 893 $Arguments: window, handle of the window to be destroyed |
910 | |
911 $Returns: none. | |
912 | |
913 $Arguments: window, handle of the window to be destroyed | |
914 | 894 |
915 *******************************************************************************/ | 895 *******************************************************************************/ |
916 | 896 |
917 void bookSDNDestroy( MfwHnd window ) | 897 void bookSDNDestroy( MfwHnd window ) |
918 { | 898 { |
919 T_MFW_WIN *win = ((T_MFW_HDR *)window)->data; | 899 T_MFW_WIN *win = ((T_MFW_HDR *)window)->data; |
920 tBookStandard *data = (tBookStandard *)win->user; | 900 tBookStandard *data = (tBookStandard *)win->user; |
921 | 901 |
922 TRACE_FUNCTION( "bookSDNDestroy" ); | 902 TRACE_FUNCTION( "bookSDNDestroy" ); |
923 | 903 |
924 /* Guard against bad incoming data | 904 /* Guard against bad incoming data |
925 */ | 905 */ |
926 if ( ! data ) | 906 if ( ! data ) |
927 return; | 907 return; |
928 | 908 |
929 /* SPR#1428 - SH - New Editor changes */ | 909 /* SPR#1428 - SH - New Editor changes */ |
930 #ifdef NEW_EDITOR | 910 #ifdef NEW_EDITOR |
931 /* Editor is no longer destroyed with winDelete, | 911 /* Editor is no longer destroyed with winDelete, |
932 * so destroy it here. */ | 912 * so destroy it here. */ |
933 if (data->editor) | 913 if (data->editor) |
934 { | 914 { |
935 ATB_edit_Destroy(data->editor); | 915 ATB_edit_Destroy(data->editor); |
936 data->editor = 0; | 916 data->editor = 0; |
937 } | 917 } |
938 if (data->entry_data) | 918 if (data->entry_data) |
939 { | 919 { |
940 AUI_entry_Destroy(data->entry_data); | 920 AUI_entry_Destroy(data->entry_data); |
941 data->entry_data = 0; | 921 data->entry_data = 0; |
942 } | 922 } |
943 #endif /* NEW_EDITOR */ | 923 #endif /* NEW_EDITOR */ |
944 | 924 |
945 /* Destroy the window using the appropriate method | 925 /* Destroy the window using the appropriate method |
946 */ | 926 */ |
947 if ( data->phbk->root_win == window ) | 927 if ( data->phbk->root_win == window ) |
948 bookPhonebookDestroy( data->phbk->win ); | 928 bookPhonebookDestroy( data->phbk->win ); |
949 else | 929 else |
950 { | 930 { |
951 /* deleting the window, so make sure we free the memory | 931 /* deleting the window, so make sure we free the memory |
952 */ | 932 */ |
953 data->phbk->search_win = 0; | 933 data->phbk->search_win = 0; |
954 winDelete( data->win ); | 934 winDelete( data->win ); |
955 FREE_MEMORY( (void *)data, sizeof( tBookStandard ) ); | 935 FREE_MEMORY( (void *)data, sizeof( tBookStandard ) ); |
956 } | 936 } |
957 /*SPR2123, MC deallocate memory for phonebook list*/ | 937 /*SPR2123, MC deallocate memory for phonebook list*/ |
958 destroy_mmi_phonebook_names_list(MmiBookMenuDetailsList()); | 938 destroy_mmi_phonebook_names_list(MmiBookMenuDetailsList()); |
959 } | 939 } |
960 | 940 |
961 | 941 |
962 /******************************************************************************* | 942 /******************************************************************************* |
963 | 943 |
964 End of File | 944 End of File |
965 | 945 |
966 *******************************************************************************/ | 946 *******************************************************************************/ |
967 |