52
|
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 |
#include "usbaddressedindicator.h"
|
58
|
18 |
#include <QVariant>
|
52
|
19 |
#include <e32uid.h>
|
|
20 |
#include <apadef.h>
|
|
21 |
#include "usbindicatorplugin.h"
|
|
22 |
#include "usbindicator.h"
|
58
|
23 |
#include "usbdebug.h"
|
52
|
24 |
|
|
25 |
|
|
26 |
/*!
|
|
27 |
UsbAddressedIndicator::UsbAddressedIndicator
|
|
28 |
*/
|
|
29 |
UsbAddressedIndicator::UsbAddressedIndicator(const QString &indicatorType) :
|
|
30 |
HbIndicatorInterface(indicatorType,
|
|
31 |
HbIndicatorInterface::ProgressCategory,
|
|
32 |
InteractionActivated)
|
58
|
33 |
{
|
|
34 |
}
|
52
|
35 |
|
|
36 |
/*!
|
|
37 |
UsbAddressedIndicator::~UsbAddressedIndicator
|
|
38 |
*/
|
|
39 |
UsbAddressedIndicator::~UsbAddressedIndicator()
|
58
|
40 |
{
|
|
41 |
}
|
52
|
42 |
|
|
43 |
|
|
44 |
/*!
|
|
45 |
UsbAddressedIndicator::handleInteraction
|
|
46 |
*/
|
|
47 |
bool UsbAddressedIndicator::handleInteraction(InteractionType type)
|
58
|
48 |
{
|
|
49 |
myDebug() << ">>> UsbAddressedIndicator::handleInteraction";
|
52
|
50 |
bool handled = false;
|
|
51 |
TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),
|
|
52 |
TUid::Uid(KUSBUIUid));
|
58
|
53 |
if (type == InteractionActivated) {
|
52
|
54 |
RProcess usbUiProcess;
|
|
55 |
TInt result = usbUiProcess.Create(KUSBExe(), KNullDesC, uidtype);
|
|
56 |
if (result == KErrNone) {
|
|
57 |
usbUiProcess.Resume();
|
|
58 |
}
|
|
59 |
usbUiProcess.Close();
|
|
60 |
handled = true;
|
58
|
61 |
}
|
|
62 |
myDebug() << "<<< UsbAddressedIndicator::handleInteraction";
|
52
|
63 |
return handled;
|
58
|
64 |
}
|
52
|
65 |
|
|
66 |
/*!
|
|
67 |
UsbAddressedIndicator::indicatorData
|
|
68 |
returns the data and icon that needs to be displayed in the universal pop up and indicator menu
|
|
69 |
*/
|
|
70 |
QVariant UsbAddressedIndicator::indicatorData(int role) const
|
|
71 |
{
|
58
|
72 |
myDebug() << ">>> UsbAddressedIndicator::indicatorData";
|
|
73 |
switch (role) {
|
|
74 |
case PrimaryTextRole:
|
|
75 |
{
|
|
76 |
QString text = QString(hbTrId("txt_usb_dblist_usb_connecting"));
|
|
77 |
return text;
|
|
78 |
}
|
|
79 |
case DecorationNameRole:
|
|
80 |
{
|
|
81 |
QString iconName(KUsbIconFile);
|
|
82 |
return iconName;
|
|
83 |
}
|
|
84 |
default:
|
|
85 |
return QVariant();
|
|
86 |
}
|
52
|
87 |
}
|
|
88 |
|
|
89 |
/*!
|
|
90 |
UsbAddressedIndicator::handleClientRequest
|
|
91 |
handles client's activate and deactivate request
|
|
92 |
*/
|
|
93 |
bool UsbAddressedIndicator::handleClientRequest( RequestType type,
|
|
94 |
const QVariant ¶meter)
|
|
95 |
{
|
58
|
96 |
myDebug() << ">>> UsbAddressedIndicator::handleClientRequest";
|
52
|
97 |
switch (type) {
|
58
|
98 |
case RequestActivate:
|
|
99 |
emit dataChanged();
|
|
100 |
break;
|
|
101 |
default:
|
|
102 |
emit deactivate();
|
|
103 |
break;
|
52
|
104 |
}
|
58
|
105 |
myDebug() << "<<< UsbAddressedIndicator::handleClientRequest";
|
|
106 |
//request always handled
|
|
107 |
return true;
|
52
|
108 |
}
|
|
109 |
|
|
110 |
|