62
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Class handles Easy dialing specific commands
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "cphoneeasydialingcontroller.h"
|
|
19 |
|
|
20 |
#include "cdialer.h"
|
|
21 |
#include "tphonecommandparam.h"
|
|
22 |
#include "tphonecmdparaminteger.h"
|
|
23 |
#include "tphonecmdparamdynmenu.h"
|
|
24 |
#include "dialingextensioninterface.h"
|
|
25 |
#include "easydialingcommands.hrh"
|
|
26 |
|
|
27 |
// ======== MEMBER FUNCTIONS ========
|
|
28 |
|
|
29 |
// ---------------------------------------------------------------------------
|
|
30 |
// CPhoneEasyDialingController::CPhoneEasyDialingController
|
|
31 |
// ---------------------------------------------------------------------------
|
|
32 |
//
|
|
33 |
CPhoneEasyDialingController::CPhoneEasyDialingController(
|
|
34 |
CDialer& aDialer )
|
|
35 |
: iDialer ( aDialer )
|
|
36 |
{
|
|
37 |
// Get Easydialing interface. This can be NULL if easydialing is not
|
|
38 |
// present in current device configuration.
|
|
39 |
iEasyDialing = iDialer.GetEasyDialingInterface();
|
|
40 |
}
|
|
41 |
|
|
42 |
// ---------------------------------------------------------------------------
|
|
43 |
// CPhoneEasyDialingController::NewL
|
|
44 |
// ---------------------------------------------------------------------------
|
|
45 |
//
|
|
46 |
CPhoneEasyDialingController* CPhoneEasyDialingController::NewL(
|
|
47 |
CDialer& aDialer )
|
|
48 |
{
|
|
49 |
return new (ELeave) CPhoneEasyDialingController( aDialer );
|
|
50 |
}
|
|
51 |
|
|
52 |
// ---------------------------------------------------------------------------
|
|
53 |
// CPhoneEasyDialingController::~CPhoneEasyDialingController
|
|
54 |
// ---------------------------------------------------------------------------
|
|
55 |
//
|
|
56 |
CPhoneEasyDialingController::~CPhoneEasyDialingController()
|
|
57 |
{
|
|
58 |
}
|
|
59 |
|
|
60 |
// ---------------------------------------------------------------------------
|
|
61 |
// CPhoneEasyDialingController::ExecuteCommandL
|
|
62 |
// ---------------------------------------------------------------------------
|
|
63 |
//
|
|
64 |
void CPhoneEasyDialingController::ExecuteCommandL(
|
|
65 |
TPhoneViewCommandId aCmdId,
|
|
66 |
TPhoneCommandParam* aCommandParam )
|
|
67 |
{
|
|
68 |
if ( iEasyDialing )
|
|
69 |
{
|
|
70 |
switch ( aCmdId )
|
|
71 |
{
|
|
72 |
case EPhoneViewGetEasyDialingMenuId:
|
|
73 |
{
|
|
74 |
TPhoneCmdParamInteger* paramInt =
|
|
75 |
static_cast<TPhoneCmdParamInteger*>( aCommandParam );
|
|
76 |
paramInt->SetInteger( iEasyDialing->MenuResourceId() );
|
|
77 |
}
|
|
78 |
break;
|
|
79 |
|
|
80 |
case EPhoneViewGetEasyDialingCbaId:
|
|
81 |
{
|
|
82 |
TPhoneCmdParamInteger* paramInt =
|
|
83 |
static_cast<TPhoneCmdParamInteger*>( aCommandParam );
|
|
84 |
paramInt->SetInteger( iEasyDialing->CbaResourceId() );
|
|
85 |
}
|
|
86 |
break;
|
|
87 |
|
|
88 |
default:
|
|
89 |
break;
|
|
90 |
}
|
|
91 |
}
|
|
92 |
}
|
|
93 |
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
// CPhoneEasyDialingController::HandleCommandL
|
|
96 |
// ---------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
TPhoneViewResponseId CPhoneEasyDialingController::HandleCommandL(
|
|
99 |
TPhoneViewCommandId aCmdId )
|
|
100 |
{
|
|
101 |
TPhoneViewResponseId viewResponse = EPhoneViewResponseFailed;
|
|
102 |
|
|
103 |
switch ( aCmdId )
|
|
104 |
{
|
|
105 |
// commands defined in easydialingcommands.hrh are forwarded to
|
|
106 |
// easydialing plugin
|
|
107 |
case EEasyDialingVoiceCall:
|
|
108 |
case EEasyDialingVideoCall:
|
|
109 |
case EEasyDialingSendMessage:
|
|
110 |
case EEasyDialingOpenContact:
|
|
111 |
case EEasyDialingCallHandlingActivated:
|
|
112 |
case EEasyDialingEnterKeyAction:
|
|
113 |
case EEasyDialingOn:
|
|
114 |
case EEasyDialingOff:
|
|
115 |
{
|
|
116 |
if( iEasyDialing && iEasyDialing->HandleCommandL( aCmdId ) )
|
|
117 |
{
|
|
118 |
viewResponse = EPhoneViewResponseSuccess;
|
|
119 |
}
|
|
120 |
}
|
|
121 |
break;
|
|
122 |
|
|
123 |
case EPhoneViewGetEasyDialingInFocusStatus:
|
|
124 |
{
|
|
125 |
if ( iEasyDialing && iEasyDialing->IsFocused() )
|
|
126 |
{
|
|
127 |
viewResponse = EPhoneViewResponseSuccess;
|
|
128 |
}
|
|
129 |
}
|
|
130 |
break;
|
|
131 |
}
|
|
132 |
|
|
133 |
return viewResponse;
|
|
134 |
}
|
|
135 |
|
|
136 |
// ---------------------------------------------------------------------------
|
|
137 |
// CPhoneEasyDialingController::InitializeEasyDialingMenuL
|
|
138 |
// ---------------------------------------------------------------------------
|
|
139 |
//
|
|
140 |
TBool CPhoneEasyDialingController::InitializeEasyDialingMenuL(
|
|
141 |
TPhoneCommandParam* aCommandParam )
|
|
142 |
{
|
|
143 |
TBool retVal( EFalse );
|
|
144 |
if ( iEasyDialing )
|
|
145 |
{
|
|
146 |
TPhoneCmdParamDynMenu* menu = static_cast<TPhoneCmdParamDynMenu*>( aCommandParam );
|
|
147 |
|
|
148 |
// TInt resourceId = menu->ResourceId();
|
|
149 |
CEikMenuPane* menuPane = reinterpret_cast<CEikMenuPane*>( menu->DynMenu() );
|
|
150 |
|
|
151 |
retVal = iEasyDialing->InitializeMenuPaneL( *menuPane, menu->ResourceId() );
|
|
152 |
}
|
|
153 |
return retVal;
|
|
154 |
}
|