Revision: 201019 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 25 May 2010 12:41:10 +0300
branchRCL_3
changeset 30 d68a4b5d5885
parent 27 55d60436f00b
child 31 c7af88f6777c
child 36 9c5b1510919f
Revision: 201019 Kit: 2010121
alarmengines/missedalarmstore/rom/missedalarmstore.iby
alarmui/group/AknAlarmService.mmp
alarmui/group/alarmui_silence.rul
alarmui/group/alarmui_snooze.rul
alarmui/group/bld.inf
alarmui/inc/AlmAlarmControl.h
alarmui/inc/alarmcontextfwsupport.h
alarmui/inc/alarmsourcecontextdef.h
alarmui/inc/alarmutils.h
alarmui/rom/AlmAlert.iby
alarmui/sis/alarmui.pkg
alarmui/src/AlmAlarmControl.cpp
alarmui/src/alarmcontextfwsupport.cpp
alarmui/src/alarmutils.cpp
calendarui/controller/inc/calenviewmanager.h
calendarui/controller/src/calenattachmentui.cpp
calendarui/controller/src/calenbackgroundstate.cpp
calendarui/controller/src/calencmdlinelauncher.cpp
calendarui/controller/src/calenlocationui.cpp
calendarui/controller/src/calenmultipledbui.cpp
calendarui/controller/src/calenviewmanager.cpp
calendarui/editors/inc/calenunifiededitor.h
calendarui/editors/src/calendbfield.cpp
calendarui/editors/src/calenunifiededitor.cpp
calendarui/editors/src/calenunifiededitorcontrol.cpp
calendarui/globaldata/group/CalenGlobalData.mmp
calendarui/globaldata/inc/calendbchangenotifier.h
calendarui/globaldata/src/calendbchangenotifier.cpp
calendarui/globaldata/src/calenglobaldata.cpp
calendarui/multicaluidialog/src/multicaluidialogmodel.cpp
calendarui/regionalplugins/lunarVietnamese/src/calenlunarvietnameselocalizer.cpp
calendarui/server/CalenSvr/src/CalenServer.cpp
calendarui/views/inc/calendaylistbox.h
calendarui/views/inc/caleneventview.h
calendarui/views/inc/caleneventviewcontainer.h
calendarui/views/inc/calenweekcontainer.h
calendarui/views/src/calendaylistbox.cpp
calendarui/views/src/calendayview.cpp
calendarui/views/src/caleneventview.cpp
calendarui/views/src/calenmissedalarmscontainer.cpp
calendarui/views/src/calennativeview.cpp
calendarui/views/src/calenweekcontainer.cpp
clock2/clockui/plugins/clockindicatorpaneplugin/data/clockindicatorpaneplugin.rss
clock2/clockui/uilayer/clkdatetimeview/group/clkdatetimeview.mmp
clock2/clockui/uilayer/clkdatetimeview/src/clkdatetimeview.cpp
clock2/clockui/uilayer/clockalarmeditor/data/clockalarmeditor.ra
clock2/clockui/uilayer/clockalarmeditor/src/clockalarmeditorimpl.cpp
clock2/clockui/uilayer/clockmainview/inc/clockalarmarray.h
clock2/clockui/uilayer/clockmainview/inc/clockmaincontainer.h
clock2/clockui/uilayer/clockmainview/inc/clockmainview.h
clock2/clockui/uilayer/clockmainview/src/clockalarmarray.cpp
clock2/clockui/uilayer/clockmainview/src/clockmaincontainer.cpp
clock2/clockui/uilayer/clockmainview/src/clockmainview.cpp
clock2/clockui/uilayer/clockworldview/src/clockworldview.cpp
clock2/clockui/uilayer/data/clock.rss
clock2/clockui/uilayer/group/clock.mmp
clock2/clockui/uilayer/inc/clock.hrh
clock2/clockui/uilayer/inc/clockappui.h
clock2/clockui/uilayer/loc/clockapp.loc
clock2/clockui/uilayer/src/clockappui.cpp
clock2/clockui/uimodel/bwins/clkuimodelu.def
clock2/clockui/uimodel/eabi/clkuimodelu.def
clock2/clockui/uimodel/inc/clkuialarmmodel.h
clock2/clockui/uimodel/src/clkuialarmmodel.cpp
notepad/notepad1/LibData/NpdLib.rss
notepad/notepad1/LibSrc/NpdListDialog.cpp
notepad/notepad1/LibSrc/NpdViewerDialog.cpp
notepad/notepad1/inc/NpdViewerDialog.h
pimappservices/calendar/client/src/calentryimpl.cpp
pimappservices/calendar/server/src/agsentrymodel.cpp
pimappservices/calendar/server/src/agstzruleindex.cpp
pimappservices/calendar/shared/src/agmcalendarinfo.cpp
pimappservices/calendar/shared/src/agmrptdef.cpp
pimappservices/calendar/shared/src/agmsimpleentry.cpp
pimappservices/calendar/tsrc/instance_iterator/tcal_fetchinstance.cpp
--- a/alarmengines/missedalarmstore/rom/missedalarmstore.iby	Tue May 11 16:12:24 2010 +0300
+++ b/alarmengines/missedalarmstore/rom/missedalarmstore.iby	Tue May 25 12:41:10 2010 +0300
@@ -23,8 +23,6 @@
 
 file=ABI_DIR\BUILD_DIR\missedalarmstore.dll SHARED_LIB_DIR\missedalarmstore.dll
 
-data = DATAZ_\private\10202be9\2001111B.txt   Private\10202be9\2001111B.txt
-
 #endif  // MISSEDALARMSTORE_IBY
 
 
--- a/alarmui/group/AknAlarmService.mmp	Tue May 11 16:12:24 2010 +0300
+++ b/alarmui/group/AknAlarmService.mmp	Tue May 25 12:41:10 2010 +0300
@@ -88,6 +88,9 @@
 LIBRARY         remconextensionapi.lib
 LIBRARY         platformenv.lib
 LIBRARY         featmgr.lib
+LIBRARY         ws32.lib
+
+
 //MPIN-73VCR2
 // For cover display support:
 LIBRARY eikdlg.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alarmui/group/alarmui_silence.rul	Tue May 25 12:41:10 2010 +0300
@@ -0,0 +1,23 @@
+<script xmlns="http://www.nokia.com/ns/cep/script/1.0/" xmlns:cep="http://www.nokia.com/ns/cep/1.0/">
+    <!-- If alarm is not active, nothing needs to be done -->
+    <if>
+        <equals>
+            <contextRef source='Alarm' type='Status.Active' value='false'/>
+        </equals>
+        <actions>
+            <!-- Do nothing -->
+        </actions>        
+    </if>
+    
+    <!-- Silence alarm if 'silence' command is received -->
+    <elseIf>
+        <!-- ...and we got a new stop command -->
+        <contextUpdated>
+            <contextRef source='AlarmUI' type='Command' value='Silence'/>
+        </contextUpdated>
+        <actions>
+           <!-- silence the alarm -->
+            <AlarmUI.Silence/>
+        </actions>
+    </elseIf>
+</script>
\ No newline at end of file
--- a/alarmui/group/alarmui_snooze.rul	Tue May 11 16:12:24 2010 +0300
+++ b/alarmui/group/alarmui_snooze.rul	Tue May 25 12:41:10 2010 +0300
@@ -11,9 +11,26 @@
     
     <!-- Snooze alarm when device is turned upside down -->
     <elseIf>
-		<contextChanged>
-		    <contextRef source='Sensor' type='Event.Orientation' value='DisplayDownwards'/>
-		</contextChanged>
+        <and>
+            <!-- Check that turning interaction is set -->
+            <equals>
+            	   <contextRef source='Sensor' type='Setting.TurningInteraction.SilenceAlarm'/>
+                 <string>On</string>
+            </equals>
+                 <!-- ...and previous orientation is not 'Undefined' ... -->
+            <notEqual>
+                 <contextRef source='Sensor' type='Event.Orientation.Previous'/>
+                 <string>Undefined</string>
+            </notEqual>
+                 <!-- ...and we receive a new orientation event from sensors... -->
+	    <contextChanged>
+	         <contextRef source='Sensor' type='Event.Orientation'/>
+	    </contextChanged>
+    	    <equals>
+                 <contextRef source='Sensor' type='Event.Orientation'/>
+                 <string>DisplayDownwards</string>
+    	    </equals>
+        </and>
         <actions>
            <!-- snooze the alarm -->
             <AlarmUI.Snooze/>
--- a/alarmui/group/bld.inf	Tue May 11 16:12:24 2010 +0300
+++ b/alarmui/group/bld.inf	Tue May 25 12:41:10 2010 +0300
@@ -42,6 +42,9 @@
 alarmui_stop.rul            /epoc32/release/winscw/udeb/z/private/10282bc4/rules/alarmui_stop.rul
 alarmui_stop.rul            /epoc32/release/winscw/urel/z/private/10282bc4/rules/alarmui_stop.rul
 alarmui_stop.rul            /epoc32/data/z/private/10282bc4/rules/alarmui_stop.rul
+alarmui_silence.rul	    /epoc32/data/z/private/10282bc4/rules/alarmui_silence.rul	
+alarmui_silence.rul	    /epoc32/release/winscw/urel/z/private/10282bc4/rules/alarmui_silence.rul	
+alarmui_silence.rul	    /epoc32/release/winscw/udeb/z/private/10282bc4/rules/alarmui_silence.rul	
 
 
 // alarm tones
--- a/alarmui/inc/AlmAlarmControl.h	Tue May 11 16:12:24 2010 +0300
+++ b/alarmui/inc/AlmAlarmControl.h	Tue May 25 12:41:10 2010 +0300
@@ -105,6 +105,11 @@
     * @since 5.0
     **/
     TBool CanSnooze();
+    /**
+    * Returns handle to alarmutils
+    * @since TB9.2
+    **/
+    CAlarmUtils* AlarmUtils() const;
  private:  // New functions
     /**
      * Alarm UI Panic.
--- a/alarmui/inc/alarmcontextfwsupport.h	Tue May 11 16:12:24 2010 +0300
+++ b/alarmui/inc/alarmcontextfwsupport.h	Tue May 25 12:41:10 2010 +0300
@@ -201,7 +201,13 @@
     * @since S60 5.0
     */
     void PublishAlarmResultL(const TAlarmSourceResultValues aResult);
-
+	
+private: // methods  
+    /**
+    * 
+    * @since TB9.2
+    */
+    void SilenceAlarm();
 private: // constructors
 
     /** 
--- a/alarmui/inc/alarmsourcecontextdef.h	Tue May 11 16:12:24 2010 +0300
+++ b/alarmui/inc/alarmsourcecontextdef.h	Tue May 25 12:41:10 2010 +0300
@@ -88,14 +88,18 @@
     _S( "Stop" ),
 
     // command to snooze an active alarm
-    _S( "Snooze" )
+    _S( "Snooze" ),
+    
+    // command to silence an active alarm
+    _S( "Silence" )    
     };
 
 // Enumerations for accessing values array
 enum TAlarmSourceCommandValues
     {
     ECommandAlarmStop,
-    ECommandAlarmSnooze
+    ECommandAlarmSnooze,
+    ECommandAlarmSilence
     };
 
 //-----------------------------------------------------------------------------
@@ -157,6 +161,9 @@
     // stop the active alarm
     _S( "AlarmUI.Stop" ),
 
+    // stop the active alarm
+    _S( "AlarmUI.Silence" ),    
+    
     // print a debug string
     _S( "AlarmUI.Debug" )
 
@@ -167,6 +174,7 @@
     {
     EActionSnooze,
     EActionStop,
+    EActionSilence,    
     EDebug
     };
 
--- a/alarmui/inc/alarmutils.h	Tue May 11 16:12:24 2010 +0300
+++ b/alarmui/inc/alarmutils.h	Tue May 25 12:41:10 2010 +0300
@@ -260,7 +260,11 @@
     * @since S60 3.2
     **/
     void DoSnooze();
-
+    /**
+    * Silence the active alarm.
+    * @since tb9.2
+    **/
+    void DoSilence();    
     /**
     * Checks if this alarm can be shown in "alarm" or in "charging" state.
     * @since S60 3.2
--- a/alarmui/rom/AlmAlert.iby	Tue May 11 16:12:24 2010 +0300
+++ b/alarmui/rom/AlmAlert.iby	Tue May 25 12:41:10 2010 +0300
@@ -40,6 +40,7 @@
 data=\epoc32\data\Z\private\10282BC4\Rules\alarmui_snooze.rul      private\10282BC4\Rules\alarmui_snooze.rul
 data=\epoc32\data\Z\private\10282BC4\Rules\alarmui_activate.rul    private\10282BC4\Rules\alarmui_activate.rul
 data=\epoc32\data\Z\private\10282BC4\Rules\alarmui_stop.rul        private\10282BC4\Rules\alarmui_stop.rul
+data=\epoc32\data\Z\private\10282BC4\Rules\alarmui_silence.rul        private\10282BC4\Rules\alarmui_silence.rul
 
 #endif // RD_CONTEXT_FRAMEWORK
 
--- a/alarmui/sis/alarmui.pkg	Tue May 11 16:12:24 2010 +0300
+++ b/alarmui/sis/alarmui.pkg	Tue May 25 12:41:10 2010 +0300
@@ -33,7 +33,11 @@
 "\epoc32\release\armv5\urel\AlmAlert.dll" 								- "!:\sys\bin\AlmAlert.dll"
 "\epoc32\release\armv5\urel\AknAlarmService.dll" 								- "!:\sys\bin\AknAlarmService.dll"
 
-"\epoc32\data\Z\private\10282BC4\Rules\alarmuisnooze.rul"    - "!:\private\10282BC4\Rules\alarmuisnooze.rul"
+"\epoc32\data\Z\private\10282BC4\Rules\alarmui_snooze.rul"    - "!:\private\10282BC4\Rules\alarmui_snooze.rul"
+"\epoc32\data\Z\private\10282BC4\Rules\alarmui_stop.rul"    - "!:\private\10282BC4\Rules\alarmui_stop.rul"
+"\epoc32\data\Z\private\10282BC4\Rules\alarmui_activate.rul"    - "!:\private\10282BC4\Rules\alarmui_activate.rul"
+"\epoc32\data\Z\private\10282BC4\Rules\alarmui_silence.rul"    - "!:\private\10282BC4\Rules\alarmui_silence.rul"
+
 "\epoc32\data\z\resource\AlmAlert.rsc"                        - "!:\resource\AlmAlert.rsc"
 "\epoc32\data\z\resource\AlmAlert.r01"                        - "!:\resource\AlmAlert.r01"
 
--- a/alarmui/src/AlmAlarmControl.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/alarmui/src/AlmAlarmControl.cpp	Tue May 25 12:41:10 2010 +0300
@@ -1323,4 +1323,9 @@
  	return iStopFromContextFw;
  }
 
-// End of File
+ CAlarmUtils* CAlmAlarmControl::AlarmUtils() const
+     {
+     return iAlarmUtils;
+     }
+ // End of File
+ 
--- a/alarmui/src/alarmcontextfwsupport.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/alarmui/src/alarmcontextfwsupport.cpp	Tue May 25 12:41:10 2010 +0300
@@ -32,6 +32,7 @@
 // USER INCLUDE
 #include "alarmcontextfwsupport.h"
 #include "AlmAlarmControl.h"
+#include "alarmutils.h"
 
 #include "pim_trace.h"
 
@@ -87,9 +88,11 @@
             {
             // snooze alarm
             if(iAlarmControl->CanSnooze())
-	            {
-	            iAlarmControl->ExternalSnoozeAlarm();
-	            }
+              iAlarmControl->ExternalSnoozeAlarm();
+            }
+        else if( contextObject.Value() == TPtrC( KAlarmUISourceCommandValues[ECommandAlarmSilence] ) )
+            {
+            SilenceAlarm();
             }
         else
             {
@@ -114,9 +117,13 @@
     if( aActionToExecute.Identifier() == TPtrC( KAlarmUIActions[EActionSnooze] ) )
         {
         // snooze the alarm
-		if(iAlarmControl->CanSnooze())
-        	iAlarmControl->ExternalSnoozeAlarm();
+        if(iAlarmControl->CanSnooze())
+          iAlarmControl->ExternalSnoozeAlarm();
         }
+    else if( aActionToExecute.Identifier() == TPtrC( KAlarmUIActions[EActionSilence] ) )
+        {
+        SilenceAlarm();
+        }    
     else if( aActionToExecute.Identifier() == TPtrC( KAlarmUIActions[EActionStop] ) )
         {
         //Do not stop the alarm internally but force the user to stop the alarm manually.
@@ -183,6 +190,7 @@
 
     // define actions(s)
     DefineActionL( EActionSnooze );
+    DefineActionL( EActionSilence );    
 
     //Stop action definition should not be defined as the alarm component should not automatically stop the alarm on observing context events
     // but continue to expire the alarm and force the user to manually stop the alarm
@@ -299,6 +307,7 @@
 
     // subscribe for action(s)
     SubscribeActionL( EActionSnooze );
+    SubscribeActionL( EActionSilence );
 
     //Subscription to stop action definition from the context events should not be defined as the alarm component should not automatically stop the alarm on observing context events
     // but continue to expire the alarm and force the user to manually stop the alarm
@@ -451,5 +460,11 @@
     TRACE_EXIT_POINT;	
 	}
 
-
+void CAlarmContextFwSupport::SilenceAlarm()
+    {
+    if( iAlarmControl->AlarmUtils() )
+        {
+        iAlarmControl->AlarmUtils()->DoSilence();
+        }
+    }
 // End of File
--- a/alarmui/src/alarmutils.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/alarmui/src/alarmutils.cpp	Tue May 25 12:41:10 2010 +0300
@@ -32,6 +32,7 @@
 #include "alarmcontextfwsupport.h"
 #endif // RD_ALMALERT__SENSOR_SUPPORT
 
+#include <w32std.h>
 #include <almconst.h>
 #include <eikenv.h>
 #include <AknCapServer.h>
@@ -1668,4 +1669,51 @@
     return iCalendarAlarmViewer;
     }
 
+// ---------------------------------------------------------
+// Silence the notifying alarm 
+// ---------------------------------------------------------
+//
+void CAlarmUtils::DoSilence()
+    {
+    TRACE_ENTRY_POINT;
+    
+    // silence only if snoozing is possible
+    // this way user must hear the last "call"
+    if( CanSnooze() )
+        {
+        delete iAlarmPlayer;
+        iAlarmPlayer = NULL;
+        SetBackLight( EFalse );
+        
+        if( IsCalendarAlarm() )
+            {
+    
+            // calendar alarm needs extra handling due to having stop - silence
+            //simulate right softkey pressing
+            RWsSession wsSession=CCoeEnv::Static()->WsSession();
+            TKeyEvent keyEvent;
+            keyEvent.iCode = EKeyCBA2;  
+            keyEvent.iScanCode = EStdKeyDevice1;
+            keyEvent.iModifiers = 0;
+            keyEvent.iRepeats = 0;
+            wsSession.SimulateKeyEvent( keyEvent );
+            wsSession.Flush();
+            }
+        // clockalarm
+        else
+            {
+            StartAutoSnoozeTimer();
+            }
+    
+        #if defined( RD_ALMALERT__SENSOR_SUPPORT )
+        // notify the result through the context framework
+        if( iCFSupport )
+            {
+            PIM_TRAPD_ASSERT( iCFSupport->PublishAlarmResultL( EResultAlarmSilenced ); )
+            }
+        #endif // RD_ALMALERT__SENSOR_SUPPORT
+        }
+    TRACE_EXIT_POINT;     
+    }
+
 // End of File
--- a/calendarui/controller/inc/calenviewmanager.h	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/controller/inc/calenviewmanager.h	Tue May 25 12:41:10 2010 +0300
@@ -205,6 +205,12 @@
          */
         void ActivateViewOnFakeExitL(TUid aDefView);
         
