cpsecplugins/cpadvancedsecplugin/src/cpsecurityview.cpp
changeset 22 6b63ca65093a
parent 19 098e361762d2
child 26 aad866c37519
equal deleted inserted replaced
19:098e361762d2 22:6b63ca65093a
    52 	  mSecModUIModel(NULL),
    52 	  mSecModUIModel(NULL),
    53 	  mSecModView(NULL),
    53 	  mSecModView(NULL),
    54 	  mPreView(NULL),
    54 	  mPreView(NULL),
    55 	  mCertView(NULL),
    55 	  mCertView(NULL),
    56 	  mCurrentView(NULL),
    56 	  mCurrentView(NULL),
    57 	  mPos(0)
    57 	  mPos(0),
       
    58 	  mNote(NULL)
    58 	{
    59 	{
    59 	setTitle(hbTrId("txt_certificate_manager_setlabel_advanced_security"));
    60 	setTitle(hbTrId("txt_certificate_manager_setlabel_advanced_security"));
    60 	
    61 	
    61 	std::auto_ptr<QGraphicsLinearLayout> layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical)));
    62 	std::auto_ptr<QGraphicsLinearLayout> layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical)));
    62     HbListWidget* listCertView = q_check_ptr(new HbListWidget(this)); 
    63     HbListWidget* listCertView = q_check_ptr(new HbListWidget(this)); 
   151 CpSecurityView::~CpSecurityView()
   152 CpSecurityView::~CpSecurityView()
   152 	{
   153 	{
   153 	if(mSecModView)
   154 	if(mSecModView)
   154 		{
   155 		{
   155 		mSecModView->deleteLater();
   156 		mSecModView->deleteLater();
   156 		mSecModView= NULL;
       
   157 		}
   157 		}
   158 	
   158 	
   159 	if(mPreView)
   159 	if(mPreView)
   160 		{
   160 		{
   161 		mPreView->deleteLater();
   161 		mPreView->deleteLater();
   162 		mPreView= NULL;
       
   163 		}
   162 		}
   164 	
   163 	
   165 	if(mCertView)
   164 	if(mCertView)
   166 		{
   165 		{
   167 		mCertView->deleteLater();
   166 		mCertView->deleteLater();
   168 		mCertView= NULL;
       
   169 		}
   167 		}
   170 	
   168 	
   171 	if(mCurrentView)
   169 	if(mCurrentView)
   172 		{
   170 		{
   173 		mCurrentView->deleteLater();
   171 		mCurrentView->deleteLater();
   174 		mCurrentView= NULL;
       
   175 		}
   172 		}
   176 	
   173 	
   177 	delete mSecModUIModel;  
   174 	delete mSecModUIModel;  
   178 	mSecModUIModel = NULL;
   175 	
       
   176 	delete mNote;
   179 	}
   177 	}
   180 
   178 
   181 void CpSecurityView::showCodeView()
   179 void CpSecurityView::showCodeView()
   182 	{
   180 	{
   183 	try
   181 	try
   297 
   295 
   298 void CpSecurityView::deleteModule()
   296 void CpSecurityView::deleteModule()
   299 	{
   297 	{
   300 	try
   298 	try
   301 		{
   299 		{
   302 		HbMessageBox note(HbMessageBox::MessageTypeQuestion);
   300 		
   303 		note.setHeadingWidget(q_check_ptr(new HbLabel(tr("Delete..."))));
   301 		delete mNote;
   304 		note.setText("Delete keystore and password?");
   302 		mNote = NULL;
   305 		note.setPrimaryAction(q_check_ptr(new HbAction("Yes")));
   303 		
   306 		note.setSecondaryAction(q_check_ptr(new HbAction("No")));
   304 		mNote = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
   307 		note.setTimeout(HbPopup::NoTimeout);
   305 		mNote->setHeadingWidget(q_check_ptr(new HbLabel(tr("Delete..."))));
   308 		note.setIconVisible (EFalse);
   306 		mNote->setText("Delete keystore and password?");
   309 		HbAction* result = note.exec();
   307 		mNote->setPrimaryAction(q_check_ptr(new HbAction("Yes")));
   310 	
   308 		mNote->setSecondaryAction(q_check_ptr(new HbAction("No")));
   311 		if (result != note.primaryAction())
   309 		mNote->setTimeout(HbPopup::NoTimeout);
   312 			{
   310 		mNote->setIconVisible (EFalse);
   313 			return;
   311 		mNote->open(this,SLOT(dialogClosed(HbAction*)));
   314 			}
   312 		}
   315 	
   313 	catch(const std::exception& exception)
       
   314 		{
       
   315 	    HbMessageBox *box = new HbMessageBox(exception.what());
       
   316     	box->setAttribute(Qt::WA_DeleteOnClose);
       
   317     	box->open();	
       
   318 		}
       
   319 
       
   320 }
       
   321 void CpSecurityView::dialogClosed(HbAction* action)
       
   322 {
       
   323 	if (action != mNote->primaryAction())
       
   324 		{
       
   325 		return;
       
   326 		}
       
   327 		
       
   328 	try
       
   329 		{
   316 		QT_TRAP_THROWING(mSecModUIModel->DeleteKeysL(mPos));
   330 		QT_TRAP_THROWING(mSecModUIModel->DeleteKeysL(mPos));
   317 		}
   331    		}		
   318 	catch(const std::exception& exception)
   332 	catch(const std::exception& exception)
   319 		{
   333 		{
   320 		HbMessageBox::information(exception.what());
   334 	    HbMessageBox *box = new HbMessageBox(exception.what());
   321 		}
   335     	box->setAttribute(Qt::WA_DeleteOnClose);
   322 	// refresh current view
   336     	box->open();
       
   337 		}
   323 	}
   338 	}
   324 
   339 
   325 void CpSecurityView::moduleDetails()
   340 void CpSecurityView::moduleDetails()
   326 	{
   341 	{
   327 	try
   342 	try