33
|
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 |
|
43
|
18 |
#include <QtCore/QProcess>
|
|
19 |
#include <QtCore/QDir>
|
|
20 |
#include <QtCore/QLibraryInfo>
|
33
|
21 |
#include <cpsettingformitemdata.h>
|
43
|
22 |
#include <apgtask.h>
|
33
|
23 |
#include "deviceupdatesdata.h"
|
|
24 |
|
|
25 |
|
|
26 |
DeviceUpdateData::DeviceUpdateData(CpItemDataHelper &itemDataHelper,
|
|
27 |
const QString &text /*= QString()*/,
|
|
28 |
const QString &description /*= QString()*/,
|
|
29 |
const HbIcon &icon /*= HbIcon()*/,
|
|
30 |
const HbDataFormModelItem *parent /*= 0*/)
|
|
31 |
: CpSettingFormEntryItemData(itemDataHelper,
|
|
32 |
text,
|
|
33 |
description,
|
|
34 |
icon,
|
|
35 |
parent)
|
|
36 |
{
|
43
|
37 |
mproc = NULL;
|
33
|
38 |
}
|
|
39 |
|
|
40 |
DeviceUpdateData::~DeviceUpdateData()
|
|
41 |
{
|
43
|
42 |
CloseDeviceUpdatesUi();
|
|
43 |
if (mproc)
|
|
44 |
{
|
|
45 |
delete mproc;
|
|
46 |
mproc = NULL;
|
|
47 |
}
|
33
|
48 |
}
|
|
49 |
|
|
50 |
// -----------------------------------------------------------------------------
|
|
51 |
// DeviceUpdateData::OpenDmAppL()
|
|
52 |
// -----------------------------------------------------------------------------
|
|
53 |
//
|
43
|
54 |
void DeviceUpdateData::LaunchDeviceUpdatesUi()
|
33
|
55 |
{
|
|
56 |
|
43
|
57 |
RWsSession ws;
|
|
58 |
User::LeaveIfError( ws.Connect() );
|
|
59 |
CleanupClosePushL( ws );
|
|
60 |
// Find the task with uid
|
|
61 |
TApaTaskList taskList(ws);
|
|
62 |
TApaTask task = taskList.FindApp( KUidSmlSyncApp );
|
|
63 |
if ( task.Exists() )
|
|
64 |
{
|
|
65 |
task.BringToForeground();
|
|
66 |
}
|
|
67 |
else
|
|
68 |
{
|
|
69 |
// Create DM UI Process
|
|
70 |
if(!mproc)
|
|
71 |
mproc = new QProcess();
|
|
72 |
if(mproc->state() != QProcess::Running)
|
|
73 |
{
|
|
74 |
QString app = QLatin1String("deviceupdates");
|
|
75 |
QStringList args;
|
|
76 |
args<< QLatin1String("-cp");
|
|
77 |
mproc->start(app, args);
|
|
78 |
mproc->waitForStarted();
|
|
79 |
}
|
|
80 |
}
|
|
81 |
CleanupStack::PopAndDestroy(); // ws
|
33
|
82 |
}
|
|
83 |
|
|
84 |
// ---------------------------------------------------------------------------------------------
|
|
85 |
// DeviceUpdateData::CloseDmUi
|
|
86 |
// closes DM Ui
|
|
87 |
// ---------------------------------------------------------------------------------------------
|
43
|
88 |
void DeviceUpdateData:: CloseDeviceUpdatesUi()
|
33
|
89 |
{
|
43
|
90 |
if(( mproc )&&(mproc->state() == QProcess::Running))
|
|
91 |
{
|
|
92 |
mproc->close();
|
|
93 |
}
|
|
94 |
|
33
|
95 |
}
|
|
96 |
|
|
97 |
void DeviceUpdateData::onLaunchView()
|
|
98 |
{
|
43
|
99 |
LaunchDeviceUpdatesUi();
|
33
|
100 |
}
|
|
101 |
|
|
102 |
CpBaseSettingView *DeviceUpdateData::createSettingView() const
|
|
103 |
{
|
43
|
104 |
return 0;
|
33
|
105 |
}
|