+        /**
+         * Activate the local view if application already in back ground
+         * @param   aDefView    current default view which needs to be activated.
+         */
+        void ActivateLocalViewL(TUid aDefView);
+        
     private:  // New functions
 
         /**
--- a/calendarui/controller/src/calenattachmentui.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/controller/src/calenattachmentui.cpp	Tue May 25 12:41:10 2010 +0300
@@ -441,6 +441,7 @@
         if( KErrNone != err )
             {
             // if any error in opening file then return EFalse
+            CleanupStack::PopAndDestroy(filename);
             return EFalse;
             }
         
@@ -673,9 +674,17 @@
                             attachment->SetMimeTypeL(attachmentInfo->DataType().Des8());
                             entry->AddAttachmentL(*attachment);
                             CleanupStack::Pop(attachment);
-                            }                
+                            }
+                        else
+                            {
+                            CleanupStack::PopAndDestroy(data);
+                            }                        
                         }
-                        CleanupStack::PopAndDestroy(&fileHandle);
+                    else
+                        {
+                        CleanupStack::PopAndDestroy(data);
+                        }
+                    CleanupStack::PopAndDestroy(&fileHandle);
                     }
                 }
                         
@@ -845,11 +854,11 @@
         {
         aProtection = ETrue;
         
-        //DRM protected file: can't attach the DRM protected file 
-        CAknInformationNote* note = new ( ELeave ) CAknInformationNote(ETrue);
+        //DRM protected file: can't attach the DRM protected file
         HBufC* cannotAttach = StringLoader::LoadLC( 
                 R_QTN_CALEN_INFO_CANNOT_OPEN, CCoeEnv::Static() );
-        note->ExecuteLD( *cannotAttach );
+        CAknInformationNote* note = new ( ELeave ) CAknInformationNote(ETrue);
+        note->ExecuteLD( *cannotAttach );        
         CleanupStack::PopAndDestroy( cannotAttach );
         }
     else
--- a/calendarui/controller/src/calenbackgroundstate.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/controller/src/calenbackgroundstate.cpp	Tue May 25 12:41:10 2010 +0300
@@ -102,6 +102,9 @@
     switch( cmd )
         {
         case ECalenDayView:
+        case ECalenTodoView:
+        case ECalenMonthView:
+        case ECalenWeekView:
             SetCurrentState(aStateMachine,CCalenStateMachine::ECalenIdleState);
             cmdUsed = ETrue;
             break;
--- a/calendarui/controller/src/calencmdlinelauncher.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/controller/src/calencmdlinelauncher.cpp	Tue May 25 12:41:10 2010 +0300
@@ -262,9 +262,11 @@
                 }
             else
                 {
-                iController.ViewManager().ActivateDefaultViewL( viewUid );
-                }
-            
+                iController.ViewManager().ActivateDefaultViewL( viewUid );                
+                // Comment the following line when the the calendar.exe file is removed
+                // from the startup list.
+                iController.ViewManager().ActivateLocalViewL(viewUid);                
+                }            
             }
             break;
             
--- a/calendarui/controller/src/calenlocationui.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/controller/src/calenlocationui.cpp	Tue May 25 12:41:10 2010 +0300
@@ -77,6 +77,15 @@
 CCalenLocationUi::~CCalenLocationUi()
     {
     TRACE_ENTRY_POINT;
+    if(iMapView)
+       {
+       iMapView->Cancel();
+       iMapView->ResetLandmarksToShow();
+       delete iMapView;
+       iMapView = NULL;    
+       }
+    ReleaseLandmarkResources();
+       
     if(iLocationSelector)
 	    {
 	    delete iLocationSelector;	
@@ -252,6 +261,16 @@
 	    case ECalenNotifyCancelMapLaunch:
 	    	{
 	    	// Cancel any pending async requests
+	    	
+	    	if(iMapView)
+               {
+               iMapView->Cancel();
+               iMapView->ResetLandmarksToShow();
+               delete iMapView;
+               iMapView = NULL;    
+               }
+            ReleaseLandmarkResources();
+	    	            
 	    	iLocationSelector->DoCancel();
 	    	if(iProvider)
 	    	    {
--- a/calendarui/controller/src/calenmultipledbui.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/controller/src/calenmultipledbui.cpp	Tue May 25 12:41:10 2010 +0300
@@ -770,7 +770,7 @@
     keyBuff.Zero();
     keyBuff.AppendNum( ESyncStatus ); 
     TPckgC<TBool> pckgSyncStatusValue(syncstatus);
-    pckgSyncStatusValue.Set(iCalendarInfoEdited->PropertyValueL( keyBuff ));
+    TRAP_IGNORE(pckgSyncStatusValue.Set(iCalendarInfoEdited->PropertyValueL( keyBuff ))); 
     iCalendarInfoOriginal->SetPropertyL( keyBuff, pckgSyncStatusValue );                
 
     iDbEditor = CCalenMultiDBEditor::NewL(*this,*iCalendarInfoEdited, iController,
@@ -875,7 +875,7 @@
     TPckgC<TBool> pckgSyncStatusValueOriginal(syncstatusOriginal);
     pckgSyncStatusValueOriginal.Set(aCalendarInfoOriginal.PropertyValueL( keyBuff ));
     TPckgC<TBool> pckgSyncStatusValueModified(syncstatusModified);
-    pckgSyncStatusValueModified.Set(aCalendarInfoModified.PropertyValueL( keyBuff ));
+    TRAP_IGNORE(pckgSyncStatusValueModified.Set(aCalendarInfoModified.PropertyValueL( keyBuff )));
     syncstatusOriginal = pckgSyncStatusValueOriginal();
     syncstatusModified = pckgSyncStatusValueModified();
     if (editedName->Compare(aCalendarInfoOriginal.NameL())
--- a/calendarui/controller/src/calenviewmanager.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/controller/src/calenviewmanager.cpp	Tue May 25 12:41:10 2010 +0300
@@ -540,6 +540,10 @@
                 iPreviousToDayView.iViewUid = KNullUid;
                 }
             RequestActivationL( KUidCalenDayView, KCalenDummyUid, KNullDesC8() );
+            if(iController.IsLaunchFromExternalApp())
+                {
+                iAvoidRepopulation = ETrue;
+                }
             }
             break;
         case ECalenTodoView:
@@ -1797,4 +1801,13 @@
     
     TRACE_EXIT_POINT;
     }
+
+// -----------------------------------------------------------------------------
+// CCalenViewManager::ActivateLocalViewL
+// Activate the local view if application already in back ground
+// -----------------------------------------------------------------------------
+void CCalenViewManager::ActivateLocalViewL(TUid aDefView)
+    {
+    iAppUi.ActivateLocalViewL( aDefView );      
+    }
 // End of file
--- a/calendarui/editors/inc/calenunifiededitor.h	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/editors/inc/calenunifiededitor.h	Tue May 25 12:41:10 2010 +0300
@@ -356,6 +356,11 @@
     public:
         
         /**
+         * @brief Gets the iServices reference.
+         */
+        MCalenServices& GetServices();
+        
+        /**
          * @brief Inserts dialog line (form field) defined by aResourceId 
          *        and aControlId after existing dialog line aPrevControlId.
          * @resourceId dialog line resource
--- a/calendarui/editors/src/calendbfield.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/editors/src/calendbfield.cpp	Tue May 25 12:41:10 2010 +0300
@@ -304,7 +304,16 @@
     RPointerArray<CCalCalendarInfo> calendarInfoList; 
     iServices->GetAllCalendarInfoL(calendarInfoList);
     CleanupClosePushL( calendarInfoList );
-    TInt pos = iDbNamesTextValues->CurrentValueIndex();
+    TInt pos;
+    if( calendarInfoList.Count() == 1 )
+        {
+         pos = 0;
+        }
+    else
+        {
+        pos = iDbNamesTextValues->CurrentValueIndex();
+        }
+    
     HBufC* calendarFileName = calendarInfoList[pos]->FileNameL().AllocLC();
     iCurrentColId = iServices->SessionL(*calendarFileName).CollectionIdL();
     CleanupStack::PopAndDestroy(calendarFileName);
--- a/calendarui/editors/src/calenunifiededitor.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/editors/src/calenunifiededitor.cpp	Tue May 25 12:41:10 2010 +0300
@@ -1285,8 +1285,7 @@
             
             aMenuPane->AddMenuItemsL( R_CALEN_UNIFIED_EDITOR_DEFAULT_MENUPANE );
 
-            if( ( ctrlid != ECalenEditorPlace ) || 
-                    ( !CCalenLocationUtil::IsMapProviderAvailableL() ) )
+            if(  !CCalenLocationUtil::IsMapProviderAvailableL() )   
                 {
                 aMenuPane->DeleteMenuItem( ECalenGetLocation );
                 }
@@ -2599,7 +2598,8 @@
 void CCalenUnifiedEditor::UpdateLocationInfoToFormL()
     {
     TRACE_ENTRY_POINT;
-	
+    // set the focus to location field as the address is inserted/updated to location field.
+    TryChangeFocusToL(ECalenEditorPlace);
 	// Get location details from context
 	MCalenContext& context = iServices->Context();
 	CPosLandmark* landmark = context.GetLandMark();
@@ -3274,6 +3274,16 @@
         Edited().AttachmentNamesL(aAttachmentNames);
         }
     }
+
+// -----------------------------------------------------------------------------
+// CCalenUnifiedEditor::GetServices
+// Gets services reference
+// -----------------------------------------------------------------------------
+//
+MCalenServices& CCalenUnifiedEditor::GetServices()
+    {
+    return *iServices;
+    }
 	
 // -----------------------------------------------------------------------------
 // CMapsIconPicture::CMapsIconPicture
--- a/calendarui/editors/src/calenunifiededitorcontrol.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/editors/src/calenunifiededitorcontrol.cpp	Tue May 25 12:41:10 2010 +0300
@@ -329,7 +329,15 @@
         iRepeatField->InitRepetFieldLayoutL();
         }
 
-    iDbField->InitDbFieldLayoutL();
+    RPointerArray<CCalCalendarInfo> calendarInfoList; 
+    iUnifiedEditor.GetServices().GetAllCalendarInfoL(calendarInfoList);
+    CleanupClosePushL( calendarInfoList );
+    if( calendarInfoList.Count() > 1 )
+      {
+        iDbField->InitDbFieldLayoutL();
+      }
+    CleanupStack::PopAndDestroy( &calendarInfoList );
+    
     iDescription->InitDescritpionFieldLayoutL();
     
     TRACE_EXIT_POINT;
@@ -344,10 +352,27 @@
     {
     TRACE_ENTRY_POINT;
     // event type, subject, date & year,more details
-     
-    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
-                  ECalenEditorStartDate, ECalenEditorSubject ); 
+    
+    RPointerArray<CCalCalendarInfo> calendarInfoList; 
+    iUnifiedEditor.GetServices().GetAllCalendarInfoL(calendarInfoList);
+    CleanupClosePushL( calendarInfoList );
+
+    if( calendarInfoList.Count() > 1 )
+        {
+        iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
+            ECalenEditorDBName, ECalenEditorSubject );
 
+        iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
+            ECalenEditorStartDate, ECalenEditorDBName );
+        }
+    else
+        {
+        iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
+            ECalenEditorStartDate, ECalenEditorSubject );
+        }
+
+    CleanupStack::PopAndDestroy( &calendarInfoList );
+    
     // "Start Date" Label should be "Date of Birth" for Birthday
     iUnifiedEditor.SetControlCaptionL( ECalenEditorStartDate,
                     R_QTN_CALEN_EDITOR_DATE_OF_BIRTH );
@@ -359,13 +384,13 @@
                     ECalenEditorPlace, ECalenEditorReminder );
 /*    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_PEOPLE_ITEM,
                     ECalenEditorPeople, ECalenEditorPlace );
-*/    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
-                    ECalenEditorDBName, ECalenEditorPlace );
+*/   /* iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
+                    ECalenEditorDBName, ECalenEditorPlace );*/
 
     // TODO: Uncomment this when enabling attachment support
     // Replace ECalenEditorDBName with ECalenEditorAttachment in the next statement
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
-                    ECalenEditorAttachment, ECalenEditorDBName );
+                    ECalenEditorAttachment, ECalenEditorPlace );
 
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DESCRIPTION_ITEM,
                     ECalenEditorDescription, ECalenEditorAttachment );
@@ -388,10 +413,26 @@
     // all day event 
     // subject,event type,all day,start date,end date,place,more details 
     
-  
+    RPointerArray<CCalCalendarInfo> calendarInfoList; 
+    iUnifiedEditor.GetServices().GetAllCalendarInfoL(calendarInfoList);
+    CleanupClosePushL( calendarInfoList );
+
+    if( calendarInfoList.Count() > 1 )
+        {
+    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
+            ECalenEditorDBName, ECalenEditorSubject );
+
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ALL_DAY_ITEM,
+            ECalenEditorAllDayItem, ECalenEditorDBName );
+        }
+    else
+        {
+    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ALL_DAY_ITEM, 
             ECalenEditorAllDayItem, ECalenEditorSubject );
+        }
 
+    CleanupStack::PopAndDestroy( &calendarInfoList );
+    
     if( !iUnifiedEditor.Edited().IsAllDayEvent() )
         {
         iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_TIME_ITEM, 
@@ -418,13 +459,13 @@
     /*iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_PEOPLE_ITEM,
                     ECalenEditorPeople, ECalenEditorRepeat );
     */
-    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
+   /* iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
                     ECalenEditorDBName, ECalenEditorRepeat );
-    
+    */
     // TODO: Uncomment this when enabling attachment support
     // Replace ECalenEditorDBName with ECalenEditorAttachment in the next statement
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
-                    ECalenEditorAttachment, ECalenEditorDBName );
+                    ECalenEditorAttachment, ECalenEditorRepeat );
     
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DESCRIPTION_ITEM,
                     ECalenEditorDescription, ECalenEditorAttachment );
@@ -441,9 +482,25 @@
     {
     TRACE_ENTRY_POINT;
     // event type,subject,due date,more details
+   RPointerArray<CCalCalendarInfo> calendarInfoList; 
+   iUnifiedEditor.GetServices().GetAllCalendarInfoL(calendarInfoList);
+   CleanupClosePushL( calendarInfoList );
+   
+    if( calendarInfoList.Count() > 1 )
+        {
+        iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
+                        ECalenEditorDBName, ECalenEditorSubject );
+        
+        iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
+                            ECalenEditorStartDate, ECalenEditorDBName );
+        }
+    else
+        {
+        iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
+                               ECalenEditorStartDate, ECalenEditorSubject );
+        }
     
-    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
-                    ECalenEditorStartDate, ECalenEditorSubject );
+    CleanupStack::PopAndDestroy( &calendarInfoList );
 
     // "Start Date" Label should be "Due date" for To-Do
     iUnifiedEditor.SetControlCaptionL( ECalenEditorStartDate,
@@ -455,13 +512,13 @@
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_PRIORITY_ITEM, 
                     ECalenEditorPriority, ECalenEditorReminder );
 
-    iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
-                    ECalenEditorDBName, ECalenEditorPriority );
+    /*iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DB_NAME_ITEM,
+                    ECalenEditorDBName, ECalenEditorPriority );*/
     
     // TODO: Uncomment this when enabling attachment support
     // Replace ECalenEditorDBName with ECalenEditorAttachment in the next statement
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_ATTACHMENT_ITEM,
-                    ECalenEditorAttachment, ECalenEditorDBName );
+                    ECalenEditorAttachment, ECalenEditorPriority );
     
     iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_DESCRIPTION_ITEM,
                     ECalenEditorDescription, ECalenEditorAttachment );
@@ -868,8 +925,11 @@
         iUnifiedEditor.DeleteLine( ECalenEditorPeople );
         }
     */
-    iUnifiedEditor.DeleteLine( ECalenEditorDBName );
-    
+    CCoeControl* dbNameCtrl = iUnifiedEditor.ControlOrNull( ECalenEditorDBName );
+    if( dbNameCtrl )
+        {
+        iUnifiedEditor.DeleteLine( ECalenEditorDBName );
+        }
     // TODO: Uncomment this when enabling attachment support
     iUnifiedEditor.DeleteLine( ECalenEditorAttachment );
     
@@ -1283,9 +1343,13 @@
         case CCalEntry::EAnniv:
             {
             iUnifiedEditor.DeleteLine( ECalenEditorStartDate, EFalse );
-            iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_BIRTHDAY_YEAR_ITEM, 
+            iUnifiedEditor.InsertFieldL( R_CALEN_EDITOR_START_DATE_ITEM, 
                     ECalenEditorStartDate, ECalenEditorEventType );
             
+            // "Start Date" Label should be "Date of Birth" for Birthday
+            iUnifiedEditor.SetControlCaptionL( ECalenEditorStartDate,
+                            R_QTN_CALEN_EDITOR_DATE_OF_BIRTH );
+            
             }
             break;
             
--- a/calendarui/globaldata/group/CalenGlobalData.mmp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/globaldata/group/CalenGlobalData.mmp	Tue May 25 12:41:10 2010 +0300
@@ -46,6 +46,7 @@
 APP_LAYER_SYSTEMINCLUDE
 SYSTEMINCLUDE   ../../../inc   //organizer include
 SYSTEMINCLUDE   /epoc32/include/ecom
+SYSTEMINCLUDE   ../../../alarmengines/inc
 
 LIBRARY         euser.lib
 LIBRARY         ecom.lib
@@ -69,6 +70,7 @@
 LIBRARY			lbs.lib
 LIBRARY			calencommonutils.lib
 LIBRARY         centralrepository.lib
+LIBRARY			missedalarmstore.lib  flogger.lib
 
 CAPABILITY      CAP_GENERAL_DLL
 
--- a/calendarui/globaldata/inc/calendbchangenotifier.h	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/globaldata/inc/calendbchangenotifier.h	Tue May 25 12:41:10 2010 +0300
@@ -27,6 +27,7 @@
 // FORWARD DECLARATIONS
 class CCalSession;                  //Calendar session
 class CCalenGlobalData;             //Calendar global data
+class CMissedAlarm;
 
 // CLASS DECLARATION
 
@@ -126,6 +127,14 @@
         * Cancels iNotificationTimer if started
         */
         void DoCancel();
+        void HandleMissedAlarmsL(const RArray<TCalChangeEntry>& aChangeItems);
+        class  TCalLuidFilename
+            {
+        public:
+            TCalLocalUid iLuid;
+            TFileName iFilename;
+            };
+        static TBool DoFindEntryByLuid(const TCalLuidFilename* aLuidFilename,const CMissedAlarm& aCalendarInfo);
 
     private:    // Data
 
