examples/SFExamples/PIM/AgendaRepeat/src/AgendaRepeatAppUi.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 <AgendaRepeat.rsg>
00019 
00020 #include "AgendaRepeatAppUi.h"
00021 #include "AgendaRepeatMainView.h"
00022 #include "CalWrite.h"
00023 #include "AgendaRepeat.hrh"
00024 
00025 void CAgendaRepeatAppUi::ConstructL()
00026         {
00027         BaseConstructL(EAknEnableSkin);
00028         iMainView = CAgendaRepeatMainView::NewL(ClientRect());
00029 
00030         iCalendarWriter = CCalWrite::NewL();
00031         }
00032         
00033 CAgendaRepeatAppUi::~CAgendaRepeatAppUi()
00034     {
00035     delete iCalendarWriter;
00036 #ifdef __SERIES60_3X__
00037         delete iMainView;
00038 #endif
00039     }
00040 
00041 void CAgendaRepeatAppUi::HandleCommandL(TInt aCommand)
00042         {
00043         switch ( aCommand )
00044                 {
00045 #ifdef __SERIES60_3X__
00046                 case EAknSoftkeyExit:
00047 #endif
00048                 case EEikCmdExit:
00049                         {
00050                         User::Exit(0);
00051                         break;
00052                         }
00053                 case EAgendaRepeat:
00054                         {
00055                         _LIT(KNewEntry, "Newer Entry");
00056                         TRAPD(error, iCalendarWriter->AddRepeatL(KNewEntry(), 2));
00057                         // report error on the Label control
00058                         if (KErrNone == error)
00059                                 {
00060                                 _LIT(KSuccess, "It Worked!");
00061                                 iMainView->SetTextL(KSuccess());
00062                                 }
00063                         else
00064                                 {
00065                                 _LIT(KErrorMsg, "Symbian Error Code = %D");
00066                                 TBuf<32> errorBuf;
00067                                 errorBuf.Format(KErrorMsg(), error);
00068                                 iMainView->SetTextL(errorBuf);
00069                                 }
00070                         break;
00071                         }
00072                 default:
00073                         break;
00074                 }
00075         }
00076 
00077         
00078 #ifdef __SERIES60_3X__
00079 
00080 void CAgendaRepeatAppUi::HandleResourceChangeL(TInt aType)
00081         {
00082         CAknAppUi::HandleResourceChangeL(aType);
00083         iMainView->SetRect(ClientRect());
00084         }
00085 
00086 #endif
00087         
00088 // End of File

Generated by  doxygen 1.6.2