omads/omadsappui/ui/src/NSmlDSSyncAppUi.cpp
changeset 0 dab8a81a92de
child 1 95fdac6ccb5c
equal deleted inserted replaced
-1:000000000000 0:dab8a81a92de
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "NSmlDSSyncAppUi.h"
       
    22 #include "NSmlDSSyncContainer.h" 
       
    23 #include "NSmlDSSyncDocument.h"
       
    24 
       
    25 #include <NSmlDSSync.rsg>
       
    26 #include "NSmlDSSync.hrh"
       
    27 #include "AspDebug.h"
       
    28 
       
    29 #include <eikmenup.h> 
       
    30 
       
    31 
       
    32 
       
    33 // ============================ MEMBER FUNCTIONS ===============================
       
    34 
       
    35 //#ifdef RD_DSUI_CP_INTEGRATION
       
    36 // -----------------------------------------------------------------------------
       
    37 // CNSmlDSSyncAppUi::ConstructL
       
    38 //
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 void CNSmlDSSyncAppUi::ConstructL()
       
    42     {
       
    43     FLOG( _L("CNSmlDSSyncAppUi::ConstructL START") );
       
    44     
       
    45     const TInt KBufSize128 = 128;
       
    46     const TInt KModeDialogNoWait = 4;
       
    47     
       
    48     BaseConstructL(EAknEnableSkin | EAknDisableHighlightAnimation | EAknEnableMSK);
       
    49 
       
    50 	TBool flag = CEikonEnv::Static()->StartedAsServerApp() ;
       
    51 	if (flag)
       
    52 		{
       
    53 		TRAP_IGNORE(iIdle = CIdle::NewL( CActive::EPriorityHigh ));
       
    54 	
       
    55     	if ( !iIdle->IsActive() ) 
       
    56     		{
       
    57        		iIdle->Start( TCallBack( OpenDialog, this ) );
       
    58     		}
       
    59 		}
       
    60 	else
       
    61 		{
       
    62 		iAppContainer = new (ELeave) CNSmlDSSyncContainer;
       
    63 	    iAppContainer->SetMopParent(this);
       
    64 	    iAppContainer->ConstructL(ClientRect());
       
    65 	    AddToStackL(iAppContainer);
       
    66 
       
    67 	    TBuf<KBufSize128> buf;
       
    68 	    CNSmlDSSyncDocument* document= STATIC_CAST(CNSmlDSSyncDocument*, Document());
       
    69 	    document->Model()->ShowSettingsL(0, KModeDialogNoWait, buf);
       
    70 		}
       
    71 
       
    72     FLOG( _L("CNSmlDSSyncAppUi::ConstructL END") );
       
    73     }
       
    74     
       
    75 // ==========================================================================
       
    76 // METHOD:  OpenDialog
       
    77 //
       
    78 // DESIGN:  CIdle Callback function
       
    79 // ==========================================================================
       
    80 TInt CNSmlDSSyncAppUi::OpenDialog( TAny* /*aThis*/ )
       
    81 {
       
    82     const TInt KBufSize128 = 128;
       
    83          
       
    84 	// Launch the settings dialog
       
    85  	TBuf<KBufSize128> buf;
       
    86     CSyncUtilApi* utilApi = CSyncUtilApi::NewL();
       
    87 	CleanupStack::PushL( utilApi );
       
    88 
       
    89 	TRAP_IGNORE( utilApi->ShowSettingsL( 0, 0, buf ) );
       
    90 
       
    91 	CleanupStack::PopAndDestroy( utilApi );
       
    92 
       
    93 	// We're done; exit
       
    94 	iAvkonAppUi->Exit();
       
    95 	
       
    96 	return KErrNone;
       
    97 } 
       
    98 
       
    99 //#else
       
   100 // -----------------------------------------------------------------------------
       
   101 // CNSmlDSSyncAppUi::ConstructL
       
   102 //
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 /*void CNSmlDSSyncAppUi::ConstructL()
       
   106     {
       
   107     FLOG( _L("CNSmlDSSyncAppUi::ConstructL START") );
       
   108     
       
   109     const TInt KBufSize128 = 128;
       
   110     const TInt KModeDialogNoWait = 4;
       
   111     
       
   112     BaseConstructL(EAknEnableSkin | EAknDisableHighlightAnimation | EAknEnableMSK);
       
   113 
       
   114     iAppContainer = new (ELeave) CNSmlDSSyncContainer;
       
   115     iAppContainer->SetMopParent(this);
       
   116     iAppContainer->ConstructL(ClientRect());
       
   117     AddToStackL(iAppContainer);
       
   118 
       
   119     TBuf<KBufSize128> buf;
       
   120     CNSmlDSSyncDocument* document= STATIC_CAST(CNSmlDSSyncDocument*, Document());
       
   121     document->Model()->ShowSettingsL(0, KModeDialogNoWait, buf);
       
   122     
       
   123     FLOG( _L("CNSmlDSSyncAppUi::ConstructL END") );
       
   124     }*/
       
   125 
       
   126 //#endif
       
   127 
       
   128 // -----------------------------------------------------------------------------
       
   129 // CNSmlDSSyncAppUi::~CNSmlDSSyncAppUi
       
   130 //
       
   131 // -----------------------------------------------------------------------------
       
   132 //
       
   133 CNSmlDSSyncAppUi::~CNSmlDSSyncAppUi()
       
   134     {
       
   135     FLOG( _L("CNSmlDSSyncAppUi::~CNSmlDSSyncAppUi START") );
       
   136 //#ifdef RD_DSUI_CP_INTEGRATION    
       
   137 	if ( iIdle )
       
   138     	{
       
   139     	delete iIdle;
       
   140      	iIdle = NULL;
       
   141     	}
       
   142 //#endif    	
       
   143     if (iAppContainer)
       
   144         {
       
   145         RemoveFromStack( iAppContainer );
       
   146         delete iAppContainer;
       
   147         }
       
   148         
       
   149     FLOG( _L("CNSmlDSSyncAppUi::~CNSmlDSSyncAppUi END") );
       
   150     }
       
   151 
       
   152 
       
   153 // -----------------------------------------------------------------------------
       
   154 // CNSmlDSSyncAppUi::DynInitMenuPaneL
       
   155 //
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 void CNSmlDSSyncAppUi::DynInitMenuPaneL(TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/)
       
   159     {
       
   160     }
       
   161 
       
   162 
       
   163 // -----------------------------------------------------------------------------
       
   164 // CNSmlDSSyncAppUi::HandleKeyEventL
       
   165 //
       
   166 // -----------------------------------------------------------------------------
       
   167 //
       
   168 TKeyResponse CNSmlDSSyncAppUi::HandleKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
       
   169     {
       
   170     return EKeyWasNotConsumed;
       
   171     }
       
   172 
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CNSmlDSSyncAppUi::HandleCommandL
       
   176 //
       
   177 // -----------------------------------------------------------------------------
       
   178 //
       
   179 void CNSmlDSSyncAppUi::HandleCommandL(TInt aCommand)
       
   180     {
       
   181     FLOG( _L("CNSmlDSSyncAppUi::HandleCommandL START") );
       
   182     
       
   183     switch (aCommand)
       
   184         {
       
   185 		case EAknCmdExit:
       
   186         case EEikCmdExit:
       
   187         case EAknSoftkeyBack:
       
   188 			{
       
   189      		FLOG( _L("before Exit") );
       
   190      		
       
   191      		Exit();
       
   192      		
       
   193      		FLOG( _L("after Exit") );
       
   194 			break;			
       
   195 			}
       
   196 
       
   197         default:
       
   198 			{
       
   199             break;      
       
   200 			}
       
   201         }
       
   202         
       
   203     FLOG( _L("CNSmlDSSyncAppUi::HandleCommandL END") );
       
   204 	}
       
   205 
       
   206 
       
   207 
       
   208 
       
   209 // End of File