iaupdate/IAD/ui/src/iaupdatemainview.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:
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
     2
* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    14
* Description:   This module contains the implementation of IAUpdateMainView
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    15
*                class member functions.
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
*/
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    19
#include <hbaction.h>
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    20
#include <QGraphicsWidget>
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    21
#include <QGraphicsLayout>
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    22
#include <QGraphicsLayoutItem>
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    23
#include <QGraphicsLinearLayout>
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    24
#include <QSizeF>
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    25
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    26
#include <hbdockwidget.h>
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    27
#include <HbListView>
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    28
#include <hblistviewitem.h>
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    29
#include <hblistwidgetitem.h>
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    30
#include <hbtoolbar.h>
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    31
#include <hbmenu.h>
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    32
#include <hbdocumentloader.h>
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    33
#include <xqconversions.h>
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    34
#include <hbmessagebox.h>
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    35
#include <hblabel.h>
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    36
#include <hbgroupbox.h>
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    37
#include <HbDataForm>
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    38
#include <HbLabel>
64
48c14c385b0e 201033_01
hgs
parents: 44
diff changeset
    39
#include <hbtranslator.h>
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    40
#include <HbStyleLoader>
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    41
#include <HbIconItem>
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    42
#include <HbIconAnimationManager>
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    43
#include <HbIconAnimator>
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    44
#include <hbparameterlengthlimiter.h>
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
#include "iaupdatemainview.h"
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    47
#include "iaupdateengine.h"
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    48
#include "iaupdateagreement.h"
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    49
#include "iaupdatedeputils.h"
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    50
#include "iaupdatedialogutil.h"
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    51
#include "iaupdateversion.h"
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    52
#include "iaupdateapplistmodel.h"
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    53
#include "iaupdateapplistitem.h"
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    54
#include "iaupdateuicontroller.h"
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    55
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
#include "iaupdatedebug.h"
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    58
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    59
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    60
const int KKiloByte = 1024;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    61
const int KMegaByte = 1024 * 1024;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    62
const int KMaxShownInKiloBytes = 10 * KMegaByte;
64
48c14c385b0e 201033_01
hgs
parents: 44
diff changeset
    63
const QString KTranslationsPath = "/resource/qt/translations/";
48c14c385b0e 201033_01
hgs
parents: 44
diff changeset
    64
const QString KTranslationsFile = "swupdate";
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    66
const QString ANIMATION_ICON("qtg_anim_loading");
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    67
const QString ANIMATION_FILE("qtg_anim_loading.axml");
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    68
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
    70
IAUpdateMainView::IAUpdateMainView(IAUpdateEngine *engine):
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    71
mEngine(engine)        
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    72
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    73
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::IAUpdateMainView() begin");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    74
    mFwListView = NULL;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    75
    mApplicationUpdatesGroupBox = NULL;;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    76
    mFwNSUGroupBox = NULL;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    77
    mContentDataForm = NULL;
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    78
    mDialogUtil = NULL;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    79
    mDialogState = NoDialog;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    80
    mPrimaryAction = NULL;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    81
    mNode = NULL;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
    82
    mSelectionUpdate = false;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
    83
    mSelectionConnect = false;
64
48c14c385b0e 201033_01
hgs
parents: 44
diff changeset
    84
    mTranslator = NULL;
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    85
    mAnimationIconItem = NULL;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    86
    mLabel = NULL;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    87
    mMark = false;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    88
    mUpdating = false;
