examples/ForumNokia/CalendarExample/inc/CalendarHelperEntry.h

00001 /*
00002  * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003  *    
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions are met:
00006  *    
00007  *  * Redistributions of source code must retain the above copyright notice, this
00008  *    list of conditions and the following disclaimer.
00009  *  * Redistributions in binary form must reproduce the above copyright notice,
00010  *    this list of conditions and the following disclaimer in the documentation
00011  *    and/or other materials provided with the distribution.
00012  *  * Neither the name of Nokia Corporation nor the names of its contributors
00013  *    may be used to endorse or promote products derived from this software
00014  *    without specific prior written permission.
00015  *    
00016  *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017  *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018  *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019  *    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020  *    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021  *    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022  *    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023  *    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024  *    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025  *    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026  *    
00027  *    Description:  
00028  */
00029 
00030 #ifndef __CALHELPERENTRY_H__
00031 #define __CALHELPERENTRY_H__
00032 
00033 // CLASS DECLARATION
00034 
00035 #include "CalendarAPIexample.hrh"
00036 #include <e32base.h>
00037 
00038 class CCalEntry;
00039 class CCalInstance;
00040 class CCalAlarm;
00041 
00046 class CCalHelperEntry : public CBase
00047     {
00048 public: // Constructors and destructor
00052     static CCalHelperEntry* NewL(CCalEntry* aAnniv);
00053     static CCalHelperEntry* NewLC(CCalEntry* aAnniv);
00054 
00055     static CCalHelperEntry* NewL(CCalInstance* aAnniv);
00056     static CCalHelperEntry* NewLC(CCalInstance* aAnniv);
00057 
00061     ~CCalHelperEntry();
00062 
00063 public:
00064 
00071     CCalEntry* NewAnnivLC();
00072 
00082     void SaveValuesL();
00083 
00099     TBool SetValues(   const TDesC& aName,
00100                         const TDateTime& aDate,
00101                         const TBool& aAlarm,
00102                         const TDateTime& aAlarmTime,
00103                         const TInt& aSynchronizationMethod);
00104 
00105     // Getters
00106     TBuf<KMaxNameLength> Name() const;
00107     TDateTime Date() const;
00108     TBool Alarm() const;
00109     TDateTime AlarmTime() const;
00110     TInt SynchronizationMethod() const;
00111     CCalEntry* Anniv();
00112     TBool Modified() const;
00113     TBool DateHasChanged() const;
00114 
00115 private:
00119     CCalHelperEntry();
00120     void ConstructL(CCalEntry* aAnniv);
00121     void ConstructL(CCalInstance* aAnniv);
00122 
00128     CCalEntry* CreateAnnivL();
00129 
00136     void ResetTimeL(TDateTime& aDate) const;
00137 
00147     void GetDaysAndMinutesL(const TDateTime& aTime,
00148                                     const TDateTime& aFromTime,
00149                                     TTimeIntervalDays& aDays,
00150                                     TTimeIntervalMinutes& aMinutes) const;
00151 
00152 
00159     void SetName(const TDesC& aName);
00160     void SetDate(const TDateTime& aDate);
00161     void SetAlarm(const TBool& aAlarm);
00162     void SetSynchronizationMethod(const TInt& aSynchronizationMethod);
00163 
00164     void SaveValuesToAnnivL(CCalEntry* aAnniv);
00165 
00166 
00167 private: // data members
00168 
00169     TBuf<KMaxNameLength> iName;
00170     TDateTime iDate;
00171     CCalAlarm* iAlarmPtr;
00172     TBool iAlarm;
00173     TDateTime iAlarmTime;
00174     TInt iSynchronizationMethod;
00175     TTimeIntervalDays iAlarmDays;
00176     TTimeIntervalMinutes iAlarmMinutes;
00177     TBool iModified;
00178     TBool iDateModified;
00179 
00180     CCalEntry* iAnniv;
00181     CCalInstance* iInstance;
00182     };
00183 #endif //__CALHELPERENTRY_H__

Generated by  doxygen 1.6.2