|
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 "fotanotifiers.h" |
|
18 #include "FotaDlMgrClient.h" |
|
19 _LIT(KHbNotifier,"com.nokia.hb.devicemanagementdialog/1.0"); |
|
20 |
|
21 // -------------------------------------------------------------------------- |
|
22 // CFotaDownloadNotifHandler::NewL |
|
23 // -------------------------------------------------------------------------- |
|
24 // |
|
25 CFotaDownloadNotifHandler* CFotaDownloadNotifHandler::NewL( |
|
26 MfotadevicedialogObserver* aObserver) |
|
27 { |
|
28 FLOG(_L("CFotaDownloadNotifHandler::NewL >>")); |
|
29 __ASSERT_ALWAYS( aObserver, User::Panic(KFotaPanic, KErrArgument) ); |
|
30 CFotaDownloadNotifHandler* h = new (ELeave) CFotaDownloadNotifHandler; |
|
31 h->iObserver = aObserver; |
|
32 |
|
33 FLOG(_L("CFotaDownloadNotifHandler::NewL <<")); |
|
34 |
|
35 return h; |
|
36 } |
|
37 |
|
38 // -------------------------------------------------------------------------- |
|
39 CFotaDownloadNotifHandler::CFotaDownloadNotifHandler() : |
|
40 iDevDialog(NULL), iDialogID(0) |
|
41 { |
|
42 FLOG(_L("CFotaDownloadNotifHandler::CFotaDownloadNotifHandler()")); |
|
43 } |
|
44 |
|
45 // -------------------------------------------------------------------------- |
|
46 CFotaDownloadNotifHandler::~CFotaDownloadNotifHandler() |
|
47 { |
|
48 FLOG(_L("CFotaDownloadNotifHandler::~CFotaDownloadNotifHandler >>")); |
|
49 if (iDevDialog) |
|
50 delete iDevDialog; |
|
51 FLOG(_L("CFotaDownloadNotifHandler::~CFotaDownloadNotifHandler <<")); |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // CFotaDownloadNotifHandler::LaunchNotifierL |
|
56 // This function is used the observer which uses this notifer to lauch the notifier |
|
57 // It puts the necessary parameters to lauch the notifier in CHbSymbianVariantMap |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 void CFotaDownloadNotifHandler::LaunchNotifierL( |
|
61 CHbSymbianVariantMap *aNotifParams, TInt aDialogId) |
|
62 { |
|
63 FLOG(_L("CFotaDownloadNotifHandler::LaunchNotifierL() >>")); |
|
64 if (!iDevDialog) |
|
65 iDevDialog = CHbDeviceDialogSymbian::NewL(); |
|
66 FLOG(_L("CFotaDownloadNotifHandler::CHbDeviceDialogSymbian::NewL()")); |
|
67 if (iDevDialog == NULL) |
|
68 FLOG(_L("Error in CHbDeviceDialogSymbian::NewL()")); |
|
69 |
|
70 iDialogID = aDialogId; |
|
71 //connect(mDeviceDialog, SIGNAL(dataReceived(QVariantMap)), this, SLOT(dataReceived(QVariantMap))); |
|
72 |
|
73 TInt Err = iDevDialog->Show(KHbNotifier, *aNotifParams, this); |
|
74 FLOG( |
|
75 _L("CFotaDownloadNotifHandler::CHbDeviceDialogSymbian::Show() - %d"), |
|
76 Err); |
|
77 |
|
78 FLOG(_L("CFotaDownloadNotifHandler::LaunchNotifierL() <<")); |
|
79 } |
|
80 |
|
81 void CFotaDownloadNotifHandler::Cancel() |
|
82 { |
|
83 FLOG(_L("CFotaDownloadNotifHandler::Cancel >>")); |
|
84 if (iDialogID) |
|
85 iDevDialog->Cancel(); |
|
86 FLOG(_L("CFotaDownloadNotifHandler::Cancel <<")); |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CFotaDownloadNotifHandler::DataReceived |
|
91 // This slot is called when user gives a keypress event to the device dialog(through deviceDialogData signal). |
|
92 // CHbSymbianVariantMap is passed from the device dialog which contains the information |
|
93 // of the user input. |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 void CFotaDownloadNotifHandler::DataReceived(CHbSymbianVariantMap& aData) |
|
97 { |
|
98 FLOG(_L("CFotaDownloadNotifHandler::DataReceived() >>")); |
|
99 iDevDialog->Cancel(); |
|
100 TFwUpdNoteTypes ret; |
|
101 const CHbSymbianVariant* dialogId = aData.Get(KResult); |
|
102 ret = *(TFwUpdNoteTypes *) dialogId->Value<TInt> (); |
|
103 TInt temp = iDialogID; |
|
104 iDialogID = 0; |
|
105 iObserver->HandleDialogResponse(ret, temp); |
|
106 |
|
107 FLOG(_L("CFotaDownloadNotifHandler::DataReceived() <<")); |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------------------------- |
|
111 // CFotaDownloadNotifHandler::DeviceDialogClosed |
|
112 // This slot is called when the device dialog is closed due to some error. |
|
113 // aCompletionCode gives the error information on which the dialog is closed. |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 void CFotaDownloadNotifHandler::DeviceDialogClosed(TInt aCompletionCode) |
|
117 { |
|
118 FLOG(_L("CFotaDownloadNotifHandler::DeviceDialogClosed() >>")); |
|
119 |
|
120 FLOG(_L("CFotaDownloadNotifHandler::DeviceDialogClosed() <<")); |
|
121 } |
|
122 |