64
48c14c385b0e 201033_01
hgs
parents: 44
diff changeset
    89
        
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    90
    mTranslator = new HbTranslator(KTranslationsPath, KTranslationsFile);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
    91
        
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    92
    HbDocumentLoader loader;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    93
    bool ok = false;
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    94
    loader.load(":/xml/iaupdate_mainview.docml", &ok);
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    95
        
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    96
    // Exit if the file format is invalid
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    97
    Q_ASSERT_X(ok, "Software update", "Invalid docml file");
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    98
    // Create the view from DocML
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    99
    
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   100
    HbView* loadedWidget = qobject_cast<HbView*>(loader.findWidget("view"));
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   101
    Q_ASSERT_X(loadedWidget != 0, "Software update", "View not found");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   102
    QString viewTitle(loadedWidget->title());
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   103
    // Set the IAUpdateMainView view to be the widget that was loaded from the xml
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   104
    setWidget(loadedWidget);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   105
    setTitle(viewTitle);
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   106
      
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   107
    HbToolBar *toolBar = qobject_cast< HbToolBar*>( loader.findWidget("viewToolbar") );
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   108
    //setToolBar(toolBar);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   109
    
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   110
    HbMenu *menu = qobject_cast< HbMenu*>( loader.findWidget("viewMenu") );
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   111
    setMenu(menu);
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   112
    
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   113
    //Get the Action objects from the docml file
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   114
    mActionStartUpdate = qobject_cast<HbAction*>(loader.findObject("action"));
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   115
    mActionSettings = qobject_cast<HbAction*>(loader.findObject("action_1"));
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   116
    mActionDisclaimer = qobject_cast<HbAction*>(loader.findObject("action_2"));
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   117
    mActionCancelRefresh = qobject_cast<HbAction*>(loader.findObject("action_3"));
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   118
    mActionCancelUpdate = qobject_cast<HbAction*>(loader.findObject("action_4"));
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   119
    
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   120
    
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   121
    connect(mActionStartUpdate, SIGNAL(triggered()), this, SLOT(handleStartUpdate()));
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   122
    connect(mActionSettings, SIGNAL(triggered()), this, SLOT(handleSettings()));
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   123
    connect(mActionDisclaimer, SIGNAL(triggered()), this, SLOT(handleDisclaimer()));
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   124
    connect(mActionCancelRefresh, SIGNAL(triggered()), this, SLOT(handleCancelRefresh()));
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   125
    connect(mActionCancelUpdate, SIGNAL(triggered()), this, SLOT(handleCancelUpdate()));
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   126
    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   127
    mActionStartUpdate->setDisabled(true);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   128
    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   129
    mActionCancelRefresh->setVisible(false);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   130
    mActionCancelUpdate->setVisible(false);
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   131
        
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   132
    mContent = qobject_cast< HbWidget*>( loader.findWidget("content") );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   133
           
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   134
    //mListView = qobject_cast<HbListView*>( loader.findWidget("listWidget") );
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   135
    mListView = new HbListView(mContent);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   136
    mListView->setSelectionMode(HbAbstractItemView::MultiSelection);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   137
    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   138
    //mListView->setLayoutName("iaupdate_progress");
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   139
    HbStyleLoader::registerFilePath(":/layout/");
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   140
    
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   141
    connect( mListView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ),
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   142
            this, SLOT( handleDetails( HbAbstractViewItem *, const QPointF & ) ) ); 
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   143
    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   144
    IAUpdateAppListModel *model = new IAUpdateAppListModel();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   145
    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   146
    //HbListViewItem *prototype = mListView->listItemPrototype();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   147
    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   148
    HbListViewItem *prototype = new IAUpdateAppListItem(mListView);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   149
    prototype->setGraphicsSize(HbListViewItem::LargeIcon);
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   150
    prototype->setStretchingStyle(HbListViewItem::NoStretching); 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   151
            
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   152
    mListView->setModel(model, prototype);
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   153
    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   154
    HbDockWidget *dock = new HbDockWidget(this);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   155
    HbWidget *dockContainer = new HbWidget(dock);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   156
    QGraphicsLinearLayout *dockLayout = new QGraphicsLinearLayout(dockContainer);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   157
    dockLayout->setOrientation(Qt::Vertical);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   158
    dockContainer->setLayout(dockLayout);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   159
    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   160
    mSelections = new HbGroupBox(dockContainer);
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   161
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   162
    QString selectedString = 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   163
        QString(hbTrId("txt_software_subhead_selected_1l_2l_3l_kb")).arg(0).arg(0).arg(0);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   164
    mSelections->setHeading(selectedString); 
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   165
    
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   166
    dockLayout->addItem(mSelections);
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   167
    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   168
    dockLayout->addItem(toolBar);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   169
    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   170
    dock->setWidget(dockContainer);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   171
    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   172
    setDockWidget(dock);
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   173
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   174
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   175
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::IAUpdateMainView() end");
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   176
}
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   177
    
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   178
IAUpdateMainView::~IAUpdateMainView()
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   179
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   180
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::~IAUpdateMainView() begin");
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   181
    delete mTranslator;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   182
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::~IAUpdateMainView() end");
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   183
}
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
// -----------------------------------------------------------------------------
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   186
// IAUpdateMainView::refresh
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
// Refreshes update list
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
// -----------------------------------------------------------------------------
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
//    
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   190
void IAUpdateMainView::refresh(const RPointerArray<MIAUpdateNode> &nodes,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   191
                               const RPointerArray<MIAUpdateFwNode> &fwNodes,
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   192
                               int error)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   193
{   
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   194
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refresh() begin");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   195
    removeCurrentContentLayout();
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
        
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   197
    refreshFirmwareUpdates(fwNodes);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   198
    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   199
    refreshApplicationUpdates(nodes);
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
    
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   201
    if (nodes.Count() == 0 && fwNodes.Count() == 0 && 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   202
        error != KErrCancel && error != KErrAbort)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   203
    {    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   204
        if (!mContentDataForm)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   205
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   206
            mContentDataForm  = new HbDataForm(mContent); 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   207
        }
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   208
        else
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   209
        {
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   210
            mContentDataForm->setVisible(true);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   211
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   212
        QGraphicsLinearLayout *linearLayout = (QGraphicsLinearLayout*) mContent->layout();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   213
        linearLayout->addItem(mContentDataForm);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   214
        QString formText;
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   215
        
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   216
        if (error == KErrNone)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   217
        {
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   218
             formText = 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   219
                hbTrId("txt_software_formlabel_applications_are_up_to_date");
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   220
        }
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
        else
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   222
        {
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   223
            formText = 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   224
                hbTrId("txt_software_formlabel_refreshing_failed_try_agai");
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   226
        mContentDataForm->setDescription(formText);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   227
    }
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   228
    updateSelectionInfoInDock(); 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   229
    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   230
    if (!mUpdating)
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   231
    {    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   232
        mActionStartUpdate->setEnabled(countOfSelections() > 0);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   233
    } 
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   234
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refresh() end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   235
}
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   237
void IAUpdateMainView::refreshProgress()
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   238
{ 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   239
    IAUpdateAppListModel *model = NULL;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   240
    model = (IAUpdateAppListModel*)  mListView->model();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   241
    if (model)
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   242
    {
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   243
        model->refreshProgress();    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   244
    }
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   245
}
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   247
void IAUpdateMainView::startRefreshingAnimation()
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   248
{
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   249
    removeCurrentContentLayout();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   250
     
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   251
    mActionDisclaimer->setVisible(false);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   252
    mActionSettings->setVisible(false);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   253
    mActionCancelRefresh->setVisible(true);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   254
   
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   255
    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   256
    if (!mLabel)
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   257
    {    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   258
        mLabel = new HbLabel(mContent);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   259
    }
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   260
    else
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   261
    {    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   262
        mLabel->setVisible(true);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   263
    }
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   264
        
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   265
    QString formText;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   266
    formText = hbTrId("txt_software_formlabel_refreshing_updates_list");
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   267
    mLabel->setPlainText(formText);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   268
    mLabel->setAlignment(Qt::AlignHCenter);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   269
          
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   270
     
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   271
    QGraphicsLinearLayout *linearLayout = (QGraphicsLinearLayout*) mContent->layout();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   272
    linearLayout->addStretch();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   273
    linearLayout->addItem(mLabel);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   274
    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   275
    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   276
    if (!mAnimationIconItem)
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   277
    {    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   278
        mAnimationIconItem = new HbIconItem(ANIMATION_ICON,mContent);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   279
    }
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   280
    else
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   281
    {
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   282
        mAnimationIconItem->setVisible(true);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   283
    }
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   284
    mAnimationIconItem->setAlignment(Qt::AlignHCenter );
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   285
    linearLayout->addItem(mAnimationIconItem);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   286
    linearLayout->addStretch();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   287
        
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   288
    HbIconAnimationManager::global()->addDefinitionFile(ANIMATION_FILE);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   289
    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   290
    mAnimationIconItem->animator().startAnimation();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   291
}
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   292
    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   293
void IAUpdateMainView::stopRefreshingAnimation()
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   294
{
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   295
    mActionDisclaimer->setVisible(true);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   296
    mActionSettings->setVisible(true);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   297
    mActionCancelRefresh->setVisible(false);
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   298
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   299
    mAnimationIconItem->animator().stopAnimation();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   300
}    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   301
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   302
void IAUpdateMainView::updateCompleted()
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   303
{
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   304
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::updateCompleted() begin");  
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   305
    mUpdating = false;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   306
    mActionStartUpdate->setEnabled(countOfSelections() > 0);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   307
    mActionDisclaimer->setVisible(true);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   308
    mActionSettings->setVisible(true);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   309
    mActionCancelUpdate->setVisible(false);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   310
    connect( mListView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ),
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   311
            this, SLOT( handleDetails( HbAbstractViewItem *, const QPointF & ) ) ); 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   312
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::updateCompleted() end"); 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   313
}
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   314
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   315
void IAUpdateMainView::handleStartUpdate()
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   316
{
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   317
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleStartUpdate() begin");
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   318
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   319
    mActionStartUpdate->setEnabled(false);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   320
    mActionDisclaimer->setVisible(false);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   321
    mActionSettings->setVisible(false);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   322
    mActionCancelUpdate->setVisible(true);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   323
    disconnect( mListView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ),
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   324
                this, SLOT( handleDetails( HbAbstractViewItem *, const QPointF & ) ) ); 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   325
    mUpdating = true;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   326
    mEngine->StartUpdate(fotaSelected());
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   327
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleStartUpdate() end");
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   328
}
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   329
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   330
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   331
void IAUpdateMainView::handleSettings()
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   332
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   333
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleSettings() begin");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   334
    emit toSettingView();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   335
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleSettings() end");
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   336
}
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   337
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   338
void IAUpdateMainView::handleDisclaimer()
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   339
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   340
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleDisclaimer() begin");
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   341
    int counter = mListView->model()->rowCount();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   342
       
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   343
    if (!mDialogUtil)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   344
    {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   345
        mDialogUtil = new IAUpdateDialogUtil(this);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   346
    }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   347
    if (mDialogUtil)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   348
    {
64
48c14c385b0e 201033_01
hgs
parents: 44
diff changeset
   349
        HbAction *primaryAction = 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
   350
        mDialogUtil->showAgreement(primaryAction);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   351
    }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   352
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleDisclaimer() end");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   353
}
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   354
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   355
void IAUpdateMainView::handleCancelRefresh()
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   356
{
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   357
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleCancelRefresh() begin");
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   358
    mEngine->Controller()->HandleUserCancelL();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   359
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleCancelRefresh() end");
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   360
}
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   361
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   362
void IAUpdateMainView::handleCancelUpdate()
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   363
{
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   364
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleCancelUpdate() begin");
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   365
    mEngine->Controller()->HandleUserCancelL();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   366
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleCancelUpdate() end");
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   367
}
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   368
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   369
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   370
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   371
void IAUpdateMainView::handleDetails(HbAbstractViewItem * item, const QPointF &)
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   372
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   373
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleDetails() begin");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   374
    int ind = item->modelIndex().row();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   375
    if (getApplicationNode(ind) != NULL)
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   376
    {    
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   377
        showDetails(*getApplicationNode(ind));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   378
    }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   379
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleDetails() end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   380
}
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   381
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   382
void IAUpdateMainView::handleFotaDetails(HbAbstractViewItem *, const QPointF &)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   383
{
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   384
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleFotaDetails begin");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   385
    //only one FOTA item in a list, just use it
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   386
    for (int i = 0; i < mFwNodes.Count(); i++)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   387
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   388
        if (mFwNodes[i]->FwType() == MIAUpdateFwNode::EFotaDp2)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   389
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   390
            showDetails(*mFwNodes[i]);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   391
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   392
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   393
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleFotaDetails end");
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   394
}
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   395
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   396
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   397
void IAUpdateMainView::handleSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   398
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   399
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleSelectionChanged begin");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   400
    if (!mSelectionUpdate)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   401
    {
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   402
        bool changedItemFound = false; 
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   403
        QModelIndexList indexList = selected.indexes();
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   404
        for (int i = 0; !changedItemFound && i < indexList.count(); ++i)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   405
        {    
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   406
            changedItemFound = true;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   407
            markListItem(true, indexList.at(i).row());
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   408
        }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   409
        if (!changedItemFound)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   410
        {
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   411
            indexList = deselected.indexes();
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   412
            for (int i = 0; !changedItemFound && i < indexList.count(); ++i)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   413
            {    
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   414
                changedItemFound = true;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   415
                markListItem(false, indexList.at(i).row());
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   416
            }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   417
        }
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   418
    }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   419
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleSelectionChanged end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   420
}
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   421
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   422
void IAUpdateMainView::handleFwSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   423
{
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   424
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleFwSelectionChanged begin");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   425
    if (!mSelectionUpdate)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   426
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   427
        bool changedItemFound = false; 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   428
        QModelIndexList indexList = selected.indexes();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   429
        for (int i = 0; !changedItemFound && i < indexList.count(); ++i)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   430
        {    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   431
            changedItemFound = true;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   432
            markFotaItem(true);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   433
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   434
        if (!changedItemFound)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   435
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   436
            indexList = deselected.indexes();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   437
            for (int i = 0; !changedItemFound && i < indexList.count(); ++i)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   438
            {    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   439
                changedItemFound = true;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   440
                markFotaItem(false);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   441
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   442
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   443
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   444
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::handleFwSelectionChanged end");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   445
}
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   446
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   447
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   448
void IAUpdateMainView::dialogFinished(HbAction *action)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   449
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   450
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::dialogFinished begin");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   451
    DialogState dialogState = mDialogState;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   452
    mDialogState = NoDialog;
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
    switch ( dialogState )
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   455
    {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   456
        case Dependencies:
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   457
            if (action == mPrimaryAction)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   458
            {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   459
                updateSelectionsToNodeArray(*mNode,mMark);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   460
            }
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   461
            updateSelectionsToList();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   462
            updateSelectionInfoInDock();
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   463
            mActionStartUpdate->setEnabled(countOfSelections() > 0);
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   464
            break;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   465
        case CannotOmit:    
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   466
            break;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   467
        case Details:
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   468
            break; 
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   469
        default: 
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   470
            break;
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   471
    }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   472
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::dialogFinished end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   473
}
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   474
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   475
bool IAUpdateMainView::fotaSelected() const
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   476
{
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   477
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::fotaSelected() begin");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   478
    bool selected = false;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   479
    for (int i = 0; i < mFwNodes.Count() && !selected; ++i)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   480
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   481
        if ( mFwNodes[i]->FwType() == MIAUpdateFwNode::EFotaDp2 && mFwNodes[i]->Base().IsSelected() )
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   482
        {    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   483
            selected = true;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   484
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   485
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   486
    if (selected)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   487
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   488
        IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::fotaSelected() Fota item is selected");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   489
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   490
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::fotaSelected() end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   491
    return selected;
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   492
}
0
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   493
ba25891c3a9e Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   494
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   495
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   496
void IAUpdateMainView::markListItem(bool mark, int index)
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   497
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   498
    IAUPDATE_TRACE_2("[IAUPDATE] IAUpdateMainView::markListItem() begin mark: %d index %d", mark, index);
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   499
    if (mark)
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   500
    {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   501
        //It's Mark Command
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   502
        if (fotaSelected())
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   503
        {    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   504
            //FOTA item is selected, unmark FOTA item
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   505
            //FOTA item and application update items can't be selected at the same time 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   506
            markFotaItem(false);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   507
        }    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   508
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   509
       
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   510
    bool accepted = false;
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   511
        
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   512
    if(index > -1)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   513
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   514
        accepted = true;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   515
        MIAUpdateNode* node = mNodes[index];
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   516
        RPointerArray<MIAUpdateNode> mands;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   517
        RPointerArray<MIAUpdateNode> deps;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   518
           
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   519
        if (mark)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   520
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   521
            TRAPD(err,IAUpdateDepUtils::GetDependenciesL(*node, mNodes, deps));
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   522
            if (err != KErrNone)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   523
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   524
                deps.Close();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   525
                updateSelectionsToList();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   526
                IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markListItem() return end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   527
                return;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   528
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   529
            if (!getMandatoryNodes(mands))
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   530
                {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   531
                // error when creating mandatory node list
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   532
                mands.Close();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   533
                updateSelectionsToList();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   534
                IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markListItem() return end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   535
                return;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   536
                }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   537
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   538
        else
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   539
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   540
            //mandatory item is not allowed to be unmarked
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   541
            if (mNodes[index]->Base().Importance() == MIAUpdateBaseNode::EMandatory)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   542
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   543
                //show dialog  
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   544
                showUpdateCannotOmitDialog();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   545
                updateSelectionsToList();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   546
                IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markListItem() return end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   547
                return;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   548
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   549
            TRAPD(err,IAUpdateDepUtils::GetDependantsL(*node, mNodes, deps));  
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   550
            if (err != KErrNone)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   551
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   552
                deps.Close();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   553
                updateSelectionsToList();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   554
                IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markListItem() return end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   555
                return;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   556
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   557
            // item is not allowed to be unmarked if its dependant is mandatory
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   558
            bool mandatoryDependantFound = false;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   559
            for(int i = 0; i < deps.Count() && !mandatoryDependantFound; i++)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   560
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   561
                if (deps[i]->Base().Importance() == MIAUpdateBaseNode::EMandatory)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   562
                {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   563
                    mandatoryDependantFound = true;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   564
                }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   565
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   566
            if (mandatoryDependantFound)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   567
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   568
                showUpdateCannotOmitDialog();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   569
                deps.Close();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   570
                updateSelectionsToList();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   571
                IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markListItem() return end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   572
                return;
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   573
            }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   574
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   575
             
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   576
        int depCount = deps.Count();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   577
           
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   578
        if (depCount > 0)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   579
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   580
            QString text;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   581
            QString names;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   582
            MIAUpdateNode* depNode = NULL;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   583
            QString separator(",");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   584
                       
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   585
            for(int i = 0; i < depCount; i++)  
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   586
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   587
                depNode = deps[i];
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   588
                if (i > 0)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   589
                {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   590
                    names.append(separator);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   591
                    names.append(QString(" "));
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   592
                }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   593
                names.append(XQConversions::s60DescToQString(depNode->Base().Name()));
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   594
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   595
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   596
            if (mark)
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   597
            {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   598
                if (depCount > 1) 
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   599
                {
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   600
                    text.append(hbTrId("txt_software_info_selected_update_also_needs_updat").arg(names));
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   601
                } 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   602
                else
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   603
                {
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   604
                    text.append(hbTrId("txt_software_info_selected_update_also_needs_1").arg(names));
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   605
                    
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   606
                }
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   607
            }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   608
            else
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   609
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   610
                if (depCount > 1) 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   611
                {
80
hgs
parents: 77
diff changeset
   612
                    HbParameterLengthLimiter limiter(hbTrId("txt_software_info_updates_1_need_deselected_upd"));  
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   613
                    text.append(limiter.arg("names")); 
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   614
                } 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   615
                else
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   616
                {
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   617
                    HbParameterLengthLimiter limiter(hbTrId("txt_software_info_update_1_needs_deselected_upd"));  
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   618
                    text.append(limiter.arg("names")); 
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   619
                }   
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   620
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   621
                
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   622
            if (mark && mNodes[index]->Base().Importance() == MIAUpdateBaseNode::EMandatory)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   623
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   624
                // depencencies of mandatory update are also selected without showing dialog
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   625
                accepted = true;
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   626
            }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   627
            else
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   628
            {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   629
                mNode = node;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   630
                mMark = mark;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   631
                accepted = false;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   632
                showDependenciesFoundDialog(text);
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   633
            }
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   634
        }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   635
        if (accepted)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   636
        {    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   637
            updateSelectionsToNodeArray(*node, mark);   
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   638
        }
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   639
    }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   640
    if (accepted)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   641
    {    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   642
        updateSelectionsToList();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   643
        updateSelectionInfoInDock();
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   644
        if (!mUpdating)
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   645
        {    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   646
            mActionStartUpdate->setEnabled(countOfSelections() > 0);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   647
        }    
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   648
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   649
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markListItem() end");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   650
}       
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   651
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   652
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   653
void IAUpdateMainView::markFotaItem(bool mark)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   654
{
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   655
    IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateMainView::markFotaItem() begin mark: %d", mark);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   656
    if (mark)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   657
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   658
        //It's Mark Command
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   659
                
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   660
        //if some of application update item(s) are selected, unmark them
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   661
        //FOTA item and application update items can't be selected at the same time 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   662
        bool deselected = false;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   663
        for (int i = 0; i < mNodes.Count(); ++i)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   664
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   665
            if (mNodes[i]->Base().IsSelected())
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   666
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   667
                mNodes[i]->Base().SetSelected(false);
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   668
                deselected = true;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   669
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   670
        } 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   671
        if (deselected)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   672
        {    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   673
            // umnmarked items to be updated also to UI
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   674
            updateSelectionsToList();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   675
        }    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   676
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   677
    for (int j = 0; j < mFwNodes.Count(); ++j)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   678
    {    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   679
        if (mFwNodes[j]->FwType() == MIAUpdateFwNode::EFotaDp2)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   680
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   681
            mFwNodes[j]->Base().SetSelected(mark);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   682
            if (mark)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   683
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   684
                mFwListView->selectionModel()->select(mFwListView->model()->index(0,0),QItemSelectionModel::Select);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   685
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   686
            else
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   687
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   688
                mFwListView->selectionModel()->select(mFwListView->model()->index(0,0),QItemSelectionModel::Deselect);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   689
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   690
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   691
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   692
    updateSelectionInfoInDock();
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   693
    mActionStartUpdate->setEnabled(countOfSelections() > 0);
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   694
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::markFotaItem() end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   695
}
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   696
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   697
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   698
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   699
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   700
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   701
void IAUpdateMainView::updateSelectionsToNodeArray(MIAUpdateNode &node, bool mark)   
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   702
{
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   703
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::updateSelectionsToNodeArray() begin");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   704
    RPointerArray<MIAUpdateNode> deps;  
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   705
    TInt err = KErrNone;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   706
    if (mark)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   707
    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   708
        TRAP(err,IAUpdateDepUtils::GetDependenciesL(node, mNodes, deps));
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
    else
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   711
    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   712
        TRAP(err,IAUpdateDepUtils::GetDependantsL(node, mNodes, deps)); 
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   713
    }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   714
    if (err  == KErrNone )
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   715
    {    
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   716
        int depCount = deps.Count(); 
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   717
        for(int i = 0; i < depCount; i++)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   718
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   719
            int depNodeInd = mNodes.Find(deps[i]);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   720
            mNodes[depNodeInd]->Base().SetSelected(mark);
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   721
        }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   722
        deps.Close();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   723
        int nodeInd = mNodes.Find(&node);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   724
        mNodes[nodeInd]->Base().SetSelected(mark);
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   725
    }                
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   726
    
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   727
    //mark all of the mandatory items
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   728
    if ( mark )
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   729
    {    
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   730
        RPointerArray<MIAUpdateNode> mands;    
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   731
        if (getMandatoryNodes(mands))
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   732
        {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   733
            int mandCount = mands.Count();
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   734
            if (mandCount > 0)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   735
            {
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   736
                for(int i = 0; i < mandCount; i++)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   737
                {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   738
                    int mandNodeInd = mNodes.Find(mands[i]);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   739
                    mNodes[mandNodeInd]->Base().SetSelected(mark);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   740
                    if (mNodes[mandNodeInd]->NodeType() == MIAUpdateAnyNode::ENodeTypeNormal)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   741
                    {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   742
                        // mark also all dependencies of a mandatory item
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   743
                        MIAUpdateNode* dependencyNode = mNodes[mandNodeInd];
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   744
                        RPointerArray<MIAUpdateNode> dependencies;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   745
                        TRAPD(err,IAUpdateDepUtils::GetDependenciesL(*dependencyNode, mNodes, dependencies));
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   746
                        if (err)
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   747
                        {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   748
                            dependencies.Close(); 
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   749
                            mands.Close();
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   750
                            return;
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   751
                        }
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   752
                        for(int j = 0; j < dependencies.Count(); j++)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   753
                        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   754
                            int depNodeInd = mNodes.Find(dependencies[j]);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   755
                            mNodes[depNodeInd]->Base().SetSelected(true);
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   756
                        }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   757
                        dependencies.Close();
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   758
                    }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   759
                }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   760
            }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   761
        }
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   762
        mands.Close();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   763
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   764
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::updateSelectionsToNodeArray() end");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   765
}
29
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   766
26b6f0522fd8 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   767
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   768
bool IAUpdateMainView::getMandatoryNodes(RPointerArray<MIAUpdateNode> &mandNodes) const
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   769
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   770
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::getMandatoryNodes() begin");
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   771
    bool ret = true;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   772
    for(int i = 0; i < mNodes.Count(); ++i)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   773
    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   774
        if (mNodes[i]->Base().Importance() == MIAUpdateBaseNode::EMandatory)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   775
        {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   776
            if (mandNodes.Append(mNodes[i]) != KErrNone)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   777
            {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   778
                ret = false; 
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   779
            }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   780
        }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   781
    }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   782
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::getMandatoryNodes() end");
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   783
    return ret;
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   784
}
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   785
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   786
void IAUpdateMainView::showUpdateCannotOmitDialog()
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   787
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   788
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::showUpdateCannotOmitDialog() begin");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   789
    HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   790
    messageBox->setText(hbTrId("txt_software_info_this_required_update_cannot_be_o"));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   791
    int actionCount = messageBox->actions().count();
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   792
    for (int i=actionCount-1; i >= 0; i--)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   793
    { 
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   794
        messageBox->removeAction(messageBox->actions().at(i));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   795
    }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   796
    HbAction *okAction = NULL;
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   797
    okAction = 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
   798
    messageBox->addAction(okAction);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   799
    messageBox->setTimeout(HbPopup::StandardTimeout);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   800
    messageBox->setAttribute(Qt::WA_DeleteOnClose);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   801
    mDialogState = CannotOmit;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   802
    messageBox->open(this, SLOT(dialogFinished(HbAction*)));
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   803
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::showUpdateCannotOmitDialog() end");
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   804
}
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   805
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   806
void IAUpdateMainView::showDependenciesFoundDialog(QString &text)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   807
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   808
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::showDependenciesFoundDialog() begin");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   809
    HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   810
    HbLabel *label = new HbLabel(messageBox);
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   811
    label->setHtml(hbTrId("txt_software_title_dependencies"));
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   812
    messageBox->setHeadingWidget(label);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   813
    //messageBox->setIconVisible(false);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   814
        
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   815
    messageBox->setText(text);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   816
    int actionCount = messageBox->actions().count();
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   817
    for (int i=actionCount-1; i >= 0; i--)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   818
    { 
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   819
        messageBox->removeAction(messageBox->actions().at(i));
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   820
    }
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   821
    mPrimaryAction = NULL;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   822
    mPrimaryAction = new HbAction("Continue");
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   823
    HbAction *secondaryAction = NULL;
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   824
    secondaryAction = new HbAction(hbTrId("txt_common_button_cancel"));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   825
    messageBox->addAction(mPrimaryAction);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   826
    messageBox->addAction(secondaryAction);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   827
    messageBox->setTimeout(HbPopup::NoTimeout);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   828
    messageBox->setAttribute(Qt::WA_DeleteOnClose);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   829
    mDialogState = Dependencies;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   830
    messageBox->open(this, SLOT(dialogFinished(HbAction*)));
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   831
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::showDependenciesFoundDialog() end");
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   832
}
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   833
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   834
void IAUpdateMainView::updateSelectionsToList()
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   835
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   836
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::updateSelectionsToList() begin");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   837
    mSelectionUpdate = true;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   838
    for(int i = 0; i < mNodes.Count(); ++i)
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   839
    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   840
        if ( mNodes[i]->Base().IsSelected() != mListView->selectionModel()->isSelected(mListView->model()->index(i,0)))
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   841
        {    
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   842
            QItemSelectionModel::SelectionFlag selectionFlag;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   843
            if ( mNodes[i]->Base().IsSelected())
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   844
            {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   845
                selectionFlag = QItemSelectionModel::Select;
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   846
            }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   847
            else
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   848
            {
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   849
                selectionFlag = QItemSelectionModel::Deselect;
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   850
            }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   851
            mListView->selectionModel()->select(mListView->model()->index(i,0),selectionFlag);   
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   852
        }
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   853
    }
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   854
    mSelectionUpdate = false;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   855
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::updateSelectionsToList() end");
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   856
}
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   857
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   858
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   859
MIAUpdateNode* IAUpdateMainView::getApplicationNode(int index) const
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   860
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   861
    IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateMainView::getApplicationNode() begin index: %d", index);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   862
    MIAUpdateNode *currentNode = NULL;
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   863
     
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   864
    if (index >= 0 && index < mNodes.Count())
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   865
    {
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   866
        currentNode = mNodes[index];
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   867
    }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   868
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::getApplicationNode() end");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   869
    return currentNode;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   870
}
33
8110bf1194d1 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 29
diff changeset
   871
                
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   872
void IAUpdateMainView::showDetails(MIAUpdateAnyNode& node)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   873
{  
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   874
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::showDetails() begin");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   875
    HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   876
    HbLabel *label = new HbLabel(messageBox);
80
hgs
parents: 77
diff changeset
   877
    label->setHtml(hbTrId("txt_software_title_details"));
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   878
    messageBox->setHeadingWidget(label);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   879
       
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   880
    messageBox->setIconVisible(false);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   881
            
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   882
    QString text;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   883
    constructDetailsText(node,text); 
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   884
    messageBox->setText(text);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   885
    messageBox->setTimeout(HbPopup::NoTimeout);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   886
    messageBox->setAttribute(Qt::WA_DeleteOnClose);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   887
    mDialogState = Details;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   888
    messageBox->open(this, SLOT(dialogFinished(HbAction*)));    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   889
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::showDetails() end");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   890
}                
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   891
        
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   892
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   893
void IAUpdateMainView::constructDetailsText(MIAUpdateAnyNode &node, QString &text)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   894
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   895
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::constructDetailsText() begin");
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   896
    text.append(hbTrId("txt_software_dialog_name"));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   897
    text.append(QString("<br />"));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   898
    if (node.NodeType() == MIAUpdateAnyNode::ENodeTypeFw)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   899
    {    
80
hgs
parents: 77
diff changeset
   900
        text.append(hbTrId("txt_swupdate_dialog_device_software")); 
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   901
    }
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   902
    else
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   903
    {
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   904
        QString name = XQConversions::s60DescToQString(node.Base().Name());
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   905
        text.append(name);
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   906
    }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   907
        
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   908
    text.append(QString("<br />"));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   909
    text.append(QString("<br />"));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   910
    
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   911
    text.append(hbTrId("txt_software_dialog_description"));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   912
    text.append(QString("<br />"));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   913
    QString description;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   914
    if (node.NodeType() == MIAUpdateAnyNode::ENodeTypeFw)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   915
    {
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   916
        description = 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   917
            hbTrId("txt_software_info_this_update_improves_your_device");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   918
    }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   919
    else
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   920
    {    
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   921
        description = XQConversions::s60DescToQString(node.Base().Description());
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   922
    }    
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   923
    text.append(description);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   924
    text.append(QString("<br />"));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   925
    text.append(QString("<br />"));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   926
    
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   927
    
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   928
    if (node.NodeType() == MIAUpdateAnyNode::ENodeTypeNormal)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   929
    {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   930
        MIAUpdateNode *iaupdateNode = static_cast<MIAUpdateNode*> (&node);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   931
        if (iaupdateNode->Type()!= MIAUpdateNode::EPackageTypeServicePack)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   932
        {
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   933
            text.append(hbTrId("txt_software_dialog_version"));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   934
            text.append(QString("<br />"));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   935
            QString textVersion;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   936
            versionText(node.Base().Version(), textVersion);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   937
            text.append(textVersion);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   938
            text.append(QString("<br />"));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   939
            text.append(QString("<br />"));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   940
        }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   941
    }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   942
    if (node.NodeType() == MIAUpdateAnyNode::ENodeTypeFw)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   943
    {    
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   944
        MIAUpdateFwNode *fwNode = static_cast<MIAUpdateFwNode*> (&node);
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   945
        text.append(hbTrId("txt_software_dialog_version"));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   946
        text.append(QString("<br />"));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   947
        QString textVersion = XQConversions::s60DescToQString(fwNode->FwVersion1());
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   948
        text.append(textVersion);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   949
        text.append(QString("<br />"));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   950
        text.append(QString("<br />"));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   951
    }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   952
    
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   953
    int contentSize = node.Base().ContentSizeL();
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   954
    if (contentSize > 0)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   955
    {
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   956
        text.append(hbTrId("txt_software_dialog_size"));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   957
        text.append(QString("<br />"));
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   958
        QString textFileSize;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   959
        fileSizeText(contentSize, textFileSize);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   960
        text.append(textFileSize);
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   961
    }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   962
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::constructDetailsText() end");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   963
}
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   964
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   965
void IAUpdateMainView::versionText(const TIAUpdateVersion &version, QString &versionText)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   966
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   967
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::versionText() begin");
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   968
    versionText.append
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   969
        (hbTrId("txt_software_info_version_1l_2l_3l").arg(version.iMajor).arg(version.iMinor).arg(version.iBuild));
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   970
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::versionText() end");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   971
}
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   972
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   973
void IAUpdateMainView::fileSizeText(int fileSize, QString &text)
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   974
{
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   975
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::fileSizeText() begin");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   976
    int size = 0;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   977
    
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   978
    if (fileSize >= KMaxShownInKiloBytes )
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   979
        {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   980
        size = fileSize / KMegaByte;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   981
        if ( fileSize % KMegaByte != 0 )
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   982
            {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   983
            size++;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   984
            }
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   985
        text.append(hbTrId("txt_software_dialog_l_kb").arg(size));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   986
        }
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   987
    else
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   988
        {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   989
        size = fileSize / KKiloByte;
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   990
        if ( fileSize % KKiloByte != 0 )
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   991
            {
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   992
            size++;
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   993
            } 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   994
        text.append(hbTrId("txt_software_dialog_l_mb").arg(size));
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   995
        }
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
   996
    
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   997
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::fileSizeText() end");
42
d17dc5398051 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 33
diff changeset
   998
}
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
   999
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1000
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1001
void IAUpdateMainView::removeCurrentContentLayout()
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1002
{
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1003
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::removeCurrentContentLayout() begin");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1004
    int itemCount = mContent->layout()->count();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1005
    for (int i = 0; i < itemCount; i++)    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1006
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1007
        mContent->layout()->removeAt(i);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1008
    }
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1009
    if (mContentDataForm)
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1010
    {
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1011
        mContentDataForm->setVisible(false);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1012
    }
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1013
    if (mLabel)
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1014
    {
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1015
        mLabel->setVisible(false);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1016
    }
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1017
    if (mAnimationIconItem)
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1018
    {   
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1019
        delete mAnimationIconItem;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1020
        mAnimationIconItem = NULL;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1021
    }
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1022
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::removeCurrentContentLayout() end");    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1023
}
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1024
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1025
void IAUpdateMainView::refreshFirmwareUpdates(const RPointerArray<MIAUpdateFwNode> &fwNodes)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1026
{
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1027
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshFirmwareUpdates() begin");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1028
    mFwNodes.Reset();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1029
            
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1030
    for (int i = 0; i < fwNodes.Count(); i++)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1031
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1032
        MIAUpdateFwNode *fwnode = (fwNodes[i]);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1033
        mFwNodes.Append(fwnode);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1034
        fwnode->Base().SetImportance(MIAUpdateBaseNode::ECritical);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1035
        if (fwnode->FwType() == MIAUpdateFwNode::EFotaDp2)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1036
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1037
            refreshFotaUpdate(*fwnode );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1038
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1039
        else if (fwNodes.Count() == 1 && fwnode->FwType() == MIAUpdateFwNode::EFotiNsu)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1040
        {
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1041
        refreshNsuUpdate(*fwnode);
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1042
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1043
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshFirmwareUpdates() end");    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1044
    }    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1045
}
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1046
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1047
void IAUpdateMainView::refreshFotaUpdate(MIAUpdateFwNode& fwNode)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1048
{
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1049
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshFotaUpdate() begin");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1050
    if (!mFwListView)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1051
    {
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1052
        mFwListView  = new HbListView(mContent);
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1053
        mFwListView->setSelectionMode( HbAbstractItemView::MultiSelection );
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1054
        connect( mFwListView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ),
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1055
        this, SLOT( handleFotaDetails( HbAbstractViewItem *, const QPointF & ) ) ); 
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1056
        
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1057
        IAUpdateAppListModel *model = new IAUpdateAppListModel();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1058
        HbListViewItem *prototype = new IAUpdateAppListItem(mListView);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1059
        prototype->setGraphicsSize(HbListViewItem::LargeIcon);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1060
        prototype->setStretchingStyle(HbListViewItem::NoStretching);            
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1061
        mListView->setModel(model, prototype);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1062
         
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1063
        mFwListView->listItemPrototype()->setGraphicsSize(HbListViewItem::LargeIcon);   
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1064
        mFwListView->listItemPrototype()->setStretchingStyle(HbListViewItem::NoStretching);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1065
        connect(mFwListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1066
        this, SLOT(handleFwSelectionChanged(QItemSelection,QItemSelection)));     
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1067
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1068
    QGraphicsLinearLayout *linearLayout = (QGraphicsLinearLayout*) mContent->layout();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1069
    linearLayout->addItem(mFwListView);
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1070
    IAUpdateAppListModel *model = (IAUpdateAppListModel*)  mListView->model();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1071
    QItemSelectionModel *selectionModel = mFwListView->selectionModel();  
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1072
    mSelectionUpdate = true;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1073
    selectionModel->clear();
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1074
    mSelectionUpdate = false;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1075
    model->setFwNode(&fwNode);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1076
 
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1077
    if (fwNode.Base().IsSelected())
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1078
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1079
        QModelIndex modelIndex = mFwListView->model()->index(0,0);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1080
        selectionModel->select(modelIndex, QItemSelectionModel::Select);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1081
    }
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1082
    model->refresh();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1083
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshFotaUpdate() end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1084
}
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1085
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1086
void IAUpdateMainView::refreshNsuUpdate(MIAUpdateFwNode& fwNode)
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1087
{
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1088
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshNsuUpdate() begin");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1089
    if (!mFwNSUGroupBox)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1090
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1091
        mFwNSUGroupBox = new HbGroupBox(mContent);
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1092
        mFwNSUGroupBox->setHeading(hbTrId("txt_software_subhead_device_software_available"));
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1093
        HbDataForm *dataForm  = new HbDataForm(mFwNSUGroupBox); 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1094
        mFwNSUGroupBox->setContentWidget(dataForm);
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1095
        QString textVersion = XQConversions::s60DescToQString(fwNode.FwVersion1());
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1096
        dataForm->setDescription
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1097
            (hbTrId("txt_software_info_please_use_your_pc_to_update_the").arg(textVersion));
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1098
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1099
    QGraphicsLinearLayout *linearLayout = (QGraphicsLinearLayout*) mContent->layout();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1100
    linearLayout->addItem(mFwNSUGroupBox);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1101
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshNsuUpdate() end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1102
}
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1103
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1104
void IAUpdateMainView::refreshApplicationUpdates(const RPointerArray<MIAUpdateNode> &nodes)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1105
{
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1106
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshApplicationUpdates() begin");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1107
    if (nodes.Count() > 0)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1108
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1109
        if (!mApplicationUpdatesGroupBox)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1110
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1111
            mApplicationUpdatesGroupBox = new HbGroupBox(mContent);
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1112
            mApplicationUpdatesGroupBox->setHeading(hbTrId("txt_software_subhead_application_updates"));
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1113
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1114
        QGraphicsLinearLayout *linearLayout = (QGraphicsLinearLayout*) mContent->layout();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1115
        linearLayout->addItem(mApplicationUpdatesGroupBox);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1116
        linearLayout->addItem(mListView);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1117
    }
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1118
    IAUpdateAppListModel *model = (IAUpdateAppListModel*)  mListView->model();
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1119
    QItemSelectionModel *selectionModel = mListView->selectionModel();  
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1120
    mSelectionUpdate = true;
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1121
    selectionModel->clear();
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1122
    mSelectionUpdate = false;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1123
    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1124
    //HbIcon icon(QString(":/icons/qgn_menu_swupdate"));
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1125
    mNodes.Reset();
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1126
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1127
    for(int i = 0; i < nodes.Count(); ++i) 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1128
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1129
        MIAUpdateNode *node = nodes[i];
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1130
        mNodes.Append(node);
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1131
    }
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1132
    model->setNodeArray(mNodes);
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1133
    for(int j = 0; j < mNodes.Count(); ++j) 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1134
    {
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1135
        if (mNodes[j]->Base().IsSelected())
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1136
        {
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1137
            QModelIndex modelIndex = mListView->model()->index(j,0);
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1138
            selectionModel->select(modelIndex, QItemSelectionModel::Select);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1139
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1140
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1141
    if (!mSelectionConnect)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1142
    {    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1143
        mSelectionConnect = connect(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1144
                        this, SLOT(handleSelectionChanged(QItemSelection,QItemSelection)));     
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1145
    }
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1146
    model->refresh();
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1147
44
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1148
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::refreshApplicationUpdates() end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1149
}
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1150
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1151
void IAUpdateMainView::updateSelectionInfoInDock()
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1152
{
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1153
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::updateSelectionInfoInDock() begin");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1154
    int countOfSelectedItems = 0;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1155
    int countOfAllItems = 0;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1156
    int selectedSizeInBytes = 0;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1157
    for (int i = 0; i < mFwNodes.Count(); ++i)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1158
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1159
        if (mFwNodes[i]->FwType() == MIAUpdateFwNode::EFotaDp2)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1160
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1161
            countOfAllItems++;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1162
            if (mFwNodes[i]->Base().IsSelected())
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1163
            {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1164
                countOfSelectedItems++;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1165
                selectedSizeInBytes += mFwNodes[i]->Base().ContentSizeL();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1166
            }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1167
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1168
    } 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1169
    countOfAllItems += mNodes.Count();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1170
    for (int j = 0; j < mNodes.Count(); ++j)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1171
    {    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1172
        if (mNodes[j]->Base().IsSelected())
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1173
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1174
            countOfSelectedItems++;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1175
            selectedSizeInBytes += mNodes[j]->Base().ContentSizeL();
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1176
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1177
    }    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1178
    
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1179
    int selectedSize = 0;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1180
    QString unit;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1181
    if (selectedSizeInBytes >= KMaxShownInKiloBytes)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1182
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1183
        unit = "MB";
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1184
        selectedSize = selectedSizeInBytes / KMegaByte;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1185
        if (selectedSizeInBytes % KMegaByte != 0)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1186
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1187
            selectedSize++;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1188
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1189
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1190
    else 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1191
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1192
        unit = "kB";
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1193
        selectedSize = selectedSizeInBytes / KKiloByte;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1194
        if (selectedSizeInBytes % KKiloByte != 0)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1195
        {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1196
            selectedSize++;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1197
        }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1198
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1199
    QString selectionString; 
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1200
    selectionString.append("Selected ");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1201
    QString numText;
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1202
    numText.setNum(countOfSelectedItems);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1203
    selectionString.append(numText);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1204
    selectionString.append("/");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1205
    numText.setNum(countOfAllItems);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1206
    selectionString.append(numText);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1207
    if (selectedSize > 0)
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1208
    {
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1209
        selectionString.append(" (");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1210
        numText.setNum(selectedSize);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1211
        selectionString.append(numText);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1212
        selectionString.append(" ");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1213
        selectionString.append(unit);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1214
        selectionString.append(")");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1215
    }
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1216
    mSelections->setHeading(selectionString);
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1217
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::updateSelectionInfoInDock() end");
329d304c1aa1 201025_01
hgs
parents: 42
diff changeset
  1218
}
77
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1219
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1220
int IAUpdateMainView::countOfSelections() const
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1221
{
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1222
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::countOfSelections() begin");
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1223
    int countOfSelectedItems = 0;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1224
    for (int i = 0; i < mFwNodes.Count(); ++i)
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1225
    {
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1226
        if (mFwNodes[i]->FwType() == MIAUpdateFwNode::EFotaDp2)
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1227
        {
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1228
            if (mFwNodes[i]->Base().IsSelected())
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1229
            {
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1230
                countOfSelectedItems++;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1231
            }
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1232
        }
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1233
    } 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1234
    for (int j = 0; j < mNodes.Count(); ++j)
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1235
    {    
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1236
        if (mNodes[j]->Base().IsSelected())
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1237
        {
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1238
            countOfSelectedItems++;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1239
        }
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1240
    } 
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1241
    IAUPDATE_TRACE("[IAUPDATE] IAUpdateMainView::countOfSelections() end");
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1242
    return countOfSelectedItems;
d1838696558c 201039_02
hgs
parents: 64
diff changeset
  1243
}