ipsservices/ipssossettings/src/ipssetview.cpp
changeset 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 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: This file implements class CIpsSetView.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "emailtrace.h"
       
    20 #include <ecom/implementationproxy.h>
       
    21 #include <msvstd.h>
       
    22 #include <aknViewAppUi.h>
       
    23 //<cmail>
       
    24 #include "FreestyleEmailUiConstants.h"
       
    25 //</cmail>
       
    26 #include <ipssossettings.rsg>
       
    27 
       
    28 #include "ipssetview.h"
       
    29 #include "ipssetui.h"
       
    30 #include "../../ipssosplugin/inc/ipsplgsosbaseplugin.hrh"
       
    31 
       
    32 // CONTANTS
       
    33 const TInt KSubViewCountZero = 0;
       
    34 
       
    35 // interface implementation table
       
    36 const TImplementationProxy ImplementationTable[] =
       
    37     {
       
    38     IMPLEMENTATION_PROXY_ENTRY(
       
    39     	IPS_SET_ECOM_IMPLEMENTATION_UID,
       
    40         CIpsSetView::NewL )
       
    41     };
       
    42 
       
    43 // CESMailSettingsUiPlugin implementation
       
    44 
       
    45 CIpsSetView* CIpsSetView::NewL()
       
    46     {
       
    47     FUNC_LOG;
       
    48     CIpsSetView* self = new (ELeave) CIpsSetView();
       
    49 	CleanupStack::PushL( self );
       
    50 	self->ConstructL();
       
    51 	CleanupStack::Pop( self );
       
    52     return self;
       
    53     }
       
    54 
       
    55 void CIpsSetView::ConstructL()
       
    56     {
       
    57     FUNC_LOG;
       
    58     BaseConstructL();
       
    59     TCallBack callbackFunc( RunSettingsDlgL, this );
       
    60     iAsyncCallback = new (ELeave) CAsyncCallBack( callbackFunc, CActive::EPriorityStandard );
       
    61     }
       
    62 
       
    63 CIpsSetView::~CIpsSetView()
       
    64     {
       
    65     FUNC_LOG;
       
    66     delete iAsyncCallback;
       
    67     delete iCustomMessage;
       
    68     }
       
    69 
       
    70 // Constructor
       
    71 CIpsSetView::CIpsSetView()
       
    72     {
       
    73     FUNC_LOG;
       
    74     }
       
    75 
       
    76 TUid CIpsSetView::Id() const
       
    77     {
       
    78     FUNC_LOG;
       
    79     return TUid::Uid( IPS_SET_ECOM_IMPLEMENTATION_UID );
       
    80     }
       
    81 
       
    82 void CIpsSetView::DoActivateL(
       
    83 		const TVwsViewId& aPrevViewId,
       
    84 		TUid /*aCustomMessageId*/,
       
    85 		const TDesC8& aCustomMessage )
       
    86     {
       
    87     FUNC_LOG;
       
    88     iPrevViewId = aPrevViewId;
       
    89     delete iCustomMessage;
       
    90     iCustomMessage = NULL;
       
    91     iCustomMessage = aCustomMessage.AllocL();
       
    92     iAsyncCallback->CallBack();
       
    93     }
       
    94 
       
    95 void CIpsSetView::DoDeactivate()
       
    96     {
       
    97     FUNC_LOG;
       
    98     }
       
    99 
       
   100 TPtrC CIpsSetView::MailSettingsSubviewCaption(
       
   101 		TFSMailMsgId /*aAccountId*/,
       
   102 		TInt /*aSubviewIndex*/,
       
   103 		TBool /*aLongCaption*/ )
       
   104     {
       
   105     FUNC_LOG;
       
   106     return TPtrC( KNullDesC );
       
   107     }
       
   108 
       
   109 TInt CIpsSetView::MailSettingsSubviewCount()
       
   110     {
       
   111     FUNC_LOG;
       
   112     return KSubViewCountZero;
       
   113     }
       
   114 
       
   115 TBool CIpsSetView::CanHandlePIMSync()
       
   116     {
       
   117     FUNC_LOG;
       
   118     return EFalse;
       
   119     }
       
   120 
       
   121 TPtrC CIpsSetView::LocalizedProtocolName()
       
   122     {
       
   123     FUNC_LOG;
       
   124     return TPtrC( KNullDesC );
       
   125     }
       
   126 
       
   127 TBool CIpsSetView::IsSelectedForPIMSync()
       
   128     {
       
   129     FUNC_LOG;
       
   130     return EFalse;
       
   131     }
       
   132 
       
   133 void CIpsSetView::SelectForPIMSync( TBool /*aSelectForSync*/ )
       
   134     {
       
   135     FUNC_LOG;
       
   136     }
       
   137 
       
   138 TInt CIpsSetView::PIMSettingsSubviewCount()
       
   139     {
       
   140     FUNC_LOG;
       
   141     return KSubViewCountZero;
       
   142     }
       
   143 
       
   144 TPtrC CIpsSetView::PIMSettingsSubviewCaption(
       
   145 		TFSMailMsgId /*aAccountId*/,
       
   146 		TInt /*aSubviewIndex*/,
       
   147 		TBool /*aLongCaption*/ )
       
   148     {
       
   149     FUNC_LOG;
       
   150     return TPtrC( KNullDesC );
       
   151     }
       
   152 
       
   153 
       
   154 
       
   155 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
       
   156     TInt& aTableCount )
       
   157     {
       
   158     aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
       
   159     return ImplementationTable;
       
   160     }
       
   161 
       
   162 TInt CIpsSetView::RunSettingsDlgL( TAny* aSelfPtr )
       
   163     {
       
   164     FUNC_LOG;
       
   165     CIpsSetView* self = static_cast<CIpsSetView*>( aSelfPtr );
       
   166 
       
   167     TSubViewActivationData subView;
       
   168     TPckgBuf<CESMailSettingsPlugin::TSubViewActivationData> subViewData( subView ); //<cmail>
       
   169     subViewData.Copy( *self->iCustomMessage );
       
   170     subView = subViewData();
       
   171 
       
   172     TInt buttonId( KErrNotFound );
       
   173     CIpsSetUi* setUi = CIpsSetUi::NewL( subView.iAccount.Id(), subView.iLaunchFolderSettings );//<cmail>
       
   174 
       
   175     // leaves if user choose cancel in queries,
       
   176     // then just exit settings
       
   177     TRAP_IGNORE( buttonId = setUi->ExecuteLD( R_IPS_SET_SETTINGS_DIALOG ) );
       
   178 
       
   179     if( buttonId == EAknSoftkeyExit )
       
   180         {
       
   181         // Exit Freestyle app
       
   182         User::Exit( KErrCancel );
       
   183         }
       
   184     else
       
   185         {
       
   186         // go back to previous view
       
   187         self->AppUi()->ActivateViewL( self->iPrevViewId,
       
   188                                       TUid::Uid(KMailSettingsReturnFromPluginSettings),
       
   189                                       *self->iCustomMessage );
       
   190         }
       
   191     return KErrNone;
       
   192     }
       
   193 // End of File
       
   194