cpsecplugins/cpadvancedsecplugin/src/cpcertview.cpp
author hgs
Thu, 07 Oct 2010 14:07:34 +0300
changeset 62 3255e7d5bd67
parent 59 881d92421467
permissions -rw-r--r--
201037_06
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0""
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
098e361762d2 Revision: 201017
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".
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
    14
* Description:
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
#include <QStringList>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include <QGraphicsLinearLayout>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <QModelIndex>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <hblineedit.h>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include <hbdataform.h>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <hbdataformmodel.h>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include <hbdataformmodelitem.h>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include <hblabel.h>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include <hbpushbutton.h>
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
    28
#include <hbmenu.h>
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include <hbaction.h>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
#include <HbListWidget>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
#include <HbListWidgetItem>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include <HbGroupBox>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include <hbpushbutton.h>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include <hbdataform.h>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include <hbdataformmodel.h>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
#include <hbdataformmodelitem.h>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
#include <hbabstractviewitem.h>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
#include <hbtextitem.h>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
#include <hbmainwindow.h>
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
    40
#include <hblistview.h>
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
#include <QStandardItemModel>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
#include <QModelIndexList>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
#include <hbmessagebox.h>
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
#include <memory>
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
    45
#include <../../inc/cpsecplugins.h>
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
#include "cpcertdetailview.h"
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
#include "cpcertview.h"
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
#include "cpcertdatacontainer.h"
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
#include "cpcerttrustview.h"
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
#include "cpcertmanuisyncwrapper.h"
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
CpCertView::CpCertView(const QModelIndex& modelIndex, QGraphicsItem *parent /*= 0*/)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
	: CpBaseSettingView(0,parent),
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
    55
	  mPopup(NULL), mOkAction(NULL),
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
	  mPrevView(NULL),
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
	  mCurrentView(NULL),
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
	  mRefreshedView(NULL),
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
	  mListView(NULL),
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    60
	  mSelectAllView(NULL),
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    61
	  mOriginalView(NULL),
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    62
	  mNote(NULL)
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
    64
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
	mOriginalView = mainWindow()->currentView();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
    66
881d92421467 201037_03
hgs
parents: 30
diff changeset
    67
	HbMenu* menu = this->menu();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
	std::auto_ptr<HbAction> deleteAction(new HbAction(hbTrId("txt_common_menu_delete")));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
    69
	connect(deleteAction.get(), SIGNAL(triggered()), this, SLOT(deleteList()));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
	menu->addAction(deleteAction.get());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
	deleteAction.release();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
    72
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
	std::auto_ptr<QGraphicsLinearLayout> layout(new QGraphicsLinearLayout(Qt::Vertical));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
    74
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
	HbDataForm *form = q_check_ptr(new HbDataForm(this));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
	std::auto_ptr<HbDataFormModel> formModel(q_check_ptr(new HbDataFormModel()));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
	form->setModel(formModel.get());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
	formModel.release();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
    79
881d92421467 201037_03
hgs
parents: 30
diff changeset
    80
	HbListWidget* certificateList = q_check_ptr(new HbListWidget(this));
881d92421467 201037_03
hgs
parents: 30
diff changeset
    81
881d92421467 201037_03
hgs
parents: 30
diff changeset
    82
	CpCertView::TCertificateViews currentView = (CpCertView::TCertificateViews)modelIndex.row();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
	QString title;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
	if(currentView == EPersonalView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
		title = "Move to Device";
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
	else if(currentView == EDeviceView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
		{
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
    90
		title = "Move to Personal";
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
		}
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
    92
	RDEBUG("0", 0);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
    93
	if(currentView == EPersonalView || currentView == EDeviceView)
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
    94
		{
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
    95
		std::auto_ptr<HbAction> moveToDeviceAction(q_check_ptr(new HbAction(title)));
881d92421467 201037_03
hgs
parents: 30
diff changeset
    96
		connect(moveToDeviceAction.get(), SIGNAL(triggered()), this, SLOT(moveCert()));
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
    97
		menu->addAction(moveToDeviceAction.get());
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
    98
		moveToDeviceAction.release();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
    99
		}
881d92421467 201037_03
hgs
parents: 30
diff changeset
   100
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
	setDetails(currentView);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
	TInt count = 0;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
	try
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
		QT_TRAP_THROWING(mCertDataContainer = CpCertDataContainer::NewL());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
		QT_TRAP_THROWING(count = refreshListL());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
	catch(const std::exception& exception)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
		HbMessageBox::information(exception.what());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
		throw(exception);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
		}
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   113
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
	for(int index = 0; index< count; index++)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
		QString certificateLabel = certLabel(index);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
		std::auto_ptr<HbListWidgetItem> singleCert(q_check_ptr(new HbListWidgetItem()));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
		singleCert->setText(certificateLabel);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
		certificateList->addItem(singleCert.get());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
		singleCert.release();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
		}  // End of FOR loop
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   122
881d92421467 201037_03
hgs
parents: 30
diff changeset
   123
	connect(certificateList, SIGNAL(activated(QModelIndex)), this, SLOT(openCertFromList(QModelIndex)));
