|
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: Default Screensaver runtime. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QtPlugin> |
|
19 #include <QDebug> |
|
20 #include <qservicemanager.h> |
|
21 #include <hbdevicedialog.h> |
|
22 |
|
23 #include "snsrdevicedialogplugin.h" |
|
24 #include "snsrdevicedialog.h" |
|
25 |
|
26 #ifdef COVERAGE_MEASUREMENT |
|
27 #pragma CTC SKIP |
|
28 #endif //COVERAGE_MEASUREMENT |
|
29 |
|
30 /*! |
|
31 \class SnsrDeviceDialogPlugin |
|
32 \ingroup group_snsrdevicedialogplugin |
|
33 \brief Screensaver Device Dialog Plug-in. |
|
34 */ |
|
35 |
|
36 Q_EXPORT_PLUGIN2(snsrdevicedialogplugin, SnsrDeviceDialogPlugin) |
|
37 |
|
38 // This plugin implements one device dialog type |
|
39 static const struct |
|
40 { |
|
41 const char *mTypeString; |
|
42 } dialogInfos[] = { { "com.nokia.screensaver.snsrdevicedialogplugin/1.0" } }; |
|
43 |
|
44 const char *lBigClockSnsrPluginUri = |
|
45 #ifdef Q_OS_SYMBIAN |
|
46 "z:/snsrresources/plugins/screensaverplugins/snsrbigclockscreensaverplugin.xml"; |
|
47 #else |
|
48 "snsrresources/plugins/screensaverplugins/snsrbigclockscreensaverplugin.xml"; |
|
49 #endif |
|
50 |
|
51 const char *lViewType("view_type"); |
|
52 |
|
53 QTM_USE_NAMESPACE |
|
54 |
|
55 /*! |
|
56 Constructor. |
|
57 */ |
|
58 SnsrDeviceDialogPlugin::SnsrDeviceDialogPlugin() : |
|
59 mError(0) |
|
60 { |
|
61 qDebug("SnsrDeviceDialogPlugin::SnsrDeviceDialogPlugin()"); |
|
62 |
|
63 QServiceManager manager; |
|
64 manager.addService(lBigClockSnsrPluginUri); |
|
65 } |
|
66 |
|
67 /*! |
|
68 Destructor. |
|
69 */ |
|
70 SnsrDeviceDialogPlugin::~SnsrDeviceDialogPlugin() |
|
71 { |
|
72 qDebug("SnsrDeviceDialogPlugin::~SnsrDeviceDialogPlugin()"); |
|
73 } |
|
74 |
|
75 /*! |
|
76 \reimp |
|
77 */ |
|
78 bool SnsrDeviceDialogPlugin::accessAllowed(const QString &deviceDialogType, |
|
79 const QVariantMap ¶meters, const QVariantMap &securityInfo) const |
|
80 { |
|
81 Q_UNUSED(deviceDialogType) |
|
82 Q_UNUSED(parameters) |
|
83 Q_UNUSED(securityInfo) |
|
84 |
|
85 // This plugin doesn't perform operations that may compromise security. |
|
86 // All clients are allowed to use. |
|
87 return true; |
|
88 } |
|
89 |
|
90 /*! |
|
91 \reimp |
|
92 */ |
|
93 HbDeviceDialogInterface *SnsrDeviceDialogPlugin::createDeviceDialog( |
|
94 const QString &deviceDialogType, const QVariantMap ¶meters) |
|
95 { |
|
96 qDebug("SnsrDeviceDialogPlugin::createDeviceDialog()"); |
|
97 mError = 0; |
|
98 |
|
99 HbDeviceDialogInterface *ret(0); |
|
100 const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]); |
|
101 for (int i = 0; i < numTypes && !ret; i++) { |
|
102 if (dialogInfos[i].mTypeString == deviceDialogType) { |
|
103 //create the dialog |
|
104 ret = new SnsrDeviceDialog(parameters); |
|
105 } |
|
106 } |
|
107 |
|
108 if (!ret) { |
|
109 mError = -1; |
|
110 } |
|
111 return ret; |
|
112 } |
|
113 |
|
114 /*! |
|
115 \reimp |
|
116 */ |
|
117 bool SnsrDeviceDialogPlugin::deviceDialogInfo( |
|
118 const QString &deviceDialogType, const QVariantMap ¶meters, |
|
119 DeviceDialogInfo *info) const |
|
120 { |
|
121 Q_UNUSED(parameters) |
|
122 Q_UNUSED(deviceDialogType) |
|
123 |
|
124 info->group = SecurityGroup; |
|
125 info->flags = NoDeviceDialogFlags; |
|
126 info->priority = DefaultPriority; |
|
127 |
|
128 return true; |
|
129 } |
|
130 |
|
131 /*! |
|
132 \reimp |
|
133 */ |
|
134 QStringList SnsrDeviceDialogPlugin::deviceDialogTypes() const |
|
135 { |
|
136 QStringList types; |
|
137 const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]); |
|
138 for (int i = 0; i < numTypes; i++) { |
|
139 types.append(dialogInfos[i].mTypeString); |
|
140 } |
|
141 |
|
142 return types; |
|
143 } |
|
144 |
|
145 /*! |
|
146 \reimp |
|
147 */ |
|
148 HbDeviceDialogPlugin::PluginFlags SnsrDeviceDialogPlugin::pluginFlags() const |
|
149 { |
|
150 return NoPluginFlags; |
|
151 } |
|
152 |
|
153 /*! |
|
154 \reimp |
|
155 */ |
|
156 int SnsrDeviceDialogPlugin::error() const |
|
157 { |
|
158 return mError; |
|
159 } |
|
160 |
|
161 #ifdef COVERAGE_MEASUREMENT |
|
162 #pragma CTC ENDSKIP |
|
163 #endif //COVERAGE_MEASUREMENT |