107
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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: canotifier.cpp
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "cauninstallnotifier.h"
|
|
19 |
#include "cauninstallnotifier_p.h"
|
|
20 |
#include "caprogresscanner.h"
|
|
21 |
#include "cauninstallobserver.h"
|
|
22 |
#include "casoftwareregistry.h"
|
|
23 |
|
|
24 |
/*!
|
|
25 |
Constructor.
|
|
26 |
\param notifierFilter descrbies entries to observe.
|
|
27 |
*/
|
|
28 |
CaUninstallNotifierPrivate::CaUninstallNotifierPrivate() :
|
|
29 |
mUninstallObserver(NULL), mProgressScanner(NULL),
|
|
30 |
mCaSoftwareRegistry(CaSoftwareRegistry::create()),
|
127
|
31 |
m_q(NULL),
|
|
32 |
mLastComponentId(0),
|
|
33 |
mLastValueOfProgress(0)
|
107
|
34 |
{
|
|
35 |
mUninstallObserver = new CaUninstallObserver();
|
|
36 |
TRAP_IGNORE(mProgressScanner = CCaProgresScanner::NewL(mUninstallObserver));
|
|
37 |
}
|
|
38 |
|
|
39 |
/*!
|
|
40 |
Destructor.
|
|
41 |
*/
|
|
42 |
CaUninstallNotifierPrivate::~CaUninstallNotifierPrivate()
|
|
43 |
{
|
|
44 |
delete mProgressScanner;
|
|
45 |
delete mUninstallObserver;
|
|
46 |
}
|
|
47 |
|
127
|
48 |
/*!
|
|
49 |
Makes connections witch uninstall observer.
|
|
50 |
*/
|
107
|
51 |
void CaUninstallNotifierPrivate::makeConnect()
|
|
52 |
{
|
|
53 |
connect(mUninstallObserver, SIGNAL(signalprogressChange(int, int)),
|
127
|
54 |
this, SLOT(progressChange(int, int)));
|
|
55 |
}
|
|
56 |
|
|
57 |
/*!
|
|
58 |
Slot to cache and forward progress notification.
|
|
59 |
*/
|
|
60 |
void CaUninstallNotifierPrivate::progressChange(int componentId,int valueOfProgress){
|
|
61 |
mLastComponentId = componentId;
|
|
62 |
mLastValueOfProgress = valueOfProgress;
|
|
63 |
emit m_q->progressChange(componentId, valueOfProgress);
|
107
|
64 |
}
|
127
|
65 |
|
|
66 |
/*!
|
|
67 |
Returns last progress notification.
|
|
68 |
*/
|
|
69 |
QVariantMap CaUninstallNotifierPrivate::getLastNotification()
|
|
70 |
{
|
|
71 |
QVariantMap lastNote;
|
|
72 |
if(mLastValueOfProgress < 0){
|
|
73 |
mLastComponentId = 0;
|
|
74 |
}
|
|
75 |
lastNote.insert(uninstallNotifierComponentIdKey, mLastComponentId);
|
|
76 |
lastNote.insert(uninstallNotifierValueOfProgressKey, mLastValueOfProgress);
|
|
77 |
return lastNote;
|
|
78 |
}
|