1 /*! |
1 /*! |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
13 * |
13 * |
14 * Description: Wraps phone command extensions. |
14 * Description: Wraps phone command extensions. |
15 */ |
15 */ |
16 |
16 |
17 #include "phonecommandextensionwrapper.h" |
17 #include "phonecommandextensionwrapper.h" |
18 #include <QtDebug> |
18 #include "qtphonelog.h" |
19 #include <xqplugin.h> |
19 #include <xqplugin.h> |
20 #include <xqpluginloader.h> |
20 #include <xqpluginloader.h> |
21 #include <pevirtualengine.h> |
21 #include <pevirtualengine.h> |
22 |
22 |
23 |
23 |
24 PhoneCommandExtensionWrapper::PhoneCommandExtensionWrapper(int pluginUid) : |
24 PhoneCommandExtensionWrapper::PhoneCommandExtensionWrapper(int pluginUid) : |
25 m_plugin(0),m_pluginUid(pluginUid) |
25 m_plugin(0),m_pluginUid(pluginUid) |
26 { |
26 { |
27 qDebug() << "PhoneCommandExtensionWrapper::PhoneMenuExtensionWrapper"; |
27 PHONE_DEBUG("PhoneCommandExtensionWrapper::PhoneMenuExtensionWrapper"); |
28 XQPluginLoader pluginLoader; |
28 XQPluginLoader pluginLoader; |
29 pluginLoader.setUid(m_pluginUid); |
29 pluginLoader.setUid(m_pluginUid); |
30 |
30 |
31 QObject *plugin = pluginLoader.instance(); |
31 QObject *plugin = pluginLoader.instance(); |
32 |
32 |
33 if (plugin) { |
33 if (plugin) { |
34 m_plugin = qobject_cast<XQTelUiCommandExtension*>(plugin); |
34 m_plugin = qobject_cast<XQTelUiCommandExtension*>(plugin); |
35 } |
35 } |
36 } |
36 } |
37 |
37 |
38 PhoneCommandExtensionWrapper::~PhoneCommandExtensionWrapper() |
38 PhoneCommandExtensionWrapper::~PhoneCommandExtensionWrapper() |
39 { |
39 { |
40 qDebug() << "PhoneCommandExtensionWrapper::~PhoneCommandExtensionWrapper"; |
40 PHONE_DEBUG("PhoneCommandExtensionWrapper::~PhoneCommandExtensionWrapper"); |
41 release(); |
41 release(); |
42 } |
42 } |
43 |
43 |
44 int PhoneCommandExtensionWrapper::pluginUid() |
44 int PhoneCommandExtensionWrapper::pluginUid() |
45 { |
45 { |
46 return m_pluginUid; |
46 return m_pluginUid; |
47 } |
47 } |
48 |
48 |
49 void PhoneCommandExtensionWrapper::modifyMenuCommandList( |
49 void PhoneCommandExtensionWrapper::modifyMenuCommandList( |
50 const QList<XQTelUiCommandExtension::CallInfo> &callInfo, |
50 const QList<XQTelUiCommandExtension::CallInfo> &callInfo, |
51 QList<int> &menuCmdList) |
51 QList<int> &menuCmdList) |
52 { |
52 { |
53 if (m_plugin) { |
53 if (m_plugin) { |
54 m_plugin->modifyMenuCommandList(callInfo, menuCmdList); |
54 m_plugin->modifyMenuCommandList(callInfo, menuCmdList); |
55 } |
55 } |
56 } |
56 } |
57 |
57 |
58 void PhoneCommandExtensionWrapper::modifyPushButtonCommandList( |
58 void PhoneCommandExtensionWrapper::modifyPushButtonCommandList( |
59 const QList<XQTelUiCommandExtension::CallInfo> &callInfo, |
59 const QList<XQTelUiCommandExtension::CallInfo> &callInfo, |
60 QList<int> &buttonCmdList) |
60 QList<int> &buttonCmdList) |
61 { |
61 { |
62 if (m_plugin) { |
62 if (m_plugin) { |
63 m_plugin->modifyPushButtonCommandList(callInfo, buttonCmdList); |
63 m_plugin->modifyPushButtonCommandList(callInfo, buttonCmdList); |
64 } |
64 } |
65 } |
65 } |
66 |
66 |
88 } |
88 } |
89 } |
89 } |
90 |
90 |
91 void PhoneCommandExtensionWrapper::getCallInfoList( |
91 void PhoneCommandExtensionWrapper::getCallInfoList( |
92 QList<XQTelUiCommandExtension::CallInfo> &callInfo, |
92 QList<XQTelUiCommandExtension::CallInfo> &callInfo, |
93 QMap<int,int> callStates, |
93 QMap<int,int> callStates, |
94 QMap<int,int> serviceIds, |
94 QMap<int,int> serviceIds, |
95 int expandedCall ) |
95 int expandedCall ) |
96 { |
96 { |
97 for (int i=0;i<callStates.keys().count();++i) { |
97 for (int i=0;i<callStates.keys().count();++i) { |
98 XQTelUiCommandExtension::CallInfo info; |
98 XQTelUiCommandExtension::CallInfo info; |
105 |
105 |
106 XQTelUiCommandExtension::CallState PhoneCommandExtensionWrapper::mapCallState( |
106 XQTelUiCommandExtension::CallState PhoneCommandExtensionWrapper::mapCallState( |
107 int callState ) |
107 int callState ) |
108 { |
108 { |
109 XQTelUiCommandExtension::CallState state(XQTelUiCommandExtension::None); |
109 XQTelUiCommandExtension::CallState state(XQTelUiCommandExtension::None); |
110 |
110 |
111 switch( callState ) { |
111 switch( callState ) { |
112 case EPEStateDisconnecting: { |
112 case EPEStateDisconnecting: { |
113 state = XQTelUiCommandExtension::Disconnecting; |
113 state = XQTelUiCommandExtension::Disconnecting; |
114 } |
114 } |
115 break; |
115 break; |
116 |
116 |
117 case EPEStateRinging: { |
117 case EPEStateRinging: { |
118 state = XQTelUiCommandExtension::Incoming; |
118 state = XQTelUiCommandExtension::Incoming; |
119 } |
119 } |
120 break; |
120 break; |
121 |
121 |
122 case EPEStateDialing: |
122 case EPEStateDialing: |
123 case EPEStateConnecting: { |
123 case EPEStateConnecting: { |
124 state = XQTelUiCommandExtension::Outgoing; |
124 state = XQTelUiCommandExtension::Outgoing; |
125 } |
125 } |
126 break; |
126 break; |
127 |
127 |
128 case EPEStateConnected: |
128 case EPEStateConnected: |
129 case EPEStateConnectedConference: { |
129 case EPEStateConnectedConference: { |
130 state = XQTelUiCommandExtension::Active; |
130 state = XQTelUiCommandExtension::Active; |
131 } |
131 } |
132 break; |
132 break; |
133 |
133 |
134 case EPEStateHeld: |
134 case EPEStateHeld: |
135 case EPEStateHeldConference: { |
135 case EPEStateHeldConference: { |
136 state = XQTelUiCommandExtension::OnHold; |
136 state = XQTelUiCommandExtension::OnHold; |
137 } |
137 } |
138 break; |
138 break; |
139 |
139 |
140 case EPEStateUnknown: |
140 case EPEStateUnknown: |
141 case EPEStateIdle: |
141 case EPEStateIdle: |
142 case EPEStateConferenceIdle: |
142 case EPEStateConferenceIdle: |
143 break; |
143 break; |
144 |
144 |
145 default: |
145 default: |
146 break; |
146 break; |
147 } |
147 } |
148 |
148 |
149 return state; |
149 return state; |
150 } |
150 } |
151 |
151 |
152 |
152 |