881d92421467 201037_03
hgs
parents: 30
diff changeset
   124
	connect(certificateList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF)));
881d92421467 201037_03
hgs
parents: 30
diff changeset
   125
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
	layout->addItem(certificateList);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
	setLayout(layout.get());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
	layout.release();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   129
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   130
	mPopup = q_check_ptr(new HbDialog());
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   131
	mContextMenu = q_check_ptr(new HbMenu());
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   132
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   133
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
CpCertView::~CpCertView()
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
	{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
	delete mCertDataContainer;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
	mCertDataContainer = NULL;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   140
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
	if(mPrevView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
		mPrevView->deleteLater();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
		mPrevView= NULL;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
	if(mCurrentView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
		mCurrentView->deleteLater();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
		mCurrentView= NULL;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
	if(mRefreshedView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
		mRefreshedView->deleteLater();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
		mRefreshedView= NULL;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
	if(mListView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
		mListView->deleteLater();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
		mListView= NULL;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
		}
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   161
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   162
	if(mSelectAllView)
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   163
	{
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   164
	mSelectAllView->deleteLater();
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   165
	mSelectAllView = NULL;
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   166
	}
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   167
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   168
	mSelectionIndex.Close();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   169
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   170
	mIndexList.Close();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   171
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   172
	delete mPopup;
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   173
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   174
	delete mNote;
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   175
	mNote = NULL;
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   176
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   177
	delete mContextMenu;
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   178
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
	}
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   180
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
void CpCertView::setDetails(CpCertView::TCertificateViews currentView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   183
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
	switch(currentView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
		case EAuthorityView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
		setTitle(hbTrId("txt_certificate_manager_list_authority_certificate"));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
		mCertView = EAuthorityView;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
		break;
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   190
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
		case ETrustedView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
		setTitle(hbTrId("txt_certificate_manager_list_trusted_site_certific"));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
		mCertView = ETrustedView;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
		break;
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   195
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
		case EPersonalView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
		setTitle(hbTrId("txt_certificate_manager_list_personal_certificates"));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
		mCertView = EPersonalView;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
		break;
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   200
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
		case EDeviceView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   202
		setTitle(hbTrId("txt_certificate_manager_list_device_certificates"));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
		mCertView = EDeviceView;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
		break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   205
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
void CpCertView::indicateLongPress(HbAbstractViewItem *item,QPointF coords)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   210
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
	mPos = item->modelIndex().row();   // Pos will tell you what is the certificate clicked in particular view.
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   212
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   213
	mContextMenu->clearActions();
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   214
	std::auto_ptr<HbAction> open(q_check_ptr(new HbAction(hbTrId("txt_common_menu_open"))));
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   215
	connect(open.get(), SIGNAL(triggered()), this, SLOT( openCertificate()));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   216
	mContextMenu->addAction(open.get());
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
	open.release();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   218
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
	QString moveTitle;
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   220
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
	if(mCertView == EAuthorityView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
		{
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   223
		std::auto_ptr<HbAction> trustSettings(q_check_ptr(new HbAction(hbTrId("txt_certificate_manager_menu_trust_settings"))));
881d92421467 201037_03
hgs
parents: 30
diff changeset
   224
		connect(trustSettings.get(), SIGNAL(triggered()), this, SLOT(showTrustSettings()));
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   225
		mContextMenu->addAction(trustSettings.get());
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
		trustSettings.release();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
	else if(mCertView == EPersonalView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   229
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
		moveTitle = hbTrId("txt_certificate_manager_menu_move_to_device_certif");
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
	else if(mCertView == EDeviceView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   234
		moveTitle = hbTrId("txt_certificate_manager_menu_move_to_personal_cert");
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   235
		}
881d92421467 201037_03
hgs
parents: 30
diff changeset
   236
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   237
	if(mCertView == EPersonalView || mCertView == EDeviceView )
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   238
		{
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   239
		std::auto_ptr<HbAction> moveCert(q_check_ptr(new HbAction(moveTitle)));
881d92421467 201037_03
hgs
parents: 30
diff changeset
   240
		connect(moveCert.get(), SIGNAL(triggered()), this, SLOT(moveSelectedCert()));
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   241
		mContextMenu->addAction(moveCert.get());
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   242
		moveCert.release();
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   243
		}
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   244
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   245
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
	if( certAt(mPos)->IsDeletable() )
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
		{
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   248
		std::auto_ptr<HbAction> menuDelete(q_check_ptr(new HbAction(hbTrId("txt_common_menu_delete"))));
881d92421467 201037_03
hgs
parents: 30
diff changeset
   249
		connect(menuDelete.get(), SIGNAL(triggered()), this, SLOT(deleteCertificate()));
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   250
		mContextMenu->addAction(menuDelete.get());
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
		menuDelete.release();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
		}
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   253
	mContextMenu->setPreferredPos(coords);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   254
	mContextMenu->open();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
void CpCertView::openCertFromList(const QModelIndex& modelIndex)
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   258
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   259
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
	// Pos will tell you what is the certificate clicked in particular view.
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   261
	mPos = modelIndex.row();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
	openCertificate();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
void CpCertView::openCertificate()
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   266
	{
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   267
	RDEBUG("0", 0);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   268
	mCurrentView = q_check_ptr(new CpCertDetailView(mCertView,mPos,*mCertDataContainer));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
	connect(mCurrentView, SIGNAL(aboutToClose()), this, SLOT(displayPreviousView()));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   270
	mPrevView = mainWindow()->currentView();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
	mainWindow()->addView(mCurrentView);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   272
	mainWindow()->setCurrentView(mCurrentView);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
	}
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   274
881d92421467 201037_03
hgs
parents: 30
diff changeset
   275
void CpCertView::displayPreviousView()
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   277
	RDEBUG("0", 0);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   278
	mainWindow()->removeView(mCurrentView);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
	mCurrentView->deleteLater();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
	mCurrentView= NULL;
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   281
	mainWindow()->setCurrentView(mPrevView);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
	}
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   283
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
void CpCertView::deleteCertificate()
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   286
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
	RArray<TInt> pos;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
	pos.Append(mPos);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   289
	QT_TRAP_THROWING(deleteCertsL(pos));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   290
	}
881d92421467 201037_03
hgs
parents: 30
diff changeset
   291
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
void CpCertView::deleteList()
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   293
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   294
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
	mSelectAll = EFalse;
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   296
	mPopup->setDismissPolicy(HbDialog::NoDismiss);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
	// Set the label as heading widget
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   298
	mPopup->setHeadingWidget(q_check_ptr(new HbLabel(hbTrId("txt_certificate_manager_setlabel_certificates"))));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   299
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
	std::auto_ptr<QGraphicsLinearLayout> layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical)));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   301
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   302
	mSelectAllView = q_check_ptr(new HbListView(this));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   303
	QStandardItemModel* selectAllModel = q_check_ptr(new QStandardItemModel(this));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   304
	// Populate the model with content
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   305
	std::auto_ptr<QStandardItem> selectAllItem(q_check_ptr(new QStandardItem()));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   306
	selectAllItem->setData(QString("Select All"),Qt::DisplayRole);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   307
	selectAllModel->appendRow(selectAllItem.get());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   308
	selectAllItem.release();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   309
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   310
	connect(mSelectAllView, SIGNAL(activated(QModelIndex)), this, SLOT(selectAll()));
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   311
	mSelectAllView->setModel(selectAllModel);
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   312
	mSelectAllView->setSelectionMode(HbListView::MultiSelection);
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   313
	layout->addItem(mSelectAllView);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   314
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   315
	mListView = q_check_ptr(new HbListView(this));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   316
	// Connect to "activated" signal
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   317
	connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex)));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   318
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   319
	// Create a model
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   320
	QStandardItemModel* model = q_check_ptr(new QStandardItemModel(this));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   321
	TInt count=0;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   322
	QT_TRAP_THROWING( count = refreshListL());
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   323
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   324
	for(TInt index = 0; index < count ; ++index)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   325
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   326
		const CCTCertInfo* cert = certAt(index);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   327
		if( cert->IsDeletable() )
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   328
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   329
			// Populate the model with content
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   330
			std::auto_ptr<QStandardItem> certItem(q_check_ptr(new QStandardItem()));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
			QString certificateLabel = certLabel(index);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   332
			certItem->setData( certificateLabel, Qt::DisplayRole);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   333
			model->appendRow(certItem.get());
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   334
			mSelectionIndex.Append(index);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   335
			certItem.release();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   336
			}
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   337
		}
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   338
	// Set the model to the list view
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
	mListView->setModel(model);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
	mListView->setSelectionMode(HbListView::MultiSelection);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   341
	layout->addItem(mListView);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   342
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   343
	std::auto_ptr<HbWidget> widget( q_check_ptr(new HbWidget()));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   344
	widget->setLayout(layout.get());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
	layout.release();
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   346
	mPopup->setContentWidget(widget.get());
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
	widget.release();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   348