--- a/calendarui/globaldata/src/calendbchangenotifier.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/globaldata/src/calendbchangenotifier.cpp	Tue May 25 12:41:10 2010 +0300
@@ -21,9 +21,14 @@
 #include "calendarui_debug.h"
 
 // INCLUDE FILES
+#include "CleanupResetAndDestroy.h"
 #include "calendbchangenotifier.h"    // CCalenDbChangeNotifier
 #include "calenglobaldata.h"            // Calendar global data
 #include <calsession.h>                 // CalSession
+#include <missedalarm.h>
+#include <missedalarmstore.h>
+#include <missedalarmstorecrkeys.h>
+#include <calcalendarinfo.h>
 
 // -----------------------------------------------------------------------------
 // KTimerResolution limits the number of notifications sent to registered
@@ -148,10 +153,11 @@
 // to the one we are currently using.
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
-void CCalenDbChangeNotifier::CalChangeNotification( RArray<TCalChangeEntry>& /*aChangeItems*/ )
+void CCalenDbChangeNotifier::CalChangeNotification( RArray<TCalChangeEntry>& aChangeItems )
     {
     TRACE_ENTRY_POINT;
 
+    TRAP_IGNORE(HandleMissedAlarmsL(aChangeItems));
     // Always update the last notification time, even if we don't notify 
     // our observers
     iLastDbChangeNotification.UniversalTime();
@@ -168,6 +174,52 @@
 
     TRACE_EXIT_POINT;
     }
