51
|
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 |
|
|
20 |
#include <hbdevicedialog.h>
|
|
21 |
#include "perfmondatapopupplugin_p.h"
|
|
22 |
#include "perfmondatapopupdialog_p.h"
|
|
23 |
#include "perfmondatapopuppluginerrors_p.h"
|
|
24 |
|
|
25 |
Q_EXPORT_PLUGIN2(perfmondatapopupplugin, PerfMonDataPopupPlugin)
|
|
26 |
|
|
27 |
// This plugin implements one device dialog type
|
|
28 |
static const struct {
|
|
29 |
const char *mTypeString;
|
|
30 |
} dialogInfos[] = {
|
|
31 |
{"com.nokia.rnd.perfmondatapopup/1.0"}
|
|
32 |
};
|
|
33 |
|
|
34 |
class PerfMonDataPopupPluginPrivate
|
|
35 |
{
|
|
36 |
public:
|
|
37 |
PerfMonDataPopupPluginPrivate() {mError = NoError;}
|
|
38 |
|
|
39 |
int mError;
|
|
40 |
};
|
|
41 |
|
|
42 |
// Constructor
|
|
43 |
PerfMonDataPopupPlugin::PerfMonDataPopupPlugin()
|
|
44 |
: d(new PerfMonDataPopupPluginPrivate)
|
|
45 |
{
|
|
46 |
}
|
|
47 |
|
|
48 |
// Destructor
|
|
49 |
PerfMonDataPopupPlugin::~PerfMonDataPopupPlugin()
|
|
50 |
{
|
|
51 |
delete d;
|
|
52 |
}
|
|
53 |
|
|
54 |
// Check if client is allowed to use device dialog widget
|
|
55 |
bool PerfMonDataPopupPlugin::accessAllowed(const QString &deviceDialogType,
|
|
56 |
const QVariantMap ¶meters, const QVariantMap &securityInfo) const
|
|
57 |
{
|
|
58 |
Q_UNUSED(deviceDialogType)
|
|
59 |
Q_UNUSED(parameters)
|
|
60 |
Q_UNUSED(securityInfo)
|
|
61 |
|
|
62 |
// This plugin doesn't perform operations that may compromise security. All clients
|
|
63 |
// are allowed to use.
|
|
64 |
return true;
|
|
65 |
}
|
|
66 |
|
|
67 |
// Create device dialog widget
|
|
68 |
HbDeviceDialogInterface *PerfMonDataPopupPlugin::createDeviceDialog(
|
|
69 |
const QString &deviceDialogType, const QVariantMap ¶meters)
|
|
70 |
{
|
|
71 |
Q_UNUSED(deviceDialogType)
|
|
72 |
d->mError = NoError;
|
|
73 |
|
|
74 |
HbDeviceDialogInterface *ret(0);
|
|
75 |
QVariantMap params = parameters;
|
|
76 |
|
|
77 |
PerfMonDataPopupDialog *deviceDialog =
|
|
78 |
new PerfMonDataPopupDialog(params);
|
|
79 |
d->mError = deviceDialog->deviceDialogError();
|
|
80 |
if (d->mError != NoError) {
|
|
81 |
delete deviceDialog;
|
|
82 |
deviceDialog = 0;
|
|
83 |
}
|
|
84 |
ret = deviceDialog;
|
|
85 |
|
|
86 |
return ret;
|
|
87 |
}
|
|
88 |
|
|
89 |
// Return device dialog flags
|
|
90 |
bool PerfMonDataPopupPlugin::deviceDialogInfo(const QString &deviceDialogType,
|
|
91 |
const QVariantMap ¶meters, DeviceDialogInfo *info) const
|
|
92 |
{
|
|
93 |
Q_UNUSED(deviceDialogType);
|
|
94 |
Q_UNUSED(parameters);
|
|
95 |
|
|
96 |
info->group = DeviceNotificationDialogGroup;
|
|
97 |
//info->group = GenericDeviceDialogGroup;
|
52
|
98 |
//info->group = IndicatorGroup;
|
51
|
99 |
info->flags = NoDeviceDialogFlags;
|
|
100 |
info->priority = DefaultPriority;
|
|
101 |
|
|
102 |
return true;
|
|
103 |
}
|
|
104 |
|
|
105 |
// Return device dialog types this plugin implements
|
|
106 |
QStringList PerfMonDataPopupPlugin::deviceDialogTypes() const
|
|
107 |
{
|
|
108 |
QStringList types;
|
|
109 |
const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]);
|
|
110 |
for(int i = 0; i < numTypes; i++) {
|
|
111 |
types.append(dialogInfos[i].mTypeString);
|
|
112 |
}
|
|
113 |
return types;
|
|
114 |
}
|
|
115 |
|
|
116 |
// Return plugin flags
|
|
117 |
HbDeviceDialogPlugin::PluginFlags PerfMonDataPopupPlugin::pluginFlags() const
|
|
118 |
{
|
|
119 |
return NoPluginFlags;
|
|
120 |
}
|
|
121 |
|
|
122 |
// Return last error
|
|
123 |
int PerfMonDataPopupPlugin::error() const
|
|
124 |
{
|
|
125 |
return d->mError;
|
|
126 |
}
|