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