connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConfirmationQueryNotif.cpp
branchRCL_3
changeset 8 2e6c4614c58e
parent 0 5a93021fdf25
child 17 0a9e01492035
equal deleted inserted replaced
4:77415202bfc8 8:2e6c4614c58e
    30 #include <cmmanagerext.h>
    30 #include <cmmanagerext.h>
    31 #include <cmconnectionmethod.h>
    31 #include <cmconnectionmethod.h>
    32 #include <cmdestination.h>
    32 #include <cmdestination.h>
    33 #include <ConnectionUiUtilities.h>
    33 #include <ConnectionUiUtilities.h>
    34 #include <datamobilitycommsdattypes.h>
    34 #include <datamobilitycommsdattypes.h>
    35 
    35 #include <ctsydomainpskeys.h>
    36 
    36 
    37 using namespace CMManager;
    37 using namespace CMManager;
    38 
    38 
    39 // ================= MEMBER FUNCTIONS =======================
    39 // ================= MEMBER FUNCTIONS =======================
    40 
    40 
   107            aMessage.Complete( KErrServerBusy );
   107            aMessage.Complete( KErrServerBusy );
   108            return;
   108            return;
   109            }    
   109            }    
   110         }
   110         }
   111     
   111     
       
   112     // Check if emergency call is ongoing. If it is then do not display the dialog.    
       
   113     TInt err( KErrNone );
       
   114     TInt state( 0 );
       
   115 
       
   116     err = RProperty::Get(
       
   117             KPSUidCtsyEmergencyCallInfo,
       
   118             KCTSYEmergencyCallInfo,
       
   119             state );
       
   120     
       
   121     if ( err == KErrNone && state )
       
   122         {
       
   123         // Emergency call is active. Cancel connection. 
       
   124         CLOG_WRITE( "CConfirmationQueryNotif::StartL: Emergency call is active!" );
       
   125         aMessage.WriteL( aReplySlot, TPckg<TMsgQueryLinkedResults>( EMsgQueryCancelled ) );
       
   126         aMessage.Complete( KErrNone );
       
   127         return;
       
   128         }
       
   129     
   112     iChoice = EMsgQueryCancelled; 
   130     iChoice = EMsgQueryCancelled; 
   113     TPckgBuf<TConnUiUiDestConnMethodNoteId> input;
   131     TPckgBuf<TConnUiUiDestConnMethodNoteId> input;
   114     input.Copy( aBuffer );
   132     input.Copy( aBuffer );
   115     iNoteInfo = input();
   133     iNoteInfo = input();
   116     
   134     
   117     iReplySlot = aReplySlot;
   135     iReplySlot = aReplySlot;
   118     iMessage = aMessage;
   136     iMessage = aMessage;
   119     iCancelled = EFalse;
   137     iCancelled = EFalse;
   120     
   138 
   121     TCallBack cb( LaunchDialogL, this );
   139     if ( iLaunchDialogAsync )
   122     
   140         {
   123     if ( !iLaunchDialogAsync )
   141         delete iLaunchDialogAsync;
   124         {
   142         iLaunchDialogAsync = NULL;
       
   143         }
       
   144     
       
   145     if ( iNoteInfo.iNoteId == EConfirmMethodUsageQueryInHomeNetwork )
       
   146         {
       
   147         TCallBack cb( LaunchDialogL, this );
   125         iLaunchDialogAsync = new( ELeave ) CAsyncCallBack( cb, CActive::EPriorityHigh );    
   148         iLaunchDialogAsync = new( ELeave ) CAsyncCallBack( cb, CActive::EPriorityHigh );    
   126         }
   149         }
   127     
   150     else
       
   151         {
       
   152         TCallBack cb( LaunchDialogVisitorL, this );
       
   153         iLaunchDialogAsync = new( ELeave ) CAsyncCallBack( cb, CActive::EPriorityHigh );    
       
   154         }
       
   155 
   128     iLaunchDialogAsync->CallBack();
   156     iLaunchDialogAsync->CallBack();
   129     }
   157     }
   130 
   158 
   131 
   159 
   132 // ---------------------------------------------------------
   160 // ---------------------------------------------------------
   142         if ( !iMessage.IsNull() )
   170         if ( !iMessage.IsNull() )
   143             {
   171             {
   144             iMessage.Complete( KErrCancel );
   172             iMessage.Complete( KErrCancel );
   145             }
   173             }
   146         
   174         
   147         delete iDialog;
   175         if ( iDialog )
   148         iDialog = NULL;
   176             {
       
   177             delete iDialog;
       
   178             iDialog = NULL;
       
   179             }
       
   180         
       
   181         if ( iDialogVisitor )
       
   182             {
       
   183             delete iDialog;
       
   184             iDialog = NULL;
       
   185             }
   149         }
   186         }
   150     
   187     
   151     CLOG_LEAVEFN( "CConfirmationQueryNotif::Cancel" );
   188     CLOG_LEAVEFN( "CConfirmationQueryNotif::Cancel" );
   152     }
   189     }
   153 
   190 
   208     HBufC* thisTime = NULL;
   245     HBufC* thisTime = NULL;
   209 
   246 
   210     automatic = StringLoader::LoadLC( R_QTN_OCC_LIST_CS_DATA_HOME_NW_AUTOMATIC );
   247     automatic = StringLoader::LoadLC( R_QTN_OCC_LIST_CS_DATA_HOME_NW_AUTOMATIC );
   211     thisTime = StringLoader::LoadLC( R_QTN_OCC_LIST_CS_DATA_HOME_NW_THIS_TIME );
   248     thisTime = StringLoader::LoadLC( R_QTN_OCC_LIST_CS_DATA_HOME_NW_THIS_TIME );
   212                                 
   249                                 
   213     if ( myself->iNoteInfo.iNoteId == EConfirmMethodUsageQueryInHomeNetwork ) 
   250     heading = StringLoader::LoadLC( R_QTN_OCC_PRMPT_CS_DATA_HOME_NW );
   214         {
   251     messageBase = StringLoader::LoadLC( R_QTN_OCC_DETAIL_CS_DATA_HOME_NW );
   215         heading = StringLoader::LoadLC( R_QTN_OCC_PRMPT_CS_DATA_HOME_NW );
   252     // the order of the query options depends on the location
   216         messageBase = StringLoader::LoadLC( R_QTN_OCC_DETAIL_CS_DATA_HOME_NW );
   253     choices.Append(EMsgQueryAutomatically);
   217         // the order of the query options depends on the location
   254     choices.Append(EMsgQueryThisTime);
   218         choices.Append(EMsgQueryAutomatically);
   255     array->AppendL( *automatic );
   219         choices.Append(EMsgQueryThisTime);
   256     array->AppendL( *thisTime );
   220         array->AppendL( *automatic );
   257  
   221         array->AppendL( *thisTime );
       
   222         } 
       
   223     else 
       
   224         {
       
   225         heading = StringLoader::LoadLC( R_QTN_OCC_PRMPT_CS_DATA_FOREIGN_NW );
       
   226         messageBase = StringLoader::LoadLC( R_QTN_OCC_DETAIL_CS_DATA_FOREIGN_NW );
       
   227         // the order of the query options depends on the location
       
   228         choices.Append(EMsgQueryThisTime);
       
   229         choices.Append(EMsgQueryAutomatically);
       
   230         array->AppendL( *thisTime );
       
   231         array->AppendL( *automatic );
       
   232         }              
       
   233 
       
   234     // Set the dialog heading and message text
   258     // Set the dialog heading and message text
   235     myself->iDialog->Heading()->SetTextL(*heading);
   259     myself->iDialog->Heading()->SetTextL(*heading);
   236     myself->iDialog->MessageBox()->SetMessageTextL(messageBase);
   260     myself->iDialog->MessageBox()->SetMessageTextL(messageBase);
   237     CleanupStack::PopAndDestroy( messageBase );
   261     CleanupStack::PopAndDestroy( messageBase );
   238     CleanupStack::PopAndDestroy( heading );
   262     CleanupStack::PopAndDestroy( heading );
   251                                  
   275                                  
   252     CLOG_LEAVEFN( "CConfirmationQueryNotif::LaunchDialogL" );
   276     CLOG_LEAVEFN( "CConfirmationQueryNotif::LaunchDialogL" );
   253     return 0;   
   277     return 0;   
   254     }
   278     }
   255 
   279 
       
   280 // ---------------------------------------------------------
       
   281 // TInt CConfirmationQueryNotif::LaunchDialogVisitorL()
       
   282 // ---------------------------------------------------------
       
   283 //
       
   284 TInt CConfirmationQueryNotif::LaunchDialogVisitorL( TAny* aObject )
       
   285     {
       
   286     CLOG_ENTERFN( "CCConfirmationQueryNotif::LaunchDialogVisitorL" );
       
   287     CConfirmationQueryNotif* myself =
       
   288                             static_cast<CConfirmationQueryNotif*>( aObject );
       
   289 
       
   290     myself->iDialogVisitor = new ( ELeave ) CConfirmationQueryVisitor( myself );
       
   291     myself->iDialogVisitor->PrepareLC( R_VISITOR_QUERY );
       
   292 
       
   293     HBufC* heading  = NULL;
       
   294     HBufC* message  = NULL;
       
   295     TInt resourceId = R_QTN_OCC_DETAIL_CS_DATA_FOREIGN_NW;
       
   296     heading         = StringLoader::LoadLC( 
       
   297                       R_QTN_OCC_PRMPT_CS_DATA_FOREIGN_NW );
       
   298 
       
   299     CDesCArrayFlat* strings = new( ELeave ) CDesCArrayFlat( 2 );
       
   300     CleanupStack::PushL( strings );
       
   301 
       
   302     HBufC* messageBase = StringLoader::LoadL( resourceId, *strings );
       
   303     CleanupStack::PopAndDestroy( strings );
       
   304 
       
   305     CleanupStack::PushL( messageBase );
       
   306     TInt lenMsg = messageBase->Des().Length();
       
   307 
       
   308     message = HBufC::NewL( lenMsg );
       
   309     TPtr messagePtr = message->Des();
       
   310     messagePtr.Append( messageBase->Des() ); 
       
   311 
       
   312     CleanupStack::PopAndDestroy( messageBase );
       
   313 
       
   314     CleanupStack::PushL( message );
       
   315     myself->iDialogVisitor->SetMessageTextL( *message );
       
   316     CleanupStack::PopAndDestroy( message );
       
   317 
       
   318     myself->iDialogVisitor->QueryHeading()->SetTextL( *heading );
       
   319     CleanupStack::PopAndDestroy( heading );
       
   320 
       
   321     myself->iDialogVisitor->RunLD();
       
   322     CLOG_LEAVEFN( "CConfirmationQueryNotif::LaunchDialogVisitorL" );
       
   323     return 0;
       
   324     }
       
   325 
   256 // End of File
   326 // End of File