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 <QtPlugin> |
|
19 #include <QVariant> |
|
20 #include <HbInstance> |
|
21 |
|
22 #include "phoneindicatorplugin.h" |
|
23 #include "phoneindicatorinterface.h" |
|
24 |
|
25 Q_EXPORT_PLUGIN(PhoneIndicatorPlugin) |
|
26 PhoneIndicatorPlugin::PhoneIndicatorPlugin(): m_error(0) |
|
27 { |
|
28 for (int i = 0; i < PhoneIndicatorCount; ++i) { |
|
29 m_indicatorTypes.append(indicatorName(i)); |
|
30 } |
|
31 } |
|
32 |
|
33 PhoneIndicatorPlugin::~PhoneIndicatorPlugin() |
|
34 { |
|
35 } |
|
36 |
|
37 QStringList PhoneIndicatorPlugin::indicatorTypes() const |
|
38 { |
|
39 return m_indicatorTypes; |
|
40 } |
|
41 |
|
42 bool PhoneIndicatorPlugin::accessAllowed(const QString &indicatorType, |
|
43 const QVariantMap &securityInfo) const |
|
44 { |
|
45 Q_UNUSED(indicatorType); |
|
46 Q_UNUSED(securityInfo); |
|
47 return true; // constant for hats =) |
|
48 } |
|
49 |
|
50 int PhoneIndicatorPlugin::typeIndex(const QString &indicatorType) const |
|
51 { |
|
52 for (int i = 0; i < m_indicatorTypes.count(); ++i) { |
|
53 if (m_indicatorTypes.at(i) == indicatorType) { |
|
54 return i; |
|
55 } |
|
56 } |
|
57 return -1; |
|
58 } |
|
59 |
|
60 HbIndicatorInterface* PhoneIndicatorPlugin::createIndicator( |
|
61 const QString &indicatorType) |
|
62 { |
|
63 HbIndicatorInterface *indicator = 0; |
|
64 int index(typeIndex(indicatorType)); |
|
65 if (index >= 0) { |
|
66 indicator = new PhoneIndicatorInterface( |
|
67 indicatorType, index, IndicatorInfos[index].interaction); |
|
68 } |
|
69 return indicator; |
|
70 } |
|
71 |
|
72 int PhoneIndicatorPlugin::error() const |
|
73 { |
|
74 return m_error; |
|
75 } |
|