39
39
// ]]] end generated region [Generated Constants]
41
41
Csymbian_ua_guiContainerView *myinstance = NULL;
42
_LIT(KStCall, "Call");
43
_LIT(KStHangUp, "Hang Up");
45
void on_info(const wchar_t* buf)
47
TPtrC aBuf((const TUint16*)buf);
50
myinstance->PutMessage(aBuf);
53
void on_incoming_call(const wchar_t* caller_disp, const wchar_t* caller_uri)
56
TPtrC aDisp((const TUint16*)caller_disp);
57
TPtrC aUri((const TUint16*)caller_uri);
58
_LIT(KFormat, "Incoming call from %S, accept?");
60
buf.Format(KFormat, &aDisp);
61
if (Csymbian_ua_guiContainerView::RunQry_accept_callL(&buf) == EAknSoftkeyYes)
63
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
65
TRAPD(result, cba->SetCommandL(ESymbian_ua_guiContainerViewControlPaneRightId, KStHangUp));
68
symbian_ua_answercall();
74
void on_call_end(const wchar_t* reason)
76
TPtrC aReason((const TUint16*)reason);
78
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
80
TRAPD(result, cba->SetCommandL(ESymbian_ua_guiContainerViewControlPaneRightId, KStCall));
84
Csymbian_ua_guiContainerView::RunNote_infoL(&aReason);
87
void on_reg_state(bool success)
90
Csymbian_ua_guiContainerView::RunNote_infoL();
92
Csymbian_ua_guiContainerView::RunNote_warningL();
95
void on_unreg_state(bool success)
97
TPtrC st_success(_L("Unregistration Success!"));
98
TPtrC st_failed(_L("Unregistration Failed!"));
101
Csymbian_ua_guiContainerView::RunNote_infoL(&st_success);
103
Csymbian_ua_guiContainerView::RunNote_warningL(&st_failed);
106
void Csymbian_ua_guiContainerView::PutMessage(const TDesC &msg)
108
if (!iSymbian_ua_guiContainer)
111
CEikEdwin *obj_info = (CEikEdwin*) iSymbian_ua_guiContainer->ComponentControl(iSymbian_ua_guiContainer->EEd_info);
113
obj_info->SetTextL(&msg);
114
obj_info->DrawDeferred();
42
_LIT (KStCall, "Call");
43
_LIT (KStHangUp, "Hang Up");
45
void on_info (const wchar_t* buf)
47
TPtrC aBuf ( (const TUint16*) buf);
50
myinstance->PutMessage (aBuf);
53
void on_incoming_call (const wchar_t* caller_disp, const wchar_t* caller_uri)
56
TPtrC aDisp ( (const TUint16*) caller_disp);
57
TPtrC aUri ( (const TUint16*) caller_uri);
58
_LIT (KFormat, "Incoming call from %S, accept?");
60
buf.Format (KFormat, &aDisp);
62
if (Csymbian_ua_guiContainerView::RunQry_accept_callL (&buf) == EAknSoftkeyYes) {
63
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
66
TRAPD (result, cba->SetCommandL (ESymbian_ua_guiContainerViewControlPaneRightId, KStHangUp));
70
symbian_ua_answercall();
76
void on_call_end (const wchar_t* reason)
78
TPtrC aReason ( (const TUint16*) reason);
80
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
83
TRAPD (result, cba->SetCommandL (ESymbian_ua_guiContainerViewControlPaneRightId, KStCall));
87
Csymbian_ua_guiContainerView::RunNote_infoL (&aReason);
90
void on_reg_state (bool success)
93
Csymbian_ua_guiContainerView::RunNote_infoL();
95
Csymbian_ua_guiContainerView::RunNote_warningL();
98
void on_unreg_state (bool success)
100
TPtrC st_success (_L ("Unregistration Success!"));
101
TPtrC st_failed (_L ("Unregistration Failed!"));
104
Csymbian_ua_guiContainerView::RunNote_infoL (&st_success);
106
Csymbian_ua_guiContainerView::RunNote_warningL (&st_failed);
109
void Csymbian_ua_guiContainerView::PutMessage (const TDesC &msg)
111
if (!iSymbian_ua_guiContainer)
114
CEikEdwin *obj_info = (CEikEdwin*) iSymbian_ua_guiContainer->ComponentControl (iSymbian_ua_guiContainer->EEd_info);
116
obj_info->SetTextL (&msg);
117
obj_info->DrawDeferred();
118
121
* First phase of Symbian two-phase construction. Should not contain any
119
122
* code that could leave.
121
124
Csymbian_ua_guiContainerView::Csymbian_ua_guiContainerView()
123
// [[[ begin generated region: do not modify [Generated Contents]
124
iSymbian_ua_guiContainer = NULL;
125
// ]]] end generated region [Generated Contents]
126
// [[[ begin generated region: do not modify [Generated Contents]
127
iSymbian_ua_guiContainer = NULL;
128
// ]]] end generated region [Generated Contents]
129
132
* The view's destructor removes the container from the control
130
133
* stack and destroys it.
132
135
Csymbian_ua_guiContainerView::~Csymbian_ua_guiContainerView()
134
// [[[ begin generated region: do not modify [Generated Contents]
135
delete iSymbian_ua_guiContainer;
136
iSymbian_ua_guiContainer = NULL;
137
// ]]] end generated region [Generated Contents]
139
symbian_ua_set_info_callback(NULL);
137
// [[[ begin generated region: do not modify [Generated Contents]
138
delete iSymbian_ua_guiContainer;
139
iSymbian_ua_guiContainer = NULL;
140
// ]]] end generated region [Generated Contents]
142
symbian_ua_set_info_callback (NULL);
144
147
* Symbian two-phase constructor.
160
163
* @return new instance of Csymbian_ua_guiContainerView
162
165
Csymbian_ua_guiContainerView* Csymbian_ua_guiContainerView::NewLC()
164
Csymbian_ua_guiContainerView* self = new ( ELeave ) Csymbian_ua_guiContainerView();
165
CleanupStack::PushL( self );
167
Csymbian_ua_guiContainerView* self = new (ELeave) Csymbian_ua_guiContainerView();
168
CleanupStack::PushL (self);
172
* Second-phase constructor for view.
175
* Second-phase constructor for view.
173
176
* Initialize contents from resource.
175
178
void Csymbian_ua_guiContainerView::ConstructL()
177
// [[[ begin generated region: do not modify [Generated Code]
178
BaseConstructL( R_SYMBIAN_UA_GUI_CONTAINER_SYMBIAN_UA_GUI_CONTAINER_VIEW );
179
// ]]] end generated region [Generated Code]
181
// add your own initialization code here
182
symbian_ua_info_cb_t cb;
183
Mem::FillZ(&cb, sizeof(cb));
185
cb.on_info = &on_info;
186
cb.on_incoming_call = &on_incoming_call;
187
cb.on_reg_state = &on_reg_state;
188
cb.on_unreg_state = &on_unreg_state;
189
cb.on_call_end = &on_call_end;
191
symbian_ua_set_info_callback(&cb);
180
// [[[ begin generated region: do not modify [Generated Code]
181
BaseConstructL (R_SYMBIAN_UA_GUI_CONTAINER_SYMBIAN_UA_GUI_CONTAINER_VIEW);
182
// ]]] end generated region [Generated Code]
184
// add your own initialization code here
185
symbian_ua_info_cb_t cb;
186
Mem::FillZ (&cb, sizeof (cb));
188
cb.on_info = &on_info;
189
cb.on_incoming_call = &on_incoming_call;
190
cb.on_reg_state = &on_reg_state;
191
cb.on_unreg_state = &on_unreg_state;
192
cb.on_call_end = &on_call_end;
194
symbian_ua_set_info_callback (&cb);
196
199
* @return The UID for this view
198
201
TUid Csymbian_ua_guiContainerView::Id() const
200
return TUid::Uid( ESymbian_ua_guiContainerViewId );
203
return TUid::Uid (ESymbian_ua_guiContainerViewId);
204
207
* Handle a command for this view (override)
205
208
* @param aCommand command id to be handled
207
void Csymbian_ua_guiContainerView::HandleCommandL( TInt aCommand )
209
// [[[ begin generated region: do not modify [Generated Code]
210
TBool commandHandled = EFalse;
212
{ // code to dispatch to the AknView's menu and CBA commands is generated here
214
case ESymbian_ua_guiContainerViewControlPaneRightId:
215
commandHandled = CallSoftKeyPressedL( aCommand );
217
case ESymbian_ua_guiContainerViewSettingMenuItemCommand:
218
commandHandled = HandleSettingMenuItemSelectedL( aCommand );
225
if ( !commandHandled )
228
if ( aCommand == ESymbian_ua_guiContainerViewControlPaneRightId )
230
AppUi()->HandleCommandL( EEikCmdExit );
234
// ]]] end generated region [Generated Code]
210
void Csymbian_ua_guiContainerView::HandleCommandL (TInt aCommand)
212
// [[[ begin generated region: do not modify [Generated Code]
213
TBool commandHandled = EFalse;
215
switch (aCommand) { // code to dispatch to the AknView's menu and CBA commands is generated here
217
case ESymbian_ua_guiContainerViewControlPaneRightId:
218
commandHandled = CallSoftKeyPressedL (aCommand);
220
case ESymbian_ua_guiContainerViewSettingMenuItemCommand:
221
commandHandled = HandleSettingMenuItemSelectedL (aCommand);
228
if (!commandHandled) {
230
if (aCommand == ESymbian_ua_guiContainerViewControlPaneRightId) {
231
AppUi()->HandleCommandL (EEikCmdExit);
236
// ]]] end generated region [Generated Code]
239
* Handles user actions during activation of the view,
241
* Handles user actions during activation of the view,
240
242
* such as initializing the content.
242
void Csymbian_ua_guiContainerView::DoActivateL(
243
const TVwsViewId& /*aPrevViewId*/,
244
TUid /*aCustomMessageId*/,
245
const TDesC8& /*aCustomMessage*/ )
247
// [[[ begin generated region: do not modify [Generated Contents]
250
CEikButtonGroupContainer* cba = AppUi()->Cba();
253
cba->MakeVisible( EFalse );
256
if ( iSymbian_ua_guiContainer == NULL )
258
iSymbian_ua_guiContainer = CSymbian_ua_guiContainer::NewL( ClientRect(), NULL, this );
259
iSymbian_ua_guiContainer->SetMopParent( this );
260
AppUi()->AddToStackL( *this, iSymbian_ua_guiContainer );
262
// ]]] end generated region [Generated Contents]
264
cba = CEikButtonGroupContainer::Current();
266
if (symbian_ua_anycall())
267
cba->SetCommandL(ESymbian_ua_guiContainerViewControlPaneRightId, KStHangUp);
269
cba->SetCommandL(ESymbian_ua_guiContainerViewControlPaneRightId, KStCall);
244
void Csymbian_ua_guiContainerView::DoActivateL (
245
const TVwsViewId& /*aPrevViewId*/,
246
TUid /*aCustomMessageId*/,
247
const TDesC8& /*aCustomMessage*/)
249
// [[[ begin generated region: do not modify [Generated Contents]
252
CEikButtonGroupContainer* cba = AppUi()->Cba();
255
cba->MakeVisible (EFalse);
258
if (iSymbian_ua_guiContainer == NULL) {
259
iSymbian_ua_guiContainer = CSymbian_ua_guiContainer::NewL (ClientRect(), NULL, this);
260
iSymbian_ua_guiContainer->SetMopParent (this);
261
AppUi()->AddToStackL (*this, iSymbian_ua_guiContainer);
264
// ]]] end generated region [Generated Contents]
266
cba = CEikButtonGroupContainer::Current();
269
if (symbian_ua_anycall())
270
cba->SetCommandL (ESymbian_ua_guiContainerViewControlPaneRightId, KStHangUp);
272
cba->SetCommandL (ESymbian_ua_guiContainerViewControlPaneRightId, KStCall);
276
279
void Csymbian_ua_guiContainerView::DoDeactivate()
278
// [[[ begin generated region: do not modify [Generated Contents]
281
CEikButtonGroupContainer* cba = AppUi()->Cba();
284
cba->MakeVisible( ETrue );
288
if ( iSymbian_ua_guiContainer != NULL )
290
AppUi()->RemoveFromViewStack( *this, iSymbian_ua_guiContainer );
291
delete iSymbian_ua_guiContainer;
292
iSymbian_ua_guiContainer = NULL;
294
// ]]] end generated region [Generated Contents]
281
// [[[ begin generated region: do not modify [Generated Contents]
284
CEikButtonGroupContainer* cba = AppUi()->Cba();
287
cba->MakeVisible (ETrue);
291
if (iSymbian_ua_guiContainer != NULL) {
292
AppUi()->RemoveFromViewStack (*this, iSymbian_ua_guiContainer);
293
delete iSymbian_ua_guiContainer;
294
iSymbian_ua_guiContainer = NULL;
297
// ]]] end generated region [Generated Contents]
298
301
// [[[ begin generated function: do not modify
299
302
void Csymbian_ua_guiContainerView::SetupStatusPaneL()
301
// reset the context pane
302
TUid contextPaneUid = TUid::Uid( EEikStatusPaneUidContext );
303
CEikStatusPaneBase::TPaneCapabilities subPaneContext =
304
StatusPane()->PaneCapabilities( contextPaneUid );
305
if ( subPaneContext.IsPresent() && subPaneContext.IsAppOwned() )
307
CAknContextPane* context = static_cast< CAknContextPane* > (
308
StatusPane()->ControlL( contextPaneUid ) );
309
context->SetPictureToDefaultL();
312
// setup the title pane
313
TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle );
314
CEikStatusPaneBase::TPaneCapabilities subPaneTitle =
315
StatusPane()->PaneCapabilities( titlePaneUid );
316
if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() )
318
CAknTitlePane* title = static_cast< CAknTitlePane* >(
319
StatusPane()->ControlL( titlePaneUid ) );
320
TResourceReader reader;
321
iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_TITLE_RESOURCE );
322
title->SetFromResourceL( reader );
323
CleanupStack::PopAndDestroy(); // reader internal state
304
// reset the context pane
305
TUid contextPaneUid = TUid::Uid (EEikStatusPaneUidContext);
306
CEikStatusPaneBase::TPaneCapabilities subPaneContext =
307
StatusPane()->PaneCapabilities (contextPaneUid);
309
if (subPaneContext.IsPresent() && subPaneContext.IsAppOwned()) {
310
CAknContextPane* context = static_cast< CAknContextPane* > (
311
StatusPane()->ControlL (contextPaneUid));
312
context->SetPictureToDefaultL();
315
// setup the title pane
316
TUid titlePaneUid = TUid::Uid (EEikStatusPaneUidTitle);
317
CEikStatusPaneBase::TPaneCapabilities subPaneTitle =
318
StatusPane()->PaneCapabilities (titlePaneUid);
320
if (subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned()) {
321
CAknTitlePane* title = static_cast< CAknTitlePane* > (
322
StatusPane()->ControlL (titlePaneUid));
323
TResourceReader reader;
324
iEikonEnv->CreateResourceReaderLC (reader, R_SYMBIAN_UA_GUI_CONTAINER_TITLE_RESOURCE);
325
title->SetFromResourceL (reader);
326
CleanupStack::PopAndDestroy(); // reader internal state
327
330
// ]]] end generated function
329
332
// [[[ begin generated function: do not modify
330
333
void Csymbian_ua_guiContainerView::CleanupStatusPane()
333
336
// ]]] end generated function
336
339
* Handle status pane size change for this view (override)
338
341
void Csymbian_ua_guiContainerView::HandleStatusPaneSizeChange()
340
CAknView::HandleStatusPaneSizeChange();
342
// this may fail, but we're not able to propagate exceptions here
344
TRAP( result, SetupStatusPaneL() );
343
CAknView::HandleStatusPaneSizeChange();
345
// this may fail, but we're not able to propagate exceptions here
347
TRAP (result, SetupStatusPaneL());
348
351
* Handle the rightSoftKeyPressed event.
349
352
* @return ETrue if the command was handled, EFalse if not
351
TBool Csymbian_ua_guiContainerView::CallSoftKeyPressedL( TInt aCommand )
353
CEikEdwin *obj_url = (CEikEdwin*) iSymbian_ua_guiContainer->ComponentControl(iSymbian_ua_guiContainer->EEd_url);
354
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
356
if (symbian_ua_anycall()) {
357
symbian_ua_endcall();
361
PutMessage(_L("Making call..."));
363
cba->SetCommandL(aCommand, KStHangUp);
369
TPtr8 aUrl(url, 256);
371
HBufC *buf = obj_url->GetTextInHBufL();
372
CnvUtfConverter::ConvertFromUnicodeToUtf8(aUrl, *buf);
375
if (symbian_ua_makecall((char *)aUrl.PtrZ()) != 0) {
376
PutMessage(_L("Making call failed!"));
378
cba->SetCommandL(aCommand, KStCall);
354
TBool Csymbian_ua_guiContainerView::CallSoftKeyPressedL (TInt aCommand)
356
CEikEdwin *obj_url = (CEikEdwin*) iSymbian_ua_guiContainer->ComponentControl (iSymbian_ua_guiContainer->EEd_url);
357
CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
359
if (symbian_ua_anycall()) {
360
symbian_ua_endcall();
364
PutMessage (_L ("Making call..."));
367
cba->SetCommandL (aCommand, KStHangUp);
373
TPtr8 aUrl (url, 256);
375
HBufC *buf = obj_url->GetTextInHBufL();
376
CnvUtfConverter::ConvertFromUnicodeToUtf8 (aUrl, *buf);
379
if (symbian_ua_makecall ( (char *) aUrl.PtrZ()) != 0) {
380
PutMessage (_L ("Making call failed!"));
383
cba->SetCommandL (aCommand, KStCall);
387
392
* Handle the selected event.
388
393
* @param aCommand the command id invoked
389
394
* @return ETrue if the command was handled, EFalse if not
391
TBool Csymbian_ua_guiContainerView::HandleSettingMenuItemSelectedL( TInt aCommand )
393
AppUi()->ActivateLocalViewL(TUid::Uid(ESymbian_ua_guiSettingItemListViewId));
396
TBool Csymbian_ua_guiContainerView::HandleSettingMenuItemSelectedL (TInt aCommand)
398
AppUi()->ActivateLocalViewL (TUid::Uid (ESymbian_ua_guiSettingItemListViewId));
397
402
// [[[ begin generated function: do not modify
399
404
* Show the popup note for note_error
400
405
* @param aOverrideText optional override text
402
void Csymbian_ua_guiContainerView::RunNote_errorL( const TDesC* aOverrideText )
404
CAknErrorNote* note = new ( ELeave ) CAknErrorNote();
405
if ( aOverrideText == NULL )
407
HBufC* noteText = StringLoader::LoadLC( R_SYMBIAN_UA_GUI_CONTAINER_NOTE_ERROR );
408
note->ExecuteLD( *noteText );
409
CleanupStack::PopAndDestroy( noteText );
413
note->ExecuteLD( *aOverrideText );
407
void Csymbian_ua_guiContainerView::RunNote_errorL (const TDesC* aOverrideText)
409
CAknErrorNote* note = new (ELeave) CAknErrorNote();
411
if (aOverrideText == NULL) {
412
HBufC* noteText = StringLoader::LoadLC (R_SYMBIAN_UA_GUI_CONTAINER_NOTE_ERROR);
413
note->ExecuteLD (*noteText);
414
CleanupStack::PopAndDestroy (noteText);
416
note->ExecuteLD (*aOverrideText);
416
419
// ]]] end generated function
418
421
// [[[ begin generated function: do not modify