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: Wraps phone command extensions. |
|
15 */ |
|
16 |
|
17 #include "phonecommandextensionwrapper.h" |
|
18 #include <QtDebug> |
|
19 #include <pevirtualengine.h> |
|
20 #include <hbaction.h> |
|
21 |
|
22 bool m_setActions; |
|
23 bool m_setInvalidCommand; |
|
24 bool m_setInvalidButtonCommands; |
|
25 QList<HbAction*> m_menuActions; |
|
26 |
|
27 |
|
28 PhoneCommandExtensionWrapper::PhoneCommandExtensionWrapper(int pluginUid) : |
|
29 m_pluginUid(pluginUid) |
|
30 { |
|
31 |
|
32 } |
|
33 |
|
34 PhoneCommandExtensionWrapper::~PhoneCommandExtensionWrapper() |
|
35 { |
|
36 |
|
37 } |
|
38 |
|
39 int PhoneCommandExtensionWrapper::pluginUid() |
|
40 { |
|
41 return m_pluginUid; |
|
42 } |
|
43 |
|
44 void PhoneCommandExtensionWrapper::modifyMenuCommandList( |
|
45 const QList<XQTelUiCommandExtension::CallInfo> &callInfo, |
|
46 QList<int> &menuCmdList) |
|
47 { |
|
48 if (m_setInvalidCommand) { |
|
49 menuCmdList.append(-1); |
|
50 } |
|
51 } |
|
52 |
|
53 void PhoneCommandExtensionWrapper::modifyPushButtonCommandList( |
|
54 const QList<XQTelUiCommandExtension::CallInfo> &callInfo, |
|
55 QList<int> &buttonCmdList) |
|
56 { |
|
57 if (m_setInvalidButtonCommands) { |
|
58 buttonCmdList.clear(); |
|
59 buttonCmdList.append(-1); |
|
60 buttonCmdList.append(-2); |
|
61 } |
|
62 } |
|
63 |
|
64 void PhoneCommandExtensionWrapper::addMenuActions( |
|
65 const QList<XQTelUiCommandExtension::CallInfo> &callInfo, |
|
66 QList<HbAction*> &menuActions) |
|
67 { |
|
68 if (m_setActions) { |
|
69 HbAction *action = new HbAction; |
|
70 action->setText(QString("Test")); |
|
71 m_menuActions.append(action); |
|
72 menuActions.append(action); |
|
73 } |
|
74 } |
|
75 |
|
76 void PhoneCommandExtensionWrapper::releaseMenu() |
|
77 { |
|
78 qDeleteAll(m_menuActions); |
|
79 m_menuActions.clear(); |
|
80 } |
|
81 |
|
82 void PhoneCommandExtensionWrapper::release() |
|
83 { |
|
84 |
|
85 } |
|
86 |
|
87 void PhoneCommandExtensionWrapper::getCallInfoList( |
|
88 QList<XQTelUiCommandExtension::CallInfo> &callInfo, |
|
89 QMap<int,int> callStates, |
|
90 QMap<int,int> serviceIds, |
|
91 int expandedCall ) |
|
92 { |
|
93 for (int i=0;i<callStates.keys().count();++i) { |
|
94 XQTelUiCommandExtension::CallInfo info; |
|
95 info.mCallState = mapCallState(callStates.values().at(i)); |
|
96 info.mServiceId = serviceIds.value(callStates.keys().at(i)); |
|
97 info.mIsExpanded = (expandedCall == callStates.keys().at(i)); |
|
98 callInfo.append(info); |
|
99 } |
|
100 } |
|
101 |
|
102 XQTelUiCommandExtension::CallState PhoneCommandExtensionWrapper::mapCallState( |
|
103 int callState ) |
|
104 { |
|
105 XQTelUiCommandExtension::CallState state(XQTelUiCommandExtension::None); |
|
106 |
|
107 switch( callState ) { |
|
108 case EPEStateDisconnecting: |
|
109 { |
|
110 state = XQTelUiCommandExtension::Disconnecting; |
|
111 } |
|
112 break; |
|
113 case EPEStateRinging: |
|
114 { |
|
115 state = XQTelUiCommandExtension::Incoming; |
|
116 } |
|
117 break; |
|
118 case EPEStateDialing: |
|
119 case EPEStateConnecting: |
|
120 { |
|
121 state = XQTelUiCommandExtension::Outgoing; |
|
122 } |
|
123 break; |
|
124 case EPEStateConnected: |
|
125 case EPEStateConnectedConference: |
|
126 { |
|
127 state = XQTelUiCommandExtension::Active; |
|
128 } |
|
129 break; |
|
130 case EPEStateHeld: |
|
131 case EPEStateHeldConference: |
|
132 { |
|
133 state = XQTelUiCommandExtension::OnHold; |
|
134 } |
|
135 break; |
|
136 case EPEStateUnknown: |
|
137 case EPEStateIdle: |
|
138 case EPEStateConferenceIdle: |
|
139 break; |
|
140 default: |
|
141 break; |
|
142 } |
|
143 |
|
144 return state; |
|
145 } |
|
146 |
|
147 |
|