9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "phoneindicatorinterface.h" |
18 #include "phoneindicatorinterface.h" |
|
19 #include "phoneindicatorservicesendertask.h" |
19 #include "phoneindicators.h" |
20 #include "phoneindicators.h" |
20 |
21 |
21 #include <QTime> |
22 #include <QTime> |
22 #include <QStringList> |
23 #include <QStringList> |
23 #ifdef Q_OS_SYMBIAN |
24 #include <QThreadPool> |
24 #include <logsservices.h> |
|
25 #include <xqservicerequest.h> |
|
26 #include <xqrequestinfo.h> |
|
27 #include <apgtask.h> |
|
28 #include <xqaiwrequest.h> |
|
29 #include <cppluginlauncher.h> |
|
30 |
|
31 |
|
32 #endif |
|
33 |
25 |
34 PhoneIndicatorInterface::PhoneIndicatorInterface( |
26 PhoneIndicatorInterface::PhoneIndicatorInterface( |
35 const QString &indicatorType, |
27 const QString &indicatorType, |
36 int typeIndex, |
28 int typeIndex, |
37 Interaction interaction) : |
29 Interaction interaction) : |
40 m_typeIndex(typeIndex), |
32 m_typeIndex(typeIndex), |
41 m_interaction(interaction), |
33 m_interaction(interaction), |
42 m_primaryText(IndicatorInfos[typeIndex].primaryText), |
34 m_primaryText(IndicatorInfos[typeIndex].primaryText), |
43 m_secondaryText(IndicatorInfos[typeIndex].secondaryText), |
35 m_secondaryText(IndicatorInfos[typeIndex].secondaryText), |
44 m_icon(IndicatorInfos[typeIndex].icon) |
36 m_icon(IndicatorInfos[typeIndex].icon) |
45 |
|
46 { |
37 { |
47 } |
|
48 |
|
49 PhoneIndicatorInterface::~PhoneIndicatorInterface() |
|
50 { |
|
51 |
|
52 } |
38 } |
53 |
39 |
54 bool PhoneIndicatorInterface::handleInteraction(InteractionType type) |
40 bool PhoneIndicatorInterface::handleInteraction(InteractionType type) |
55 { |
41 { |
56 if (type == InteractionActivated) { |
42 if (type == InteractionActivated) { |
57 switch (m_interaction) { |
43 switch (m_interaction) { |
58 case OpenMissedCallView: { |
44 case OpenMissedCallView: //fallthrough |
59 #ifdef Q_OS_SYMBIAN |
45 case OpenCallUi: //fallthrough |
60 XQServiceRequest snd("com.nokia.services.logsservices.starter", |
46 case OpenDiverSettingsView: |
61 "start(int,bool)", false); |
47 QThreadPool::globalInstance()->start(new PhoneIndicatorServiceSenderTask(m_interaction)); |
62 snd << (int)LogsServices::ViewMissed; |
|
63 snd << false; |
|
64 int retValue; |
|
65 snd.send(retValue); |
|
66 #endif |
|
67 } |
|
68 break; |
|
69 case SwitchBackToCall: { |
|
70 #ifdef Q_OS_SYMBIAN |
|
71 int dialer(1); |
|
72 XQServiceRequest snd("com.nokia.services.telephony.uistarter", |
|
73 "start(int)", false); |
|
74 XQRequestInfo info; |
|
75 info.setForeground(true); |
|
76 snd.setInfo(info); |
|
77 snd << dialer; |
|
78 QVariant retValue; |
|
79 snd.send(retValue); |
|
80 #endif |
|
81 } |
|
82 break; |
|
83 case OpenDiverSettingsView: { |
|
84 launchDivertSettingsView(); |
|
85 } |
|
86 break; |
48 break; |
87 case Deactivate: |
49 case Deactivate: |
88 emit deactivate(); |
50 emit deactivate(); |
89 break; |
51 break; |
90 default: |
52 default: |
96 } |
58 } |
97 |
59 |
98 QVariant PhoneIndicatorInterface::indicatorData(int role) const |
60 QVariant PhoneIndicatorInterface::indicatorData(int role) const |
99 { |
61 { |
100 QVariantMap map = m_parameter.value<QVariantMap>(); |
62 QVariantMap map = m_parameter.value<QVariantMap>(); |
101 |
63 |
102 if (role == PrimaryTextRole) { |
64 if (role == PrimaryTextRole) { |
103 return map.value( (QVariant(PrimaryTextRole)).toString()).toString(); |
65 return map.value( (QVariant(PrimaryTextRole)).toString()).toString(); |
104 } else if (role == SecondaryTextRole ) { |
66 } else if (role == SecondaryTextRole ) { |
105 return map.value( (QVariant(SecondaryTextRole)).toString()).toString(); |
67 return map.value( (QVariant(SecondaryTextRole)).toString()).toString(); |
106 } else if (role == MonoDecorationNameRole) { |
68 } else if (role == MonoDecorationNameRole) { |
112 } |
74 } |
113 |
75 |
114 bool PhoneIndicatorInterface::handleClientRequest(RequestType type, const QVariant ¶meter) |
76 bool PhoneIndicatorInterface::handleClientRequest(RequestType type, const QVariant ¶meter) |
115 { |
77 { |
116 bool handled(false); |
78 bool handled(false); |
117 switch (type) { |
79 switch (type) { |
118 case RequestActivate: |
80 case RequestActivate: |
119 if (m_parameter != parameter) { |
81 if (m_parameter != parameter) { |
120 m_parameter = parameter; |
82 m_parameter = parameter; |
121 emit dataChanged(); |
83 emit dataChanged(); |
122 } |
84 } |
123 handled = true; |
85 handled = true; |
124 break; |
86 break; |
125 default: |
87 default: |
126 m_parameter.clear(); |
88 m_parameter.clear(); |
127 } |
89 } |
128 |
|
129 return handled; |
90 return handled; |
130 } |
91 } |
131 |
92 |
132 void PhoneIndicatorInterface::launchDivertSettingsView() |
|
133 { |
|
134 |
|
135 XQAiwRequest *request = m_appMgr.create( |
|
136 "com.nokia.symbian.ICpPluginLauncher", |
|
137 "launchSettingView(QString,QVariant)", |
|
138 false); // |
|
139 |
|
140 if (!request) { |
|
141 return; |
|
142 } |
|
143 else { |
|
144 connect(request, SIGNAL(requestOk(QVariant)), SLOT(handleReturnValue(QVariant))); |
|
145 connect(request, SIGNAL(requestError(int,QString)), SLOT(handleError(int,QString))); |
|
146 } |
|
147 // Set arguments for request |
|
148 QList<QVariant> args; |
|
149 args << (QString)"cptelephonyplugin.dll"; |
|
150 args << (QVariant)""; |
|
151 |
|
152 request->setArguments(args); |
|
153 request->setSynchronous(true); |
|
154 // Make the request |
|
155 if (!request->send()) { |
|
156 //report error |
|
157 } |
|
158 delete request; |
|
159 |
|
160 } |
|
161 |
|
162 void PhoneIndicatorInterface::handleReturnValue(const QVariant &returnValue) |
|
163 { |
|
164 Q_UNUSED(returnValue); |
|
165 } |
|
166 |
|
167 void PhoneIndicatorInterface::handleError(int errorCode,const QString &errorMessage) |
|
168 { |
|
169 Q_UNUSED(errorCode); |
|
170 Q_UNUSED(errorMessage); |
|
171 } |
|