javamanager/debugapi/src.s60/appremover.cpp
author hgs
Fri, 15 Oct 2010 12:29:39 +0300
changeset 80 d6dafc5d983f
parent 21 2a9601315dfc
permissions -rw-r--r--
v2.2.19_1

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: AppRemover uninstalls Java application
*
*/

#include "appremover.h"

#include "logger.h"
#include "commsmessage.h"

using namespace java::debug;
using namespace java::comms;

AppRemover::AppRemover(const Uid& aSuiteUid):
        mSuiteUid(aSuiteUid), mUninstallDone(false), mUninstallResult(-1)
{
}

AppRemover::~AppRemover()
{
}

int AppRemover::uninstall()
{
    JELOG2(EDebugApi);

    runJavaInstaller();
    LOG2(EDebugApi, EInfo, "InstallOperation::uninstallApp(): uid=%S, result=%d",
         mSuiteUid.toString().c_str(), mUninstallResult);
    return mUninstallResult;
}

CommsMessage AppRemover::getNextOperation()
{
    if (mUninstallDone)
    {
        return InstallOperation::getNextOperation();
    }

    CommsMessage msg;
    msg << UNINSTALL_OPERATION << mSuiteUid;
    LOG1(EDebugApi, EInfo, "next operation is UNINSTALL(%d)",
         mSuiteUid.toString().c_str());
    return msg;
}

void AppRemover::handleOperationResult(CommsMessage& aMessage)
{
    if (mUninstallDone)
    {
        InstallOperation::handleOperationResult(aMessage);
        return;
    }

    int operation = 0;
    aMessage >> operation >> mUninstallResult;

    LOG1(EDebugApi, EInfo, "UNINSTALL result: result=%d", mUninstallResult);
    mUninstallDone = true;
}