iaupdate/IAD/ui/src/iaupdateengine.cpp
author hgs
Wed, 20 Oct 2010 14:52:56 +0300
changeset 80 9dcba1ee99f7
parent 77 d1838696558c
permissions -rw-r--r--
201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
     2
 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
     3
 * All rights reserved.
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
     4
 * This component and the accompanying materials are made available
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
     6
 * which accompanies this distribution, and is available
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
     8
 *
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
     9
 * Initial Contributors:
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    10
 * Nokia Corporation - initial contribution.
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    11
 *
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    12
 * Contributors:
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    13
 *
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    14
 * Description:   This module contains the implementation of IAUpdateEngine
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    15
 *                class member functions.
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    16
 *
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    17
 */
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include <qapplication.h>
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <hbmessagebox.h>
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <hbaction.h>
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <eikenv.h>
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include <centralrepository.h>
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    24
#include <cmmanager.h>
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    25
#include <cmdestination.h>
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include <rconnmon.h>
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include <apgwgnam.h>
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    28
#include <starterclient.h>
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
#include "iaupdateengine.h"
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
#include "iaupdateserviceprovider.h"
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include "iaupdateuicontroller.h"
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    33
#include "iaupdatefwupdatehandler.h"
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include "iaupdategloballockhandler.h"
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include "iaupdatenodefilter.h"
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
#include "iaupdateresult.h"
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
#include "iaupdateprivatecrkeys.h"
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
#include "iaupdateuiconfigdata.h"
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
#include "iaupdatequeryhistory.h"
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
#include "iaupdateparameters.h"
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    41
#include "iaupdateagreement.h"
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    42
#include "iaupdateautomaticcheck.h"
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    43
#include "iaupdateresultsdialog.h"
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
#include "iaupdatedebug.h"
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    46
IAUpdateEngine::IAUpdateEngine(QObject *parent) :
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    47
    QObject(parent)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    48
    {
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::IAUpdateEngine() begin");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    50
    iController = NULL;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    51
    iFwUpdateHandler = NULL;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    52
    iGlobalLockHandler = NULL;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    53
    iAutomaticCheck = NULL;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    54
    iIdle = NULL;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    55
    iIdleAutCheck = NULL;
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
    iEikEnv = CEikonEnv::Static();
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    57
    mUpdateNow = false;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    58
    mRequestIssued = false;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    59
    mStartedFromApplication = false;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    60
    mUiRefreshAllowed = true;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    61
    mWgId = 0;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    62
    mUpdatequeryUid = 0;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    63
    mDialogState = NoDialog;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    64
    mResultsDialog = NULL;
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    65
    mServiceProvider = NULL;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    66
    mServiceProvider = new IAUpdateServiceProvider(*this);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    67
    connect(mServiceProvider, SIGNAL(clientDisconnected()), this,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    68
            SLOT(handleAllClientsClosed()));
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
    TRAP_IGNORE( iController = CIAUpdateUiController::NewL( *this ));
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    70
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::IAUpdateEngine() end");
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    71
    }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