+void CCalenDbChangeNotifier::HandleMissedAlarmsL(const RArray<TCalChangeEntry>& aChangeItems)
+    {
+    TRACE_ENTRY_POINT
+    CRepository* missedAlarmStoreRepository = CRepository::NewL(
+            KCRUidMissedAlarmStore);
+    // Create missed alarm store
+    CMissedAlarmStore* missedAlarmStore = CMissedAlarmStore::NewL(
+            *missedAlarmStoreRepository);
+    CleanupStack::PushL(missedAlarmStore);
+    RPointerArray<CMissedAlarm> missedAlarmStorelist;
+    CleanupResetAndDestroyPushL(missedAlarmStorelist);
+    missedAlarmStore->GetL(missedAlarmStorelist);
+    CCalCalendarInfo* calendarInfo = iSession.CalendarInfoL();
+    CleanupStack::PushL(calendarInfo);
+    CCalenDbChangeNotifier::TCalLuidFilename calLuidFilename;
+    calLuidFilename.iFilename = calendarInfo->FileNameL();
+    if (missedAlarmStorelist.Count())
+        {
+        for (TInt idx = 0; idx < aChangeItems.Count(); idx++)
+            {
+            if (aChangeItems[idx].iChangeType == EChangeDelete)
+                {
+                calLuidFilename.iLuid = aChangeItems[idx].iEntryId;
+                TInt index = missedAlarmStorelist.Find(
+                        calLuidFilename,CCalenDbChangeNotifier::DoFindEntryByLuid);
+                if(index != KErrNotFound)
+                    {
+                    CMissedAlarm* missedAlarm = missedAlarmStorelist[index];
+                    missedAlarmStore->RemoveL(*missedAlarm);
+                    }
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy(calendarInfo);
+    CleanupStack::PopAndDestroy(&missedAlarmStorelist);
+    CleanupStack::PopAndDestroy(missedAlarmStore);
+    TRACE_EXIT_POINT    
+    }
+TBool CCalenDbChangeNotifier::DoFindEntryByLuid(
+                const TCalLuidFilename* aLuidFilename,const CMissedAlarm& aMissedAlarm)
+    {
+    TRACE_ENTRY_POINT
+    TRACE_EXIT_POINT
+    return (aLuidFilename->iLuid == aMissedAlarm.iLuid 
+            && !aLuidFilename->iFilename.CompareF(aMissedAlarm.iCalFileName));
+    }
 
 // -----------------------------------------------------------------------------
 // CCalenDbChangeNotifier::RegisterObserverL
--- a/calendarui/globaldata/src/calenglobaldata.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/globaldata/src/calenglobaldata.cpp	Tue May 25 12:41:10 2010 +0300
@@ -58,8 +58,7 @@
 
 
 _LIT(KPersonal,"Personal");
-_LIT(KFamily,"Family");
-_LIT(KFriends,"Friends");
+
 _LIT( KMissedAlarmResourceFile, "z:\\resource\\CalenSvrMissedAlarmManagerResource.rsc"); // changes done
 
 // ============================ MEMBER FUNCTIONS ===============================
@@ -1524,24 +1523,7 @@
             iCalendarInfoList[index]->SetNameL(*personalCalendar);
             CleanupStack::PopAndDestroy( personalBuffer );
             }
-        else if(calendarNamePtr.Compare(KFamily) == 0)
-            {
-            HBufC8* familyBuffer=resourceFile.AllocReadLC( R_CALE_DB_FAMILY );
-            const TPtrC16 ptrFBuffer(( TText16*) familyBuffer->Ptr(),
-                    ( familyBuffer->Length()+1 )>>1 );
-            HBufC *familyCalendar = ptrFBuffer.AllocL();
-            iCalendarInfoList[index]->SetNameL(*familyCalendar);
-            CleanupStack::PopAndDestroy( familyBuffer );
-            }
-        else if(calendarNamePtr.Compare(KFriends) == 0)
-            {
-            HBufC8* friendsBuffer = resourceFile.AllocReadLC( R_CALE_DB_FRIENDS );
-            const TPtrC16 ptrFrBuffer(( TText16*) friendsBuffer->Ptr(),
-                    ( friendsBuffer->Length()+1 )>>1 );
-            HBufC *friendsCalendar = ptrFrBuffer.AllocL();
-            iCalendarInfoList[index]->SetNameL(*friendsCalendar);
-            CleanupStack::PopAndDestroy( friendsBuffer );
-            }
+       
 	   
             aCalendarInfoList.AppendL(iCalendarInfoList[index]);
 	        
--- a/calendarui/multicaluidialog/src/multicaluidialogmodel.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/multicaluidialog/src/multicaluidialogmodel.cpp	Tue May 25 12:41:10 2010 +0300
@@ -22,11 +22,15 @@
 #include <CalenInterimUtils2.h>
 #include <calcalendarinfo.h>
 #include <calcalendariterator.h>
+#include <calenmulticaluids.hrh>
+
 // user include.
 #include "multicaluidialogmodel.h"
 #include "calendarui_debug.h"
 #include "cleanupresetanddestroy.h"
 
+const TInt KBuffLength = 24;
+
 // ----------------------------------------------------------------------------
 // CMultiCalUiDialogModel::CMultiCalUiDialogModel
 // Constructor
@@ -304,11 +308,29 @@
     CCalCalendarIterator* calIter = CCalCalendarIterator::NewL(
             *iCalendarsSession);
     CleanupStack::PushL(calIter);
-    CCalCalendarInfo* calendarInfo = calIter->FirstL();
-    while (calendarInfo)
+
+    for( CCalCalendarInfo* calendarInfo = calIter->FirstL();
+            calendarInfo!=NULL;calendarInfo = calIter->NextL())
         {
-        aCalendarInfoList.AppendL(calendarInfo);
-        calendarInfo = calIter->NextL();
+            TBuf8<KBuffLength> keyBuff;
+            // Mark the meta property as SoftDeleted
+            keyBuff.Zero();
+            keyBuff.AppendNum(EMarkAsDelete);
+            TBool softDelete = EFalse;
+            TPckgC<TBool> pkgSoftDelete( softDelete );
+            TRAPD(err,pkgSoftDelete.Set(calendarInfo->PropertyValueL(keyBuff)));
+            if( KErrNone == err )
+                {
+                softDelete = pkgSoftDelete();
+                }
+            if(!softDelete)
+                {
+                aCalendarInfoList.Append(calendarInfo);
+                }
+            else
+                {
+                delete calendarInfo;
+                }
         }
     CleanupStack::PopAndDestroy(calIter);
 
--- a/calendarui/regionalplugins/lunarVietnamese/src/calenlunarvietnameselocalizer.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/regionalplugins/lunarVietnamese/src/calenlunarvietnameselocalizer.cpp	Tue May 25 12:41:10 2010 +0300
@@ -137,8 +137,8 @@
     day.Num( TInt64(aInfo.iLunarDate.iDay ));
     CPtrCArray* monthAndDaySubs = new (ELeave) CPtrCArray(2);
     CleanupStack::PushL( monthAndDaySubs );
+    monthAndDaySubs->AppendL(day);
     monthAndDaySubs->AppendL(month);
-    monthAndDaySubs->AppendL(day);
     
     HBufC* tmp = StringLoader::LoadLC( dateResource, *monthAndDaySubs );
     aLocInfo->iLunarMonthAndDay = *tmp;
--- a/calendarui/server/CalenSvr/src/CalenServer.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/server/CalenSvr/src/CalenServer.cpp	Tue May 25 12:41:10 2010 +0300
@@ -53,8 +53,7 @@
 const TInt KComma( ',' );
 
 _LIT(KPersonal,"Personal");
-_LIT(KFamily,"Family");
-_LIT(KFriends,"Friends");
+
 
 // ================= MEMBER FUNCTIONS =======================
 //
@@ -382,15 +381,7 @@
         aCalendarNames.AppendL( personalBuffer->Des() );    
        CleanupStack::PopAndDestroy( personalBuffer );
        
-    // famliy
-        HBufC* familyBuffer = KFamily().AllocLC();    
-       aCalendarNames.AppendL( familyBuffer->Des() );    
-       CleanupStack::PopAndDestroy( familyBuffer );
-       
-    //friends
-       HBufC* friendBuffer = KFriends().AllocLC();    
-      aCalendarNames.AppendL( friendBuffer->Des() );    
-      CleanupStack::PopAndDestroy( friendBuffer );
+   
    
     
     TRACE_EXIT_POINT;
--- a/calendarui/views/inc/calendaylistbox.h	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/views/inc/calendaylistbox.h	Tue May 25 12:41:10 2010 +0300
@@ -98,7 +98,7 @@
      * From CCoeControl Draws itself
      */
     void Draw(const TRect& aRect) const;
-
+   
     /**
      * From CCoeControl Handle global resource change
      */
--- a/calendarui/views/inc/caleneventview.h	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/views/inc/caleneventview.h	Tue May 25 12:41:10 2010 +0300
@@ -152,6 +152,11 @@
 	*/
     void AddToolbarButtonsL();
     
+    /**
+     * Updates the toolbar buttons on the existing toolbar for event viewer
+     */
+    void UpdateToolbarButtonsL();
+    
 private:
     TVwsViewId iPreviousViewId;  
 
--- a/calendarui/views/inc/caleneventviewcontainer.h	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/views/inc/caleneventviewcontainer.h	Tue May 25 12:41:10 2010 +0300
@@ -499,15 +499,6 @@
      */
     void AddCalendarInfoFieldL();
     
-    /*
-     * @brief Find calendarinfo object based on calendar name
-     * 
-     * @param aName calendar filename
-     * @param aCalendarInfo referance for calendarinfo
-     * @return TBool find status
-     */
-    static TBool CalendarInfoIdentifierL(const HBufC* aName,
-            const CCalCalendarInfo& aCalendarInfo);
     /**
      * Adds the attachment field in the viewer
      */
@@ -547,6 +538,16 @@
      * To stop the alarm in auto snooze case.and to open the event viewer in normal mode.
      */
      void HandleStopCommandL();
+     
+     /*
+      * @brief Find calendarinfo object based on calendar name
+      * 
+      * @param aName calendar filename
+      * @param aCalendarInfo referance for calendarinfo
+      * @return TBool find status
+      */
+     static TBool CalendarInfoIdentifierL(const HBufC* aName,
+             const CCalCalendarInfo& aCalendarInfo);
 
 protected:
 
--- a/calendarui/views/inc/calenweekcontainer.h	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/views/inc/calenweekcontainer.h	Tue May 25 12:41:10 2010 +0300
@@ -127,8 +127,9 @@
 
     /**
      * Set Active context based on currently focused cell.
+     * @param aInstAvailable Flag to find instance available
      */
-    void SetActiveContextFromHighlightL();
+    void SetActiveContextFromHighlightL(TBool aInstAvailable = ETrue);
 
     /**
      * Step 1 of construction of grid data.
--- a/calendarui/views/src/calendaylistbox.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/views/src/calendaylistbox.cpp	Tue May 25 12:41:10 2010 +0300
@@ -388,6 +388,8 @@
     }
 
 
+
+
 TKeyResponse CCalenDayListBox::HandleDownwardLoopingL(const TKeyEvent& aKeyEvent)
     {
     TRACE_ENTRY_POINT;
--- a/calendarui/views/src/calendayview.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/views/src/calendayview.cpp	Tue May 25 12:41:10 2010 +0300
@@ -185,7 +185,6 @@
         {
         iShowBackButtonOnCba = EFalse;
         }
-    iDayContainer->UpdateContainerL();
     //UpdateCbaL();
 
     iEventViewCommandHandled = EFalse;
--- a/calendarui/views/src/caleneventview.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/views/src/caleneventview.cpp	Tue May 25 12:41:10 2010 +0300
@@ -25,6 +25,8 @@
 #include <calencommands.hrh>            // Calendar commands
 #include <calencontext.h>
 #include <CalenStatusPaneUtils.h>
+#include <calcalendarinfo.h>
+#include <caleninstanceid.h>
 
 // user includes
 #include "caleneventview.h"
@@ -157,6 +159,7 @@
         	{
         	cnt->CompletePopulationL();
         	RedrawStatusPaneL();
+        	UpdateToolbarButtonsL();
         	nextStep = CCalenView::EDone;
         	}
         	break;
@@ -465,12 +468,23 @@
 	{
     TRACE_ENTRY_POINT;
     CCalenEventViewContainer* cnt = static_cast<CCalenEventViewContainer*>( iContainer );
+    TCalCollectionId colId = iServices.Context().InstanceId().iColId;
+    // get multiple db data from services
+    RPointerArray<CCalCalendarInfo> calendarInfoList;
+    iServices.GetAllCalendarInfoL(calendarInfoList);
+    CleanupClosePushL(calendarInfoList);
+    
+    HBufC* calendarFileName = iServices.GetCalFileNameForCollectionId(colId).AllocLC();
+    TInt index = calendarInfoList.Find( *calendarFileName, 
+            CCalenEventViewContainer::CalendarInfoIdentifierL);
+   CleanupStack::PopAndDestroy(calendarFileName);
     switch(aResourceId)
     	{
 	    case R_CALEN_EVENT_VIEW_MENUPANE:
 	    case R_CALEN_EVENT_VIEW_LONGTAP_MENUPANE:
 	    	{
 	    	CCalenEntryUtil* eventViewData = cnt->GetEventViewData();
+	    	
 	    	if(eventViewData)
 	    	    {
 	    	    if(eventViewData->EntryType() == CCalEntry::ETodo)
@@ -515,6 +529,14 @@
 	            aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace );
 	            aMenuPane->DeleteMenuItem( ECalenShowLocation );	
 	            }
+		  	if(!(calendarInfoList[index]->Enabled()))
+		  	    {
+                aMenuPane->DeleteMenuItem(ECalenSend);
+                aMenuPane->DeleteMenuItem(ECalenCmdPromptThenEdit);
+                aMenuPane->DeleteMenuItem(ECalenDeleteCurrentEntry);
+		  	    }
+		  	
+		  	 
 		    break;
 		  	}
 		 default:
@@ -523,7 +545,7 @@
 		    }
 			break;
 		}
-    
+    CleanupStack::PopAndDestroy(&calendarInfoList);
     TRACE_EXIT_POINT;	
 	}
 	
@@ -762,5 +784,44 @@
 
     TRACE_EXIT_POINT;
     return button;
-    }    
+    } 
+    
+// ----------------------------------------------------------------------------
+// CCalenEventView::UpdateToolbarButtonsL
+// Updates the toolbar buttons on the existing toolbar for event viewer
+// ----------------------------------------------------------------------------
+//  
+
+void CCalenEventView::UpdateToolbarButtonsL()
+    {
+    // Get the existing toolbar from MCalenservices
+    MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
+    CAknToolbar& toolbar = toolbarImpl->Toolbar();
+    TCalCollectionId colId = iServices.Context().InstanceId().iColId;
+      
+    // get multiple db data from services
+    RPointerArray<CCalCalendarInfo> calendarInfoList;
+    iServices.GetAllCalendarInfoL(calendarInfoList);
+    CleanupClosePushL(calendarInfoList);
+    
+    HBufC* calendarFileName = iServices.GetCalFileNameForCollectionId(colId).AllocLC();
+    TInt index = calendarInfoList.Find( *calendarFileName, 
+    CCalenEventViewContainer::CalendarInfoIdentifierL);
+    CleanupStack::PopAndDestroy(calendarFileName);
+    
+    
+    if(!(calendarInfoList[index]->Enabled()))
+        {
+        toolbar.SetItemDimmed( ECalenSend, ETrue, ETrue );
+        toolbar.SetItemDimmed( ECalenDeleteCurrentEntry, ETrue, ETrue );
+        toolbar.SetItemDimmed( ECalenEditCurrentEntry, ETrue, ETrue );
+        }
+    else
+        {
+        toolbar.SetItemDimmed( ECalenSend, EFalse, ETrue );
+        toolbar.SetItemDimmed( ECalenDeleteCurrentEntry, EFalse, ETrue );
+        toolbar.SetItemDimmed( ECalenEditCurrentEntry, EFalse, ETrue );
+        }
+    CleanupStack::PopAndDestroy(&calendarInfoList);
+    }
 //end of file
--- a/calendarui/views/src/calenmissedalarmscontainer.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/views/src/calenmissedalarmscontainer.cpp	Tue May 25 12:41:10 2010 +0300
@@ -917,7 +917,9 @@
     TCalenInstanceId missedAlarm = iMissedAlarmsArray[aIndex];
             
     CCalEntry* entry = iServices.EntryViewL(missedAlarm.iColId)->FetchL( missedAlarm.iEntryLocalUid );
-    User::LeaveIfNull( entry );
+    //User::LeaveIfNull( entry );
+    if (entry)
+    	{
     CleanupStack::PushL( entry );
     
     TTime instanceTime;
@@ -933,6 +935,7 @@
     context.SetInstanceIdL( id, context.ViewId() ); 
     
     CleanupStack::PopAndDestroy( entry );
+    }
     
     TRACE_EXIT_POINT;
     }
--- a/calendarui/views/src/calennativeview.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/views/src/calennativeview.cpp	Tue May 25 12:41:10 2010 +0300
@@ -707,6 +707,7 @@
     notificationArray.Append(ECalenNotifyStopAlarm);
 	notificationArray.Append(ECalenNotifyDeleteFailed);
 	notificationArray.Append(ECalenNotifyEntryDeleted);
+	notificationArray.Append(ECalenNotifyResourceChanged);
 	
     iServices.RegisterForNotificationsL( this,notificationArray);
     
@@ -1164,6 +1165,19 @@
                 }
             }
             break;
+		case ECalenNotifyResourceChanged:
+		    {
+		    if(iContainer )
+		        {
+                CAknAppUi* Appui = (CAknAppUi*)CEikonEnv::Static()->EikAppUi();
+                //handle this event when the app is in background
+                if(!Appui->IsForeground())
+                    {
+                    iContainer->HandleResourceChange(KEikDynamicLayoutVariantSwitch);
+                    }
+		        }
+		    }
+		    break;
         default:
             ASSERT( 0 ); // should never get here
             break;
--- a/calendarui/views/src/calenweekcontainer.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/calendarui/views/src/calenweekcontainer.cpp	Tue May 25 12:41:10 2010 +0300
@@ -402,7 +402,7 @@
 // (other items were commented in a header).
 // ----------------------------------------------------------------------------
 //
-void CCalenWeekContainer::SetActiveContextFromHighlightL()
+void CCalenWeekContainer::SetActiveContextFromHighlightL(TBool aInstAvailable)
     {
     TRACE_ENTRY_POINT;
 
@@ -424,7 +424,7 @@
         //    * Focus on instanceId and datetime
         // 2. Timed item, 1-n for each cell, on same/ different day
         //    * Focus on datetime
-        if( itemInfo.HasInstance() )
+        if( itemInfo.HasInstance() && aInstAvailable)
             {
             TCalenInstanceId instId = TCalenInstanceId::CreateL( *itemInfo.iInstance );
             if( !itemInfo.IsTimed() )       // todo/anniv/memo
@@ -438,13 +438,8 @@
                 {
                 TTime focusTime = CalenDateUtils::BeginningOfDay( iTime ) + itemInfo.iStartTime;
                 currentDayCalTime.SetTimeLocalL( focusTime );
- //               context.SetFocusDateAndTimeL( currentDayCalTime,
-  //                                              TVwsViewId( KUidCalendar, KUidCalenWeekView ) );
                 context.SetFocusDateAndTimeAndInstanceL( currentDayCalTime, instId, 
-                                                TVwsViewId( KUidCalendar, KUidCalenWeekView ) );
-                                                
-                TDateTime focusTimeTemp = focusTime.DateTime();
-                
+                                            TVwsViewId( KUidCalendar, KUidCalenWeekView ) );
                 }
             }
         else if( itemInfo.iStartTime.Int() == KErrNotFound )    // empty non-timed cell
@@ -2067,32 +2062,32 @@
         {
         TInt direction(0);
         if(aEventID == EAknNaviDecoratorEventLeftTabArrow)
-                    {
-                    if(AknLayoutUtils::LayoutMirrored())
-						{
-                        direction = 1;
-						}
-                    else
-						{
-                        direction = -1;
-						}
-                    }
-                    
-                else if(aEventID == EAknNaviDecoratorEventRightTabArrow)
-                    { 
-                    if(AknLayoutUtils::LayoutMirrored())
-						{
-                        direction = -1;
-						}
-                    else
-						{
-                        direction = 1;
-						}
-                    }
+            {
+            if(AknLayoutUtils::LayoutMirrored())
+                {
+                direction = 1;
+                }
+            else
+                {
+                direction = -1;
+                }
+            }            
+        else if(aEventID == EAknNaviDecoratorEventRightTabArrow)
+            { 
+            if(AknLayoutUtils::LayoutMirrored())
+                {
+                direction = -1;
+                }
+            else
+                {
+                direction = 1;
+                }
+            }
         else
             return;
+        
         HorizontalWeekMoveL(direction);
-        SetActiveContextFromHighlightL();
+        SetActiveContextFromHighlightL(EFalse);
         WeekView().SetStatusPaneFromActiveContextL();
         iView->BeginRepopulationL();
         }
--- a/clock2/clockui/plugins/clockindicatorpaneplugin/data/clockindicatorpaneplugin.rss	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/plugins/clockindicatorpaneplugin/data/clockindicatorpaneplugin.rss	Tue May 25 12:41:10 2010 +0300
@@ -46,7 +46,7 @@
 //
 RESOURCE TBUF r_qtn_clk_stylus_popup_alarms_set
 	{
-	buf = "%0U at %1U";		// TODO: Replace with logical string once CR is approved.
+	buf = qtn_clk_stylus_popup_alarms_set;		
 	}
 
 // End of file
--- a/clock2/clockui/uilayer/clkdatetimeview/group/clkdatetimeview.mmp	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/clkdatetimeview/group/clkdatetimeview.mmp	Tue May 25 12:41:10 2010 +0300
@@ -81,5 +81,6 @@
 LIBRARY			eiksrv.lib
 LIBRARY			ecom.lib
 LIBRARY			clockecomlistener.lib
+LIBRARY     		mediafilelist.lib
 
 // End of file
--- a/clock2/clockui/uilayer/clkdatetimeview/src/clkdatetimeview.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/clkdatetimeview/src/clkdatetimeview.cpp	Tue May 25 12:41:10 2010 +0300
@@ -56,6 +56,7 @@
 #include <AknGlobalNote.h>
 #include <featdiscovery.h>
 #include <ProfileEngineDomainCRKeys.h>
+#include <mediafilelist.h>
 
 // User Includes
 #include "clkuiclksrvmodel.h"
@@ -2437,39 +2438,31 @@
     // Set the flag to indicate that the tone selection list is in use.
     iExtension->SetAlarmToneListInUse( ETrue );    
 	
-	// Open the resource file.
-    RConeResourceLoader resourceLoader( *( CCoeEnv::Static() ) );
-    OpenFileListResourceLC( resourceLoader );
+    CMediaFileList* list = CMediaFileList::NewL();
+    CleanupStack::PushL( list );
+    
+    TInt nullItem( KErrNotFound );
     
-    // Launch filelist using your custom resource.
-	CFLDFileListContainer* alarmToneList = CFLDFileListContainer::NewLC( R_FILELIST_MODEL_NOVIDEO );
+    // default tone
+    list->SetNullItemL( iDefaultToneTxt->Des(), iDefaultAlarmToneName,
+            CMediaFileList::EMediaFileTypeAudio,
+            CMediaFileList::ENullItemIconDefaultTone );    
     
-	// Populate the list with "Default" and "Off" strings.
-	alarmToneList->InsertNullItemL( iDefaultToneTxt->Des(), iDefaultAlarmToneName );
-	alarmToneList->InsertEndNullItemL( iSoundOffTxt->Des(), iExtension->GetSilentToneStr()->Des() );
-	// Do not show videos.
-	alarmToneList->AddExclusiveMediaTypeL( ECLFMediaTypeVideo );
-	alarmToneList->SetAutomatedType( CDRMHelper::EAutomatedTypeClockAlarm );
-    // Do not show items over the file size limit, if configured.
-    if ( CFeatureDiscovery::IsFeatureSupportedL(
-         KFeatureIdFfLimitedMessageAndAlarmToneSize ) )
-        {
-         // Max file size allowed (in KB).  0 == no limit.
-        TInt fileSizeLimit = 0;
-        CRepository* profilesCenRep = CRepository::NewLC( KCRUidProfileEngine );
+    // off
+    list->SetNullItemL( iSoundOffTxt->Des(), iExtension->GetSilentToneStr()->Des(),
+            CMediaFileList::EMediaFileTypeAudio,
+            CMediaFileList::ENullItemIconOff );      
+    
 
-        // Reading the repository should not fail, but if it does, the default
-        // value we have for the file size limit is acceptable.
-        profilesCenRep->Get( KProEngRingingToneMaxSize, fileSizeLimit ); // codescanner::crepository
-        CleanupStack::PopAndDestroy( profilesCenRep );
+	list->SetAttrL( CMediaFileList::EAttrAutomatedType, CDRMHelper::EAutomatedTypeClockAlarm );
+    list->SetAttrL( CMediaFileList::EAttrExcludeFolder, CMediaFileList::EMediaFileTypeVideo );
+    	
+	// Launch the list. ETrue is returned if OK is pressed. EFalse otherwise.
+    TBool ok( list->ShowMediaFileListL( &iAlarmToneName, &nullItem, NULL, NULL ) );
 
-        if ( fileSizeLimit > 0 )
-            {
-            alarmToneList->SetMaxFileSize( fileSizeLimit * KKilo );
-            }
-        }
-	// Launch the list. ETrue is returned if OK is pressed. EFalse otherwise.
-    if( alarmToneList->LaunchL( iAlarmToneName, *iToneListHeader ) )
+    // Cleanup.
+    CleanupStack::PopAndDestroy( list );    	
+    if( ok )
 		{
 		// User has selected the tone and pressed OK.
 		// Holder for the old alarm tone.
@@ -2489,12 +2482,7 @@
         // Cleanup.
         CleanupStack::PopAndDestroy( cenRep );
 		}
-	// User pressed Cancel.
-    iExtension->SetAlarmToneListInUse( EFalse );
-    
-    // Cleanup.
-    CleanupStack::PopAndDestroy( alarmToneList );
-    CleanupStack::PopAndDestroy( &resourceLoader );
+    iExtension->SetAlarmToneListInUse( EFalse );   	
     }
 
 // ---------------------------------------------------------
--- a/clock2/clockui/uilayer/clockalarmeditor/data/clockalarmeditor.ra	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/clockalarmeditor/data/clockalarmeditor.ra	Tue May 25 12:41:10 2010 +0300
@@ -94,7 +94,6 @@
     items =
         {
         LBUF { txt = qtn_clk_alarm_occ_once; },
-        LBUF { txt = qtn_clk_alarm_24h; },
         LBUF { txt = text_calendar_every_day; },
         LBUF { txt = qtn_clk_alarm_occ_workd; },
         LBUF { txt = text_calendar_every_week; }
--- a/clock2/clockui/uilayer/clockalarmeditor/src/clockalarmeditorimpl.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/clockalarmeditor/src/clockalarmeditorimpl.cpp	Tue May 25 12:41:10 2010 +0300
@@ -45,13 +45,10 @@
 const TInt KZerothDay( 0 );
 const TInt KDaysInWeek( 7 );
 const TInt KFirstLine( 1 );
-const TInt KNextDayIndex( 1 );
 const TInt KRepeatOnceIndex( 0 );
-const TInt KWithIn24HoursIndex( 1 );
-const TInt KDailyIndex( 2 );
-const TInt KWorkdaysIndex( 3 );
-const TInt KWeeklyIndex( 4 );
-const TInt KCurrentDayIndex( 0 );
+const TInt KDailyIndex( 1 );
+const TInt KWorkdaysIndex( 2 );
+const TInt KWeeklyIndex( 3 );
 const TInt KMaxCharsInNote( 32 );
 const TInt KZerothRule( 0 );
 const TInt KOneMinuteInMicrosecond( 1000000 * 60 );
@@ -123,7 +120,7 @@
     // The Description is "Alarm" by default too.
     if( !iAlarmForEditing )
         {
-        iAlarmInfo.iRepeat = EAlarmRepeatDefintionRepeatNext24Hours;
+        iAlarmInfo.iRepeat = EAlarmRepeatDefintionRepeatOnce;
         
         // Here we have to load the default description.
         HBufC* defaultDescription = StringLoader::LoadLC( R_QTN_CLOCK_ALARM_EDITOR_DESC_DEFAULT, iCoeEnv );
@@ -188,8 +185,7 @@
         
     // We don't display the alarm day selection item for repeated alarms of type daily, next 24 hours and
     // workdays. So when this functions is called, we check for the type and update the form accordingly.
-    if( KWithIn24HoursIndex == iOccuranceIndex ||
-        KDailyIndex == iOccuranceIndex ||
+    if( KDailyIndex == iOccuranceIndex ||
         KWorkdaysIndex == iOccuranceIndex )
         {
         DeleteAlmDayCtrlL();
@@ -246,33 +242,23 @@
         case KRepeatOnceIndex:
             {
             iAlarmInfo.iRepeat = EAlarmRepeatDefintionRepeatOnce;
+            break;
             }
-            break;
-            
-        case KWithIn24HoursIndex:
-            {
-            iAlarmInfo.iRepeat = EAlarmRepeatDefintionRepeatNext24Hours;
-            }
-            break;
-            
         case KDailyIndex:
             {
             iAlarmInfo.iRepeat = EAlarmRepeatDefintionRepeatDaily;
-            }
             break;
-            
+            }        
+        case KWorkdaysIndex:
+            {
+            iAlarmInfo.iRepeat = EAlarmRepeatDefintionRepeatWorkday;
+            break;
+            }                        
         case KWeeklyIndex:
             {
             iAlarmInfo.iRepeat = EAlarmRepeatDefintionRepeatWeekly;
-            }
             break;
-            
-        case KWorkdaysIndex:
-            {
-            iAlarmInfo.iRepeat = EAlarmRepeatDefintionRepeatWorkday;
-            }
-            break;
-            
+            }        
         default:
 			{
 			// No implementation yet.
@@ -424,8 +410,7 @@
     
     // We don't display the alarm day selection item for repeated alarms of type daily, next 24 hours and
     // workdays. So when this functions is called, we check for the type and update the form accordingly.
-    if( KWithIn24HoursIndex == iOccuranceIndex ||
-        KDailyIndex == iOccuranceIndex ||
+    if( KDailyIndex == iOccuranceIndex ||
         KWorkdaysIndex == iOccuranceIndex )
         {
         DeleteAlmDayCtrlL();
@@ -543,11 +528,7 @@
     
     // Do not show Delete option when editing an alarm.
     // Do not show Discard changes option if its a new alarm.
-    if( iAlarmForEditing )
-        {
-        aMenuPane->SetItemDimmed( EClockAlarmDelete, ETrue );
-        }
-    else
+    if( !iAlarmForEditing )
         {
         aMenuPane->SetItemDimmed( EClockAlarmDiscardChanges, ETrue );
         }
@@ -655,12 +636,6 @@
             }
             break;
         
-        case KWithIn24HoursIndex:
-            {
-            iAlarmInfo.iRepeat = EAlarmRepeatDefintionRepeatNext24Hours;
-            }
-            break;
-        
         case KDailyIndex:
             {
             iAlarmInfo.iRepeat = EAlarmRepeatDefintionRepeatDaily;
@@ -691,8 +666,7 @@
     
     // We don't display the alarm day selection item for repeated alarms of type daily, next 24 hours and
     // workdays. So when this functions is called, we check for the type and update the form accordingly.
-    if( KWithIn24HoursIndex == iOccuranceIndex ||
-        KDailyIndex == iOccuranceIndex ||
+    if( KDailyIndex == iOccuranceIndex ||
         KWorkdaysIndex == iOccuranceIndex )
         {
         DeleteAlmDayCtrlL();
@@ -742,13 +716,6 @@
             iOccuranceIndex = KRepeatOnceIndex;
             }
             break;
-            
-        case EAlarmRepeatDefintionRepeatNext24Hours:
-            {
-            iOccuranceIndex = KWithIn24HoursIndex;
-            }
-            break;
-
         case EAlarmRepeatDefintionRepeatDaily:
             {
             iOccuranceIndex = KDailyIndex;
@@ -985,8 +952,8 @@
     // Get the current day of the week.
     TInt currentDay( aHomeTime.DayNoInWeek() );
         
-    if( ( EAlarmRepeatDefintionRepeatOnce == iOccuranceIndex ) ||
-        ( EAlarmRepeatDefintionRepeatWeekly == iOccuranceIndex ) )
+    if( ( KRepeatOnceIndex == iOccuranceIndex ) ||
+        ( KWeeklyIndex == iOccuranceIndex ) )
         {
         TInt dateOffset( KZerothDay );
 
@@ -1013,16 +980,6 @@
             }
         aTimeFromForm += TTimeIntervalDays( dateOffset );
         }
-    else if( EAlarmRepeatDefintionRepeatNext24Hours == iOccuranceIndex )  
-        {
-        TInt dayIndex( KCurrentDayIndex );
-        if( aTimeFromForm < aHomeTime )
-            {
-            dayIndex = KNextDayIndex;   
-            }
-        aTimeFromForm += TTimeIntervalDays( dayIndex );
-        }
-    
     __PRINTS( "CClockAlarmEditorImpl::GetActualAlarmTime - Exit" );
     }
 
@@ -1341,7 +1298,6 @@
     // Choose the appropriate Repeat type.
     switch( iAlarmInfo.iRepeat )
         {
-        case EAlarmRepeatDefintionRepeatNext24Hours:
         case EAlarmRepeatDefintionRepeatOnce:
             {
             if( oneDayDifference )
--- a/clock2/clockui/uilayer/clockmainview/inc/clockalarmarray.h	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/clockmainview/inc/clockalarmarray.h	Tue May 25 12:41:10 2010 +0300
@@ -126,6 +126,8 @@
         * @param aAlarmInfo The information of the alarm at aIndex in the list.
         */
         void GetInActiveAlarmInfo(TInt aIndex, TAlarmId& aAlarmId, SClkAlarmInfo& aAlarmInfo  ) const;
+
+        HBufC* NewAlarmText() const;
         
     private:            // New functions
         
--- a/clock2/clockui/uilayer/clockmainview/inc/clockmaincontainer.h	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/clockmainview/inc/clockmaincontainer.h	Tue May 25 12:41:10 2010 +0300
@@ -36,9 +36,10 @@
 class CAknDoubleStyleListBox;
 
 class CClockMarqueeLabel;
+class CAknButton;
 
 // Constants
-const TInt KZeroAlarms( 1 );
+const TInt KZeroAlarms( 0 );
 
 // Class declaration
 /**
@@ -47,7 +48,8 @@
 * @exe clock.exe
 */
 class CClockMainContainer : public CCoeControl,
-                            public MEikListBoxObserver
+                            public MEikListBoxObserver,
+                            public MCoeControlObserver
 	{
 	public:			// Constructor and destructor
 			
@@ -103,6 +105,8 @@
         * may be obtained by accessing the list box itself.
         */
         void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
+        
+        void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
     	
 	public:         // New functions
 	    
@@ -146,6 +150,16 @@
 		* @brief Reconstructs the marquee label and prepares it for marqueeing again.
 		*/
 		void ResetMarqueeLabelL();
+
+      /**
+        * @brief Calculates correct rect and sets if ro NewAlarmButton
+        */
+		void SetCorrectRectForNewAlarmButton();
+
+		/**
+        * @brief Switches clock type
+        */
+		void SwitchClockTypeL();
     	
    	private:    	// Functions from base classes
 
@@ -316,6 +330,10 @@
 		* @brief Holds the date.
 		*/
 		HBufC*									iDateString;
+		
+		CAknButton*   iNewAlarmButton;
+		
+		TTime                                   iPreviousClockTypeSwitch;
 
 	};
 
--- a/clock2/clockui/uilayer/clockmainview/inc/clockmainview.h	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/clockmainview/inc/clockmainview.h	Tue May 25 12:41:10 2010 +0300
@@ -121,7 +121,12 @@
         * @return CClockAppUi The pointer to the clock application ui.
         */
         CClockAppUi* ClockApplicationUi();
-	    
+
+        /**
+        * @brief Gives tactile feedback on user touch action
+        */        
+        void GiveVibes();
+
 	protected:     // From base classes
 	
 		/**
@@ -154,12 +159,23 @@
 		* @brief Displays the alarm editor for the user to set the alarm.
 		*/
         void SetNewAlarmL();
-        
+
+        /**
+        * @brief Deletes the selected alarm.
+        * @param aAlarmId the id of the alarm to be deleted
+        */
+        void RemoveAlarmL( TAlarmId aAlarmId  );        
+
 		/**
 		* @brief Deletes the selected alarm.
 		*/
         void RemoveAlarmL();
-        
+
+        /**
+         * @brief Remove the snooze on an expired alarm put on snooze
+         */
+        void RemoveSnoozeL();
+
 		/**
 		* @brief Activates the focused alarm item in the list.
 		*/
@@ -175,6 +191,11 @@
 		*/
         void ResetAlarmL();
         
+		/**
+        * @brief Switches clock type between analog and digital
+        */
+        void SwitchClockTypeL();     
+
         /**
          * @brief Checks if DST changes will be applied in the next 24 hours.
          * @return TBool ETrue if remaining time note has to be displayed.
--- a/clock2/clockui/uilayer/clockmainview/src/clockalarmarray.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/clockmainview/src/clockalarmarray.cpp	Tue May 25 12:41:10 2010 +0300
@@ -30,8 +30,7 @@
 
 // Constants
 const TInt KTimeStringLength( 25 );
-const TInt KFirstAlarmIndex( 1 );
-const TInt KNewAlarmIndex( 0 );
+const TInt KFirstAlarmIndex( 0 );
 
 // Literals
 _LIT( KFieldSeparator, "\t" );
@@ -151,35 +150,6 @@
 TPtrC16 CClockAlarmArray::MdcaPoint( TInt aIndex ) const
     {
 	__PRINTS( "CClockAlarmArray::MdcaPoint - Entry" );
-	
-    // Set "New Alarm" as the first index of the listitem.
-    if( KNewAlarmIndex == aIndex )
-        {
-        iListBoxEntry->Des().Zero();
-		
-		TPtr listEntryPtr = iListBoxEntry->Des();		      
-        
-        listEntryPtr.Append( KFieldSeparator );    
-           
-		//Single click integration
-        listEntryPtr.Append( iNewAlarmText->Des() );
-
-        listEntryPtr.Append( KFieldSeparator );
-        
-        
-        listEntryPtr.Append( KFieldSeparator );
-    
-        listEntryPtr.AppendNum( EBlankIconIndex );
-    
-        listEntryPtr.Append( KFieldSeparator );
-    
-        listEntryPtr.AppendNum( EBlankIconIndex );
-        
-        __PRINTS( "CClockAlarmArray::MdcaPoint - Exit" );
-        
-        return listEntryPtr;
-        }
-
     SClkAlarmInfo alarmInfo;
     TBuf< KTimeStringLength > timeString;
     TAlarmId alarmId;
@@ -258,13 +228,13 @@
             
         case EAlarmRepeatDefintionRepeatDaily:
             {
-            listEntryPtr.Append( ( *iOccuranceList )[ 2 ] );
+            listEntryPtr.Append( ( *iOccuranceList )[ 1 ] );
             }
             break;
             
         case EAlarmRepeatDefintionRepeatWorkday:
             {
-            listEntryPtr.Append( ( *iOccuranceList )[ 3 ]);
+            listEntryPtr.Append( ( *iOccuranceList )[ 2 ]);
             }
             break;
             
@@ -491,8 +461,6 @@
     // Get the ids from alarmserver.
     iAlarmModel->GetClkAlarmIds( iAlarmIdArray );
     
-    // Add a dummy index for "New Alarm" Option as first item in the Id array.
-    iAlarmIdArray.Insert( KNewAlarmIndex, KNewAlarmIndex );
     
     SClkAlarmInfo alarmInfo;      
     TInt alarmCount( iAlarmIdArray.Count() );
@@ -548,7 +516,7 @@
     TInt enabledAlarmCount( GetEnabledAlarmCount() );
         
     // If info of an active alarm is needed.       
-    if( aIndex <= enabledAlarmCount )
+    if( aIndex < enabledAlarmCount )
     	{
     	GetActiveAlarmInfo( aIndex, aAlarmId , aAlarmInfo );
     	}
@@ -612,21 +580,22 @@
     iAlarmModel->GetClkAlarmIds( alarmIdArray );
     
     TInt alarmIdCount( alarmIdArray.Count() );
-    TInt alarmIndex( NULL );
+    TInt alarmIndex( 0 );
         
-	for( TInt index( NULL ); index < alarmIdCount; index++ )
+	for( TInt index( 0 ); index < alarmIdCount; index++ )
 	    {
 	    // Get information of each alarm.
 	    SClkAlarmInfo alarmInfo;
 	    TInt errorValue( iAlarmModel->ClockAlarmInfo( alarmIdArray[ index ], alarmInfo ) );
 	    
-	    if( ( KErrNone == errorValue ) &&
+	    if(  !( ( KErrNone == errorValue ) &&
 	        ( EAlarmStateInPreparation != alarmInfo.iState &&
 	          EAlarmStateNotified != alarmInfo.iState &&
-	          EAlarmStatusEnabled == alarmInfo.iStatus ) )
+	          EAlarmStatusEnabled == alarmInfo.iStatus ) ) )
 	        {
-	        alarmIndex++;
+	        continue;
 	        }
+	    
 	    if( aIndex == alarmIndex )
 	        {
 	        // We have a match, return the values.
@@ -637,8 +606,9 @@
 	        // Break the loop.
 	        return;
 	        }
-	     }
-   	  }
+	    alarmIndex++;
+	    }
+   	}
     
 // ---------------------------------------------------------
 // CClockAlarmArray::GetInActiveAlarmInfo
@@ -655,19 +625,19 @@
 	
     // Get the alarms which are enabled and active.
     TInt enabledAlarmCount = GetEnabledAlarmCount();
-
-    for( TInt index( NULL ); index < alarmIdCount; index++ )
+    
+    for( TInt index( 0 ); index < alarmIdCount; index++ )
         {
         // Get information of each alarm.
         SClkAlarmInfo alarmInfo;
         TInt errorValue( iAlarmModel->ClockAlarmInfo( alarmIdArray[ index ], alarmInfo ) );
 
-        if( ( KErrNone == errorValue ) &&
+        if( !( ( KErrNone == errorValue ) &&
             ( EAlarmStateInPreparation != alarmInfo.iState &&
               EAlarmStateNotified != alarmInfo.iState &&
-              EAlarmStatusEnabled != alarmInfo.iStatus ) )
+              EAlarmStatusEnabled != alarmInfo.iStatus ) ) )
             {
-            alarmIndex++;
+            continue;
             }
         // Disabled alarms are always indexed after the enabled alarms.
         if( ( enabledAlarmCount + alarmIndex ) == aIndex )
@@ -679,6 +649,7 @@
             // Break the loop.
             return;
             }
+        alarmIndex++;
         }
    	 }
     
@@ -758,4 +729,8 @@
     return returnValue;
     }
 
+HBufC* CClockAlarmArray::NewAlarmText() const
+        {
+        return iNewAlarmText;
+        }
 // End of file
--- a/clock2/clockui/uilayer/clockmainview/src/clockmaincontainer.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/clockmainview/src/clockmaincontainer.cpp	Tue May 25 12:41:10 2010 +0300
@@ -38,6 +38,7 @@
 #include <tzlocalizer.h>
 #include <tzlocalizationdatatypes.h>
 #include <vtzrules.h>
+#include <aknbutton.h>
 
 // User includes
 #include "clockmaincontainer.h"
@@ -68,6 +69,8 @@
     R_QTN_WEEK_LONG_SUNDAY
     };
 
+TInt const KSwitchDelay = 200*1000;
+
 // Literals
 _LIT( KIconFileName, "\\resource\\apps\\clockapp.mif" );
 _LIT( KPlusGMT, " \x202A+" );
@@ -155,7 +158,9 @@
 	    delete iTimeZoneString;
 	    iTimeZoneString = NULL;
 	    }
-		
+
+	delete iNewAlarmButton;
+	iNewAlarmButton = NULL;
 	__PRINTS( "CClockMainContainer::~CClockMainContainer - Exit" );
     }
 
@@ -189,12 +194,78 @@
         if( EKeyUpArrow == aKeyEvent.iCode ||
             EKeyDownArrow == aKeyEvent.iCode )
             {
-            if( iListBox )
+
+            TInt itemCount = iListBox->Model()->ItemTextArray()->MdcaCount();
+            // if neither has focus just then select button to be focused
+            if( !iNewAlarmButton->IsFocused() && !iListBox->IsFocused() )
+                {
+                iListBox->View()->ItemDrawer()->SetFlags( CListItemDrawer::EDisableHighlight );
+                iNewAlarmButton->SetFocus( ETrue );
+                DrawDeferred();
+                retVal = EKeyWasConsumed;
+                }
+            // button not focused and no list items -> set focus to button
+            else if( itemCount == 0 && !iNewAlarmButton->IsFocused() )
+                {
+                iListBox->View()->ItemDrawer()->SetFlags( CListItemDrawer::EDisableHighlight );
+                iListBox->SetFocus( EFalse );
+                iNewAlarmButton->SetFocus( ETrue );
+                DrawDeferred();
+                retVal = EKeyWasConsumed;
+                }
+            // button focused and listbox has items
+            else if( iNewAlarmButton->IsFocused() && itemCount > 0 )
                 {
-    
-                    
+                iListBox->View()->ItemDrawer()->ClearFlags( CListItemDrawer::EDisableHighlight );
+                iNewAlarmButton->SetFocus( EFalse );
+                iListBox->SetFocus( ETrue );
+                if( EKeyDownArrow == aKeyEvent.iCode )
+                    {
+                    iListBox->SetCurrentItemIndex( itemCount - 1 );
+                    }
+                else
+                    {
+                    iListBox->SetCurrentItemIndex( 0 );
+                    }
+                retVal = iListBox->OfferKeyEventL( aKeyEvent, aType );
+                }
+            // listbox focused
+            else if( iListBox->IsFocused() && itemCount > 0 )
+                {
+                // first item when only one item in the list
+                if( iListBox->CurrentItemIndex() == 0 && itemCount == 1 )
+                    {
+                    iListBox->View()->ItemDrawer()->SetFlags( CListItemDrawer::EDisableHighlight );
+                    iListBox->SetFocus( EFalse );
+                    iNewAlarmButton->SetFocus( ETrue );
+                    DrawDeferred();
+                    retVal = EKeyWasConsumed;
+                    }
+                // first item
+                else if( iListBox->CurrentItemIndex() == 0 && EKeyUpArrow == aKeyEvent.iCode )
+                    {
+                    iListBox->View()->ItemDrawer()->SetFlags( CListItemDrawer::EDisableHighlight );
+                    iListBox->SetFocus( EFalse );
+                    iNewAlarmButton->SetFocus( ETrue );
+                    DrawDeferred();
+                    retVal = EKeyWasConsumed;
+                    }
+                //last item
+                else if( iListBox->CurrentItemIndex() == ( itemCount - 1 )
+                        && EKeyDownArrow == aKeyEvent.iCode )
+                    {
+                    iListBox->View()->ItemDrawer()->SetFlags( CListItemDrawer::EDisableHighlight );
+                    iListBox->SetFocus( EFalse);
+                    iNewAlarmButton->SetFocus( ETrue );
+                    DrawDeferred();
+                    retVal = EKeyWasConsumed;
+                    }
                 // Send the event to the listbox to handle the event.
-                retVal = iListBox->OfferKeyEventL( aKeyEvent, aType );
+                else
+                    {
+                    iListBox->View()->ItemDrawer()->ClearFlags( CListItemDrawer::EDisableHighlight );
+                    retVal = iListBox->OfferKeyEventL( aKeyEvent, aType );
+                    }
                 }
             }
 
@@ -203,7 +274,7 @@
             {
             // Handle backspace command. Deletes the selected alarm.
 			//Single click integration
-            if ( iView->MenuBar()->ItemSpecificCommandsEnabled() )
+            if ( iListBox->IsFocused() && iView->MenuBar()->ItemSpecificCommandsEnabled() )
                 {
                 // if highlighted
                 iView->HandleCommandL( EClockRemoveAlarm );
@@ -215,8 +286,27 @@
 		//Single click integration
         if ( aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter )
             {
-            // Send the event to the listbox to handle the event.
-            iListBox->OfferKeyEventL( aKeyEvent, aType );
+            // Send the event to the listbox to handle the event
+            // if listbox is focused
+            if( iListBox->IsFocused() && iListBox->Model()->ItemTextArray()->MdcaCount() > 0 )
+                {
+                iListBox->OfferKeyEventL( aKeyEvent, aType );
+                retVal = EKeyWasConsumed;
+                }
+            else
+                {
+                // default action for the enter is button press
+                TKeyEvent keyEvent;
+                keyEvent.iCode = EKeyOK;  
+                keyEvent.iScanCode = EStdKeyDevice3;
+                keyEvent.iModifiers = 0;
+                keyEvent.iRepeats = 0;
+                iNewAlarmButton->OfferKeyEventL( keyEvent, EEventKeyDown );
+                iNewAlarmButton->OfferKeyEventL( keyEvent, EEventKey );
+                iNewAlarmButton->OfferKeyEventL( keyEvent, EEventKeyUp );
+                retVal = EKeyWasConsumed;
+                
+                }
             }
 
         }
@@ -280,11 +370,6 @@
     {
 	__PRINTS( "CClockMainContainer::FocusChanged - Entry" );
 	
-    if( iListBox )
-        {
-        iListBox->SetFocus( IsFocused() );
-        }
-		
 	__PRINTS( "CClockMainContainer::FocusChanged - Exit" );
     }
 
@@ -304,10 +389,28 @@
 		
         return;
         }
-
-    // Let the listbox handle the event.
-    iListBox->HandlePointerEventL( aPointerEvent );
-		
+    
+    // to get the vibes let's handle skinnable clock as a special case
+    // no need to to delegate pointer events to it
+    if( iSkinnableClock && iSkinnableClock->Rect().Contains( aPointerEvent.iPosition ) )
+        {
+        if( aPointerEvent.iType == TPointerEvent::EButton1Down  )
+            {
+            TTime now;
+            now.HomeTime();
+            TInt64 launchFreq = now.MicroSecondsFrom( iPreviousClockTypeSwitch ).Int64();
+            if( launchFreq > MAKE_TINT64( 0, KSwitchDelay )  )
+                {
+                iView->GiveVibes();
+                iView->HandleCommandL( EClockSwitchClockType ); 
+                iPreviousClockTypeSwitch.HomeTime();
+                }   
+            }
+        } 
+    else
+        {
+        CCoeControl::HandlePointerEventL( aPointerEvent );
+        }
 	__PRINTS( "CClockMainContainer::HandlePointerEventL - Exit" );
     }
 
@@ -319,42 +422,15 @@
 void CClockMainContainer::HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType )
     {
     __PRINTS( "CClockMainContainer::HandleListBoxEventL - Entry" );
-
     if( aListBox == iListBox &&
-        aEventType == EEventItemSingleClicked )
+        ( aEventType == EEventItemSingleClicked || aEventType == EEventEnterKeyPressed ) )
         {
         // Check if the user has double clicked on the list item.
         if( !iView->IsAlarmEditorOpen() )
             {
-            // If the user has selected the first item, launch alarm editor.
-            if( KErrNone == aListBox->CurrentItemIndex() )
-                {
-                iView->HandleCommandL( EClockNewAlarm );
-                }
-            else
-                {
-				//Single click integration
-                iView->HandleCommandL( EClockResetAlarm ); 
-
-                }
+            iView->HandleCommandL( EClockResetAlarm ); 
             }
         }
-	//Single click integration
-    else if ( aListBox == iListBox && aEventType == EEventEnterKeyPressed )
-        {
-        if( !iView->IsAlarmEditorOpen() )
-            {
-            if ( iListBox->CurrentItemIndex() == 0 ) 
-                {
-                iView->HandleCommandL( EClockNewAlarm );
-                }
-            else 
-                {
-                iView->HandleCommandL( EClockResetAlarm ); 
-                }
-            }
-        }
-
     
     __PRINTS( "CClockMainContainer::HandleListBoxEventL - Entry" );
     }
@@ -378,7 +454,8 @@
     // Update the listbox.
     iListBox->ScrollToMakeItemVisible( itemIndex );
     iListBox->SetCurrentItemIndexAndDraw( itemIndex );
-	
+    SetCorrectRectForNewAlarmButton();
+    iNewAlarmButton->DrawDeferred();
 	__PRINTS( "CClockMainContainer::UpdateAlarmListL - Exit" );
     }
 
@@ -393,27 +470,34 @@
 	
     // Reinitialize the alarm list.
     iAlarmArray->InitIdList();
+    TInt count = iListBox->Model()->ItemTextArray()->MdcaCount();
     
-    if( ( KZeroAlarms <= aIndex ) &&
-        ( aIndex == iListBox->Model()->ItemTextArray()->MdcaCount() ) )
+    //SetCorrectRectForNewAlarmButton();
+    
+    // if only one item
+    if( ( KZeroAlarms == aIndex ) && ( aIndex == count ) )
+        {
+        iListBox->SetCurrentItemIndex( KZeroAlarms );
+        SetCorrectRectForNewAlarmButton();
+        }  
+    // last item when more than one exists
+    else if( ( KZeroAlarms < aIndex ) && ( aIndex == count ) )
         {
         // Last alarm in the list is deleted hence set the previous alarm.
         iListBox->ScrollToMakeItemVisible( aIndex - 1 );
         iListBox->SetCurrentItemIndexAndDraw( aIndex - 1 );
-        
-        
+        iListBox->HandleItemRemovalL();
+        DrawNow();
         }
-    else if( ( KZeroAlarms <= aIndex ) &&
-             ( KZeroAlarms < iListBox->Model()->ItemTextArray()->MdcaCount() ) )
+    // not last item
+    else if( ( KZeroAlarms <= aIndex ) && ( aIndex < count ) )
         {
         // Highlight the alarm item replacing the deleted element
         iListBox->ScrollToMakeItemVisible( aIndex );
         iListBox->SetCurrentItemIndexAndDraw( aIndex );
+        iListBox->HandleItemRemovalL();
+        DrawNow();
         }
-    
-    // Update the listbox.
-    iListBox->HandleItemRemovalL();
-    DrawNow();
 	
 	__PRINTS( "CClockMainContainer::RemoveAlarmL - Exit" );
     }
@@ -768,6 +852,8 @@
                                   AknLayoutScalable_Apps::popup_clock_analogue_window_cp03( KVGAPortraitVariant ).LayoutLine() );
         }
     
+    SetCorrectRectForNewAlarmButton();
+    
     // Update the skinnable clock.
     iSkinnableClock->SetExtent( skinClockRect.Rect().iTl, skinClockRect.Rect().Size() );
     iSkinnableClock->UpdateDisplay();
@@ -789,7 +875,7 @@
 	
 	__PRINTS( "CClockMainContainer::CountComponentControls - Exit" );
 	
-    return 2;
+    return 3;
     }
 
 // ---------------------------------------------------------
@@ -813,6 +899,14 @@
             
         case 1:
             {
+            __PRINTS( "CClockMainContainer::ComponentControl - Exit" );
+            
+            // Return the new alarm button.
+            return iNewAlarmButton;
+            }            
+            
+        case 2:
+            {
 			__PRINTS( "CClockMainContainer::ComponentControl - Exit" );
 			
             // Return the listbox.
@@ -863,6 +957,13 @@
         {
         iSkinnableClock->HandleResourceChange( aType );
         }
+
+    // Allow the listbox to handle the resource change.
+    if( iNewAlarmButton )
+        {
+        iNewAlarmButton->HandleResourceChange( aType );
+        }
+
     // Allow the listbox to handle the resource change.
     if( iListBox )
         {
@@ -1202,7 +1303,21 @@
 	
     // Cleanup.
 	CleanupStack::Pop( iconArray );
-	
+
+    // construct the "New Alarm" button
+    iNewAlarmButton = CAknButton::NewL( NULL, NULL, NULL, NULL,
+            iAlarmArray->NewAlarmText()->Des(),iAlarmArray->NewAlarmText()->Des(), 0, 0 );
+    iNewAlarmButton->SetParent( this );
+    iNewAlarmButton->SetContainerWindowL( *this );
+    //TAknLayoutRect newAlarmButtonRect;
+    // Get the skinnable clock rect.
+    //newAlarmButtonRect.LayoutRect( listRect.Rect(),
+    //        AknLayoutScalable_Apps::main_clock2_btn_pane( layoutOrientation  ).LayoutLine() );
+    
+    //iNewAlarmButton->SetRect( newAlarmButtonRect.Rect() );
+    SetCorrectRectForNewAlarmButton();
+    iNewAlarmButton->SetObserver( this );
+    iNewAlarmButton->ActivateL();
     // Add the icon for DST indicator.
     AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(),
                                  KAknsIIDQgnIndiDstAdd,
@@ -1479,4 +1594,80 @@
         return timeUpdateOn;
 }
 
+void CClockMainContainer::HandleControlEventL( CCoeControl* aControl,
+            TCoeEvent aEventType )
+    {
+    if ( aControl == iNewAlarmButton && aEventType == MCoeControlObserver::EEventStateChanged )
+        {
+        iView->HandleCommandL( EClockNewAlarm );
+        }
+    }
+
+void CClockMainContainer::SetCorrectRectForNewAlarmButton()
+    {
+    if( iNewAlarmButton )
+        {
+        TRect paneRect = this->Rect();
+        TAknLayoutRect newAlarmButtonRect;
+        TAknLayoutRect mainRect;
+        TInt displayOrientation( Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0 );
+        // Get the layout for the main rect.
+        mainRect.LayoutRect( paneRect,
+                AknLayoutScalable_Apps::main_clock2_pane().LayoutLine() );
+        if( displayOrientation )
+            {
+            // landscape
+            TInt alarmCount( 0 );
+            if( iListBox )
+                {
+                alarmCount = iListBox->Model()->ItemTextArray()->MdcaCount();
+                }
+            if( alarmCount > 0 )
+                {
+            if( iListBox )
+                {
+                iListBox->MakeVisible( ETrue );
+                }
+                // landscape if not empty alarm list
+                newAlarmButtonRect.LayoutRect( mainRect.Rect(),
+                        AknLayoutScalable_Apps::main_clock2_btn_pane( displayOrientation ).LayoutLine() );
+                }
+            else
+                {
+                // landscape if empty alarm list
+                if( iListBox )
+                    {
+                    iListBox->MakeVisible( EFalse );
+                    }
+                newAlarmButtonRect.LayoutRect( mainRect.Rect(),
+                        AknLayoutScalable_Apps::main_clock2_btn_pane_cp01( displayOrientation ).LayoutLine() );
+                }
+            }
+        else
+            {
+            // portrait
+            if( iListBox )
+                {
+                iListBox->MakeVisible( ETrue );
+                }
+            newAlarmButtonRect.LayoutRect( mainRect.Rect(),
+                    AknLayoutScalable_Apps::main_clock2_btn_pane( displayOrientation ).LayoutLine() );
+            }
+        iNewAlarmButton->SetRect( newAlarmButtonRect.Rect() );
+        }
+
+    }
+
+void CClockMainContainer::SwitchClockTypeL()
+    {
+    TRect skinClockRect = iSkinnableClock->Rect();
+    delete iSkinnableClock;
+    iSkinnableClock = NULL;
+    // Construct the skinnable clock.
+    iSkinnableClock = CAknSkinnableClock::NewL( this, ETrue, EFalse );
+    // Set the size of the clock.
+    iSkinnableClock->SetExtent( skinClockRect.iTl, skinClockRect.Size() );
+    iSkinnableClock->ActivateL();
+    iSkinnableClock->DrawDeferred();
+    }
 // End of file
--- a/clock2/clockui/uilayer/clockmainview/src/clockmainview.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/clockmainview/src/clockmainview.cpp	Tue May 25 12:41:10 2010 +0300
@@ -26,6 +26,7 @@
 #include <vtzrules.h>
 #include <clockalarmeditor.h>
 #include <hlplch.h>
+#include <touchfeedback.h>
 
 // User includes
 #include "clockmainview.h"
@@ -228,6 +229,73 @@
     }
 
 // ---------------------------------------------------------
+//papercut clock2 Remove_Snooze Start - rajender
+// CClockMainView::RemoveSnoozeL
+// rest of the details are commented in the header
+// ---------------------------------------------------------
+//
+void CClockMainView::RemoveSnoozeL()
+    {  
+    __PRINTS( "CClockMainView::RemoveSnoozeL - Entry" );       
+    // First get the index of the selected item in the list.
+    TInt itemIndex( iContainer->ListBox()->CurrentItemIndex() );
+    
+    if( KErrNone > itemIndex )
+        {
+        __PRINTS( "CClockMainView::RemoveSnoozeL - Exit" );
+        return;
+        }
+
+        SClkAlarmInfo alarmInfo;
+        TAlarmId alarmId;
+        // Get the alarm id from alarm model.
+        iAlarmArray->GetSortedAlmIdInfo( itemIndex, alarmId, alarmInfo );
+        
+        // Delete the alarm.
+        User::LeaveIfError( iAlarmModel->AlarmRemoveSnooze( alarmId ) );
+                
+        // Update the container.
+        iContainer->ListBox()->HandleItemAdditionL();
+        
+        // Display the confirmation note to the user about alarm deletion.
+        //CAknConfirmationNote* confNote = new( ELeave ) CAknConfirmationNote;
+        //HBufC* confNoteText = StringLoader::LoadLC( R_QTN_CLOCK_SNOOZE_NOTE_REMOVED, iCoeEnv );
+        // Display the note.
+        //confNote->ExecuteLD( *confNoteText );
+        // Cleanup.
+        //CleanupStack::PopAndDestroy( confNoteText );
+        
+        __PRINTS( "CClockMainView::RemoveSnoozeL - Exit" );        
+        
+    }
+
+// ---------------------------------------------------------
+// CClockMainView::RemoveAlarmL
+// rest of the details are commented in the header
+// ---------------------------------------------------------
+//
+void CClockMainView::RemoveAlarmL( TAlarmId aAlarmId )
+    {
+    __PRINTS( "CClockMainView::RemoveAlarmL - Entry" );
+    
+    // First get the index of the selected item in the list.
+    TInt itemIndex( iAlarmArray->ListBoxIndex( aAlarmId ) );
+    
+    if( KErrNone > itemIndex )
+        {
+        __PRINTS( "CClockMainView::RemoveAlarmL - Exit" );
+        
+        return;
+        }
+        // Delete the alarm.
+        User::LeaveIfError( iAlarmModel->DeleteClockAlarm( aAlarmId ) );
+        // Update the container.
+        iContainer->RemoveAlarmL( itemIndex );
+        
+    __PRINTS( "CClockMainView::RemoveAlarmL - Exit" );
+    }
+
+// ---------------------------------------------------------
 // CClockMainView::RemoveAlarmL
 // rest of the details are commented in the header
 // ---------------------------------------------------------
@@ -239,7 +307,7 @@
     // First get the index of the selected item in the list.
     TInt itemIndex( iContainer->ListBox()->CurrentItemIndex() );
     
-    if( KErrNone >= itemIndex )
+    if( KErrNone > itemIndex )
         {
 		__PRINTS( "CClockMainView::RemoveAlarmL - Exit" );
 		
@@ -254,15 +322,6 @@
         
         // Delete the alarm.
         User::LeaveIfError( iAlarmModel->DeleteClockAlarm( alarmId ) );
-        
-        // Display the confirmation note to the user about alarm deletion.
-        CAknConfirmationNote* confNote = new( ELeave ) CAknConfirmationNote;
-        HBufC* confNoteText = StringLoader::LoadLC( R_QTN_CLOCK_ALARM_NOTE_DELETED, iCoeEnv );
-        // Display the note.
-        confNote->ExecuteLD( *confNoteText );
-        // Cleanup.
-        CleanupStack::PopAndDestroy( confNoteText );
-        
         // Update the container.
         iContainer->RemoveAlarmL( itemIndex );
         
@@ -365,7 +424,25 @@
 	
 	 // Show the navigation pane again.
     appUi->MakeNavigationPaneVisible( ETrue, EClockAppMainViewId );
+
+    if(  EClockAlarmDelete == iAlarmId )
+        {
+        // Mark the alarm editor as closed.
+        iAlarmEditorOpen = EFalse;
     
+        if( alarmEditor )
+            {
+            delete alarmEditor;
+            alarmEditor = NULL;
+            }
+        __PRINTS( "CClockMainView::ResetAlarmL:EClockAlarmDelete - Exit" ); 
+        
+        // do the removing of the alarm
+        RemoveAlarmL( alarmId );
+        
+        return;
+        }    
+
     if( EClockAlarmExit == iAlarmId )
         {		
         // Mark the alarm editor as closed.
@@ -555,7 +632,15 @@
     clockAppUi->MakeNavigationPaneVisible( ETrue, EClockAppMainViewId );
     
     // Activate the container.
-    iContainer->ActivateL();
+    if( clockAppUi->TransitionOngoing() )
+        {
+        //clockAppUi->DoAppearTransition( iContainer );
+        iContainer->ActivateL();
+        }
+    else
+        {
+        iContainer->ActivateL();
+        }
     
 	__PRINTS( "CClockMainView::DoActivateL - Exit" );
     }
@@ -575,7 +660,11 @@
 	
 	if( iContainer )
 		{
-	
+	    CClockAppUi* clockAppUi( static_cast< CClockAppUi* > ( AppUi() ) );
+        if( clockAppUi->TransitionOngoing() )
+            {
+            //clockAppUi->DoDisappearTransition( iContainer );
+            }
 		// First remove the container from the control stack
 		( AppUi() )->RemoveFromStack( iContainer );
 		// And then destroy it.
@@ -600,14 +689,7 @@
 		//Single click integration
 	    case EClockSelect:
 		    {
-		    if ( iContainer->ListBox()->CurrentItemIndex() == 0 )
-		        {
-		        SetNewAlarmL(); 
-		        }
-		    else
-		        {
-		        ResetAlarmL(); 
-		        } 
+		    ResetAlarmL();
 		    }
 		    break; 
 
@@ -645,7 +727,18 @@
 		    RemoveAlarmL();
 		    }
 		    break;
-		    
+		case EClockRemoveSnooze:
+		    {
+		    // Remove snooze on the selected alarm
+		    RemoveSnoozeL();
+		    }
+		    break;
+	      case EClockSwitchClockType:
+            {
+            // Switches clock type
+            SwitchClockTypeL();
+            }
+            break;
 		case EClockSettings:
 		    {
 		    // Let the appui handle the command.
@@ -705,7 +798,14 @@
         if( KErrNotFound == currentlyFocussedItem ) 
             {
             TInt itemCount = iContainer->ListBox()->Model()->ItemTextArray()->MdcaCount();
-        	iContainer->ListBox()->SetCurrentItemIndexAndDraw( itemCount -1 );
+			if( itemCount > 0 )
+                {
+                iContainer->ListBox()->SetCurrentItemIndexAndDraw( itemCount -1 );
+                }
+            else
+                {
+                iContainer->ListBox()->SetCurrentItemIndexAndDraw( KZeroAlarms );
+                }
         	
         	
             }    
@@ -741,16 +841,17 @@
 
 	
     TInt alarmCount = iAlarmArray->MdcaCount();
+    TBool deleteRemoveSnooze( EFalse );
 
-    // There are no alarms set or the current focussed listitem is "New Alarm" then remove alarm specific options 
-    if( KZeroAlarms >= alarmCount || ( KErrNone == iContainer->ListBox()->CurrentItemIndex() ) )
+    // There are no alarms set 
+    if( KZeroAlarms >= alarmCount )
         {
         // There are no alarms set. Remove the irrelevant options from the menu.
-        aMenuPane->DeleteMenuItem( EClockNewAlarm );
         aMenuPane->DeleteMenuItem( EClockResetAlarm );
         aMenuPane->DeleteMenuItem( EClockRemoveAlarm );
         aMenuPane->DeleteMenuItem( EClockActivateAlarm );           
         aMenuPane->DeleteMenuItem( EClockDeactivateAlarm );                                 
+        deleteRemoveSnooze = ETrue;
         }
     else
         {
@@ -773,16 +874,26 @@
                 {
                 // Alarm is not recurring. Remove the deactivate option from the menu.
                 aMenuPane->DeleteMenuItem( EClockDeactivateAlarm ); 
+                // no snooze removing needed for not recurring
+                deleteRemoveSnooze = ETrue;
+                }
+            // if the alarm is not snoozed, Remove the 'Remove snooze' option
+            if (alarmInfo.iState != EAlarmStateSnoozed )
+                {
+                deleteRemoveSnooze = ETrue;
                 }
             }
         else        
             {
             // Alarm is already inactive. Remove the deactivate option from the menu. 
             aMenuPane->DeleteMenuItem( EClockDeactivateAlarm );
+            deleteRemoveSnooze = ETrue;
             }
         }
-
-   
+       if( deleteRemoveSnooze )
+           {
+           aMenuPane->DeleteMenuItem( EClockRemoveSnooze );
+           }
 		
 	__PRINTS( "CClockMainView::DynInitMenuPaneL - Exit" );
     }
@@ -1231,4 +1342,27 @@
     return returnValue;
     }
 
+void CClockMainView::GiveVibes()
+    {
+    CClockAppUi* clockAppUi( static_cast< CClockAppUi* > ( AppUi() ) );
+    if ( clockAppUi->GetFeedback() &&
+            clockAppUi->GetFeedback()->TouchFeedbackSupported() )
+        {
+        clockAppUi->GetFeedback()->InstantFeedback( ETouchFeedbackBasic );
+        }    
+    }
+
+void CClockMainView::SwitchClockTypeL()
+    {
+    TLocale phoneLocale;
+    // Set the new clock format with the locale.
+    phoneLocale.SetClockFormat( ( EClockAnalog == phoneLocale.ClockFormat() )
+            ? EClockDigital : EClockAnalog );
+    phoneLocale.Set();
+    if( iContainer )
+        {
+        iContainer->SwitchClockTypeL();
+        }
+    }
+
 // End of file
--- a/clock2/clockui/uilayer/clockworldview/src/clockworldview.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/clockworldview/src/clockworldview.cpp	Tue May 25 12:41:10 2010 +0300
@@ -592,7 +592,15 @@
         }
 
     // Activate the container.
-    iContainer->ActivateL();
+    if( ClockApplicationUi()->TransitionOngoing() )
+        {
+        //ClockApplicationUi()->DoAppearTransition( iContainer );
+        iContainer->ActivateL();
+        }
+    else
+        {
+        iContainer->ActivateL();
+        }
     iContainer->SetRect( ClientRect() );
     
     
@@ -937,7 +945,6 @@
         return;
         }
         
-	HBufC* queryText( NULL );
     TInt currentListItem( iContainer->ListBox()->CurrentItemIndex() );
     
     // Get information about the city selected.
--- a/clock2/clockui/uilayer/data/clock.rss	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/data/clock.rss	Tue May 25 12:41:10 2010 +0300
@@ -128,6 +128,12 @@
             txt = qtn_clk_activate_alarm;
             flags = EEikMenuItemSpecific; 
             },
+        MENU_ITEM
+            {
+            command = EClockRemoveSnooze;
+            txt = qtn_clk_remove_snooze;
+            flags = EEikMenuItemSpecific;             
+            },
         MENU_ITEM 
             { 
             command = EClockRemoveAlarm;
@@ -590,5 +596,15 @@
 #include "clkdatetimeview.ra"
 #include "clockalarmeditor.ra"
 #include "clockcityselectionlist.ra"
+// Resource definitions
+// ---------------------------------------------------------
+// r_qtn_clock_alarm_note_deleted
+// Resource for string "Alarm deleted from Alarm view"
+// ---------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_clock_snooze_note_removed
+    {
+    buf = qtn_clk_snooze_note_removed;
+    }
 
 // End of file
--- a/clock2/clockui/uilayer/group/clock.mmp	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/group/clock.mmp	Tue May 25 12:41:10 2010 +0300
@@ -164,7 +164,9 @@
 LIBRARY				hlplch.lib
 LIBRARY				iaupdateapi.lib
 LIBRARY				featmgr.lib
-
-LIBRARY           thumbnailmanager.lib
+LIBRARY             		gfxtrans.lib // effect manager
+LIBRARY             		thumbnailmanager.lib
+LIBRARY       			ws32.lib
+LIBRARY             		touchfeedback.lib
 
 // End of file
--- a/clock2/clockui/uilayer/inc/clock.hrh	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/inc/clock.hrh	Tue May 25 12:41:10 2010 +0300
@@ -29,8 +29,11 @@
 	EClockSettings,
 	EClockMainViewHelp,
 	EClockMainViewExit,
+	EClockSwitchClockType,
 //single click integration
-    	EClockSelect
+    	EClockSelect,
+//remove snooze
+    	EClockRemoveSnooze
 	};
 
 /** Menu item command ids for world view */
--- a/clock2/clockui/uilayer/inc/clockappui.h	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/inc/clockappui.h	Tue May 25 12:41:10 2010 +0300
@@ -36,6 +36,8 @@
 class CAknNavigationDecorator;
 class CIAUpdate;
 class CIAUpdateParameters;
+class CTransitionEffectManager;
+class MTouchFeedback;
 
 // Class declaration
 /**
@@ -47,6 +49,16 @@
                     public MAknTabObserver,
                     public MIAUpdateObserver
 	{
+    
+    public: // enums
+    
+        enum TTransitionDirection 
+            {
+            ETransitionUndefined = 0,
+            ETransitionLeft,
+            ETransitionRight
+            };    
+    
 	public:            // Constructor and destructor
 
 		/**
@@ -145,6 +157,23 @@
         */
         TBool IsAppExitHidden();
         
+        TBool TransitionOngoing() const;
+        
+        void SetTransitionOngoing( TBool aTransitionOngoing );
+        
+        TInt TransitionGroupId() const;
+        
+        void SetTransitionGroupId( TInt aId ); 
+        
+        TTransitionDirection TransitionDirection() const;
+        
+        void  SetTransitionDirection( TTransitionDirection aId );  
+        
+        void DoDisappearTransition( CCoeControl* aControl );
+        
+        void DoAppearTransition( CCoeControl* aControl );
+        
+        
         /**
         * @brief Hides or Un-hides the navigation pane.
         * @param aVisible ETrue, pane will be visible. EFalse will be hidden.
@@ -156,6 +185,14 @@
         * @brief Handles IAD related updates.
         */
         void HandleIADUpdateL();
+
+        
+        //papercut Ana/Digital No24Rpeat Start- rajender
+		/**
+        * @brief returns handle to tactile feedback.
+        */
+        MTouchFeedback* GetFeedback();
+		//papercut Ana/Digital No24Rpeat End- rajender
 		
 	private:           // New functions
 	
@@ -237,6 +274,13 @@
         * @brief Object of CIAUpdateParameters class.
         */
         CIAUpdateParameters*                iParameters;
+        
+        TBool iTransitionOngoing;
+        TInt  iTransitionGroupId;
+        TBool   iTactileFeedbackSupported;
+        TTransitionDirection iTransitionDirection;
+        
+        MTouchFeedback*  iFeedback;
 	};
 
 #endif 		// __CLOCK_APPUI_H__
--- a/clock2/clockui/uilayer/loc/clockapp.loc	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/loc/clockapp.loc	Tue May 25 12:41:10 2010 +0300
@@ -340,5 +340,17 @@
 //r: 5.1
 //
 #define qtn_clk_note_location_max               "Unable to add more.Remove some locations."     
+//d: Used in Alarm Clock view. Used in confirmation note of deleting a snooze.
+//l: popup_note_window
+//w:
+//r: tb9.2
+//
+#define qtn_clk_remove_snooze                   "Remove Snooze"
 
+//d: In Alarm's view while removing the snooze.
+//l: popup_note_window
+//w:
+//r: tb9.2
+//
+#define qtn_clk_snooze_note_removed						"Snooze removed"
 // End of file
--- a/clock2/clockui/uilayer/src/clockappui.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/src/clockappui.cpp	Tue May 25 12:41:10 2010 +0300
@@ -29,6 +29,8 @@
 #include <featmgr.h>  
 #include <e32property.h>
 #include <startupdomainpskeys.h>
+#include <touchfeedback.h>
+#include <gfxtranseffect/gfxtranseffect.h> 
 
 // User includes
 #include "clock.h"
@@ -53,6 +55,13 @@
                           EChangesFreeMemory |
                           EChangesOutOfMemory );
 
