|
1 /* |
|
2 * Copyright (c) 2009 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 "msgindicatorplugin.h" |
|
19 |
|
20 #include "msgindicator.h" |
|
21 #include "msginfodefs.h" |
|
22 |
|
23 #include <QtPlugin> |
|
24 #include <QVariant> |
|
25 |
|
26 |
|
27 // ---------------------------------------------------------------------------- |
|
28 // MsgIndicatorPlugin::MsgIndicatorPlugin |
|
29 // @see msgindicatorplugin.h |
|
30 // ---------------------------------------------------------------------------- |
|
31 MsgIndicatorPlugin::MsgIndicatorPlugin() : |
|
32 mError(0) |
|
33 { |
|
34 mIndicatorTypes.append(QString("com.nokia.messaging.newindicatorplugin")); |
|
35 mIndicatorTypes.append(QString("com.nokia.messaging.failedindicatorplugin")); |
|
36 mIndicatorTypes.append(QString("com.nokia.messaging.pendingindicatorplugin")); |
|
37 |
|
38 } |
|
39 |
|
40 // ---------------------------------------------------------------------------- |
|
41 // MsgIndicatorPlugin::~MsgIndicatorPlugin |
|
42 // @see msgindicatorplugin.h |
|
43 // ---------------------------------------------------------------------------- |
|
44 MsgIndicatorPlugin::~MsgIndicatorPlugin() |
|
45 { |
|
46 } |
|
47 |
|
48 // ---------------------------------------------------------------------------- |
|
49 // MsgIndicatorPlugin::indicatorTypes |
|
50 // Return notification types this plugin implements |
|
51 // @see msgindicatorplugin.h |
|
52 // ---------------------------------------------------------------------------- |
|
53 QStringList MsgIndicatorPlugin::indicatorTypes() const |
|
54 { |
|
55 return mIndicatorTypes; |
|
56 } |
|
57 |
|
58 // ---------------------------------------------------------------------------- |
|
59 // MsgIndicatorPlugin::accessAllowed |
|
60 // Check if client is allowed to use notification widget |
|
61 // @see msgindicatorplugin.h |
|
62 // ---------------------------------------------------------------------------- |
|
63 bool MsgIndicatorPlugin::accessAllowed(const QString &indicatorType, |
|
64 const QVariantMap& securityInfo) const |
|
65 { |
|
66 Q_UNUSED(indicatorType) |
|
67 Q_UNUSED(securityInfo) |
|
68 |
|
69 // This plugin doesn't perform operations that may compromise security. |
|
70 // All clients are allowed to use. |
|
71 return true; |
|
72 } |
|
73 |
|
74 // ---------------------------------------------------------------------------- |
|
75 // MsgIndicatorPlugin::createIndicator |
|
76 // @see msgindicatorplugin.h |
|
77 // ---------------------------------------------------------------------------- |
|
78 HbIndicatorInterface* MsgIndicatorPlugin::createIndicator(const QString &indicatorType) |
|
79 { |
|
80 HbIndicatorInterface *indicator = NULL; |
|
81 int index(typeIndex(indicatorType)); |
|
82 if (index >= 0) { |
|
83 indicator = new MsgIndicator(indicatorType); |
|
84 } |
|
85 |
|
86 return indicator; |
|
87 } |
|
88 |
|
89 // ---------------------------------------------------------------------------- |
|
90 // MsgIndicatorPlugin::error |
|
91 // @see msgindicatorplugin.h |
|
92 // ---------------------------------------------------------------------------- |
|
93 int MsgIndicatorPlugin::error() const |
|
94 { |
|
95 return mError; |
|
96 } |
|
97 |
|
98 // ---------------------------------------------------------------------------- |
|
99 // MsgIndicatorPlugin::typeIndex |
|
100 // @see msgindicatorplugin.h |
|
101 // ---------------------------------------------------------------------------- |
|
102 int MsgIndicatorPlugin::typeIndex(const QString &indicatorType) const |
|
103 { |
|
104 for (int i = 0; i < mIndicatorTypes.count(); ++i) { |
|
105 if (mIndicatorTypes.at(i) == indicatorType) { |
|
106 return i; |
|
107 } |
|
108 } |
|
109 return -1; |
|
110 } |
|
111 |
|
112 Q_EXPORT_PLUGIN2(msgindicatorplugin,MsgIndicatorPlugin) |