|
1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "Phoneindicatorinterface.h" |
|
19 #include "phoneindicators.h" |
|
20 #include <QTime> |
|
21 #include <QStringList> |
|
22 #ifdef Q_OS_SYMBIAN |
|
23 #include <logsservices.h> |
|
24 #include <xqservicerequest.h> |
|
25 #endif |
|
26 |
|
27 PhoneIndicatorInterface::PhoneIndicatorInterface( |
|
28 const QString &indicatorType, |
|
29 int typeIndex, |
|
30 Interaction interaction) : |
|
31 HbIndicatorInterface( indicatorType, IndicatorInfos[typeIndex].priority, |
|
32 (interaction == InteractionNone) ? NoInteraction : InteractionActivated), |
|
33 m_typeIndex(typeIndex), |
|
34 m_interaction(interaction), |
|
35 m_primaryText(IndicatorInfos[typeIndex].primaryText), |
|
36 m_secondaryText(IndicatorInfos[typeIndex].secondaryText), |
|
37 m_icon(IndicatorInfos[typeIndex].icon) |
|
38 |
|
39 { |
|
40 } |
|
41 |
|
42 PhoneIndicatorInterface::~PhoneIndicatorInterface() |
|
43 { |
|
44 |
|
45 } |
|
46 |
|
47 bool PhoneIndicatorInterface::handleInteraction(InteractionType type) |
|
48 { |
|
49 if (type == InteractionActivated) { |
|
50 switch (m_interaction) { |
|
51 |
|
52 case OpenMissedCallView: { |
|
53 #ifdef Q_OS_SYMBIAN |
|
54 XQServiceRequest snd("com.nokia.services.logsservices.starter", |
|
55 "start(int,bool)", false); |
|
56 snd << (int)LogsServices::ViewMissed; |
|
57 snd << false; |
|
58 int retValue; |
|
59 snd.send(retValue); |
|
60 |
|
61 // LogsServices::start( LogsServices::ViewMissed, false ); |
|
62 #endif |
|
63 } |
|
64 break; |
|
65 case Deactivate: |
|
66 emit deactivate(); |
|
67 break; |
|
68 default: |
|
69 return false; |
|
70 } |
|
71 emit dataChanged(); |
|
72 } |
|
73 return false; |
|
74 } |
|
75 |
|
76 QVariant PhoneIndicatorInterface::indicatorData(int role) const |
|
77 { |
|
78 QVariantMap map = m_parameter.value<QVariantMap>(); |
|
79 |
|
80 if (role == PrimaryTextRole) { |
|
81 return map.value( (QVariant(PrimaryTextRole)).toString()).toString(); |
|
82 } else if (role == SecondaryTextRole ) { |
|
83 return map.value( (QVariant(SecondaryTextRole)).toString()).toString(); |
|
84 } else if (role == IconNameRole) { |
|
85 return m_icon; |
|
86 } else if (role == DecorationNameRole) { |
|
87 return map.value( (QVariant(DecorationNameRole)).toString()).toString(); |
|
88 } |
|
89 return QVariant(); |
|
90 } |
|
91 |
|
92 bool PhoneIndicatorInterface::handleClientRequest(RequestType type, const QVariant ¶meter) |
|
93 { |
|
94 bool handled(false); |
|
95 switch (type) { |
|
96 // TODO: |
|
97 case RequestActivate: |
|
98 if (m_parameter != parameter) { |
|
99 m_parameter = parameter; |
|
100 emit dataChanged(); |
|
101 } |
|
102 handled = true; |
|
103 break; |
|
104 default: |
|
105 m_parameter.clear(); |
|
106 } |
|
107 |
|
108 return handled; |
|
109 } |