+// constants for control effects
+const TInt KGfxControlPageSwitchDisappear = 4;
+const TInt KGfxControlPageSwitchAppear = 3;
+
+const TUid KControlUid1 = {0x2000B47C};  
+const TUid KControlUid2 = {0x2000B47D};
+
 // Literals
 _LIT( KIconFileName, "\\resource\\apps\\clockapp_tab.mif" );
 _LIT( KIAParamExec, "clock.exe" );
@@ -133,7 +142,9 @@
     CClkDateTimeView* dateTimeView = CClkDateTimeView::NewLC( KClockAppMainViewId, ETrue );
     AddViewL( dateTimeView );
     CleanupStack::Pop( dateTimeView );
-	
+
+    iTactileFeedbackSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback );
+    
 	// Start the model.
 	alarmModel->Start();
 	
@@ -296,6 +307,8 @@
         case EClockAppMainViewId:
             {
             // The main view.
+            iTransitionOngoing = ETrue;
+            iTransitionDirection = ETransitionLeft;
             ActivateLocalViewL( KClockAppMainViewId );
             }
             break;
@@ -303,6 +316,8 @@
         case EClockAppWorldViewId:
             {
             // The clockworld view.
+            iTransitionOngoing = ETrue;
+            iTransitionDirection = ETransitionRight;
             ActivateLocalViewL( KClockAppWorldViewId );
             }
             break;
