phonebookui/Phonebook2/Commands/src/CPbk2AiwInterestItemOviSync.cpp
changeset 0 e686773b3f54
child 21 9da50d567e3c
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Phonebook 2 OviSync AIW interest item.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "CPbk2AiwInterestItemOviSync.h"
       
    19 
       
    20 // Phonebook 2
       
    21 #include "CPbk2OviSyncCmd.h"
       
    22 #include <Pbk2Commands.hrh>
       
    23 #include <MPbk2Command.h>
       
    24 #include <MPbk2ContactUiControl.h>
       
    25 #include <Pbk2Commands.rsg>
       
    26 #include "Pbk2InternalCommands.hrh"
       
    27 
       
    28 // System includes
       
    29 #include <AiwServiceHandler.h>
       
    30 #include <AiwCommon.hrh>
       
    31 #include <eikmenup.h>
       
    32 
       
    33 // --------------------------------------------------------------------------
       
    34 // CPbk2AiwInterestItemOviSync::CPbk2AiwInterestItemOviSync
       
    35 // --------------------------------------------------------------------------
       
    36 //
       
    37 inline CPbk2AiwInterestItemOviSync::CPbk2AiwInterestItemOviSync
       
    38         ( TInt aInterestId, CAiwServiceHandler& aServiceHandler ) :
       
    39             CPbk2AiwInterestItemBase( aInterestId, aServiceHandler )
       
    40     {
       
    41     }
       
    42 
       
    43 // --------------------------------------------------------------------------
       
    44 // CPbk2AiwInterestItemOviSync::~CPbk2AiwInterestItemOviSync
       
    45 // --------------------------------------------------------------------------
       
    46 //
       
    47 CPbk2AiwInterestItemOviSync::~CPbk2AiwInterestItemOviSync()
       
    48     {
       
    49     }
       
    50 
       
    51 // --------------------------------------------------------------------------
       
    52 // CPbk2AiwInterestItemOviSync::NewL
       
    53 // --------------------------------------------------------------------------
       
    54 //
       
    55 CPbk2AiwInterestItemOviSync* CPbk2AiwInterestItemOviSync::NewL
       
    56         ( TInt aInterestId, CAiwServiceHandler& aServiceHandler )
       
    57     {
       
    58     CPbk2AiwInterestItemOviSync* self =
       
    59         new ( ELeave ) CPbk2AiwInterestItemOviSync
       
    60             ( aInterestId, aServiceHandler );
       
    61     return self;
       
    62     }
       
    63 
       
    64 // --------------------------------------------------------------------------
       
    65 // CPbk2AiwInterestItemOviSync::DynInitMenuPaneL
       
    66 // --------------------------------------------------------------------------
       
    67 //
       
    68 TBool CPbk2AiwInterestItemOviSync::DynInitMenuPaneL
       
    69         ( const TInt aResourceId, CEikMenuPane& aMenuPane,
       
    70           const MPbk2ContactUiControl& aControl )
       
    71     {
       
    72     TBool ret = EFalse;
       
    73     
       
    74     if ( aResourceId == R_PHONEBOOK2_OVISYNC_MENU )
       
    75         {
       
    76         ret = ETrue;
       
    77         // If the list has marked items, hide ovisync option
       
    78         if ( !aControl.ContactsMarked() )
       
    79             {
       
    80             // Let provider add its menu items to the menu
       
    81             iServiceHandler.InitializeMenuPaneL(
       
    82                 aMenuPane,
       
    83                 aResourceId,
       
    84                 EPbk2CmdLast,
       
    85                 iServiceHandler.InParamListL() );
       
    86             }
       
    87         else
       
    88             {
       
    89             aMenuPane.SetItemDimmed( KOtasAiwCmdSynchronize, ETrue );
       
    90             }
       
    91         }
       
    92 
       
    93     return ret;
       
    94     }
       
    95 
       
    96 // --------------------------------------------------------------------------
       
    97 // CPbk2AiwInterestItemOviSync::HandleCommandL
       
    98 // --------------------------------------------------------------------------
       
    99 //
       
   100 TBool CPbk2AiwInterestItemOviSync::HandleCommandL
       
   101         ( const TInt aMenuCommandId, MPbk2ContactUiControl& /*aControl*/,
       
   102           TInt aServiceCommandId  )
       
   103     {
       
   104     TBool ret = EFalse;
       
   105 
       
   106     // Only handle this command if the service command is Ovisync based
       
   107     if ( aServiceCommandId == KOtasAiwCmdSynchronize || 
       
   108             aServiceCommandId == KOtasAiwCmdSettings )
       
   109         {
       
   110         // Create the Ovisync command object
       
   111         MPbk2Command* cmd = CPbk2OviSyncCmd::NewL(
       
   112             aMenuCommandId, iServiceHandler );
       
   113         // Execute the command
       
   114         cmd->ExecuteLD();
       
   115         ret = ETrue;
       
   116         }
       
   117 
       
   118     return ret;
       
   119     }
       
   120 
       
   121 // --------------------------------------------------------------------------
       
   122 // CPbk2AiwInterestItemOviSync::DoCancel
       
   123 // --------------------------------------------------------------------------
       
   124 //
       
   125 void CPbk2AiwInterestItemOviSync::DoCancel()
       
   126     {
       
   127     // Do nothing
       
   128     }
       
   129 
       
   130 // --------------------------------------------------------------------------
       
   131 // CPbk2AiwInterestItemOviSync::RunL
       
   132 // --------------------------------------------------------------------------
       
   133 //
       
   134 void CPbk2AiwInterestItemOviSync::RunL()
       
   135     {
       
   136     // Do nothing
       
   137     }
       
   138 
       
   139 // --------------------------------------------------------------------------
       
   140 // CPbk2AiwInterestItemOviSync::RunError
       
   141 // --------------------------------------------------------------------------
       
   142 //
       
   143 TInt CPbk2AiwInterestItemOviSync::RunError(TInt aError)
       
   144     {
       
   145     CCoeEnv::Static()->HandleError(aError);
       
   146     return KErrNone;
       
   147     }
       
   148 
       
   149 // End of File