IAUpdateEngine::~IAUpdateEngine()
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    74
    {
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::~IAUpdateEngine() begin");
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    76
    InformRequestObserver(KErrCancel);
77
d1838696558c 201039_02
hgs
parents: 69
diff changeset
    77
    if (iController)
d1838696558c 201039_02
hgs
parents: 69
diff changeset
    78
        {
d1838696558c 201039_02
hgs
parents: 69
diff changeset
    79
        delete iController;
d1838696558c 201039_02
hgs
parents: 69
diff changeset
    80
        }
d1838696558c 201039_02
hgs
parents: 69
diff changeset
    81
    
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    82
    if (iIdle)
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    83
        {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    84
        delete iIdle;
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    85
        }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    86
    if (iIdleAutCheck)
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    87
        {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    88
        delete iIdleAutCheck;
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    89
        }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    90
    if (iGlobalLockHandler)
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    91
        {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    92
        delete iGlobalLockHandler;
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    93
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    94
    if (iAutomaticCheck)
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    95
        {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    96
        delete iAutomaticCheck;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    97
        }
77
d1838696558c 201039_02
hgs
parents: 69
diff changeset
    98
    
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    99
    if (iFwUpdateHandler)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   100
        {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   101
        delete iFwUpdateHandler;
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   102
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   103
    if (mServiceProvider)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   104
        {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   105
        delete mServiceProvider;
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   106
        }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::~IAUpdateEngine() end");
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   108
    }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
// IAUpdateEngine::StartedByLauncherL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
//
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   115
void IAUpdateEngine::StartedByLauncherL(bool aRefreshFromNetworkDenied)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartedByLauncherL() begin");
80
hgs
parents: 77
diff changeset
   118
    emit createUI();
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   119
    mRequestIssued = true;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   120
    mRequestType = IAUpdateUiDefines::ENoRequest;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   121
    iController->SetRequestType(mRequestType);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   122
    SetVisibleL(true);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
    CIAUpdateParameters* params = iController->ParamsReadAndRemoveFileL();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   124
    iController->CheckUpdatesDeferredL(params, aRefreshFromNetworkDenied);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
// IAUpdateEngine::CheckUpdatesRequestL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
//
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   132
void IAUpdateEngine::CheckUpdatesRequestL(int wgid,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   133
        CIAUpdateParameters* aFilterParams, bool aForcedRefresh)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   134
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::CheckUpdatesRequestL() begin");
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   137
    SetClientWgId(wgid);
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   138
    mRequestIssued = true;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   139
    mStartedFromApplication = true;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   140
    CleanupStack::PushL(aFilterParams);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   141
    if (wgid > 0)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   143
        HideApplicationInFSWL(true);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   145
    CleanupStack::Pop(aFilterParams);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   146
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   147
    if (!aFilterParams->ShowProgress())
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   149
        iEikEnv->RootWin().SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   151
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   152
    mRequestType = IAUpdateUiDefines::ECheckUpdates;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   153
    iController->SetRequestType(mRequestType);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   154
    iController->SetForcedRefresh(aForcedRefresh);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   155
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   156
    iController->CheckUpdatesDeferredL(aFilterParams, false);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   157
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::CheckUpdatesRequestL() end");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
// IAUpdateEngine::ShowUpdatesRequestL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
// 
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   166
void IAUpdateEngine::ShowUpdatesRequestL(int wgid,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   167
        CIAUpdateParameters* aFilterParams)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   169
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdatesRequestL() begin");
80
hgs
parents: 77
diff changeset
   170
    emit createUI();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   171
    SetClientWgId(wgid);
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   172
    mRequestIssued = true;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   173
    //    delete iBackgroundTimer;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   174
    //    iBackgroundTimer = NULL;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   175
    mStartedFromApplication = true;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   176
    CleanupStack::PushL(aFilterParams);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   177
    if (wgid > 0)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   179
        HideApplicationInFSWL(true);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   181
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   182
    //StatusPane()->MakeVisible( true );
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   183
    iEikEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityNormal);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   184
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
    //iRequestObserver = &aObserver;
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   186
    mRequestType = IAUpdateUiDefines::EShowUpdates;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   187
    iController->SetRequestType(mRequestType);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
    //if ( !iMainView )
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
    //    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
    //    iMainView  = CIAUpdateMainView::NewL( ClientRect() ); 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
    //    AddViewL( iMainView );
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
    //    }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   194
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   195
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
    // by pushing object to cleanup stack its destructor is called if leave happens
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
    // so global lock issued by this instance can be released in destructor of CIAUpdateGlobalLockHandler
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   198
    CIAUpdateGlobalLockHandler* globalLockHandler =
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   199
            CIAUpdateGlobalLockHandler::NewLC();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   200
    if (!globalLockHandler->InUseByAnotherInstanceL())
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   202
        globalLockHandler->SetToInUseForAnotherInstancesL(true);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   203
        CleanupStack::Pop(globalLockHandler);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   204
        CleanupStack::Pop(aFilterParams);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   205
        CleanupStack::PushL(globalLockHandler);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   206
        iController->CheckUpdatesDeferredL(aFilterParams, false);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   207
        CleanupStack::Pop(globalLockHandler);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
        delete iGlobalLockHandler;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
        iGlobalLockHandler = globalLockHandler;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
        //now possible deletion of iGlobalLockHandler in leave situation is handled
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
        //in HandleLeaveErrorL() and HandleLeaveErrorWithoutLeave methods. 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
        }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
    else
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   215
        CleanupStack::PopAndDestroy(globalLockHandler);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   216
        CleanupStack::PopAndDestroy(aFilterParams);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
        // locked by another IAD instance, nothing else to do than just complete client's request.  
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   218
        InformRequestObserver(KErrNone);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   219
        }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   221
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdatesRequestL() end");
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
// IAUpdateEngine::ShowUpdateQueryRequestL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
//     
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   229
void IAUpdateEngine::ShowUpdateQueryRequestL(int wgid, uint aUid)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdateQueryRequestL begin");
80
hgs
parents: 77
diff changeset
   232
    emit createUI();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   233
    SetClientWgId(wgid);
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   234
    mRequestIssued = true;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   235
    mStartedFromApplication = true;
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   236
    mUpdatequeryUid = aUid;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   237
    mUpdateNow = false;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   238
    if (wgid > 0)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   240
        HideApplicationInFSWL(true);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
        }
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   242
    mRequestType = IAUpdateUiDefines::EUpdateQuery;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   243
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
    delete iIdle;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
    iIdle = NULL;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   246
    iIdle = CIdle::NewL(CActive::EPriorityIdle);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   247
    iIdle->Start(TCallBack(UpdateQueryCallbackL, this));
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdateQueryRequestL end")
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
// -----------------------------------------------------------------------------
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   252
// IAUpdateEngine::StartUpdate
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   253
// 
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   254
// -----------------------------------------------------------------------------
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   255
//
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   256
void IAUpdateEngine::StartUpdate(bool aFirmwareUpdate)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   257
    {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   258
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartUpdate() begin");
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   259
    if (aFirmwareUpdate)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   260
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   261
        if (!iFwUpdateHandler)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   262
            {
77
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   263
            TRAP_IGNORE(CIAUpdateFWUpdateHandler::NewL());
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   264
            }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   265
        if (iFwUpdateHandler)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   266
            {
77
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   267
            iFwUpdateHandler->FirmWareUpdatewithFOTA(this);
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   268
            }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   269
        }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   270
    else
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   271
        {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   272
        // by pushing object to cleanup stack it's destructor is called if leave happens
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   273
        // so global lock issued by this instance can be released in destructor of CIAUpdateGlobalLockHandler
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   274
        CIAUpdateGlobalLockHandler* globalLockHandler =
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   275
                CIAUpdateGlobalLockHandler::NewLC();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   276
        if (!globalLockHandler->InUseByAnotherInstanceL())
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   277
            {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   278
            globalLockHandler->SetToInUseForAnotherInstancesL(true);
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   279
            // No need to be totally silent since the updating is started
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   280
            // by user.
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   281
            SetDefaultConnectionMethodL(false);
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   282
            iController->StartUpdateL();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   283
            CleanupStack::Pop(globalLockHandler);
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   284
            delete iGlobalLockHandler;
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   285
            iGlobalLockHandler = globalLockHandler;
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   286
            //now possible deletion of iGlobalLockHandler in leave situation is handled
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   287
            //in HandleLeaveErrorL() and HandleLeaveErrorWithoutLeave methods. 
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   288
            }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   289
        else
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   290
            {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   291
            CleanupStack::PopAndDestroy(globalLockHandler);
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   292
            }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   293
        }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   294
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartUpdate() end");
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   295
    }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   296
