|
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: Device updates data for control panel |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <cpsettingformitemdata.h> |
|
20 #include <centralrepository.h> |
|
21 #include "deviceupdatesdata.h" |
|
22 |
|
23 |
|
24 DeviceUpdateData::DeviceUpdateData(CpItemDataHelper &itemDataHelper, |
|
25 const QString &text /*= QString()*/, |
|
26 const QString &description /*= QString()*/, |
|
27 const HbIcon &icon /*= HbIcon()*/, |
|
28 const HbDataFormModelItem *parent /*= 0*/) |
|
29 : CpSettingFormEntryItemData(itemDataHelper, |
|
30 text, |
|
31 description, |
|
32 icon, |
|
33 parent) |
|
34 { |
|
35 } |
|
36 |
|
37 DeviceUpdateData::~DeviceUpdateData() |
|
38 { |
|
39 CloseDmUi(); |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // DeviceUpdateData::OpenDmAppL() |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 void DeviceUpdateData::OpenDmAppL() |
|
47 { |
|
48 |
|
49 // Create DM UI Process |
|
50 RProcess rp; |
|
51 TInt cpLaunch(1); |
|
52 CRepository *cenrep = CRepository::NewL(KUidSmlSyncApp); |
|
53 if(cenrep) |
|
54 { |
|
55 cenrep->Set( KNsmlDmUILaunch, cpLaunch); |
|
56 delete cenrep; |
|
57 cenrep = NULL; |
|
58 } |
|
59 TInt err = rp.Create(KDMUIProcess,KNullDesC); |
|
60 |
|
61 User::LeaveIfError(err); |
|
62 |
|
63 |
|
64 rp.Resume(); // logon OK - start the server |
|
65 |
|
66 |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------------------------- |
|
70 // DeviceUpdateData::CloseDmUi |
|
71 // closes DM Ui |
|
72 // --------------------------------------------------------------------------------------------- |
|
73 void DeviceUpdateData:: CloseDmUi() |
|
74 { |
|
75 // Create DM UI Process |
|
76 |
|
77 TFullName processName; |
|
78 TFindProcess process; |
|
79 while ( process.Next( processName ) != KErrNotFound ) |
|
80 { |
|
81 if ( ( processName.Find( KDMUIName ) != KErrNotFound ) ) |
|
82 { |
|
83 RProcess rprocess; |
|
84 if (rprocess.Open(process, EOwnerProcess) == KErrNone) |
|
85 { |
|
86 rprocess.Terminate(KErrNone); |
|
87 rprocess.Close(); |
|
88 } |
|
89 } |
|
90 } |
|
91 } |
|
92 |
|
93 void DeviceUpdateData::onLaunchView() |
|
94 { |
|
95 TRAP_IGNORE( OpenDmAppL() ); |
|
96 } |
|
97 |
|
98 CpBaseSettingView *DeviceUpdateData::createSettingView() const |
|
99 { |
|
100 return 0; |
|
101 } |
|
102 |
|
103 |