@@ -504,7 +519,10 @@
     {
     // Set the title pane text first
     SetTitlePaneTextL( R_CLOCK_TITLE_SETTINGS );
-
+    
+    // Activate the date and time settings view
+    ActivateLocalViewL( KClkDateTimeViewId );
+    
     // Don't display the navigation pane when switching to settings view.
     if( iNavigationDecorator )
         {
@@ -546,9 +564,16 @@
     viewId.iViewUid = KClockAppMainViewId;
                         
     // Switch to the main view
-    // ActivateLocalViewL( KClockAppMainViewId, KClockAppMainViewId, KNullDesC8() );
-    TRAP_IGNORE( CAknViewAppUi::CreateActivateViewEventL( viewId, TUid::Uid(KClockHideInBackground), KNullDesC8 ) ) ;
-
+    if( iTabGroup->ActiveTabId() == EClockAppWorldViewId )
+        {
+        ActivateLocalViewL( KClockAppMainViewId, TUid::Uid(KClockHideInBackground), KNullDesC8() );
+        //TRAP_IGNORE( CAknViewAppUi::CreateActivateViewEventL( viewId, TUid::Uid(KClockHideInBackground), KNullDesC8 ) ) ;
+        }
+    else
+        {
+        // ActivateLocalViewL( KClockAppMainViewId, KClockAppMainViewId, KNullDesC8() );
+        TRAP_IGNORE( CAknViewAppUi::CreateActivateViewEventL( viewId, TUid::Uid(KClockHideInBackground), KNullDesC8 ) ) ;
+        }
 	// Update the tab.
 	iTabGroup->SetActiveTabById( EClockAppMainViewId );
     }
@@ -697,4 +722,84 @@
         }
     __PRINTS( "CClockAppUi::HandleIADUpdateL - Exit" );
     }
