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