77
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   297
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   298
// -----------------------------------------------------------------------------
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   299
// IAUpdateEngine::SetVisibleL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
//  
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   303
void IAUpdateEngine::SetVisibleL(bool /*aVisible*/)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   304
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   305
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetVisibleL() begin");
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   306
    //IAUPDATE_TRACE_1("[IAUPDATE] visible: %d", aVisible );
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   307
    /*if ( aVisible )
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   308
     {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   309
     if ( iEikonEnv->RootWin().OrdinalPosition() != 0 || iEikonEnv->RootWin().OrdinalPriority() != ECoeWinPriorityNormal )
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   310
     {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   311
     iEikonEnv->RootWin().SetOrdinalPosition( 0, ECoeWinPriorityNormal );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   312
     }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   313
     
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   314
     StatusPane()->MakeVisible( ETrue );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   315
     iMainView  = CIAUpdateMainView::NewL( ClientRect() ); 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   316
     AddViewL( iMainView );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   317
     ActivateLocalViewL( TUid::Uid( EIAUpdateMainViewId ) );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   318
     }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   319
     else
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   320
     {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   321
     iEikonEnv->RootWin().SetOrdinalPosition( -1, ECoeWinPriorityNeverAtFront );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   322
     StatusPane()->MakeVisible( EFalse );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   323
     }*/
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   324
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetVisibleL() end");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   325
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   326
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   327
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   328
// IAUpdateEngine::SetClientWgId
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   329
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   330
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
// 
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   332
void IAUpdateEngine::SetClientWgId(int aWgId)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   333
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   334
    IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateEngine::SetClientWgId() wgId %d", aWgId );
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   335
    mWgId = aWgId;
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   336
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   337
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   338
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
// IAUpdateEngine::ClientInBackgroundL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   341
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   342
// 
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   343
bool IAUpdateEngine::ClientInBackgroundL() const
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   344
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ClientInBackgroundL() begin");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   346
    bool inBackground = false;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   347
    if (mWgId > 0)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   349
        CArrayFixFlat<int>* wgArray = new (ELeave) CArrayFixFlat<int> (10);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   350
        CleanupStack::PushL(wgArray);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   351
        User::LeaveIfError(iEikEnv->WsSession().WindowGroupList(0, wgArray));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   352
        int ownWgId = iEikEnv->RootWin().Identifier();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   353
        if ((wgArray->At(0) != ownWgId) && (wgArray->At(0) != mWgId))
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   354
            {
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   355
            inBackground = true;
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   356
            }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   357
        CleanupStack::PopAndDestroy(wgArray);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   358
        }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   359
    IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateEngine::ClientInBackgroundL() inBackground: %d", inBackground );
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   360
    return inBackground;
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   361
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   362
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   363
// -----------------------------------------------------------------------------
77
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   364
// IAUpdateEngine::Controller()
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   365
// 
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   366
// -----------------------------------------------------------------------------
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   367
//      
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   368
CIAUpdateUiController* IAUpdateEngine::Controller() const
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   369
    {
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   370
    return iController;
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   371
    }
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   372
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   373
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   374
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   375
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   376
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   377
// -----------------------------------------------------------------------------
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   378
// IAUpdateEngine::handleAllClientsClosed()
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   379
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   380
// -----------------------------------------------------------------------------
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   381
//
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   382
void IAUpdateEngine::handleAllClientsClosed()
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   383
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   384
    qApp->quit();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   385
    }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   386
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   387
// -----------------------------------------------------------------------------
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   388
// IAUpdateEngine::dialogFinished
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   389
// Called when dialog is finished.
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   390
// -----------------------------------------------------------------------------
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   391
//
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   392
void IAUpdateEngine::dialogFinished(HbAction *action)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   393
    {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   394
    DialogState dialogState = mDialogState;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   395
    mDialogState = NoDialog;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   396
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   397
    switch (dialogState)
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   398
        {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   399
        case Results:
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   400
            mUiRefreshAllowed = true;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   401
            if (iController->ResultsInfo().iRebootAfterInstall)
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   402
                {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   403
                ShowRebootDialogL();
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   404
                }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   405
            else
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   406
                {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   407
                if (!DoPossibleApplicationClose())
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   408
                    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   409
                    iController->RefreshNodeList();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   410
                    RefreshUI();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   411
                    }
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   412
                }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   413
            break;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   414
        case RebootQuery:
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   415
            if (action == mPrimaryAction)
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   416
                {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   417
                RStarterSession startersession;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   418
                if (startersession.Connect() == KErrNone)
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   419
                    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   420
                    startersession.Reset(RStarterSession::EUnknownReset);
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   421
                    startersession.Close();
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   422
                    }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   423
                }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   424
            else
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   425
                {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   426
                if (!DoPossibleApplicationClose())
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   427
                    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   428
                    iController->RefreshNodeList();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   429
                    RefreshUI();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   430
                    }
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   431
                }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   432
            break;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   433
        case ShowUpdateQuery:
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   434
            if (action == mPrimaryAction)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   435
                {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   436
                IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::dialogFinished() Now");
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   437
                mUpdateNow = true;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   438
                }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   439
            else if (action == mSecondaryAction)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   440
                {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   441
                IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::dialogFinished() Later");
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   442
                CIAUpdateQueryHistory* updateQueryHistory =
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   443
                        CIAUpdateQueryHistory::NewL();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   444
                CleanupStack::PushL(updateQueryHistory);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   445
                updateQueryHistory->SetTimeL(mUpdatequeryUid);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   446
                CleanupStack::PopAndDestroy(updateQueryHistory);
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   447
                }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   448
            InformRequestObserver(KErrNone);
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   449
            break;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   450
        default:
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   451
            break;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   452
        }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   453
    }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   454
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   455
// -----------------------------------------------------------------------------
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   456
// IAUpdateEngine::StartupComplete
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   457
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   458
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   459
//    
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   460
void IAUpdateEngine::StartupComplete(TInt aError)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   461
    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   462
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartupComplete() begin");
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   463
    IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", aError);
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   464
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   465
    if (aError != KErrNone)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   466
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   467
        HandleLeaveErrorWithoutLeave(aError);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   468
        }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   469
    else
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   470
        {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   471
        TRAPD( err, StartupCompleteL() );
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   472
        if (err != KErrNone)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   473
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   474
            HandleLeaveErrorWithoutLeave(err);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   475
            }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   476
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   477
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   478
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartupComplete() end");
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   479
    }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   480
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   481
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   482
// IAUpdateEngine::StartupCompleteL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   483
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   484
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   485
//    
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   486
void IAUpdateEngine::StartupCompleteL()
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   487
    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   488
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartupCompleteL() begin");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   489
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   490
    delete iGlobalLockHandler;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   491
    iGlobalLockHandler = NULL;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   492
    iGlobalLockHandler = CIAUpdateGlobalLockHandler::NewL();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   493
    if (!iGlobalLockHandler->InUseByAnotherInstanceL())
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   494
        {
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   495
        bool totalSilent(false);
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   496
        if (mRequestType == IAUpdateUiDefines::ECheckUpdates)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   497
            {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   498
            if (iController->Filter())
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   499
                {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   500
                if (iController->Filter()->FilterParams())
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   501
                    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   502
                    if (iController->Filter()->FilterParams()->Refresh())
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   503
                        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   504
                        if (!iController->ForcedRefresh())
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   505
                            {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   506
                            //from bgchecker, make it silent
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   507
                            totalSilent = true;
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   508
                            }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   509
                        }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   510
                    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   511
                }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   512
            }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   513
        SetDefaultConnectionMethodL(totalSilent);
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   514
        iGlobalLockHandler->SetToInUseForAnotherInstancesL(true);
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   515
        iController->StartRefreshL();
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   516
        }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   517
    else
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   518
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   519
        RefreshCompleteL(true, KErrServerBusy);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   520
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   521
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   522
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartupCompleteL() end");
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   523
    }
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   524
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   525
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   526
// IAUpdateEngine::HandleLeaveErrorL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   527
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   528
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   529
//        
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   530
void IAUpdateEngine::HandleLeaveErrorL(TInt aError)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   531
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   532
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HandleLeaveErrorL() begin");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   533
    //removal of iGlobalLockHandler releases possible global operation lock to other IAD instances
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   534
    delete iGlobalLockHandler;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   535
    iGlobalLockHandler = NULL;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   536
    // client request is completed before leave in case of leave error
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   537
    if (aError != KErrNone)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   538
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   539
        InformRequestObserver(aError);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   540
        User::Leave(aError);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   541
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   542
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   543
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HandleLeaveErrorL() end");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   544
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   545
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   546
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   547
// IAUpdateEngine::HandleLeaveErrorWithoutLeave
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   548
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   549
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   550
//  
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   551
void IAUpdateEngine::HandleLeaveErrorWithoutLeave(TInt aError)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   552
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   553
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HandleLeaveErrorWithoutLeave() begin");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   554
    //removal of iGlobalLockHandler releases possible global operation lock to other IAD instances
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   555
    delete iGlobalLockHandler;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   556
    iGlobalLockHandler = NULL;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   557
    if (aError != KErrNone)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   558
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   559
        InformRequestObserver(aError);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   560
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   561
    if (aError == KErrDiskFull)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   562
        {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   563
        //TRAP_IGNORE( ShowGlobalErrorNoteL( aError ) );
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   564
        }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   565
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HandleLeaveErrorWithoutLeave end");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   566
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   567
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   568
// -----------------------------------------------------------------------------
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   569
// IAUpdateEngine::RefreshUI
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   570
// 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   571
// -----------------------------------------------------------------------------
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   572
// 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   573
void IAUpdateEngine::RefreshUI()
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   574
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   575
    emit refresh(iController->Nodes(), iController->FwNodes(), KErrNone);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   576
    }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   577
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   578
// -----------------------------------------------------------------------------
77
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   579
// IAUpdateEngine::RefreshUIProgress
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   580
// 
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   581
// -----------------------------------------------------------------------------
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   582
//
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   583
void IAUpdateEngine::RefreshUIProgress()
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   584
    {
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   585
    emit refreshProgress();
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   586
    }
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   587
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   588
// -----------------------------------------------------------------------------
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   589
// IAUpdateEngine::SetUpdatesRefreshing
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   590
// 
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   591
// -----------------------------------------------------------------------------
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   592
//
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   593
void IAUpdateEngine::SetUpdatesRefreshing( TBool aRefreshing )
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   594
    {
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   595
    emit setUpdatesRefreshing(aRefreshing);
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   596
    }
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   597
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   598
// -----------------------------------------------------------------------------
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   599
// IAUpdateEngine::RefreshCompleteL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   600
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   601
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   602
//      
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   603
void IAUpdateEngine::RefreshCompleteL(TBool /*aWithViewActivation*/,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   604
        TInt aError)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   605
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   606
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::RefreshCompleteL() begin");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   607
    IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", aError );
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   608
    //removal of iGlobalLockHandler releases possible global operation lock to other IAD instances
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   609
    delete iGlobalLockHandler;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   610
    iGlobalLockHandler = NULL;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   611
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   612
    if (mRequestType == IAUpdateUiDefines::ECheckUpdates)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   613
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   614
        InformRequestObserver(aError);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   615
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   616
    else
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   617
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   618
        emit refresh(iController->Nodes(), iController->FwNodes(), aError);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   619
        //if ( aWithViewActivation)
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   620
        //  {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   621
        //  ActivateLocalViewL( TUid::Uid( EIAUpdateMainViewId ) );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   622
        //  }
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   623
        CIAUpdateAgreement* agreement = CIAUpdateAgreement::NewLC();
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   624
        bool agreementAccepted = agreement->AgreementAcceptedL();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   625
        if (iController->ForcedRefresh())
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   626
            {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   627
            if (!agreementAccepted)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   628
                {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   629
                agreement->SetAgreementAcceptedL();
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   630
                }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   631
            }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   632
        CleanupStack::PopAndDestroy(agreement);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   633
        // By calling CIdle possible waiting dialog can be closed before
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   634
        // automatic check where a new dialog may be launched
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   635
        delete iIdleAutCheck;
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   636
        iIdleAutCheck = NULL;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   637
        iIdleAutCheck = CIdle::NewL(CActive::EPriorityIdle);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   638
        iIdleAutCheck->Start(TCallBack(AutomaticCheckCallbackL, this));
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   639
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   640
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   641
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::RefreshCompleteL() end");
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   642
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   643
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   644
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   645
// IAUpdateEngine::UpdateCompleteL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   646
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   647
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   648
//     
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   649
void IAUpdateEngine::UpdateCompleteL(TInt aError)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   650
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   651
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::UpdateCompleteL begin");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   652
    IAUPDATE_TRACE_1("[IAUPDATE] error code: %d", aError );
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   653
    //removal of iGlobalLockHandler releases possible global operation lock to other IAD instances
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   654
    delete iGlobalLockHandler;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   655
    iGlobalLockHandler = NULL;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   656
    if (mRequestType != IAUpdateUiDefines::ENoRequest)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   657
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   658
        InformRequestObserver(aError);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   659
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   660
77
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   661
    emit updateCompleted();
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   662
    ShowResultsDialogL();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   663
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   664
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::UpdateCompleteL end");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   665
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   666
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   667
// -----------------------------------------------------------------------------
77
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   668
// IAUpdateEngine::PreparingStarted
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   669
// 
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   670
// -----------------------------------------------------------------------------
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   671
//
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   672
void IAUpdateEngine::PreparingStarted()
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   673
    {
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   674
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   675
    }
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   676
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   677
// -----------------------------------------------------------------------------
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   678
// IAUpdateEngine::Prepared
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   679
// 
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   680
// -----------------------------------------------------------------------------
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   681
//
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   682
void IAUpdateEngine::Prepared()
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   683
    {
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   684
    emit updateCompleted();
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   685
    }
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   686
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   687
// -----------------------------------------------------------------------------
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   688
// IAUpdateEngine::ShowResultsDialogL
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   689
// 
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   690
// -----------------------------------------------------------------------------
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   691
//   
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   692
void IAUpdateEngine::ShowResultsDialogL()
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   693
    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   694
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowResultsDialogL() begin");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   695
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   696
    mUiRefreshAllowed = false;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   697
    mResultsDialog = new IAUpdateResultsDialog(this);
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   698
    mResultsDialog->showResults(iController->ResultsInfo(), this,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   699
            SLOT(dialogFinished(HbAction*)));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   700
    mDialogState = Results;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   701
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   702
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowResultsDialogL() end");
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   703
    }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   704
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   705
// -----------------------------------------------------------------------------
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   706
// IAUpdateEngine::ShowRebootDialogL
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   707
// 
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   708
// -----------------------------------------------------------------------------
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   709
//
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   710
void IAUpdateEngine::ShowRebootDialogL()
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   711
    {
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   712
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowRebootDialogL() begin");
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   713
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   714
    HbMessageBox *messageBox = new HbMessageBox(
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   715
            HbMessageBox::MessageTypeQuestion);
77
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   716
    messageBox->setText
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   717
        (hbTrId("txt_software_info_device_restart_is_needed_restar"));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   718
    int actionCount = messageBox->actions().count();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   719
    for (int i = actionCount - 1; i >= 0; i--)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   720
        {
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   721
        messageBox->removeAction(messageBox->actions().at(i));
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   722
        }
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   723
    mPrimaryAction = NULL;
77
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   724
    mPrimaryAction = new HbAction(hbTrId("txt_common_button_ok"));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   725
    HbAction *secondaryAction = NULL;
77
d1838696558c 201039_02
hgs
parents: 69
diff changeset
   726
    secondaryAction = new HbAction(hbTrId("txt_common_button_cancel"));
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   727
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   728
    messageBox->addAction(mPrimaryAction);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   729
    messageBox->addAction(secondaryAction);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   730
    messageBox->setTimeout(HbPopup::NoTimeout);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   731
    messageBox->setAttribute(Qt::WA_DeleteOnClose);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   732
    messageBox->open(this, SLOT(dialogFinished(HbAction*)));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   733
    mDialogState = RebootQuery;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   734
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   735
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowRebootDialogL() end");
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   736
    }
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   737
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   738
// -----------------------------------------------------------------------------
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   739
// IAUpdateEngine::InformRequestObserver
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   740
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   741
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   742
//      
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   743
void IAUpdateEngine::InformRequestObserver(int aError)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   744
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   745
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::InformRequestObserver() begin");
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   746
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   747
    //if ( iRequestObserver )
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   748
    if (mRequestIssued)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   749
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   750
        if (iController->ClosingAllowedByClient())
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   751
            {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   752
            if (mRequestType != IAUpdateUiDefines::ENoRequest)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   753
                {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   754
                //                if ( iRequestType == IAUpdateUiDefines::EUpdateQuery && iUpdateNow )
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   755
                //                    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   756
                //                  if ( !iBackgroundTimer )
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   757
                //                        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   758
                //                        iBackgroundTimer = CIAUpdateUITimer::NewL( *this, CIAUpdateUITimer::EBackgroundDelay );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   759
                //                        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   760
                //                 if ( !iBackgroundTimer->IsActive() )
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   761
                //                        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   762
                //                        iBackgroundTimer->After( 500000 );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   763
                //                        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   764
                //                    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   765
                //                 else
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   766
                //                    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   767
                iEikEnv->RootWin().SetOrdinalPosition(-1,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   768
                        ECoeWinPriorityNeverAtFront);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   769
                //                    }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   770
                }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   771
            }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   772
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   773
        switch (mRequestType)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   774
            {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   775
            case IAUpdateUiDefines::ENoRequest:
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   776
                {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   777
                mServiceProvider->completeLauncherLaunch(aError);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   778
                break;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   779
                }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   780
            case IAUpdateUiDefines::ECheckUpdates:
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   781
                {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   782
                mServiceProvider->completeCheckUpdates(
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   783
                        iController->CountOfAvailableUpdates(), aError);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   784
                break;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   785
                }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   786
            case IAUpdateUiDefines::EShowUpdates:
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   787
                {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   788
                CIAUpdateResult* result(NULL);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   789
                TRAPD( error, result = CIAUpdateResult::NewL() )
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   790
                if (result)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   791
                    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   792
                    TIAUpdateResultsInfo resultsInfo(
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   793
                            iController->ResultsInfo());
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   794
                    IAUPDATE_TRACE_3("[IAUPDATE] IAUpdateEngine::InformRequestObserver succeed: %d failed: %d  cancelled: %d",
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   795
                            resultsInfo.iCountSuccessfull,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   796
                            resultsInfo.iCountFailed,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   797
                            resultsInfo.iCountCancelled );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   798
                    result->SetSuccessCount(resultsInfo.iCountSuccessfull);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   799
                    result->SetFailCount(resultsInfo.iCountFailed);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   800
                    result->SetCancelCount(resultsInfo.iCountCancelled);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   801
                    mServiceProvider->completeShowUpdates(result, aError);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   802
                    // Ownership of result is transferred here.
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   803
                    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   804
                else
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   805
                    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   806
                    mServiceProvider->completeShowUpdates(NULL, error);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   807
                    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   808
                break;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   809
                }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   810
            case IAUpdateUiDefines::EUpdateQuery:
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   811
                {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   812
                mServiceProvider->completeUpdateQuery(mUpdateNow, aError);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   813
                break;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   814
                }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   815
            default:
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   816
                {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   817
                break;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   818
                }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   819
            }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   820
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   821
        mRequestIssued = false;
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   822
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   823
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   824
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::InformRequestObserver() end");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   825
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   826
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   827
// ---------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   828
// IAUpdateEngine::SetDefaultConnectionMethodL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   829
// Sets the connection method for the update network connection.
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   830
// ---------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   831
//
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   832
void IAUpdateEngine::SetDefaultConnectionMethodL(bool aTotalSilent)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   833
    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   834
    if (aTotalSilent)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   835
        {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   836
        // from back ground checker, choose the IAP to make the internet access silent
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   837
        IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetDefaultConnectionMethodL() begin");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   838
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   839
        uint connectionMethodId(0);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   840
        int connMethodId(0);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   841
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   842
        // Let's first check whether cenrep contains SNAP id other than zero
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   843
        CRepository* cenrep(CRepository::NewLC(KCRUidIAUpdateSettings));
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   844
        User::LeaveIfError(cenrep->Get(KIAUpdateAccessPoint, connMethodId));
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   845
        CleanupStack::PopAndDestroy(cenrep);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   846
        cenrep = NULL;
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   847
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   848
        RCmManager cmManager;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   849
        cmManager.OpenL();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   850
        CleanupClosePushL(cmManager);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   851
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   852
        if (connMethodId == -1)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   853
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   854
            IAUPDATE_TRACE("[IAUPDATE] user chooses default connection, use IAP logic");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   855
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   856
            //check what is the default connection by users     
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   857
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   858
            TCmDefConnValue DCSetting;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   859
            cmManager.ReadDefConnL(DCSetting);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   860
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   861
            switch (DCSetting.iType)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   862
                {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   863
                case ECmDefConnAlwaysAsk:
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   864
                case ECmDefConnAskOnce:
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   865
                    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   866
                    //go with the best IAP under internet snap
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   867
                    connectionMethodId = GetBestIAPInAllSNAPsL(cmManager);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   868
                    break;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   869
                    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   870
                case ECmDefConnDestination:
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   871
                    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   872
                    //go with the best IAP under this snap
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   873
                    connectionMethodId = GetBestIAPInThisSNAPL(cmManager,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   874
                            DCSetting.iId);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   875
                    break;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   876
                    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   877
                case ECmDefConnConnectionMethod:
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   878
                    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   879
                    //go with the best IAP under this snap
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   880
                    connectionMethodId = DCSetting.iId;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   881
                    break;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   882
                    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   883
                }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   884
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   885
        else if (connMethodId == 0)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   886
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   887
            //no choice from user, we go with the best IAP under Internent SNAP
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   888
            connectionMethodId = GetBestIAPInAllSNAPsL(cmManager);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   889
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   890
        else
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   891
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   892
            IAUPDATE_TRACE("[IAUPDATE] use chooses a snap");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   893
            // It was some SNAP value
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   894
            connectionMethodId = GetBestIAPInThisSNAPL(cmManager,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   895
                    connMethodId);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   896
            }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   897
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   898
        CleanupStack::PopAndDestroy(&cmManager);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   899
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   900
        if (connectionMethodId != 0)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   901
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   902
            TIAUpdateConnectionMethod
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   903
                    connectionMethod(
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   904
                            connectionMethodId,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   905
                            TIAUpdateConnectionMethod::EConnectionMethodTypeAccessPoint);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   906
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   907
            iController->SetDefaultConnectionMethodL(connectionMethod);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   908
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   909
        else
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   910
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   911
            //In the totally silent case, if no usable IAP, we complete the check update with 0 updates.
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   912
            //the bgchecker will try again later after 1 month. 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   913
            //The LEAVE will be catched up later and complete the request from background checker.
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   914
            User::LeaveIfError(KErrNotFound);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   915
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   916
        IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetDefaultConnectionMethodL() end");
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   917
        }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   918
    else
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   919
        {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   920
        // from grid, use the old logic
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   921
        IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetDefaultConnectionMethodL() begin");
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   922
        uint connectionMethodId(0);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   923
        int connMethodId(0);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   924
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   925
        // Set initial value to always ask
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   926
        int connectionMethodType(
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   927
                TIAUpdateConnectionMethod::EConnectionMethodTypeAlwaysAsk);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   928
        bool needSaving(false);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   929
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   930
        // Let's first check whether cenrep contains SNAP id other than zero
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   931
        CRepository* cenrep(CRepository::NewLC(KCRUidIAUpdateSettings));
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   932
        User::LeaveIfError(cenrep->Get(KIAUpdateAccessPoint, connMethodId));
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   933
        CleanupStack::PopAndDestroy(cenrep);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   934
        cenrep = NULL;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   935
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   936
        if (connMethodId == -1)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   937
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   938
            IAUPDATE_TRACE("[IAUPDATE] user chooses default connection, use IAP logic");
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   939
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   940
            connectionMethodId = 0;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   941
            connectionMethodType
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   942
                    = TIAUpdateConnectionMethod::EConnectionMethodTypeDefault;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   943
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   944
        else if (connMethodId == 0)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   945
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   946
            IAUPDATE_TRACE("[IAUPDATE] use chooses nothing, use internal IAP logic");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   947
            //if nothing is set by user, use our new logic
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   948
            //SetDefaultConnectionMethod2L();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   949
            //return;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   950
            // CenRep didn't contain any SNAP id. Let's try Internet SNAP then.
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   951
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   952
            RCmManager cmManager;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   953
            cmManager.OpenL();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   954
            CleanupClosePushL(cmManager);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   955
            iDestIdArray.Reset();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   956
            cmManager.AllDestinationsL(iDestIdArray);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   957
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   958
            for (int i = 0; i < iDestIdArray.Count(); i++)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   959
                {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   960
                RCmDestination dest = cmManager.DestinationL(iDestIdArray[i]);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   961
                CleanupClosePushL(dest);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   962
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   963
                if (dest.MetadataL(CMManager::ESnapMetadataInternet))
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   964
                    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   965
                    // Check whether Internet SNAP contains any IAP.
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   966
                    if (dest.ConnectionMethodCount() > 0)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   967
                        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   968
                        connectionMethodId = iDestIdArray[i];
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   969
                        needSaving = true;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   970
                        IAUPDATE_TRACE_1("[IAUPDATE] connectionMethodId: %d", connectionMethodId );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   971
                        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   972
                    CleanupStack::PopAndDestroy(&dest);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   973
                    break;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   974
                    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   975
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   976
                CleanupStack::PopAndDestroy(&dest);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   977
                }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   978
            iDestIdArray.Reset();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   979
            CleanupStack::PopAndDestroy(&cmManager);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   980
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   981
        else
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   982
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   983
            IAUPDATE_TRACE("[IAUPDATE] use chooses a snap");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   984
            // It was some SNAP value
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   985
            connectionMethodId = connMethodId;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   986
            }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   987
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   988
        if (connectionMethodId > 0)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   989
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   990
            // We have now some valid SNAP id, either from CenRep or Internet SNAP
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   991
            connectionMethodType
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   992
                    = TIAUpdateConnectionMethod::EConnectionMethodTypeDestination;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   993
            // Save to cenrep if needed
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   994
            if (needSaving)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   995
                {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   996
                cenrep = CRepository::NewLC(KCRUidIAUpdateSettings);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   997
                int err = cenrep->StartTransaction(
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   998
                        CRepository::EReadWriteTransaction);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   999
                User::LeaveIfError(err);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1000
                cenrep->CleanupCancelTransactionPushL();
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1001
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1002
                connMethodId = connectionMethodId;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1003
                err = cenrep->Set(KIAUpdateAccessPoint, connMethodId);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1004
                User::LeaveIfError(err);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1005
                TUint32 ignore = KErrNone;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1006
                User::LeaveIfError(cenrep->CommitTransaction(ignore));
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1007
                CleanupStack::PopAndDestroy(); // CleanupCancelTransactionPushL()
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1008
                CleanupStack::PopAndDestroy(cenrep);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1009
                }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1010
            }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1011
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1012
        TIAUpdateConnectionMethod
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1013
                connectionMethod(
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1014
                        connectionMethodId,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1015
                        static_cast<TIAUpdateConnectionMethod::TConnectionMethodType> (connectionMethodType));
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1016
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1017
        iController->SetDefaultConnectionMethodL(connectionMethod);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1018
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1019
        IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::SetDefaultConnectionMethodL() end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1020
        }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1021
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1022
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1023
// ---------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1024
// IAUpdateEngine::GetBestIAPInAllSNAPsL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1025
// Sets the best IAP from all snaps
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1026
// ---------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1027
//
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1028
uint IAUpdateEngine::GetBestIAPInAllSNAPsL(RCmManager& aCmManager)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1029
    {
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1030
    //go with internet SNAP first.
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1031
    uint IAPID = 0;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1032
    IAPID = GetBestIAPInInternetSNAPL(aCmManager);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1033
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1034
    if (IAPID)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1035
        {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1036
        return IAPID;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1037
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1038
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1039
    //select IAP from rest of the SNAPs
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1040
    iDestIdArray.Reset();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1041
    aCmManager.AllDestinationsL(iDestIdArray);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1042
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1043
    for (int i = 0; i < iDestIdArray.Count(); i++)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1044
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1045
        uint SNAPID = iDestIdArray[i];
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1046
        IAPID = GetBestIAPInThisSNAPL(aCmManager, SNAPID);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1047
        if (IAPID)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1048
            {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1049
            break;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1050
            }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1051
        }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1052
    iDestIdArray.Reset();
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1053
    return IAPID;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1054
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1055
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1056
// ---------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1057
// IAUpdateEngine::GetBestIAPInInternetSNAPL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1058
// Sets the best IAP from internet snap
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1059
// ---------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1060
//
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1061
uint IAUpdateEngine::GetBestIAPInInternetSNAPL(RCmManager& aCmManager)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1062
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1063
    //select IAP from Internet SNAP
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1064
    iDestIdArray.Reset();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1065
    aCmManager.AllDestinationsL(iDestIdArray);
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1066
    uint InternetSNAPID = 0;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1067
    for (int i = 0; i < iDestIdArray.Count(); i++)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1068
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1069
        RCmDestination dest = aCmManager.DestinationL(iDestIdArray[i]);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1070
        CleanupClosePushL(dest);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1071
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1072
        if (dest.MetadataL(CMManager::ESnapMetadataInternet))
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1073
            {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1074
            InternetSNAPID = iDestIdArray[i];
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1075
            CleanupStack::PopAndDestroy(&dest);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1076
            break;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1077
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1078
        CleanupStack::PopAndDestroy(&dest);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1079
        }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1080
    iDestIdArray.Reset();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1081
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1082
    return GetBestIAPInThisSNAPL(aCmManager, InternetSNAPID);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1083
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1084
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1085
// ---------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1086
// IAUpdateEngine::GetBestIAPInThisSNAPL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1087
// Sets the best IAP from the given snap
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1088
// ---------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1089
//
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1090
uint IAUpdateEngine::GetBestIAPInThisSNAPL(RCmManager& aCmManager,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1091
        uint aSNAPID)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1092
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1093
    //get all usable IAPs
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1094
    TConnMonIapInfoBuf iapInfo;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1095
    TRequestStatus status;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1096
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1097
    RConnectionMonitor connMon;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1098
    connMon.ConnectL();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1099
    CleanupClosePushL(connMon);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1100
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1101
    connMon.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iapInfo,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1102
            status);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1103
    User::WaitForRequest(status);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1104
    User::LeaveIfError(status.Int());
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1105
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1106
    CleanupStack::PopAndDestroy(&connMon);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1107
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1108
    RCmDestination dest = aCmManager.DestinationL(aSNAPID);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1109
    CleanupClosePushL(dest);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1110
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1111
    // Check whether the SNAP contains any IAP.
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1112
    for (int i = 0; i < dest.ConnectionMethodCount(); i++)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1113
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1114
        RCmConnectionMethod cm = dest.ConnectionMethodL(i);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1115
        CleanupClosePushL(cm);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1116
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1117
        uint iapid = cm.GetIntAttributeL(CMManager::ECmIapId);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1118
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1119
        for (int i = 0; i < iapInfo().iCount; i++)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1120
            {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1121
            if (iapInfo().iIap[i].iIapId == iapid)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1122
                {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1123
                CleanupStack::PopAndDestroy(2); //cm & dest;
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1124
                return iapid;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1125
                }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1126
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1127
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1128
        CleanupStack::PopAndDestroy(&cm);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1129
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1130
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1131
    CleanupStack::PopAndDestroy(&dest);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1132
    return 0;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1133
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1134
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1135
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1136
// IAUpdateEngine::ShowUpdateQueryL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1137
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1138
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1139
//    
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1140
void IAUpdateEngine::ShowUpdateQueryL()
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1141
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1142
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdateQueryL() begin");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1143
    CIAUpdateQueryHistory* updateQueryHistory = CIAUpdateQueryHistory::NewL();
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1144
    // Get the delay information from the controller that has read it from
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1145
    // the config file.
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1146
    updateQueryHistory->SetDelay(
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1147
            iController->ConfigData().QueryHistoryDelayHours());
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1148
    CleanupStack::PushL(updateQueryHistory);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1149
    bool isDelayed(updateQueryHistory->IsDelayedL(mUpdatequeryUid));
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1150
    CleanupStack::PopAndDestroy(updateQueryHistory);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1151
    if (!isDelayed)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1152
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1153
        if (ClientInBackgroundL())
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1154
            {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1155
            iEikEnv->RootWin().SetOrdinalPosition(-1, ECoeWinPriorityNormal);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1156
            }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1157
        else
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1158
            {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1159
            iEikEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityNormal);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1160
            }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1161
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1162
        HbMessageBox *messageBox = new HbMessageBox(
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1163
                HbMessageBox::MessageTypeQuestion);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1164
        messageBox->setText(QString(
80
hgs
parents: 77
diff changeset
  1165
                hbTrId("txt_software_info_application_update_is_available")));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1166
        int actionCount = messageBox->actions().count();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1167
        for (int i = actionCount - 1; i >= 0; i--)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1168
            {
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1169
            messageBox->removeAction(messageBox->actions().at(i));
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1170
            }
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1171
        mPrimaryAction = NULL;
