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 |
#include <cpsettingformitemdata.h>
|
43
|
18 |
#include <apgtask.h>
|
33
|
19 |
#include "deviceupdatesdata.h"
|
67
|
20 |
#include <xqserviceutil.h>
|
33
|
21 |
DeviceUpdateData::DeviceUpdateData(CpItemDataHelper &itemDataHelper,
|
67
|
22 |
const QString &text,
|
|
23 |
const QString &description,
|
|
24 |
const HbIcon &icon,
|
|
25 |
const HbDataFormModelItem *parent)
|
33
|
26 |
: CpSettingFormEntryItemData(itemDataHelper,
|
|
27 |
text,
|
|
28 |
description,
|
|
29 |
icon,
|
|
30 |
parent)
|
|
31 |
{
|
|
32 |
}
|
|
33 |
|
|
34 |
DeviceUpdateData::~DeviceUpdateData()
|
|
35 |
{
|
43
|
36 |
CloseDeviceUpdatesUi();
|
33
|
37 |
}
|
|
38 |
|
|
39 |
// -----------------------------------------------------------------------------
|
|
40 |
// DeviceUpdateData::OpenDmAppL()
|
|
41 |
// -----------------------------------------------------------------------------
|
|
42 |
//
|
43
|
43 |
void DeviceUpdateData::LaunchDeviceUpdatesUi()
|
67
|
44 |
{
|
|
45 |
qDebug("DeviceUpdateData::LaunchDeviceUpdatesUi >>");
|
|
46 |
RWsSession ws;
|
|
47 |
qt_symbian_throwIfError( ws.Connect() );
|
43
|
48 |
CleanupClosePushL( ws );
|
|
49 |
// Find the task with uid
|
|
50 |
TApaTaskList taskList(ws);
|
|
51 |
TApaTask task = taskList.FindApp( KUidSmlSyncApp );
|
|
52 |
if ( task.Exists() )
|
|
53 |
{
|
|
54 |
task.BringToForeground();
|
|
55 |
}
|
|
56 |
else
|
|
57 |
{
|
67
|
58 |
qDebug("DeviceUpdateData::LaunchDeviceUpdatesUi >> embedding");
|
|
59 |
QScopedPointer<XQAiwRequest> requester (mRequestManager.create(KService,KInterface,KMethod,true)); //false for NON-EMBEDDED
|
|
60 |
qDebug("DeviceUpdateData::LaunchDeviceUpdatesUi >> embed end");
|
|
61 |
connect(requester.data(), SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&)));
|
|
62 |
connect(requester.data(), SIGNAL(requestError(int,const QString&)), this, SLOT(handleError(int,const QString&)));
|
|
63 |
if (!(requester.isNull()))
|
|
64 |
{
|
|
65 |
m_currentRequest = requester.data();
|
|
66 |
requester->setSynchronous(false);
|
|
67 |
bool serviceRequestOk = requester->send();
|
|
68 |
if (serviceRequestOk)
|
|
69 |
{
|
|
70 |
m_currentRequest = requester.take();
|
|
71 |
}
|
|
72 |
else
|
|
73 |
{
|
|
74 |
// On a controlled error Qt Highway should call requestError,
|
|
75 |
// so clean scoped pointer here.
|
|
76 |
requester.take();
|
|
77 |
}
|
|
78 |
}
|
|
79 |
}
|
|
80 |
CleanupStack::PopAndDestroy(); // ws
|
|
81 |
qDebug("DeviceUpdateData::LaunchDeviceUpdatesUi >> end");
|
33
|
82 |
}
|
|
83 |
|
|
84 |
// ---------------------------------------------------------------------------------------------
|
67
|
85 |
// DeviceUpdateData::CloseDeviceUpdatesUi
|
33
|
86 |
// closes DM Ui
|
|
87 |
// ---------------------------------------------------------------------------------------------
|
43
|
88 |
void DeviceUpdateData:: CloseDeviceUpdatesUi()
|
33
|
89 |
{
|
67
|
90 |
if(m_currentRequest)
|
|
91 |
{
|
|
92 |
delete m_currentRequest;
|
|
93 |
m_currentRequest = NULL;
|
|
94 |
}
|
33
|
95 |
}
|
|
96 |
|
67
|
97 |
// ---------------------------------------------------------------------------------------------
|
|
98 |
// DeviceUpdateData::onLaunchView
|
|
99 |
// ---------------------------------------------------------------------------------------------
|
33
|
100 |
void DeviceUpdateData::onLaunchView()
|
|
101 |
{
|
43
|
102 |
LaunchDeviceUpdatesUi();
|
33
|
103 |
}
|
|
104 |
|
67
|
105 |
// ---------------------------------------------------------------------------------------------
|
|
106 |
// DeviceUpdateData::createSettingView
|
|
107 |
// ---------------------------------------------------------------------------------------------
|
33
|
108 |
CpBaseSettingView *DeviceUpdateData::createSettingView() const
|
|
109 |
{
|
67
|
110 |
return NULL;
|
33
|
111 |
}
|
67
|
112 |
|
|
113 |
// ---------------------------------------------------------------------------------------------
|
|
114 |
// DeviceUpdateData::handleOk
|
|
115 |
// Handles when request completes successfully
|
|
116 |
// ---------------------------------------------------------------------------------------------
|
|
117 |
void DeviceUpdateData::handleOk(const QVariant &returnValue)
|
|
118 |
{
|
|
119 |
if(m_currentRequest)
|
|
120 |
{
|
|
121 |
delete m_currentRequest;
|
|
122 |
m_currentRequest = NULL;
|
|
123 |
}
|
|
124 |
}
|
|
125 |
|
|
126 |
// ---------------------------------------------------------------------------------------------
|
|
127 |
// DeviceUpdateData::handleError
|
|
128 |
// Handles when request returns with an error
|
|
129 |
// ---------------------------------------------------------------------------------------------
|
|
130 |
void DeviceUpdateData::handleError(int error, const QString& errorMessage)
|
|
131 |
{
|
|
132 |
if(m_currentRequest)
|
|
133 |
{
|
|
134 |
delete m_currentRequest;
|
|
135 |
m_currentRequest = NULL;
|
|
136 |
}
|
|
137 |
}
|