locationsystemui/locationsysui/privacyverifiernotifierui/locverifier/src/lpdglobalplugindialog.cpp
changeset 40 16118e24b93b
parent 32 b12ea03c50a3
equal deleted inserted replaced
33:834e27cad510 40:16118e24b93b
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include "lpdglobalplugindialog.h"
    20 #include "lpdglobalplugindialog.h"
    21 #include "lpddlgobserver.h"
    21 #include "lpddlgobserver.h"
    22 #include "lpdrequestorprocessor.h"
    22 #include "lpdrequestorprocessor.h"
       
    23 #include "locverifierdlgdebug.h"
    23 
    24 
    24 #include <lbs/EPos_CPosContactRequestor.h>
    25 #include <lbs/EPos_CPosContactRequestor.h>
    25 #include <lbs/EPos_CPosServiceRequestor.h>
    26 #include <lbs/EPos_CPosServiceRequestor.h>
    26 #include <lbs/EPos_CPosRequestor.h>
    27 #include <lbs/EPos_CPosRequestor.h>
    27 #include <hbsymbianvariant.h>
    28 #include <hbsymbianvariant.h>
    79 // Two-phased constructor.
    80 // Two-phased constructor.
    80 // -----------------------------------------------------------------------------
    81 // -----------------------------------------------------------------------------
    81 //
    82 //
    82 void CLpdGlobalPluginDialog::ConstructL()
    83 void CLpdGlobalPluginDialog::ConstructL()
    83     {
    84     {
       
    85     LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::ConstructL" );
    84     iMsgBox = CHbDeviceDialogSymbian::NewL();
    86     iMsgBox = CHbDeviceDialogSymbian::NewL();
    85     iNotification = CHbDeviceNotificationDialogSymbian::NewL(this);
    87     iNotification = CHbDeviceNotificationDialogSymbian::NewL(this);
    86     TBool result =
    88     TBool result =
    87             HbTextResolverSymbian::Init(KLocTsFileName, KLocTsFilePath);
    89             HbTextResolverSymbian::Init(KLocTsFileName, KLocTsFilePath);
    88     if (!result)
    90     if (!result)
    89         {
    91         {
    90         HbTextResolverSymbian::Init(KLocTsFileName, KLocTsAFileAltPath);
    92         HbTextResolverSymbian::Init(KLocTsFileName, KLocTsAFileAltPath);
    91         }
    93         }
       
    94     LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::ConstructL" );
    92     }
    95     }
    93 
    96 
    94 // -----------------------------------------------------------------------------
    97 // -----------------------------------------------------------------------------
    95 // CLpdGlobalPluginDialog::NewL
    98 // CLpdGlobalPluginDialog::NewL
    96 // Two-phased constructor.
    99 // Two-phased constructor.
   108     }
   111     }
   109 
   112 
   110 // Destructor
   113 // Destructor
   111 CLpdGlobalPluginDialog::~CLpdGlobalPluginDialog()
   114 CLpdGlobalPluginDialog::~CLpdGlobalPluginDialog()
   112 	{
   115 	{
       
   116    	 LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::~CLpdGlobalPluginDialog" );
   113    	delete iMsgBox;
   117    	delete iMsgBox;
   114 	iMsgBox = NULL;
   118 	iMsgBox = NULL;
   115 	
   119 	
   116 	delete iNotification;
   120 	delete iNotification;
   117 	iNotification = NULL;
   121 	iNotification = NULL;
   118 	
   122 	
   119 	 delete iRequestInfo;
   123 	 delete iRequestInfo;
   120 	 iRequestInfo=NULL;
   124 	 iRequestInfo=NULL;
   121 	
   125 	 LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::~CLpdGlobalPluginDialog" );
   122 	}
   126 	}
   123 
   127 
   124 
   128 
   125 // -----------------------------------------------------------------------------
   129 // -----------------------------------------------------------------------------
   126 // CLpdGlobalPluginDialog::RunLD
   130 // CLpdGlobalPluginDialog::RunLD
   127 // (other items were commented in a header).
   131 // (other items were commented in a header).
   128 // -----------------------------------------------------------------------------
   132 // -----------------------------------------------------------------------------
   129 //
   133 //
   130 void CLpdGlobalPluginDialog::RunVerificationQueryL()
   134 void CLpdGlobalPluginDialog::RunVerificationQueryL()
   131     {
   135     {
       
   136     LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::RunVerificationQueryL" );
   132     mSymbianVariantMap = CHbSymbianVariantMap::NewL();
   137     mSymbianVariantMap = CHbSymbianVariantMap::NewL();
   133     CleanupStack::PushL(mSymbianVariantMap);
   138     CleanupStack::PushL(mSymbianVariantMap);
   134     
   139     
   135     AddVerDlgHeadingParamL();
   140     AddVerDlgHeadingParamL();
   136     AddQueryTextParamL();
   141     AddQueryTextParamL();
   141         {
   146         {
   142         sts->PlayTone(CSystemToneService::ELocationRequest);
   147         sts->PlayTone(CSystemToneService::ELocationRequest);
   143         }
   148         }
   144     CSystemToneService::Delete(sts);
   149     CSystemToneService::Delete(sts);
   145     CleanupStack::Pop(mSymbianVariantMap);
   150     CleanupStack::Pop(mSymbianVariantMap);
       
   151     LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::RunVerificationQueryL" );
   146     }
   152     }
   147 
   153 
   148 void CLpdGlobalPluginDialog::RunNotificationL()
   154 void CLpdGlobalPluginDialog::RunNotificationL()
   149     {
   155     {
       
   156     LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::RunNotificationL" );
   150     if( EPosDecisionByRequestSource == iRequestInfo->iNotifReason ||
   157     if( EPosDecisionByRequestSource == iRequestInfo->iNotifReason ||
   151         EPosVerificationTimeout == iRequestInfo->iNotifReason    )
   158         EPosVerificationTimeout == iRequestInfo->iNotifReason    )
   152         {
   159         {
   153         if ( EPosDecisionAccepted == iRequestInfo->iRequestDecision )
   160         if ( EPosDecisionAccepted == iRequestInfo->iRequestDecision )
   154             {
   161             {
   193         }
   200         }
   194     iNotification->SetTextL(buf);
   201     iNotification->SetTextL(buf);
   195     iNotification->SetTimeout(KNotificationTimeout);
   202     iNotification->SetTimeout(KNotificationTimeout);
   196     iNotification->EnableTouchActivation(ETrue);
   203     iNotification->EnableTouchActivation(ETrue);
   197     iNotification->ShowL();
   204     iNotification->ShowL();
       
   205     LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::RunNotificationL" );
   198     }
   206     }
   199 
   207 
   200 // -----------------------------------------------------------------------------
   208 // -----------------------------------------------------------------------------
   201 // CLpdGlobalPluginDialog::SetMessageTextL
   209 // CLpdGlobalPluginDialog::SetMessageTextL
   202 // (other items were commented in a header).
   210 // (other items were commented in a header).
   203 // -----------------------------------------------------------------------------
   211 // -----------------------------------------------------------------------------
   204 //
   212 //
   205 void CLpdGlobalPluginDialog::SetRequestInfoL( CLpdRequestorProcessor* aRequestInfo )
   213 void CLpdGlobalPluginDialog::SetRequestInfoL( CLpdRequestorProcessor* aRequestInfo )
   206     {
   214     {
       
   215     LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::SetRequestInfoL" );
   207     if(iRequestInfo)
   216     if(iRequestInfo)
   208         {
   217         {
   209         // clear and create again if already has been set before
   218         // clear and create again if already has been set before
   210         delete iRequestInfo;
   219         delete iRequestInfo;
   211         iRequestInfo=NULL;
   220         iRequestInfo=NULL;
   243             iRequestInfo->iRequestors.Append(contact);
   252             iRequestInfo->iRequestors.Append(contact);
   244             CleanupStack::Pop(contact);
   253             CleanupStack::Pop(contact);
   245             }
   254             }
   246         
   255         
   247         }
   256         }
       
   257     LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::SetRequestInfoL" );
   248     }
   258     }
   249 
   259 
   250 
   260 
   251 
   261 
   252 void CLpdGlobalPluginDialog::Cancel()
   262 void CLpdGlobalPluginDialog::Cancel()
   253     {
   263     {
   254     // Close any running dialogs if any.Close() doesnt have any effect if dialog is not running
   264     // Close any running dialogs if any.Close() doesnt have any effect if dialog is not running
       
   265     LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::Cancel" );
   255     isCancelled = ETrue;
   266     isCancelled = ETrue;
   256     iMsgBox->Cancel();
   267     iMsgBox->Cancel();
   257     iNotification->Close();
   268     iNotification->Close();
       
   269     LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::Cancel" );
   258     }
   270     }
   259 
   271 
   260 void CLpdGlobalPluginDialog::NotificationDialogActivated(
   272 void CLpdGlobalPluginDialog::NotificationDialogActivated(
   261         const CHbDeviceNotificationDialogSymbian */*aDialog*/)        
   273         const CHbDeviceNotificationDialogSymbian */*aDialog*/)        
   262     {
   274     {
       
   275     LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::NotificationDialogActivated" );
   263     // Complete with KErrNone now 
   276     // Complete with KErrNone now 
   264     TRAP_IGNORE(iCallBack.HandleDlgDismissedL( KErrNone ));
   277     TRAP_IGNORE(iCallBack.HandleDlgDismissedL( KErrNone ));
       
   278     LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::NotificationDialogActivated" );
   265     }
   279     }
   266 
   280 
   267 void CLpdGlobalPluginDialog::NotificationDialogClosed(
   281 void CLpdGlobalPluginDialog::NotificationDialogClosed(
   268         const CHbDeviceNotificationDialogSymbian */*aDialog*/,
   282         const CHbDeviceNotificationDialogSymbian */*aDialog*/,
   269         TInt aCompletionCode)
   283         TInt aCompletionCode)
   270     {
   284     {
       
   285     LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::NotificationDialogClosed" );
   271     TRAP_IGNORE(iCallBack.HandleDlgDismissedL( aCompletionCode ));
   286     TRAP_IGNORE(iCallBack.HandleDlgDismissedL( aCompletionCode ));
       
   287     LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::NotificationDialogClosed" );
   272     }
   288     }
   273 
   289 
   274 void CLpdGlobalPluginDialog::DataReceived(CHbSymbianVariantMap& /*aData*/)
   290 void CLpdGlobalPluginDialog::DataReceived(CHbSymbianVariantMap& /*aData*/)
   275     {
   291     {
       
   292     LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::DataReceived" );
   276     mDissmissed = ETrue;
   293     mDissmissed = ETrue;
   277     TRAP_IGNORE(iCallBack.HandleDlgDismissedL( KErrAccessDenied ));
   294     TRAP_IGNORE(iCallBack.HandleDlgDismissedL( KErrAccessDenied ));
       
   295     LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::DataReceived" );
   278     }
   296     }
   279 
   297 
   280 void CLpdGlobalPluginDialog::DeviceDialogClosed(TInt /*aCompletionCode*/)
   298 void CLpdGlobalPluginDialog::DeviceDialogClosed(TInt /*aCompletionCode*/)
   281     {
   299     {
       
   300      LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::DeviceDialogClosed" );
   282     if (!mDissmissed && !isCancelled)
   301     if (!mDissmissed && !isCancelled)
   283         {
   302         {
   284         TRAP_IGNORE(iCallBack.HandleDlgDismissedL( KErrNone ));
   303         TRAP_IGNORE(iCallBack.HandleDlgDismissedL( KErrNone ));
   285         }
   304         }
       
   305      LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::DeviceDialogClosed" );
   286     }
   306     }
   287 
   307 
   288 void CLpdGlobalPluginDialog::AddVerDlgHeadingParamL()
   308 void CLpdGlobalPluginDialog::AddVerDlgHeadingParamL()
   289     {
   309     {
       
   310     LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::AddVerDlgHeadingParamL" );
   290     HBufC* headingText = HbTextResolverSymbian::LoadL(KRequestHeading);
   311     HBufC* headingText = HbTextResolverSymbian::LoadL(KRequestHeading);
   291     CleanupStack::PushL(headingText);
   312     CleanupStack::PushL(headingText);
   292     CHbSymbianVariant* heading = CHbSymbianVariant::NewL(headingText,
   313     CHbSymbianVariant* heading = CHbSymbianVariant::NewL(headingText,
   293             CHbSymbianVariant::EDes);
   314             CHbSymbianVariant::EDes);
   294     CleanupStack::PushL(heading);
   315     CleanupStack::PushL(heading);
   295     mSymbianVariantMap->Add(KHeadingKey, heading );
   316     mSymbianVariantMap->Add(KHeadingKey, heading );
   296     CleanupStack::Pop(heading);
   317     CleanupStack::Pop(heading);
   297     CleanupStack::PopAndDestroy(headingText);
   318     CleanupStack::PopAndDestroy(headingText);
       
   319     LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::AddVerDlgHeadingParamL" );
   298     }
   320     }
   299 
   321 
   300 void CLpdGlobalPluginDialog::AddQueryTextParamL()
   322 void CLpdGlobalPluginDialog::AddQueryTextParamL()
   301     {
   323     {
       
   324      LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::AddQueryTextParamL" );
   302     HBufC * value = HBufC::NewL(KVariantMaxSize);
   325     HBufC * value = HBufC::NewL(KVariantMaxSize);
   303     CleanupStack::PushL(value);
   326     CleanupStack::PushL(value);
   304     HBufC * value2 = HBufC::NewL(KVariantMaxSize);
   327     HBufC * value2 = HBufC::NewL(KVariantMaxSize);
   305     CleanupStack::PushL(value2);
   328     CleanupStack::PushL(value2);
   306     HBufC* requestorText = HbTextResolverSymbian::LoadL(KRequestorText);
   329     HBufC* requestorText = HbTextResolverSymbian::LoadL(KRequestorText);
   385         }
   408         }
   386     mSymbianVariantMap->Add(KQueryTextKey, queryText);
   409     mSymbianVariantMap->Add(KQueryTextKey, queryText);
   387     CleanupStack::Pop(queryText2);
   410     CleanupStack::Pop(queryText2);
   388     CleanupStack::Pop(queryText);
   411     CleanupStack::Pop(queryText);
   389     CleanupStack::PopAndDestroy(3);
   412     CleanupStack::PopAndDestroy(3);
       
   413     LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::AddQueryTextParamL" );
   390     }
   414     }
   391 
   415 
   392 void CLpdGlobalPluginDialog::AddRequestorsParamL()
   416 void CLpdGlobalPluginDialog::AddRequestorsParamL()
   393     {
   417     {
   394 
   418     LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::AddRequestorsParamL" );
   395     CDesC16ArrayFlat* array = new CDesC16ArrayFlat(8);
   419     CDesC16ArrayFlat* array = new CDesC16ArrayFlat(8);
   396     TInt reqCount = iRequestInfo->iRequestors.Count();
   420     TInt reqCount = iRequestInfo->iRequestors.Count();
   397     if (!reqCount)
   421     if (!reqCount)
   398         {
   422         {
   399         HBufC* requestor = HbTextResolverSymbian::LoadL(KUnknownRequestor);
   423         HBufC* requestor = HbTextResolverSymbian::LoadL(KUnknownRequestor);
   412     TInt count = array->MdcaCount();
   436     TInt count = array->MdcaCount();
   413     MDesCArray* marray = static_cast<MDesCArray*> (array);
   437     MDesCArray* marray = static_cast<MDesCArray*> (array);
   414     CHbSymbianVariant* requestors = CHbSymbianVariant::NewL(marray,
   438     CHbSymbianVariant* requestors = CHbSymbianVariant::NewL(marray,
   415             CHbSymbianVariant::EDesArray);
   439             CHbSymbianVariant::EDesArray);
   416     mSymbianVariantMap->Add(KRequestorKey, requestors);
   440     mSymbianVariantMap->Add(KRequestorKey, requestors);
       
   441     LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::AddRequestorsParamL" );
   417     }
   442     }
   418 
   443 
   419 // End of file
   444 // End of file
   420 
   445