# HG changeset patch # User hgs # Date 1285671834 -10800 # Node ID 881d92421467aa130fa0b6b8c7bb2a783a787ecb # Parent 25dd1e8b266355653d77212d5de43f505350fcfd 201037_03 diff -r 25dd1e8b2663 -r 881d92421467 cpsecplugins/cpadvancedsecplugin/inc/cpcertview.h --- a/cpsecplugins/cpadvancedsecplugin/inc/cpcertview.h Fri Sep 03 16:31:27 2010 +0300 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpcertview.h Tue Sep 28 14:03:54 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -27,39 +27,41 @@ class HbAction; class HbDialog; class HbMessageBox; +class HbAction; + class CpCertView : public CpBaseSettingView { Q_OBJECT - + public: explicit CpCertView(const QModelIndex& index, QGraphicsItem *parent = 0); virtual ~CpCertView(); - + public: enum TCertificateViews { EAuthorityView=0, ETrustedView, EPersonalView, - EDeviceView + EDeviceView }; - + public slots: void displayPreviousView(); - + private slots: void openCertificate(); void openCertFromList(const QModelIndex& modelIndex); void showTrustSettings(); void saveTrustSettings(); void indicateLongPress(HbAbstractViewItem*, QPointF); - + void deleteCertificate(); TInt refreshListL(); void refreshView( TInt aCount ); - + void moveSelectedCert(); - void deleteList(); + void deleteList(); void selectAll(); void moveCert(); void viewDone(); @@ -81,13 +83,14 @@ TBool mSelectAll; RArray mSelectionIndex; RArray mIndexList; - + HbDialog* mPopup; + HbAction* mOkAction; HbView* mPrevView; HbView* mCurrentView; CpBaseSettingView* mRefreshedView; - HbListView* mListView; - HbListView* mSelectAllView; + HbListView* mListView; + HbListView* mSelectAllView; HbView* mOriginalView; HbMessageBox* mNote; HbMenu* mContextMenu; diff -r 25dd1e8b2663 -r 881d92421467 cpsecplugins/cpadvancedsecplugin/inc/cpsecurityview.h --- a/cpsecplugins/cpadvancedsecplugin/inc/cpsecurityview.h Fri Sep 03 16:31:27 2010 +0300 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpsecurityview.h Tue Sep 28 14:03:54 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -28,13 +28,15 @@ class QModelIndex; class CpSecmoduleInfoView; class HbMessageBox; +class HbAction; + class CpSecurityView : public CpBaseSettingView { Q_OBJECT public: explicit CpSecurityView(QGraphicsItem *parent = 0); virtual ~CpSecurityView(); - + public slots: void viewDone(); void showWIMview(); @@ -48,7 +50,7 @@ void displayPreviousFromModInfo(); void dialogClosed(HbAction* action); private: - CSecModUIModel* mSecModUIModel; + CSecModUIModel* mSecModUIModel; CpSecModView* mSecModView; HbView* mPreView; CpCertView* mCertView; @@ -56,6 +58,7 @@ HbView* mCurrentView; TInt mPos; HbMessageBox* mNote; + HbAction* mOkAction; HbMenu* mContextMenu; }; diff -r 25dd1e8b2663 -r 881d92421467 cpsecplugins/cpadvancedsecplugin/rom/advancedsecurity_resources.iby --- a/cpsecplugins/cpadvancedsecplugin/rom/advancedsecurity_resources.iby Fri Sep 03 16:31:27 2010 +0300 +++ b/cpsecplugins/cpadvancedsecplugin/rom/advancedsecurity_resources.iby Tue Sep 28 14:03:54 2010 +0300 @@ -11,11 +11,15 @@ * * Contributors: * -* Description: Translation string details +* Description: Advanced security settings resources * */ +#ifndef ADVANCEDSECPLUGIN_RESOURCES_IBY +#define ADVANCEDSECPLUGIN_RESOURCES_IBY #include -data=DATAZ_\QT_TRANSLATIONS_DIR\certificate_management.qm QT_TRANSLATIONS_DIR\certificate_management.qm \ No newline at end of file +data=DATAZ_\QT_TRANSLATIONS_DIR\certificate_manager.qm QT_TRANSLATIONS_DIR\certificate_manager.qm + +#endif // ADVANCEDSECPLUGIN_RESOURCES_IBY diff -r 25dd1e8b2663 -r 881d92421467 cpsecplugins/cpadvancedsecplugin/src/cpcertpluginloader.cpp --- a/cpsecplugins/cpadvancedsecplugin/src/cpcertpluginloader.cpp Fri Sep 03 16:31:27 2010 +0300 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpcertpluginloader.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -44,10 +44,17 @@ } QList CpCertPluginLoader::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const - { - RDEBUG("0", 0); - return QList() - << new CpSettingFormEntryItemDataImpl(itemDataHelper,tr("Advanced Security"), QString()); - } + { + RDEBUG("0", 0); + CpSettingFormEntryItemData *advancedSecuritySettingsItem = + new CpSettingFormEntryItemDataImpl( + CpSettingFormEntryItemData::ButtonEntryItem, + itemDataHelper, hbTrId("txt_certificate_manager_setlabel_advanced_security")); + advancedSecuritySettingsItem->setContentWidgetData("textAlignment", + QVariant( Qt::AlignHCenter | Qt::AlignVCenter) ); + advancedSecuritySettingsItem->setContentWidgetData("objectName", + "advancedSecuritySettingsButton" ); + return QList() << advancedSecuritySettingsItem; + } Q_EXPORT_PLUGIN2(cpcertpluginloader, CpCertPluginLoader); diff -r 25dd1e8b2663 -r 881d92421467 cpsecplugins/cpadvancedsecplugin/src/cpcertview.cpp --- a/cpsecplugins/cpadvancedsecplugin/src/cpcertview.cpp Fri Sep 03 16:31:27 2010 +0300 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpcertview.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -52,7 +52,7 @@ CpCertView::CpCertView(const QModelIndex& modelIndex, QGraphicsItem *parent /*= 0*/) : CpBaseSettingView(0,parent), - mPopup(NULL), + mPopup(NULL), mOkAction(NULL), mPrevView(NULL), mCurrentView(NULL), mRefreshedView(NULL), @@ -63,23 +63,23 @@ { RDEBUG("0", 0); mOriginalView = mainWindow()->currentView(); - - HbMenu* menu = this->menu(); + + HbMenu* menu = this->menu(); std::auto_ptr deleteAction(new HbAction(hbTrId("txt_common_menu_delete"))); - connect(deleteAction.get(), SIGNAL(triggered()), this, SLOT(deleteList())); + connect(deleteAction.get(), SIGNAL(triggered()), this, SLOT(deleteList())); menu->addAction(deleteAction.get()); deleteAction.release(); - + std::auto_ptr layout(new QGraphicsLinearLayout(Qt::Vertical)); - + HbDataForm *form = q_check_ptr(new HbDataForm(this)); std::auto_ptr formModel(q_check_ptr(new HbDataFormModel())); form->setModel(formModel.get()); formModel.release(); - - HbListWidget* certificateList = q_check_ptr(new HbListWidget(this)); - - CpCertView::TCertificateViews currentView = (CpCertView::TCertificateViews)modelIndex.row(); + + HbListWidget* certificateList = q_check_ptr(new HbListWidget(this)); + + CpCertView::TCertificateViews currentView = (CpCertView::TCertificateViews)modelIndex.row(); QString title; if(currentView == EPersonalView) { @@ -87,17 +87,17 @@ } else if(currentView == EDeviceView) { - title = "Move to Personal"; + title = "Move to Personal"; } RDEBUG("0", 0); if(currentView == EPersonalView || currentView == EDeviceView) { - std::auto_ptr moveToDeviceAction(q_check_ptr(new HbAction(title))); - connect(moveToDeviceAction.get(), SIGNAL(triggered()), this, SLOT(moveCert())); + std::auto_ptr moveToDeviceAction(q_check_ptr(new HbAction(title))); + connect(moveToDeviceAction.get(), SIGNAL(triggered()), this, SLOT(moveCert())); menu->addAction(moveToDeviceAction.get()); moveToDeviceAction.release(); - } - + } + setDetails(currentView); TInt count = 0; try @@ -119,17 +119,17 @@ certificateList->addItem(singleCert.get()); singleCert.release(); } // End of FOR loop - - connect(certificateList, SIGNAL(activated(QModelIndex)), this, SLOT(openCertFromList(QModelIndex))); - connect(certificateList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF))); - + + connect(certificateList, SIGNAL(activated(QModelIndex)), this, SLOT(openCertFromList(QModelIndex))); + connect(certificateList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF))); + layout->addItem(certificateList); setLayout(layout.get()); layout.release(); - + mPopup = q_check_ptr(new HbDialog()); mContextMenu = q_check_ptr(new HbMenu()); - + RDEBUG("0", 0); } @@ -158,26 +158,26 @@ mListView->deleteLater(); mListView= NULL; } - + if(mSelectAllView) { mSelectAllView->deleteLater(); mSelectAllView = NULL; } - + mSelectionIndex.Close(); - + mIndexList.Close(); - + delete mPopup; - + delete mNote; mNote = NULL; - + delete mContextMenu; - + } - + void CpCertView::setDetails(CpCertView::TCertificateViews currentView) { RDEBUG("0", 0); @@ -187,17 +187,17 @@ setTitle(hbTrId("txt_certificate_manager_list_authority_certificate")); mCertView = EAuthorityView; break; - + case ETrustedView: setTitle(hbTrId("txt_certificate_manager_list_trusted_site_certific")); mCertView = ETrustedView; break; - + case EPersonalView: setTitle(hbTrId("txt_certificate_manager_list_personal_certificates")); mCertView = EPersonalView; break; - + case EDeviceView: setTitle(hbTrId("txt_certificate_manager_list_device_certificates")); mCertView = EDeviceView; @@ -209,19 +209,19 @@ { RDEBUG("0", 0); mPos = item->modelIndex().row(); // Pos will tell you what is the certificate clicked in particular view. - + mContextMenu->clearActions(); std::auto_ptr open(q_check_ptr(new HbAction(hbTrId("txt_common_menu_open")))); connect(open.get(), SIGNAL(triggered()), this, SLOT( openCertificate())); - mContextMenu->addAction(open.get()); + mContextMenu->addAction(open.get()); open.release(); - + QString moveTitle; - + if(mCertView == EAuthorityView) { - std::auto_ptr trustSettings(q_check_ptr(new HbAction(hbTrId("txt_certificate_manager_menu_trust_settings")))); - connect(trustSettings.get(), SIGNAL(triggered()), this, SLOT(showTrustSettings())); + std::auto_ptr trustSettings(q_check_ptr(new HbAction(hbTrId("txt_certificate_manager_menu_trust_settings")))); + connect(trustSettings.get(), SIGNAL(triggered()), this, SLOT(showTrustSettings())); mContextMenu->addAction(trustSettings.get()); trustSettings.release(); } @@ -232,21 +232,21 @@ else if(mCertView == EDeviceView) { moveTitle = hbTrId("txt_certificate_manager_menu_move_to_personal_cert"); - } - + } + if(mCertView == EPersonalView || mCertView == EDeviceView ) { - std::auto_ptr moveCert(q_check_ptr(new HbAction(moveTitle))); - connect(moveCert.get(), SIGNAL(triggered()), this, SLOT(moveSelectedCert())); + std::auto_ptr moveCert(q_check_ptr(new HbAction(moveTitle))); + connect(moveCert.get(), SIGNAL(triggered()), this, SLOT(moveSelectedCert())); mContextMenu->addAction(moveCert.get()); moveCert.release(); } - + RDEBUG("0", 0); if( certAt(mPos)->IsDeletable() ) { - std::auto_ptr menuDelete(q_check_ptr(new HbAction(hbTrId("txt_common_menu_delete")))); - connect(menuDelete.get(), SIGNAL(triggered()), this, SLOT(deleteCertificate())); + std::auto_ptr menuDelete(q_check_ptr(new HbAction(hbTrId("txt_common_menu_delete")))); + connect(menuDelete.get(), SIGNAL(triggered()), this, SLOT(deleteCertificate())); mContextMenu->addAction(menuDelete.get()); menuDelete.release(); } @@ -255,40 +255,40 @@ } void CpCertView::openCertFromList(const QModelIndex& modelIndex) - { + { RDEBUG("0", 0); // Pos will tell you what is the certificate clicked in particular view. - mPos = modelIndex.row(); + mPos = modelIndex.row(); openCertificate(); } void CpCertView::openCertificate() { RDEBUG("0", 0); - mCurrentView = q_check_ptr(new CpCertDetailView(mCertView,mPos,*mCertDataContainer)); + mCurrentView = q_check_ptr(new CpCertDetailView(mCertView,mPos,*mCertDataContainer)); connect(mCurrentView, SIGNAL(aboutToClose()), this, SLOT(displayPreviousView())); - mPrevView = mainWindow()->currentView(); + mPrevView = mainWindow()->currentView(); mainWindow()->addView(mCurrentView); - mainWindow()->setCurrentView(mCurrentView); + mainWindow()->setCurrentView(mCurrentView); } - -void CpCertView::displayPreviousView() + +void CpCertView::displayPreviousView() { RDEBUG("0", 0); - mainWindow()->removeView(mCurrentView); + mainWindow()->removeView(mCurrentView); mCurrentView->deleteLater(); mCurrentView= NULL; - mainWindow()->setCurrentView(mPrevView); + mainWindow()->setCurrentView(mPrevView); } - + void CpCertView::deleteCertificate() { RDEBUG("0", 0); RArray pos; pos.Append(mPos); QT_TRAP_THROWING(deleteCertsL(pos)); - } - + } + void CpCertView::deleteList() { RDEBUG("0", 0); @@ -296,9 +296,9 @@ mPopup->setDismissPolicy(HbDialog::NoDismiss); // Set the label as heading widget mPopup->setHeadingWidget(q_check_ptr(new HbLabel(hbTrId("txt_certificate_manager_setlabel_certificates")))); - + std::auto_ptr layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); - + mSelectAllView = q_check_ptr(new HbListView(this)); QStandardItemModel* selectAllModel = q_check_ptr(new QStandardItemModel(this)); // Populate the model with content @@ -306,16 +306,16 @@ selectAllItem->setData(QString("Select All"),Qt::DisplayRole); selectAllModel->appendRow(selectAllItem.get()); selectAllItem.release(); - + connect(mSelectAllView, SIGNAL(activated(QModelIndex)), this, SLOT(selectAll())); mSelectAllView->setModel(selectAllModel); mSelectAllView->setSelectionMode(HbListView::MultiSelection); layout->addItem(mSelectAllView); - + mListView = q_check_ptr(new HbListView(this)); // Connect to "activated" signal connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex))); - + // Create a model QStandardItemModel* model = q_check_ptr(new QStandardItemModel(this)); TInt count=0; @@ -334,20 +334,23 @@ mSelectionIndex.Append(index); certItem.release(); } - } + } // Set the model to the list view mListView->setModel(model); mListView->setSelectionMode(HbListView::MultiSelection); layout->addItem(mListView); - + std::auto_ptr widget( q_check_ptr(new HbWidget())); widget->setLayout(layout.get()); layout.release(); mPopup->setContentWidget(widget.get()); widget.release(); - - mPopup->setPrimaryAction(q_check_ptr(new HbAction(hbTrId("txt_common_opt_delete")))); - mPopup->setSecondaryAction(q_check_ptr(new HbAction(hbTrId("txt_common_button_cancel")))); + + mPopup->clearActions(); + mOkAction = q_check_ptr(new HbAction(hbTrId("txt_common_opt_delete"))); + mPopup->addAction(mOkAction); + HbAction *cancelAction = q_check_ptr(new HbAction(hbTrId("txt_common_button_cancel"))); + mPopup->addAction(cancelAction); mPopup->setTimeout(HbPopup::NoTimeout); RDEBUG("0", 0); // Launch popup syncronously @@ -358,7 +361,7 @@ void CpCertView::handleMultipleDelete(HbAction* action) { RDEBUG("0", 0); - if(action == mPopup->primaryAction()) + if(action == mOkAction) { QItemSelectionModel *selectionModel = mListView->selectionModel(); QModelIndexList mWidgetItemsToRemove = selectionModel->selectedIndexes(); @@ -369,7 +372,7 @@ QT_TRAP_THROWING ( CleanupClosePushL(actualIndex); - for (TInt index = deleteCount-1; index>= 0 ; --index) + for (TInt index = deleteCount-1; index>= 0 ; --index) { TInt selectedItemIndex = mWidgetItemsToRemove[index].row(); actualIndex.Append( mSelectionIndex[selectedItemIndex] ); @@ -382,7 +385,7 @@ mListView->deleteLater(); mListView = NULL; mSelectAllView->deleteLater(); - mSelectAllView = NULL; + mSelectAllView = NULL; } void CpCertView::moveCert() @@ -399,9 +402,9 @@ { mPopup->setHeadingWidget(q_check_ptr(new HbLabel(tr("Move To Personal")))); } - + std::auto_ptr layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); - + mSelectAllView = q_check_ptr(new HbListView(this)); QStandardItemModel* selectAllModel = q_check_ptr(new QStandardItemModel(this)); // Populate the model with content @@ -413,11 +416,11 @@ mSelectAllView->setModel(selectAllModel); mSelectAllView->setSelectionMode(HbListView::MultiSelection); layout->addItem(mSelectAllView); - + mListView = q_check_ptr(new HbListView(this)); // Connect to "activated" signal connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex))); - + // Create a model QStandardItemModel* model = q_check_ptr(new QStandardItemModel(this)); TInt count =0; @@ -432,32 +435,35 @@ model->appendRow(certItem.get()); mSelectionIndex.Append(index); certItem.release(); - } - + } + // Set the model to the list view mListView->setModel(model); mListView->setSelectionMode(HbListView::MultiSelection); layout->addItem(mListView); - + std::auto_ptr widget(q_check_ptr(new HbWidget())); - widget->setLayout(layout.get()); + widget->setLayout(layout.get()); layout.release(); mPopup->setContentWidget(widget.get()); widget.release(); RDEBUG("0", 0); - mPopup->setPrimaryAction(q_check_ptr(new HbAction(tr("Yes")))); - mPopup->setSecondaryAction(q_check_ptr(new HbAction(tr("No")))); + mPopup->clearActions(); + mOkAction = q_check_ptr(new HbAction(tr("Yes"))); + mPopup->addAction(mOkAction); + HbAction *noAction = q_check_ptr(new HbAction(tr("No"))); + mPopup->addAction(noAction); mPopup->setTimeout(HbPopup::NoTimeout); - + // Launch popup syncronously mPopup->open(this, SLOT(handleMoveCertDialog(HbAction*))); RDEBUG("0", 0); } void CpCertView::handleMoveCertDialog(HbAction* action) -{ +{ RDEBUG("0", 0); - if(action == mPopup->primaryAction()) + if(action == mOkAction) { QItemSelectionModel *selectionModel = mListView->selectionModel(); QModelIndexList mWidgetItemsToRemove = selectionModel->selectedIndexes(); @@ -469,17 +475,17 @@ QT_TRAP_THROWING ( CleanupClosePushL(actualIndex); - for (TInt index = deleteCount-1; index>= 0 ; --index) + for (TInt index = deleteCount-1; index>= 0 ; --index) { TInt selectedItemIndex = mWidgetItemsToRemove[index].row(); - actualIndex.Append(mSelectionIndex[selectedItemIndex]); + actualIndex.Append(mSelectionIndex[selectedItemIndex]); } moveCertList(actualIndex); CleanupStack::PopAndDestroy(&actualIndex); ) } mListView->deleteLater(); - mListView = NULL; + mListView = NULL; mSelectAllView->deleteLater(); mSelectAllView = NULL; RDEBUG("0", 0); @@ -508,7 +514,7 @@ { mIndexList.Append(indexList[index]); } - + mNote = new HbMessageBox(HbMessageBox::MessageTypeQuestion); QString deleteMsg; QString sCount; @@ -535,35 +541,35 @@ { RDEBUG("0", 0); TInt count = mIndexList.Count(); - + if (action != mNote->primaryAction() || count == 0 ) { return; } - + RPointerArray errCerts; QT_TRAP_THROWING( CleanupClosePushL(errCerts); - + for(TInt index = 0; index < count; ++index) { const CCTCertInfo* entry = certAt(mIndexList[index]); - + if( mCertView == EPersonalView || mCertView == EAuthorityView ) { - mCertDataContainer->iWrapper->DeleteCertL( + mCertDataContainer->iWrapper->DeleteCertL( mCertDataContainer->CertManager(), *entry ); } else if( mCertView == ETrustedView ) { - mCertDataContainer->iWrapper->DeleteCertL( + mCertDataContainer->iWrapper->DeleteCertL( mCertDataContainer->CertManager(),*entry, KCMTrustedServerTokenUid ); } else if( mCertView == EDeviceView ) { mCertDataContainer->iWrapper->DeleteCertL( mCertDataContainer->CertManager(), *entry, KCMDeviceCertStoreTokenUid ); - } + } errCerts.AppendL(entry); } RDEBUG("0", 0); @@ -581,10 +587,10 @@ } count = refreshListL(); refreshView(count); - + CleanupStack::PopAndDestroy(&errCerts); ) // QT_TRAP_THROWING - + delete mNote; mNote = NULL; RDEBUG("0", 0); @@ -696,7 +702,7 @@ mRefreshedView = NULL; } - mRefreshedView = q_check_ptr(new CpBaseSettingView()); + mRefreshedView = q_check_ptr(new CpBaseSettingView()); switch(mCertView) { case EAuthorityView: @@ -706,45 +712,45 @@ } case ETrustedView: { - mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_trusted_site_certific")); + mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_trusted_site_certific")); break; } case EPersonalView: { - mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_personal_certificates")); + mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_personal_certificates")); break; } case EDeviceView: { - mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_device_certificates")); + mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_device_certificates")); break; } - } - - HbMenu* menu = mRefreshedView->menu(); + } + + HbMenu* menu = mRefreshedView->menu(); RDEBUG("0", 0); std::auto_ptr endAction( q_check_ptr(new HbAction(hbTrId("txt_common_opt_delete"))) ); - connect(endAction.get(), SIGNAL(triggered()), this, SLOT(deleteList())); + connect(endAction.get(), SIGNAL(triggered()), this, SLOT(deleteList())); menu->addAction(endAction.get()); endAction.release(); - + QString title; if(mCertView == EPersonalView) { - title = "Move to Device"; + title = "Move to Device"; } else if(mCertView == EDeviceView) { - title = "Move to Personal"; + title = "Move to Personal"; } std::auto_ptr moveAction(q_check_ptr(new HbAction(title))); - connect(moveAction.get(), SIGNAL(triggered()), this, SLOT(moveCert())); + connect(moveAction.get(), SIGNAL(triggered()), this, SLOT(moveCert())); menu->addAction(moveAction.get()); moveAction.release(); RDEBUG("0", 0); std::auto_ptr layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); - - HbListWidget* mCertificateList = q_check_ptr(new HbListWidget(this)); + + HbListWidget* mCertificateList = q_check_ptr(new HbListWidget(this)); for(int index = 0; index< count; index++) { @@ -754,40 +760,40 @@ mCertificateList->addItem(singleCert.get()); singleCert.release(); } // end of for loop - - connect(mCertificateList, SIGNAL(activated(QModelIndex)), this, SLOT(openCertFromList(QModelIndex))); - connect(mCertificateList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF))); - + + connect(mCertificateList, SIGNAL(activated(QModelIndex)), this, SLOT(openCertFromList(QModelIndex))); + connect(mCertificateList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF))); + layout->addItem(mCertificateList); RDEBUG("0", 0); // Refresh current view QObject::connect(mRefreshedView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); - mPrevView = mainWindow()->currentView(); + mPrevView = mainWindow()->currentView(); mainWindow()->addView(mRefreshedView); - mainWindow()->setCurrentView(mRefreshedView); + mainWindow()->setCurrentView(mRefreshedView); mRefreshedView->setLayout(layout.get()); layout.release(); RDEBUG("0", 0); } -void CpCertView::viewDone() +void CpCertView::viewDone() { RDEBUG("0", 0); mCurrentView = mainWindow()->currentView(); mCurrentView->deleteLater(); mCurrentView= NULL; - mainWindow()->setCurrentView(mOriginalView); + mainWindow()->setCurrentView(mOriginalView); } void CpCertView::showTrustSettings() { RDEBUG("0", 0); - mCurrentView = q_check_ptr(new CpCertTrustView(mPos, *mCertDataContainer)); + mCurrentView = q_check_ptr(new CpCertTrustView(mPos, *mCertDataContainer)); connect(mCurrentView , SIGNAL(aboutToClose()), this, SLOT(saveTrustSettings())); - mPrevView = mainWindow()->currentView(); + mPrevView = mainWindow()->currentView(); mainWindow()->addView(mCurrentView); - mainWindow()->setCurrentView(mCurrentView); - } + mainWindow()->setCurrentView(mCurrentView); + } void CpCertView::saveTrustSettings() { @@ -817,7 +823,7 @@ { mNote->setText("Use of Personal certificates may require user confirmation. Proceed?"); } - + mNote->setTimeout(HbPopup::NoTimeout); mNote->setIconVisible (EFalse); mNote->open(this,SLOT(handleMoveDialog(HbAction*))); @@ -831,9 +837,9 @@ { return; } - + TInt count = mIndexList.Count(); - + for(TInt index = 0 ; index < count; ++index) { CCTCertInfo* entry = NULL; @@ -845,7 +851,7 @@ { entry = mCertDataContainer->iDeviceLabelEntries[ mIndexList[index] ]->iDeviceEntry; } - + // Move key first TCTKeyAttributeFilter keyFilter; keyFilter.iKeyId = entry->SubjectKeyId(); @@ -855,7 +861,7 @@ TUid targetCertStoreUid = TUid::Uid(0); TUid sourceKeyStoreUid = TUid::Uid(0); TUid targetKeyStoreUid = TUid::Uid(0); - + if(mCertView == EPersonalView) { sourceKeyStoreUid = KCMFileKeyStoreTokenUid; @@ -873,12 +879,12 @@ RDEBUG("0", 0); try { - - QT_TRAP_THROWING( mCertDataContainer->iWrapper->MoveKeyL( + + QT_TRAP_THROWING( mCertDataContainer->iWrapper->MoveKeyL( mCertDataContainer->KeyManager(), keyFilter, sourceKeyStoreUid, targetKeyStoreUid )); - + // Move certificate - QT_TRAP_THROWING( mCertDataContainer->iWrapper->MoveCertL( + QT_TRAP_THROWING( mCertDataContainer->iWrapper->MoveCertL( mCertDataContainer->CertManager(), *entry, sourceCertStoreUid, targetCertStoreUid ) ); } @@ -910,11 +916,11 @@ } // have to call straight away the Exit // showing any error notes would corrupt the display - User::Exit( error.toInt() ); + User::Exit( error.toInt() ); } } // for // Refresh current view - QT_TRAP_THROWING(refreshView(refreshListL())); + QT_TRAP_THROWING(refreshView(refreshListL())); delete mNote; mNote = NULL; RDEBUG("0", 0); diff -r 25dd1e8b2663 -r 881d92421467 cpsecplugins/cpadvancedsecplugin/src/cpsecurityview.cpp --- a/cpsecplugins/cpadvancedsecplugin/src/cpsecurityview.cpp Fri Sep 03 16:31:27 2010 +0300 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpsecurityview.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -57,25 +57,25 @@ mCertView(NULL), mCurrentView(NULL), mPos(0), - mNote(NULL) + mNote(NULL), mOkAction(NULL) { RDEBUG("0", 0); setTitle(hbTrId("txt_certificate_manager_setlabel_advanced_security")); - + std::auto_ptr layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); - HbListWidget* listCertView = q_check_ptr(new HbListWidget(this)); + HbListWidget* listCertView = q_check_ptr(new HbListWidget(this)); std::auto_ptr authcert(q_check_ptr(new HbListWidgetItem())); authcert->setText(hbTrId("txt_certificate_manager_list_authority_certificate")); - + std::auto_ptr trustedsitecert(q_check_ptr(new HbListWidgetItem())); trustedsitecert->setText(hbTrId("txt_certificate_manager_list_trusted_site_certific")); - + std::auto_ptr personalcert(q_check_ptr(new HbListWidgetItem())); personalcert->setText(hbTrId("txt_certificate_manager_list_personal_certificates")); - + std::auto_ptr devicecert(q_check_ptr(new HbListWidgetItem())); - devicecert->setText(hbTrId("txt_certificate_manager_list_device_certificates")); + devicecert->setText(hbTrId("txt_certificate_manager_list_device_certificates")); listCertView->addItem(authcert.get()); authcert.release(); @@ -87,8 +87,8 @@ devicecert.release(); connect(listCertView, SIGNAL(released(QModelIndex)), this, SLOT(displayCert(QModelIndex))); - - HbListWidget* listSecView = q_check_ptr(new HbListWidget(this)); + + HbListWidget* listSecView = q_check_ptr(new HbListWidget(this)); QMap keystoreLabels; RDEBUG("0", 0); try @@ -103,7 +103,7 @@ HbMessageBox::information(error); QT_RETHROW; } - + QMapIterator labelIter(keystoreLabels); if(keystoreLabels.count() != 0) { @@ -116,8 +116,8 @@ listSecView->addItem(widget.get()); widget.release(); } - connect(listSecView, SIGNAL(activated(QModelIndex)), this, SLOT(showCodeView(QModelIndex))); - connect(listSecView, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF))); + connect(listSecView, SIGNAL(activated(QModelIndex)), this, SLOT(showCodeView(QModelIndex))); + connect(listSecView, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF))); } else { @@ -133,23 +133,23 @@ certificatesList->setCollapsed(true); layout->addItem(certificatesList.get()); certificatesList.release(); - + std::auto_ptr protectedContentList(q_check_ptr(new HbGroupBox())); protectedContentList->setHeading("Protected Content"); protectedContentList->setCollapsed(true); layout->addItem(protectedContentList.get()); protectedContentList.release(); - + std::auto_ptr securityModuleList(q_check_ptr(new HbGroupBox())); securityModuleList->setHeading("Security Module"); securityModuleList->setContentWidget(listSecView); securityModuleList->setCollapsed(true); layout->addItem(securityModuleList.get()); securityModuleList.release(); - + mContextMenu = q_check_ptr(new HbMenu()); - - setLayout(layout.get()); + + setLayout(layout.get()); layout.release(); } @@ -160,24 +160,24 @@ { mSecModView->deleteLater(); } - + if(mPreView) { mPreView->deleteLater(); } - + if(mCertView) { mCertView->deleteLater(); } - + if(mCurrentView) { mCurrentView->deleteLater(); } - - delete mSecModUIModel; - + + delete mSecModUIModel; + delete mNote; delete mContextMenu; } @@ -187,7 +187,7 @@ RDEBUG("0", 0); try { - mSecModView = q_check_ptr(new CpSecModView(mPos, *mSecModUIModel)); + mSecModView = q_check_ptr(new CpSecModView(mPos, *mSecModUIModel)); QObject::connect(mSecModView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); mPreView = mainWindow()->currentView(); //suppose mPreView is member variable of CpSecurityView mainWindow()->addView(mSecModView); @@ -202,7 +202,7 @@ void CpSecurityView::showCodeView( const QModelIndex& aModelIndex) { mPos = aModelIndex.row(); - showCodeView(); + showCodeView(); } void CpSecurityView::showWIMview() @@ -213,7 +213,7 @@ QObject::connect(mSecModView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); mPreView = mainWindow()->currentView(); //suppose mPreView is member variable of CpSecurityView mainWindow()->addView(mSecModView); - mainWindow()->setCurrentView(mSecModView); + mainWindow()->setCurrentView(mSecModView); } catch(const std::exception& exception) { @@ -221,11 +221,11 @@ } } -void CpSecurityView::viewDone() +void CpSecurityView::viewDone() { try { - mainWindow()->removeView(mSecModView); + mainWindow()->removeView(mSecModView); mSecModView->deleteLater(); mSecModView= NULL; mainWindow()->setCurrentView(mPreView); @@ -241,9 +241,9 @@ RDEBUG("0", 0); try { - mCertView = q_check_ptr(new CpCertView(modelIndex)); + mCertView = q_check_ptr(new CpCertView(modelIndex)); connect(mCertView , SIGNAL(aboutToClose()), this, SLOT(displayPrevious())); - mPreView = mainWindow()->currentView(); + mPreView = mainWindow()->currentView(); mainWindow()->addView(mCertView); mainWindow()->setCurrentView(mCertView); } @@ -253,12 +253,12 @@ } } -void CpSecurityView::displayPrevious() +void CpSecurityView::displayPrevious() { RDEBUG("0", 0); try { - mainWindow()->removeView(mCertView); + mainWindow()->removeView(mCertView); mCertView->deleteLater(); mCertView= NULL; mainWindow()->setCurrentView(mPreView); @@ -275,26 +275,26 @@ try { mContextMenu->clearActions(); - mPos = item->modelIndex().row(); - - std::auto_ptr openModule(q_check_ptr(new HbAction("Open"))); - connect(openModule.get(), SIGNAL(triggered()), this, SLOT( showCodeView())); + mPos = item->modelIndex().row(); + + std::auto_ptr openModule(q_check_ptr(new HbAction("Open"))); + connect(openModule.get(), SIGNAL(triggered()), this, SLOT( showCodeView())); mContextMenu->addAction(openModule.get()); openModule.release(); - + if(mSecModUIModel->IsTokenDeletable(mPos)) { - std::auto_ptr deleteModule(q_check_ptr(new HbAction("Delete"))); - connect(deleteModule.get(), SIGNAL(triggered()), this, SLOT( deleteModule())); + std::auto_ptr deleteModule(q_check_ptr(new HbAction("Delete"))); + connect(deleteModule.get(), SIGNAL(triggered()), this, SLOT( deleteModule())); mContextMenu->addAction(deleteModule.get()); deleteModule.release(); } - - std::auto_ptr moduleInfo(q_check_ptr(new HbAction("Module Info"))); - connect(moduleInfo.get(), SIGNAL(triggered()), this, SLOT( moduleDetails())); + + std::auto_ptr moduleInfo(q_check_ptr(new HbAction("Module Info"))); + connect(moduleInfo.get(), SIGNAL(triggered()), this, SLOT( moduleDetails())); mContextMenu->addAction(moduleInfo.get()); moduleInfo.release(); - + mContextMenu->setPreferredPos(coords); mContextMenu->open(); } @@ -309,15 +309,18 @@ RDEBUG("0", 0); try { - + delete mNote; mNote = NULL; - + mNote = new HbMessageBox(HbMessageBox::MessageTypeQuestion); mNote->setHeadingWidget(q_check_ptr(new HbLabel(tr("Delete...")))); mNote->setText("Delete keystore and password?"); - mNote->setPrimaryAction(q_check_ptr(new HbAction("Yes"))); - mNote->setSecondaryAction(q_check_ptr(new HbAction("No"))); + mNote->clearActions(); + mOkAction = q_check_ptr(new HbAction("Yes")); + mNote->addAction(mOkAction); + HbAction* cancelAction = q_check_ptr(new HbAction("No")); + mNote->addAction(cancelAction); mNote->setTimeout(HbPopup::NoTimeout); mNote->setIconVisible (EFalse); mNote->open(this,SLOT(dialogClosed(HbAction*))); @@ -326,22 +329,22 @@ { HbMessageBox *box = new HbMessageBox(exception.what()); box->setAttribute(Qt::WA_DeleteOnClose); - box->open(); + box->open(); } } void CpSecurityView::dialogClosed(HbAction* action) { RDEBUG("0", 0); - if (action != mNote->primaryAction()) + if (action != mOkAction) { return; } - + try { QT_TRAP_THROWING(mSecModUIModel->DeleteKeysL(mPos)); - } + } catch(const std::exception& exception) { HbMessageBox *box = new HbMessageBox(exception.what()); @@ -358,9 +361,9 @@ QVector< QPair > securityDetails; QT_TRAP_THROWING(securityDetails = mSecModUIModel->SecModDetailsL(mPos)); mModuleinfoView = q_check_ptr(new CpSecmoduleInfoView(securityDetails)); - + connect(mModuleinfoView , SIGNAL(aboutToClose()), this, SLOT(displayPreviousFromModInfo())); - mPreView = mainWindow()->currentView(); + mPreView = mainWindow()->currentView(); mainWindow()->addView(mModuleinfoView); mainWindow()->setCurrentView(mModuleinfoView); } @@ -370,12 +373,12 @@ } } -void CpSecurityView::displayPreviousFromModInfo() +void CpSecurityView::displayPreviousFromModInfo() { RDEBUG("0", 0); try { - mainWindow()->removeView(mModuleinfoView); + mainWindow()->removeView(mModuleinfoView); mCertView->deleteLater(); mCertView= NULL; mainWindow()->setCurrentView(mPreView); diff -r 25dd1e8b2663 -r 881d92421467 cpsecplugins/devicelockplugin/src/cpdevicelockpluginview.cpp --- a/cpsecplugins/devicelockplugin/src/cpdevicelockpluginview.cpp Fri Sep 03 16:31:27 2010 +0300 +++ b/cpsecplugins/devicelockplugin/src/cpdevicelockpluginview.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -58,6 +58,8 @@ CpDeviceLockPluginView::CpDeviceLockPluginView(QGraphicsItem *parent /*= 0*/) : CpBaseSettingView(0,parent) { + RDEBUG("0", 0); + processingRequest=0; QTranslator *translator = new QTranslator(); QString lang = QLocale::system().name(); QString path = "Z:/resource/qt/translations/"; @@ -81,6 +83,7 @@ HbDataForm *form = qobject_cast (widget()); if (form) { + RDEBUG("0", 0); QGraphicsLinearLayout *layout = new QGraphicsLinearLayout( Qt::Vertical); QList protoTypeList = form->itemPrototypes(); @@ -103,6 +106,7 @@ form->addConnection(lockCodeItem, SIGNAL(clicked()), this, SLOT(onLockCodeClicked())); formModel->appendDataFormItem(lockCodeItem); + RDEBUG("0", 0); //Autolock period mAutolockPeriodItem = new HbDataFormModelItem( @@ -207,6 +211,7 @@ HbLineEdit::Password); mRemoteLockMessageItem->setContentWidgetData("text", "1111"); mRemoteLockMessageItem->setContentWidgetData("readOnly", true); + RDEBUG("0", 0); if (mPrevRemLockData.toString() == hbTrId( "txt_devicelocking_button_remote_on")) @@ -221,7 +226,9 @@ form->setModel(formModel); layout->addItem(form); setLayout(layout); + RDEBUG("0", 0); } + RDEBUG("99", 0x99); } @@ -250,8 +257,10 @@ void CpDeviceLockPluginView::onLockCodeClicked() { Dprint(_L("CpDeviceLockPluginView::onLockCodeClicked()..Enter")); - RDEBUG("0", 0); - mUiSecuSettings->ChangeSecCodeL(); + RDEBUG("processingRequest", processingRequest); + if(!processingRequest) + mUiSecuSettings->ChangeSecCodeL(); + processingRequest=0; Dprint(_L("CpDeviceLockPluginView::onLockCodeClicked()..Exit")); } @@ -268,6 +277,7 @@ { Dprint(_L("CpDeviceLockPluginView::onAutoLockChanged()..Enter")); RDEBUG("index", index); + RDEBUG("processingRequest", processingRequest); if (index != mThemeComboPrevIndex) { //TODO: need to set user entered/selected value @@ -295,7 +305,7 @@ } Dprint(_L("CpDeviceLockPluginView::onAutoLockChanged()..Exit")); - RDEBUG("0", 0); + RDEBUG("99", 0x99); } @@ -311,7 +321,7 @@ void CpDeviceLockPluginView::onLockMessageClicked() { Dprint(_L("CpDeviceLockPluginView::onLockMessageClicked()..Exit")); - RDEBUG("0", 0); + RDEBUG("processingRequest", processingRequest); TBuf remoteLockCode; TBool remoteLockStatus(EFalse); TInt retVal = KErrNone; @@ -352,10 +362,10 @@ void CpDeviceLockPluginView::onAutoTextChanged(const QString& aText) { Dprint(_L("CpDeviceLockPluginView::onAutoTextChanged()..Enter")); - RDEBUG("0", 0); + RDEBUG("processingRequest", processingRequest); //TBool ret = DisplaySecurityDialog(); Dprint(_L("CpDeviceLockPluginView::onAutoTextChanged()..Exit")); - RDEBUG("0", 0); + RDEBUG("99", 0x99); } #endif @@ -371,7 +381,7 @@ { Q_UNUSED(aEndIn); Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..Enter")); - RDEBUG("0", 0); + RDEBUG("processingRequest", processingRequest); HbDataFormModelItem *item = formModel->itemFromIndex(aStartIn); if ((item->type() == HbDataFormModelItem::ToggleValueItem) @@ -390,7 +400,7 @@ { mHack++; } - /****************************************************************************************************************/ + ****************************************************************************************************************/ TInt autoLockVal; TInt retVal = KErrNone; TBuf remoteLockCode; @@ -423,17 +433,18 @@ { if (remoteLockSetting->SetEnabledL(remoteLockCode)) { - Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetEnabledL success")); + RDEBUG("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetEnabledL success",1); RDEBUG("success", 1); mPrevRemLockData = mDeviceRemoteLockItem->contentWidgetData( QString("text")); - mRemoteLockMessageItem->setEnabled(true); + RDEBUG("calling setEnabled", 0); + mRemoteLockMessageItem->setEnabled(true); } else { RollbackRemoteLockSettingState(); - Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetEnabledL failed")); + RDEBUG("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetEnabledL failed",0); RDEBUG("failed", 0); } } @@ -441,16 +452,18 @@ { if (mRemoteLockSettings->SetDisabled()) { - Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetDisabled success")); + RDEBUG("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetDisabled success",1); RDEBUG("success", 1); mPrevRemLockData = mDeviceRemoteLockItem->contentWidgetData( QString("text")); + RDEBUG("calling setEnabled", 0); + mRemoteLockMessageItem->setEnabled(false); // this calls onSIMLockDataChanged ? } else { RollbackRemoteLockSettingState(); - Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetDisabled failed")); + RDEBUG("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetDisabled failed",0); RDEBUG("failed", 0); } } @@ -464,7 +477,7 @@ delete remoteLockSetting; } Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..Exit")); - RDEBUG("0", 0); + RDEBUG("99", 0x99); } @@ -480,6 +493,7 @@ void CpDeviceLockPluginView::onSIMLockDataChanged(QModelIndex aStartIn, QModelIndex aEndIn) { Q_UNUSED(aEndIn); + RDEBUG("processingRequest", processingRequest); HbDataFormModelItem *item = formModel->itemFromIndex(aStartIn); if ((item->type() == HbDataFormModelItem::ToggleValueItem) @@ -489,7 +503,7 @@ { RDEBUG("mHack", mHack); //The following If-Else condition should be removed once orbit team fix the issue with datachanged() signal - /****************************************************************************************************************/ + /**************************************************************************************************************** if ((mHack % 2) == 0) //need to capture second datachanged() signal , not first one. { mHack++; @@ -499,7 +513,7 @@ { mHack++; } - /****************************************************************************************************************/ + ****************************************************************************************************************/ TBool ret = mUiSecuSettings->ChangeSimSecurityL(); RDEBUG("ret", ret); @@ -529,6 +543,11 @@ this, SLOT(onSIMLockDataChanged(QModelIndex,QModelIndex))); } } + else + { + RDEBUG("Nothing to do", 0); + } + RDEBUG("99", 0x99); } @@ -639,10 +658,12 @@ connect(formModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(onRemoteLockDataChanged(QModelIndex,QModelIndex))); + RDEBUG("0", 0); if (mPrevRemLockData.toString() == hbTrId( "txt_devicelocking_button_remote_on")) mRemoteLockMessageItem->setEnabled(true); else mRemoteLockMessageItem->setEnabled(false); - RDEBUG("0", 0); + RDEBUG("99", 0x99); } + \ No newline at end of file diff -r 25dd1e8b2663 -r 881d92421467 cpsecplugins/devicelockplugin/src/cpdevicelockpluginview.h --- a/cpsecplugins/devicelockplugin/src/cpdevicelockpluginview.h Fri Sep 03 16:31:27 2010 +0300 +++ b/cpsecplugins/devicelockplugin/src/cpdevicelockpluginview.h Tue Sep 28 14:03:54 2010 +0300 @@ -95,6 +95,7 @@ * Need to remove this variabl once fix available from orbit team */ TInt mHack; + TInt processingRequest; }; #endif diff -r 25dd1e8b2663 -r 881d92421467 cpsecplugins/devicelockplugin/src/cpremotelockdataformviewitem.cpp --- a/cpsecplugins/devicelockplugin/src/cpremotelockdataformviewitem.cpp Fri Sep 03 16:31:27 2010 +0300 +++ b/cpsecplugins/devicelockplugin/src/cpremotelockdataformviewitem.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -19,7 +19,7 @@ #include #include #include <../../inc/cpsecplugins.h> - +#include /* ***************************************************************** @@ -116,6 +116,12 @@ CpLockEdit::CpLockEdit(const QString &text, QGraphicsItem *parent /*= 0*/) : HbLineEdit(text,parent) { + RDEBUG("0", 0); + grabGesture(Qt::TapGesture); + grabGesture(Qt::PanGesture); + grabGesture(Qt::PinchGesture); + grabGesture(Qt::SwipeGesture); + } @@ -144,6 +150,11 @@ void CpLockEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) { RDEBUG("0", 0); + RDEBUG("Nothing to do because QTapGesture did it", 0); + event->ignore(); + return; + + /* if (event->button() != Qt::LeftButton) { event->ignore(); return; @@ -155,5 +166,21 @@ } else { event->ignore(); - } + } + */ } + +void CpLockEdit::gestureEvent(QGestureEvent *event) +{ + RDEBUG("0", 0); + if (QTapGesture *tap = (QTapGesture*)event->gesture(Qt::TapGesture)) { + switch(tap->state()) { + case Qt::GestureStarted: + RDEBUG("0", 0); + emit clicked(); + break; + default: + break; + } + } +} diff -r 25dd1e8b2663 -r 881d92421467 cpsecplugins/devicelockplugin/src/cpremotelockdataformviewitem.h --- a/cpsecplugins/devicelockplugin/src/cpremotelockdataformviewitem.h Fri Sep 03 16:31:27 2010 +0300 +++ b/cpsecplugins/devicelockplugin/src/cpremotelockdataformviewitem.h Tue Sep 28 14:03:54 2010 +0300 @@ -55,6 +55,13 @@ virtual ~CpLockEdit(); /* handles mouse events*/ void mousePressEvent(QGraphicsSceneMouseEvent *event); +protected: + /* + Reimplemented from HbWidgetBase. Called by the framework when + a gesture event has been received. + @param event The received event + */ + void gestureEvent(QGestureEvent *event); signals: /* signal when edit box is clicked*/ void clicked(); diff -r 25dd1e8b2663 -r 881d92421467 cpsecplugins/simpincodeplugin/inc/seccodeedit.h --- a/cpsecplugins/simpincodeplugin/inc/seccodeedit.h Fri Sep 03 16:31:27 2010 +0300 +++ b/cpsecplugins/simpincodeplugin/inc/seccodeedit.h Tue Sep 28 14:03:54 2010 +0300 @@ -31,6 +31,13 @@ virtual ~SecCodeEdit(); void mousePressEvent(QGraphicsSceneMouseEvent *event); +protected: + /* + Reimplemented from HbWidgetBase. Called by the framework when + a gesture event has been received. + @param event The received event + */ + void gestureEvent(QGestureEvent *event); signals: void clicked(); }; diff -r 25dd1e8b2663 -r 881d92421467 cpsecplugins/simpincodeplugin/src/seccodeedit.cpp --- a/cpsecplugins/simpincodeplugin/src/seccodeedit.cpp Fri Sep 03 16:31:27 2010 +0300 +++ b/cpsecplugins/simpincodeplugin/src/seccodeedit.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -21,6 +21,7 @@ // User includes #include "seccodeedit.h" #include <../../inc/cpsecplugins.h> +#include // ======== MEMBER FUNCTIONS ======== @@ -45,6 +46,10 @@ void SecCodeEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) { RDEBUG("0", 0); + RDEBUG("Nothing to do because QTapGesture did it", 0); + event->ignore(); + return; + /* if (event->button() != Qt::LeftButton) { event->ignore(); return; @@ -56,4 +61,20 @@ } else { event->ignore(); } + */ } + +void SecCodeEdit::gestureEvent(QGestureEvent *event) +{ + RDEBUG("0", 0); + if (QTapGesture *tap = (QTapGesture*)event->gesture(Qt::TapGesture)) { + switch(tap->state()) { + case Qt::GestureStarted: + RDEBUG("0", 0); + emit clicked(); + break; + default: + break; + } + } +} diff -r 25dd1e8b2663 -r 881d92421467 gba/gba.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gba/gba.pro Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,20 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description:gba project file +# + +TEMPLATE = subdirs + +SUBDIRS += gbaapi_qt/gbautility_qt.pro + diff -r 25dd1e8b2663 -r 881d92421467 gba/gbaapi_qt/bwins/gbautilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gba/gbaapi_qt/bwins/gbautilityu.def Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,18 @@ +EXPORTS + ?bootstrap@GbaUtility@@QAE?AW4GbaErrorStatus@1@PBUGbaBootstrapInputData@@PAUGbaBootstrapOutputData@@@Z @ 1 NONAME ; enum GbaUtility::GbaErrorStatus GbaUtility::bootstrap(struct GbaBootstrapInputData const *, struct GbaBootstrapOutputData *) + ??0GbaUtility@@QAE@PAVQObject@@@Z @ 2 NONAME ; GbaUtility::GbaUtility(class QObject *) + ?trUtf8@GbaUtility@@SA?AVQString@@PBD0H@Z @ 3 NONAME ; class QString GbaUtility::trUtf8(char const *, char const *, int) + ?trUtf8@GbaUtility@@SA?AVQString@@PBD0@Z @ 4 NONAME ; class QString GbaUtility::trUtf8(char const *, char const *) + ?qt_metacall@GbaUtility@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 5 NONAME ; int GbaUtility::qt_metacall(enum QMetaObject::Call, int, void * *) + ??1GbaUtility@@UAE@XZ @ 6 NONAME ; GbaUtility::~GbaUtility(void) + ??_EGbaUtility@@UAE@I@Z @ 7 NONAME ; GbaUtility::~GbaUtility(unsigned int) + ?bootstrapCompleted@GbaUtility@@IAEXW4GbaErrorStatus@1@@Z @ 8 NONAME ; void GbaUtility::bootstrapCompleted(enum GbaUtility::GbaErrorStatus) + ?qt_metacast@GbaUtility@@UAEPAXPBD@Z @ 9 NONAME ; void * GbaUtility::qt_metacast(char const *) + ?tr@GbaUtility@@SA?AVQString@@PBD0@Z @ 10 NONAME ; class QString GbaUtility::tr(char const *, char const *) + ?getStaticMetaObject@GbaUtility@@SAABUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const & GbaUtility::getStaticMetaObject(void) + ?setBsfAddress@GbaUtility@@QAE?AW4GbaErrorStatus@1@ABVQString@@@Z @ 12 NONAME ; enum GbaUtility::GbaErrorStatus GbaUtility::setBsfAddress(class QString const &) + ?cancelBootstrap@GbaUtility@@QAEXXZ @ 13 NONAME ; void GbaUtility::cancelBootstrap(void) + ?staticMetaObject@GbaUtility@@2UQMetaObject@@B @ 14 NONAME ; struct QMetaObject const GbaUtility::staticMetaObject + ?metaObject@GbaUtility@@UBEPBUQMetaObject@@XZ @ 15 NONAME ; struct QMetaObject const * GbaUtility::metaObject(void) const + ?tr@GbaUtility@@SA?AVQString@@PBD0H@Z @ 16 NONAME ; class QString GbaUtility::tr(char const *, char const *, int) + diff -r 25dd1e8b2663 -r 881d92421467 gba/gbaapi_qt/eabi/gbautilityu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gba/gbaapi_qt/eabi/gbautilityu.def Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,18 @@ +EXPORTS + _ZN10GbaUtility11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN10GbaUtility11qt_metacastEPKc @ 2 NONAME + _ZN10GbaUtility13setBsfAddressERK7QString @ 3 NONAME + _ZN10GbaUtility15cancelBootstrapEv @ 4 NONAME + _ZN10GbaUtility16staticMetaObjectE @ 5 NONAME DATA 16 + _ZN10GbaUtility18bootstrapCompletedENS_14GbaErrorStatusE @ 6 NONAME + _ZN10GbaUtility19getStaticMetaObjectEv @ 7 NONAME + _ZN10GbaUtility9bootstrapEPK21GbaBootstrapInputDataP22GbaBootstrapOutputData @ 8 NONAME + _ZN10GbaUtilityC1EP7QObject @ 9 NONAME + _ZN10GbaUtilityC2EP7QObject @ 10 NONAME + _ZN10GbaUtilityD0Ev @ 11 NONAME + _ZN10GbaUtilityD1Ev @ 12 NONAME + _ZN10GbaUtilityD2Ev @ 13 NONAME + _ZNK10GbaUtility10metaObjectEv @ 14 NONAME + _ZTI10GbaUtility @ 15 NONAME + _ZTV10GbaUtility @ 16 NONAME + diff -r 25dd1e8b2663 -r 881d92421467 gba/gbaapi_qt/gbautility_qt.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gba/gbaapi_qt/gbautility_qt.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utility to perform GBA bootstrapping operation. +*/ + +#include "gbautilitybody.h" + +GbaUtility::GbaUtility(QObject *parent) : QObject(parent) +{ +#ifdef Q_OS_SYMBIAN + QT_TRAP_THROWING(gbaUtilityBody = CGbaUtilityBody::NewL(this)); +#else + gbaUtilityBody = CGbaUtilityBody::NewL(this); +#endif +} + +GbaUtility::~GbaUtility() +{ + delete gbaUtilityBody; +} + +GbaUtility::GbaErrorStatus GbaUtility::bootstrap(const GbaBootstrapInputData *gbainputdata, GbaBootstrapOutputData *gbaoutputdata) +{ + return gbaUtilityBody->bootstrap(gbainputdata, gbaoutputdata); +} + +void GbaUtility::cancelBootstrap() +{ + gbaUtilityBody->cancelBootstrap(); +} + +GbaUtility::GbaErrorStatus GbaUtility::setBsfAddress(const QString &bsfaddress) +{ + return gbaUtilityBody->setBsfAddress(bsfaddress); +} + diff -r 25dd1e8b2663 -r 881d92421467 gba/gbaapi_qt/gbautility_qt.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gba/gbaapi_qt/gbautility_qt.pro Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,56 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description:gba project file +# + +TEMPLATE = lib + +QT -= gui + +CONFIG += dll + +DEFINES += BUILD_QTGBA_DLL + +TARGET = gbautility + +LIBS += -lgba2 + +MOC_DIR = . + +INCLUDEPATH += . \ + $$MW_LAYER_SYSTEMINCLUDE + +DEPENDPATH += $$INCLUDEPATH + +HEADERS += gbautility_qt.h \ + gbauilityexport.h \ + gbautilitybody.h + +SOURCES += gbautility_qt.cpp \ + gbautilitybody.cpp + +#Symbian specific definitions +DEFINES += SYMBIAN +TARGET.UID2 = 0x10009D8D +TARGET.UID3 = 0x20031E53 +TARGET.EPOCALLOWDLLDATA = 1 +TARGET.CAPABILITY = CAP_CLIENT_DLL + +SYMBIAN_PLATFORMS = DEFAULT + + +symbian*: { + MMP_RULES -= "OPTION_REPLACE ARMCC --export_all_vtbl -D__QT_NOEFFECTMACRO_DONOTUSE" + } + diff -r 25dd1e8b2663 -r 881d92421467 gba/gbaapi_qt/gbautilitybody.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gba/gbaapi_qt/gbautilitybody.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: GBA utility body to perform GBA bootstrapping operation. +*/ + +#include "gbautilitybody.h" + +CGbaUtilityBody* CGbaUtilityBody::NewL(GbaUtility* aGbautility) +{ + CGbaUtilityBody* self = new (ELeave) CGbaUtilityBody(aGbautility); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; +} + +void CGbaUtilityBody::ConstructL() +{ + iGbaUtility = CGbaUtility::NewL(*this); +} + +CGbaUtilityBody::CGbaUtilityBody(GbaUtility* aGbautility) : iQtGbautility(aGbautility) +{ +} + +CGbaUtilityBody::~CGbaUtilityBody() +{ + delete iGbaUtility; +} + +GbaUtility::GbaErrorStatus CGbaUtilityBody::bootstrap(const GbaBootstrapInputData* gbainputdata, GbaBootstrapOutputData* gbaoutputdata) +{ + iGbaOutPutData = gbaoutputdata; + iInputGbaParameters.iNAFName.Copy(reinterpret_cast(gbainputdata->nafName.toAscii().data()) + , gbainputdata->nafName.toAscii().length()); + iInputGbaParameters.iFlags = gbainputdata->bootstrapFlag; + iInputGbaParameters.iUICCLabel.Copy(reinterpret_cast(gbainputdata->uiccLabel.toAscii().data()) + , gbainputdata->uiccLabel.toAscii().length()); + iInputGbaParameters.iProtocolIdentifier.Copy(reinterpret_cast(gbainputdata->protocolIdentifier.toAscii().data()) + , gbainputdata->protocolIdentifier.toAscii().length()); + iInputGbaParameters.iAPID = gbainputdata->accessPoint; + TInt error = iGbaUtility->Bootstrap( iInputGbaParameters, iOutputGbaParameters ); + if(error != KErrNone) { + if (error == KErrInUse) + return GbaUtility::GbaErrorInUse; + else if (error == KErrGeneral) + return GbaUtility::GbaErrorGeneral; + } + return GbaUtility::GbaNoError; +} + +void CGbaUtilityBody::cancelBootstrap() +{ + iGbaUtility->CancelBootstrap(); +} + +GbaUtility::GbaErrorStatus CGbaUtilityBody::setBsfAddress(const QString& aBsfAddress) +{ + HBufC8*bsfAddress = HBufC8::NewL(aBsfAddress.toAscii().length()); + bsfAddress->Des().Copy(reinterpret_cast(aBsfAddress.toAscii().data()), aBsfAddress.toAscii().length()); + TInt error = iGbaUtility->SetBSFAddress(bsfAddress->Des()); + delete bsfAddress; + if (error != KErrNone) { + if (error == KErrPermissionDenied) + return GbaUtility::GbaErrorPermissionDenied; + else + return GbaUtility::GbaErrorGeneral; + } + return GbaUtility::GbaNoError; +} + +void CGbaUtilityBody::BootstrapComplete(TInt aError) +{ + if (aError != KErrNone) { + emit iQtGbautility->bootstrapCompleted(GbaUtility::GbaErrorBootstrapFailed); + return; + } + // Output: B-TID + iGbaOutPutData->bTid = QString::fromAscii(reinterpret_cast(iOutputGbaParameters.iBTID.Ptr()) + ,iOutputGbaParameters.iBTID.Length()); + // Output: Ks_NAFs + QByteArray ksNaf; + ksNaf.append(reinterpret_cast(iOutputGbaParameters.iKNAF.Ptr())); + iGbaOutPutData->ksNaf = ksNaf; + // Output: lifetime + QTime time(iOutputGbaParameters.iLifetime.DateTime().Hour() + ,iOutputGbaParameters.iLifetime.DateTime().Minute() + ,iOutputGbaParameters.iLifetime.DateTime().Second() + ,0/*milli seconds component*/); + QDate date(iOutputGbaParameters.iLifetime.DateTime().Year() + ,iOutputGbaParameters.iLifetime.DateTime().Month() + ,iOutputGbaParameters.iLifetime.DateTime().Day()); + iGbaOutPutData->lifetime.setDate(date); + iGbaOutPutData->lifetime.setTime(time); + // Output: IMPI + iGbaOutPutData->impi = QString::fromAscii(reinterpret_cast(iOutputGbaParameters.iKIMPI.Ptr()) + ,iOutputGbaParameters.iKIMPI.Length()); + // Output: GBA run-type + switch (iOutputGbaParameters.iGbaRunType) { + case E2GGBA: + iGbaOutPutData->gbaRunType = RunType2gGba; + break; + case E3GGBAME: + iGbaOutPutData->gbaRunType = RunType3gGbaMe; + break; + case EGBAU: + iGbaOutPutData->gbaRunType = RunType3gGbaU; + break; + case ENoType: + iGbaOutPutData->gbaRunType = RunTypeNone; + break; + default: + break; + } + // Output: type of UICC application used + iGbaOutPutData->uiccLabel = QString::fromAscii(reinterpret_cast(iOutputGbaParameters.iOutputUICCLabel.Ptr()) + ,iOutputGbaParameters.iOutputUICCLabel.Length()); + emit iQtGbautility->bootstrapCompleted(GbaUtility::GbaNoError); +} + diff -r 25dd1e8b2663 -r 881d92421467 gba/gbaapi_qt/gbautilitybody.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gba/gbaapi_qt/gbautilitybody.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: GBA utility body to perform GBA bootstrapping operation. +*/ + +#ifndef GBAUTILITYBODY_H +#define GBAUTILITYBODY_H +#include +#include +#include + +// CLASS DECLARATION +class CGbaUtilityBody : public CBase, + public MGbaObserver +{ +public: + + static CGbaUtilityBody* NewL(GbaUtility *aGbautility); + + //Destructor + virtual ~CGbaUtilityBody(); + + /*Bootstapping function*/ + GbaUtility::GbaErrorStatus bootstrap(const GbaBootstrapInputData *gbainputdata, GbaBootstrapOutputData *gbaoutputdata); + + //Cancel any outstanding bootstapping process + void cancelBootstrap(); + + //set the bsf address in the local cache,which would be used while bootstrapping + GbaUtility::GbaErrorStatus setBsfAddress(const QString &aBsfaddress); + + //MGbaObserver + void BootstrapComplete(TInt aError); +private: + // Constructor + CGbaUtilityBody(GbaUtility *aGbautility); + + void ConstructL(); + +private: + CGbaUtility *iGbaUtility; + TGBABootstrapInputParams iInputGbaParameters; + TGBABootstrapOutputParams iOutputGbaParameters; + GbaBootstrapOutputData *iGbaOutPutData; + GbaUtility *iQtGbautility; +}; + +#endif //GBAUTILITYBODY_H +//EOF diff -r 25dd1e8b2663 -r 881d92421467 gba/rom/gba.iby --- a/gba/rom/gba.iby Fri Sep 03 16:31:27 2010 +0300 +++ b/gba/rom/gba.iby Tue Sep 28 14:03:54 2010 +0300 @@ -23,6 +23,7 @@ FILE=ABI_DIR\BUILD_DIR\gba2.dll SHARED_LIB_DIR\gba2.dll +FILE=ABI_DIR\BUILD_DIR\gbautility.dll SHARED_LIB_DIR\gbautility.dll FILE=ABI_DIR\BUILD_DIR\gbaserver2.exe PROGRAMS_DIR\gbaserver2.exe data=ZSYSTEM\install\gba_stub.sis System\Install\gba_stub.sis diff -r 25dd1e8b2663 -r 881d92421467 gba/sis/gba.pkg --- a/gba/sis/gba.pkg Fri Sep 03 16:31:27 2010 +0300 +++ b/gba/sis/gba.pkg Tue Sep 28 14:03:54 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Header -#{"GBA"},(0x20029F08), 1, 1, 0, TYPE=SA,RU +#{"GBA"},(0x20029F08), 1, 2, 0, TYPE=SA,RU ; Localised Vendor name %{"Nokia"} @@ -36,6 +36,7 @@ "\epoc32\release\armv5\urel\gbauicc2.dll" -"!:\sys\bin\gbauicc2.dll" "\epoc32\data\z\resource\plugins\gbauicc2.rsc" -"!:\resource\plugins\gbauicc2.rsc" "\epoc32\release\armv5\urel\gba2.dll" -"!:\sys\bin\gba2.dll" +"\epoc32\release\armv5\urel\gbautility.dll" -"!:\sys\bin\gbautility.dll" "\epoc32\release\armv5\urel\httpfiltergba2.dll" -"!:\sys\bin\httpfiltergba2.dll" "\epoc32\data\z\resource\plugins\httpfiltergba2.rsc" -"!:\resource\plugins\httpfiltergba2.rsc" diff -r 25dd1e8b2663 -r 881d92421467 gba/sis/gba_stub.pkg --- a/gba/sis/gba_stub.pkg Fri Sep 03 16:31:27 2010 +0300 +++ b/gba/sis/gba_stub.pkg Tue Sep 28 14:03:54 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Header -#{"GBA"}, (0x20029F08), 1, 1, 0, TYPE=SA +#{"GBA"}, (0x20029F08), 1, 2, 0, TYPE=SA ; Localised Vendor name %{"Nokia"} @@ -31,6 +31,7 @@ ""-"z:\sys\bin\gbauicc2.dll" ""-"z:\resource\plugins\gbauicc2.rsc" ""-"z:\sys\bin\gba2.dll" +""-"z:\sys\bin\gbautility.dll" ""-"z:\sys\bin\httpfiltergba2.dll" ""-"z:\resource\plugins\httpfiltergba2.rsc" diff -r 25dd1e8b2663 -r 881d92421467 gba/sis/gba_stub.sis Binary file gba/sis/gba_stub.sis has changed diff -r 25dd1e8b2663 -r 881d92421467 layers.sysdef.xml --- a/layers.sysdef.xml Fri Sep 03 16:31:27 2010 +0300 +++ b/layers.sysdef.xml Tue Sep 28 14:03:54 2010 +0300 @@ -9,6 +9,9 @@ + + + diff -r 25dd1e8b2663 -r 881d92421467 package_definition.xml --- a/package_definition.xml Fri Sep 03 16:31:27 2010 +0300 +++ b/package_definition.xml Tue Sep 28 14:03:54 2010 +0300 @@ -2,209 +2,212 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff -r 25dd1e8b2663 -r 881d92421467 pkiutilities/Certificates/group/bld.inf --- a/pkiutilities/Certificates/group/bld.inf Fri Sep 03 16:31:27 2010 +0300 +++ b/pkiutilities/Certificates/group/bld.inf Tue Sep 28 14:03:54 2010 +0300 @@ -21,8 +21,8 @@ DEFAULT -ARMI PRJ_EXPORTS -../data/certclients.dat /epoc32/release/winscw/udeb/Z/Private/101f72a6/certclients.dat -../data/certclients.dat /epoc32/release/winscw/urel/Z/Private/101f72a6/certclients.dat +../data/certclients.dat /epoc32/release/winscw/udeb/z/Private/101f72a6/certclients.dat +../data/certclients.dat /epoc32/release/winscw/urel/z/Private/101f72a6/certclients.dat ../data/certclients.dat /epoc32/data/z/private/101f72a6/certclients.dat diff -r 25dd1e8b2663 -r 881d92421467 pkiutilities/group/bld.inf --- a/pkiutilities/group/bld.inf Fri Sep 03 16:31:27 2010 +0300 +++ b/pkiutilities/group/bld.inf Tue Sep 28 14:03:54 2010 +0300 @@ -31,7 +31,6 @@ // export iby files ../rom/x509certnameparser.iby CORE_MW_LAYER_IBY_EXPORT_PATH( x509certnameparser.iby ) ../rom/pkcs12.iby CORE_MW_LAYER_IBY_EXPORT_PATH( pkcs12.iby ) -../rom/certmanui_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( certmanui_resources.iby ) // needed by CTSecurityDialogs ../rom/CertSaver.iby CORE_MW_LAYER_IBY_EXPORT_PATH( CertSaver.iby ) ../rom/CertSaver_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( CertSaver_resources.iby ) ../rom/DevToken.iby CORE_MW_LAYER_IBY_EXPORT_PATH( DevToken.iby ) diff -r 25dd1e8b2663 -r 881d92421467 pkiutilities/ocsp/group/bld.inf --- a/pkiutilities/ocsp/group/bld.inf Fri Sep 03 16:31:27 2010 +0300 +++ b/pkiutilities/ocsp/group/bld.inf Tue Sep 28 14:03:54 2010 +0300 @@ -22,18 +22,6 @@ DEFAULT PRJ_EXPORTS -// specify the source file followed by its destination here -// copy will be used to copy the source file to its destination -// If there's no destination then the source file will be copied -// to the same name in /epoc32/include - -../inc/ocsppolicy.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(ocsppolicy.h) -../inc/ocsp_v2.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(ocsp.h) -../inc/ocsptransport_v2.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(ocsptransport.h) -../inc/ocsprequestandresponse.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(ocsprequestandresponse.h) - -// ROMKIT includes -../inc/ocsp.iby /epoc32/rom/include/ocsp.iby PRJ_MMPFILES @@ -42,8 +30,6 @@ #ifndef WINC -ocspcommon.mmp -ocsp.mmp ../transport/ocsptransport.mmp #endif // WINC diff -r 25dd1e8b2663 -r 881d92421467 pkiutilities/ocsp/group_ncp/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/ocsp/group_ncp/bld.inf Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,52 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: Online Certificate Status Protocol ( OCSP ) +// +// + +/** + @file +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include + +../inc/ocsppolicy.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(ocsppolicy.h) +../inc/ocsp_v2.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(ocsp.h) +../inc/ocsptransport_v2.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(ocsptransport.h) +../inc/ocsprequestandresponse.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(ocsprequestandresponse.h) + +// ROMKIT includes +../inc/ocsp.iby /epoc32/rom/include/ocsp.iby +../inc/ocsp_ncp.iby /epoc32/rom/include/ocsp_ncp.iby + +PRJ_MMPFILES + +#ifndef TOOLS +#ifndef TOOLS2 + + +#ifndef WINC +../group/ocspcommon.mmp +../group/ocsp.mmp +#endif // WINC + +#endif // TOOLS2 +#endif // TOOLS + diff -r 25dd1e8b2663 -r 881d92421467 pkiutilities/ocsp/inc/ocsp.iby --- a/pkiutilities/ocsp/inc/ocsp.iby Fri Sep 03 16:31:27 2010 +0300 +++ b/pkiutilities/ocsp/inc/ocsp.iby Tue Sep 28 14:03:54 2010 +0300 @@ -20,9 +20,8 @@ // Online Certificate Status Protocol( OCSP ) implementation -file=ABI_DIR\BUILD_DIR\ocsp.dll System\Libs\ocsp.dll +#include file=ABI_DIR\BUILD_DIR\ocsptransport.dll System\Libs\ocsptransport.dll -file=ABI_DIR\BUILD_DIR\ocspcommon.dll System\Libs\ocspcommon.dll #endif diff -r 25dd1e8b2663 -r 881d92421467 pkiutilities/ocsp/inc/ocsp_ncp.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/ocsp/inc/ocsp_ncp.iby Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __OCSP_NCP_IBY__ +#define __OCSP_NCP_IBY__ + +// Online Certificate Status Protocol( OCSP ) implementation + +file=ABI_DIR\BUILD_DIR\ocsp.dll System\Libs\ocsp.dll +file=ABI_DIR\BUILD_DIR\ocspcommon.dll System\Libs\ocspcommon.dll + +#endif + diff -r 25dd1e8b2663 -r 881d92421467 pkiutilities/ocsp/inc/ocsppolicy.h --- a/pkiutilities/ocsp/inc/ocsppolicy.h Fri Sep 03 16:31:27 2010 +0300 +++ b/pkiutilities/ocsp/inc/ocsppolicy.h Tue Sep 28 14:03:54 2010 +0300 @@ -26,7 +26,7 @@ #include // Security settings. -#include +#include #include diff -r 25dd1e8b2663 -r 881d92421467 secsrv_plat/devicelock_access_api/inc/devicelockaccessapi.h --- a/secsrv_plat/devicelock_access_api/inc/devicelockaccessapi.h Fri Sep 03 16:31:27 2010 +0300 +++ b/secsrv_plat/devicelock_access_api/inc/devicelockaccessapi.h Tue Sep 28 14:03:54 2010 +0300 @@ -88,22 +88,25 @@ * @return KErrNone if succeeded * KErrAlreadyExists if already enabled * KErrPermissionDenied if no required capabilities + * Other errors */ IMPORT_C TInt EnableDevicelock( TDevicelockReason aReason = EDevicelockManual ); /** - * Currently not implemented ! - * Offer to enable devicelock. Shows a query note to user. + * Offer to enable devicelock. Shows a query note to user, and then a unlock-query. + * @return KErrNone if succeeded + * KErrAlreadyExists if already enabled + * KErrPermissionDenied if no required capabilities + * Other errors */ IMPORT_C TInt OfferDevicelock( ); /** - * Remove this method eventually! - * - * Disable devicelock. + * Disable devicelock. Shows a unlock-query to user. * @return KErrNone if succeeded * KErrAlreadyExists if already enabled * KErrPermissionDenied if no required capabilities + * Other errors */ IMPORT_C TInt DisableDevicelock( ); diff -r 25dd1e8b2663 -r 881d92421467 secsrv_plat/gba_api/group/bld.inf --- a/secsrv_plat/gba_api/group/bld.inf Fri Sep 03 16:31:27 2010 +0300 +++ b/secsrv_plat/gba_api/group/bld.inf Tue Sep 28 14:03:54 2010 +0300 @@ -26,5 +26,11 @@ ../inc/GbaUtility.h MW_LAYER_PLATFORM_EXPORT_PATH(GbaUtility.h) +../inc/gbautility_qt.h MW_LAYER_PLATFORM_EXPORT_PATH(gbautility_qt.h) +../inc/gbauilityexport.h MW_LAYER_PLATFORM_EXPORT_PATH(gbauilityexport.h) + + + + diff -r 25dd1e8b2663 -r 881d92421467 secsrv_plat/gba_api/inc/gbauilityexport.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/secsrv_plat/gba_api/inc/gbauilityexport.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: dll export flag definition +*/ + +#ifndef GBAUTILITYEXPORT_H +#define GBAUTILITYEXPORT_H + +#if defined(BUILD_QTGBA_DLL) +#define QTGBADLL_EXPORT Q_DECL_EXPORT +#else +#define QTGBADLL_EXPORT Q_DECL_IMPORT +#endif + +#endif //GBAUTILITYEXPORT_H + diff -r 25dd1e8b2663 -r 881d92421467 secsrv_plat/gba_api/inc/gbautility_qt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/secsrv_plat/gba_api/inc/gbautility_qt.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utility to perform GBA bootstrapping operation. +* GBA = Generic Bootstrapping Architecture +* Reference: 3GPP TS 33.220 (version 7.110 Release 7) at http://www.3gpp.org +*/ + +#ifndef GBAUTILITY_QT_H +#define GBAUTILITY_QT_H + +#include +#include +#include +#include + +const QString gUsim = "USIM"; +const QString gSim = "SIM"; +const QString gIsim = "ISIM"; // Currently not supported. + +enum GbaBootstrapFlag { + // Default bootstrap: use the cached credentials if they have not expired. + DefaultBootstrap = 0, + // Do not use cached credentials, instead force bootstrapping with BSF. + ForceBootstrap +}; + +enum GbaRunType { + RunTypeNone = 0, + RunType2gGba, // 2G GBA: GBA-specific functions are carried out in the ME. + RunType3gGbaMe, // 3G GBA_ME: GBA-specific functions are carried out in the ME. + RunType3gGbaU // 3G GBA_U: GBA-specific functions are carried out in the UICC. +}; + +// Input data to GBA Bootstrapping operation. +typedef struct +{ + // Input: FQDN (Fully Qualified Domain Name) of NAF + QString nafName; + // Input: DefaultBootstrap or ForceBootstrap + GbaBootstrapFlag bootstrapFlag; + // Input: label of UICC application that user wants to use, gUsim ("USIM") for example; + // default UICC application is used if the label is empty. + QString uiccLabel; // Currently not supported. + // Input: security protocol identifier appended to NAF Name for key derivation + QString protocolIdentifier; + // Input: identifier of preferred internet access point for bootstrap; + // set -1 to use the default access point. + qint32 accessPoint; +} GbaBootstrapInputData; + +// Output data (credentials) from GBA Bootstrapping operation. +typedef struct +{ + // Output: B-TID + QString bTid; + // Output: Ks_NAF + QByteArray ksNaf; + // Output: lifetime + QDateTime lifetime; + // Output: IMPI + QString impi; // Currently not supported. + // Output: GBA run-type + GbaRunType gbaRunType; + // Output: type of UICC application used + QString uiccLabel; +} GbaBootstrapOutputData; + + +class CGbaUtilityBody; + + +// API class for GBA Bootstrapping operation. +class QTGBADLL_EXPORT GbaUtility : public QObject +{ + Q_OBJECT + +public: + enum GbaErrorStatus { + GbaNoError = 0, // No error; operation is successful. + GbaErrorGeneral, // Error: general error. + GbaErrorArgument, // Error: wrong argument value in method call. + GbaErrorInUse, // Error: an outstanding bootstrap request is in place. + GbaErrorPermissionDenied, // Error: permission to execute the operation is denied, e.g., + // due to application not having enough security capability. + GbaErrorNetworkConnection, // Error: error in network connection. + GbaErrorBootstrapFailed // Error: bootstrapping with BSF has failed. + }; + + GbaUtility(QObject *parent = 0); + + virtual ~GbaUtility(); + + // Perform GBA Bootstrapping operation. This is an asynchronous method and the "bootstrapCompleted" signal + // will be sent with a success or failure indication when the operation is completed. + // Only one Bootstrapping operation can be performed at a time. + // On Symbian platform, application needs to have "ReadDeviceData" capability + // for this method call to be successful. + GbaErrorStatus bootstrap(const GbaBootstrapInputData *input, GbaBootstrapOutputData *output); + + // Cancel the current Bootstrapping operation. + // The "bootstrapCompleted" signal will not be sent after cancellation. + void cancelBootstrap(); + + // Set BSF address. The BSF address set by this method will overwrite the one calculated from IMPI. + // On Symbian platform, application needs to have "WriteDeviceData" capability + // for this method call to be successful. + GbaErrorStatus setBsfAddress(const QString &bsfAddress); + +signals: + // Signal to indicate that GBA Bootstrapping operation has completed. + // The parameter "status" indicates the success or failure of the operation. + // If it is successful, the output data (credentials) of the operation are returned in + // the "GbaBootstrapOutputData" structure that application passed in the previous "bootstrap" method call. + void bootstrapCompleted(GbaUtility::GbaErrorStatus status); + +private: + CGbaUtilityBody *gbaUtilityBody; + +private: // Friend class definitions + friend class CGbaUtilityBody; +}; + +#endif // GBAUTILITY_QT_H +// EOF diff -r 25dd1e8b2663 -r 881d92421467 secsrv_plat/keyguard_access_api/inc/keyguardaccessapi.h --- a/secsrv_plat/keyguard_access_api/inc/keyguardaccessapi.h Fri Sep 03 16:31:27 2010 +0300 +++ b/secsrv_plat/keyguard_access_api/inc/keyguardaccessapi.h Tue Sep 28 14:03:54 2010 +0300 @@ -77,6 +77,7 @@ * @return KErrNone if succeeded * KErrAlreadyExists if already enabled * KErrPermissionDenied if devicelock is activated + * Other errors */ IMPORT_C TInt EnableKeyguard( TBool aWithNote ); @@ -86,6 +87,7 @@ * @return KErrNone if succeeded * KErrAlreadyExists if already disabled * KErrPermissionDenied if devicelock is activated + * Other errors */ IMPORT_C TInt DisableKeyguard( TBool aWithNote ); @@ -93,14 +95,17 @@ * Offer to enable keyguard. Shows a query note to user. * @return KErrNone if succeeded * KErrPermissionDenied if keyguard/devicelock already activated + * KErrCancel if user replies "No" + * Other errors */ IMPORT_C TInt OfferKeyguard(); /** * Shows note informing that keys are locked. * Only works if keyguard is already enabled. - * @return KErrNone if succeeded ' + * @return KErrNone if succeeded * KErrPermissionDenied if keyguard is not activated + * Other errors */ IMPORT_C TInt ShowKeysLockedNote(); diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/Autolock.pro --- a/securitydialogs/Autolock/Autolock.pro Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/Autolock/Autolock.pro Tue Sep 28 14:03:54 2010 +0300 @@ -40,6 +40,7 @@ LIBS += -lpower_save_display_mode LIBS += -ltstaskmonitorclient # for TsTaskSettings LIBS += -lavkon # for KeySounds +LIBS += -lapgrfx # for CApaWindowGroupName SERVICE.FILE = service_conf.xml SERVICE.OPTIONS = embeddable @@ -54,7 +55,17 @@ symbian*: { TARGET.CAPABILITY = CAP_APPLICATION TARGET.UID3 = 0x100059B5 - crmlFiles.sources = autolock.qcrml + crmlFiles.sources = ./qcrml/autolock.qcrml + crmlFiles.sources += ./qcrml/callstate.qcrml + crmlFiles.sources += ./qcrml/dismissdialog.qcrml + crmlFiles.sources += ./qcrml/grip.qcrml + crmlFiles.sources += ./qcrml/keyguard.qcrml + crmlFiles.sources += ./qcrml/lights.qcrml + crmlFiles.sources += ./qcrml/profile.qcrml + crmlFiles.sources += ./qcrml/screensaver.qcrml + crmlFiles.sources += ./qcrml/securitysettings.qcrml + crmlFiles.sources += ./qcrml/TestCode.qcrml + crmlFiles.path = /resource/qt/crml DEPLOYMENT += crmlFiles } @@ -67,4 +78,6 @@ BLD_INF_RULES.prj_exports += "./rom/AutolockSrv.iby CORE_APP_LAYER_IBY_EXPORT_PATH(AutolockSrv.iby)" BLD_INF_RULES.prj_exports += "./PubSub/SecurityUIsPrivatePSKeys.h |../../inc/securityuisprivatepskeys.h" -BLD_INF_RULES.prj_exports += "./conf/lock_10283322.crml MW_LAYER_CRML(lock_10283322.crml)" \ No newline at end of file +BLD_INF_RULES.prj_exports += "./conf/lock_10283322.crml MW_LAYER_CRML(lock_10283322.crml)" + +symbian:MMP_RULES += SMPSAFE diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/autolock.qcrml --- a/securitydialogs/Autolock/autolock.qcrml Fri Sep 03 16:31:27 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice.pro --- a/securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice.pro Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice.pro Tue Sep 28 14:03:54 2010 +0300 @@ -21,7 +21,7 @@ DEFINES += AUTOLOCKUSERACTIVITYSERVICE_LIB symbian: { -TARGET.UID3 = 0x2002704D +TARGET.UID3 = 0x2002704C LIBS += -lactivitymanager include(autolockuseractivityservice_s60.pri) @@ -30,3 +30,5 @@ } include(autolockuseractivityservice.pri) + +symbian:MMP_RULES += SMPSAFE diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/indicatorplugin/IndicatorAutolockPlugin_installer.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/indicatorplugin/IndicatorAutolockPlugin_installer.pkg Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,30 @@ +; IndicatorAutolockPlugin_installer.pkg generated by qmake at 2010-05-17T09:17:32 +; This file is generated by qmake and should not be modified by the user +; + +; Language +&EN + + +; SIS header: name, uid, version +#{"IndicatorAutolockPlugin installer"},(0xA000D7CE),1,0,0 + +; Localised Vendor name +%{"Vendor"} + +; Unique Vendor name +:"Vendor" + + +; Manual PKG pre-rules from PRO files +; Default dependency to Qt libraries +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + + + +"E:/sf/mw/securitysrv/securitydialogs/Autolock/indicatorplugin/IndicatorAutolockPlugin.sis" - "c:\adm\IndicatorAutolockPlugin.sis" +@"E:/sf/mw/qt/smartinstaller.sis",(0x2002CCCD) diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/indicatorplugin/IndicatorAutolockPlugin_template.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/indicatorplugin/IndicatorAutolockPlugin_template.pkg Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,33 @@ +; IndicatorAutolockPlugin_template.pkg generated by qmake at 2010-05-17T09:17:32 +; This file is generated by qmake and should not be modified by the user +; + +; Language +&EN + + +; SIS header: name, uid, version +#{"IndicatorAutolockPlugin"},(0xEeaa3a61),1,0,0 + +; Localised Vendor name +%{"Vendor"} + +; Unique Vendor name +:"Vendor" + + +; Manual PKG pre-rules from PRO files +; Default dependency to Qt libraries +(0x2001E61C), 4, 6, 3, {"Qt"} +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + + +; DEPLOYMENT +"/epoc32/release/$(PLATFORM)/$(TARGET)/indicatorautolockplugin.dll" - "!:\sys\bin\indicatorautolockplugin.dll" +"/epoc32/data/z/resource/plugins/indicators/indicatorautolockplugin.qtplugin" - "!:\resource\plugins\indicators\indicatorautolockplugin.qtplugin" + +; Manual PKG post-rules from PRO files diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/indicatorplugin/autolockindicators.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/indicatorplugin/autolockindicators.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,67 @@ +/* +* ============================================================================ +* Name : autolockindicators.h +* Part of : hb / +* Description : +* Version : %version: 1 % +* +* Copyright (c) 2009 Nokia. All rights reserved. +* This material, including documentation and any related computer +* programs, is protected by copyright controlled by Nokia. All +* rights are reserved. Copying, including reproducing, storing, +* adapting or translating, any or all of this material requires the +* prior written consent of Nokia. This material also contains +* confidential information which may not be disclosed to others +* without the prior written consent of Nokia. +* ============================================================================ +*/ + +#ifndef AUTOLOCKINDICATORS_H +#define AUTOLOCKINDICATORS_H + +#include +#include +#include + +static const char *IndicatorNameTemplate = "com.nokia.hb.indicator.autolock.autolock_%1/1.0"; + +enum Interaction +{ + InteractionNone, + ChangeContent, + Deactivate, + ChangeOrientation +}; + +inline QString indicatorName(int indicatorType) { + return QString(IndicatorNameTemplate).arg(indicatorType); +} + +struct IndicatorInfo +{ + const char *icon; + const char *iconMono; + const char *primaryText; + const char *secondaryText; + HbIndicatorInterface::Category category; + Interaction interaction; +}; + +Q_DECLARE_METATYPE(IndicatorInfo) + +static const int IndicatorCount = 10; +static const IndicatorInfo IndicatorInfos[IndicatorCount] = { + {"navi_left.svg", "qtg_mono_settings.svg", "Notification indicator 1", "no interaction", HbIndicatorInterface::NotificationCategory, InteractionNone}, + {"qt_prog_bar_play.svg","qtg_status_new_email.svg", "Notification indicator 2", "deactivates, when clicked (additional to test the text truncation.)", HbIndicatorInterface::NotificationCategory, Deactivate}, + {"hb_vol_slider_increment_pressed.svg", "qtg_status_new_email.svg", "Notification indicator 3", "changes content", HbIndicatorInterface::NotificationCategory, ChangeContent}, + {"hb_vol_slider_muted.svg", "qtg_status_new_email.svg", "Notification indicator 4", "changes content, when clicked", HbIndicatorInterface::NotificationCategory, ChangeContent}, + {"qgn_menu_pinb.svg", "qgn_menu_pinb.svg", "Progress indicator 1", "no interaction", HbIndicatorInterface::ProgressCategory, InteractionNone}, + {"qgn_menu_note.svg", "qgn_menu_note.svg", "Progress indicator 2", "changes content, when clicked", HbIndicatorInterface::ProgressCategory, ChangeContent}, + {"note_error.svg", "note_error.svg", "Progress indicator 3", "changes orientation, when clicked", HbIndicatorInterface::ProgressCategory, ChangeOrientation}, + {"note_info.svg", "note_info.svg", "Progress indicator 4", "changes content, when clicked", HbIndicatorInterface::ProgressCategory, ChangeContent}, + {"qtg_large_device_lock.svg", "qtg_large_device_lock.svg", "Keyguard Enabled", "Keyguard Enabled", HbIndicatorInterface::SettingCategory, InteractionNone}, + {"qgn_menu_phob.svg", "qgn_menu_phob.svg", "Devicelock Enabled", "Devicelock Enabled", HbIndicatorInterface::SettingCategory, InteractionNone} +}; + + +#endif // AUTOLOCKINDICATORS_H diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/indicatorplugin/hbindicatorautolockplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/indicatorplugin/hbindicatorautolockplugin.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,220 @@ +/* +* ============================================================================ +* Name : hbindicatorautolockplugin.cpp +* Part of : hb / hbcore +* Description : indicator autolock plugin implementation +* Version : %version: 1 % +* +* Copyright (c) 2009 Nokia. All rights reserved. +* This material, including documentation and any related computer +* programs, is protected by copyright controlled by Nokia. All +* rights are reserved. Copying, including reproducing, storing, +* adapting or translating, any or all of this material requires the +* prior written consent of Nokia. This material also contains +* confidential information which may not be disclosed to others +* without the prior written consent of Nokia. +* ============================================================================ +*/ + +#include +#include +#include +#include +#include + +#include "hbindicatorautolockplugin.h" + +Q_EXPORT_PLUGIN(HbIndicatorAutolockPlugin) + +// Constructor +HbIndicatorAutolockPlugin::HbIndicatorAutolockPlugin() : mError(0) +{ + for (int i = 0; i < IndicatorCount; ++i) { + mIndicatorTypes.append(indicatorName(i)); + } +} + +// Destructor +HbIndicatorAutolockPlugin::~HbIndicatorAutolockPlugin() +{ +} + +// Return notification types this plugin implements +QStringList HbIndicatorAutolockPlugin::indicatorTypes() const +{ + return mIndicatorTypes; +} + +// Check if client is allowed to use notification widget +bool HbIndicatorAutolockPlugin::accessAllowed(const QString &indicatorType, + const QVariantMap &securityInfo) const +{ + Q_UNUSED(indicatorType) + Q_UNUSED(securityInfo) + + // This plugin doesn't perform operations that may compromise security. + // All clients are allowed to use. + return true; +} + +HbIndicatorInterface* HbIndicatorAutolockPlugin::createIndicator( + const QString &indicatorType) +{ + HbIndicatorInterface *indicator = 0; + int index(typeIndex(indicatorType)); + if (index >= 0) { + indicator = new HbAutolockIndicator( + indicatorType, index, IndicatorInfos[index].interaction); + } + return indicator; +} + +int HbIndicatorAutolockPlugin::error() const +{ + return mError; +} + +int HbIndicatorAutolockPlugin::typeIndex(const QString &indicatorType) const +{ + for (int i = 0; i < mIndicatorTypes.count(); ++i) { + if (mIndicatorTypes.at(i) == indicatorType) { + return i; + } + } + return -1; +} + +HbAutolockIndicator::HbAutolockIndicator(const QString &indicatorType, + int typeIndex, + Interaction interaction) : + HbIndicatorInterface(indicatorType, IndicatorInfos[typeIndex].category, + (interaction == InteractionNone) ? NoInteraction : InteractionActivated), + mPrimaryText(IndicatorInfos[typeIndex].primaryText), + mSecondaryText(IndicatorInfos[typeIndex].secondaryText), + mIcon(IndicatorInfos[typeIndex].icon), + mIconMono(IndicatorInfos[typeIndex].iconMono), + mTypeIndex(typeIndex), mInteraction(interaction) +{ +} + +HbAutolockIndicator::~HbAutolockIndicator() +{ +} + +bool HbAutolockIndicator::handleInteraction(InteractionType type) +{ + if (type == InteractionActivated) { + switch(mInteraction) { + case ChangeContent: + mPrimaryText = "Clicked"; + mSecondaryText = "content changed!"; + mIcon = "qtg_mono_ok.svg"; + break; + case Deactivate: + emit deactivate(); + break; + case ChangeOrientation: + qDebug() << "============= HbAutolockIndicator::handleInteraction doesn't react to ChangeOrientation"; + /* + if (hbInstance->orientation() == Qt::Horizontal) { + hbInstance->setOrientation(Qt::Vertical); + } else { + hbInstance->setOrientation(Qt::Horizontal); + } + */ + if (hbInstance->allMainWindows().at(0)->orientation() == Qt::Horizontal) { + hbInstance->allMainWindows().at(0)->setOrientation(Qt::Vertical); + } else { + hbInstance->allMainWindows().at(0)->setOrientation(Qt::Horizontal); + } + break; + default: + return false; + } + emit dataChanged(); + } + return false; +} + +QVariant HbAutolockIndicator::indicatorData(int role) const +{ + if (role == PrimaryTextRole) { + if (mParameter.isValid()) { + qDebug() << "============= HbAutolockIndicator::indicatorData 11="; + qDebug() << QString("data:").append(mParameter.toString()) + .append(" ") + .append(mPrimaryText); + return QString("data:").append(mParameter.toString()) + .append(" ") + .append(mPrimaryText); + } else { + qDebug() << "============= HbAutolockIndicator::indicatorData 12="; + qDebug() << mPrimaryText ; + return mPrimaryText; + } + } else if (role == SecondaryTextRole && mTypeIndex != 7) { + if (mParameter.isValid()) { + qDebug() << "============= HbAutolockIndicator::indicatorData 21="; + qDebug() << QString("data:").append(mParameter.toString()) + .append(" ") + .append(mPrimaryText); + return QString("data:").append(mParameter.toString()) + .append(" ") + .append(mSecondaryText); + } else { + qDebug() << "============= HbAutolockIndicator::indicatorData 22="; + qDebug() << mSecondaryText ; + return mSecondaryText; + } + } else if (role == MonoDecorationNameRole) { + if (mParameter.isValid()) { + qDebug() << "============= HbAutolockIndicator::indicatorData 31="; + qDebug() << "qtg_mono_ok.svg" ; + return "qtg_mono_ok.svg"; + } else { + qDebug() << "============= HbAutolockIndicator::indicatorData 32="; + qDebug() << mIcon ; + return mIcon; + } + } else if (role == DecorationNameRole) { + if (mParameter.isValid()) { + qDebug() << "============= HbAutolockIndicator::indicatorData 41="; + qDebug() << "qtg_mono_ok.svg" ; + return "qtg_mono_ok.svg"; + } else { + qDebug() << "============= HbAutolockIndicator::indicatorData 42="; + qDebug() << mIcon ; + return mIcon; + } + } else if (role == MonoDecorationNameRole) { + if (mParameter.isValid()) { + qDebug() << "============= HbAutolockIndicator::indicatorData 51="; + qDebug() << "qtg_mono_ok.svg" ; + return "qtg_mono_ok.svg"; + } else { + qDebug() << "============= HbAutolockIndicator::indicatorData 52="; + qDebug() << mIconMono ; + return mIconMono; + } + } + return QVariant(); +} + +bool HbAutolockIndicator::handleClientRequest(RequestType type, const QVariant ¶meter) +{ + bool handled(false); + switch (type) { + case RequestActivate: + if (mParameter != parameter) { + mParameter = parameter; + emit dataChanged(); + } + handled = true; + break; + default: + mParameter.clear(); + } + + return handled; +} + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/indicatorplugin/hbindicatorautolockplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/indicatorplugin/hbindicatorautolockplugin.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,74 @@ +/* +* ============================================================================ +* Name : hbindicatorautolockplugin.h +* Part of : hb / hbcore +* Description : indicator autolock plugin header +* Version : %version: 1 % +* +* Copyright (c) 2009 Nokia. All rights reserved. +* This material, including documentation and any related computer +* programs, is protected by copyright controlled by Nokia. All +* rights are reserved. Copying, including reproducing, storing, +* adapting or translating, any or all of this material requires the +* prior written consent of Nokia. This material also contains +* confidential information which may not be disclosed to others +* without the prior written consent of Nokia. +* ============================================================================ +*/ + +#ifndef HBINDICATORAUTOLOCKPLUGIN_H +#define HBINDICATORAUTOLOCKPLUGIN_H + +#include +#include +#include + +#include +#include +#include "autolockindicators.h" + +class HbIndicatorAutolockPlugin : public QObject, public HbIndicatorPluginInterface +{ + Q_OBJECT + Q_INTERFACES(HbIndicatorPluginInterface) + +public: + HbIndicatorAutolockPlugin(); + ~HbIndicatorAutolockPlugin(); + + QStringList indicatorTypes() const; + bool accessAllowed(const QString &indicatorType, + const QVariantMap &securityInfo) const; + HbIndicatorInterface* createIndicator(const QString &indicatorType); + int error() const; +private: + int typeIndex(const QString &indicatorType) const; +private: + Q_DISABLE_COPY(HbIndicatorAutolockPlugin) + int mError; + QStringList mIndicatorTypes; +}; + +class HbAutolockIndicator : public HbIndicatorInterface +{ +public: + HbAutolockIndicator(const QString &indicatorType, + int typeIndex, + Interaction interaction); + ~HbAutolockIndicator(); + bool handleInteraction(InteractionType type); + QVariant indicatorData(int role) const; +protected: + bool handleClientRequest(RequestType type, const QVariant ¶meter); +private: + QString mPrimaryText; + QString mSecondaryText; + QString mIcon; + QString mIconMono; + int mTypeIndex; + Interaction mInteraction; + QVariant mParameter; +}; + +#endif // HBINDICATORAUTOLOCKPLUGIN_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/indicatorplugin/indicatorautolockplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/indicatorplugin/indicatorautolockplugin.pro Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,62 @@ +# +# ============================================================================ +# Name : indicatorautolockplugin.pro +# Part of : hb / +# Description : indicator autolock plugin +# Version : %version: 2 % +# +# Copyright © 2009 Nokia. All rights reserved. +# This material, including documentation and any related computer +# programs, is protected by copyright controlled by Nokia. All +# rights are reserved. Copying, including reproducing, storing, +# adapting or translating, any or all of this material requires the +# prior written consent of Nokia. This material also contains +# confidential information which may not be disclosed to others +# without the prior written consent of Nokia. +# ============================================================================ +# + +TEMPLATE = lib + +CONFIG += Hb + +TARGET = IndicatorAutolockPlugin +CONFIG += plugin +win32 { + debug { + DESTDIR = ../indicatorplugin/debug + } + else { + DESTDIR = ../indicatorplugin/release + } +} +else { + DESTDIR = ../indicatorplugin +} + +HEADERS += hbindicatorautolockplugin.h autolockindicators.h +SOURCES += hbindicatorautolockplugin.cpp + +symbian { + TARGET.EPOCALLOWDLLDATA=1 + TARGET.CAPABILITY = CAP_GENERAL_DLL + + hblib.sources = Hb.dll + hblib.path = \sys\bin + hblib.depends = "(0xEEF9EA38), 1, 0, 0, {\"Hb\"}" + + pluginstub.sources = indicatorautolockplugin.dll + pluginstub.path = /resource/plugins/indicators + DEPLOYMENT += pluginstub +} + +!local { + target.path = $${HB_PLUGINS_DIR}/indicators + INSTALLS += target +} + +BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include " \ + "rom/indicatorautolockplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(indicatorautolockplugin.iby)" + +symbian:MMP_RULES += SMPSAFE diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/indicatorplugin/plugin_commonU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/indicatorplugin/plugin_commonU.def Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,16 @@ +; ============================================================================== +; Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-05-17T09:17:32 +; This file is generated by qmake and should not be modified by the +; user. +; Name : plugin_commonU.def +; Part of : IndicatorAutolockPlugin +; Description : Fixes common plugin symbols to known ordinals +; Version : +; +; ============================================================================== + + +EXPORTS + qt_plugin_query_verification_data @ 1 NONAME + qt_plugin_instance @ 2 NONAME + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/qcrml/TestCode.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/qcrml/TestCode.qcrml Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,5 @@ + + + + + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/qcrml/autolock.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/qcrml/autolock.qcrml Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,5 @@ + + + + + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/qcrml/callstate.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/qcrml/callstate.qcrml Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,5 @@ + + + + + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/qcrml/dismissdialog.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/qcrml/dismissdialog.qcrml Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,5 @@ + + + + + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/qcrml/grip.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/qcrml/grip.qcrml Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,5 @@ + + + + + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/qcrml/keyguard.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/qcrml/keyguard.qcrml Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,5 @@ + + + + + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/qcrml/lights.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/qcrml/lights.qcrml Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,5 @@ + + + + + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/qcrml/profile.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/qcrml/profile.qcrml Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,4 @@ + + + + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/qcrml/screensaver.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/qcrml/screensaver.qcrml Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,4 @@ + + + + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/qcrml/securitysettings.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/qcrml/securitysettings.qcrml Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,10 @@ + + + + + + + + + + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Autolock/rom/Autolock.iby --- a/securitydialogs/Autolock/rom/Autolock.iby Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/Autolock/rom/Autolock.iby Tue Sep 28 14:03:54 2010 +0300 @@ -26,6 +26,16 @@ file=ABI_DIR\BUILD_DIR\autolockuseractivityservice.dll SHARED_LIB_DIR\autolockuseractivityservice.dll data=\epoc32\data\z\resource\qt\crml\autolock.qcrml \resource\qt\crml\autolock.qcrml +data=\epoc32\data\z\resource\qt\crml\callstate.qcrml \resource\qt\crml\callstate.qcrml +data=\epoc32\data\z\resource\qt\crml\dismissdialog.qcrml \resource\qt\crml\dismissdialog.qcrml +data=\epoc32\data\z\resource\qt\crml\grip.qcrml \resource\qt\crml\grip.qcrml +data=\epoc32\data\z\resource\qt\crml\keyguard.qcrml \resource\qt\crml\keyguard.qcrml +data=\epoc32\data\z\resource\qt\crml\lights.qcrml \resource\qt\crml\lights.qcrml +data=\epoc32\data\z\resource\qt\crml\profile.qcrml \resource\qt\crml\profile.qcrml +data=\epoc32\data\z\resource\qt\crml\screensaver.qcrml \resource\qt\crml\screensaver.qcrml +data=\epoc32\data\z\resource\qt\crml\securitysettings.qcrml \resource\qt\crml\securitysettings.qcrml +// This is only for test purposes +data=\epoc32\data\z\resource\qt\crml\TestCode.qcrml \resource\qt\crml\TestCode.qcrml // this is already done in IndicatorAutolockPlugin.iby // file=ABI_DIR\BUILD_DIR\IndicatorAutolockPlugin.dll SHARED_LIB_DIR\IndicatorAutolockPlugin.dll diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/SecUi/Src/SecQueryUi.cpp --- a/securitydialogs/SecUi/Src/SecQueryUi.cpp Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecQueryUi.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -364,7 +364,7 @@ _LIT(KInvalidNewLockCode0, "invalidNewLockCode$-1"); AddParamL(KInvalidNewLockCode, KInvalidNewLockCode0); // for starter RSCPClient scpClient; - TSCPSecCode newCode; + TBuf<32> newCode; // can't be TSCPSecCode=8 . Must use SEC_C_SECURITY_CODE_MAX_LENGTH=10 newCode.Copy(acceptedValueTop); RDEBUG("scpClient.Connect", 0); if (scpClient.Connect() == KErrNone) diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp --- a/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -129,6 +129,7 @@ EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent, TBool aStartup, TInt& aResult) { RDEBUG("0", 0); + RDEBUG("TBool aStartup", aStartup); iStartup = aStartup; HandleEventL(aEvent, aResult); @@ -186,6 +187,7 @@ else aResult = KErrNotSupported; break; + case RMobilePhone::EPhonePasswordRequired+0x100: // from Autolock case RMobilePhone::EPhonePasswordRequired: aResult = PassPhraseRequiredL(); break; @@ -343,7 +345,7 @@ TSCPSecCode newCode; RDEBUG("iSecUi_password", 1); RDEBUGSTR(iSecUi_password); - newCode.Copy(iSecUi_password); + newCode.Copy(iSecUi_password); // this might fail if lenght=10 , because TSCPSecCode=8, while SEC_C_SECURITY_CODE_MAX_LENGTH=10 RDEBUG( "!!!!!!! ***** deprecated **** !!!!! scpClient.StoreCode", 0); @@ -377,6 +379,7 @@ } } RDEBUG("while AskSecCodeL", 1); + iSecUi_password.Copy(_L("")); // clear password so that the next time, it shows empty } // while iQueryCanceled = ETrue; @@ -535,12 +538,13 @@ User::LeaveIfError(codeQueryNotifier.Connect()); CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); - TInt queryResponse = 0; + TInt queryResponse = 0; // TODO will be changed by SecurityObserver TPckg response(queryResponse); RDEBUG("0", 0); TSecurityNotificationPckg params; - params().iEvent = static_cast (RMobilePhone::EPhonePasswordRequired); + params().iEvent = static_cast (0x100+RMobilePhone::EPhonePasswordRequired); params().iStartup = EFalse; + RDEBUG("queryResponse", queryResponse); RDEBUG("StartNotifierAndGetResponse", 0); codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, KSecurityNotifierUid, params, response); @@ -666,10 +670,12 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ + askPassPhraseRequiredL: RDEBUG("0", 0); TBool StartUp = iStartup; RMobilePhone::TMobilePassword iSecUi_password; + iSecUi_password.Copy(_L("")); RMobilePhone::TMobilePassword required_fourth; TInt queryAccepted = KErrCancel; @@ -916,7 +922,7 @@ RDEBUG("scpClient.Connect", 1); CleanupClosePushL(scpClient); TSCPSecCode newCode; - newCode.Copy(iSecUi_password); + newCode.Copy(iSecUi_password); // this might fail if lenght=10 , because TSCPSecCode=8, while SEC_C_SECURITY_CODE_MAX_LENGTH=10 RDEBUG( "!!!!!!! ***** TODO deprecated **** !!!!! scpClient.StoreCode", 0); @@ -1041,7 +1047,14 @@ } break; case KErrGsm0707IncorrectPassword: + { RDEBUG("KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword); + // The Settings caller might retry + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + if(StartUp) + goto askPassPhraseRequiredL; + } + break; // and continue case KErrAccessDenied: { @@ -1255,6 +1268,7 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ + askPuk1RequiredL: RDEBUG("0", 0); TInt queryAccepted = KErrCancel; RMobilePhone::TMobilePassword puk1_password; @@ -1356,8 +1370,9 @@ case KErrAccessDenied: // wrong PUK code -> note -> ask PUK code again CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - returnValue = Puk1RequiredL(); - break; + RDEBUG("goto askPuk1RequiredL", 0); + goto askPuk1RequiredL; + // break; case KErrGsm0707SimWrong: // sim lock active // no message ? @@ -1368,8 +1383,9 @@ break; default: CSecuritySettings::ShowErrorNoteL(res); - returnValue = Puk1RequiredL(); - break; + RDEBUG("goto askPuk1RequiredL", 0); + goto askPuk1RequiredL; + // break; } // Now the PUK1 is validated. It's time for asking the new PIN1 @@ -1392,7 +1408,9 @@ HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code")); title.Append(stringHolder2->Des()); CleanupStack::PopAndDestroy(stringHolder2); - lSecUiCancelSupported = ESecUiCancelSupported; + lSecUiCancelSupported = ESecUiCancelNotSupported; // initialy it was ESecUiCancelSupported , but an error said "Becaouse, if it is can be canceled, why desigh this step about newpincode confirm" + // Somehow both scenarios make sense: User should not cancel because the code has been already changed to PUK. + // On the other hand, this happened because user forgot the PIN. Now you know it: same as PUK. So user can cancel. RDEBUG("StartUp", 0); if (StartUp) // how to know whether PUK comes from failing at Starter, or failing at any other PIN (i.e. changing PIN, or changing PIN-request) ??? { @@ -1415,12 +1433,13 @@ // send code again, now with the user pin RDEBUG("VerifySecurityCode", 0); - iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPinPassword, puk1_password); + iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPinPassword, puk1_password); // TODO why not ChangeSecurityCode ? RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); CleanupStack::PopAndDestroy(wait); + // this can't fail, because PUK1 was just verified returnValue = res; switch (res) { @@ -1557,6 +1576,7 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ + askPuk2RequiredL: RDEBUG("0", 0); TInt queryAccepted = KErrCancel; RMobilePhone::TMobilePassword iSecUi_password; @@ -1636,8 +1656,9 @@ case KErrAccessDenied: // wrong PUK2 code -> note -> ask PUK2 code again CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - Puk2RequiredL(); - break; + RDEBUG("goto askPuk2RequiredL", 0); + goto askPuk2RequiredL; + // break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // Pin2 features blocked permanently! @@ -1645,8 +1666,9 @@ break; default: CSecuritySettings::ShowErrorNoteL(res); - Puk2RequiredL(); - break; + RDEBUG("goto askPuk2RequiredL", 0); + goto askPuk2RequiredL; + // break; } // now the PUK2 is valid. Time to get the new PIN2 @@ -1693,6 +1715,7 @@ RDEBUG("WaitForRequestL res", res); CleanupStack::PopAndDestroy(wait); + // this can't fail, as PUK2 was just verified switch (res) { case KErrNone: diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp --- a/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -400,22 +400,23 @@ /* TODO not sure if needs to check against the typed, or the hashed */ - /* RArray aFailedPolicies; - TDevicelockPolicies failedPolicy; TInt retLockcode = KErrNone; RMobilePhone::TMobilePassword aISACode; TInt scpFlags = 0; RDEBUG("scpClient.VerifyCurrentLockcode", 0); - // this validate on ISA . No need to do iPhone.VerifySecurityCode + // get hashed code, to verify that message is different than code + RSCPClient scpClient; + TInt ret = scpClient.Connect(); + RDEBUG("ret", ret); retLockcode = scpClient.VerifyCurrentLockcode(aRemoteLockCode, aISACode, aFailedPolicies, scpFlags); RDEBUG("retLockcode", retLockcode); + scpClient.Close(); RDEBUG("aISACode", 0); RDEBUGSTR(aISACode); - */ - securityCode = aRemoteLockCode; + securityCode = aISACode; // aRemoteLockCode; RDEBUG( "EMobilePhoneVerifySecurityCode", EMobilePhoneVerifySecurityCode ); iWait->SetRequestType(EMobilePhoneVerifySecurityCode); RDEBUG( "VerifySecurityCode", 0 ); @@ -600,19 +601,23 @@ case KErrAccessDenied: { // code was entered erroneously + RDEBUG("KErrAccessDenied", KErrAccessDenied); return ChangeSimSecurityL(); } case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: { + RDEBUG("KErrLocked", KErrLocked); return ChangeSimSecurityL(); } case KErrAbort: { + RDEBUG("KErrAbort", KErrAbort); return EFalse; } default: { + RDEBUG("default", status); ShowErrorNoteL(status); return ChangeSimSecurityL(); } @@ -1454,6 +1459,10 @@ titleTr.Append(_L("SCP server doesn't support this UID")); title.Append(_L("SCP server doesn't support this UID")); break; + case KErrGsm0707SIMPuk1Required: + titleTr.Append(_L("KErrGsm0707SIMPuk1Required")); + title.Append(_L("Puk 1 Required")); + break; default: // " " titleTr.Append(_L("Specific Error")); @@ -1590,6 +1599,7 @@ EXPORT_C TInt CSecuritySettings::ChangePinParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, TInt aShowError) { + askChangePinParamsL: RDEBUG("aFlags", aFlags); RDEBUG("aOldPassword", 0); RDEBUGSTR(aOldPassword); @@ -1650,7 +1660,13 @@ res = KErrNone; } #endif - + if(res==KErrGsm0707SIMPuk1Required) + { + CSecurityHandler* handler = new (ELeave) CSecurityHandler(iPhone); + CleanupStack::PushL(handler); + handler->HandleEventL(RMobilePhone::EPuk1Required); + CleanupStack::PopAndDestroy(handler); // handler + } User::LeaveIfError(res); if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) @@ -1720,7 +1736,9 @@ if (res != KErrNone) { ShowResultNoteL(res, CAknNoteDialog::EErrorTone); - return res; // not sure if it's wise to exit now. + newPassword = _L(""); + oldPassword = _L(""); + goto askChangePinParamsL; } newPassword = _L(""); @@ -1800,8 +1818,7 @@ { // code was entered erroneously. This is strange, because it was verified before ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - ChangePinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); - break; + goto askChangePinParamsL; } case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: @@ -1821,9 +1838,9 @@ } default: { + RDEBUG("default", res); ShowErrorNoteL(res); - ChangePinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); - break; + goto askChangePinParamsL; } } return res; @@ -2226,6 +2243,7 @@ EXPORT_C TInt CSecuritySettings::ChangeSecCodeParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, TInt aShowError) { + askChangeSecCodeParamsL: RDEBUG("aFlags", aFlags); RDEBUG("aShowError", aShowError); /***************************************************** @@ -2246,17 +2264,19 @@ { RArray aFailedPolicies; TDevicelockPolicies failedPolicy; - TInt retLockcode = KErrNone; RSCPClient scpClient; - retLockcode = scpClient.Connect(); - RDEBUG( "retLockcode", retLockcode ); - if(retLockcode == KErrNone ) + res = scpClient.Connect(); + RDEBUG( "res", res ); + if(res == KErrNone ) { RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); - retLockcode = scpClient.IsLockcodeChangeAllowedNow( aFailedPolicies ); - RDEBUG( "retLockcode", retLockcode ); + TBool changeAllowed = scpClient.IsLockcodeChangeAllowedNow( aFailedPolicies ); + RDEBUG( "bool changeAllowed", changeAllowed ); RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); - res = retLockcode; + if(changeAllowed) + res = KErrNone; + else + res = KErrAccessDenied; for(TInt i=0; i aFailedPolicies; TDevicelockPolicies failedPolicy; - TInt retLockcode = KErrNone; RSCPClient scpClient; - retLockcode = scpClient.Connect(); - RDEBUG( "retLockcode", retLockcode ); - if(retLockcode == KErrNone ) + res = scpClient.Connect(); + RDEBUG( "res", res ); + if(res == KErrNone ) { RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); RDEBUGSTR( newPassword ); - retLockcode = scpClient.VerifyNewLockcodeAgainstPolicies( newPassword, aFailedPolicies ); - RDEBUG( "retLockcode", retLockcode ); + res = scpClient.VerifyNewLockcodeAgainstPolicies( newPassword, aFailedPolicies ); + RDEBUG( "res", res ); RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); for(TInt i=0; iSetRequestType(EMobilePhoneChangeSecurityCode); - RDEBUG("ChangeSecurityCode", 0); - iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); - RDEBUG("WaitForRequestL", 0); - res = iWait->WaitForRequestL(); - RDEBUG("WaitForRequestL res", res); -#ifdef __WINS__ - if (res == KErrNotSupported) - res = KErrNone; -#endif - - if (res == KErrNone && 1 == 0) // TODO not possible to enable because it asks code again - { - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; - RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockSetEnabled; - iWait->SetRequestType(EMobilePhoneSetLockSetting); - RDEBUG("SetLockSetting", 0); - iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); - RDEBUG("WaitForRequestL", 0); - res = iWait->WaitForRequestL(); - RDEBUG("WaitForRequestL res", res); -#ifdef __WINS__ - if (res == KErrNotSupported || res == KErrTimedOut) - res = KErrNone; -#endif - } - } + // let's see if TARM rejects it + if(res==KErrNone) + { + // Send the changed code to the SCP server, even with device lock enhancements. + RDEBUG("scpClient.Connect", 0); + RSCPClient scpClient; + TBuf<32> newScpCode; + TBuf<32> oldScpCode; + newScpCode.Copy(newPassword); + oldScpCode.Copy(oldPassword); + if (scpClient.Connect() == KErrNone) + { + RDEBUG("scpClient.StoreLockcode", 0); + // this is the old method. Obsolete now + // scpClient.StoreCode( newCode ); + RArray aFailedPolicies; + TDevicelockPolicies failedPolicy; + RDEBUG("newScpCode", 0); + RDEBUGSTR( newScpCode ); + RDEBUG("oldScpCode", 0); + RDEBUGSTR( oldScpCode ); + RDEBUG( "StoreLockcode", 0 ); + res = scpClient.StoreLockcode(newScpCode, oldScpCode, aFailedPolicies); // this does iPhone.ChangeSecurityCode + RDEBUG( "res", res ); + RDEBUG( "KErrAccessDenied", KErrAccessDenied ); + #ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; + #endif + RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); + for (TInt i = 0; i < aFailedPolicies.Count(); i++) + { + failedPolicy = aFailedPolicies[i]; + RDEBUG( "failedPolicy", failedPolicy ); + } + scpClient.Close(); + // Don't know what to do if TARM fails. Hopefully it was stopped at typing, as well as VerifyNewLockcodeAgainstPolicies + switch (res) + { + case KErrNone: + { + RDEBUG( "showing R_SECURITY_CODE_CHANGED_NOTE", R_SECURITY_CODE_CHANGED_NOTE ); + ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + break; + } + case KErrAccessDenied: // TARM has wrong UID + { + res = KErrTDevicelockPolicies+EDevicelockTotalPolicies+1; + RDEBUG( "res", res ); + ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone); + res = KErrAccessDenied; // no reason for retry, as it will fail again and again + break; + } + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + { + RDEBUG( "KErrLocked", KErrLocked ); + ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); + goto askChangeSecCodeParamsL; + // break; + } + case KErrGsm0707IncorrectPassword: + { + // code was entered erroneously + RDEBUG( "KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword ); + ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + goto askChangeSecCodeParamsL; + // break; + } + case KErrAbort: + { + RDEBUG( "KErrAbort", KErrAbort ); + break; + } + default: + { + ShowErrorNoteL(res); + goto askChangeSecCodeParamsL; + // break; + } + } // switch + } // scpClient.Connect + } - RDEBUG("res", res); - switch (res) - { - case KErrNone: - { - // code changed ... unless TARM rejects it - { - // Send the changed code to the SCP server, even with device lock enhancements. - RDEBUG("scpClient.Connect", 0); - RSCPClient scpClient; - TSCPSecCode newScpCode; - TSCPSecCode oldScpCode; - newScpCode.Copy(newPassword); - oldScpCode.Copy(oldPassword); - if (scpClient.Connect() == KErrNone) - { - RDEBUG("scpClient.StoreLockcode", 0); - // this is the old method. Obsolete now - // scpClient.StoreCode( newCode ); - RArray aFailedPolicies; - TDevicelockPolicies failedPolicy; - TInt retLockcode = KErrNone; - RDEBUG("newScpCode", 0); - RDEBUGSTR( newScpCode ); - RDEBUG("oldScpCode", 0); - RDEBUGSTR( oldScpCode ); - retLockcode = scpClient.StoreLockcode(newScpCode, oldScpCode, aFailedPolicies); - RDEBUG( "retLockcode", retLockcode ); - RDEBUG( "KErrAccessDenied", KErrAccessDenied ); - RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); - for (TInt i = 0; i < aFailedPolicies.Count(); i++) - { - failedPolicy = aFailedPolicies[i]; - RDEBUG( "failedPolicy", failedPolicy ); - } - // Don't know what to do if TARM fails. Hopefully it was stopped at typing, as well as VerifyNewLockcodeAgainstPolicies - // The code is already changed in iPhone ! - // For now, just undo the changed password - if(retLockcode!=KErrNone) - { - RDEBUG("Undo password change because retLockcode", retLockcode); - if(retLockcode==KErrAccessDenied) // this happens if CSCPSession::HandleAuthenticationMessageL doesn't include the UID - retLockcode = KErrTDevicelockPolicies+EDevicelockTotalPolicies+1; - ShowResultNoteL(retLockcode, CAknNoteDialog::EConfirmationTone); - - // go back to previous password. - passwords.iOldPassword = newPassword; - passwords.iNewPassword = oldPassword; - iWait->SetRequestType(EMobilePhoneChangeSecurityCode); - RDEBUG("ChangeSecurityCode", 0); - iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); - RDEBUG("WaitForRequestL", 0); - res = iWait->WaitForRequestL(); // this can't fail. ISA is always allowing to undo the password change. - RDEBUG("WaitForRequestL res", res); - #ifdef __WINS__ - if (res == KErrNotSupported) - res = KErrNone; - #endif - res = retLockcode; - } - scpClient.Close(); - } - if(res==KErrNone) - { - RDEBUG( "showing R_SECURITY_CODE_CHANGED_NOTE", R_SECURITY_CODE_CHANGED_NOTE ); - ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); - } - } - break; - } - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - { - ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); - ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, aCaption, aShowError); - break; - } - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - { - // code was entered erroneously - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, aCaption, aShowError); - break; - } - case KErrAbort: - { - break; - } - default: - { - ShowErrorNoteL(res); - ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, aCaption, aShowError); - break; - } - } // switch RDEBUG("return res", res); return res; } @@ -2550,6 +2525,7 @@ // the params are changed in the settings,. This only asks for password. EXPORT_C TInt CSecuritySettings::ChangeAutoLockPeriodParamsL(TInt aPeriod, RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError) { + askChangeAutoLockPeriodParamsL: RDEBUG("aPeriod", aPeriod); RDEBUG("aFlags", aFlags); /***************************************************** @@ -2678,22 +2654,26 @@ RDEBUG("KErrLocked", KErrLocked) ; ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone); // the old code didn't show messages - return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again + goto askChangeAutoLockPeriodParamsL; // ask again case KErrGsm0707IncorrectPassword: + RDEBUG("KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword) + ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); // the old code didn't show messages + goto askChangeAutoLockPeriodParamsL; // ask again case KErrAccessDenied: RDEBUG("KErrAccessDenied", KErrAccessDenied) ; // code was entered erroneously ShowResultNoteL(KErrAccessDenied, CAknNoteDialog::EErrorTone); // the old code didn't show messages - return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again + goto askChangeAutoLockPeriodParamsL; // ask again case KErrAbort: // User pressed "cancel" in the code query dialog. - return oldPeriod; + RDEBUG("KErrAbort", KErrAbort) + return KErrAbort; default: RDEBUG("default", status) ; ShowResultNoteL(status, CAknNoteDialog::EErrorTone); // the old code didn't show messages - return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again + goto askChangeAutoLockPeriodParamsL; // ask again } RDEBUG("aPeriod", aPeriod); return aPeriod; diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/SecUi/rom/SecUi.iby --- a/securitydialogs/SecUi/rom/SecUi.iby Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/SecUi/rom/SecUi.iby Tue Sep 28 14:03:54 2010 +0300 @@ -23,10 +23,12 @@ file=ABI_DIR\BUILD_DIR\SecUi.dll SHARED_LIB_DIR\SecUi.dll //Security Notifier -file=ABI_DIR\BUILD_DIR\SecurityNotifier.dll SHARED_LIB_DIR\SecurityNotifier.dll +// Not used any more. Now secuidialognotifier takes the role +// file=ABI_DIR\BUILD_DIR\SecurityNotifier.dll SHARED_LIB_DIR\SecurityNotifier.dll //Notifier wrapper -ECOM_PLUGIN(Securitynotifierwrapper.dll,102071FA.rsc) +// Not used any more. Now secuidialognotifier takes the role +// ECOM_PLUGIN(Securitynotifierwrapper.dll,102071FA.rsc) //Security Observer #ifndef RD_STARTUP_CHANGE diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Securitynotifier/Group/Securitynotifier.mmp --- a/securitydialogs/Securitynotifier/Group/Securitynotifier.mmp Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/Securitynotifier/Group/Securitynotifier.mmp Tue Sep 28 14:03:54 2010 +0300 @@ -47,6 +47,7 @@ LIBRARY centralrepository.lib LIBRARY eikcore.lib LIBRARY scpclient.lib // SCP server +LIBRARY lockclient.lib #if defined(WINSCW) DEFFILE ../BWinsCw/SecurityNotifierU.def diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/Securitynotifier/Src/SecurityNotifier.cpp --- a/securitydialogs/Securitynotifier/Src/SecurityNotifier.cpp Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/Securitynotifier/Src/SecurityNotifier.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -32,6 +32,7 @@ #include #include #include +#include // LOCAL CONSTANTS AND MACROS /***************************************************** @@ -225,35 +226,7 @@ // void CSecurityNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReturnVal, const RMessagePtr2& aMessage) { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) searching for autolock.exe =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x0 ); - #endif - TApaTaskList taskList( CCoeEnv::Static()->WsSession() ); - const TUid KAutolockUid = { 0x100059B5 }; - TApaTask task( taskList.FindApp( KAutolockUid ) ); - if ( !task.Exists() ) - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) autolock.exe not running. Starting now=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 ); - #endif - RApaLsSession ls; - User::LeaveIfError(ls.Connect()); - CleanupClosePushL(ls); - - CApaCommandLine* commandLine = CApaCommandLine::NewLC(); - commandLine->SetExecutableNameL( _L("autolock.exe" ) ); - commandLine->SetCommandL( EApaCommandRun ); - - // Try to launch the application. - TInt err = ls.StartApp(*commandLine); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) autolock.exe err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err ); - #endif - - CleanupStack::PopAndDestroy(2); // commandLine, ls - } - /***************************************************** * Series 60 Customer / ETel * Series 60 ETel API @@ -270,8 +243,38 @@ TSecurityNotificationPckg pckg; pckg.Copy( aBuffer ); iStartup = pckg().iStartup; - iEvent = static_cast(pckg().iEvent); - + TInt lEvent = pckg().iEvent; + iEvent = static_cast(lEvent); + if(lEvent==100+RMobilePhone::EPhonePasswordRequired) + { + // from AskSecCodeInAutoLockL + iEvent = RMobilePhone::EPhonePasswordRequired; + } + + #if defined(_DEBUG) + RDebug::Printf( "%s %s (%u) iStartup =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iStartup ); + RDebug::Printf( "%s %s (%u) lEvent =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, lEvent ); + RDebug::Printf( "%s %s (%u) iEvent =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iEvent ); + RDebug::Printf( "%s %s (%u) iReturnVal =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iReturnVal ); + #endif + + // Forces Autolock to load + TInt err = KErrNone; + + if(iEvent == RMobilePhone::EPhonePasswordRequired && lEvent==100+RMobilePhone::EPhonePasswordRequired) + { + #if defined(_DEBUG) + RDebug::Printf( "%s %s (%u) query from AskSecCodeInAutoLockL . No need to start Autolock.exe =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + #endif + } + else + { + CKeyguardAccessApi* iKeyguardAccess = CKeyguardAccessApi::NewL( ); + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + err = iKeyguardAccess->ShowKeysLockedNote( ); + RDebug::Printf( "%s %s (%u) err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err ); + delete iKeyguardAccess; + } if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) { diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/group/bld.inf --- a/securitydialogs/group/bld.inf Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/group/bld.inf Tue Sep 28 14:03:54 2010 +0300 @@ -29,9 +29,11 @@ #include "../SecUi/group/bld.inf" #include "../Securitynotifier/Group/bld.inf" #include "../Securityobserver/Group/bld.inf" -// As far as I know, lockclient is also a QT project. I wonder why it's left as .inf -#include "../lockclient/group/bld.inf" +// lockclient is also a QT project. +// #include "../lockclient/group/bld.inf" #include "../lockapp/group/bld.inf" +#include "../secuidialognotifier/Group/bld.inf" +#include "../secuidialognotifiersrv/Group/bld.inf" PRJ_TESTMMPFILES diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/lockapp/group/lockapp.mmp --- a/securitydialogs/lockapp/group/lockapp.mmp Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/lockapp/group/lockapp.mmp Tue Sep 28 14:03:54 2010 +0300 @@ -46,5 +46,6 @@ LIBRARY apgrfx.lib LIBRARY apparc.lib LIBRARY cone.lib +LIBRARY lockclient.lib SMPSAFE diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/lockapp/src/lockapp.cpp --- a/securitydialogs/lockapp/src/lockapp.cpp Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/lockapp/src/lockapp.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -28,6 +28,7 @@ #include #include #include +#include // ---------------------------------------------------------------------------------------- // Server startup code @@ -72,9 +73,17 @@ commandLine->SetExecutableNameL(_L("autolock.exe")); commandLine->SetCommandL(EApaCommandRun); // Try to launch the application. - TInt err = ls.StartApp(*commandLine); // this migh fail + TInt err = 0 ; // ls.StartApp(*commandLine); // this migh fail RDebug::Printf("%s %s (%u) Start: autolock.exe err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err); + // alternate way of starting Autolock + CKeyguardAccessApi* iKeyguardAccess = CKeyguardAccessApi::NewL( ); + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + ret = iKeyguardAccess->ShowKeysLockedNote( ); + RDebug::Printf( "%s %s (%u) ret=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret ); + delete iKeyguardAccess; + + CleanupStack::PopAndDestroy(2); // commandLine, ls // Initialisation complete, now signal the client diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/lockclient/group/bld.inf --- a/securitydialogs/lockclient/group/bld.inf Fri Sep 03 16:31:27 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: LockClient build file -* -*/ - - -#include - -PRJ_EXPORTS - -/* this is also done in .pro , but doesn't harm to do it here, too */ -../rom/lockclient.iby CORE_MW_LAYER_IBY_EXPORT_PATH(lockclient.iby) - -PRJ_MMPFILES - -/* -Not any more. This is done in the QT way, using lockclient.pro -lockclient.mmp -*/ \ No newline at end of file diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/lockclient/src/keyguardaccessapi.cpp --- a/securitydialogs/lockclient/src/keyguardaccessapi.cpp Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/lockclient/src/keyguardaccessapi.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -78,6 +78,7 @@ RDEBUG("0", 0); TInt value; + TBool ret = EFalse; TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value); RDEBUG("err", err); RDEBUG("value", value); @@ -87,16 +88,18 @@ { case EKeyguardLocked: case EKeyguardAutolockEmulation: - return ETrue; + ret = ETrue; case EKeyguardNotActive: default: - return EFalse; + ret = EFalse; } } else { - return EFalse; + ret = EFalse; } + RDEBUG("bool ret", ret); + return ret; } // --------------------------------------------------------------------------- @@ -106,6 +109,7 @@ { RDEBUG("0", 0); TInt value; + TBool ret = EFalse; TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value); RDEBUG("err", err); RDEBUG("value", value); @@ -114,17 +118,19 @@ switch( value ) { case EKeyguardLocked: - return ETrue; + ret = ETrue; case EKeyguardAutolockEmulation: case EKeyguardNotActive: default: - return EFalse; + ret = EFalse; } } else { - return EFalse; + ret = EFalse; } + RDEBUG("bool ret", ret); + return ret; } // --------------------------------------------------------------------------- diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/lockclient/src/lockaccessextension.cpp --- a/securitydialogs/lockclient/src/lockaccessextension.cpp Fri Sep 03 16:31:27 2010 +0300 +++ b/securitydialogs/lockclient/src/lockaccessextension.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -121,10 +121,10 @@ - TInt value = -1; + TInt value = 0; err = KErrNone; numAttempts = 0; - while( value<1 && numAttempts++ <10 ) // wait max 5 seconds + while( value==0 && numAttempts++ <10 ) // wait max 5 seconds { // process was started, but still not fully running. Give a bit more time err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, value); diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/data/102071FA.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/data/102071FA.rss Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier plug-in resource file. +* +*/ + + +#include +#include + +RESOURCE REGISTRY_INFO r_registry + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = 0x102071FA; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUikonUidPluginInterfaceNotifiers; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x102071FB; + version_no = 1; + display_name = "SecuiDialogs Plugin"; + default_data = "SecuiDialogs"; + opaque_data = "0"; + rom_only = 1; + } + }; + } + }; + } + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/group/bld.inf Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/secuidialognotifier.iby CORE_MW_LAYER_IBY_EXPORT_PATH( secuidialognotifier.iby ) + +PRJ_MMPFILES +secuidialognotifier.mmp + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/group/secuidialognotifier.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/group/secuidialognotifier.mmp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier +* +*/ + +#include + +TARGET secuidialognotifier.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID 0x10009D8D 0x102071FA +VENDORID VID_DEFAULT + +SOURCEPATH ../data +START RESOURCE 102071FA.rss +TARGET secuidialognotifier.rsc +END + +MW_LAYER_SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore /epoc32/include/mw/hb/hbwidgets +USERINCLUDE ../inc + +SOURCEPATH ../src +SOURCE secuidialogmain.cpp +SOURCE secuidialognotifier.cpp +SOURCE secuidialognotifiersrv.cpp +SOURCE secuidialogs.cpp + +LIBRARY euser.lib +LIBRARY eiksrv.lib +LIBRARY ctframework.lib + +SMPSAFE diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/inc/secuidialognotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/inc/secuidialognotifier.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier +* +*/ + +#ifndef SECUIDIALOGNOTIFIER_H +#define SECUIDIALOGNOTIFIER_H + +#include // MEikSrvNotifierManager + +class CSecuiDialogs; + + +/** + * Secui Dialog Notifier + * CSecuiDialogNotifier is a RNotifier that implements secui dialogs + * defined in secdlgimpldefs.h (see TSecurityDialogOperation operations). + */ +NONSHARABLE_CLASS( CSecuiDialogNotifier ) : public CBase, public MEikSrvNotifierBase2 + { + public: // constructors and destructor + static CSecuiDialogNotifier* NewL(); + ~CSecuiDialogNotifier(); + + private: // from MEikSrvNotifierBase2 + void Release(); + TNotifierInfo RegisterL(); + TNotifierInfo Info() const; + void StartL( const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage ); + TPtrC8 StartL( const TDesC8& aBuffer ); + void Cancel(); + TPtrC8 UpdateL( const TDesC8& aBuffer ); + + private: // new functions + CSecuiDialogNotifier(); + void ConstructL(); + void DoStartL( const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage ); + + private: // data + CSecuiDialogs* iSecuiDialogs; + TBool iIsSecuiDialogsDeleted; + }; + +#endif // SECUIDIALOGNOTIFIER_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/inc/secuidialognotifiersrv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/inc/secuidialognotifiersrv.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier server, client-side API. +* +*/ + +#ifndef SECUIDIALOGNOTIFIERSRV_H +#define SECUIDIALOGNOTIFIERSRV_H + +#include // RSessionBase +#include // TSecurityDialogOperation + + +/** + * Secui Dialog Notifier Server API + * Secui dialogs provide TSecurityDialogOperation functionality defined in secdlgimpldefs.h. + * Implementation consist of two components: a notifier DLL (CSecuiDialogNotifier, ECom DLL) + * and a server executable (CSecuiDialogNotifierSrv). CSecuiDialogNotifier runs in UIKON + * server that has limited capabilities. It passes the requests to the server component + * (CSecuiDialogNotifierSrv) that provides the actual functionality. + */ +NONSHARABLE_CLASS( RSecuiDialogNotifierSrv ) : public RSessionBase + { + public: // constructors and destructor + RSecuiDialogNotifierSrv(); + ~RSecuiDialogNotifierSrv(); + + public: // new functions + TInt Connect(); + TVersion Version() const; + void SecuiDialogOperation( TSecurityDialogOperation aOperation, + const TDesC8& aInputBuffer, TDes8& aOutputBuffer, + TRequestStatus& aStatus ); + void CancelOperation(); + + private: // new functions + TInt StartServer(); + + private: // data + TIpcArgs iArgs; + }; + +#endif // SECUIDIALOGNOTIFIERSRV_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/inc/secuidialogs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/inc/secuidialogs.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CSecuiDialogs active object +* +*/ + +#ifndef SECUIDIALOGS_H +#define SECUIDIALOGS_H + +#include // CActive +#include // TSecurityDialogOperation +#include "secuidialognotifiersrv.h" // RSecuiDialogNotifierSrv + + +/** + * Secui Dialogs + * CSecuiDialogs class provides implementation for the secui dialog + * operations (TSecurityDialogOperation) defined in secdlgimpldefs.h. + * When RNotifier class is used to open secui dialogs, CSecuiDialogNotifier + * class calls CSecuiDialogs to show the requested dialogs. CSecuiDialogs + * uses RSecuiDialogNotifierSrv server to do the actual work. + */ +NONSHARABLE_CLASS( CSecuiDialogs ) : public CActive + { + public: // constructors and destructor + static CSecuiDialogs* NewL( TBool& aIsDeleted ); + ~CSecuiDialogs(); + + public: // new functions + /** + * Starts handling the requested operation. + * @param aBuffer - Data passed from client RNotifier::StartNotifierAndGetResponse() call + * @param aReplySlot - Identifies which message argument to use for the reply + * @param aMessage - Encapsulates the client request + */ + void StartLD( const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage ); + + protected: // from CActive + void RunL(); + void DoCancel(); + TInt RunError( TInt aError ); + + private: // new functions + CSecuiDialogs( TBool& aIsDeleted ); + + private: // data + TBool& iIsDeleted; + + TInt iRetry; + TInt iReplySlot; + RMessagePtr2 iMessagePtr; + TSecurityDialogOperation iOperation; + + RSecuiDialogNotifierSrv iServer; + HBufC8* iInputBuffer; + TAny* iOutputBuffer; + TPtr8 iOutputPtr; + }; + +#endif // SECUIDIALOGS_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/inc/secuidialogstrace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/inc/secuidialogstrace.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TRACE macros for secui dialogs +* +*/ + +#ifndef SECUIDIALOGSTRACE_H +#define SECUIDIALOGSTRACE_H + +#include // RDebug + + +// TODO: replace with OST tracing +#ifdef _DEBUG +#define TRACE( a, ARGS... ) { RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); DebugPrint( _L( a ), ##ARGS ) ; }; +#else +#define TRACE( a, ARGS... ) +#endif + + +// --------------------------------------------------------------------------- +// DebugPrint() +// --------------------------------------------------------------------------- +// +#ifdef _DEBUG +const TInt KMaxPrintSize = 256; +inline void DebugPrint( TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list, aFmt ); + TBuf buf; + buf.AppendFormatList( aFmt, list ); + RDebug::Print( buf ); + } +#endif + + +#endif // SECUIDIALOGSTRACE_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/rom/secuidialognotifier.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/rom/secuidialognotifier.iby Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier +* +*/ + +#ifndef SECUIDIALOGNOTIFIER_IBY +#define SECUIDIALOGNOTIFIER_IBY +#include + +ECOM_PLUGIN( secuidialognotifier.dll, secuidialognotifier.rsc ) + +#endif // SECUIDIALOGNOTIFIER_IBY + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/src/secuidialogmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/src/secuidialogmain.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui Dialog notifier entry point +* +*/ + +#include "secuidialognotifier.h" // CSecuiDialogNotifier +#include // TImplementationProxy definition + +const TInt KNumberOfImplementations = 1; + + +// ---------------------------------------------------------------------------- +// CreateNotifiersL() +// ---------------------------------------------------------------------------- +// +void CreateNotifiersL( CArrayPtr& aNotifierArray ) + { + CSecuiDialogNotifier* notifier = CSecuiDialogNotifier::NewL(); + CleanupStack::PushL( notifier ); + aNotifierArray.AppendL( notifier ); + CleanupStack::Pop( notifier ); + } + +// ---------------------------------------------------------------------------- +// NotifierArray() +// ---------------------------------------------------------------------------- +// +CArrayPtr* NotifierArray() + { + + CArrayPtr* notifierArray = + new CArrayPtrFlat( KNumberOfImplementations ); + if( notifierArray ) + { + TRAPD( err, CreateNotifiersL( *notifierArray ) ); + + + if( err ) + { + TInt count = notifierArray->Count(); + while( count-- ) + { + (*notifierArray)[ count ]->Release(); + } + delete notifierArray; + notifierArray = NULL; + } + } + return notifierArray; + } + +// ---------------------------------------------------------------------------- +// Provides a key value pair table, that ECOM uses to identify +// the correct construction function for the requested interface. +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + // UID is the implementation uid defined in .rss file + IMPLEMENTATION_PROXY_ENTRY( 0x102071FB, NotifierArray ) + }; + +// ---------------------------------------------------------------------------- +// Main entry function used to return an instance of the proxy table. +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/src/secuidialognotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/src/secuidialognotifier.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier +* +*/ + +#include "secuidialognotifier.h" // CSecuiDialogNotifier +#include "secuidialogs.h" // CSecuiDialogs +#include "secuidialogstrace.h" // TRACE macro + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifier::~CSecuiDialogNotifier() +// --------------------------------------------------------------------------- +// +CSecuiDialogNotifier::~CSecuiDialogNotifier() + { + TRACE( "CSecuiDialogNotifier::~CSecuiDialogNotifier" ); + Cancel(); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifier::NewL() +// --------------------------------------------------------------------------- +// +CSecuiDialogNotifier* CSecuiDialogNotifier::NewL() + { + TRACE( "CSecuiDialogNotifier::NewL, 1 =%d", 1 ); + CSecuiDialogNotifier* self = new( ELeave ) CSecuiDialogNotifier; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifier::Release() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifier::Release() + { + TRACE( "CSecuiDialogNotifier::Release" ); + delete this; + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifier::RegisterL() +// --------------------------------------------------------------------------- +// +CSecuiDialogNotifier::TNotifierInfo CSecuiDialogNotifier::RegisterL() + { + TRACE( "CSecuiDialogNotifier::RegisterL, 1 =%d", 1 ); + return Info(); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifier::Info() +// --------------------------------------------------------------------------- +// +CSecuiDialogNotifier::TNotifierInfo CSecuiDialogNotifier::Info() const + { + TRACE( "CSecuiDialogNotifier::Info, 1 =%d", 1 ); + + TNotifierInfo info; + static const TUid KUidSecuiDialogNotifier = { 0x10005988 }; + info.iUid = KUidSecuiDialogNotifier; + const TUid KSecAuthChannel = {0x00000602}; + info.iChannel = KSecAuthChannel; + info.iPriority = ENotifierPriorityAbsolute; + return info; + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifier::StartL() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifier::StartL( const TDesC8& aBuffer, TInt aReplySlot, + const RMessagePtr2& aMessage ) + { + TRACE( "CSecuiDialogNotifier::StartL, begin" ); + + TRAPD( err, DoStartL( aBuffer, aReplySlot, aMessage ) ); + TRACE( "CSecuiDialogNotifier::StartL, DoStartL err=%d", err ); + if( err ) + { + if( iSecuiDialogs && !iIsSecuiDialogsDeleted ) + { + TRACE( "CSecuiDialogNotifier::StartL, deleting iSecuiDialogs" ); + delete iSecuiDialogs; + iSecuiDialogs = NULL; + } + if( !aMessage.IsNull() ) + { + TRACE( "CSecuiDialogNotifier::StartL, completing message" ); + aMessage.Complete( err ); + } + } + + TRACE( "CSecuiDialogNotifier::StartL, end" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifier::StartL() +// --------------------------------------------------------------------------- +// +TPtrC8 CSecuiDialogNotifier::StartL( const TDesC8& /*aBuffer*/ ) + { + return KNullDesC8(); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifier::Cancel() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifier::Cancel() + { + TRACE( "CSecuiDialogNotifier::Cancel" ); + if( iSecuiDialogs && !iIsSecuiDialogsDeleted ) + { + TRACE( "CSecuiDialogNotifier::Cancel, deleting iSecuiDialogs" ); + delete iSecuiDialogs; + iSecuiDialogs = NULL; + } + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifier::UpdateL() +// --------------------------------------------------------------------------- +// +TPtrC8 CSecuiDialogNotifier::UpdateL( const TDesC8& /*aBuffer*/ ) + { + return KNullDesC8(); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifier::CSecuiDialogNotifier() +// --------------------------------------------------------------------------- +// +CSecuiDialogNotifier::CSecuiDialogNotifier() + { + TRACE( "CSecuiDialogNotifier::CSecuiDialogNotifier" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifier::ConstructL() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifier::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifier::DoStartL() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifier::DoStartL( const TDesC8& aBuffer, TInt aReplySlot, + const RMessagePtr2& aMessage ) + { + TRACE( "CSecuiDialogNotifier::DoStartL, 1 =%d", 1 ); + + iSecuiDialogs = CSecuiDialogs::NewL( iIsSecuiDialogsDeleted ); + iSecuiDialogs->StartLD( aBuffer, aReplySlot, aMessage ); + } + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/src/secuidialognotifiersrv.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/src/secuidialognotifiersrv.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier server, client-side API. +* +*/ + +#include "secuidialognotifiersrv.h" // RSecuiDialogNotifierSrv +#include "../../secuidialognotifiersrv/inc/secuidialognotifierservername.h" +#include "secuidialogstrace.h" // TRACE macro + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// RSecuiDialogNotifierSrv::RSecuiDialogNotifierSrv() +// --------------------------------------------------------------------------- +// +RSecuiDialogNotifierSrv::RSecuiDialogNotifierSrv() + { + } + +// --------------------------------------------------------------------------- +// RSecuiDialogNotifierSrv::~RSecuiDialogNotifierSrv() +// --------------------------------------------------------------------------- +// +RSecuiDialogNotifierSrv::~RSecuiDialogNotifierSrv() + { + } + +// --------------------------------------------------------------------------- +// RSecuiDialogNotifierSrv::Connect() +// --------------------------------------------------------------------------- +// +TInt RSecuiDialogNotifierSrv::Connect() + { + TRACE( "RSecuiDialogNotifierSrv::Connect" ); + const TInt KMaxCreateSessionAttepmts = 2; + TInt retry = KMaxCreateSessionAttepmts; + FOREVER + { + TInt err = CreateSession( KSecuiDialogNotifierServerName, Version() ); + TRACE( "RSecuiDialogNotifierSrv::Connect, create session err=%d", err ); + if( err != KErrNotFound && err != KErrServerTerminated ) + { + return err; + } + + if( --retry == 0 ) + { + return err; + } + + err = StartServer(); + if( err != KErrNone && err != KErrAlreadyExists ) + { + return err; + } + } + } + +// --------------------------------------------------------------------------- +// RSecuiDialogNotifierSrv::Version() +// --------------------------------------------------------------------------- +// +TVersion RSecuiDialogNotifierSrv::Version() const + { + return TVersion( KSecuiDialogNotifierServerMajorVersionNumber, + KSecuiDialogNotifierServerMinorVersionNumber, + KSecuiDialogNotifierServerBuildVersionNumber ); + } + +// --------------------------------------------------------------------------- +// RSecuiDialogNotifierSrv::SecuiDialogOperationL() +// --------------------------------------------------------------------------- +// +void RSecuiDialogNotifierSrv::SecuiDialogOperation( + TSecurityDialogOperation aOperation, + const TDesC8& aInputBuffer, TDes8& aOutputBuffer, + TRequestStatus& aStatus ) + { + TRACE( "RSecuiDialogNotifierSrv::SecuiDialogOperation" ); + iArgs = TIpcArgs( &aInputBuffer, &aOutputBuffer ); + SendReceive( aOperation, iArgs, aStatus ); + } + +// --------------------------------------------------------------------------- +// RSecuiDialogNotifierSrv::CancelOperation() +// --------------------------------------------------------------------------- +// +void RSecuiDialogNotifierSrv::CancelOperation() + { + TRACE( "RSecuiDialogNotifierSrv::CancelOperation" ); + SendReceive( KSecuiDialogCancelOperation ); + } + +// --------------------------------------------------------------------------- +// RSecuiDialogNotifierSrv::StartServer() +// --------------------------------------------------------------------------- +// +TInt RSecuiDialogNotifierSrv::StartServer() +{ + TRACE( "RSecuiDialogNotifierSrv::StartServer, begin" ); + RProcess server; + TInt err = server.Create( KSecuiDialogNotifierServerName, KNullDesC ); + if( err ) + { + TRACE( "RSecuiDialogNotifierSrv::StartServer, create failed, err=%d", err ); + return err; + } + + TRequestStatus status; + server.Rendezvous( status ); + if( status == KRequestPending ) + { + server.Resume(); + } + else + { + server.Kill( KErrNone ); + } + + TRACE( "RSecuiDialogNotifierSrv::StartServer, waiting rendezvous" ); + User::WaitForRequest( status ); + if( server.ExitType() == EExitPanic ) + { + err = KErrGeneral; + } + else + { + err = status.Int(); + } + server.Close(); + + TRACE( "RSecuiDialogNotifierSrv::StartServer, end err=%d", err ); + return err; +} + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/src/secuidialogs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/src/secuidialogs.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,191 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CSecuiDialogs active object +* +*/ + +#include "secuidialogs.h" // CSecuiDialogs +#include "secuidialogstrace.h" // TRACE macro + +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSecuiDialogs::NewL() +// --------------------------------------------------------------------------- +// +CSecuiDialogs* CSecuiDialogs::NewL( TBool& aIsDeleted ) + { + return new( ELeave ) CSecuiDialogs( aIsDeleted ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogs::~CSecuiDialogs() +// --------------------------------------------------------------------------- +// +CSecuiDialogs::~CSecuiDialogs() + { + TRACE( "CSecuiDialogs::~CSecuiDialogs, begin" ); + Cancel(); + iServer.Close(); + delete iInputBuffer; + iInputBuffer = NULL; + delete iOutputBuffer; + iOutputBuffer = NULL; + iIsDeleted = ETrue; + TRACE( "CSecuiDialogs::~CSecuiDialogs, end" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogs::StartLD() +// --------------------------------------------------------------------------- +// +void CSecuiDialogs::StartLD( const TDesC8& aBuffer, TInt aReplySlot, + const RMessagePtr2& aMessage ) + { + TRACE( "CSecuiDialogs::StartLD, begin" ); + User::LeaveIfError( iServer.Connect() ); + + const TInt* ptr = reinterpret_cast< const TInt* >( aBuffer.Ptr() ); + iOperation = static_cast< TSecurityDialogOperation >( *ptr & KSecurityDialogOperationMask ); + iReplySlot = aReplySlot; + TRACE( "CSecuiDialogs::StartLD, iReplySlot 0x%08x", iReplySlot ); + + TRACE( "CSecuiDialogs::StartLD, message 0x%08x", iMessagePtr.Handle() ); + iMessagePtr = aMessage; + + TRACE( "CSecuiDialogs::StartLD, iOperation=%d", iOperation ); + + TSecurityNotificationPckg pckg; + pckg.Copy( aBuffer ); + TRACE( "CSecuiDialogs::StartLD, Copy=%d", 1 ); + TInt iStartup = pckg().iStartup; + TRACE( "CSecuiDialogs::StartLD, iStartup=%d", iStartup ); + TInt iEvent = pckg().iEvent; + TRACE( "CSecuiDialogs::StartLD, iEvent=%d", iEvent ); + TInt lOperation = 0x0000; + if(iStartup) + lOperation = 0x1000; + lOperation += iEvent; + iOperation = static_cast< TSecurityDialogOperation >( lOperation ); + TRACE( "CSecuiDialogs::StartLD, new iOperation=%d", iOperation ); + + __ASSERT_DEBUG( iOutputBuffer == NULL, User::Invariant() ); + TInt outputBufLen = 0; + if( iEvent < 0x100 || iEvent == 0x106 /* from Autolock*/) // a simple test to prevent unknown codes. Nevertheless they will also be stopped later in case that no dialog can answer the request + { + iOutputBuffer = new( ELeave ) TPINValueBuf; + outputBufLen = sizeof( TPINValueBuf ); + } + else + { + TRACE( "CSecuiDialogs::StartLD, not allowed iOperation =%d", iOperation ); + User::Leave( KErrNotSupported ); + } + + __ASSERT_DEBUG( iInputBuffer == NULL, User::Invariant() ); + iInputBuffer = aBuffer.AllocL(); + + if( iOutputBuffer ) + { + TRACE( "CSecuiDialogs::StartLD, iOutputPtr.Set outputBufLen=%d", outputBufLen ); + iOutputPtr.Set( static_cast< TUint8* >( iOutputBuffer ), outputBufLen, outputBufLen ); + iServer.SecuiDialogOperation( iOperation, *iInputBuffer, iOutputPtr, iStatus ); + } + else + { + TRACE( "CSecuiDialogs::StartLD, Leave KErrNotSupported=%d", KErrNotSupported ); + User::Leave( KErrNotSupported ); + } + SetActive(); + TRACE( "CSecuiDialogs::StartLD, end" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogs::RunL() +// --------------------------------------------------------------------------- +// +void CSecuiDialogs::RunL() + { + TRACE( "CSecuiDialogs::RunL, iStatus.Int()=%d", iStatus.Int() ); + TInt error = iStatus.Int(); + User::LeaveIfError( error ); + __ASSERT_DEBUG( iOutputPtr.Ptr(), User::Invariant() ); + TRACE( "CSecuiDialogs::RunL, calling iMessagePtr.WriteL" ); + TRACE( "CSecuiDialogs::RunL, iReplySlot 0x%08x", iReplySlot ); + TInt maxx = iMessagePtr.GetDesMaxLength(iReplySlot); + TRACE( "CSecuiDialogs::RunL, maxx 0x%08x", maxx ); + TInt curr = iMessagePtr.GetDesLength(iReplySlot); + TRACE( "CSecuiDialogs::RunL, curr 2 0x%08x", curr ); + // no need to copy. Besides, it seems to crash because it's too long + // iMessagePtr.WriteL( iReplySlot, iOutputPtr ); + TRACE( "CSecuiDialogs::RunL, called iMessagePtr.WriteL" ); + + TRACE( "CSecuiDialogs::RunL, completing message 0x%08x", iMessagePtr.Handle() ); + iMessagePtr.Complete( error ); + + TRACE( "CSecuiDialogs::RunL, deleting this" ); + delete this; + TRACE( "CSecuiDialogs::RunL, end" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogs::DoCancel() +// --------------------------------------------------------------------------- +// +void CSecuiDialogs::DoCancel() + { + TRACE( "CSecuiDialogs::DoCancel, begin" ); + iServer.CancelOperation(); + if( !iMessagePtr.IsNull() ) + { + TRACE( "CSecuiDialogs::DoCancel, completing message 0x%08x", iMessagePtr.Handle() ); + iMessagePtr.Complete( KErrCancel ); + } + TRACE( "CSecuiDialogs::DoCancel(), end" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogs::RunError() +// --------------------------------------------------------------------------- +// +TInt CSecuiDialogs::RunError( TInt aError ) + { + TRACE( "CSecuiDialogs::RunError, aError=%d", aError ); + if( !iMessagePtr.IsNull() ) + { + TRACE( "CSecuiDialogs::RunError, completing message 0x%08x", iMessagePtr.Handle() ); + iMessagePtr.Complete( aError ); + } + + TRACE( "CSecuiDialogs::RunError, deleting this" ); + delete this; + + TRACE( "CSecuiDialogs::RunError, end" ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CSecuiDialogs::CSecuiDialogs() +// --------------------------------------------------------------------------- +// +CSecuiDialogs::CSecuiDialogs( TBool& aIsDeleted ) : CActive( CActive::EPriorityLow ), + iIsDeleted( aIsDeleted ), iOutputPtr( NULL, 0, 0 ) + { + TRACE( "CSecuiDialogs::CSecuiDialogs" ); + CActiveScheduler::Add( this ); + iIsDeleted = EFalse; + } + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,218 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test application for untrusted certificate dialog. +* +*/ + +#include "srvauthfaildlglauncher.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifdef Q_OS_SYMBIAN +#include // TValidationError +#include // TServerAuthenticationFailureInput, KUidSecuiDialogNotifier + +HBufC8* GetInputBufferL( const QString& server, const QByteArray& certificate, int reason ) + { + const TPtrC16 serverNameUnicode(reinterpret_cast(server.constData()), + server.length()); + const TPtrC8 encodedCert(reinterpret_cast(certificate.constData()), + certificate.length()); + + const TInt KServerNameMaxLength = 512; + TBuf8 serverName; + serverName.Copy(serverNameUnicode); + + TServerAuthenticationFailureInput serverAuthenticationInput; + serverAuthenticationInput.iOperation = EServerAuthenticationFailure; + serverAuthenticationInput.iFailureReason = static_cast(reason); + serverAuthenticationInput.iServerNameLength = serverName.Length(); + serverAuthenticationInput.iEncodedCertLength = encodedCert.Length(); + + TServerAuthenticationFailureInputBuf inputBuf( serverAuthenticationInput ); + + TInt bufferSize = sizeof( inputBuf ) + serverName.Length() + encodedCert.Length(); + HBufC8* packedBuffer = HBufC8::NewL( bufferSize ); + TPtr8 packedBufferPtr( packedBuffer->Des() ); + + packedBufferPtr.Append( inputBuf ); + packedBufferPtr.Append( serverName ); + packedBufferPtr.Append( encodedCert ); + + return packedBuffer; + } + +bool ShowDialogL( const QString& server, const QByteArray& certificate, int reason, bool cancel ) + { + RNotifier notifier; + User::LeaveIfError( notifier.Connect() ); + CleanupClosePushL( notifier ); + + HBufC8* buffer = GetInputBufferL( server, certificate, reason ); + CleanupStack::PushL( buffer ); + + TRequestStatus status; + TPckgBuf resultPckg; + notifier.StartNotifierAndGetResponse( status, KUidSecuiDialogNotifier, + *buffer, resultPckg ); + if( cancel ) + { + const TInt KTenSecDelay = 10000000; + User::After( KTenSecDelay ); + notifier.CancelNotifier( KUidSecuiDialogNotifier ); + } + User::WaitForRequest( status ); + User::LeaveIfError( status.Int() ); + + CleanupStack::PopAndDestroy( buffer ); + CleanupStack::PopAndDestroy( ¬ifier ); + return( resultPckg() == EContinue ); + } + +#endif // Q_OS_SYMBIAN + + +const QString KTestCertDir = "c:/data/testCerts"; + +SrvAuthFailDlgLauncher::SrvAuthFailDlgLauncher(int& argc, char* argv[]) + : HbApplication(argc, argv), mMainWindow(0), mMainView(0) +{ + mMainWindow = new HbMainWindow(); + mMainView = new HbView(); + mMainView->setTitle(tr("SrvAuthFailDlgLauncher")); + + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); + + layout->addItem(new HbLabel(tr("Server host name:"))); + mHostName = new HbTextEdit(tr("some.host.com")); + layout->addItem(mHostName); + layout->addStretch(); + + layout->addItem(new HbLabel(tr("Certificate file:"))); + mFilesList = new HbComboBox; + mFilesList->setEditable(false); + QDir dir(KTestCertDir); + if (dir.exists()) { + QFileInfoList list = dir.entryInfoList(QDir::Files); + QListIterator iter(list); + while (iter.hasNext()) { + const QFileInfo &info(iter.next()); + mFilesList->addItem(info.fileName()); + } + } + layout->addItem(mFilesList); + layout->addStretch(); + + layout->addItem(new HbLabel(tr("Validation result:"))); + mValidationResult = new HbComboBox; + QStringList validationResults; + validationResults + << "EValidatedOK" + << "EChainHasNoRoot" + << "ESignatureInvalid" + << "EDateOutOfRange" + << "ENameIsExcluded" + << "ENameNotPermitted" + << "ENotCACert" + << "ECertificateRevoked" + << "EUnrecognizedCriticalExtension" + << "ENoBasicConstraintInCACert" + << "ENoAcceptablePolicy" + << "EPathTooLong" + << "ENegativePathLengthSpecified" + << "ENamesDontChain" + << "ERequiredPolicyNotFound" + << "EBadKeyUsage" + << "ERootCertNotSelfSigned" + << "ECriticalExtendedKeyUsage" + << "ECriticalCertPoliciesWithQualifiers" + << "ECriticalPolicyMapping" + << "ECriticalDeviceId" + << "ECriticalSid" + << "ECriticalVid" + << "ECriticalCapabilities"; + mValidationResult->addItems(validationResults); + mValidationResult->setCurrentIndex(1); // EChainHasNoRoot + layout->addItem(mValidationResult); + layout->addStretch(); + + mCancelShortly = new HbCheckBox("Cancel after 10 seconds"); + layout->addItem(mCancelShortly); + + HbPushButton *button = 0; + button = new HbPushButton("Launch dialog"); + connect(button, SIGNAL(clicked()), this, SLOT(activateDialog())); + layout->addItem(button); + + button = new HbPushButton("Exit"); + connect(button, SIGNAL(clicked()), qApp, SLOT(quit())); + layout->addItem(button); + + mMainView->setLayout(layout); + mMainWindow->addView(mMainView); + mMainWindow->show(); +} + +SrvAuthFailDlgLauncher::~SrvAuthFailDlgLauncher() +{ + delete mMainView; + delete mMainWindow; +} + +void SrvAuthFailDlgLauncher::activateDialog() +{ + QString server = mHostName->toPlainText(); + + QString fileName = mFilesList->currentText(); + QFile file; + QDir::setCurrent(KTestCertDir); + file.setFileName(fileName); + file.open(QIODevice::ReadOnly); + QByteArray fileContent = file.readAll(); + file.close(); + + int reason = mValidationResult->currentIndex(); + bool cancel = mCancelShortly->isChecked(); + + int error = 0; + bool accepted = false; +#ifdef Q_OS_SYMBIAN + TRAP( error, accepted = ShowDialogL(server, fileContent, reason, cancel) ); +#endif // Q_OS_SYMBIAN + if (!error) { + if (accepted) { + HbMessageBox::information(QString("Accepted")); + } else { + HbMessageBox::information(QString("Declined")); + } + } else { + if (error == KErrCancel) { + HbMessageBox::information(QString("Cancelled")); + } else { + HbMessageBox::information(QString("Failed, error %1").arg(error)); + } + } +} + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test application for untrusted certificate dialog. +* +*/ + +#ifndef SRVAUTHFAILDLGLAUNCHER_H +#define SRVAUTHFAILDLGLAUNCHER_H + +#include + +class HbMainWindow; +class HbView; +class HbComboBox; +class HbTextEdit; +class HbCheckBox; + + +class SrvAuthFailDlgLauncher : public HbApplication +{ + Q_OBJECT + +public: // constructor and destructor + SrvAuthFailDlgLauncher(int& argc, char* argv[]); + ~SrvAuthFailDlgLauncher(); + +private slots: // new functions + void activateDialog(); + +private: // data + HbMainWindow *mMainWindow; + HbView *mMainView; + HbComboBox *mFilesList; + HbTextEdit *mHostName; + HbComboBox *mValidationResult; + HbCheckBox *mCancelShortly; +}; + +#endif // SRVAUTHFAILDLGLAUNCHER_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.iby Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test application for untrusted certificate dialog. +* +*/ + + +#ifndef __SRVAUTHFAILDLGLAUNCHER_IBY__ +#define __SRVAUTHFAILDLGLAUNCHER_IBY__ + +file=ABI_DIR/BUILD_DIR/srvauthfaildlglauncher.exe SHARED_LIB_DIR/srvauthfaildlglauncher.exe +HB_UPGRADABLE_APP_REG_RSC( srvauthfaildlglauncher ) +S60_APP_RESOURCE( srvauthfaildlglauncher ) + +#endif // __SRVAUTHFAILDLGLAUNCHER_IBY__ diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.pkg Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,43 @@ +; +; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Test application for untrusted certificate dialog. +; + +; Language +&EN + +; SIS header: name, uid, version +#{"srvauthfaildlglauncher"},(0xE9bbd80d),1,0,0 + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Manual PKG pre-rules from PRO files +; Default dependency to Qt libraries +(0x2001E61C), 4, 6, 3, {"Qt"} + +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + +; Executable and default resource files +"/epoc32/release/armv5/urel/srvauthfaildlglauncher.exe" - "!:\sys\bin\srvauthfaildlglauncher.exe" +"/epoc32/data/z/resource/apps/srvauthfaildlglauncher.rsc" - "!:\resource\apps\srvauthfaildlglauncher.rsc" +"/epoc32/data/z/private/10003a3f/import/apps/srvauthfaildlglauncher_reg.rsc" - "!:\private\10003a3f\import\apps\srvauthfaildlglauncher_reg.rsc" + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.pro Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,43 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Test application for untrusted certificate dialog. +# + +TEMPLATE = app +TARGET = srvauthfaildlglauncher +CONFIG += hb +DEPENDPATH += . +INCLUDEPATH += . + +HEADERS += srvauthfaildlglauncher.h +SOURCES += srvauthfaildlglaunchermain.cpp srvauthfaildlglauncher.cpp + +symbian { + TARGET.CAPABILITY = CAP_APPLICATION +} + +BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include " \ + "srvauthfaildlglauncher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(srvauthfaildlglauncher.iby)" \ + "testCerts/RootCert.cer /epoc32/winscw/c/data/testCerts/RootCert.cer" \ + "testCerts/IntermediateCert.cer /epoc32/winscw/c/data/testCerts/IntermediateCert.cer" \ + "testCerts/ServerCert1.cer /epoc32/winscw/c/data/testCerts/ServerCert1.cer" \ + "testCerts/ServerCert2_noCN.cer /epoc32/winscw/c/data/testCerts/ServerCert2_noCN.cer" \ + "testCerts/ServerCert3_exp.cer /epoc32/winscw/c/data/testCerts/ServerCert3_exp.cer" \ + "testCerts/ServerCert4_exp2.cer /epoc32/winscw/c/data/testCerts/ServerCert4_exp2.cer" \ + "testCerts/ServerCert5_alg.cer /epoc32/winscw/c/data/testCerts/ServerCert5_alg.cer" \ + "testCerts/ServerCert6_key.cer /epoc32/winscw/c/data/testCerts/ServerCert6_key.cer" \ + "testCerts/SevverCert7_ocsp.cer /epoc32/winscw/c/data/testCerts/ServerCert7_ocsp.cer" \ + "testCerts/ServerCert8_aia.cer /epoc32/winscw/c/data/testCerts/ServerCert8_aia.cer" \ + "testCerts/ServerCert9_san.cer /epoc32/winscw/c/data/testCerts/ServerCert9_san.cer" diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglaunchermain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglaunchermain.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test application for untrusted certificate dialog. +* +*/ + +#include "srvauthfaildlglauncher.h" + +int main(int argc, char *argv[]) +{ + SrvAuthFailDlgLauncher app(argc, argv); + return app.exec(); +} + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/IntermediateCert.cer Binary file securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/IntermediateCert.cer has changed diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/RootCert.cer Binary file securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/RootCert.cer has changed diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert1.cer Binary file securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert1.cer has changed diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert2_noCN.cer Binary file securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert2_noCN.cer has changed diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert3_exp.cer Binary file securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert3_exp.cer has changed diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert4_exp2.cer Binary file securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert4_exp2.cer has changed diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert5_alg.cer Binary file securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert5_alg.cer has changed diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert6_key.cer Binary file securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert6_key.cer has changed diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert8_aia.cer Binary file securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert8_aia.cer has changed diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert9_san.cer Binary file securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert9_san.cer has changed diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/SevverCert7_ocsp.cer Binary file securitydialogs/secuidialognotifier/tsrc/srvauthfaildlglauncher/testCerts/SevverCert7_ocsp.cer has changed diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/group/bld.inf Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier server +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/secuidialognotifiersrv.iby CORE_MW_LAYER_IBY_EXPORT_PATH( secuidialognotifiersrv.iby ) + +PRJ_MMPFILES +secuidialognotifiersrv.mmp + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/group/secuidialognotifiersrv.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/group/secuidialognotifiersrv.mmp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier server +* +*/ + +#include + +TARGET secuidialognotifiersrv.exe +CAPABILITY CAP_SERVER NetworkControl +TARGETTYPE EXE +UID 0x0 0x10000938 +VENDORID VID_DEFAULT + +MW_LAYER_SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore /epoc32/include/mw/hb/hbwidgets +USERINCLUDE ../inc + +SOURCEPATH ../src +SOURCE secuidialognotifierservermain.cpp +SOURCE secuidialognotifierserver.cpp +SOURCE secuidialognotifiersession.cpp +SOURCE secuidialogoperation.cpp +// SOURCE secuidialogoperserverauthfail.cpp +SOURCE secuidialogoperbasicpinquery.cpp +SOURCE untrustedcertquery.cpp + +LIBRARY euser.lib // Base classes +LIBRARY efsrv.lib // RFs +LIBRARY ctframework.lib // CServerAuthenticationFailureInput +LIBRARY x509.lib // CX509Certificate +LIBRARY x500.lib // CX500DistinguishedName +LIBRARY crypto.lib // CSignedObject +LIBRARY certstore.lib // CUnifiedCertStore +LIBRARY DevTokenClient.lib // CTrustSitesStore +LIBRARY HbCore.lib // CHbDeviceDialogSymbian +LIBRARY HbWidgets.lib // CHbDeviceMessageBoxSymbian +LIBRARY secui.lib // CSecQueryUi +LIBRARY etelmm.lib +LIBRARY etel.lib +LIBRARY customapi.lib +LIBRARY lockclient.lib +LIBRARY featmgr.lib + +SMPSAFE diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/inc/secuidialognotifierserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/inc/secuidialognotifierserver.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier server +* +*/ + +#ifndef SECUIDIALOGNOTIFIERSERVER_H +#define SECUIDIALOGNOTIFIERSERVER_H + +#include // CPolicyServer + + +/** + * CSecuiDialogNotifierServer is the work-horse for TSecurityDialogOperation + * operations defined for secui dialogs in secdlgimpldefs.h. It's client + * is CSecuiDialogs class in secuidialognotifier component. + */ +NONSHARABLE_CLASS( CSecuiDialogNotifierServer ) : public CPolicyServer + { + public: // constructor and destructor + static CSecuiDialogNotifierServer* NewLC(); + ~CSecuiDialogNotifierServer(); + + public: // new functions + void AddSession(); + void RemoveSession(); + + private: // from CServer2 (via CPolicyServer) + CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const; + + private: // new functions + CSecuiDialogNotifierServer(); + void ConstructL(); + + private: // data + TInt iSessionCount; + }; + +#endif // SECUIDIALOGNOTIFIERSERVER_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/inc/secuidialognotifierservername.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/inc/secuidialognotifierservername.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier server name +* +*/ + +#ifndef SECUIDIALOGNOTIFIERSERVERNAME_H +#define SECUIDIALOGNOTIFIERSERVERNAME_H + +_LIT( KSecuiDialogNotifierServerName, "secuidialognotifiersrv" ); +const TInt KSecuiDialogNotifierServerMajorVersionNumber = 1; +const TInt KSecuiDialogNotifierServerMinorVersionNumber = 0; +const TInt KSecuiDialogNotifierServerBuildVersionNumber = 0; + +// See TSecurityDialogOperation in secdlgimpldefs.h for other function codes. +const TInt KSecuiDialogCancelOperation = 0; + +#endif // SECUIDIALOGNOTIFIERSERVERNAME_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/inc/secuidialognotifiersession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/inc/secuidialognotifiersession.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier server session +* +*/ + +#ifndef SECUIDIALOGNOTIFIERSESSION_H +#define SECUIDIALOGNOTIFIERSESSION_H + +#include // CSession2 +#include "secuidialogoperationobserver.h" // MSecuiDialogOperationObserver + +class CSecuiDialogNotifierServer; +class CSecuiDialogOperation; + + +/** + * CSecuiDialogNotifierSession is the session object in secui + * dialog notifier server (CSecuiDialogNotifierServer). + */ +NONSHARABLE_CLASS( CSecuiDialogNotifierSession ) : public CSession2, + public MSecuiDialogOperationObserver + { + public: // constructor and destructor + static CSecuiDialogNotifierSession* NewL(); + ~CSecuiDialogNotifierSession(); + + public: // from CSession2 + void CreateL(); + void ServiceL( const RMessage2& aMessage ); + + public: // from MSecuiDialogOperationObserver + void OperationComplete(); + + private: // new functions + CSecuiDialogNotifierSession(); + void ConstructL(); + CSecuiDialogNotifierServer& Server(); + void DispatchMessageL( const RMessage2& aMessage ); + TBool IsOperationCancelled( const RMessage2& aMessage ); + void GetInputBufferL( const RMessage2& aMessage ); + void ServerAuthenticationFailureL( const RMessage2& aMessage ); + void BasicPinOperationL( const RMessage2& aMessage ); + + private: // data + HBufC8* iInputBuffer; + CSecuiDialogOperation* iOperationHandler; + }; + +#endif // SECUIDIALOGNOTIFIERSESSION_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/inc/secuidialogoperation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/inc/secuidialogoperation.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for CSecuiDialog operations +* +*/ + +#ifndef SECUIDIALOGOPERATION_H +#define SECUIDIALOGOPERATION_H + +#include // CActive + +class MSecuiDialogOperationObserver; + + +/** + * CSecuiDialogOperation is a base class for different kinds of operations + * defined for secui dialogs in secdlgimpldefs.h. TSecurityDialogOperation + * lists the possible operations. A derived class implements each operation + * separately. This base class works as common API between different operation + * classes and the main CSecuiDialog class. + */ +NONSHARABLE_CLASS( CSecuiDialogOperation ) : public CActive + { + protected: // constructor + CSecuiDialogOperation( MSecuiDialogOperationObserver& aObserver, + const RMessage2& aMessage, TInt aReplySlot ); + + public: // destructor + ~CSecuiDialogOperation(); + + public: // new function + virtual void StartL( const TDesC8& aBuffer ) = 0; + virtual void CancelOperation() = 0; + + protected: // from CActive + TInt RunError( TInt aError ); + + protected: // new functions + void ShowWarningNoteL( const TDesC& aMessage ); + + protected: // data + MSecuiDialogOperationObserver& iObserver; + RMessage2 iMessage; + const TInt iReplySlot; + }; + +#endif // SECUIDIALOGOPERATION_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/inc/secuidialogoperationobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/inc/secuidialogoperationobserver.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Observer definition for CSecuiDialog operations +* +*/ + +#ifndef SECUIDIALOGOPERATIONOBSERVER_H +#define SECUIDIALOGOPERATIONOBSERVER_H + + +/** + * CSecuiDialogOperations inform observer when they are complete. + * Completed operations can be deleted safely. Deleting an incomplete + * operation cancels the ongoing request. + */ +class MSecuiDialogOperationObserver + { + public: + virtual void OperationComplete() = 0; + }; + +#endif // SECUIDIALOGOPERATIONOBSERVER_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/inc/secuidialogoperbasicpinquery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/inc/secuidialogoperbasicpinquery.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Basic PIN query operation in secui dialog +* +*/ + +#ifndef SECUIDIALOGOPERBASICPINQUERY_H +#define SECUIDIALOGOPERBASICPINQUERY_H + +#include "secuidialogoperation.h" // CSecuiDialogOperation +#include // TPINValue + +class MSecuiDialogOperationObserver; +class CSecQueryUi; + + +/** + * CBasicPinQueryOperation is a CSecuiDialogOperation that handles + * EEnterPIN, EEnablePIN, EChangePIN, and EDisablePIN operations. + */ +NONSHARABLE_CLASS( CBasicPinQueryOperation ) : public CSecuiDialogOperation + { + public: // constructors and destructor + static CBasicPinQueryOperation* NewL( MSecuiDialogOperationObserver& aObserver, + const RMessage2& aMessage, TInt aReplySlot ); + ~CBasicPinQueryOperation(); + + public: // from CSecuiDialogOperation + void StartL( const TDesC8& aBuffer ); + void CancelOperation(); + + protected: // from CActive (via CSecuiDialogOperation) + void RunL(); + void DoCancel(); + + private: // new functions + CBasicPinQueryOperation( MSecuiDialogOperationObserver& aObserver, + const RMessage2& aMessage, TInt aReplySlot ); + void ReturnResultL( TInt aErrorCode ); + + private: // data + const TPINInput* iPinInput; + TPINValue iPinValue; + TBool iStartUp; + }; + +#endif // SECUIDIALOGOPERBASICPINQUERY_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/inc/secuidialogstrace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/inc/secuidialogstrace.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TRACE macros for secui dialogs +* +*/ + +#ifndef SECUIDIALOGSTRACE_H +#define SECUIDIALOGSTRACE_H + +#include // RDebug + + +// TODO: replace with OST tracing +#ifdef _DEBUG +#define TRACE( a, ARGS... ) { RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); DebugPrint( _L( a ), ##ARGS ) ; }; +#else +#define TRACE( a, ARGS... ) +#endif + + +// --------------------------------------------------------------------------- +// DebugPrint() +// --------------------------------------------------------------------------- +// +#ifdef _DEBUG +const TInt KMaxPrintSize = 256; +inline void DebugPrint( TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list, aFmt ); + TBuf buf; + buf.AppendFormatList( aFmt, list ); + RDebug::Print( buf ); + } +#endif + + +#endif // SECUIDIALOGSTRACE_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/inc/untrustedcertquery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/inc/untrustedcertquery.h Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Displays untrusted certificate dialog +* +*/ + +#ifndef C_UNTRUSTEDCERTQUERY_H +#define C_UNTRUSTEDCERTQUERY_H + +#include // CActive +#include // MHbDeviceDialogObserver +#include // TValidationError + +class CHbDeviceDialogSymbian; +class CHbSymbianVariantMap; + + +/** +* Displays untrusted certificate query. +* Untrusted certificate query dialog is displayed for secure connection +* (SSL/TLS) server authentication failure errors. CCTUntrustedCertQuery +* class uses UntrustedCertificateDialog device dialog to show the query. +*/ +NONSHARABLE_CLASS( CUntrustedCertQuery ) : public CActive, public MHbDeviceDialogObserver + { + public: // constructors and destructor + static CUntrustedCertQuery* NewL( TValidationError aValidationError, + const TDesC8& aCertificate, const TDesC& aServerName, + TBool aCanHandlePermanentAccept ); + ~CUntrustedCertQuery(); + + public: // new functions + enum TResponse { + EQueryRejected, + EQueryAccepted, + EQueryAcceptedPermanently + }; + void ShowQueryAndWaitForResponseL( TResponse& aResponse ); + + protected: // from CActive + void DoCancel(); + void RunL(); + + private: // from MHbDeviceDialogObserver + void DataReceived( CHbSymbianVariantMap& aData ); + void DeviceDialogClosed( TInt aCompletionCode ); + + private: // new functions + CUntrustedCertQuery( TValidationError aValidationError, + const TDesC8& aCertificate, const TDesC& aServerName, + TBool aCanHandlePermanentAccept ); + void ConstructL(); + + private: // data + TValidationError iValidationError; + const TDesC8& iCertificate; + const TDesC& iServerName; + TBool iCanHandlePermanentAccept; + CActiveSchedulerWait *iWait; + TInt iWaitCompletionCode; + CHbDeviceDialogSymbian* iDeviceDialog; + CHbSymbianVariantMap* iVariantMap; + TResponse iResponse; + }; + +#endif // C_UNTRUSTEDCERTQUERY_H + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/rom/secuidialognotifiersrv.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/rom/secuidialognotifiersrv.iby Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier server +* +*/ + +#ifndef SECUIDIALOGNOTIFIERSRV_IBY +#define SECUIDIALOGNOTIFIERSRV_IBY +#include + +file=ABI_DIR\BUILD_DIR\secuidialognotifiersrv.exe sys\bin\secuidialognotifiersrv.exe + +#endif // SECUIDIALOGNOTIFIERSRV_IBY + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/src/secuidialognotifierserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/src/secuidialognotifierserver.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier server +* +*/ + +#include "secuidialognotifierserver.h" // CSecuiDialogNotifierServer +#include "secuidialognotifiersession.h" // CSecuiDialogNotifierSession +#include "secuidialognotifierservername.h" // KSecuiDialogNotifierServerName +#include "secuidialogstrace.h" // TRACE macro + + +const TUint KRangeCount = 1; + +const TInt KRanges[ KRangeCount ] = + { + 0 + }; + +const TUint8 KElementsIndex[ KRangeCount ] = + { + 0 + }; + +const TInt KUikonServerId = 0x10003a4a; +const CPolicyServer::TPolicyElement KPolicyElements[] = + { + { _INIT_SECURITY_POLICY_S0( KUikonServerId ), CPolicyServer::EFailClient } + }; + +const CPolicyServer::TPolicy KSecuiDialogNotifierServerPolicy = + { + CPolicyServer::EAlwaysPass, + KRangeCount, + KRanges, + KElementsIndex, + KPolicyElements + }; + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierServer::NewLC() +// --------------------------------------------------------------------------- +// +CSecuiDialogNotifierServer* CSecuiDialogNotifierServer::NewLC() + { + CSecuiDialogNotifierServer* self = new( ELeave ) CSecuiDialogNotifierServer; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierServer::~CSecuiDialogNotifierServer() +// --------------------------------------------------------------------------- +// +CSecuiDialogNotifierServer::~CSecuiDialogNotifierServer() + { + TRACE( "CSecuiDialogNotifierServer::~CSecuiDialogNotifierServer" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierServer::AddSession() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifierServer::AddSession() + { + TRACE( "CSecuiDialogNotifierServer::AddSession" ); + ++iSessionCount; + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierServer::RemoveSession() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifierServer::RemoveSession() + { + TRACE( "CSecuiDialogNotifierServer::RemoveSession" ); + --iSessionCount; + if( iSessionCount == 0 ) + { + TRACE( "CSecuiDialogNotifierServer::RemoveSession, shutting down" ); + CActiveScheduler::Stop(); + } + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierServer::NewSessionL() +// --------------------------------------------------------------------------- +// +CSession2* CSecuiDialogNotifierServer::NewSessionL( const TVersion &aVersion, + const RMessage2& /*aMessage*/ ) const + { + TRACE( "CSecuiDialogNotifierServer::NewSessionL" ); + TVersion version( KSecuiDialogNotifierServerMajorVersionNumber, + KSecuiDialogNotifierServerMinorVersionNumber, + KSecuiDialogNotifierServerBuildVersionNumber ); + if( !User::QueryVersionSupported( version, aVersion ) ) + { + TRACE( "CSecuiDialogNotifierServer::NewSessionL, version not supported" ); + User::Leave( KErrNotSupported ); + } + + return CSecuiDialogNotifierSession::NewL(); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierServer::CSecuiDialogNotifierServer() +// --------------------------------------------------------------------------- +// +CSecuiDialogNotifierServer::CSecuiDialogNotifierServer() : + CPolicyServer( CActive::EPriorityStandard, KSecuiDialogNotifierServerPolicy ) + { + TRACE( "CSecuiDialogNotifierServer::CSecuiDialogNotifierServer" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierServer::ConstructL() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifierServer::ConstructL() + { + StartL( KSecuiDialogNotifierServerName ); + } + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/src/secuidialognotifierservermain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/src/secuidialognotifierservermain.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier server +* +*/ + +#include "secuidialognotifierserver.h" // CSecuiDialogNotifierServer +#include "secuidialognotifierservername.h" // KSecuiDialogNotifierServerName +#include "secuidialogstrace.h" // TRACE macro + + +// --------------------------------------------------------------------------- +// MainL() +// --------------------------------------------------------------------------- +// +LOCAL_C void MainL() + { + TRACE( "SecuiDialogNotifierServer: MainL" ); + CActiveScheduler* scheduler = new( ELeave ) CActiveScheduler; + CleanupStack::PushL( scheduler ); + CActiveScheduler::Install( scheduler ); + + CSecuiDialogNotifierServer* server = CSecuiDialogNotifierServer::NewLC(); + User::LeaveIfError( User::RenameThread( KSecuiDialogNotifierServerName ) ); + TRACE( "SecuiDialogNotifierServer: MainL, rendezvous" ); + + RProcess::Rendezvous( KErrNone ); + TRACE( "SecuiDialogNotifierServer: MainL, activescheduler start" ); + CActiveScheduler::Start(); + + TRACE( "SecuiDialogNotifierServer: MainL, cleanup" ); + CleanupStack::PopAndDestroy( server ); + CleanupStack::PopAndDestroy( scheduler ); + } + +// --------------------------------------------------------------------------- +// E32Main() +// --------------------------------------------------------------------------- +// +GLDEF_C TInt E32Main() + { + CTrapCleanup* cleanup = CTrapCleanup::New(); + + TRAPD( err, MainL() ); + __ASSERT_ALWAYS( !err, User::Panic( KSecuiDialogNotifierServerName, err ) ); + + delete cleanup; + return err; + } + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/src/secuidialognotifiersession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/src/secuidialognotifiersession.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,246 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Secui dialog notifier server session +* +*/ + +#include "secuidialognotifiersession.h" // CSecuiDialogNotifierSession +#include "secuidialognotifierserver.h" // CSecuiDialogNotifierServer +#include "secuidialognotifierservername.h" // KSecuiDialogsCancelOperation +// #include "secuidialogoperserverauthfail.h" // CServerAuthFailOperation +#include "secuidialogoperbasicpinquery.h" // CBasicPinQueryOperation +#include "secuidialogstrace.h" // TRACE macro +#include // TSecurityDialogOperation +#include + +const TInt KInputParam = 0; +const TInt KOutputParam = 1; + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierSession::NewL() +// --------------------------------------------------------------------------- +// +CSecuiDialogNotifierSession* CSecuiDialogNotifierSession::NewL() + { + TRACE( "CBasicPinQueryOperation::RunL, 1 =%d", 1 ); + CSecuiDialogNotifierSession* self = new( ELeave ) CSecuiDialogNotifierSession; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierSession::~CSecuiDialogNotifierSession() +// --------------------------------------------------------------------------- +// +CSecuiDialogNotifierSession::~CSecuiDialogNotifierSession() + { + TRACE( "CSecuiDialogNotifierSession::~CSecuiDialogNotifierSession, begin" ); + Server().RemoveSession(); + delete iOperationHandler; + iOperationHandler = NULL; + delete iInputBuffer; + iInputBuffer = NULL; + TRACE( "CSecuiDialogNotifierSession::~CSecuiDialogNotifierSession, end" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierSession::CreateL() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifierSession::CreateL() + { + TRACE( "CSecuiDialogNotifierSession::~CSecuiDialogNotifierSession" ); + Server().AddSession(); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierSession::ServiceL() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifierSession::ServiceL( const RMessage2& aMessage ) + { + TRACE( "CSecuiDialogNotifierSession::ServiceL, message 0x%08x", aMessage.Handle() ); + TRAPD( error, DispatchMessageL( aMessage ) ); + TRACE( "CSecuiDialogNotifierSession::ServiceL, dispatched, error %d", error ); + if( error && !aMessage.IsNull() ) + { + TRACE( "CSecuiDialogNotifierSession::ServiceL, completing msg 0x%08x", + aMessage.Handle() ); + aMessage.Complete( error ); + } + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierSession::OperationComplete() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifierSession::OperationComplete() + { + TRACE( "CSecuiDialogNotifierSession::OperationComplete, begin" ); + delete iOperationHandler; + iOperationHandler = NULL; + TRACE( "CSecuiDialogNotifierSession::OperationComplete, end" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierSession::CSecuiDialogNotifierSession() +// --------------------------------------------------------------------------- +// +CSecuiDialogNotifierSession::CSecuiDialogNotifierSession() + { + TRACE( "CSecuiDialogNotifierSession::CSecuiDialogNotifierSession" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierSession::ConstructL() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifierSession::ConstructL() + { + TRACE( "CSecuiDialogNotifierSession::ConstructL" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierSession::Server() +// --------------------------------------------------------------------------- +// +CSecuiDialogNotifierServer& CSecuiDialogNotifierSession::Server() + { + return *static_cast< CSecuiDialogNotifierServer* >( + const_cast< CServer2* >( CSession2::Server() ) ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierSession::DispatchMessageL() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifierSession::DispatchMessageL( const RMessage2& aMessage ) + { + TRACE( "CSecuiDialogNotifierSession::DispatchMessageL, begin" ); + if( !IsOperationCancelled( aMessage ) ) + { + TInt lOperation = aMessage.Function(); + TSecurityDialogOperation operation = + static_cast< TSecurityDialogOperation >( lOperation ); + TRACE( "CSecuiDialogNotifierSession::DispatchMessageL, operation=%d", operation ); + + // from AskSecCodeInAutoLockL + if(lOperation==0x100+6 /*RMobilePhone::EPhonePasswordRequired*/) + { + TRACE( "CSecuiDialogNotifierSession::DispatchMessageL, query from AskSecCodeInAutoLockL . No need to start Autolock.exe =%d", 0 ); + } + else + { + CKeyguardAccessApi* iKeyguardAccess = CKeyguardAccessApi::NewL( ); + TRACE( "CBasicPinQueryOperation::RunL, 1 =%d", 1 ); + TInt err = iKeyguardAccess->ShowKeysLockedNote( ); + TRACE( "CBasicPinQueryOperation::RunL, err =%d", err ); + delete iKeyguardAccess; + } + TRACE( "CBasicPinQueryOperation::RunL, lOperation =%d", lOperation ); + if( lOperation >= 0x1000 ) // flag for iStartup + lOperation -= 0x1000; + TRACE( "CBasicPinQueryOperation::RunL, new lOperation =%d", lOperation ); + if( lOperation < 0x200 ) + { + BasicPinOperationL( aMessage ); + } + else + { + TRACE( "CBasicPinQueryOperation::RunL, lOperation =%d", lOperation ); + User::Leave( KErrNotSupported ); + } + } + TRACE( "CSecuiDialogNotifierSession::DispatchMessageL, end" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierSession::IsOperationCancelled() +// --------------------------------------------------------------------------- +// +TBool CSecuiDialogNotifierSession::IsOperationCancelled( const RMessage2& aMessage ) + { + TBool isCancelled = EFalse; + if( aMessage.Function() == KSecuiDialogCancelOperation ) + { + if( iOperationHandler ) + { + TRACE( "CSecuiDialogNotifierSession::CheckIfOperationCancelledL, cancelling" ); + iOperationHandler->CancelOperation(); + } + TRACE( "CSecuiDialogNotifierSession::CheckIfOperationCancelledL, completing msg 0x%08x", + aMessage.Handle() ); + aMessage.Complete( KErrNone ); + isCancelled = ETrue; + } + return isCancelled; + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierSession::GetInputBufferL() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifierSession::GetInputBufferL( const RMessage2& aMessage ) + { + TInt inputLength = aMessage.GetDesLength( KInputParam ); + TRACE( "CSecuiDialogNotifierSession::GetInputBufferL, inputLength=%d", inputLength ); + __ASSERT_ALWAYS( inputLength > 0, User::Leave( KErrCorrupt ) ); + if( iInputBuffer ) + { + delete iInputBuffer; + iInputBuffer = NULL; + } + iInputBuffer = HBufC8::NewL( inputLength ); + TPtr8 inputBufferPtr( iInputBuffer->Des() ); + aMessage.ReadL( KInputParam, inputBufferPtr ); + TRACE( "CSecuiDialogNotifierSession::GetInputBufferL, read complete" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierSession::ServerAuthenticationFailureL() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifierSession::ServerAuthenticationFailureL( const RMessage2& aMessage ) + { + TRACE( "CSecuiDialogNotifierSession::ServerAuthenticationFailureL, begin" ); + GetInputBufferL( aMessage ); + + ASSERT( iOperationHandler == NULL ); + // iOperationHandler = CServerAuthFailOperation::NewL( *this, aMessage, KOutputParam ); + // iOperationHandler->StartL( *iInputBuffer ); + + TRACE( "CSecuiDialogNotifierSession::ServerAuthenticationFailureL, end" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogNotifierSession::BasicPinOperationL() +// --------------------------------------------------------------------------- +// +void CSecuiDialogNotifierSession::BasicPinOperationL( const RMessage2& aMessage ) + { + TRACE( "CSecuiDialogNotifierSession::BasicPinOperationL, begin" ); + GetInputBufferL( aMessage ); + + ASSERT( iOperationHandler == NULL ); + iOperationHandler = CBasicPinQueryOperation::NewL( *this, aMessage, KOutputParam ); + iOperationHandler->StartL( *iInputBuffer ); + + TRACE( "CSecuiDialogNotifierSession::BasicPinOperationL, end" ); + } + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/src/secuidialogoperation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/src/secuidialogoperation.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for CSecuiDialog operations +* +*/ + +#include "secuidialogoperation.h" // CSecuiDialogOperation +#include "secuidialogoperationobserver.h" // MSecuiDialogOperationObserver +#include // CHbDeviceMessageBoxSymbian +#include "secuidialogstrace.h" // TRACE macro + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSecuiDialogOperation::CSecuiDialogOperation() +// --------------------------------------------------------------------------- +// +CSecuiDialogOperation::CSecuiDialogOperation( + MSecuiDialogOperationObserver& aObserver, const RMessage2& aMessage, + TInt aReplySlot ) : CActive( CActive::EPriorityStandard ), iObserver( aObserver ), + iMessage( aMessage ), iReplySlot( aReplySlot ) + { + TRACE( "CSecuiDialogOperation::CSecuiDialogOperation, iMessage 0x%08x", + iMessage.Handle() ); + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogOperation::~CSecuiDialogOperation() +// --------------------------------------------------------------------------- +// +CSecuiDialogOperation::~CSecuiDialogOperation() + { + TRACE( "CSecuiDialogOperation::~CSecuiDialogOperation, begin" ); + Cancel(); + TRACE( "CSecuiDialogOperation::~CSecuiDialogOperation, end" ); + } + +// --------------------------------------------------------------------------- +// CSecuiDialogOperation::RunError() +// --------------------------------------------------------------------------- +// +TInt CSecuiDialogOperation::RunError( TInt aError ) + { + TRACE( "CSecuiDialogOperation::RunError, aError=%d", aError ); + if( !iMessage.IsNull() ) + { + TRACE( "CSecuiDialogOperation::RunError, completing message 0x%08x", + iMessage.Handle() ); + iMessage.Complete( aError ); + } + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CSecuiDialogOperation::ShowWarningNoteL() +// --------------------------------------------------------------------------- +// +void CSecuiDialogOperation::ShowWarningNoteL( const TDesC& aMessage ) + { + CHbDeviceMessageBoxSymbian *note = + CHbDeviceMessageBoxSymbian::NewL( CHbDeviceMessageBoxSymbian::EWarning ); + CleanupStack::PushL( note ); + note->SetTextL( aMessage ); + (void)note->ExecL(); // waits for response or timeout + CleanupStack::PopAndDestroy( note ); + } + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/src/secuidialogoperbasicpinquery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/src/secuidialogoperbasicpinquery.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,339 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Basic PIN query operation in secui dialog +* +*/ + +#include "secuidialogoperbasicpinquery.h" // CBasicPinQueryOperation +#include "secuidialogoperationobserver.h" // MSecuiDialogOperationObserver +#include // HbTextResolverSymbian +#include "secuidialogstrace.h" // TRACE macro + +// TODO: fix this +#include "../../../securitydialogs/SecUi/Inc/SecQueryUi.h" // CSecQueryUi + +#include +#include +#include +#include +#include +#include +#include + +const TInt KPhoneIndex( 0 ); +const TInt KTriesToConnectServer( 2 ); +const TInt KTimeBeforeRetryingServerConnection( 50000 ); + +_LIT( KMmTsyModuleName, "PhoneTsy"); + +// Descriptors for different password queries +_LIT( KBasicPinQueryKeyStorePassphrase, "Key store passphrase" ); +_LIT( KBasicPinQueryNewKeyStorePassphrase, "New key store passphrase" ); +_LIT( KBasicPinQueryImportedKeyFilePassphrase, "Passphrase of the imported key file" ); +_LIT( KBasicPinQueryExportedKeyFilePassphrase, "Passphrase of the exported key file" ); +_LIT( KBasicPinQueryPKCS12, "PKCS12"); + + + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CBasicPinQueryOperation::NewL() +// --------------------------------------------------------------------------- +// +CBasicPinQueryOperation* CBasicPinQueryOperation::NewL( + MSecuiDialogOperationObserver& aObserver, const RMessage2& aMessage, + TInt aReplySlot ) + { + TRACE( "CBasicPinQueryOperation::NewL, aMessage 0x%08x", aMessage.Handle() ); + TRACE( "CBasicPinQueryOperation::NewL, aMessage.Function = 0x%08x", aMessage.Function() ); + return new( ELeave ) CBasicPinQueryOperation( aObserver, aMessage, aReplySlot ); + } + +// --------------------------------------------------------------------------- +// CBasicPinQueryOperation::~CBasicPinQueryOperation() +// --------------------------------------------------------------------------- +// +CBasicPinQueryOperation::~CBasicPinQueryOperation() + { + TRACE( "CBasicPinQueryOperation::~CBasicPinQueryOperation" ); + Cancel(); + iPinInput = NULL; // not owned + } + +// --------------------------------------------------------------------------- +// CBasicPinQueryOperation::StartL() +// --------------------------------------------------------------------------- +// +void CBasicPinQueryOperation::StartL( const TDesC8& aBuffer ) + { + TRACE( "CBasicPinQueryOperation::StartL" ); + iPinInput = reinterpret_cast< const TPINInput* >( aBuffer.Ptr() ); + ASSERT( iPinInput != NULL ); + + iStatus = KRequestPending; + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + SetActive(); + } + +// --------------------------------------------------------------------------- +// CBasicPinQueryOperation::CancelOperation() +// --------------------------------------------------------------------------- +// +void CBasicPinQueryOperation::CancelOperation() + { + TRACE( "CBasicPinQueryOperation::CancelOperation" ); + // nothing to do + } + +// --------------------------------------------------------------------------- +// CBasicPinQueryOperation::RunL() +// --------------------------------------------------------------------------- +// +void CBasicPinQueryOperation::RunL() + { + TRACE( "CBasicPinQueryOperation::RunL, iStatus.Int()=%d", iStatus.Int() ); + User::LeaveIfError( iStatus.Int() ); + + TBool isRetry = ( iPinInput->iOperation & EPINValueIncorrect ); + if( isRetry ) + { + // Show "Invalid PIN code" error note, as previous attempt was failed. + // TODO: localized UI string needed + _LIT( KInvalidPinCode, "Invalid PIN code" ); + ShowWarningNoteL( KInvalidPinCode ); + } +TRACE( "CBasicPinQueryOperation::RunL, iPinInput->iOperation=%d", iPinInput->iOperation ); + + HBufC* caption = NULL; + if( iPinInput->iPIN.iPINLabel == KBasicPinQueryKeyStorePassphrase ) + { + TRACE( "CBasicPinQueryOperation::RunL, KBasicPinQueryKeyStorePassphrase =%d", 1 ); + + // TODO: localized UI string needed + _LIT( KText, "Keystore password:" ); + caption = KText().AllocLC(); + } + else if( iPinInput->iPIN.iPINLabel == KBasicPinQueryNewKeyStorePassphrase ) + { + TRACE( "CBasicPinQueryOperation::RunL, KBasicPinQueryNewKeyStorePassphrase =%d", 1 ); + + // "Keystore password must be created for using private keys." + // SecUi creates two input fields when caption contains two labels + // separated with a vertical bar. SecUi verifies that user types the + // same passphrase in both fields. + // TODO: localized UI strings needed + _LIT( KText, "Create keystore password:|Verify:" ); + caption = KText().AllocLC(); + } + else if( iPinInput->iPIN.iPINLabel == KBasicPinQueryImportedKeyFilePassphrase ) + { + TRACE( "CBasicPinQueryOperation::RunL, KBasicPinQueryImportedKeyFilePassphrase =%d", 1 ); + + // "Enter code for imported key:" + // TODO: localized UI strings needed + _LIT( KText, "Enter code for imported key:|Verify:" ); + caption = KText().AllocLC(); + } + else if( iPinInput->iPIN.iPINLabel == KBasicPinQueryExportedKeyFilePassphrase ) + { + TRACE( "CBasicPinQueryOperation::RunL, KBasicPinQueryExportedKeyFilePassphrase =%d", 1 ); + + // "Enter new code for exported key:" + // TODO: localized UI strings needed + _LIT( KText, "Enter new code for exported key:|Verify:" ); + caption = KText().AllocLC(); + } + else if( iPinInput->iPIN.iPINLabel == KBasicPinQueryPKCS12 ) + { + TRACE( "CBasicPinQueryOperation::RunL, KBasicPinQueryPKCS12 =%d", 1 ); + + // "Password for %U:", PKCS#12 password query prompt + // TODO: localized UI string needed + _LIT( KText, "Password for PKCS#12 file:" ); + caption = KText().AllocLC(); + } + else + { + TRACE( "CBasicPinQueryOperation::RunL, else =%d", 1 ); + + // "Enter code for %0U in %1U" + // Data query for PIN request in keystore where %0U is the PIN's name %1U is the keystore's name. + // TODO: EEnterPinNR + _LIT( KText, "86" ); + caption = KText().AllocLC(); + } + iPinValue.Copy(_L("0")); + TRACE( "CBasicPinQueryOperation::RunL, 1 =%d", 1 ); + + TInt resultVerif = KErrNone; + TRACE( "CBasicPinQueryOperation::RunL, 1 =%d", 1 ); + + { + RMobilePhone iPhone; + + TInt err( KErrGeneral); + TRACE( "CBasicPinQueryOperation::RunL, ESecurityQueryActive =%d", ESecurityQueryActive ); + err = RProperty::Set(KPSUidStartup, KStartupSecurityCodeQueryStatus, ESecurityQueryActive); + TRACE( "CBasicPinQueryOperation::RunL, err =%d", err ); + + TInt thisTry( 0); + RTelServer iTelServer; + RMmCustomAPI iCustomPhone; + while ( ( err = iTelServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) + { + User::After( KTimeBeforeRetryingServerConnection ); + } + err = iTelServer.LoadPhoneModule( KMmTsyModuleName ); + RTelServer::TPhoneInfo PhoneInfo; + err = iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) ; + err = iTelServer.GetPhoneInfo( KPhoneIndex, PhoneInfo ) ; + err = iPhone.Open( iTelServer, PhoneInfo.iName ) ; + err = iCustomPhone.Open( iPhone ) ; + TRACE( "CBasicPinQueryOperation::RunL, err =%d", err ); + CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); + CleanupStack::PushL(handler); + // TSecUi::InitializeLibL(); + TRACE( "CBasicPinQueryOperation::RunL, TMobilePhoneSecurityEvent 1 =%d", 1 ); + RMobilePhone::TMobilePhoneSecurityEvent iEvent; + TInt lEvent = iPinInput->iOperation; + TRACE( "CBasicPinQueryOperation::RunL, lEvent =%d", lEvent ); + if( lEvent >= 0x1000 ) // flag for iStartUp + { + lEvent-=0x1000; + } + iEvent = static_cast(lEvent); + TRACE( "CBasicPinQueryOperation::RunL, iEvent =%d", iEvent ); + TRACE( "CBasicPinQueryOperation::RunL, TBool iStartUp =%d", iStartUp ); + TRAPD( resultHandler, handler->HandleEventL( iEvent, iStartUp, resultVerif ) ); + TRACE( "CBasicPinQueryOperation::RunL, resultHandler =%d", resultHandler ); + TRACE( "CBasicPinQueryOperation::RunL, resultVerif =%d", resultVerif ); + + // if something went wrong cancel the code request + if (resultHandler) + { + if(resultVerif==KErrNone) // if the process failed, then the result shoud also indicate the failure (unless it does it already) + resultVerif = resultHandler; + TRACE( "CBasicPinQueryOperation::RunL, iEvent =%d", iEvent ); + TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); + TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); + switch (iEvent) + { + case RMobilePhone::EUniversalPinRequired: + if(wcdmaSupported || upinSupported) + { + iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPin); + } + break; + case RMobilePhone::EUniversalPukRequired: + if(wcdmaSupported || upinSupported) + { + iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPuk); + } + break; + case RMobilePhone::EPin1Required: + iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1); + break; + case RMobilePhone::EPuk1Required: + iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePuk1); + break; + case RMobilePhone::EPin2Required: + iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin2); + break; + case RMobilePhone::EPuk2Required: + iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePuk2); + break; + case RMobilePhone::EPhonePasswordRequired: + iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePhonePassword); + break; + default: + TRACE( "CBasicPinQueryOperation::RunL, default iEvent =%d", iEvent ); + break; + } + } + + // uninitialize security ui + TRACE( "CBasicPinQueryOperation::RunL, PopAndDestroy(handler) =%d", 0 ); + CleanupStack::PopAndDestroy(handler); // handler + TRACE( "CBasicPinQueryOperation::RunL, UnInitializeLib =%d", 1 ); + TSecUi::UnInitializeLib(); + TRACE( "CBasicPinQueryOperation::RunL, ESecurityQueryNotActive =%d", ESecurityQueryNotActive ); + err = RProperty::Set(KPSUidStartup, KStartupSecurityCodeQueryStatus, ESecurityQueryNotActive); + TRACE( "CBasicPinQueryOperation::RunL, err =%d", err ); + //close ETel connection + if (iTelServer.Handle()) + { + TRACE( "CBasicPinQueryOperation::RunL, iPhone.Close =%d", 0 ); + iPhone.Close(); + iTelServer.UnloadPhoneModule(KMmTsyModuleName); + iTelServer.Close(); + TRACE( "CBasicPinQueryOperation::RunL, iTelServer.Close =%d", 1 ); + } + } + + + ReturnResultL( resultVerif ); + + if( caption ) + { + CleanupStack::PopAndDestroy( caption ); + caption = NULL; + } + } + +// --------------------------------------------------------------------------- +// CBasicPinQueryOperation::DoCancel() +// --------------------------------------------------------------------------- +// +void CBasicPinQueryOperation::DoCancel() + { + TRACE( "CBasicPinQueryOperation::DoCancel" ); + } + +// --------------------------------------------------------------------------- +// CBasicPinQueryOperation::CBasicPinQueryOperation() +// --------------------------------------------------------------------------- +// +CBasicPinQueryOperation::CBasicPinQueryOperation( + MSecuiDialogOperationObserver& aObserver, const RMessage2& aMessage, + TInt aReplySlot ) : CSecuiDialogOperation( aObserver, aMessage, aReplySlot ) + { + TRACE( "CBasicPinQueryOperation::CBasicPinQueryOperation, aMessage 0x%08x", aMessage.Handle() ); + TRACE( "CBasicPinQueryOperation::CBasicPinQueryOperation, aMessage.Function = 0x%08x", aMessage.Function() ); + iStartUp=EFalse; + if(aMessage.Function()>=0x1000) + iStartUp=ETrue; + } + +// --------------------------------------------------------------------------- +// CBasicPinQueryOperation::ReturnResultL() +// --------------------------------------------------------------------------- +// +void CBasicPinQueryOperation::ReturnResultL( TInt aErrorCode ) + { + TRACE( "CBasicPinQueryOperation::ReturnResultL, begin, aErrorCode=%d", aErrorCode ); + if( aErrorCode <= KErrNone ) // TODO should skip WriteL is error? + { + TPINValueBuf output( iPinValue ); + iMessage.WriteL( iReplySlot, output ); + } + TRACE( "CBasicPinQueryOperation::ReturnResultL, completing msg 0x%08x", iMessage.Handle() ); + iMessage.Complete( aErrorCode ); + TRACE( "CBasicPinQueryOperation::ReturnResultL, informing observer" ); + iObserver.OperationComplete(); + TRACE( "CBasicPinQueryOperation::ReturnResultL, end" ); + } + diff -r 25dd1e8b2663 -r 881d92421467 securitydialogs/secuidialognotifiersrv/src/untrustedcertquery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuidialognotifiersrv/src/untrustedcertquery.cpp Tue Sep 28 14:03:54 2010 +0300 @@ -0,0 +1,250 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Displays untrusted certificate dialog +* +*/ + +#include "untrustedcertquery.h" // CUntrustedCertQuery +#include // CHbSymbianVariantMap +#include "secuidialogstrace.h" // TRACE macro + +// Note that the dialog type string, the parameters name strings, and the return code +// name string and values must match to those defined in Qt-side untrusted certificate +// dialog (in untrustedcertificatedefinitions.h file). + +// Device dialog type for untrusted certificate dialog +_LIT( KUntrustedCertificateDialog, "com.nokia.untrustedcert/1.0" ); + +// Variant map parameter names for untrusted certificate dialog +_LIT( KUntrustedCertEncodedCertificate, "cert" ); // bytearray, mandatory +_LIT( KUntrustedCertServerName, "host" ); // string, mandatory +_LIT( KUntrustedCertValidationError, "err" ); // int (TValidationError), mandatory +_LIT( KUntrustedCertTrustedSiteStoreFail, "tss" ); // any, prevents permanent acceptance + +// Dialog return code name and values +_LIT( KUntrustedCertDialogResult, "result" ); // int +const TInt KUntrustedCertDialogRejected = 0; +const TInt KUntrustedCertDialogAccepted = 1; +const TInt KUntrustedCertDialogAcceptedPermanently = 2; + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::NewL() +// --------------------------------------------------------------------------- +// +CUntrustedCertQuery* CUntrustedCertQuery::NewL( + TValidationError aValidationError, const TDesC8& aCertificate, + const TDesC& aServerName, TBool aCanHandlePermanentAccept ) + { + TRACE( "CUntrustedCertQuery::NewL" ); + CUntrustedCertQuery* self = new ( ELeave ) CUntrustedCertQuery( + aValidationError, aCertificate, aServerName, + aCanHandlePermanentAccept ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::~CUntrustedCertQuery() +// --------------------------------------------------------------------------- +// +CUntrustedCertQuery::~CUntrustedCertQuery() + { + TRACE( "CUntrustedCertQuery::~CUntrustedCertQuery, begin" ); + Cancel(); + delete iWait; + iWait = NULL; + delete iDeviceDialog; + iDeviceDialog = NULL; + delete iVariantMap; + iVariantMap = NULL; + TRACE( "CUntrustedCertQuery::~CUntrustedCertQuery, end" ); + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::ShowQueryAndWaitForResponseL() +// --------------------------------------------------------------------------- +// +void CUntrustedCertQuery::ShowQueryAndWaitForResponseL( TResponse& aResponse ) + { + TRACE( "CUntrustedCertQuery::ShowQueryAndWaitForResponseL, begin" ); + if( !iDeviceDialog ) + { + iDeviceDialog = CHbDeviceDialogSymbian::NewL(); + } + if( !iVariantMap ) + { + iVariantMap = CHbSymbianVariantMap::NewL(); + } + + CHbSymbianVariant *variant = NULL; + variant = CHbSymbianVariant::NewL( &iCertificate, CHbSymbianVariant::EBinary ); + User::LeaveIfError( iVariantMap->Add( KUntrustedCertEncodedCertificate, variant ) ); + variant = CHbSymbianVariant::NewL( &iValidationError, CHbSymbianVariant::EInt ); + User::LeaveIfError( iVariantMap->Add( KUntrustedCertValidationError, variant ) ); + variant = CHbSymbianVariant::NewL( &iServerName, CHbSymbianVariant::EDes ); + User::LeaveIfError( iVariantMap->Add( KUntrustedCertServerName, variant ) ); + if( !iCanHandlePermanentAccept ) + { + variant = CHbSymbianVariant::NewL( &iCanHandlePermanentAccept, CHbSymbianVariant::EBool ); + User::LeaveIfError( iVariantMap->Add( KUntrustedCertTrustedSiteStoreFail, variant ) ); + } + + User::LeaveIfError( iDeviceDialog->Show( KUntrustedCertificateDialog, *iVariantMap, this ) ); + iStatus = KRequestPending; + SetActive(); + + TRACE( "CUntrustedCertQuery::ShowQueryAndWaitForResponseL, iWait start" ); + iWait->Start(); + TRACE( "CUntrustedCertQuery::ShowQueryAndWaitForResponseL, iWaitCompletionCode=%d", + iWaitCompletionCode ); + User::LeaveIfError( iWaitCompletionCode ); + TRACE( "CUntrustedCertQuery::ShowQueryAndWaitForResponseL, iResponse=%d", iResponse ); + aResponse = iResponse; + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::DoCancel() +// --------------------------------------------------------------------------- +// +void CUntrustedCertQuery::DoCancel() + { + TRACE( "CUntrustedCertQuery::DoCancel, begin" ); + if( iDeviceDialog ) + { + TRACE( "CUntrustedCertQuery::DoCancel, cancelling device dialog" ); + iDeviceDialog->Cancel(); + } + + // Have to complete the request here, because cancelled device dialog does not + // call DeviceDialogClosed() that normally completes it. The request needs to + // be completed since CActive::Cancel() waits until the request is completed. + TRACE( "CUntrustedCertQuery::DoCancel, completing self with KErrCancel" ); + TRequestStatus* status( &iStatus ); + User::RequestComplete( status, KErrCancel ); + + // Normally the above request complete would trigger running RunL(). Now RunL() + // is not run since the active object is already cancelled. Hence, have to stop + // the waiting here so that iWait->Start() returns. + iWaitCompletionCode = KErrCancel; + if( iWait && iWait->IsStarted() ) + { + TRACE( "CUntrustedCertQuery::DoCancel, stopping iWait" ); + iWait->AsyncStop(); + } + TRACE( "CUntrustedCertQuery::DoCancel, end" ); + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::RunL() +// --------------------------------------------------------------------------- +// +void CUntrustedCertQuery::RunL() + { + TRACE( "CUntrustedCertQuery::RunL, iStatus.Int()=%d", iStatus.Int() ); + iWaitCompletionCode = iStatus.Int(); + if( iWait && iWait->IsStarted() ) + { + TRACE( "CUntrustedCertQuery::RunL, stopping iWait" ); + iWait->AsyncStop(); + } + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::DataReceived() +// --------------------------------------------------------------------------- +// +void CUntrustedCertQuery::DataReceived( CHbSymbianVariantMap& aData ) + { + TRACE( "CUntrustedCertQuery::DataReceived" ); + const CHbSymbianVariant* variant = aData.Get( KUntrustedCertDialogResult ); + if( variant ) + { + TInt* value = variant->Value(); + if( value ) + { + switch( *value ) + { + case KUntrustedCertDialogRejected: + TRACE( "CUntrustedCertQuery::DataReceived, rejected" ); + iResponse = EQueryRejected; + break; + case KUntrustedCertDialogAccepted: + TRACE( "CUntrustedCertQuery::DataReceived, accepted" ); + iResponse = EQueryAccepted; + break; + case KUntrustedCertDialogAcceptedPermanently: + TRACE( "CUntrustedCertQuery::DataReceived, accepted permanently" ); + iResponse = EQueryAcceptedPermanently; + break; + default: + __ASSERT_DEBUG( EFalse, User::Invariant() ); + break; + } + } + else + { + __ASSERT_DEBUG( EFalse, User::Invariant() ); + } + } + else + { + __ASSERT_DEBUG( EFalse, User::Invariant() ); + } + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::DeviceDialogClosed() +// --------------------------------------------------------------------------- +// +void CUntrustedCertQuery::DeviceDialogClosed( TInt aCompletionCode ) + { + TRACE( "CUntrustedCertQuery::DeviceDialogClosed, aCompletionCode=%d", aCompletionCode ); + if( IsActive() ) + { + TRACE( "CUntrustedCertQuery::DeviceDialogClosed, request complete" ); + TRequestStatus* status( &iStatus ); + User::RequestComplete( status, aCompletionCode ); + } + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::CUntrustedCertQuery() +// --------------------------------------------------------------------------- +// +CUntrustedCertQuery::CUntrustedCertQuery( + TValidationError aValidationError, const TDesC8& aCertificate, + const TDesC& aServerName, TBool aCanHandlePermanentAccept ) : + CActive( CActive::EPriorityStandard ), iValidationError( aValidationError ), + iCertificate( aCertificate ), iServerName( aServerName ), + iCanHandlePermanentAccept( aCanHandlePermanentAccept ), + iResponse( EQueryRejected ) + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::ConstructL() +// --------------------------------------------------------------------------- +// +void CUntrustedCertQuery::ConstructL() + { + TRACE( "CUntrustedCertQuery::ConstructL" ); + iWait = new( ELeave ) CActiveSchedulerWait; + } + diff -r 25dd1e8b2663 -r 881d92421467 securitysrv.pro --- a/securitysrv.pro Fri Sep 03 16:31:27 2010 +0300 +++ b/securitysrv.pro Tue Sep 28 14:03:54 2010 +0300 @@ -19,4 +19,3 @@ SUBDIRS += securitydialogs/securitydialogs.pro SUBDIRS += cpsecplugins/cpsecplugins.pro SUBDIRS += pkiutilities/pkiutilities.pro - diff -r 25dd1e8b2663 -r 881d92421467 wim/WimServer/group/WimServer.mmp --- a/wim/WimServer/group/WimServer.mmp Fri Sep 03 16:31:27 2010 +0300 +++ b/wim/WimServer/group/WimServer.mmp Tue Sep 28 14:03:54 2010 +0300 @@ -68,7 +68,7 @@ LIBRARY Asn1.lib // Used to decode trusted usage OID's LIBRARY Customapi.lib // CustomAPI (used in SIM file reading) LIBRARY Etel.lib Etelmm.lib // RTelServer, RMobilePhone -LIBRARY Estlib.lib Euser.lib // Symbian basic libraries +LIBRARY Estlib.lib euser.lib // Symbian basic libraries LIBRARY Ctframework.lib // Crypto token framework LIBRARY Efsrv.lib // File server LIBRARY Edbms.lib // Database server