+	
+TBool CClockAppUi::TransitionOngoing() const
+    {
+    return iTransitionOngoing;
+    }
+
+void CClockAppUi::SetTransitionOngoing( TBool aTransitionOngoing )
+    {
+    iTransitionOngoing = aTransitionOngoing;
+    }
+
+void CClockAppUi::SetTransitionGroupId( TInt aId )
+    {
+    iTransitionGroupId = aId;
+    }
+
+TInt CClockAppUi::TransitionGroupId() const
+    {
+    return iTransitionGroupId;
+    }
+
+CClockAppUi::TTransitionDirection CClockAppUi::TransitionDirection() const
+    {
+    return iTransitionDirection;
+    }
+
+void  CClockAppUi::SetTransitionDirection( CClockAppUi::TTransitionDirection aDirection )
+    {
+    iTransitionDirection = aDirection;
+    }
+
+void  CClockAppUi::DoDisappearTransition( CCoeControl* aControl )
+    {
+    if( aControl && iTransitionOngoing )
+        {
+        if( iTransitionDirection == ETransitionLeft )
+            {
+            GfxTransEffect::Register( aControl, KControlUid2 );      
+            }
+        else
+            {
+            GfxTransEffect::Register( aControl, KControlUid1 );   
+            }
+        GfxTransEffect::Begin( aControl, KGfxControlPageSwitchDisappear );
+        aControl->MakeVisible( EFalse );
+        GfxTransEffect::SetDemarcation( aControl, aControl->Rect() );
+        GfxTransEffect::End( aControl );
+        GfxTransEffect::EndGroup( iTransitionGroupId );
+        iTransitionOngoing = EFalse;
+        }
+    }
+
+void  CClockAppUi::DoAppearTransition( CCoeControl* aControl )
+    {
+    if( aControl && iTransitionOngoing )
+        {
+        if( iTransitionDirection == ETransitionLeft )
+            {
+            GfxTransEffect::Register( aControl, KControlUid2 );      
+            }
+        else
+            {
+            GfxTransEffect::Register( aControl, KControlUid1 );   
+            }
+        iTransitionGroupId = GfxTransEffect::BeginGroup();
+        GfxTransEffect::Begin( aControl, KGfxControlPageSwitchAppear );
+        aControl->MakeVisible( ETrue );
+        GfxTransEffect::SetDemarcation( aControl, aControl->Rect() );
+        GfxTransEffect::End( aControl );
+        }
+    }
+
+MTouchFeedback* CClockAppUi::GetFeedback()
+	{
+    if( !iFeedback && iTactileFeedbackSupported )
+    	{
+        iFeedback = MTouchFeedback::Instance();
+        }
+    return iFeedback;
+    }
 // End of file
--- a/clock2/clockui/uimodel/bwins/clkuimodelu.def	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uimodel/bwins/clkuimodelu.def	Tue May 25 12:41:10 2010 +0300
@@ -43,4 +43,5 @@
 	?SetModelObserver@CClkUiModelBase@@QAEXPAVMClkModelObserver@@@Z @ 42 NONAME ; void CClkUiModelBase::SetModelObserver(class MClkModelObserver *)
 	?Start@CClkUiModelBase@@QAEXXZ @ 43 NONAME ; void CClkUiModelBase::Start(void)
 	?Stop@CClkUiModelBase@@QAEXXZ @ 44 NONAME ; void CClkUiModelBase::Stop(void)
+	?AlarmRemoveSnooze@CClkUiAlarmModel@@QAEHH@Z @ 45 NONAME ; int CClkUiAlarmModel::AlarmRemoveSnooze(int)
 
--- a/clock2/clockui/uimodel/eabi/clkuimodelu.def	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uimodel/eabi/clkuimodelu.def	Tue May 25 12:41:10 2010 +0300
@@ -70,4 +70,5 @@
 	_ZTV29CClkUiMdlIntermediateObserver @ 69 NONAME ; #<VT>#
 	_ZThn4_N18CClkUiIdleObserver13HandleUpdateLEi @ 70 NONAME ; #<thunk>#
 	_ZThn4_N29CClkUiMdlIntermediateObserver13HandleUpdateLEi @ 71 NONAME ; #<thunk>#
+	_ZN16CClkUiAlarmModel17AlarmRemoveSnoozeEi @ 72 NONAME
 
--- a/clock2/clockui/uimodel/inc/clkuialarmmodel.h	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uimodel/inc/clkuialarmmodel.h	Tue May 25 12:41:10 2010 +0300
@@ -71,6 +71,13 @@
         IMPORT_C TInt DeleteClockAlarm( TAlarmId aAlarmId );
 
         /**
+        * @brief Deletes a clock alarm with 
+        * @param aAlarmId The id of the alarm to be deleted.
+        * @return TInt Symbian OS error code.
+        */
+        IMPORT_C TInt AlarmRemoveSnooze ( TAlarmId aAlarmId );
+
+        /**
         * @brief Enable or disable a clock alarm.
         * @param aAlarmId The id of the clock alarm.
         * @param aState The status to which the alarm has to be changed.
--- a/clock2/clockui/uimodel/src/clkuialarmmodel.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uimodel/src/clkuialarmmodel.cpp	Tue May 25 12:41:10 2010 +0300
@@ -101,6 +101,32 @@
     }
 
 // ---------------------------------------------------------
+// CClkUiAlarmModel::StopClockAlarm
+// rest of the details are commented in the header
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CClkUiAlarmModel::AlarmRemoveSnooze ( TAlarmId aAlarmId )
+    {
+
+    TInt returnVal( KErrNone );
+    SClkAlarmInfo alarmInfo;
+    returnVal = ClockAlarmInfo( aAlarmId, alarmInfo);
+    if ( returnVal != KErrNone )
+        {
+        return returnVal;
+        }
+    returnVal = iAlarmSrvSes.AlarmDelete( aAlarmId );
+    if ( returnVal != KErrNone )
+        {
+        return returnVal;
+        }
+    alarmInfo.iState = EAlarmStateInPreparation;
+    alarmInfo.iAlarmTime = alarmInfo.iOrigExpiryTime;
+    return ClockAlarmSet( alarmInfo );    
+    
+    }
+
+// ---------------------------------------------------------
 // CClkUiAlarmModel::ClockAlarmEnable
 // rest of the details are commented in the header
 // ---------------------------------------------------------
--- a/notepad/notepad1/LibData/NpdLib.rss	Tue May 11 16:12:24 2010 +0300
+++ b/notepad/notepad1/LibData/NpdLib.rss	Tue May 25 12:41:10 2010 +0300
@@ -442,17 +442,17 @@
         // 'Send' is added by SendUi.
         MENU_ITEM
             {
-            command = ENotepadCmdAdd;
-            txt = qtn_nmake_om_add_new;
+            command = ENotepadCmdDelete;
+            txt = qtn_nmake_om_delete_memo;
+            flags = EEikMenuItemSpecific;
             },
         MENU_ITEM
             {
-            command = ENotepadCmdDelete;
-            txt = qtn_nmake_om_delete_memo;
-            flags = EEikMenuItemSpecific;
-            }
+            command = ENotepadCmdAdd;
+            txt = qtn_nmake_om_add_new;
+            },            
         // START CSW change
-        ,MENU_ITEM
+        MENU_ITEM
             {
             command = ENotepadCmdPrint; // Same ID as in interest. 
             txt = ""; // AIW plugin will set the text.
--- a/notepad/notepad1/LibSrc/NpdListDialog.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/notepad/notepad1/LibSrc/NpdListDialog.cpp	Tue May 25 12:41:10 2010 +0300
@@ -965,6 +965,11 @@
                 // this must after InsertSendMenuItemAfterL
                 aMenuPane->DeleteMenuItem(ENotepadCmdOpen);
                 }
+            if ( markCount >= 1  )
+                {
+                aMenuPane->SetItemSpecific( ENotepadCmdSend, EFalse );
+                aMenuPane->SetItemSpecific( ENotepadCmdDelete, EFalse );
+                }
             if ( iListBox->CurrentItemIndex() == 0 && IsNotepad() && memoCount > 0)
 				{                    
 				aMenuPane->SetItemDimmed( ENotepadCmdDelete, ETrue );				 
--- a/notepad/notepad1/LibSrc/NpdViewerDialog.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/notepad/notepad1/LibSrc/NpdViewerDialog.cpp	Tue May 25 12:41:10 2010 +0300
@@ -38,6 +38,7 @@
 #include <centralrepository.h>
 #include <CommonUiInternalCRKeys.h>
 #include <akntitle.h>
+#include <touchfeedback.h>
 
 #include <NpdLib.rsg>
 #include "NpdLib.hrh"
@@ -106,6 +107,7 @@
         }
     delete iFilename;
     delete iSendUi;
+    iAutoFinder->SetItemFinderObserverL (0);
     delete iAutoFinder;
     delete iFindMenu;
     if( iNotifier )
@@ -234,7 +236,7 @@
     iEditor->SetAmountToFormat(iEditor->Text()->DocumentLength());
     iEditor->HandleTextChangedL();
     iAutoFinder->SetEditor((CEikRichTextEditor**)&iEditor);
-
+    iAutoFinder->SetItemFinderObserverL( this );
     RefreshTitleL();
     }
 
@@ -252,7 +254,7 @@
     iEditor->SetAmountToFormat(iEditor->Text()->DocumentLength()); 
     iEditor->HandleTextChangedL();
     iAutoFinder->SetEditor((CEikRichTextEditor**)&iEditor);
-
+    iAutoFinder->SetItemFinderObserverL( this );
     RefreshTitleL();
     if( error != KErrNone)
         {
@@ -363,6 +365,7 @@
         case EAknSoftkeyContextOptions:
 	   		{
 	   		iFlags |= ENotepadMenuByOkKey;
+	   		iFlags &= ~EMenuByItemActication;
 	   		DisplayMenuL();
 	   		isOk= EFalse;
 	   		}
@@ -377,6 +380,7 @@
         case EAknSoftkeyOptions:
              iTaskSwapperFlag = ETrue;
         default:
+            iFlags &= ~EMenuByItemActication;
             isOk = CAknDialog::OkToExitL(aButtonId);
             break;
         }
@@ -530,7 +534,9 @@
         iEditor->SetAmountToFormat(iContent.Length()); // Will ensure first Format in SetTextL is in correct mode
         iEditor->HandleTextChangedL();
         iAutoFinder->SetEditor((CEikRichTextEditor**)&iEditor);
+        iAutoFinder->SetItemFinderObserverL( this );
         RefreshTitleL();
+        iEditor->EnableKineticScrollingL( ETrue );
         }
     }
 
@@ -577,6 +583,17 @@
  
     return keyResponse;
     }
+void CNotepadViewerDialog::HandleFindItemEventL(
+                const CItemFinder::CFindItemExt& aItem,
+                MAknItemFinderObserver::TEventFlag aEvent,
+                TUint aFlags)
+    {
+    if ( MAknItemFinderObserver::EPointerEvent == aEvent )
+        {
+        iFlags |= ENotepadMenuByOkKey;
+        }
+    iFlags |= EMenuByItemActication;
+    }
 // -----------------------------------------------------------------------------
 // CNotepadViewerDialog::HandleDialogPointerEventL
 // from CoeControl
@@ -588,17 +605,40 @@
         {
         return;
         }
-	 
-    if( aPointerEvent.iType == TPointerEvent::EButton1Up ) 
-        {
-        TRect rect = iEditor->Rect();  
-        if ( !iAutoFinder->ItemWasTappedL( aPointerEvent.iPosition - rect.iTl ) )
-            {
-            return;
-            }
-        
-        DisplayMenuL();
-        }
+    if( CItemFinder::ENoneSelected == iAutoFinder->CurrentItemExt().iItemType )
+	{
+	// when you selected is not item, return
+	return;
+	}
+    MTouchFeedback* feedback = MTouchFeedback::Instance();
+    TTouchLogicalFeedback fbLogicalType;
+    TTouchFeedbackType fbType;
+    switch( aPointerEvent.iType )
+    	{
+    	case TPointerEvent::EButton1Down:
+    		{
+    		fbLogicalType = ETouchFeedbackBasic;
+    		fbType = TTouchFeedbackType( ETouchFeedbackAudio|ETouchFeedbackVibra );
+    		}
+    		break;
+    	case TPointerEvent::EButton1Up:
+    		{
+    		fbLogicalType = ETouchFeedbackIncreasingPopUp;
+    		fbType = ETouchFeedbackVibra;
+    		}
+    		break;
+    	default:
+    		return;
+    	}
+    if ( feedback )
+    	{
+    	feedback->InstantFeedback( this,
+    			fbLogicalType, fbType, TPointerEvent() );
+    	if( ETouchFeedbackVibra == fbType )
+    		{
+    		DisplayMenuL();
+    		}
+    	}
     }
 
 // -----------------------------------------------------------------------------
@@ -689,7 +729,24 @@
             {
             if ( iFindMenu->CommandIsValidL(aCommandId) ) // can't really leave
                 {
+                TBool selectionVisibility ( ETrue );
+                if ( aCommandId == EFindItemCmdCopy && iAutoFinder && iEditor && iEditor->TextView() )
+                    {
+                    selectionVisibility = iEditor->TextView()->SelectionVisible();
+                    iEditor->TextView()->SetSelectionVisibilityL( EFalse );
+                    const CItemFinder::CFindItemExt& item = iAutoFinder->CurrentItemExt();
+                    iEditor->SetSelectionL( item.iStart, item.iEnd + 1 );
+                    }
+
                 iFindMenu->HandleItemFinderCommandL(aCommandId);
+
+                if ( aCommandId == EFindItemCmdCopy && iAutoFinder && iEditor && iEditor->TextView() )
+                    {
+                    iEditor->TextView()->SetSelectionVisibilityL( selectionVisibility );
+                    iEditor->ClearSelectionL();
+                    iEditor->DrawDeferred(); // sometimes editor does not update itself
+                    }
+
                 return;
                 }
             CNotepadDialogBase::ProcessCommandL(aCommandId);
@@ -710,6 +767,16 @@
     __ASSERT_DEBUG(aResourceId > 0, Panic(ENotepadLibraryPanicNoMenuResource));
     __ASSERT_DEBUG(aMenuPane, Panic(ENotepadLibraryPanicNullMenuPane));
     __ASSERT_DEBUG(iEditor, Panic(ENotepadLibraryPanicNoEdwin));
+
+    const TBool activatedByItemActication = iFlags & EMenuByItemActication;
+    if ( !activatedByItemActication && iEditor && iAutoFinder
+            && iEditor->SelectionLength() !=
+            ( iAutoFinder->CurrentItemExt().iEnd -
+              iAutoFinder->CurrentItemExt().iStart + 1 ) )
+        {
+        iAutoFinder->ResetCurrentItem(); // do not show item specific commands
+        }
+
     TInt index;
     switch ( aResourceId )
         {
--- a/notepad/notepad1/inc/NpdViewerDialog.h	Tue May 11 16:12:24 2010 +0300
+++ b/notepad/notepad1/inc/NpdViewerDialog.h	Tue May 25 12:41:10 2010 +0300
@@ -24,6 +24,7 @@
 #include "NpdDialogBase.h"
 #include <centralrepository.h>
 #include <cenrepnotifyhandler.h>
+#include <itemfinderobserver.h>
 
 // FORWARD DECLARATIONS
 class CNotepadRichTextEditor;
@@ -41,7 +42,9 @@
 * @see CNotepadDialogBase
 */
 class CNotepadViewerDialog : public CNotepadDialogBase,
