phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp
branchRCL_3
changeset 8 5586b4d2ec3e
parent 7 b3431bff8c19
child 9 0d28c1c5b6dd
equal deleted inserted replaced
7:b3431bff8c19 8:5586b4d2ec3e
   184 // CPbk2ContactEditorDlgImpl::~CPbk2ContactEditorDlgImpl
   184 // CPbk2ContactEditorDlgImpl::~CPbk2ContactEditorDlgImpl
   185 // --------------------------------------------------------------------------
   185 // --------------------------------------------------------------------------
   186 //
   186 //
   187 CPbk2ContactEditorDlgImpl::~CPbk2ContactEditorDlgImpl()
   187 CPbk2ContactEditorDlgImpl::~CPbk2ContactEditorDlgImpl()
   188     {
   188     {
       
   189     iCoeEnv->RemoveForegroundObserver( *this );
       
   190 
   189     if ( iWaitFinish && iWaitFinish->IsStarted() )
   191     if ( iWaitFinish && iWaitFinish->IsStarted() )
   190         {
   192         {
   191         iWaitFinish->AsyncStop();
   193         iWaitFinish->AsyncStop();
   192         }
   194         }
   193     delete iWaitFinish;
   195     delete iWaitFinish;
   194     delete iInputBlock;
   196     delete iInputBlock;
   195     
   197     
   196     if ( iSelfPtr )
   198     if ( iSelfPtr )
   197         {
   199         {
   198         *iSelfPtr = NULL;
   200         *iSelfPtr = NULL;
       
   201         }
       
   202     // Make the variable in CloseDialog() to ETrue.
       
   203     if ( iDestroyedPtr )
       
   204         {
       
   205         *iDestroyedPtr = ETrue;
   199         }
   206         }
   200     
   207     
   201     if( iAppServices )
   208     if( iAppServices )
   202     	{
   209     	{
   203     	iAppServices->StoreObservationRegister().DeregisterStoreEvents( *this );
   210     	iAppServices->StoreObservationRegister().DeregisterStoreEvents( *this );
   297 // --------------------------------------------------------------------------
   304 // --------------------------------------------------------------------------
   298 //
   305 //
   299 void CPbk2ContactEditorDlgImpl::ConstructL()
   306 void CPbk2ContactEditorDlgImpl::ConstructL()
   300     {
   307     {
   301     CAknDialog::ConstructL(R_PBK2_CONTACTEDITOR_MENUBAR);
   308     CAknDialog::ConstructL(R_PBK2_CONTACTEDITOR_MENUBAR);
       
   309     iCoeEnv->AddForegroundObserverL( *this );
   302     
   310     
   303     if(iParams.iActiveView != TPbk2ContactEditorParams::EEditorView)
   311     if(iParams.iActiveView != TPbk2ContactEditorParams::EEditorView)
   304         {
   312         {
   305         iParams.iFocusedContactField = NULL;
   313         iParams.iFocusedContactField = NULL;
   306         }
   314         }
   351     	}
   359     	}
   352 
   360 
   353    
   361    
   354     StoreTitlePaneTextL();
   362     StoreTitlePaneTextL();
   355     ConstructContextMenuL();
   363     ConstructContextMenuL();
   356     ConstructNaviPaneL();
       
   357 
   364 
   358     iExtensionManager = CPbk2UIExtensionManager::InstanceL();
   365     iExtensionManager = CPbk2UIExtensionManager::InstanceL();
   359     
   366     
   360     /*
   367     /*
   361 	 * Use iAppServices if provided. This is to enable editor use outside from pbk2 context
   368 	 * Use iAppServices if provided. This is to enable editor use outside from pbk2 context
   788 
   795 
   789     // Offer button group container to extensions.
   796     // Offer button group container to extensions.
   790     // This is needed here because previous settings might override extension's
   797     // This is needed here because previous settings might override extension's
   791     // buttons.
   798     // buttons.
   792     iEditorExtension->ModifyButtonGroupContainerL(ButtonGroupContainer());
   799     iEditorExtension->ModifyButtonGroupContainerL(ButtonGroupContainer());
       
   800 
       
   801     ConstructNaviPaneL();
   793     }
   802     }
   794 
   803 
   795 // --------------------------------------------------------------------------
   804 // --------------------------------------------------------------------------
   796 // CPbk2ContactEditorDlgImpl::PostLayoutDynInitL
   805 // CPbk2ContactEditorDlgImpl::PostLayoutDynInitL
   797 // --------------------------------------------------------------------------
   806 // --------------------------------------------------------------------------
  1459         {
  1468         {
  1460         if( aCurrentField.ContactField().FieldData().DataType() == 
  1469         if( aCurrentField.ContactField().FieldData().DataType() == 
  1461             EVPbkFieldStorageTypeText && 
  1470             EVPbkFieldStorageTypeText && 
  1462             !aCurrentField.ContactField().FieldData().IsEmpty() )
  1471             !aCurrentField.ContactField().FieldData().IsEmpty() )
  1463             {
  1472             {
  1464             //'View' shown even if there would be cold file name, i.e. no file 
       
  1465             //available the moment (e.g other mem card). Gallery takes care of
       
  1466             //error message. So just dim add option.
       
  1467             DimItem( aMenuPane, EPbk2CmdEditorAddImage );
  1473             DimItem( aMenuPane, EPbk2CmdEditorAddImage );
       
  1474             
       
  1475             //Dim 'View image' if currently cold file name, e.g mem card not there.
       
  1476             TBool dimView(ETrue);
       
  1477             TPbk2FieldCtrlType type = aCurrentField.FieldProperty().CtrlType();
       
  1478             TAny* ext = aCurrentField.ContactEditorFieldExtension(TUid::Uid(NULL));
       
  1479             if (type == EPbk2FieldCtrlTypeImageEditor && ext)
       
  1480                 {
       
  1481                 CPbk2ContactEditorImageField* fld =
       
  1482                         static_cast<CPbk2ContactEditorImageField*> (ext);
       
  1483                 TPtrC dataPtr(MVPbkContactFieldTextData::Cast(  
       
  1484                         fld->ContactField().FieldData()).Text());
       
  1485                 TEntry entry;
       
  1486                 RFs& fs( iCoeEnv->FsSession() );        
       
  1487                 dimView = fs.Entry( dataPtr, entry ) == 0 ? EFalse : ETrue;
       
  1488                 }        
       
  1489             if( dimView )
       
  1490                 {
       
  1491                 DimItem( aMenuPane,  EPbk2CmdEditorViewImage);
       
  1492                 }
  1468             }
  1493             }
  1469         else
  1494         else
  1470             {
  1495             {
  1471             DimItem( aMenuPane,  EPbk2CmdEditorViewImage);                    
  1496             DimItem( aMenuPane,  EPbk2CmdEditorViewImage);                    
  1472             DimItem( aMenuPane,  EPbk2CmdEditorChangeImage);
  1497             DimItem( aMenuPane,  EPbk2CmdEditorChangeImage);
  2604 // --------------------------------------------------------------------------
  2629 // --------------------------------------------------------------------------
  2605 //
  2630 //
  2606 void CPbk2ContactEditorDlgImpl::CloseDialog(
  2631 void CPbk2ContactEditorDlgImpl::CloseDialog(
  2607         MVPbkContactObserver::TContactOp aOpCode, TBool aInformObserver)
  2632         MVPbkContactObserver::TContactOp aOpCode, TBool aInformObserver)
  2608     {
  2633     {
       
  2634     // For knowing if the destructor has been called
       
  2635     TBool destroyed = EFalse;
       
  2636     iDestroyedPtr = &destroyed;
       
  2637 
  2609     if (aInformObserver && iParams.iActiveView
  2638     if (aInformObserver && iParams.iActiveView
  2610             == TPbk2ContactEditorParams::EEditorView || iAddressViewStandalone)
  2639             == TPbk2ContactEditorParams::EEditorView || iAddressViewStandalone)
  2611         {
  2640         {
  2612         switch (aOpCode)
  2641         switch (aOpCode)
  2613             {
  2642             {
  2630                 // abort
  2659                 // abort
  2631                 iContactObserver.ContactEditingAborted();
  2660                 iContactObserver.ContactEditingAborted();
  2632                 break;
  2661                 break;
  2633                 }
  2662                 }
  2634             };
  2663             };
       
  2664         }
       
  2665 
       
  2666     // In VOIP/new contacts/exit case, this object will be destructed by
       
  2667     // iContactObserver.ContactEditingComplete() above.
       
  2668     // If this object is destructed, don't excute the following anymore
       
  2669     if ( destroyed )
       
  2670         {
       
  2671         return;
  2635         }
  2672         }
  2636 
  2673 
  2637     // Don't save any contact data (already saved)
  2674     // Don't save any contact data (already saved)
  2638     iExitRecord.Set(EOkToExitWithoutHandlingIt);
  2675     iExitRecord.Set(EOkToExitWithoutHandlingIt);
  2639     iExitRecord.Clear(EExitOrdered);
  2676     iExitRecord.Clear(EExitOrdered);
  2955                     {
  2992                     {
  2956                     if ( iEndKeyWasPressed )
  2993                     if ( iEndKeyWasPressed )
  2957                         {
  2994                         {
  2958                         CloseDialog();
  2995                         CloseDialog();
  2959                         }
  2996                         }
       
  2997                     else
       
  2998                     	{
       
  2999                     	iExitRecord.Clear( EExitOrdered );
       
  3000                     	}
  2960                     }
  3001                     }
  2961                 }
  3002                 }
  2962             }
  3003             }
  2963        else
  3004        else
  2964             {
  3005             {
  3366                 }
  3407                 }
  3367             }
  3408             }
  3368         }
  3409         }
  3369     }
  3410     }
  3370 
  3411 
       
  3412 // --------------------------------------------------------------------------
       
  3413 // CPbk2ContactEditorDlgImpl::HandleLosingForeground
       
  3414 // --------------------------------------------------------------------------
       
  3415 //
       
  3416 void CPbk2ContactEditorDlgImpl::HandleLosingForeground() 
       
  3417     {
       
  3418     //Fix for ou1cimx1#308012
       
  3419     iEditorStrategy.StopQuery();            
       
  3420     }
       
  3421 
       
  3422 // --------------------------------------------------------------------------
       
  3423 // CPbk2ContactEditorDlgImpl::HandleGainingForeground
       
  3424 // --------------------------------------------------------------------------
       
  3425 //
       
  3426 void CPbk2ContactEditorDlgImpl::HandleGainingForeground() 
       
  3427     {
       
  3428     }
       
  3429 
       
  3430 
  3371 // End of File
  3431 // End of File