author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 14:15:47 +0300 | |
changeset 46 | bc5a64e5bc3c |
parent 45 | 6b911d05207e |
child 50 | 377c906a8701 |
child 51 | f39ed5e045e0 |
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) : |
|
30 |
HbIndicatorInterface( indicatorType, HbIndicatorInterface::NotificationCategory, |
|
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 |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
46 |
case OpenDiverSettingsView: |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
47 |
QThreadPool::globalInstance()->start(new PhoneIndicatorServiceSenderTask(m_interaction)); |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
48 |
break; |
37 | 49 |
case Deactivate: |
50 |
emit deactivate(); |
|
51 |
break; |
|
52 |
default: |
|
53 |
return false; |
|
54 |
} |
|
55 |
emit dataChanged(); |
|
56 |
} |
|
57 |
return false; |
|
58 |
} |
|
59 |
||
60 |
QVariant PhoneIndicatorInterface::indicatorData(int role) const |
|
61 |
{ |
|
62 |
QVariantMap map = m_parameter.value<QVariantMap>(); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
63 |
|
37 | 64 |
if (role == PrimaryTextRole) { |
65 |
return map.value( (QVariant(PrimaryTextRole)).toString()).toString(); |
|
66 |
} else if (role == SecondaryTextRole ) { |
|
67 |
return map.value( (QVariant(SecondaryTextRole)).toString()).toString(); |
|
68 |
} else if (role == MonoDecorationNameRole) { |
|
69 |
return m_icon; |
|
70 |
} else if (role == DecorationNameRole) { |
|
71 |
return map.value( (QVariant(DecorationNameRole)).toString()).toString(); |
|
72 |
} |
|
73 |
return QVariant(); |
|
74 |
} |
|
75 |
||
76 |
bool PhoneIndicatorInterface::handleClientRequest(RequestType type, const QVariant ¶meter) |
|
77 |
{ |
|
78 |
bool handled(false); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
79 |
switch (type) { |
37 | 80 |
case RequestActivate: |
81 |
if (m_parameter != parameter) { |
|
82 |
m_parameter = parameter; |
|
83 |
emit dataChanged(); |
|
84 |
} |
|
85 |
handled = true; |
|
86 |
break; |
|
87 |
default: |
|
88 |
m_parameter.clear(); |
|
89 |
} |
|
90 |
return handled; |
|
91 |
} |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
92 |