examples/SFExamples/PIM/ContactAddNew/src/ContactAddNewAppUi.cpp

00001 // 
00002 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
00003 // All rights reserved.
00004 // This component and the accompanying materials are made available
00005 // under the terms of the License "Eclipse Public License v1.0"
00006 // which accompanies this distribution, and is available
00007 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00008 // 
00009 // Initial Contributors:
00010 // Nokia Corporation - initial contribution.
00011 // 
00012 // Contributors:
00013 // 
00014 // Description:
00015 // 
00016 
00017 #include <eikapp.h>
00018 #include <ContactAddNew.rsg>
00019 
00020 #include "ContactAddNewAppUi.h"
00021 #include "ContactAddNewMainView.h"
00022 #include "ContactWrite.h"
00023 #include "ContactAddNew.hrh"
00024 
00025 void CContactAddNewAppUi::ConstructL()
00026         {
00027 
00028         BaseConstructL(EAknEnableSkin);
00029         iMainView = CContactAddNewMainView::NewL(ClientRect());
00030 
00031         iContactWriter = CContactWrite::NewL();
00032         }
00033         
00034 CContactAddNewAppUi::~CContactAddNewAppUi()
00035     {
00036     delete iContactWriter;
00037 #ifdef __SERIES60_3X__
00038         delete iMainView;
00039 #endif
00040     }
00041 
00042 void CContactAddNewAppUi::HandleCommandL(TInt aCommand)
00043         {
00044         switch ( aCommand )
00045                 {
00046 #ifdef __SERIES60_3X__
00047                 case EAknSoftkeyExit:
00048 #endif
00049                 case EEikCmdExit:
00050                         {
00051                         User::Exit(0);
00052                         break;
00053                         }
00054                 case EContactAddNew:
00055                         {
00056                         _LIT(KTelNumber, "012456789");
00057                         _LIT(KFirstName, "Mememe");
00058                         _LIT(KLastName, "Himhimhim");
00059                         TRAPD(error, iContactWriter->AddCardL(KFirstName(), KLastName(), KTelNumber()));
00060                         // report error on the Label control
00061                         if (KErrNone == error)
00062                                 {
00063                                 _LIT(KSuccess, "It Worked!");
00064                                 iMainView->SetTextL(KSuccess());
00065                                 }
00066                         else
00067                                 {
00068                                 _LIT(KErrorMsg, "Symbian Error Code = %D");
00069                                 TBuf<32> errorBuf;
00070                                 errorBuf.Format(KErrorMsg(), error);
00071                                 iMainView->SetTextL(errorBuf);
00072                                 }
00073                         break;
00074                         }
00075                 default:
00076                         break;
00077                 }
00078         }
00079 
00080         
00081 #ifdef __SERIES60_3X__
00082 
00083 void CContactAddNewAppUi::HandleResourceChangeL(TInt aType)
00084         {
00085         CAknAppUi::HandleResourceChangeL(aType);
00086         iMainView->SetRect(ClientRect());
00087         }
00088 
00089 #endif
00090         
00091 // End of File

Generated by  doxygen 1.6.2