47
|
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: DM indicator base class implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
#include <QByteArray>
|
|
18 |
#include <QVariant>
|
|
19 |
#include <qtranslator.h>
|
|
20 |
#include <qcoreapplication.h>
|
|
21 |
#include <qlocale.h>
|
|
22 |
#include "dmindicator.h"
|
|
23 |
|
|
24 |
// ----------------------------------------------------------------------------
|
|
25 |
// DMIndicator::DMIndicator
|
|
26 |
// @see DMIndicator.h
|
|
27 |
// ----------------------------------------------------------------------------
|
|
28 |
DMIndicator::DMIndicator(const QString &indicatorType,
|
|
29 |
HbIndicatorInterface::Category category,
|
|
30 |
HbIndicatorInterface::InteractionTypes interactionTypes) :
|
|
31 |
HbIndicatorInterface(indicatorType, category, interactionTypes)
|
|
32 |
{
|
|
33 |
qDebug("DMIndicator::DMIndicator() start");
|
|
34 |
mParameter = 0;
|
|
35 |
|
|
36 |
// Do translation
|
|
37 |
QTranslator *translator = new QTranslator();
|
|
38 |
QString lang = QLocale::system().name();
|
|
39 |
QString path = "Z:/resource/qt/translations/";
|
|
40 |
bool fine = translator->load("deviceupdates_" + lang, path);
|
|
41 |
if (fine)
|
|
42 |
qApp->installTranslator(translator);
|
|
43 |
qDebug("DMIndicator::DMIndicator() end");
|
|
44 |
}
|
|
45 |
|
|
46 |
// ----------------------------------------------------------------------------
|
|
47 |
// DMIndicator::~DMIndicator
|
|
48 |
// @see DMIndicator.h
|
|
49 |
// ----------------------------------------------------------------------------
|
|
50 |
DMIndicator::~DMIndicator()
|
|
51 |
{
|
|
52 |
|
|
53 |
}
|
|
54 |
|
|
55 |
// ----------------------------------------------------------------------------
|
|
56 |
// DMIndicator::indicatorData
|
|
57 |
// @see DMIndicator.h
|
|
58 |
// ----------------------------------------------------------------------------
|
|
59 |
QVariant DMIndicator::indicatorData(int role) const
|
|
60 |
{
|
|
61 |
qDebug("DMIndicator::indicatorData() start");
|
|
62 |
switch (role)
|
|
63 |
{
|
|
64 |
|
|
65 |
case MonoDecorationNameRole:
|
|
66 |
{
|
|
67 |
//QString iconName("z:/resource/devicemanagement/qtg_small_smiley_kissing.svg");
|
|
68 |
//QString iconName("C:/resource/devicemanagement/qtg_small_smiley_kissing.svg");
|
|
69 |
QString iconName("qtg_small_smiley_kissing");
|
|
70 |
return iconName;
|
|
71 |
}
|
|
72 |
|
|
73 |
default:
|
|
74 |
return QVariant();
|
|
75 |
|
|
76 |
}
|
|
77 |
}
|
|
78 |
|
|
79 |
// ----------------------------------------------------------------------------
|
|
80 |
// DMIndicator::handleClientRequest
|
|
81 |
// @see DMIndicator.h
|
|
82 |
// ----------------------------------------------------------------------------
|
|
83 |
bool DMIndicator::handleClientRequest(RequestType type,
|
|
84 |
const QVariant ¶meter)
|
|
85 |
{
|
|
86 |
qDebug("DMIndicator::handleClientRequest() start");
|
|
87 |
bool handled(false);
|
|
88 |
switch (type)
|
|
89 |
{
|
|
90 |
case RequestActivate:
|
|
91 |
{
|
|
92 |
qDebug("DMIndicator::handleClientRequest() RequestActivate");
|
|
93 |
mParameter = parameter;
|
|
94 |
emit
|
|
95 |
dataChanged();
|
|
96 |
handled = true;
|
|
97 |
}
|
|
98 |
break;
|
|
99 |
case RequestDeactivate:
|
|
100 |
{
|
|
101 |
qDebug("DMIndicator::handleClientRequest() RequestDeactivate");
|
|
102 |
emit deactivate();
|
|
103 |
}
|
|
104 |
break;
|
|
105 |
default:
|
|
106 |
break;
|
|
107 |
}
|
|
108 |
qDebug("DMIndicator::handleClientRequest() end");
|
|
109 |
return handled;
|
|
110 |
}
|