author | hgs |
Fri, 15 Oct 2010 12:58:46 +0300 | |
changeset 78 | baacf668fe89 |
parent 50 | 377c906a8701 |
permissions | -rw-r--r-- |
37 | 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 |
* |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
14 |
* Description: |
37 | 15 |
* |
16 |
*/ |
|
17 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
18 |
#include "phoneindicatorinterface.h" |
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
19 |
#include "phoneindicatorservicesendertask.h" |
37 | 20 |
#include "phoneindicators.h" |
21 |
||
22 |
#include <QTime> |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
23 |
#include <QStringList> |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
24 |
#include <QThreadPool> |
37 | 25 |
|
26 |
PhoneIndicatorInterface::PhoneIndicatorInterface( |
|
27 |
const QString &indicatorType, |
|
28 |
int typeIndex, |
|
29 |
Interaction interaction) : |
|
78 | 30 |
HbIndicatorInterface( indicatorType, IndicatorInfos[typeIndex].catecory, |
37 | 31 |
(interaction == InteractionNone) ? NoInteraction : InteractionActivated), |
32 |
m_typeIndex(typeIndex), |
|
33 |
m_interaction(interaction), |
|
34 |
m_primaryText(IndicatorInfos[typeIndex].primaryText), |
|
35 |
m_secondaryText(IndicatorInfos[typeIndex].secondaryText), |
|
36 |
m_icon(IndicatorInfos[typeIndex].icon) |
|
37 |
{ |
|
38 |
} |
|
39 |
||
40 |
bool PhoneIndicatorInterface::handleInteraction(InteractionType type) |
|
41 |
{ |
|
42 |
if (type == InteractionActivated) { |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
43 |
switch (m_interaction) { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
44 |
case OpenMissedCallView: //fallthrough |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
45 |
case OpenCallUi: //fallthrough |
50 | 46 |
case OpenDiverSettingsView: { |
47 |
// Launch services on the client side |
|
48 |
QVariantMap data; |
|
49 |
data.insert(QLatin1String("interaction"), m_interaction); |
|
50 |
emit userActivated(data); |
|
51 |
} |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
52 |
break; |
37 | 53 |
case Deactivate: |
54 |
emit deactivate(); |
|
55 |
break; |
|
56 |
default: |
|
57 |
return false; |
|
58 |
} |
|
59 |
emit dataChanged(); |
|
60 |
} |
|
61 |
return false; |
|
62 |
} |
|
63 |
||
64 |
QVariant PhoneIndicatorInterface::indicatorData(int role) const |
|
65 |
{ |
|
66 |
QVariantMap map = m_parameter.value<QVariantMap>(); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
67 |
|
37 | 68 |
if (role == PrimaryTextRole) { |
69 |
return map.value( (QVariant(PrimaryTextRole)).toString()).toString(); |
|
70 |
} else if (role == SecondaryTextRole ) { |
|
71 |
return map.value( (QVariant(SecondaryTextRole)).toString()).toString(); |
|
72 |
} else if (role == MonoDecorationNameRole) { |
|
73 |
return m_icon; |
|
74 |
} else if (role == DecorationNameRole) { |
|
75 |
return map.value( (QVariant(DecorationNameRole)).toString()).toString(); |
|
76 |
} |
|
77 |
return QVariant(); |
|
78 |
} |
|
79 |
||
80 |
bool PhoneIndicatorInterface::handleClientRequest(RequestType type, const QVariant ¶meter) |
|
81 |
{ |
|
82 |
bool handled(false); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
83 |
switch (type) { |
37 | 84 |
case RequestActivate: |
85 |
if (m_parameter != parameter) { |
|
86 |
m_parameter = parameter; |
|
87 |
emit dataChanged(); |
|
88 |
} |
|
89 |
handled = true; |
|
90 |
break; |
|
91 |
default: |
|
92 |
m_parameter.clear(); |
|
93 |
} |
|
94 |
return handled; |
|
95 |
} |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
96 |