80
hgs
parents: 77
diff changeset
  1172
        mPrimaryAction = new HbAction(hbTrId("txt_software_button_now"));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1173
        mSecondaryAction = NULL;
80
hgs
parents: 77
diff changeset
  1174
        mSecondaryAction = new HbAction(hbTrId("txt_software_button_later"));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1175
        messageBox->addAction(mPrimaryAction);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1176
        messageBox->addAction(mSecondaryAction);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1177
        messageBox->setTimeout(HbPopup::NoTimeout);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1178
        messageBox->setAttribute(Qt::WA_DeleteOnClose);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1179
        messageBox->open(this, SLOT(dialogFinished(HbAction*)));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1180
        mDialogState = ShowUpdateQuery;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1181
        }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1182
    else
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1183
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1184
        InformRequestObserver(KErrNone);
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1185
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1186
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1187
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowUpdateQueryL() end");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1188
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1189
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1190
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1191
// IAUpdateEngine::HideApplicationInFSWL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1192
// 
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1193
// -----------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1194
//  
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1195
void IAUpdateEngine::HideApplicationInFSWL(bool aHide) const
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1196
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1197
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HideApplicationInFSW() begin");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1198
    IAUPDATE_TRACE_1("[IAUPDATE] hide: %d", aHide );
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1199
    int id = iEikEnv->RootWin().Identifier();
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1200
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1201
    CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1202
            iEikEnv->WsSession(), id);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1203
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1204
    wgName->SetHidden(aHide);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1205
    wgName->SetWindowGroupName(iEikEnv->RootWin());
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1206
    CleanupStack::PopAndDestroy(wgName);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1207
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::HideApplicationInFSW() end");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1208
    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1209
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1210
// ---------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1211
// IAUpdateEngine::UpdateQueryCallbackL
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1212
// ---------------------------------------------------------------------------
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1213
//
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1214
TInt IAUpdateEngine::UpdateQueryCallbackL(TAny* aPtr)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1215
    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1216
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::UpdateQueryCallbackL() begin");
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1217
    IAUpdateEngine* engine = static_cast<IAUpdateEngine*> (aPtr);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1218
    //TRAPD( err, engine->ShowUpdateQueryL() );
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1219
    TRAP_IGNORE( engine->ShowUpdateQueryL() );
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1220
    //if ( err != KErrNone )
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1221
    //    {
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1222
    //    appUI->HandleLeaveErrorL( err );
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1223
    //    }
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1224
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::UpdateQueryCallbackL() end");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1225
    return KErrNone;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1226
    }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1227
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1228
// ---------------------------------------------------------------------------
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1229
// IAUpdateEngine::AutomaticCheckCallbackL
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1230
// ---------------------------------------------------------------------------
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1231
//    
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1232
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1233
TInt IAUpdateEngine::AutomaticCheckCallbackL(TAny* aPtr)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1234
    {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1235
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::AutomaticCheckCallbackL() begin");
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1236
    IAUpdateEngine* engine = static_cast<IAUpdateEngine*> (aPtr);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1237
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1238
    int err = KErrNone;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1239
    if (!engine->iAutomaticCheck)
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1240
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1241
        TRAP( err, engine->iAutomaticCheck = CIAUpdateAutomaticCheck::NewL() );
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1242
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1243
    if (err != KErrNone)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1244
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1245
        engine->HandleLeaveErrorL(err);
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1246
        }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1247
    else
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1248
        {
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1249
        TRAP( err, engine->iAutomaticCheck->AcceptAutomaticCheckL() );
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1250
        if (err != KErrNone)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1251
            {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1252
            engine->HandleLeaveErrorL(err);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1253
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1254
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1255
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1256
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::AutomaticCheckCallbackL() end");
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1257
    return KErrNone;
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
  1258
    }
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1259
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1260
// ---------------------------------------------------------------------------
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1261
// IAUpdateEngine::DoPossibleApplicationClose()
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1262
// ---------------------------------------------------------------------------
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1263
//  
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1264
bool IAUpdateEngine::DoPossibleApplicationClose()
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1265
    {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1266
    //exit from result view if there are no update left
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1267
    bool toBeClosed = false;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1268
    if (iController->Nodes().Count() == 0 && iController->FwNodes().Count()
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1269
            == 0)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1270
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1271
        toBeClosed = true;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1272
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1273
    else if (mStartedFromApplication
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1274
            && iController->ResultsInfo().iCountCancelled == 0
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1275
            && iController->ResultsInfo().iCountFailed == 0)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1276
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1277
        toBeClosed = true;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1278
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1279
    if (toBeClosed)
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1280
        {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1281
        qApp->quit();
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1282
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1283
    return toBeClosed;
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
  1284
    }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1285