881d92421467 201037_03
hgs
parents: 30
diff changeset
   349
    mPopup->clearActions();
881d92421467 201037_03
hgs
parents: 30
diff changeset
   350
	mOkAction = q_check_ptr(new HbAction(hbTrId("txt_common_opt_delete")));
881d92421467 201037_03
hgs
parents: 30
diff changeset
   351
	mPopup->addAction(mOkAction);
881d92421467 201037_03
hgs
parents: 30
diff changeset
   352
	HbAction *cancelAction = q_check_ptr(new HbAction(hbTrId("txt_common_button_cancel")));
881d92421467 201037_03
hgs
parents: 30
diff changeset
   353
	mPopup->addAction(cancelAction);
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   354
	mPopup->setTimeout(HbPopup::NoTimeout);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   355
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   356
	// Launch popup syncronously
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   357
	mPopup->open(this, SLOT(handleMultipleDelete(HbAction*)));
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   358
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   359
}
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   360
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   361
void CpCertView::handleMultipleDelete(HbAction* action)
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   362
{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   363
	RDEBUG("0", 0);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   364
	if(action == mOkAction)
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   365
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   366
		QItemSelectionModel *selectionModel = mListView->selectionModel();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   367
		QModelIndexList mWidgetItemsToRemove = selectionModel->selectedIndexes();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   368
		TInt deleteCount = mWidgetItemsToRemove.count();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   369
		// start deleting from end of array so that the indexes do not changes of the ones
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   370
		// at the front.
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   371
		RArray<TInt> actualIndex;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   372
		QT_TRAP_THROWING
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   373
			(
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   374
			CleanupClosePushL(actualIndex);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   375
			for (TInt index = deleteCount-1; index>= 0 ; --index)
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   376
				{
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   377
				TInt selectedItemIndex = mWidgetItemsToRemove[index].row();
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   378
				actualIndex.Append( mSelectionIndex[selectedItemIndex] );
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   379
				}
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   380
			deleteCertsL(actualIndex);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   381
			CleanupStack::PopAndDestroy(&actualIndex);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   382
			) // QT_TRAP_THROWING
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   383
		}
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   384
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   385
	mListView->deleteLater();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   386
	mListView = NULL;
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   387
	mSelectAllView->deleteLater();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   388
	mSelectAllView = NULL;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   389
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   390
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   391
void CpCertView::moveCert()
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   392
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   393
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   394
	mSelectAll = EFalse;
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   395
	mPopup->setDismissPolicy(HbDialog::NoDismiss);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   396
	// Set the label as heading widget
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   397
	if(mCertView == EPersonalView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   398
		{
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   399
		mPopup->setHeadingWidget(q_check_ptr(new HbLabel(tr("Move To Device"))));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   400
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   401
	else if(mCertView == EDeviceView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   402
		{
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   403
		mPopup->setHeadingWidget(q_check_ptr(new HbLabel(tr("Move To Personal"))));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   404
		}
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   405
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   406
	std::auto_ptr<QGraphicsLinearLayout> layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical)));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   407
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   408
	mSelectAllView = q_check_ptr(new HbListView(this));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
	QStandardItemModel* selectAllModel = q_check_ptr(new QStandardItemModel(this));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   410
	// Populate the model with content
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   411
	std::auto_ptr<QStandardItem> selectAllItem(q_check_ptr(new QStandardItem()));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
	selectAllItem->setData(QString("Select All"),Qt::DisplayRole);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   413
	selectAllModel->appendRow(selectAllItem.get());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   414
	selectAllItem.release();
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   415
	connect(mSelectAllView, SIGNAL(activated(QModelIndex)), this, SLOT(selectAll()));
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   416
	mSelectAllView->setModel(selectAllModel);
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   417
	mSelectAllView->setSelectionMode(HbListView::MultiSelection);
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   418
	layout->addItem(mSelectAllView);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   419
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   420
	mListView = q_check_ptr(new HbListView(this));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
	// Connect to "activated" signal
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
	connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex)));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   423
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   424
	// Create a model
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   425
	QStandardItemModel* model = q_check_ptr(new QStandardItemModel(this));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   426
	TInt count =0;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   427
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   428
	QT_TRAP_THROWING(count = refreshListL());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   429
	for(TInt index = 0; index < count ; ++index)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   430
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   431
		// Populate the model with content
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   432
		std::auto_ptr<QStandardItem> certItem(q_check_ptr(new QStandardItem()));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   433
		QString certificateLabel = certLabel(index);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   434
		certItem->setData( certificateLabel, Qt::DisplayRole);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   435
		model->appendRow(certItem.get());
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   436
		mSelectionIndex.Append(index);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   437
		certItem.release();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   438
		}