-                             public MCenRepNotifyHandlerCallback
+                             public MCenRepNotifyHandlerCallback,
+                             public MAknItemFinderObserver
+
     {
     public: // Constructor and destructor
 
@@ -214,6 +217,12 @@
         void SizeChanged();
     public:
         void HandleDialogPointerEventL( const TPointerEvent& aPointerEvent );
+        
+        void HandleFindItemEventL(
+                const CItemFinder::CFindItemExt& aItem,
+                MAknItemFinderObserver::TEventFlag aEvent,
+                TUint aFlags );
+
 
     private: // New function
 
@@ -307,7 +316,8 @@
 
         enum TNotepadViewerFlags
             {
-            ENotepadMenuByOkKey = 0x02
+            ENotepadMenuByOkKey = 0x02,
+            EMenuByItemActication = 0x04
             };
         CNotepadRichTextEditor* iEditor; // not own (dialog own)
         HBufC* iFilename;  // own
--- a/pimappservices/calendar/client/src/calentryimpl.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/pimappservices/calendar/client/src/calentryimpl.cpp	Tue May 25 12:41:10 2010 +0300
@@ -615,11 +615,11 @@
 	const TAgnRpt* KRpt = KRptDef->RRule();
 
 	// get the DTSTART property
-	if (SimpleEntry()->Type() == CCalEntry::ETodo)
-		{
-		aRule.SetDtStart(EndTimeL());
-		}
-	else
+//	if (SimpleEntry()->Type() == CCalEntry::ETodo)
+//		{
+//		aRule.SetDtStart(EndTimeL());
+//		}
+//	else
 		{
 		aRule.SetDtStart(StartTimeL());
 		}
--- a/pimappservices/calendar/server/src/agsentrymodel.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/pimappservices/calendar/server/src/agsentrymodel.cpp	Tue May 25 12:41:10 2010 +0300
@@ -85,6 +85,10 @@
 		iAttachmentIndex = new (ELeave) CAgnAttachmentIndex;
 		CreateAlarmForServerL();
 		}
+	
+	User::LeaveIfError(iFs.Connect());
+    User::LeaveIfError( iFs.ShareProtected() );
+    
 	iIndexFileIsDirty = ETrue; 	// for safety assume that the index
 					// file is out of date. We can correct this
 					// when we read the file
@@ -113,6 +117,7 @@
 	delete iModelStreamIdSet;
 	delete iEntryManager;
 	delete iCalConverter;
+	iFs.Close();
 	}
 
 const CAgnServFile& CAgnEntryModel::AgnServFile()
@@ -1415,12 +1420,8 @@
             if (!GenerateIndexFileName(idxfilename))
                 {
                 User::Leave(KErrBadName);
-                }
-            
-            TInt connectErr = iFs.Connect();
-            User::LeaveIfError(connectErr);
-            
-            iFs.Delete(idxfilename); // ignore return as there is nothing we can do with it
+                }           
+            iFs.Delete(idxfilename); // ignore return as there is nothing we can do with it           
         }        
 	iIndexFileIsDirty = ETrue;
 	}
@@ -1455,9 +1456,6 @@
 		User::Leave(KErrBadName);
 		}
 	
-	TInt connectErr = iFs.Connect();
-	User::LeaveIfError(connectErr);
-	
 	RFile idxFile;
 	TInt errReadIdx = idxFile.Open(iFs, idxfilename, EFileRead);
 	CleanupClosePushL(idxFile);
@@ -1531,10 +1529,7 @@
         {
         User::Leave(KErrBadName);
         }
-    
-    TInt connectErr = iFs.Connect();
-    User::LeaveIfError(connectErr);
-    
+   
     RFile idxFile;
     TInt errReadIdx = idxFile.Open(iFs, idxfilename, EFileRead);
     CleanupClosePushL(idxFile);
@@ -1558,9 +1553,7 @@
 		{
 		User::Leave(KErrBadName);
 		}
-	TInt connectErr = iFs.Connect();
-	User::LeaveIfError(connectErr);
-
+	
 	RFile idxFile;
 	TInt errWriteIdx = idxFile.Replace(iFs, idxfilename, EFileWrite);
 	User::LeaveIfError(errWriteIdx);
@@ -2712,6 +2705,15 @@
 
 	NotifyingL(MCalChangeCallBack2::EChangeModify, aEntry, instanceInfoBefore);
 	
+	if(iChangeFilter && iTzRuleIndex)
+        {
+        //Remove the tz rule from tz rule index
+        //we have to do it after CAgnEntryModel::NotifyingL that is indirectly using the
+        //tz rule in oldEntry.
+        iTzRuleIndex->RemoveTzRuleL(*oldEntry);
+        }
+  
+	
 	CleanupStack::PopAndDestroy(instanceInfoBefore);
 	CleanupStack::PopAndDestroy(oldEntry);
 	
--- a/pimappservices/calendar/server/src/agstzruleindex.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/pimappservices/calendar/server/src/agstzruleindex.cpp	Tue May 25 12:41:10 2010 +0300
@@ -592,7 +592,7 @@
  @param aOldEntry reference to the original entry to be updated.
  @param aNewEntry reference to the entry containing updated content.
  */
-void CAgnTzRuleIndex::UpdateTzRuleL(CAgnEntry& aOldEntry, CAgnEntry& aNewEntry)
+void CAgnTzRuleIndex::UpdateTzRuleL(CAgnEntry& /*aOldEntry*/, CAgnEntry& aNewEntry)
 	{
 	CAgnTzRules* newTzZone = GetTzRulesFromEntry(aNewEntry);
 	if (newTzZone != NULL && newTzZone->HasValidTzZoneStreamId())
@@ -620,7 +620,6 @@
 		AddTzRuleL(aNewEntry);
 		}
 
-	RemoveTzRuleL(aOldEntry);
 	}
 
 void CAgnTzRuleIndex::UpdateItemsInStoreL(
--- a/pimappservices/calendar/shared/src/agmcalendarinfo.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/pimappservices/calendar/shared/src/agmcalendarinfo.cpp	Tue May 25 12:41:10 2010 +0300
@@ -121,8 +121,9 @@
 EXPORT_C CDesC8Array* CAgnCalendarInfo::PropertyKeysL() const
     {
     const TInt KPropertyCount(iProperties.Count());
+    const TInt propertyCount = KPropertyCount==0 ? 1 : KPropertyCount;
     
-    CDesC8Array* propertyKeys = new(ELeave) CDesC8ArrayFlat(KPropertyCount);
+    CDesC8Array* propertyKeys = new(ELeave) CDesC8ArrayFlat(propertyCount);
     CleanupStack::PushL(propertyKeys);
     
     for (TInt i(0) ; i < KPropertyCount ; ++i)
--- a/pimappservices/calendar/shared/src/agmrptdef.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/pimappservices/calendar/shared/src/agmrptdef.cpp	Tue May 25 12:41:10 2010 +0300
@@ -2700,8 +2700,16 @@
 @internalComponent
 */
 	{
-	delete iRRule;
-	delete iTimeZone;
+    if (iRRule)
+        {
+        delete iRRule;
+        iRRule = NULL;
+        }
+    if (iTimeZone)
+        {
+        delete iTimeZone;
+        iTimeZone = NULL;
+        }
 
 	ClearTimeArray(iSporadicDates);
 	ClearTimeArray(iExceptions);
@@ -3885,7 +3893,14 @@
 @return The start date expressed as Current System Local Time.
 */
 	{
-	return iOwningEntry.EntryTime();
+	if (iOwningEntry.Type() ==  CCalEntry::ETodo)
+		{
+		return iOwningEntry.StartTime();
+		}
+	else
+		{
+		return iOwningEntry.EntryTime();
+		}
 	}
 
 EXPORT_C void CAgnRptDef::SetUntilTime(const TAgnCalendarTime& aUntilTime)
--- a/pimappservices/calendar/shared/src/agmsimpleentry.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/pimappservices/calendar/shared/src/agmsimpleentry.cpp	Tue May 25 12:41:10 2010 +0300
@@ -67,7 +67,11 @@
 @internalComponent
 */
 	{
-	delete iRptDef;
+    if (iRptDef)
+        {
+        delete iRptDef;
+        iRptDef = NULL;
+        }
 	}
 
 
@@ -394,8 +398,15 @@
 			// Ensure that the start date actually falls on a repeating instance. For example,
 			// if the repeat rule is every Wednesday, and the DtStart is a Monday, it should be 
 			// nudged forwards to the Wednesday of that week.
-
-			TTime startTimeUtc = EntryTime().UtcL();
+			TTime startTimeUtc;
+			if (Type() == CCalEntry::ETodo)
+				{
+				startTimeUtc = StartTime().UtcL();
+				}
+			else
+				{
+			    startTimeUtc = EntryTime().UtcL();
+				}
 
 			startTimeUtc -= TTimeIntervalMicroSeconds(1);
 			TTime firstInstanceUtc;
@@ -428,7 +439,7 @@
 	TTime startTime = aNewEntryTimeLocal;
 	if (Type() == CCalEntry::ETodo)
 		{
-		startTime = DurationMinusL(startTime);
+		//startTime = DurationMinusL(startTime);
 		}
 	TAgnCalendarTime startAgnTime;
 	TAgnCalendarTime endAgnTime;
--- a/pimappservices/calendar/tsrc/instance_iterator/tcal_fetchinstance.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/pimappservices/calendar/tsrc/instance_iterator/tcal_fetchinstance.cpp	Tue May 25 12:41:10 2010 +0300
@@ -435,8 +435,24 @@
 	test.Printf(_L("test the instance time"));
 	test(repeatingTodoInstance1->Time().TimeLocalL() == instanceTime1.TimeLocalL());
 	test.Printf(_L("test the entry start and end times"));
-	test(repeatingTodoInstance1->Entry().StartTimeL().TimeLocalL() == startTime.TimeLocalL());
-	test(repeatingTodoInstance1->Entry().EndTimeL().TimeLocalL() == endTime.TimeLocalL());
+	
+	// Modified Start-> if DtStart date is equal to end date then align start date with DtStart date and 
+	// end date = end date + duration of the entry. 
+	// Thus moving the time window based on DtStart date   
+	test(repeatingTodoInstance1->Entry().StartTimeL().TimeLocalL() == endTime.TimeLocalL()); 
+	
+	TTime newEndTime(endTime.TimeLocalL());
+	TTimeIntervalMinutes deltaMinutes;
+	endTime.TimeLocalL().MinutesFrom(startTime.TimeLocalL(), deltaMinutes);
+	newEndTime += deltaMinutes;
+	    
+	TTimeIntervalMicroSeconds deltaMicroSeconds = 
+	        endTime.TimeLocalL().MicroSecondsFrom(startTime.TimeLocalL() + deltaMinutes);
+	newEndTime += deltaMicroSeconds;
+	
+	test(repeatingTodoInstance1->Entry().EndTimeL().TimeLocalL() == newEndTime);
+	//Modified End<-
+	
 	test.Printf(_L("fetch the description"));
 	test(repeatingTodoInstance1->Entry().DescriptionL().Compare(KEntryDescription) == 0);
 	CleanupStack::PopAndDestroy(repeatingTodoInstance1);
@@ -448,8 +464,24 @@
 	test.Printf(_L("test the instance time"));
 	test(repeatingTodoInstance2->Time().TimeLocalL() == instanceTime2.TimeLocalL());
 	test.Printf(_L("test the entry start and end times"));
-	test(repeatingTodoInstance2->Entry().StartTimeL().TimeLocalL() == startTime.TimeLocalL());
-	test(repeatingTodoInstance2->Entry().EndTimeL().TimeLocalL() == endTime.TimeLocalL());
+	
+	// Modified Start-> if DtStart date is equal to end date then align start date with DtStart date and 
+    // end date = end date + duration of the entry. 
+    // Thus moving the time window based on DtStart date   
+    test(repeatingTodoInstance2->Entry().StartTimeL().TimeLocalL() == endTime.TimeLocalL()); 
+    
+    newEndTime = endTime.TimeLocalL();
+    
+    endTime.TimeLocalL().MinutesFrom(startTime.TimeLocalL(), deltaMinutes);
+    newEndTime += deltaMinutes;
+        
+    deltaMicroSeconds = 
+            endTime.TimeLocalL().MicroSecondsFrom(startTime.TimeLocalL() + deltaMinutes);
+    newEndTime += deltaMicroSeconds;
+    
+    test(repeatingTodoInstance2->Entry().EndTimeL().TimeLocalL() == newEndTime);
+    //Modified End<-
+    
 	test.Printf(_L("fetch the description"));
 	test(repeatingTodoInstance2->Entry().DescriptionL().Compare(KEntryDescription) == 0);
 	CleanupStack::PopAndDestroy(repeatingTodoInstance2);
@@ -461,8 +493,24 @@
 	test.Printf(_L("test the instance time"));
 	test(repeatingTodoInstance3->Time().TimeLocalL() == instanceTime3.TimeLocalL());
 	test.Printf(_L("test the entry start and end times"));
-	test(repeatingTodoInstance3->Entry().StartTimeL().TimeLocalL() == startTime.TimeLocalL());
-	test(repeatingTodoInstance3->Entry().EndTimeL().TimeLocalL() == endTime.TimeLocalL());
+	
+	// Modified Start-> if DtStart date is equal to end date then align start date with DtStart date and 
+    // end date = end date + duration of the entry. 
+    // Thus moving the time window based on DtStart date   
+    test(repeatingTodoInstance3->Entry().StartTimeL().TimeLocalL() == endTime.TimeLocalL()); 
+    
+    newEndTime = endTime.TimeLocalL();
+    
+    endTime.TimeLocalL().MinutesFrom(startTime.TimeLocalL(), deltaMinutes);
+    newEndTime += deltaMinutes;
+        
+    deltaMicroSeconds = 
+            endTime.TimeLocalL().MicroSecondsFrom(startTime.TimeLocalL() + deltaMinutes);
+    newEndTime += deltaMicroSeconds;
+    
+    test(repeatingTodoInstance3->Entry().EndTimeL().TimeLocalL() == newEndTime);
+    //Modified End<-
+    
 	test.Printf(_L("fetch the description"));
 	test(repeatingTodoInstance3->Entry().DescriptionL().Compare(KEntryDescription) == 0);
 	CleanupStack::PopAndDestroy(repeatingTodoInstance3);
@@ -474,8 +522,24 @@
 	test.Printf(_L("test the instance time"));
 	test(repeatingTodoInstance4->Time().TimeLocalL() == instanceTime4.TimeLocalL());
 	test.Printf(_L("test the entry start and end times"));
-	test(repeatingTodoInstance4->Entry().StartTimeL().TimeLocalL() == startTime.TimeLocalL());
-	test(repeatingTodoInstance4->Entry().EndTimeL().TimeLocalL() == endTime.TimeLocalL());
+	
+	// Modified Start-> if DtStart date is equal to end date then align start date with DtStart date and 
+    // end date = end date + duration of the entry. 
+    // Thus moving the time window based on DtStart date   
+    test(repeatingTodoInstance4->Entry().StartTimeL().TimeLocalL() == endTime.TimeLocalL()); 
+    
+    newEndTime = endTime.TimeLocalL();
+    
+    endTime.TimeLocalL().MinutesFrom(startTime.TimeLocalL(), deltaMinutes);
+    newEndTime += deltaMinutes;
+        
+    deltaMicroSeconds = 
+            endTime.TimeLocalL().MicroSecondsFrom(startTime.TimeLocalL() + deltaMinutes);
+    newEndTime += deltaMicroSeconds;
+    
+    test(repeatingTodoInstance4->Entry().EndTimeL().TimeLocalL() == newEndTime);
+    //Modified End<-
+    
 	test.Printf(_L("fetch the description"));
 	test(repeatingTodoInstance4->Entry().DescriptionL().Compare(KEntryDescription) == 0);
 	CleanupStack::PopAndDestroy(repeatingTodoInstance4);
@@ -486,8 +550,24 @@
 	test.Printf(_L("test the instance time"));
 	test(rDateInstance->Time().TimeLocalL() == rDateTime.TimeLocalL());
 	test.Printf(_L("test the entry start and end times"));
-	test(rDateInstance->Entry().StartTimeL().TimeLocalL() == startTime.TimeLocalL());
-	test(rDateInstance->Entry().EndTimeL().TimeLocalL() == endTime.TimeLocalL());
+	
+	// Modified Start-> if DtStart date is equal to end date then align start date with DtStart date and 
+    // end date = end date + duration of the entry. 
+    // Thus moving the time window based on DtStart date   
+    test(rDateInstance->Entry().StartTimeL().TimeLocalL() == endTime.TimeLocalL()); 
+    
+    newEndTime = endTime.TimeLocalL();
+    
+    endTime.TimeLocalL().MinutesFrom(startTime.TimeLocalL(), deltaMinutes);
+    newEndTime += deltaMinutes;
+        
+    deltaMicroSeconds = 
+            endTime.TimeLocalL().MicroSecondsFrom(startTime.TimeLocalL() + deltaMinutes);
+    newEndTime += deltaMicroSeconds;
+    
+    test(rDateInstance->Entry().EndTimeL().TimeLocalL() == newEndTime);
+    //Modified End<-
+    
 	test.Printf(_L("fetch the description"));
 	test(rDateInstance->Entry().DescriptionL().Compare(KEntryDescription) == 0);
 	CleanupStack::PopAndDestroy(rDateInstance);