881d92421467 201037_03
hgs
parents: 30
diff changeset
   439
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   440
	// Set the model to the list view
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   441
	mListView->setModel(model);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   442
	mListView->setSelectionMode(HbListView::MultiSelection);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   443
	layout->addItem(mListView);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   444
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   445
	std::auto_ptr<HbWidget> widget(q_check_ptr(new HbWidget()));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   446
	widget->setLayout(layout.get());
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   447
	layout.release();
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   448
	mPopup->setContentWidget(widget.get());
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   449
	widget.release();
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   450
	RDEBUG("0", 0);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   451
    mPopup->clearActions();
881d92421467 201037_03
hgs
parents: 30
diff changeset
   452
	mOkAction = q_check_ptr(new HbAction(tr("Yes")));
881d92421467 201037_03
hgs
parents: 30
diff changeset
   453
	mPopup->addAction(mOkAction);
881d92421467 201037_03
hgs
parents: 30
diff changeset
   454
	HbAction *noAction = q_check_ptr(new HbAction(tr("No")));
881d92421467 201037_03
hgs
parents: 30
diff changeset
   455
	mPopup->addAction(noAction);
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   456
	mPopup->setTimeout(HbPopup::NoTimeout);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   457
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   458
	// Launch popup syncronously
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   459
	 mPopup->open(this, SLOT(handleMoveCertDialog(HbAction*)));
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   460
	 RDEBUG("0", 0);
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   461
}
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   462
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   463
void CpCertView::handleMoveCertDialog(HbAction* action)
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   464
{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   465
	RDEBUG("0", 0);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   466
	if(action == mOkAction)
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   467
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   468
		QItemSelectionModel *selectionModel = mListView->selectionModel();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   469
		QModelIndexList mWidgetItemsToRemove = selectionModel->selectedIndexes();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   470
		TInt deleteCount = mWidgetItemsToRemove.count();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   471
		// start deleting from end of array so that the indexes do not changes of the ones
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   472
		// at the front.
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   473
		RArray<TInt> actualIndex;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   474
		RDEBUG("0", 0);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   475
		QT_TRAP_THROWING
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   476
			(
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   477
			CleanupClosePushL(actualIndex);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   478
			 for (TInt index = deleteCount-1; index>= 0 ; --index)
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   479
				 {
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   480
				 TInt selectedItemIndex = mWidgetItemsToRemove[index].row();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   481
				 actualIndex.Append(mSelectionIndex[selectedItemIndex]);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   482
				 }
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   483
			 moveCertList(actualIndex);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   484
			 CleanupStack::PopAndDestroy(&actualIndex);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   485
			 )
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   486
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   487
	mListView->deleteLater();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   488
	mListView = NULL;
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   489
	mSelectAllView->deleteLater();
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   490
	mSelectAllView = NULL;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   491
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   492
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   493
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   494
void CpCertView::selectAll()
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   495
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   496
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   497
	if(mSelectAll == EFalse)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   498
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   499
		mListView->selectAll();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   500
		mSelectAll= ETrue;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   501
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   502
	else
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   503
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   504
		mListView->clearSelection();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   505
		mSelectAll= EFalse;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   506
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   507
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   508
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   509
void CpCertView::deleteCertsL( RArray<TInt>& indexList )
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   510
    {
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   511
    RDEBUG("0", 0);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   512
    TInt count = indexList.Count();
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   513
    for(int index = 0;index <count;++index )
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   514
    	{
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   515
		mIndexList.Append(indexList[index]);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   516
    	}
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   517
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   518
  	mNote = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   519
	QString deleteMsg;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   520
	QString sCount;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   521
	if(count == 1)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   522
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   523
		deleteMsg = "Delete %1?";
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   524
		const CCTCertInfo* entry = certAt(indexList[0]);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   525
		sCount = QString((QChar*)entry->Label().Ptr(),entry->Label().Length());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   526
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   527
	else
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   528
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   529
		deleteMsg = "Delete %1 items?";
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   530
		sCount.setNum(count);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   531
		}
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   532
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   533
	deleteMsg = deleteMsg.arg(sCount);
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   534
	mNote->setText(deleteMsg);
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   535
	mNote->setTimeout(HbPopup::NoTimeout);
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   536
	mNote->open(this,SLOT(handleDeleteDialog(HbAction*)));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   537
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   538
}
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   539
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   540
void CpCertView::handleDeleteDialog(HbAction* action)
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   541
{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   542
	RDEBUG("0", 0);
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   543
	TInt count = mIndexList.Count();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   544
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   545
	if (action != mNote->primaryAction() || count == 0 )
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   546
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   547
		return;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   548
		}
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   549
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   550
    RPointerArray<CCTCertInfo> errCerts;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   551
    QT_TRAP_THROWING(
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   552
    		CleanupClosePushL(errCerts);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   553
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   554
		for(TInt index = 0; index < count; ++index)
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   555
			{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   556
			const CCTCertInfo* entry = certAt(mIndexList[index]);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   557
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   558
			if( mCertView == EPersonalView || mCertView == EAuthorityView )
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   559
				{
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   560
				mCertDataContainer->iWrapper->DeleteCertL(
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   561
							mCertDataContainer->CertManager(), *entry );
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   562
				}
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   563
			else if( mCertView == ETrustedView )
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   564
				{
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   565
				mCertDataContainer->iWrapper->DeleteCertL(
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   566
							mCertDataContainer->CertManager(),*entry, KCMTrustedServerTokenUid );
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   567
				}
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   568
			else if( mCertView == EDeviceView )
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   569
				{
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   570
				mCertDataContainer->iWrapper->DeleteCertL(
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   571
							mCertDataContainer->CertManager(), *entry, KCMDeviceCertStoreTokenUid );
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   572
				}
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   573
			errCerts.AppendL(entry);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   574
			}
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   575
		RDEBUG("0", 0);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   576
		if(errCerts.Count() > 0)
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   577
			{
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   578
			QString message("Unable to delete the following certificate: \n");
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   579
			TInt count = errCerts.Count();
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   580
			for(TInt index=0;index<count;++index)
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   581
				{
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   582
				const TDesC& certLabel = errCerts[index]->Label();
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   583
				QString certName = QString((QChar*)certLabel.Ptr(),certLabel.Length());
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   584
				message.append(certName).append("\n");
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   585
				}
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   586
			HbMessageBox::warning(message);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   587
			}
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   588
		count = refreshListL();
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   589
		refreshView(count);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   590
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   591
		CleanupStack::PopAndDestroy(&errCerts);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   592
		) // QT_TRAP_THROWING
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   593
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   594
	delete mNote;
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   595
	mNote = NULL;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   596
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   597
    }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   598
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   599
const CCTCertInfo* CpCertView::certAt(TInt index) const
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   600
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   601
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   602
	CCTCertInfo* currentCert = NULL;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   603
	switch(mCertView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   604
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   605
		case EAuthorityView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   606
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   607
			currentCert = mCertDataContainer->iCALabelEntries[ index ]->iCAEntry;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   608
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   609
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   610
		case ETrustedView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   611
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   612
			currentCert = mCertDataContainer->iPeerLabelEntries[ index ]->iPeerEntry;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   613
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   614
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   615
		case EDeviceView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   616
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   617
			currentCert = mCertDataContainer->iDeviceLabelEntries[ index ]->iDeviceEntry;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   618
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   619
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   620
		case EPersonalView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   621
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   622
			currentCert = mCertDataContainer->iUserLabelEntries[ index ]->iUserEntry;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   623
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   624
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   625
		};
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   626
	return currentCert;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   627
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   628
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   629
QString CpCertView::certLabel(TInt index) const
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   630
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   631
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   632
	CpCertManUICertData* certData = NULL;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   633
	HBufC* label = NULL;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   634
	TInt length = 0;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   635
	switch(mCertView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   636
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   637
		case EAuthorityView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   638
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   639
			certData = mCertDataContainer->iCALabelEntries[index];
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   640
			label = certData->iCAEntryLabel;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   641
			length = certData->iCAEntryLabel->Length();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   642
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   643
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   644
		case ETrustedView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   645
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   646
			certData = mCertDataContainer->iPeerLabelEntries[index];
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   647
			label = certData->iPeerEntryLabel;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   648
			length = certData->iPeerEntryLabel->Length();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   649
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   650
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   651
		case EPersonalView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   652
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   653
			certData = mCertDataContainer->iUserLabelEntries[index];
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   654
			label = certData->iUserEntryLabel;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   655
			length = certData->iUserEntryLabel->Length();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   656
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   657
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   658
		case EDeviceView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   659
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   660
			certData = mCertDataContainer->iDeviceLabelEntries[index];
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   661
			label = certData->iDeviceEntryLabel;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   662
			length = certData->iDeviceEntryLabel->Length();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   663
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   664
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   665
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   666
	return QString((QChar*)label->Des().Ptr(), length);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   667
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   668
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   669
TInt CpCertView::refreshListL()
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   670
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   671
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   672
	TInt count = 0;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   673
	switch(mCertView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   674
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   675
		case EAuthorityView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   676
			mCertDataContainer->RefreshCAEntriesL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   677
			count = mCertDataContainer->iCALabelEntries.Count();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   678
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   679
		case ETrustedView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   680
			mCertDataContainer->RefreshPeerCertEntriesL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   681
			count = mCertDataContainer->iPeerLabelEntries.Count();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   682
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   683
		case EPersonalView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   684
			mCertDataContainer->RefreshUserCertEntriesL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   685
			count = mCertDataContainer->iUserLabelEntries.Count();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   686
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   687
		case EDeviceView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   688
			mCertDataContainer->RefreshDeviceCertEntriesL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   689
			count = mCertDataContainer->iDeviceLabelEntries.Count();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   690
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   691
		};
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   692
	return count;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   693
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   694
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   695
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   696
void CpCertView::refreshView( TInt count )
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   697
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   698
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   699
	if(mRefreshedView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   700
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   701
		mRefreshedView->deleteLater();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   702
		mRefreshedView = NULL;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   703
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   704
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   705
	mRefreshedView = q_check_ptr(new CpBaseSettingView());
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   706
	switch(mCertView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   707
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   708
		case EAuthorityView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   709
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   710
			mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_authority_certificate"));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   711
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   712
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   713
		case ETrustedView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   714
			{
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   715
			mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_trusted_site_certific"));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   716
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   717
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   718
		case EPersonalView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   719
			{
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   720
			mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_personal_certificates"));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   721
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   722
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   723
		case EDeviceView:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   724
			{
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   725
			mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_device_certificates"));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   726
			break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   727
			}
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   728
		}
881d92421467 201037_03
hgs
parents: 30
diff changeset
   729
881d92421467 201037_03
hgs
parents: 30
diff changeset
   730
	HbMenu* menu = mRefreshedView->menu();
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   731
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   732
	std::auto_ptr<HbAction> endAction( q_check_ptr(new HbAction(hbTrId("txt_common_opt_delete"))) );
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   733
	connect(endAction.get(), SIGNAL(triggered()), this, SLOT(deleteList()));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   734
	menu->addAction(endAction.get());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   735
	endAction.release();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   736
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   737
	QString title;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   738
	if(mCertView == EPersonalView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   739
		{
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   740
		title = "Move to Device";
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   741
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   742
	else if(mCertView == EDeviceView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   743
		{
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   744
		title = "Move to Personal";
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   745
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   746
	std::auto_ptr<HbAction> moveAction(q_check_ptr(new HbAction(title)));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   747
	connect(moveAction.get(), SIGNAL(triggered()), this, SLOT(moveCert()));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   748
	menu->addAction(moveAction.get());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   749
	moveAction.release();
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   750
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   751
	std::auto_ptr<QGraphicsLinearLayout> layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical)));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   752
881d92421467 201037_03
hgs
parents: 30
diff changeset
   753
	HbListWidget* mCertificateList = q_check_ptr(new HbListWidget(this));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   754
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   755
	for(int index = 0; index< count; index++)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   756
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   757
		QString certificateLabel = certLabel(index);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   758
		std::auto_ptr<HbListWidgetItem> singleCert(q_check_ptr(new HbListWidgetItem()));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   759
		singleCert->setText(certificateLabel);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   760
		mCertificateList->addItem(singleCert.get());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   761
		singleCert.release();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   762
		}  // end of for loop
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   763
881d92421467 201037_03
hgs
parents: 30
diff changeset
   764
	connect(mCertificateList, SIGNAL(activated(QModelIndex)), this, SLOT(openCertFromList(QModelIndex)));
881d92421467 201037_03
hgs
parents: 30
diff changeset
   765
	connect(mCertificateList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF)));
881d92421467 201037_03
hgs
parents: 30
diff changeset
   766
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   767
	layout->addItem(mCertificateList);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   768
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   769
	// Refresh current view
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   770
	QObject::connect(mRefreshedView , SIGNAL(aboutToClose()), this, SLOT(viewDone()));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   771
	mPrevView = mainWindow()->currentView();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   772
	mainWindow()->addView(mRefreshedView);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   773
	mainWindow()->setCurrentView(mRefreshedView);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   774
	mRefreshedView->setLayout(layout.get());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   775
	layout.release();
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   776
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   777
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   778
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   779
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   780
void CpCertView::viewDone()
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   781
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   782
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   783
	mCurrentView = mainWindow()->currentView();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   784
	mCurrentView->deleteLater();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   785
	mCurrentView= NULL;
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   786
	mainWindow()->setCurrentView(mOriginalView);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   787
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   788
void CpCertView::showTrustSettings()
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   789
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   790
	RDEBUG("0", 0);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   791
	mCurrentView = q_check_ptr(new CpCertTrustView(mPos, *mCertDataContainer));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   792
	connect(mCurrentView , SIGNAL(aboutToClose()), this, SLOT(saveTrustSettings()));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   793
	mPrevView = mainWindow()->currentView();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   794
	mainWindow()->addView(mCurrentView);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   795
	mainWindow()->setCurrentView(mCurrentView);
881d92421467 201037_03
hgs
parents: 30
diff changeset
   796
	}
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   797
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   798
void CpCertView::saveTrustSettings()
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   799
	{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   800
	((CpCertTrustView*)mCurrentView)->saveTrustSettings();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   801
	displayPreviousView();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   802
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   803
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   804
void CpCertView::moveSelectedCert()
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   805
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   806
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   807
	RArray<TInt> pos;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   808
	pos.Append(mPos);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   809
	moveCertList(pos);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   810
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   811
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   812
void CpCertView::moveCertList(RArray<TInt>& indexList)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   813
	{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   814
	RDEBUG("0", 0);
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   815
	mIndexList = indexList;
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   816
	mNote = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   817
	mNote->setHeadingWidget(q_check_ptr(new HbLabel(hbTrId("txt_certificate_manager_info_move"))));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   818
	if( mCertView == EPersonalView )
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   819
		{
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   820
		mNote->setText(hbTrId("txt_certificate_manager_info_device_certificates_c"));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   821
		}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   822
	else if( mCertView == EDeviceView )
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   823
		{
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   824
		mNote->setText("Use of Personal certificates may require user confirmation. Proceed?");
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   825
		}
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   826
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   827
	mNote->setTimeout(HbPopup::NoTimeout);
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   828
	mNote->setIconVisible (EFalse);
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   829
	mNote->open(this,SLOT(handleMoveDialog(HbAction*)));
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   830
	RDEBUG("0", 0);
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   831
}
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   832
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   833
void CpCertView::handleMoveDialog(HbAction* action)
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   834
{
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   835
	RDEBUG("0", 0);
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   836
	if (action != mNote->primaryAction())
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   837
	    {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   838
		return;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   839
	    }
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   840
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   841
	TInt count = mIndexList.Count();
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   842
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   843
	for(TInt index = 0 ; index < count; ++index)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   844
		{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   845
		CCTCertInfo* entry = NULL;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   846
		if(mCertView == EPersonalView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   847
			{
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   848
			entry = mCertDataContainer->iUserLabelEntries[ mIndexList[index] ]->iUserEntry;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   849
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   850
		else if(mCertView == EDeviceView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   851
			{
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   852
			entry = mCertDataContainer->iDeviceLabelEntries[ mIndexList[index] ]->iDeviceEntry;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   853
			}
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   854
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   855
		// Move key first
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   856
		TCTKeyAttributeFilter keyFilter;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   857
		keyFilter.iKeyId = entry->SubjectKeyId();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   858
		keyFilter.iPolicyFilter =  TCTKeyAttributeFilter::EAllKeys;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   859
		RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   860
		TUid sourceCertStoreUid = TUid::Uid(0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   861
		TUid targetCertStoreUid = TUid::Uid(0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   862
		TUid sourceKeyStoreUid = TUid::Uid(0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   863
		TUid targetKeyStoreUid = TUid::Uid(0);
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   864
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   865
		if(mCertView == EPersonalView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   866
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   867
			sourceKeyStoreUid = KCMFileKeyStoreTokenUid;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   868
			targetKeyStoreUid = KCMDeviceKeyStoreTokenUid;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   869
			sourceCertStoreUid = KCMFileCertStoreTokenUid;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   870
			targetCertStoreUid = KCMDeviceCertStoreTokenUid;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   871
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   872
		else if(mCertView == EDeviceView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   873
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   874
			sourceKeyStoreUid = KCMDeviceKeyStoreTokenUid;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   875
			targetKeyStoreUid = KCMFileKeyStoreTokenUid;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   876
			sourceCertStoreUid = KCMDeviceCertStoreTokenUid;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   877
			targetCertStoreUid = KCMFileCertStoreTokenUid;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   878
			}
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   879
		RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   880
		try
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   881
			{
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   882
881d92421467 201037_03
hgs
parents: 30
diff changeset
   883
			QT_TRAP_THROWING( mCertDataContainer->iWrapper->MoveKeyL(
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   884
					mCertDataContainer->KeyManager(), keyFilter, sourceKeyStoreUid, targetKeyStoreUid ));
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   885
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   886
			// Move certificate
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   887
			QT_TRAP_THROWING( mCertDataContainer->iWrapper->MoveCertL(
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   888
					mCertDataContainer->CertManager(), *entry, sourceCertStoreUid, targetCertStoreUid ) );
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   889
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   890
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   891
		catch(const std::exception& exception)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   892
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   893
			QString error(exception.what());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   894
			QT_TRAP_THROWING(mCertDataContainer->ShowErrorNoteL( error.toInt() ));
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   895
			User::Exit( KErrNone );
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   896
			}
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   897
		RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   898
		try
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   899
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   900
			if(mCertView == EPersonalView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   901
				{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   902
				QT_TRAP_THROWING( mCertDataContainer->RefreshUserCertEntriesL() );
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   903
				}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   904
			else if(mCertView == EDeviceView)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   905
				{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   906
				QT_TRAP_THROWING( mCertDataContainer->RefreshDeviceCertEntriesL() );
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   907
				}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   908
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   909
		catch(const std::exception& exception)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   910
			{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   911
			QString error(exception.what());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   912
			if (  error.toInt() == KErrCorrupt )
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   913
				{
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   914
				QT_TRAP_THROWING(mCertDataContainer->ShowErrorNoteL( error.toInt()) );
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   915
				User::Exit( KErrNone );
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   916
				}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   917
			// have to call straight away the Exit
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   918
			// showing any error notes would corrupt the display
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   919
			User::Exit( error.toInt() );
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   920
			}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   921
		} // for
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   922
	// Refresh current view
59
881d92421467 201037_03
hgs
parents: 30
diff changeset
   923
	QT_TRAP_THROWING(refreshView(refreshListL()));
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   924
	delete mNote;
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   925
	mNote = NULL;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   926
	RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   927
	}
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   928