Merge both heads RCL_3 PDK_3.0.0
authorMaximilian Odendahl <maxodendahl@gmail.com>
Sun, 20 Jun 2010 22:55:39 +0200
branchRCL_3
changeset 43 51372538e3d3
parent 42 07e82e2b738b (current diff)
parent 36 9c5b1510919f (diff)
child 52 e3c9f8706792
Merge both heads
alarmui/group/alarmuisnooze.rul
calendarui/controller/inc/calendbchangenotifier.h
calendarui/controller/src/calendbchangenotifier.cpp
calendarui/group/bld.inf
organizer_pub/notepad_library_api/tsrc/group/ABLD.BAT
organizer_pub/notepad_library_api/tsrc/group/TestNpdApi.pkg
organizer_pub/notepad_library_api/tsrc/group/TestNpdApi.sis
organizer_pub/notepad_library_api/tsrc/group/TestNpdApi.sisx
organizer_pub/notepad_library_api/tsrc/group/rd-key.pem
organizer_pub/notepad_library_api/tsrc/group/rd.cer
pimappservices/appenginesdocs/app-engines_documentation.history.xml
pimappservices/appenginesdocs/app-engines_documentation.mrp
pimappsupport/vcardandvcal/documentation/TestVersit.rtf
--- a/alarmengines/missedalarmstore/rom/missedalarmstore.iby	Sun Jun 20 22:50:42 2010 +0200
+++ b/alarmengines/missedalarmstore/rom/missedalarmstore.iby	Sun Jun 20 22:55:39 2010 +0200
@@ -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/alarmengines/missedalarmstore/src/missedalarmstore.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/alarmengines/missedalarmstore/src/missedalarmstore.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -243,8 +243,8 @@
 				    {
 	                DeleteEntryAndReArrangeL( key );
 	                foundIds.Reset();
-				    }
-				return;
+	                return;
+				    }				
 				}
 			}
 	    }
--- a/alarmui/group/AknAlarmService.mmp	Sun Jun 20 22:50:42 2010 +0200
+++ b/alarmui/group/AknAlarmService.mmp	Sun Jun 20 22:55:39 2010 +0200
@@ -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_activate.rul	Sun Jun 20 22:55:39 2010 +0200
@@ -0,0 +1,60 @@
+<script xmlns="http://www.nokia.com/ns/cep/script/1.0/" xmlns:cep="http://www.nokia.com/ns/cep/1.0/">
+    <!-- If sensor settings are off, nothing needs to be done -->
+    <if>
+        <or>
+            <!-- Sensor settings are disabled -->
+            <not>
+	            <equals>
+	                <contextRef source='Sensor' type='Setting.Active' value='On'/>
+	            </equals>
+            </not>
+	        <!-- Turning interaction is disabled -->
+	        <not>
+	            <equals>
+	                <contextRef source='Sensor' type='Setting.TurningInteraction.SilenceAlarm' value='On'/>
+	            </equals>
+	        </not>
+        </or>
+        <actions>
+            <!-- Do nothing -->
+        </actions>
+    </if>
+    
+    <!-- Enable sensor services -->
+    <elseIf>
+		<!-- Alarm is active -->
+		<not>
+            <contextUpdated>
+                <contextRef source='AlarmUI' type='State' value='Inactive'/>
+            </contextUpdated>
+		</not>
+	    <actions>
+	            <!-- Activate orientation channel (0x01) from sensor source (0x10282DF0) -->
+	            <sourceCommand uid='0x10282DF0'>
+	                <sensorCommand channelId='0x01' id='activate'/>
+	            </sourceCommand>
+	            <!-- Publish context that indicates that alarm is active -->
+	            <publishContext define='true'>
+	                <contextRef source='Alarm' type='Status.Active' value='true'/>
+	            </publishContext>
+	    </actions>
+    </elseIf>
+
+    <!-- Disable sensor services -->
+    <elseIf>
+        <!-- Alarm is not active -->
+        <contextUpdated>
+            <contextRef source='AlarmUI' type='State' value='Inactive'/>
+        </contextUpdated>
+	    <actions>
+	            <!-- Activate orientation channel (0x01) from sensor source (0x10282DF0) -->
+	            <sourceCommand uid='0x10282DF0'>
+	                <sensorCommand channelId='0x01' id='deactivate'/>
+	            </sourceCommand>
+	            <!-- Publish context that indicates that alarm is not active -->
+	            <publishContext define='true'>
+	                <contextRef source='Alarm' type='Status.Active' value='false'/>
+	            </publishContext>
+	    </actions>
+    </elseIf>
+</script>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alarmui/group/alarmui_silence.rul	Sun Jun 20 22:55:39 2010 +0200
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alarmui/group/alarmui_snooze.rul	Sun Jun 20 22:55:39 2010 +0200
@@ -0,0 +1,39 @@
+<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>
+    
+    <!-- Snooze alarm when device is turned upside down -->
+    <elseIf>
+        <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/>
+        </actions>
+    </elseIf>
+</script>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/alarmui/group/alarmui_stop.rul	Sun Jun 20 22:55:39 2010 +0200
@@ -0,0 +1,22 @@
+<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>
+    
+    <!-- Stop alarm when 'stop' command is received from alarmui -->
+    <elseIf>
+		<contextUpdated>
+		    <contextRef source='AlarmUI' type='Command' value='Stop'/>
+		</contextUpdated>
+		<actions>
+			<!-- stop the alarm -->
+			<AlarmUI.Stop/>
+		</actions>
+    </elseIf>
+</script>
\ No newline at end of file
--- a/alarmui/group/alarmuisnooze.rul	Sun Jun 20 22:50:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-<!-- defines a rules to snooze and stop an active alarm on a doubletap or turndown event -->
-<script xmlns="http://www.nokia.com/ns/cep/script/1.0/" xmlns:cep="http://www.nokia.com/ns/cep/1.0/">
-
-    <!-- active sensor channels when alarm expires -->
-		<if>
-        <equals>
-            <contextRef source='Sensor' type='Setting.Active'/>
-            <string>Off</string>
-        </equals>
-        <actions>
-        </actions>
-    </if>
-    <!-- Check if we have an active alarm and we receive an event -->
-    <elseIf>
-        <and>
-            <!-- Must have an active alarm and receive new double tap event or orientation event from sensor -->
-            <!-- ...alarm is active... -->
-            <notEqual>
-                <contextRef source='AlarmUI' type='State'/>
-                <string>Inactive</string>
-            </notEqual>
-            <or>
-                <and>
-                    <!-- Check that double tap interaction is set -->
-                    <equals>
-                        <contextRef source='Sensor' type='Setting.TappingInteraction.SilenceAlarm'/>
-                        <string>On</string>
-                    </equals>
-                    <!-- ...and we receive a new doubletap event from sensors -->
-                    <contextUpdated>
-                        <contextRef source='Sensor' type='Event.DoubleTap'/>
-        	          </contextUpdated>
-                </and>
-    	          <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>
-            </or>
-        </and>
-        <actions>
-           <!-- snooze the alarm -->
-            <AlarmUI.Snooze dummy='dummy'/>
-
-            <!-- request vibra feedback -->
-            <Vibra Mode='Start' Delay='0' Repeats='2' RepeatInterval='200' Duration='50' Intensity='50'/>
-        </actions>
-    </elseIf>
-    <!-- Check if we just have an active alarm -->
-    <!-- active sensor channels when alarm expires -->
-    <elseIf>
-    		<and>
-            <!-- ...alarm is active... -->
-            <contextUpdated>
-                <contextRef source='AlarmUI' type='State'/>
-            </contextUpdated>
-            <notEqual>
-                <contextRef source='AlarmUI' type='State'/>
-                <string>Inactive</string>
-            </notEqual>
-        </and>
-        <actions>
-            <!-- Activate double tap events from sensor -->
-            <publishContext>
-                <contextRef source='Sensor' type='Event' value='DoubleTap.Activate'/>
-            </publishContext>
-            <!-- Activate orientation events from sensor -->
-            <publishContext>
-                <contextRef source='Sensor' type='Event' value='Orientation.Activate'/>
-            </publishContext>
-        </actions>
-    </elseIf>
-    <!-- stop an active alarm on a 'Stop' command -->
-    <elseIf>
-        <and>
-            <!-- alarm is active... -->
-            <notEqual>
-                <contextRef source='AlarmUI' type='State'/>
-                <string>Inactive</string>
-            </notEqual>
-            <!-- ...and we got a new stop command -->
-            <contextUpdated>
-                <contextRef source='AlarmUI' type='Command'/>
-            </contextUpdated>
-            <equals>
-                <contextRef source='AlarmUI' type='Command'/>
-                <string>Stop</string>
-            </equals>
-        </and>
-        <actions>
-            <!-- stop the alarm -->
-            <AlarmUI.Stop dummy='dummy'/>
-
-            <!-- request vibra feedback -->
-            <Vibra Mode='Start' Delay='0' Repeats='2' RepeatInterval='200' Duration='50' Intensity='50'/>
-        </actions>
-    </elseIf>
-    <!-- snooze an active alarm on a 'Snooze' command -->
-    <elseIf>
-        <and>
-            <!-- alarm is active... -->
-            <notEqual>
-                <contextRef source='AlarmUI' type='State'/>
-                <string>Inactive</string>
-            </notEqual>
-            <!-- ...and we got a new stop command -->
-            <contextUpdated>
-                <contextRef source='AlarmUI' type='Command'/>
-            </contextUpdated>
-            <equals>
-                <contextRef source='AlarmUI' type='Command'/>
-                <string>Snooze</string>
-            </equals>
-        </and>
-        <actions>
-            <!-- snooze the alarm -->
-            <AlarmUI.Snooze dummy='dummy'/>
-
-            <!-- request vibra feedback -->
-            <Vibra Mode='Start' Delay='0' Repeats='2' RepeatInterval='200' Duration='50' Intensity='50'/>
-        </actions>
-    </elseIf>
-</script>    
\ No newline at end of file
--- a/alarmui/group/bld.inf	Sun Jun 20 22:50:42 2010 +0200
+++ b/alarmui/group/bld.inf	Sun Jun 20 22:55:39 2010 +0200
@@ -33,9 +33,18 @@
 ../inc/alarmsourcecontextdef.h  |../../inc/alarmsourcecontextdef.h
 
 // context framework scripts
-alarmuisnooze.rul           /epoc32/release/winscw/udeb/z/private/10282bc4/rules/alarmuisnooze.rul
-alarmuisnooze.rul           /epoc32/release/winscw/urel/z/private/10282bc4/rules/alarmuisnooze.rul
-alarmuisnooze.rul           /epoc32/data/z/private/10282bc4/rules/alarmuisnooze.rul
+alarmui_snooze.rul          /epoc32/release/winscw/udeb/z/private/10282bc4/rules/alarmui_snooze.rul
+alarmui_snooze.rul          /epoc32/release/winscw/urel/z/private/10282bc4/rules/alarmui_snooze.rul
+alarmui_snooze.rul          /epoc32/data/z/private/10282bc4/rules/alarmui_snooze.rul
+alarmui_activate.rul        /epoc32/release/winscw/udeb/z/private/10282bc4/rules/alarmui_activate.rul
+alarmui_activate.rul        /epoc32/release/winscw/urel/z/private/10282bc4/rules/alarmui_activate.rul
+alarmui_activate.rul        /epoc32/data/z/private/10282bc4/rules/alarmui_activate.rul
+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	Sun Jun 20 22:50:42 2010 +0200
+++ b/alarmui/inc/AlmAlarmControl.h	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/alarmui/inc/alarmcontextfwsupport.h	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/alarmui/inc/alarmsourcecontextdef.h	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/alarmui/inc/alarmutils.h	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/alarmui/rom/AlmAlert.iby	Sun Jun 20 22:55:39 2010 +0200
@@ -37,7 +37,11 @@
 
 #ifdef RD_CONTEXT_FRAMEWORK
 // Context framework scripts
-data=\epoc32\data\Z\private\10282BC4\Rules\alarmuisnooze.rul    private\10282BC4\Rules\alarmuisnooze.rul
+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
 
 #endif  // __ALMALERT_IBY__
--- a/alarmui/sis/alarmui.pkg	Sun Jun 20 22:50:42 2010 +0200
+++ b/alarmui/sis/alarmui.pkg	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/alarmui/src/AlmAlarmControl.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -1323,4 +1323,9 @@
  	return iStopFromContextFw;
  }
 
-// End of File
+ CAlarmUtils* CAlmAlarmControl::AlarmUtils() const
+     {
+     return iAlarmUtils;
+     }
+ // End of File
+ 
--- a/alarmui/src/alarmcontextfwsupport.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/alarmui/src/alarmcontextfwsupport.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/alarmui/src/alarmutils.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -32,6 +32,7 @@
 #include "alarmcontextfwsupport.h"
 #endif // RD_ALMALERT__SENSOR_SUPPORT
 
+#include <w32std.h>
 #include <almconst.h>
 #include <eikenv.h>
 #include <AknCapServer.h>
@@ -48,6 +49,7 @@
 #include <wakeupalarm.h>
 #include <calalarm.h> // KUidAgendaModelAlarmCategory - the alarm category id for calendar alarms
 #include <AknUtils.h>
+#include <hwrmpowerstatesdkpskeys.h>
 
 #ifndef SYMBIAN_CALENDAR_V2
 #include <agmalarm.h> // deprecated, use CalAlarm.h when SYMBIAN_CALENDAR_V2 flag is enabled
@@ -960,12 +962,20 @@
 void CAlarmUtils::DeviceShutdown()
     {
     TRACE_ENTRY_POINT;
-    iShutdownTimer->Cancel();
-    if( StarterConnect() )
-        {
-        iStarter.Shutdown();
-        iStarter.Close();
-        }    
+    
+    // charging state added for the err EMDN-835CW2.
+    TInt chargingState;
+    RProperty::Get( KPSUidHWRMPowerState, KHWRMChargingStatus , chargingState );
+    
+    if( IsDeviceInAlarmState() && ( chargingState != EChargingStatusCharging ) )
+        {       
+            iShutdownTimer->Cancel();
+            if( StarterConnect() )
+                {
+                iStarter.Shutdown();
+                iStarter.Close();
+                }    
+        }
     TRACE_EXIT_POINT;
     }
 
@@ -1659,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/calendarengines/versit2/group/Versit2.mmp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarengines/versit2/group/Versit2.mmp	Sun Jun 20 22:55:39 2010 +0200
@@ -29,6 +29,7 @@
 
 USERINCLUDE     ../inc
 USERINCLUDE     ../../inc
+USERINCLUDE     ../../agnversit2/inc
 
 //System include macro
 APP_LAYER_SYSTEMINCLUDE
--- a/calendarengines/versit2/src/ICalValue.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarengines/versit2/src/ICalValue.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -26,6 +26,7 @@
 // User includes.
 #include "ICalKeyWords.h"		// Literals
 #include "ICalRuleSegment.h"	// CICalRuleSegment
+#include "CleanupPointerArray.h"   // For TCleanupPointerArray
 
 // Constants.
 
@@ -814,7 +815,7 @@
 		}
 		
 	TUint charNum(0);
-	
+	CleanupPointerArrayPushL(aRuleSegmentArray);
 	do
 		{
 		// Create a rule segment from characters charNum to nextSemiColon
@@ -847,6 +848,7 @@
 		}
 	while (charNum < iValue->Length());
 	
+	CleanupStack::Pop(&aRuleSegmentArray);
 	TRACE_EXIT_POINT;
 	}
 
--- a/calendarui/application/data/Calendar.rss	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/application/data/Calendar.rss	Sun Jun 20 22:55:39 2010 +0200
@@ -1679,7 +1679,7 @@
             {
             command = ECalenDeleteCurrentEntry;
             txt = qtn_cale_om_delete;
-            },
+            },   
         MENU_ITEM
             {
             command = ECalenCompleteTodo;
@@ -1697,6 +1697,12 @@
             },
         MENU_ITEM
             {
+            command = EFindItemMenuPlaceHolder;
+            txt = qtn_options_find;
+            cascade = r_calen_view_find_sub_menupane;
+            },        
+        MENU_ITEM
+            {
             command = ECalenShowLocation;
             txt = qtn_cale_om_show_on_map;
             },
@@ -1710,12 +1716,7 @@
             {
             command = ECalenGetLocationAndReplace;
             txt = qtn_cale_om_find_on_map;
-            },        
-        MENU_ITEM
-	        { 
-	        command = EFindItemMenuPlaceHolder;
-			txt = "Automatic HL"; 
-	        },                      
+            },                         
         MENU_ITEM
             {
             command = EAknCmdHelp;
@@ -1727,7 +1728,32 @@
             txt = qtn_options_exit;
             }
         };
-    }  
+    } 
+
+// ---------------------------------------------------------
+// Find UI for calendar viewers
+// ---------------------------------------------------------
+RESOURCE MENU_PANE r_calen_view_find_sub_menupane
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = ECalenCmdFindPhoneNum;
+            txt = qtn_options_find_phone_number;
+            },
+        MENU_ITEM
+            {
+            command = ECalenCmdFindEmail; 
+            txt = qtn_options_find_email_address;
+            },
+        MENU_ITEM
+            {
+            command = ECalenCmdFindURL; 
+            txt = qtn_options_find_url_address;
+            }
+        };
+    }
 
 
 // ---------------------------------------------------------
@@ -2173,11 +2199,15 @@
             {
             command = ECalenMissedEventView;
             txt = qtn_cale_opt_open;
+            //single click
+            flags = EEikMenuItemAction;
             },
 	    MENU_ITEM
             {
             command = ECalenCmdClear;
             txt = qtn_cale_mav_opt_clear;
+            //Single click 
+            flags = EEikMenuItemSpecific;
             },
 	    MENU_ITEM
             {
@@ -2376,7 +2406,6 @@
         |   EEikDialogFlagFillAppClientRect 
         |   EEikDialogFlagButtonsRight 
         |   EEikDialogFlagCbaButtons
-        |   EEikDialogFlagWait 
         |   EEikDialogFlagNoTitleBar
         |   EEikDialogFlagDontEatUpDownEvents
         |   EEikDialogFlagNotifyEsc;
@@ -2534,7 +2563,7 @@
 RESOURCE TBUF r_qtn_calendareditor_note_db_conflict_delete
     {
     //TODO need to raise loc CR
-    buf = "Calendar conflict.  This calendar has been deleted by another application.";
+    buf = qtn_cale_note_db_conflict;
     }
 
 // ---------------------------------------------------------
@@ -2547,7 +2576,7 @@
 RESOURCE TBUF r_qtn_calendareditor_note_db_conflict_update
     {
     //TODO need to raise loc CR
-    buf = "Calendar conflict.  This calendar has been updated by another application.";
+    buf = qtn_cale_note_db_modified;
     }
     
 RESOURCE MENU_BAR r_calen_multidb_menubar
@@ -3080,4 +3109,6 @@
     buf = qtn_cale_max_attachment_size;
     }
 
+
+
 // End of File
--- a/calendarui/application/group/Calendar.mmp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/application/group/Calendar.mmp	Sun Jun 20 22:55:39 2010 +0200
@@ -91,7 +91,7 @@
 //   NetworkServices // For sending vCalendars?
 //   ProtServ // For connecting Agenda Server? 
 //   DRM // Calendar alarm tones are DRM protected 
-CAPABILITY      CAP_APPLICATION
+CAPABILITY      CAP_APPLICATION NetworkControl
 
 VENDORID        VID_DEFAULT
 
--- a/calendarui/calenaiwprovider/group/calenaiwprovider.mmp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/calenaiwprovider/group/calenaiwprovider.mmp	Sun Jun 20 22:55:39 2010 +0200
@@ -66,6 +66,8 @@
 LIBRARY      eikctl.lib
 LIBRARY      cone.lib
 LIBRARY      bafl.lib 
+LIBRARY      eikcoctl.lib 
+LIBRARY      eikcore.lib
 
 // End of file.
 
--- a/calendarui/calenaiwprovider/src/calenaiwprovider.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/calenaiwprovider/src/calenaiwprovider.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -33,6 +33,8 @@
 #include <calentry.h>
 #include <bautils.h>
 #include <data_caging_path_literals.hrh>
+#include <aknnavide.h>
+#include <akntitle.h>
 
 // User inlcudes.
 #include "calenaiwprovider.h"
@@ -425,11 +427,64 @@
         User::LeaveIfError( errVal );
         }
     // Handle the command here.
+    
+    // Create settings own titlepane and navipane, and swap with existing ones
+    CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane();
+
+    // Titlepane
+    CAknTitlePane* newtp = new( ELeave ) CAknTitlePane();
+    CleanupStack::PushL( newtp );
+    CCoeControl* oldtp = sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), newtp );
+    CleanupStack::Pop( newtp ); // ownership is passed to statuspane
+    TRect oldRect( 0, 0, 0, 0 );
+    if( oldtp )
+        {
+        CleanupStack::PushL( oldtp );
+        oldRect = oldtp->Rect();
+        CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidTitle ));
+        newtp->SetContainerWindowL( *ctrl );
+        newtp->ConstructL();
+        newtp->SetRect(oldRect);
+        newtp->ActivateL();
+        }        
+
+    // NaviPane
+    CAknNavigationControlContainer* newnp = new( ELeave )CAknNavigationControlContainer();
+    CleanupStack::PushL( newnp );
+    CCoeControl* oldnp = sp->SwapControlL( TUid::Uid( EEikStatusPaneUidNavi ), newnp );
+    CleanupStack::Pop( newnp ); // ownership is passed to statuspane
+    if( oldnp )
+        {
+        CleanupStack::PushL( oldnp );
+        oldRect = oldnp->Rect();
+        CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidNavi ) );
+        newnp->SetContainerWindowL( *ctrl );
+        newnp->ConstructL();
+        newnp->SetRect( oldRect );
+        newnp->PushDefaultL();
+        newnp->ActivateL();
+        }
         
     CMultiCalUiDialog* multiCalUiDialog = CMultiCalUiDialog::NewLC( iCalEntryArray );
     errVal =  multiCalUiDialog->LaunchL();
     CleanupStack::PopAndDestroy( multiCalUiDialog );   
     
+    
+    // When setting is closed, swap back old titlepane and navipane
+   if( oldnp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidNavi), oldnp ) )
+       {
+       CleanupStack::Pop( oldnp );
+       delete newnp;
+       oldnp->ActivateL();
+       }
+
+   if( oldtp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), oldtp ) )
+       {
+       CleanupStack::Pop( oldtp );
+       delete newtp;
+       oldtp->ActivateL();
+       }
+    
     return errVal;
     
     TRACE_EXIT_POINT
--- a/calendarui/commonutils/bwins/calencommonutilsu.def	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/commonutils/bwins/calencommonutilsu.def	Sun Jun 20 22:55:39 2010 +0200
@@ -135,4 +135,5 @@
 	?SynchType@CCalenEntryUtil@@QBE?AW4TSynchType@1@XZ @ 134 NONAME ; enum CCalenEntryUtil::TSynchType CCalenEntryUtil::SynchType(void) const
 	?GetNextAvailableOffsetL@CCalenMultiCalUtil@@SAIXZ @ 135 NONAME ; unsigned int CCalenMultiCalUtil::GetNextAvailableOffsetL(void)
 	?GetNextAvailableCalFileL@CCalenMultiCalUtil@@SAPAVHBufC16@@XZ @ 136 NONAME ; class HBufC16 * CCalenMultiCalUtil::GetNextAvailableCalFileL(void)
-
+	?AttachmentOpen@CCalenAttachmentModel@@QAEXAAH@Z @ 137 NONAME ; void CCalenAttachmentModel::AttachmentOpen(int &)
+	?IsAttachmentOpen@CCalenAttachmentModel@@QAEHXZ @ 138 NONAME ; int CCalenAttachmentModel::IsAttachmentOpen(void)
--- a/calendarui/commonutils/eabi/calencommonutilsu.def	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/commonutils/eabi/calencommonutilsu.def	Sun Jun 20 22:55:39 2010 +0200
@@ -148,4 +148,6 @@
 	_ZTV21CCalenAttachmentModel @ 147 NONAME
 	_ZN18CCalenMultiCalUtil23GetNextAvailableOffsetLEv @ 148 NONAME
 	_ZN18CCalenMultiCalUtil24GetNextAvailableCalFileLEv @ 149 NONAME
+	_ZN21CCalenAttachmentModel14AttachmentOpenERi @ 150 NONAME
+	_ZN21CCalenAttachmentModel16IsAttachmentOpenEv @ 151 NONAME
 
--- a/calendarui/commonutils/inc/calenattachmentmodel.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/commonutils/inc/calenattachmentmodel.h	Sun Jun 20 22:55:39 2010 +0200
@@ -185,6 +185,22 @@
          */
         IMPORT_C void CheckForExistingAttachmentsL(CCalEntry* entry);
         
+        /**
+         * Set the flag to ETrue if the attachment(Photo, audio and vedio files) is open.
+         * 
+         * @param   aEmbeddedFileOpened, set to ETrue when attachment(Photo, audio and vedio files) is Open
+         * @return  None
+         */
+        IMPORT_C void AttachmentOpen(TBool& aEmbeddedFileOpened);
+        
+        /**
+         * return ETrue if the atacchment is opened.
+         * 
+         * @param   None
+         * @return  None
+         */
+        IMPORT_C TBool IsAttachmentOpen();
+        
     private:
 
         /**
@@ -230,6 +246,7 @@
         RApaLsSession iAppList;
         TSize iIconSize;
         TBool isAttachmentModelCleared; // Flag to tell if attachment model is reset. If yes, then only it will be populated again
+        TBool iEmbeddedFileOpened;
     };
 
 #endif // CALENATTACHMENTMODEL_H
--- a/calendarui/commonutils/src/CalenStatusPaneUtilsImpl.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/commonutils/src/CalenStatusPaneUtilsImpl.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -69,7 +69,7 @@
     {
     TRACE_ENTRY_POINT;
     
-    if( iNaviLabel != NULL )
+    if( ( iNaviLabel != NULL ) && ( iNaviContainer->Top() == iNaviLabel ) )
         {
         iNaviContainer->Pop( iNaviLabel );
         delete iNaviLabel;
--- a/calendarui/commonutils/src/calenattachmentmodel.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/commonutils/src/calenattachmentmodel.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -95,6 +95,7 @@
     {
     TRACE_ENTRY_POINT;
     isAttachmentModelCleared = ETrue;
+    iEmbeddedFileOpened = EFalse;
     TRACE_EXIT_POINT;
     }
 
@@ -612,8 +613,29 @@
 			}
 		}
 
-	TRACE_EXIT_POINT;
-	
+	TRACE_EXIT_POINT;	
 	}
 
+// ----------------------------------------------------------------------------
+// CCalenAttachmentModel::AttachmentOpen
+// Set the flag if the attachment(Photo, audio and vedio files) is open.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CCalenAttachmentModel::AttachmentOpen(TBool& aEmbeddedFileOpened)
+    {
+    TRACE_ENTRY_POINT
+    iEmbeddedFileOpened = aEmbeddedFileOpened;
+    TRACE_EXIT_POINT
+    }
+// ----------------------------------------------------------------------------
+// CCalenAttachmentModel::IsAttachmentOpen
+// return True if the atacchment is opened.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TBool CCalenAttachmentModel::IsAttachmentOpen()
+    {
+    TRACE_ENTRY_POINT
+    TRACE_EXIT_POINT
+    return iEmbeddedFileOpened;    
+    }
 // End of file	--Don't remove this.
--- a/calendarui/commonutils/src/calenentryutil.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/commonutils/src/calenentryutil.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -1015,7 +1015,7 @@
 
     if( aStartTime == CalenDateUtils::BeginningOfDay( aStartTime ) 
             && aStopTime == CalenDateUtils::BeginningOfDay( aStopTime ) 
-            && aStartTime != aStopTime && differenceInTime.Int() == 1) // fix for AllDayEntry issue
+            && aStartTime != aStopTime && differenceInTime.Int() >= 1) // fix for AllDayEntry issue
         {
         allDayEvent = ETrue;
         }
--- a/calendarui/commonutils/src/calenviewutils.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/commonutils/src/calenviewutils.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -215,7 +215,7 @@
         if( startLocalTime != stopLocalTime && 
                 startLocalTime == CalenDateUtils::BeginningOfDay( startLocalTime ) && 
                 stopLocalTime == CalenDateUtils::BeginningOfDay( stopLocalTime ) && 
-                startLocalTime != stopLocalTime && differenceInTime.Int() == 1 ) // fix for AllDayEntry issue
+                startLocalTime != stopLocalTime && differenceInTime.Int() >= 1 ) // fix for AllDayEntry issue
             {
             allDayEvent = ETrue;
             }
Binary file calendarui/conf/calendarUI.confml has changed
--- a/calendarui/controller/BWINS/calencontrolleru.def	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/BWINS/calencontrolleru.def	Sun Jun 20 22:55:39 2010 +0200
@@ -17,7 +17,7 @@
 	?RegisterForNotificationsL@CCalenController@@QAEXPAVMCalenNotificationHandler@@W4TCalenNotification@@@Z @ 16 NONAME ; void CCalenController::RegisterForNotificationsL(class MCalenNotificationHandler *, enum TCalenNotification)
 	?CreateOutOfRangeIconsL@CCalenIcons@@QBEPAVCAknIconArray@@XZ @ 17 NONAME ; class CAknIconArray * CCalenIcons::CreateOutOfRangeIconsL(void) const
 	?CreateMonthViewIconsL@CCalenIcons@@QBEPAVCAknIconArray@@XZ @ 18 NONAME ; class CAknIconArray * CCalenIcons::CreateMonthViewIconsL(void) const
-	?GetIconL@CCalenIcons@@QBEPAVCGulIcon@@W4TCalenIcons@MCalenServices@@@Z @ 19 NONAME ; class CGulIcon * CCalenIcons::GetIconL(enum MCalenServices::TCalenIcons) const
+	?GetIconL@CCalenIcons@@QBEPAVCGulIcon@@W4TCalenIcons@MCalenServices@@H@Z @ 19 NONAME ; class CGulIcon * CCalenIcons::GetIconL(enum MCalenServices::TCalenIcons, int) const
 	?CreateItemNotShownIconL@CCalenIcons@@QBEPAVCGulIcon@@XZ @ 20 NONAME ; class CGulIcon * CCalenIcons::CreateItemNotShownIconL(void) const
 	?RegisterForNotificationsL@CCalenController@@QAEXPAVMCalenNotificationHandler@@AAV?$RArray@W4TCalenNotification@@@@@Z @ 21 NONAME ; void CCalenController::RegisterForNotificationsL(class MCalenNotificationHandler *, class RArray<enum TCalenNotification> &)
 	?NewServicesL@CCalenController@@UAEPAVMCalenServices@@XZ @ 22 NONAME ; class MCalenServices * CCalenController::NewServicesL(void)
--- a/calendarui/controller/data/calencommonui.rss	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/data/calencommonui.rss	Sun Jun 20 22:55:39 2010 +0200
@@ -934,7 +934,7 @@
         MENU_ITEM
             {
             command = ECalenViewAttachmentCmdSave;
-            txt = qtn_cale_opt_save_attachment;
+           txt = qtn_cale_stylus_popup_save;
              //Single click
             flags = EEikMenuItemSpecific;
             },
@@ -946,7 +946,7 @@
         MENU_ITEM
             {
             command = ECalenViewAttachmentCmdRemove;
-            txt = qtn_cale_opt_remove_attachment;
+            txt = qtn_cale_stylus_popup_remove_attachment;
              //Single click 
             flags = EEikMenuItemSpecific;
             },
@@ -1113,5 +1113,47 @@
 RESOURCE TBUF r_qtn_cale_tb_custom_view 
     {
     buf = qtn_cale_opt_open;
-    }    
+    }  
+
+// ---------------------------------------------------------
+//      r_calen_multidb_editor_color_grid_dlg
+//      Color selection dialog with customized "none" text.
+// ---------------------------------------------------------
+//
+RESOURCE DIALOG r_calen_multidb_editor_color_grid_dlg
+    {
+    flags = EEikDialogFlagNotifyEsc | 
+            EEikDialogFlagCbaButtons | EEikDialogFlagNoDrag | 
+            EEikDialogFlagNoBorder;
+    buttons=R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EColourGridPopup;
+            control = AVKON_HEADING
+                {
+                label = qtn_select_colour_prompt;
+                headinglayout = R_AVKON_LIST_HEADING_PANE;
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtColourSelectionGridDialog;
+            id   = ECtrlGridType;
+            control = AVKON_COLOUR_SELECTION_GRID
+                {
+                nonetext = qtn_chat_set_colour_default;
+                gridcontrol = GRID
+                    {
+                    style = R_COLOUR_SEL_GRID_STYLE_NONE;
+                    flags = EEikDlgItemTakesEnterKey;
+                    height  = 4;
+                    width = 4 ;
+                    };
+                };
+            }
+        };
+    }
 // End of File
--- a/calendarui/controller/eabi/calencontrolleru.def	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/eabi/calencontrolleru.def	Sun Jun 20 22:55:39 2010 +0200
@@ -20,7 +20,7 @@
 	_ZNK11CCalenIcons22CreateOutOfRangeIconsLEv @ 19 NONAME
 	_ZNK11CCalenIcons23CreateItemNotShownIconLEv @ 20 NONAME
 	_ZNK11CCalenIcons27CreateDayWeekToDoViewIconsLEv @ 21 NONAME
-	_ZNK11CCalenIcons8GetIconLEN14MCalenServices11TCalenIconsE @ 22 NONAME
+	_ZNK11CCalenIcons8GetIconLEN14MCalenServices11TCalenIconsEi @ 22 NONAME
 	_ZTI11CCalenState @ 23 NONAME
 	_ZTI14CCalenActionUi @ 24 NONAME
 	_ZTI14CCalenMapState @ 25 NONAME
--- a/calendarui/controller/group/calencontroller.mmp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/group/calencontroller.mmp	Sun Jun 20 22:55:39 2010 +0200
@@ -54,7 +54,6 @@
 SOURCE          calencmdlineparser.cpp
 SOURCE          calencmdlinelauncher.cpp
 SOURCE          calencontroller.cpp
-SOURCE          calendbchangenotifier.cpp
 SOURCE          calendebug.cpp
 SOURCE          calendeleteui.cpp
 SOURCE          caleneditui.cpp
@@ -97,6 +96,7 @@
 SOURCE          calenattalistitemarray.cpp
 SOURCE          calenattachmentitemdrawer.cpp
 SOURCE          calenattachmentui.cpp
+SOURCE          calendialogshutter.cpp
 
 
 LIBRARY         calencustomisationmanager.lib
--- a/calendarui/controller/inc/calencmdlinelauncher.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/inc/calencmdlinelauncher.h	Sun Jun 20 22:55:39 2010 +0200
@@ -31,6 +31,7 @@
 class CCalenController;
 class CCalenGlobalData;
 class CAknViewAppUi;
+class CCalenDialogShutter;
 
 // CLASS DEFINITIONS
 
@@ -145,6 +146,7 @@
         
         TBool iDelayCallBack;
         CAknViewAppUi& iAppUi;
+        CCalenDialogShutter* iShutter;
     };
 
 #endif // CALENCMDLINELAUNCHER_H
--- a/calendarui/controller/inc/calencontroller.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/inc/calencontroller.h	Sun Jun 20 22:55:39 2010 +0200
@@ -254,7 +254,7 @@
          * Get calendar icon of specific type
          * @return CGulIcon*
          */
-        CGulIcon* GetIconL(MCalenServices::TCalenIcons aIndex);
+		CGulIcon* GetIconL(MCalenServices::TCalenIcons aIndex, const TInt aViewId = 0 ); 
 
         /* Get multipledb manager
         * @return reference to CCalenMultipleDbManager
@@ -330,6 +330,23 @@
         void GetAllCalendarInfoL( 
                     RPointerArray<CCalCalendarInfo>& aCalendarInfoList );
         
+        /**
+         * @brief sets the flag if the calendar application is launched
+         *  from external application.
+         * 
+         * @param aFlag The flag to be set.
+         */
+        void SetLaunchFromExternalApp( TBool aFlag );
+        
+        /**
+         * @brief Checks whether the calendar application is launched
+         * from external application.
+         * 
+         * @return ETrue If the calendar application is launched from
+         * external application else EFalse.
+         */
+        TBool IsLaunchFromExternalApp();
+        
     private:  // Construction and destruction
         /**
          * C++ constructor
@@ -416,6 +433,7 @@
         TInt iResourceFileOffset;
         CAsyncCallBack* iSystemTimeChangedMsgDelayer;   
         TBool iFasterApp;
+        TBool iLaunchFromExternalApp;
     };
 
 #endif // CALENCONTROLLER_H
--- a/calendarui/controller/inc/calendbchangenotifier.h	Sun Jun 20 22:50:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Notifies observers of external changes to the calendar database
-*
-*/
-
-
-#ifndef __CALENDBCHANGENOTIFIER_H
-#define __CALENDBCHANGENOTIFIER_H
-
-//  INCLUDES
-#include <e32base.h>
-
-#include <calchangecallback.h>      //MCalChangeCallBack
-
-// FORWARD DECLARATIONS
-class CCalSession;                  //Calendar session
-class CCalenGlobalData;             //Calendar global data
-
-// CLASS DECLARATION
-
-/**
-* Observer class for database changes.  Forwards callback from 
-* MCalChangeCallBack2
-*/
-class MCalenDBChangeObserver
-    {
-    public:
-        virtual void HandleDBChangeL() = 0;
-    };
-
-/**
-*  CCalenDbChangeNotifier buffers notifications from MCalChangeCallBack2 and 
-*  only notifies its observers after a set period has elapsed.  This prevents
-*  Calendar views refreshing more often than necessary during a sync operation
-*/
-NONSHARABLE_CLASS(CCalenDbChangeNotifier) : public CActive,
-                                                                  public MCalChangeCallBack2
-    {
-    public:  // Constructors and destructor
-        /**
-        * Constructor.
-        * @param aGlobalData global data reference
-        * @return a pointer to the new CCalenDbChangeNotifier instance
-        */
-        static CCalenDbChangeNotifier* NewL( CCalenGlobalData& aGlobalData );
-
-       /**
-        * Destructor.
-        */
-        ~CCalenDbChangeNotifier();
-        
-    public:
-        /**
-        * Allow CCalenViews to register for database change notifications
-        * @param aDBObserver Observer to register
-        */
-        void RegisterObserverL( MCalenDBChangeObserver& aDBObserver );
-        
-        /**
-        * Allow CCalenViews to deregister for database change notifications
-        * @param aDBObserver Observer to deregister
-        */
-        void DeRegisterObserverL( MCalenDBChangeObserver& aDBObserver );
-        
-        /**
-        * Returns the time of the last call to MCalChangeCallBack2::CalChangeNotification
-        * This is not necessarily the same time as the last notification issued by 
-        * this class
-        * @return Time of the last database modification as TTime
-        */
-        TTime LastDBModificationTime() const;
-        
-    public: 
-        /**
-        * From MCalChangeCallBack2
-        * Called when the calendar database is changed through another
-        * CCalSession
-        * @param aChangeItems array of database items changed 
-        */
-        void CalChangeNotification( RArray<TCalChangeEntry>& aChangeItems );
-
-    private:
-        /**
-        * C++ default constructor.
-        * @param aGlobalData global data reference
-        */
-        CCalenDbChangeNotifier( CCalenGlobalData& aGlobalData );
-
-        /**
-        * By default Symbian 2nd phase constructor is private.
-        * Performs any construction which may leave
-        */
-        void ConstructL();
-
-        /**
-        * From CActive
-        * Called when outstanding asynchronous request completes
-        * This will be called when iNotificationTimer either completes
-        * or is cancelled
-        */
-        void RunL();
-        
-        /**
-        * From CActive
-        * Called by the active scheduler if RunL leaves
-        * Ensures we are ready to receive the next database event
-        * @param aError System wide error code
-        */
-        TInt RunError( TInt aError );
-
-        /**
-        * From CActive
-        * Implements cancellation of outstanding asynchronous requests
-        * Cancels iNotificationTimer if started
-        */
-        void DoCancel();
-
-    private:    // Data
-        CCalenGlobalData& iGlobalData;
-        
-        //Database change observer filter
-        CCalChangeNotificationFilter* iCalChangeFilter;      
-        
-        //Observer array
-        RPointerArray<MCalenDBChangeObserver> iDBObservers;
-        
-        //Timer to limit the amount of notifications issued by this class
-        RTimer iNotificationTimer;
-        
-        //The time of the last received notification
-        TTime iLastDbChangeNotification;
-        
-        //Flag to restart the timer after cancelling last tiemr request
-        TBool iRestartTimer;
-    };
-
-#endif      // __CALENDBCHANGENOTIFIER_H
-
-// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/calendarui/controller/inc/calendialogshutter.h	Sun Jun 20 22:55:39 2010 +0200
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   For dialog shutter.
+*
+*/
+
+
+#ifndef CALENDIALOGSHUTTER_H
+#define CALENDIALOGSHUTTER_H
+
+#include <e32base.h>	// For CActive, link against: euser.lib
+#include <e32std.h>		// For RTimer, link against: euser.lib
+
+// FORWARD DECLARATIONS
+class CEikonEnv;
+
+// CLASS DEFINITIONS
+/**
+ * The CCalenDialogShutter closes all open dialogs when calendar is opened from widget  
+ */
+NONSHARABLE_CLASS( CCalenDialogShutter ): public CActive
+    {
+public:    
+
+    /**
+    * 1st phase constructor
+    * @param aEikEnv CEikonEnv pointer
+    */
+    static CCalenDialogShutter* NewL( CEikonEnv* aEikEnv );
+
+    /**
+    * 2nd phase constructor
+    * @param aEikEnv CEikonEnv pointer
+    */
+    static CCalenDialogShutter* NewLC( CEikonEnv* aEikEnv );
+    
+    /**
+    * Destructor    
+    */
+    ~CCalenDialogShutter();
+
+public:
+    // New functions    
+    /**
+    * Function for making the initial request  
+    */
+    void ShutDialogsL( /*CActiveSchedulerWait* aWait*/ );
+
+private:   
+    /**
+    * C++ constructor
+    * @param aEikEnv CEikonEnv pointer
+    */
+    CCalenDialogShutter( CEikonEnv* aEikEnv );
+   
+    /**
+    * Second-phase constructor
+    */
+    void ConstructL();
+
+private:
+    // From CActive    
+    /**
+    * Handle completion
+    */
+    void RunL();
+  
+    /**
+    * Cancel method to handle the user selection
+    */
+    void DoCancel();
+    
+    /**
+    * Override to handle leaves from RunL(). Default implementation causes the active scheduler to panic.
+    */
+    TInt RunError(TInt aError);
+    
+private:
+    
+    /**
+    * Function to queue the async requests 
+    */
+    void Queue();
+    
+    /**
+    * Function to get the startlevel of the opened dialogs
+    */
+    TInt StartLevel();
+   
+    
+private:
+    // Ref: environment
+    CEikonEnv* iEikon; 
+    
+    TInt iStartLevel;
+    
+    TInt iCount;
+
+    };
+
+class CKludgeScheduler : public CBaActiveScheduler
+    {
+public:
+    inline TInt PublicLevel() const { return Level(); }
+    };
+
+#endif // CALENDIALOGSHUTTER_H
--- a/calendarui/controller/inc/calenicons.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/inc/calenicons.h	Sun Jun 20 22:55:39 2010 +0200
@@ -94,7 +94,7 @@
      * @param aIndex An index to the enum TCalenIcons
      * @return a pointer to CGulIcon
      */
-    IMPORT_C CGulIcon* GetIconL( MCalenServices::TCalenIcons aIndex) const;
+    IMPORT_C CGulIcon* GetIconL( MCalenServices::TCalenIcons aIndex, const TInt aViewId = 0 ) const;
 
 private:
     /**
--- a/calendarui/controller/inc/calenmultidbeditor.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/inc/calenmultidbeditor.h	Sun Jun 20 22:55:39 2010 +0200
@@ -23,11 +23,15 @@
 //  INCLUDES
 #include <AknForm.h>
 #include <gdi.h>
+#include <calennotificationhandler.h>
 
 class CalenAppUi;
 class CAknNavigationControlContainer;
 class CCalenController;
 class CCalCalendarInfo;
+class CCalenMultipleDbUi;
+class CCalenColourSelectionGrid;
+
 
 /**
 * Class defining Map icon picture, derived from CPicture
@@ -104,8 +108,9 @@
     /**
      * Two-phased constructor.
      */
-    static CCalenMultiDBEditor* NewL( CCalCalendarInfo& aCalendarInfo,
-            CCalenController& aController, TBool aEditFlag);
+    static CCalenMultiDBEditor* NewL(CCalenMultipleDbUi& aMultipleDbui,
+                                    CCalCalendarInfo& aCalendarInfo,
+                                    CCalenController& aController, TBool aEditFlag);
 
     /**
      * From Base class.
@@ -124,8 +129,9 @@
     /**
      * C++ constructor.
      */
-    CCalenMultiDBEditor( CCalCalendarInfo&  aCalendarInfo,
-            CCalenController& aController, TBool aEditFlag);
+    CCalenMultiDBEditor(CCalenMultipleDbUi& aMultipleDbui,
+                        CCalCalendarInfo&  aCalendarInfo,
+                        CCalenController& aController, TBool aEditFlag);
 
     
 protected:  // Functions from base classes
@@ -159,9 +165,12 @@
      */
 	void ReadDataFromFormL( TBool aContinueOnError );
 	
-	
+	void HandleDialogPageEventL( TInt aEventID );
 	
-	void HandleDialogPageEventL( TInt aEventID );
+	/*
+	 * from CAknDialog
+	 */
+	void FocusChanged(TDrawNow aDrawNow);
 	
 private:
 
@@ -234,6 +243,11 @@
 	*/
 	void SetVisiblityFieldL( TBool aStatusVal );
 	
+	/*
+	 * Load colors for grid
+	 */
+	void LoadColorsL();
+	
 	/**
 	* setup title pane for the status pane
 	* @return void 
@@ -241,6 +255,14 @@
 	void SetTitlePaneL();  
 	
     void SetSyncFieldL( TBool aSyncVal );
+    
+    /**
+     * @breif Checks if the Flash File System storage will fall below
+     *        Critical Level. Warning will be displayed if storage
+     *        is below Critical Level.
+     * @return ETrue : Below critical level
+     */
+    TBool CheckSpaceBelowCriticalLevelL();
  protected:
 
 	/**
@@ -271,13 +293,18 @@
     CCalenController& iController;
     TInt iColVal;		// Color id
     TBool iCalendarStatus;
-    TRgb iColors;
     CDbColorPicture* iPicture;
     TBool iEditFlag;
     CAknNavigationControlContainer*   iNaviContainer;
     //Sync field, EFalse then Sync off else Sync On
     TBool                             iSyncStatus;
     TCalendarConflicts                iConflict;
+    
+    CCalenMultipleDbUi&               iMultipleDbUi;
+	 
+	CArrayFixFlat<TRgb>*              iRgbColors;
+    TBool                             iNoneChoosen;
+    TRgb                              iChoosenColor;
     };
 
 #endif // CALENMULTIDBEDITOR_H
--- a/calendarui/controller/inc/calenmultipledbui.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/inc/calenmultipledbui.h	Sun Jun 20 22:55:39 2010 +0200
@@ -245,10 +245,23 @@
                 CCalCalendarInfo& aCalendarInfoModified);
     
     /*
-     * Async exit for the dialog
+     * Callback for CAsyncCallBack class
+     * @param aThisPtr* this pointer.
+     * @return TInt status.
      */
-    static TInt DoAsyncExit(TAny* aPtr);
+    static TInt AsyncCallBackL(TAny* aThisPtr);
+    
+    /*
+     * Async method to handle all async commnds
+     * @param aCommand Async command
+     */
+    void HandleAsyncCommandL(const TInt aCommand);
 
+    /*
+     * Async method to handle all async commnds
+     * @param aCommand Async command
+     */
+    void DoAsyncActionL(const TInt aCommand);
 
     /*
      * @brief Creates button for the toolbar.
@@ -275,6 +288,12 @@
      * Refocus the items in list when delete action happened. 
      */
     void ReAdjustListItemFocusL(const TInt aCurrentIndex);
+    
+    /**
+     * From CCoeControl Gets help context
+     * @param aContext Help context
+     */
+    void GetHelpContext(TCoeHelpContext& aContext) const;
 
 public:  // from MCalenNotificationHandler
 	/** 
@@ -292,7 +311,21 @@
     *                   may be obtained by accessing the list box itself.
     */
     void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
-
+    
+public:
+    
+    /*
+     * Updates after add/edit had been performed.
+     * Called from editor before exiting the dialog.
+     * @param aItemAdded ETure if add else edit.
+     */
+    void UpdateOnAddOrEditL(TBool aItemAdded);
+    
+    /*
+     * Exit the dialog;
+     */
+    void ExitDialogL();
+    
 private:
     CCalenMultipleDbListbox* iListBox;
     CAknsBasicBackgroundControlContext* iBgContext; //Owns
@@ -300,16 +333,20 @@
     CCalenController& iController;
     CDesCArrayFlat* iDesArray; //Owns
     TRect iRect;
-    TBool iFirstTap;
-    TBool iDialogLaunched;
     RArray<MCalenServices::TCalenIcons> iIconIndices;
     CAknIconArray* iIconList;
     RArray<TInt32> iColorUidArray;
-    CAsyncCallBack* iAsyncExit;
-    TInt iAsyncExitCmd;
     CCalenMultiDBEditor* iDbEditor;//Not not owned
     TBool iConflictOccured;
     TBool iIsDbEditorOpen ; 
+    
+    CCalCalendarInfo* iCalendarInfoNew;
+    CCalCalendarInfo* iCalendarInfoOriginal;
+    CCalCalendarInfo* iCalendarInfoEdited;
+    
+    CAsyncCallBack*  iAsyncAction;
+    TInt             iAsyncActionCmd;
+    TInt             iCurrentIndex;
     };
 
 
--- a/calendarui/controller/inc/calennotifier.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/inc/calennotifier.h	Sun Jun 20 22:55:39 2010 +0200
@@ -34,7 +34,6 @@
 // FORWARD DECLARATIONS
 class CCalenGlobalData;                 // Calendar global data singleton
 class CEnvironmentChangeNotifier;       // Receive system event notifications
-class CCalenDbChangeNotifier;           // Receive database change notifications
 class CCalenEComWatcher;                // Receives Ecom registry change notifications
 class CCalenSetting;                    // Calendar settings
 class CCalenController;
@@ -251,7 +250,6 @@
         RArray<TCalenNotification> iBroadcastQueue;
         TBool iBroadcastActive;
 
-        CCalenDbChangeNotifier* iDbChangeNotifier;
         CCalenSetting* iSetting;
         TBool iIsSettingsBroadcastDeferred;
         TBool iSettingsNeedsBroadcast;
--- a/calendarui/controller/inc/calenservicesimpl.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/inc/calenservicesimpl.h	Sun Jun 20 22:55:39 2010 +0200
@@ -117,7 +117,7 @@
 	 * Get calendar icon of specific type
 	 * @return CGulIcon*
 	 */
-	CGulIcon* GetIconL( MCalenServices::TCalenIcons aIndex );
+	CGulIcon* GetIconL( MCalenServices::TCalenIcons aIndex, const TInt aViewId = 0 ); 
 
 	/**
 	 * Register for notifications of Calendar events
--- a/calendarui/controller/inc/calentoolbarimpl.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/inc/calentoolbarimpl.h	Sun Jun 20 22:55:39 2010 +0200
@@ -140,6 +140,11 @@
          */
         void ResetToolbarExtensionCommandsL();
         
+        inline TBool IsICalenToolBar()
+            {
+            return iCalenToolbar ? ETrue : EFalse;
+            }
+        
     private:
 
         /**
--- a/calendarui/controller/inc/calenviewattachmentsdialog.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/inc/calenviewattachmentsdialog.h	Sun Jun 20 22:55:39 2010 +0200
@@ -370,6 +370,7 @@
         CCalenController&               iController;
         CDocumentHandler*               iDocHandler; 
         const TDesC&                    iNewTitle;
+        TBool                           iEmbeddedFileOpened;
         
         
         // Internal status flags
--- a/calendarui/controller/inc/calenviewmanager.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/inc/calenviewmanager.h	Sun Jun 20 22:55:39 2010 +0200
@@ -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
 
         /**
@@ -379,6 +385,7 @@
         TBool iViewsActivated; 
         TVwsViewId  iPreviousViewId;
         TVwsViewId  iPreviousToDayView;
+        TVwsViewId iPreviousToWeekView;
         TBool iAvoidRepopulation;
         TBool iStartupComplete;
     };
--- a/calendarui/controller/src/calenactionui.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenactionui.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -37,6 +37,8 @@
 #include "calennotifier.h"
 #include "calenmultipledbui.h"
 #include "calenattachmentui.h"
+#include "CalenUid.h"
+#include "calenviewmanager.h"
 
 // ----------------------------------------------------------------------------
 // CCalenActionUi::NewL
@@ -304,8 +306,9 @@
         PIM_TRAPD_HANDLE( retValue = dlg->ExecuteLD( R_CALEN_MULTIPLEDB_DIALOG ) );
         notifier.ResumeSettingsNotifications();
         
-        // Unhide the toolbar when settings is closed
-        if(toolbar)
+        // Unhide the toolbar when manage calendar view is closed
+        TUid activeViewUid = iController.ViewManager().CurrentView();
+        if(toolbar && (activeViewUid != KUidCalenMissedAlarmsView ) &&(activeViewUid != KUidCalenMissedEventView ) )
             {
             toolbar->SetToolbarVisibilityL(ETrue); 
             }
@@ -414,7 +417,8 @@
     notifier.ResumeSettingsNotifications();
     
     // Unhide the toolbar when settings is closed
-    if(toolbar)
+    TUid activeViewUid = iController.ViewManager().CurrentView();
+    if(toolbar && (activeViewUid != KUidCalenMissedAlarmsView ) &&(activeViewUid != KUidCalenMissedEventView ) )
         {
         toolbar->SetToolbarVisibilityL(ETrue); 
         }
--- a/calendarui/controller/src/calenalarmmanager.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenalarmmanager.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -46,6 +46,7 @@
 #include "calensetting.h"
 #include "calencontextfwlistener.h"
 #include "CleanupResetAndDestroy.h"
+#include "calenattachmentmodel.h"
 
 static const TUint32 KMaxMissedAlarms = 10;
 
@@ -178,6 +179,7 @@
             break;
         case ECalenMissedAlarmsViewFromIdle:
             {
+            RemoveAllViewedEventsL();
             iViewManager.StartActiveStepL();
             }
             break;
@@ -189,9 +191,13 @@
             break;
         case ECalenEventViewFromAlarm:
             {
-            LaunchEventViewerL();
-            iViewManager.SetRepopulation(EFalse);
-            iController.ViewManager().RequestActivationL( KUidCalenEventView, KUidCalenShowAlarmCba );
+            TBool attachmentOpened = iController.Services().GetAttachmentData()->IsAttachmentOpen();
+            if(!attachmentOpened)
+                {
+                LaunchEventViewerL();
+                iViewManager.SetRepopulation(EFalse);
+                iController.ViewManager().RequestActivationL( KUidCalenEventView, KUidCalenShowAlarmCba );
+                }
             }
             break;
         case ECalenEventViewFromAlarmStopOnly:
@@ -572,11 +578,8 @@
     TInt missedAlarmEntryUid = context.InstanceId().iEntryLocalUid;
     TCalCollectionId colid = context.InstanceId().iColId;
     // clear missed alarm from cenrep
-    if( EFalse == ClearOneMissedAlarmL( missedAlarmEntryUid, colid ) )
-        {
-        TRACE_EXIT_POINT;
-        return;
-        }
+    
+    ClearOneMissedAlarmL( missedAlarmEntryUid, colid );
     for(TInt index = 0;index < iMissedAlarmList.Count();index++)
         {
         if( ( missedAlarmEntryUid == iMissedAlarmList[index].iEntryLocalUid ) &&
@@ -677,8 +680,9 @@
     TCalenInstanceId id = TCalenInstanceId::CreateL( *entry, inscaltime );
     id.iColId = session.CollectionIdL();
     context.SetInstanceIdL( id, context.ViewId() ); 
-		CleanupStack::PopAndDestroy( entry );
-    iMissedAlarmStore->RemoveL(*aMissedAlarmArray[0]);
+	CleanupStack::PopAndDestroy( entry );
+	iMissedAlarmList.Remove(0); //Clear the alarm list
+	iMissedAlarmStore->RemoveL(*aMissedAlarmArray[0]);
     CleanupStack::PopAndDestroy(); // aMissedAlarmArray
     
     iViewManager.StartActiveStepL();
@@ -862,10 +866,12 @@
     // get the context
     MCalenContext &context = iController.Services().Context();
     TInt missedAlarmEntryUid = context.InstanceId().iEntryLocalUid;
+    TCalCollectionId colid = context.InstanceId().iColId;
     
     for(TInt index = 0;index < iMissedAlarmList.Count();index++)
         {
-        if(missedAlarmEntryUid == iMissedAlarmList[index].iEntryLocalUid )
+        if((missedAlarmEntryUid == iMissedAlarmList[index].iEntryLocalUid ) && 
+            (colid == iMissedAlarmList[index].iColId))
             {
             // mark the missed alarm event as viewed 
             iMissedAlarmList[index].iInstanceViewed = 1;
@@ -889,6 +895,7 @@
         {
         if(iMissedAlarmList[index].iInstanceViewed)
             {
+            ClearOneMissedAlarmL( iMissedAlarmList[index].iEntryLocalUid, iMissedAlarmList[index].iColId );
             iMissedAlarmList.Remove(index);
             }
         else
@@ -987,8 +994,7 @@
     TRACE_ENTRY_POINT;
     // get the context
     MCalenContext &context = iController.Services().Context();
-    TInt deletedEntryUid = context.InstanceId().iEntryLocalUid;
-    
+    TInt deletedEntryUid = context.InstanceId().iEntryLocalUid;    
     TCalCollectionId colidFromContext = context.InstanceId().iColId;
     
     if( EFalse == ClearOneMissedAlarmL( deletedEntryUid, colidFromContext ) )
@@ -1161,9 +1167,11 @@
     else if( iPreviousToEventViewUid!=KNullUid && 
             ( iPreviousToEventViewUid!= KUidCalenEventView || iPreviousToEventViewUid != KUidCalenMissedEventView ) )
         {
+        iViewManager.SetRepopulation(EFalse);
         TVwsViewId previousViewId(KUidCalendar, iPreviousToEventViewUid) ;
         iController.ViewManager().RequestActivationL(previousViewId);
         iPreviousToEventViewUid = KNullUid;
+        iViewManager.SetRepopulation(ETrue);
         }
 	else
 		{
--- a/calendarui/controller/src/calenattachmentui.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenattachmentui.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -45,8 +45,6 @@
 #include "CleanupResetAndDestroy.h"
 #include "calenviewmanager.h"
 
-//_LIT16( KTextDataType, ".txt" );
-const TInt KCalenAttachmentOverhead = 1024;
 
 // ----------------------------------------------------------------------------
 // CCalenAttachmentUi::NewL
@@ -443,6 +441,7 @@
         if( KErrNone != err )
             {
             // if any error in opening file then return EFalse
+            CleanupStack::PopAndDestroy(filename);
             return EFalse;
             }
         
@@ -675,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);
                     }
                 }
                         
@@ -745,7 +752,8 @@
 
     // Hide the toolbar before we display settings menu
     MCalenToolbar* toolbar = iController.Services().ToolbarOrNull();
-    if(toolbar&&toolbar->IsVisible())
+   
+    if(toolbar&&toolbar->IsVisible()&& !iController.IsEditorActive())
         {
         toolbar->SetToolbarVisibilityL(EFalse); 
         iShowToolbar = ETrue;
@@ -846,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	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenbackgroundstate.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -102,6 +102,9 @@
     switch( cmd )
         {
         case ECalenDayView:
+        case ECalenTodoView:
+        case ECalenMonthView:
+        case ECalenWeekView:
             SetCurrentState(aStateMachine,CCalenStateMachine::ECalenIdleState);
             cmdUsed = ETrue;
             break;
@@ -136,7 +139,8 @@
         	       || iPreviousState == CCalenStateMachine::ECalenEditingState
         	       || iPreviousState == CCalenStateMachine::ECalenSendingState 
         	       || iPreviousState == CCalenStateMachine::ECalenIdleState 
-                   || iPreviousState == CCalenStateMachine::ECalenViewingState)
+                   || iPreviousState == CCalenStateMachine::ECalenViewingState
+                   || iPreviousState == CCalenStateMachine::ECalenAttachmentState)
         	    {
                 SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState );
                 ActivateCurrentStateL(aStateMachine);
--- a/calendarui/controller/src/calencmdlinelauncher.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calencmdlinelauncher.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -27,12 +27,14 @@
 #include <caleninstanceid.h>            // TCalenInstanceId
 #include <calenactionuiutils.h>
 #include <aknappui.h>
+#include <AknDlgShut.h> 
 #include "calenviewmanager.h"
 #include "calencmdlinelauncher.h"
 #include "calencontroller.h"            // CCalenController
 #include "calencmdlineparser.h"         // CCalCmdLineParser
 #include "CalenUid.h"
 #include "calensend.h"
+#include "calendialogshutter.h"
 
 // ================= MEMBER FUNCTIONS =======================
 
@@ -91,6 +93,12 @@
         }
 
     delete iCalendarLaunchCallBack;
+    
+    if ( iShutter )
+        {
+        delete iShutter;
+        iShutter = NULL;
+        }
 
     TRACE_EXIT_POINT;
     }
@@ -118,7 +126,7 @@
     iController.RegisterForNotificationsL( this, exitFlags );
     
     exitFlags.Reset();
-
+    iShutter = CCalenDialogShutter::NewL( CEikonEnv::Static() );
     TRACE_EXIT_POINT;
     }
 
@@ -146,40 +154,28 @@
         // using the same 'try and save whatever we can' logic that is used on a forced close
         // and then open the new editor.  We also have to prevent the focus state being updated
         // and highlighting the old entry in the day view.
-        while( AppUi().IsDisplayingDialog() )
+        if( AppUi().IsDisplayingDialog() )
             {
             iIsExitOnDlgClose = EFalse;
             // Tell the editui that whatever it was doing, it should not alter
             // the focus state
             iController.IssueCommandL( ECalenNotifyFocusChange );
-
-            // Send a key event to the currently open dialog (viewer / editor)
-            // to dismiss it
-            TKeyEvent key;
-            key.iRepeats = 0;
-            key.iCode = EKeyEscape;
-            key.iModifiers = 0;
-            CCoeEnv::Static()->SimulateKeyEventL( key, EEventKey );
             
-            // Break is added to close the messaging editor as the messagng editor is not 
-            // consuming the escape key event.
-            if( iGlobalData->CalenSendL().IsMessagingEditorOpen() )
-                {
-            break;
-                }
-                 
+            iShutter->Cancel();
+            //close all open dialogs in asynchronous way
+            iShutter->ShutDialogsL();
             }
 
         // Interpret 8bit data as 16bit unicode data
         //lint -e{826} Disable the lint warning of the pointer sizes being different
-        const TText* buf = reinterpret_cast<const TText*>(aTail.Ptr());
+        const TText* buf = reinterpret_cast<const TText*> (aTail.Ptr());
         TPtrC ptr(buf, aTail.Length() / (TInt) sizeof(TText));
 
         // create cmd line parser
         CCalenCmdLineParser* parser = CCalenCmdLineParser::NewL();
-        CleanupStack::PushL( parser );
+        CleanupStack::PushL(parser);
         // parse parameters
-        parser->ParseCommandLineL( ptr );
+        parser->ParseCommandLineL(ptr);
         iCmdParameters = parser->CommandLineParameters();
         CleanupStack::PopAndDestroy(); // parser
         }
@@ -257,12 +253,15 @@
             if( iController.ViewManager().ViewsActivated() )
                 {
                 iController.IssueCommandL( command );
+                iController.SetLaunchFromExternalApp( ETrue );
                 }
             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;
             
@@ -507,6 +506,12 @@
 			    }
 			}
 		}
+	else if(iIsExitOnDlgClose && (aNotification == ECalenNotifyDialogClosed) )
+	    {
+            //dont do any thing
+            //This scenario hits, when the application launched from device search application,
+            //User issued a "Cancel" command while adding attachment. 
+	    }
     else if(aNotification == ECalenNotifyEntryClosed)
     	{
         // Exit when Escape pressed in Eventview
--- a/calendarui/controller/src/calencontroller.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calencontroller.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -163,7 +163,7 @@
     iNotifier = new( ELeave )CCalenNotifier( *this );
 
     // Get an instance of the global data
-    iGlobalData = CCalenGlobalData::NewL( *iNotifier, iNotifier );
+    iGlobalData = CCalenGlobalData::NewL( *iNotifier, iNotifier, iNotifier );
     iGlobalData->InitializeGlobalDataL();
     
     RArray<TCalenNotification> notificationArray;
@@ -212,6 +212,7 @@
     notificationArray.Append(ECalenNotifySystemTimeChanged);
     notificationArray.Append(ECalenNotifyAppForegrounded);
     notificationArray.Append(ECalenNotifyDayViewClosed);
+    notificationArray.Append(ECalenNotifyWeekViewClosed);
     notificationArray.Append(ECalenNotifyAppBackgrounded);
     notificationArray.Append(ECalenNotifyViewPopulationComplete);
     notificationArray.Append(ECalenNotifyCalendarFieldChanged);
@@ -982,7 +983,7 @@
 // Get icon of specific type
 // ----------------------------------------------------------------------------
 //
-CGulIcon* CCalenController::GetIconL( MCalenServices::TCalenIcons aIndex )
+CGulIcon* CCalenController::GetIconL( MCalenServices::TCalenIcons aIndex, const TInt aViewId ) 
     {
     TRACE_ENTRY_POINT;
     
@@ -993,7 +994,7 @@
         }
     
     TRACE_EXIT_POINT;
-    return iViewManager->IconsL().GetIconL(aIndex);
+    return iViewManager->IconsL().GetIconL(aIndex,aViewId);
     }
 
 // ----------------------------------------------------------------------------
@@ -1133,5 +1134,33 @@
     iGlobalData->GetAllCalendarInfoL(aCalendarInfoList);
     TRACE_EXIT_POINT;
     }
+
+// -----------------------------------------------------------------------------
+// CCalenController::SetLaunchFromExternalApp
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCalenController::SetLaunchFromExternalApp( TBool aFlag )
+    {
+    TRACE_ENTRY_POINT;
+    
+    iLaunchFromExternalApp = aFlag;
+    TRACE_EXIT_POINT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCalenController::SetLaunchFromExternalApp
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCalenController::IsLaunchFromExternalApp()
+    {
+    TRACE_ENTRY_POINT;
+    TRACE_EXIT_POINT;
+    
+    return iLaunchFromExternalApp;
+    }
 // End of file
 
--- a/calendarui/controller/src/calendbchangenotifier.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,287 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:   Notifies observers of external changes to the calendar database
-*
-*/
-
-
-
-//debug
-#include "calendarui_debug.h"
-
-// INCLUDE FILES
-#include "calendbchangenotifier.h"    // CCalenDbChangeNotifier
-#include "calenglobaldata.h"            // Calendar global data
-#include <calsession.h>                 // CalSession
-
-// -----------------------------------------------------------------------------
-// KTimerResolution limits the number of notifications sent to registered
-// MCalenDBChangeObserver instances.  Notifications may come from 
-// MCalChangeCallBack2 at a very high rate which could impact performance, 
-// for example by causing constant view refreshes.
-// CCalenDbChangeNotifier notifies observers when KTimerResolution has elapsed
-// since the last notification was received from MCalChangeCallBack2
-// -----------------------------------------------------------------------------
-const TInt KTimerResolution = 1000000;  // 1 Second
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CCalenDbChangeNotifier::CCalenDbChangeNotifier
-// C++ default constructor can NOT contain any code, that might leave.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-CCalenDbChangeNotifier::CCalenDbChangeNotifier( CCalenGlobalData& aGlobalData ) 
-    : CActive( EPriorityNormal ),
-      iGlobalData( aGlobalData )
-    {
-    TRACE_ENTRY_POINT;
-
-    iRestartTimer = EFalse;
-
-    TRACE_EXIT_POINT;
-    }
-
-// -----------------------------------------------------------------------------
-// CCalenDbChangeNotifier::NewL
-// Two-phased constructor.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-CCalenDbChangeNotifier* CCalenDbChangeNotifier::NewL( CCalenGlobalData& aGlobalData )
-    {
-    TRACE_ENTRY_POINT;
-
-    CCalenDbChangeNotifier* self = new( ELeave ) CCalenDbChangeNotifier( aGlobalData );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-
-    TRACE_EXIT_POINT;
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// CCalenDbChangeNotifier::ConstructL
-// Symbian 2nd phase constructor can leave.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-void CCalenDbChangeNotifier::ConstructL()
-    {
-    TRACE_ENTRY_POINT;
-
-    // We want to receive notifications for the full agenda date range
-    TCalTime start, end;
-    start.SetTimeUtcL( TCalTime::MinTime() );
-    end.SetTimeUtcL( TCalTime::MaxTime() );
-    CalCommon::TCalTimeRange range( start, end ); 
-
-    // Create a notification filter
-    iCalChangeFilter = CCalChangeNotificationFilter::NewL(
-                                                        MCalChangeCallBack2::EChangeEntryAll, 
-                                                        ETrue, 
-                                                        range );
-
-    // Enable database change notifications on current global data session
-    iGlobalData.CalSessionL().StartChangeNotification( *this, *iCalChangeFilter );
-
-    // Create a timer to limit the number of notifications broadcast
-    iNotificationTimer.CreateLocal();
-
-    // Active object, add to active scheduler
-    CActiveScheduler::Add( this );
-
-    TRACE_EXIT_POINT;
-    }
-
-// -----------------------------------------------------------------------------
-// CCalenDbChangeNotifier::~CCalenDbChangeNotifier
-// Destructor
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-CCalenDbChangeNotifier::~CCalenDbChangeNotifier()
-    {
-    TRACE_ENTRY_POINT;
-
-    Cancel();
-    // Reset the observer array.  Array contents are NOT owned by this class
-    iDBObservers.Reset();
-
-    iNotificationTimer.Close();
-
-    // Disable database change notifications on current global data session   
-    PIM_TRAPD_HANDLE( iGlobalData.CalSessionL().StopChangeNotification() );
-
-    // Destroy the notification filter
-    delete iCalChangeFilter;
-    
-    TRACE_EXIT_POINT;    
-    }
-
-// -----------------------------------------------------------------------------
-// CCalenDbChangeNotifier::LastDBModificationTime
-// Returns the time of the last database change notification.  This may not be
-// the time of the last notification sent to MCalenDBChangeObservers.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-TTime CCalenDbChangeNotifier::LastDBModificationTime() const
-    {
-    TRACE_ENTRY_POINT;
-
-    TRACE_EXIT_POINT;
-    return iLastDbChangeNotification;
-    }
-
-// -----------------------------------------------------------------------------
-// CCalenDbChangeNotifier::CalChangeNotification
-// Called when a change to the agenda database occurs from a different session
-// to the one we are currently using.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-void CCalenDbChangeNotifier::CalChangeNotification( RArray<TCalChangeEntry>& /*aChangeItems*/ )
-    {
-    TRACE_ENTRY_POINT;
-
-    // Always update the last notification time, even if we don't notify 
-    // our observers
-    iLastDbChangeNotification.UniversalTime();
-    if( !IsActive() )
-        {
-        iNotificationTimer.After( iStatus, KTimerResolution );
-        SetActive();
-        }
-    else
-        {
-        iRestartTimer = ETrue;
-        iNotificationTimer.Cancel();
-        }
-
-    TRACE_EXIT_POINT;
-    }
-
-// -----------------------------------------------------------------------------
-// CCalenDbChangeNotifier::RegisterObserverL
-// Adds the passed observer to the observer array.  All observers in the array 
-// will be notified of changes to the agenda database.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------    
- void CCalenDbChangeNotifier::RegisterObserverL( MCalenDBChangeObserver& aDBObserver )
-    {
-    TRACE_ENTRY_POINT;
-
-    iDBObservers.Append( &aDBObserver );
-
-    TRACE_EXIT_POINT;
-    }
-
-// -----------------------------------------------------------------------------
-// CCalenDbChangeNotifier::DeRegisterObserverL
-// Removes the passed observer to the observer array.  All observers in the array 
-// will be notified of changes to the agenda database.
-// -----------------------------------------------------------------------------       
-void CCalenDbChangeNotifier::DeRegisterObserverL( MCalenDBChangeObserver& aDBObserver )
-    {
-    TRACE_ENTRY_POINT;
-
-    for( TInt x = 0; x < iDBObservers.Count(); ++x )
-        {
-        if( iDBObservers[x] == &aDBObserver )
-            {
-            iDBObservers.Remove( x );
-            return;
-            }
-        }
-    User::Leave( KErrNotFound );
-
-    TRACE_EXIT_POINT;
-    }
-
-// -----------------------------------------------------------------------------       
-// CCalenDbChangeNotifier::RunL
-// From CActive::RunL
-// Called when notification timer expires
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------       
-void CCalenDbChangeNotifier::RunL()
-    {
-    TRACE_ENTRY_POINT;
-
-    switch( iStatus.Int() )
-        {
-        case KErrCancel:
-            {
-            // The normal reason for the timer being cancelled is another
-            // database change.  Restart the timer.
-            if( iRestartTimer )
-                {
-                iRestartTimer = EFalse;
-                iNotificationTimer.After( iStatus, KTimerResolution );
-                SetActive();
-                }        
-            }
-        break;
-
-        case KErrNone:
-            {
-            //Timer completion, notify observers
-            for( TInt x = 0; x < iDBObservers.Count(); ++x )
-                {
-                iDBObservers[x]->HandleDBChangeL();
-                }
-            }
-        break;
-
-        default:
-            {
-            User::Leave( KErrArgument );
-            }
-        break;
-        }
-
-    TRACE_EXIT_POINT;
-    }
-
-// -----------------------------------------------------------------------------       
-// CCalenDbChangeNotifier::RunError
-// From CActive::RunError
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-TInt CCalenDbChangeNotifier::RunError( TInt aError )
-    {
-    TRACE_ENTRY_POINT;
-
-    //RunL leaving means that the view could not be refreshed.
-    //Theres not much we can do except be ready for the next database event.
-    iRestartTimer = EFalse;
-
-    TRACE_EXIT_POINT;
-    return aError;
-    }
-
-// -----------------------------------------------------------------------------       
-// CCalenDbChangeNotifier::DoCancel
-// From CActive::DoCancel
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-void CCalenDbChangeNotifier::DoCancel()
-    {
-    TRACE_ENTRY_POINT;
-
-    // Stop the notification timer
-    iRestartTimer = EFalse;
-    iNotificationTimer.Cancel();
-
-    TRACE_EXIT_POINT;
-    }
-
-// End of File
--- a/calendarui/controller/src/calendeleteui.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calendeleteui.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -39,6 +39,9 @@
 #include <caleninstanceid.h>            // TCalenInstanceId
 #include <calenactionuiutils.h>
 #include <calcalendarinfo.h>
+#include <calentoolbar.h>
+#include <akntoolbar.h>
+#include <CalenAttachmentModel.h>
 
 #include "calendarui_debug.h"           // Debug
 #include "calendeleteui.h"
@@ -379,6 +382,14 @@
 			    {
 			    MarkedEntriesDeletedL();    
 			    }
+			MCalenToolbar* toolbarImpl = iController.Services().ToolbarOrNull(); 
+            if (toolbarImpl)
+                {
+                CAknToolbar& toolbar = toolbarImpl->Toolbar();
+    
+                // dim clear and clear all toolbar buttons
+                toolbar.SetItemDimmed(ECalenNewMeeting, EFalse, ETrue);
+                }
 			}
         else
             {
@@ -576,13 +587,13 @@
 //
 void CCalenDeleteUi::HandleDeleteMultipleEventsL( const TTime& aFirstDay,
                                                                      const TTime& aLastDay,
-                                                                     TInt aConfNoteId )
+                                                                     TInt /*aConfNoteId */)
     {
     TRACE_ENTRY_POINT;
 
     ASSERT( !iWaitDialog );
     ASSERT( !iIsDeleting );
-    iConfirmationNoteId = aConfNoteId;
+    //iConfirmationNoteId = aConfNoteId;
 
     iWaitDialog = new( ELeave ) CAknWaitDialog( REINTERPRET_CAST( CEikDialog**, 
                                                                   &iWaitDialog ) );
@@ -680,10 +691,10 @@
 		if( aFirstPassError == KErrNone )
 			{
 			// Show confirmation note
-			HBufC* buf = StringLoader::LoadLC( iConfirmationNoteId, iEikEnv );
-			CAknConfirmationNote* dialog = new( ELeave ) CAknConfirmationNote();
-			dialog->ExecuteLD(*buf);
-			CleanupStack::PopAndDestroy( buf );
+//			HBufC* buf = StringLoader::LoadLC( iConfirmationNoteId, iEikEnv );
+//			CAknConfirmationNote* dialog = new( ELeave ) CAknConfirmationNote();
+//			dialog->ExecuteLD(*buf);
+//			CleanupStack::PopAndDestroy( buf );
 			}
 		else
 			{
@@ -881,6 +892,12 @@
         
     if( doDelete )
         {
+        //Before deleteing the entry reset the attachment model
+        if(iController.Services().GetAttachmentData()->NumberOfItems())
+            {
+            iController.Services().GetAttachmentData()->Reset();
+            }
+        
         if( !TryDeleteWithMrUtilsL( aInstance, aRepeatType ) )
             {
             if( !child || aRepeatType == CalCommon::EThisOnly )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/calendarui/controller/src/calendialogshutter.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  For dialog shutter.
+*
+*/
+
+
+#include <eikenv.h>
+#include <eikappui.h>
+
+#include "calendialogshutter.h"
+
+const TInt KMaxNumEscKeysToSend = 50;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CCalenDialogShutter::CCalenDialogShutter
+// C++ default constructor
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+CCalenDialogShutter::CCalenDialogShutter( CEikonEnv* aEikEnv ) 
+                     : CActive(EPriorityStandard) // Standard priority
+                     , iEikon( aEikEnv )
+                     , iStartLevel( StartLevel() )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CCalenDialogShutter::NewLC
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+CCalenDialogShutter* CCalenDialogShutter::NewLC( CEikonEnv* aEikEnv )
+    {
+    CCalenDialogShutter* self = new (ELeave) CCalenDialogShutter( aEikEnv );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CCalenDialogShutter::NewL
+// 1st phase of construction
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+CCalenDialogShutter* CCalenDialogShutter::NewL( CEikonEnv* aEikEnv )
+    {
+    CCalenDialogShutter* self = CCalenDialogShutter::NewLC( aEikEnv );
+    CleanupStack::Pop(); // self;
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CCalenDialogShutter::ConstructL
+// Second phase of construction
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+void CCalenDialogShutter::ConstructL()
+    {
+    CActiveScheduler::Add(this); // Add to scheduler
+    }
+
+// ----------------------------------------------------------------------------
+// CCalenDialogShutter::~CCalenDialogShutter
+// Destructor
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+CCalenDialogShutter::~CCalenDialogShutter()
+    {
+    Cancel(); // Cancel any request, if outstanding
+    }
+
+// ----------------------------------------------------------------------------
+// CCalenDialogShutter::DoCancel
+// Cancel method to handle the user selection
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+void CCalenDialogShutter::DoCancel()
+    {
+    iCount = 0;
+    }
+
+// ----------------------------------------------------------------------------
+// CCalenDialogShutter::Queue
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+void CCalenDialogShutter::Queue()
+    {
+    if (!IsActive())
+        {
+        SetActive();
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCalenDialogShutter::RunL
+// Handles the asyn requests completion 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//  
+void CCalenDialogShutter::RunL()
+    {
+    if ( iCount++ >=  KMaxNumEscKeysToSend )
+        {        
+        return;
+        }
+    
+    CEikAppUi* appUi=iEikon->EikAppUi();
+    TInt startLevel=StartLevel();
+    if ( startLevel > iStartLevel )
+        {        
+        return;
+        }
+    
+    iStartLevel = startLevel;
+    
+    if (appUi->IsDisplayingMenuOrDialog())
+        {
+        TKeyEvent key;
+        key.iCode=EKeyEscape;
+        key.iModifiers=0;
+        key.iRepeats = 0;
+        key.iScanCode = EStdKeyNull;
+        iEikon->SimulateKeyEventL(key, EEventKey);
+        }
+    else
+        {        
+        return;
+        }
+    Queue();
+    }
+
+// ----------------------------------------------------------------------------
+// CCalenDialogShutter::RunError
+// Function to handle any errors in async request
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+TInt CCalenDialogShutter::RunError(TInt aError)
+    {
+    return aError;
+    }
+
+// ----------------------------------------------------------------------------
+// CCalenDialogShutter::StartLevel
+// Function to get the startlevel of the opened dialogs
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+TInt CCalenDialogShutter::StartLevel()
+    {
+    return ((CKludgeScheduler*)CActiveScheduler::Current())->PublicLevel();
+    }
+
+// ----------------------------------------------------------------------------
+// CCalenDialogShutter::ShutDialogsL
+//  Function for making the initial request 
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+void CCalenDialogShutter::ShutDialogsL( /*CActiveSchedulerWait* aWait*/ )
+    {    
+    Queue();
+    }
--- a/calendarui/controller/src/caleneditui.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/caleneditui.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -152,7 +152,14 @@
             TUid currentView = iController.ViewManager().CurrentView();
             if( KUidCalenTodoView == currentView )
                 {
-                // Open NewEntry as "To-Do", if editor is launched from To-Do view. 
+                // Open NewEntry as "To-Do", if editor is launched from To-Do view.
+                MCalenContext& context = iController.Services().Context();
+                // Set the date on the context to today.
+                TTime homeTime;
+                homeTime.HomeTime();
+                TCalTime today;
+                today.SetTimeLocalL( homeTime );
+                context.SetFocusDateL( today, TVwsViewId( KUidCalendar, KUidCalenTodoView ) );
                 EditNewEntryL( CCalEntry::ETodo );
                 }
             else
@@ -514,7 +521,8 @@
     isEditorActive = EFalse;
     
     // Unhide the toolbar when settings is closed
-    if(toolbar)
+    TUid activeViewUid = iController.ViewManager().CurrentView();
+    if(toolbar && (activeViewUid != KUidCalenMissedAlarmsView ) &&(activeViewUid != KUidCalenMissedEventView ) )
         {
         toolbar->SetToolbarVisibilityL(ETrue); 
         }
@@ -549,7 +557,7 @@
                 {
                 // Show saved note for new entries
                 TInt res;
-                if( aEntry->EntryTypeL() == CCalEntry::ETodo )
+                if( context.InstanceId().iType == CCalEntry::ETodo )
                     {
                     res = R_QTN_CALE_NOTE_TODO_SAVED;
                     }
--- a/calendarui/controller/src/calenicons.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenicons.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -20,6 +20,7 @@
 #include "calenicons.h"
 #include "calendar.hrh"
 
+#include <CalenUid.h> 
 #include <aknconsts.h>
 #include <data_caging_path_literals.hrh>
 #include <AknIconArray.h>
@@ -309,7 +310,7 @@
 // (other items were commented in a header).
 // ---------------------------------------------------------
 //
-EXPORT_C CGulIcon* CCalenIcons::GetIconL( MCalenServices::TCalenIcons aIndex ) const
+EXPORT_C CGulIcon* CCalenIcons::GetIconL( MCalenServices::TCalenIcons aIndex, const TInt aViewId ) const 
     {
     TRACE_ENTRY_POINT;
     CGulIcon* icon;
@@ -318,6 +319,7 @@
     // When Avkon suplies some method to do that, change these 
     TAknsItemID colorGroup = KAknsIIDQsnIconColors;
     TInt colorIndex = EAknsCIQsnIconColorsCG19;
+    TInt colorIndexToDo = EAknsCIQsnIconColorsCG13;
     TRgb nonSkinColor = AKN_LAF_COLOR(215);
     CFbsBitmap* bitmap = NULL;
     CFbsBitmap* mask = NULL;
@@ -370,79 +372,188 @@
             break;
         case MCalenServices::ECalenAlarmIcon:
             {
-            AknsUtils::CreateColorIconLC( AknsUtils::SkinInstance(), 
-                                                     KAknsIIDQgnIndiAlarmAdd,
-                                                     colorGroup,
-                                                     colorIndex,
-                                                     bitmap, mask,
-                                                     AknIconUtils::AvkonIconFileName(),
-                                                     EMbmAvkonQgn_indi_alarm_add,
-                                                     EMbmAvkonQgn_indi_alarm_add_mask,
-                                                     nonSkinColor);
-            icon = CGulIcon::NewL( bitmap, mask );
-            CleanupStack::Pop( 2 ); // bitmap, mask
+            if(aViewId == KCalenTodoViewUidValue || 
+               aViewId == KCalenEventViewUidValue || 
+               aViewId == KCalenMissedAlarmsViewUidValue ||
+               aViewId == KCalenMissedEventViewUidValue )
+                {
+                AknsUtils::CreateColorIconLC( AknsUtils::SkinInstance(), 
+                                                         KAknsIIDQgnIndiAlarmAdd,
+                                                         colorGroup,
+                                                         colorIndexToDo,
+                                                         bitmap, mask,
+                                                         AknIconUtils::AvkonIconFileName(),
+                                                         EMbmAvkonQgn_indi_alarm_add,
+                                                         EMbmAvkonQgn_indi_alarm_add_mask,
+                                                         nonSkinColor);
+                icon = CGulIcon::NewL( bitmap, mask );
+                CleanupStack::Pop( 2 ); // bitmap, mask
+                break;
+                }
+            else 
+                {
+                AknsUtils::CreateColorIconLC( AknsUtils::SkinInstance(), 
+                                                       KAknsIIDQgnIndiAlarmAdd,
+                                                       colorGroup,
+                                                       colorIndex,
+                                                       bitmap, mask,
+                                                       AknIconUtils::AvkonIconFileName(),
+                                                       EMbmAvkonQgn_indi_alarm_add,
+                                                       EMbmAvkonQgn_indi_alarm_add_mask,
+                                                       nonSkinColor);
+                icon = CGulIcon::NewL( bitmap, mask );
+                CleanupStack::Pop( 2 ); // bitmap, mask
+                break;
+                }                
             }
-            break;
+            
         case MCalenServices::ECalenRepeatIcon:
             {
-            AknsUtils::CreateColorIconLC( AknsUtils::SkinInstance(), 
-                                                     KAknsIIDQgnIndiRepeatAdd,
-                                                     colorGroup,
-                                                     colorIndex,
-                                                     bitmap, mask,
-                                                     iIconFile,
-                                                     EMbmCalendarQgn_indi_repeat_add,
-                                                     EMbmCalendarQgn_indi_repeat_add_mask,
-                                                     nonSkinColor);
-            icon = CGulIcon::NewL(bitmap, mask);
-            CleanupStack::Pop( 2 );
+            if(aViewId == KCalenTodoViewUidValue || 
+               aViewId == KCalenEventViewUidValue || 
+               aViewId == KCalenMissedAlarmsViewUidValue ||
+               aViewId == KCalenMissedEventViewUidValue )
+                {
+                AknsUtils::CreateColorIconLC( AknsUtils::SkinInstance(), 
+                                                         KAknsIIDQgnIndiRepeatAdd,
+                                                         colorGroup,
+                                                         colorIndexToDo,
+                                                         bitmap, mask,
+                                                         iIconFile,
+                                                         EMbmCalendarQgn_indi_repeat_add,
+                                                         EMbmCalendarQgn_indi_repeat_add_mask,
+                                                         nonSkinColor);
+                icon = CGulIcon::NewL(bitmap, mask);
+                CleanupStack::Pop( 2 );
+                break;
+                }
+            else
+                {
+                AknsUtils::CreateColorIconLC( AknsUtils::SkinInstance(), 
+                                                         KAknsIIDQgnIndiRepeatAdd,
+                                                         colorGroup,
+                                                         colorIndex,
+                                                         bitmap, mask,
+                                                         iIconFile,
+                                                         EMbmCalendarQgn_indi_repeat_add,
+                                                         EMbmCalendarQgn_indi_repeat_add_mask,
+                                                         nonSkinColor);
+                icon = CGulIcon::NewL(bitmap, mask);
+                CleanupStack::Pop( 2 );
+                break;
+                }
             }
-            break;
+           
         case MCalenServices::ECalenRepeatExceptionIcon:
             {
-            AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), 
-                                         KAknsIIDQgnIndiRepeatExceptionAdd,
-                                         colorGroup,
-                                         colorIndex,
-                                         bitmap, mask,
-                                         iIconFile,
-                                         EMbmCalendarQgn_indi_repeat_exception_add,
-                                         EMbmCalendarQgn_indi_repeat_exception_add_mask,
-                                         nonSkinColor);
-            icon = CGulIcon::NewL(bitmap, mask);
-            CleanupStack::Pop(2); // bitmap, mask;
+            if(aViewId == KCalenTodoViewUidValue || 
+               aViewId == KCalenEventViewUidValue || 
+               aViewId == KCalenMissedAlarmsViewUidValue ||
+               aViewId == KCalenMissedEventViewUidValue )
+                {
+                AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), 
+                                             KAknsIIDQgnIndiRepeatExceptionAdd,
+                                             colorGroup,
+                                             colorIndexToDo,
+                                             bitmap, mask,
+                                             iIconFile,
+                                             EMbmCalendarQgn_indi_repeat_exception_add,
+                                             EMbmCalendarQgn_indi_repeat_exception_add_mask,
+                                             nonSkinColor);
+                icon = CGulIcon::NewL(bitmap, mask);
+                CleanupStack::Pop(2); // bitmap, mask;
+                break;
+                }
+            else
+                {
+                AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), 
+                                             KAknsIIDQgnIndiRepeatExceptionAdd,
+                                             colorGroup,
+                                             colorIndex,
+                                             bitmap, mask,
+                                             iIconFile,
+                                             EMbmCalendarQgn_indi_repeat_exception_add,
+                                             EMbmCalendarQgn_indi_repeat_exception_add_mask,
+                                             nonSkinColor);
+                icon = CGulIcon::NewL(bitmap, mask);
+                CleanupStack::Pop(2); // bitmap, mask;
+                break;
+                }
+                
             }
-            break;
         case MCalenServices::ECalenNotePriorityLow:
             {
-            AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), 
-                                         KAknsIIDQgnIndiTodoLowAdd,
-                                         colorGroup,
-                                         colorIndex,
-                                         bitmap, mask,
-                                         iIconFile,
-                                         EMbmCalendarQgn_indi_todo_low_add,
-                                         EMbmCalendarQgn_indi_todo_low_add_mask,
-                                         nonSkinColor);
-            icon = CGulIcon::NewL(bitmap, mask);
-            CleanupStack::Pop(2); // bitmap, mask;
+            if(aViewId == KCalenTodoViewUidValue || 
+               aViewId == KCalenEventViewUidValue || 
+               aViewId == KCalenMissedAlarmsViewUidValue ||
+               aViewId == KCalenMissedEventViewUidValue )
+                {
+                AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), 
+                                             KAknsIIDQgnIndiTodoLowAdd,
+                                             colorGroup,
+                                             colorIndexToDo,
+                                             bitmap, mask,
+                                             iIconFile,
+                                             EMbmCalendarQgn_indi_todo_low_add,
+                                             EMbmCalendarQgn_indi_todo_low_add_mask,
+                                             nonSkinColor);
+                icon = CGulIcon::NewL(bitmap, mask);
+                CleanupStack::Pop(2); // bitmap, mask;
+                break;
+                }
+            else 
+                {
+                AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), 
+                                                         KAknsIIDQgnIndiTodoLowAdd,
+                                                         colorGroup,
+                                                         colorIndex,
+                                                         bitmap, mask,
+                                                         iIconFile,
+                                                         EMbmCalendarQgn_indi_todo_low_add,
+                                                         EMbmCalendarQgn_indi_todo_low_add_mask,
+                                                         nonSkinColor);
+                icon = CGulIcon::NewL(bitmap, mask);
+                CleanupStack::Pop(2); // bitmap, mask;
+                break;
+                }                           
             }
-            break;
+            
         case MCalenServices::ECalenNotePriorityHigh:
             {
-            AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), 
-                                         KAknsIIDQgnIndiTodoHighAdd,
-                                         colorGroup,
-                                         colorIndex,
-                                         bitmap, mask,
-                                         iIconFile,
-                                         EMbmCalendarQgn_indi_todo_high_add,
-                                         EMbmCalendarQgn_indi_todo_high_add_mask,
-                                         nonSkinColor );
-            icon = CGulIcon::NewL(bitmap, mask);
-            CleanupStack::Pop(2); // bitmap, mask;
+            if(aViewId == KCalenTodoViewUidValue || 
+               aViewId == KCalenEventViewUidValue || 
+               aViewId == KCalenMissedAlarmsViewUidValue ||
+               aViewId == KCalenMissedEventViewUidValue )
+                {
+                AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), 
+                                             KAknsIIDQgnIndiTodoHighAdd,
+                                             colorGroup,
+                                             colorIndexToDo,
+                                             bitmap, mask,
+                                             iIconFile,
+                                             EMbmCalendarQgn_indi_todo_high_add,
+                                             EMbmCalendarQgn_indi_todo_high_add_mask,
+                                             nonSkinColor );
+                icon = CGulIcon::NewL(bitmap, mask);
+                CleanupStack::Pop(2); // bitmap, mask;
+                break;
+                }
+            else 
+                {
+                AknsUtils::CreateColorIconLC(AknsUtils::SkinInstance(), 
+                                                         KAknsIIDQgnIndiTodoHighAdd,
+                                                         colorGroup,
+                                                         colorIndex,
+                                                         bitmap, mask,
+                                                         iIconFile,
+                                                         EMbmCalendarQgn_indi_todo_high_add,
+                                                         EMbmCalendarQgn_indi_todo_high_add_mask,
+                                                         nonSkinColor );
+                icon = CGulIcon::NewL(bitmap, mask);
+                CleanupStack::Pop(2); // bitmap, mask;
+                break;
+                }
             }
-            break;
         case MCalenServices::ECalenTodoIconUndone:
             {
             icon = CreateBitmapSkinnedIconL( KAknsIIDQgnPropTodoUndone,
--- a/calendarui/controller/src/calenidlestate.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenidlestate.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -100,6 +100,7 @@
         case ECalenDayView:
         case ECalenTodoView:
         case ECalenForwardsToDayView:
+        case ECalenForwardsToWeekView:
         case ECalenNextView:
         case ECalenPrevView:
         case ECalenSwitchView:
--- a/calendarui/controller/src/calenlocationui.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenlocationui.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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/calenmapstate.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenmapstate.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -95,24 +95,8 @@
     switch( cmd )
     {
     case ECalenFasterAppExit:
-		{
-		// Issue map launch cancel notification
-		iController.BroadcastNotification(ECalenNotifyCancelMapLaunch);
-        SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState );
-        ActivateCurrentStateL(aStateMachine);
-        cmdUsed = ETrue;
-        break;
-   		}
-    case ECalenMissedEventViewFromIdle:
-        {
-        // Issue map launch cancel notification
-        iController.BroadcastNotification(ECalenNotifyCancelMapLaunch);
-        SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState );
-        ActivateCurrentStateL(aStateMachine);
-        cmdUsed = ETrue;
-        break;
-        }
-        
+    case ECalenDayView:    
+    case ECalenMissedEventViewFromIdle: 
     case ECalenEventViewFromAlarm:
     case ECalenEventViewFromAlarmStopOnly:
         {
--- a/calendarui/controller/src/calenmultidbeditor.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenmultidbeditor.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -29,12 +29,16 @@
 #include <hlplch.h>
 #include <calcalendarinfo.h>
 #include <Calendar.rsg>
+#include <calencommonui.rsg>
+#include <sysutil.h>
+#include <ErrorUI.h>
 
 #include "calenmultidbeditor.h"
 #include "calendarui_debug.h"
 #include "calendar.hrh"
 #include "calentitlepane.h"
 #include "calencontroller.h"
+#include "calenmultipledbui.h"
 
 // Constants.
 const TUint16 KIllegalChars[] = {
@@ -55,7 +59,6 @@
     0, // Array terminator
 };
 const TInt KCalenMaxELAFTextEditorLength(256);
-const TInt KCalenColorPalletteStartColor(35);
 const TInt KOne( 1 );
 const TInt KBuffLength ( 16 );
 const TInt KTen( 10 );
@@ -71,16 +74,17 @@
 // Two-phased constructor.
 // ----------------------------------------------------------------------------
 // 
-CCalenMultiDBEditor* CCalenMultiDBEditor::NewL( CCalCalendarInfo& aCalendarInfo, 
-                                 CCalenController& aController, TBool aEditFlag)
+CCalenMultiDBEditor* CCalenMultiDBEditor::NewL(
+        CCalenMultipleDbUi& aMultipleDbui, CCalCalendarInfo& aCalendarInfo,
+        CCalenController& aController, TBool aEditFlag)
     {
     TRACE_ENTRY_POINT;
 
-    CCalenMultiDBEditor* self = 
-      new(ELeave) CCalenMultiDBEditor( aCalendarInfo, aController, aEditFlag);
-    CleanupStack::PushL( self );
+    CCalenMultiDBEditor* self = new (ELeave) CCalenMultiDBEditor(
+            aMultipleDbui, aCalendarInfo, aController, aEditFlag);
+    CleanupStack::PushL(self);
     self->ConstructL();
-    CleanupStack::Pop( self );
+    CleanupStack::Pop(self);
 
     TRACE_EXIT_POINT;
     return self;
@@ -93,7 +97,14 @@
 //
 CCalenMultiDBEditor::~CCalenMultiDBEditor()
     {
-    TRACE_ENTRY_POINT;    
+    TRACE_ENTRY_POINT; 
+    
+    if(iRgbColors)
+        {
+        iRgbColors->Reset();
+        delete iRgbColors;
+        iRgbColors = NULL;
+        }
     
     if(iCalendarName)
         {
@@ -116,10 +127,12 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-CCalenMultiDBEditor::CCalenMultiDBEditor( CCalCalendarInfo&  aCalendarInfo,
-        CCalenController& aController, TBool aEditFlag)
-	:iCalendarInfo( aCalendarInfo ) , iController( aController ),
-	iEditFlag( aEditFlag )
+CCalenMultiDBEditor::CCalenMultiDBEditor(CCalenMultipleDbUi& aMultipleDbui,
+        CCalCalendarInfo& aCalendarInfo, CCalenController& aController,
+        TBool aEditFlag) :
+            iCalendarInfo(aCalendarInfo), iController(
+            aController), iEditFlag(aEditFlag),
+			iMultipleDbUi(aMultipleDbui)
     {
     TRACE_ENTRY_POINT;
     
@@ -146,10 +159,10 @@
         
     //Initial color value
     iColVal = iCalendarInfo.Color().Value();  
-    iColors = TRgb(iColVal);
+    iChoosenColor = TRgb(iColVal);
         
     iPicture = new( ELeave )CDbColorPicture( TSize( 0, 0 ) );
-    iPicture->SetRgbColorsL(iColors);
+    iPicture->SetRgbColorsL(iChoosenColor);
     
     //set sync value
     // ESyncStatus
@@ -161,10 +174,51 @@
         {
         iSyncStatus = pkgSyncStatus();
         }
+    
+    LoadColorsL();
+    
     TRACE_EXIT_POINT;
     }
 
 // -----------------------------------------------------------------------------
+// CCalenMultiDBEditor::LoadColorsL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCalenMultiDBEditor::LoadColorsL()
+    {
+    TRACE_ENTRY_POINT
+    
+    if(iRgbColors)
+        {
+        iRgbColors->Reset();
+        delete iRgbColors;
+        iRgbColors = NULL;
+        }
+    
+    iRgbColors = new(ELeave) CArrayFixFlat<TRgb>(2);
+    
+    iRgbColors->AppendL(KRgbRed);
+    iRgbColors->AppendL(KRgbDarkGray);
+    iRgbColors->AppendL(KRgbDarkRed);
+    iRgbColors->AppendL(KRgbDarkGreen);
+    iRgbColors->AppendL(KRgbDarkYellow);
+    iRgbColors->AppendL(KRgbDarkBlue);
+    iRgbColors->AppendL(KRgbDarkMagenta);
+    iRgbColors->AppendL(KRgbDarkCyan);
+    iRgbColors->AppendL(KRgbBlack);
+    iRgbColors->AppendL(KRgbGreen);
+    iRgbColors->AppendL(KRgbYellow);
+    iRgbColors->AppendL(KRgbBlue);
+    iRgbColors->AppendL(KRgbMagenta);
+    iRgbColors->AppendL(KRgbCyan);
+    iRgbColors->AppendL(KRgbGray);
+    iRgbColors->AppendL(KRgbWhite);
+    
+    TRACE_EXIT_POINT
+    }
+
+// -----------------------------------------------------------------------------
 // CCalenMultiDBEditor::ProcessCommandL
 // Process commands from the user.
 // (other items were commented in a header).
@@ -218,8 +272,6 @@
 		    else if ( ECalenMultiDbColor == IdOfFocusControl() )
 		        {
 		        GetColorL();
-		        iColors = TRgb(iColVal);
-		        GetLineByLineAndPageIndex(1,0)->DrawNow();
 		        }
 		    }
 		    break; 
@@ -227,8 +279,6 @@
 		case EAknSoftkeyOpen:
 		    {
 		    GetColorL();
-		    iColors = TRgb(iColVal);
-		    GetLineByLineAndPageIndex(1,0)->DrawNow(); 
 		    } 
 		    break;
 			
@@ -255,8 +305,6 @@
        case ECalenMultiDbColor:
           {
           GetColorL();
-          iColors = TRgb(iColVal);
-          GetLineByLineAndPageIndex(1,0)->DrawNow(); 
           }
           break;
 	  default:
@@ -314,8 +362,6 @@
         case EAknSoftkeyOpen:
             {
             GetColorL();
-            iColors = TRgb(iColVal);
-            GetLineByLineAndPageIndex(1,0)->DrawNow(); 
             } 
             break;
             
@@ -354,8 +400,6 @@
             else if ( ECalenMultiDbColor == IdOfFocusControl() )
                 {
                 GetColorL();
-                iColors = TRgb(iColVal);
-                GetLineByLineAndPageIndex(1,0)->DrawNow(); 
                 }
             }
             break;    
@@ -363,14 +407,23 @@
         case EAknSoftkeyDone:
             {
             isExitForm = SaveNoteL(aButtonId);
+            if(isExitForm)
+                {
+                iMultipleDbUi.UpdateOnAddOrEditL(!iEditFlag);
+                }
             }
             break;
         case EAknSoftkeyExit:    
         case EAknCmdExit:
             {
-            SaveNoteL(aButtonId); 
-            isExitForm = ETrue;
-            }
+            isExitForm  = SaveNoteL(aButtonId); 
+            if(isExitForm)
+                {
+                iMultipleDbUi.UpdateOnAddOrEditL(!iEditFlag);
+                }
+             isExitForm = ETrue;
+             iMultipleDbUi.ExitDialogL();           
+			 }
             break;
         case EAknSoftkeyQuit:
             {
@@ -577,55 +630,33 @@
 void CCalenMultiDBEditor::GetColorL()
     {  
     TRACE_ENTRY_POINT;
-      
-    TBool retVal = EFalse;
-    
-    // Array for TRgb colour values
-    CArrayFixFlat<TRgb>* colors = new( ELeave ) CArrayFixFlat<TRgb>( 8 );
-    CleanupStack::PushL( colors );
-    
-    // array of colors.
-    colors->AppendL(KRgbRed);
-    colors->AppendL(KRgbDarkGray);
-    colors->AppendL(KRgbDarkRed);
-    colors->AppendL(KRgbDarkGreen);
-    colors->AppendL(KRgbDarkYellow);
-    colors->AppendL(KRgbDarkBlue);
-    colors->AppendL(KRgbDarkMagenta);
-    colors->AppendL(KRgbDarkCyan);
-    colors->AppendL(KRgbBlack);
-    colors->AppendL(KRgbGreen);
-    colors->AppendL(KRgbYellow);
-    colors->AppendL(KRgbBlue);
-    colors->AppendL(KRgbMagenta);
-    colors->AppendL(KRgbCyan);
-    colors->AppendL(KRgbGray);
-    colors->AppendL(KRgbWhite);
-   
-    // Get current colour
-    TRgb color = KCalenColorPalletteStartColor; //iDbInfo.GetCalendarColor(); 
-    TInt startValue = iColVal;
-    TBool noneChosen = ETrue;
+    iNoneChoosen = ETrue;
     
     // Construct colour selection grid
-    CAknColourSelectionGrid *dlg = CAknColourSelectionGrid::NewL(colors, EFalse,
-            noneChosen,color );
+    CAknDialog  *dlg = CAknColourSelectionGrid::NewL(iRgbColors, EFalse,
+            iNoneChoosen,iChoosenColor );
 
-    retVal = dlg->ExecuteLD();
+    dlg->ExecuteLD(R_CALEN_MULTIDB_EDITOR_COLOR_GRID_DLG);
     
-    iColVal = KErrNotFound;
-    if ( !noneChosen  && retVal )//If something is chosen
-  	    {
-		iColVal = color.Value();
-		}    
-    else//Else set the previous color.
+    TRACE_EXIT_POINT;
+    }
+
+// ---------------------------------------------------------------------------
+// CCalenMultiDBEditor::FocusChanged
+// ---------------------------------------------------------------------------
+//
+void CCalenMultiDBEditor::FocusChanged(TDrawNow /*aDrawNow*/)
+    {
+    TRACE_ENTRY_POINT
+    
+    if(IsFocused() && !iNoneChoosen)
         {
-        iColVal = startValue;
+        iColVal = iChoosenColor.Value();
+        iPicture->SetRgbColorsL(iChoosenColor);
+        GetLineByLineAndPageIndex(1, 0)->DrawNow();
         }
-    iColors = TRgb(iColVal);
-    iPicture->SetRgbColorsL(iColors);  
-    CleanupStack::PopAndDestroy( colors );	
-	TRACE_EXIT_POINT;
+    
+    TRACE_EXIT_POINT
     }
 
 // ---------------------------------------------------------------------------
@@ -636,6 +667,12 @@
 TBool CCalenMultiDBEditor::SaveNoteL( TInt aButtonId )
 	{
     TRACE_ENTRY_POINT;
+    
+    if( CheckSpaceBelowCriticalLevelL() )
+        {
+        TRACE_EXIT_POINT;
+        return EFalse; 
+        }
 
     if (Conflict() == CCalenMultiDBEditor::EConflictDelete)
         {
@@ -675,8 +712,7 @@
         // If in editing mode, just save the name used before.
         if( iEditFlag )
             {
-            iCalendarName = iCalendarInfo.NameL().AllocLC();
-            CleanupStack::Pop( iCalendarName );
+			iCalendarName->Des().Copy(iCalendarInfo.NameL());
             SetEdwinTextL( ECalenMultiDbName, iCalendarName );
             }
         else
@@ -724,15 +760,15 @@
                TInt index = calendarInfoList.Find( *iCalendarName,CCalenMultiDBEditor::CalenInfoIdentifierL );
                if(index != KErrNotFound)
                    {
+                   retValue = EFalse;
                    if( EAknCmdExit != aButtonId )
-                       {
-                   retValue = EFalse;
-                   HBufC* infoText = StringLoader::LoadLC(
-                           R_QTN_CALE_DB_ALREADY_EXISTS_NOTE , iCalendarName->Des() );
-                   CAknInformationNote* dialog = new( ELeave ) CAknInformationNote(ETrue);
-                   dialog->ExecuteLD( *infoText );
-                   CleanupStack::PopAndDestroy( infoText );                        
-                       }                     
+                       {                       
+                       HBufC* infoText = StringLoader::LoadLC(
+                               R_QTN_CALE_DB_ALREADY_EXISTS_NOTE , iCalendarName->Des() );
+                       CAknInformationNote* dialog = new( ELeave ) CAknInformationNote(ETrue);
+                       dialog->ExecuteLD( *infoText );
+                       CleanupStack::PopAndDestroy( infoText );                        
+                       }
                    }
                else
                    {
@@ -745,13 +781,13 @@
            {
            if( EAknCmdExit != aButtonId )
                {
-           retValue = EFalse;
-           HBufC* infoText(NULL);
-           infoText = AreIllegalChars( *iCalendarName ) ? StringLoader::LoadLC( R_CALEN_ILLEGAL_CHARACTERS ) : 
-                                                    StringLoader::LoadLC( R_CALEN_BAD_FILE_NAME );
-           CAknInformationNote* dialog = new( ELeave ) CAknInformationNote(ETrue);
-           dialog->ExecuteLD( *infoText );
-           CleanupStack::PopAndDestroy( infoText ); 
+               retValue = EFalse;
+               HBufC* infoText(NULL);
+               infoText = AreIllegalChars( *iCalendarName ) ? StringLoader::LoadLC( R_CALEN_ILLEGAL_CHARACTERS ) : 
+                                                        StringLoader::LoadLC( R_CALEN_BAD_FILE_NAME );
+               CAknInformationNote* dialog = new( ELeave ) CAknInformationNote(ETrue);
+               dialog->ExecuteLD( *infoText );
+               CleanupStack::PopAndDestroy( infoText ); 
                }
            }
 		    
@@ -803,13 +839,13 @@
     {
     TRACE_ENTRY_POINT;
     //Initial Name value
-     TPtr summary = iCalendarName->Des();    
-      
-     CEikEdwin* edwin =
-              reinterpret_cast<CEikEdwin*>(Control(ECalenMultiDbName));
-      GetEdwinText(summary, ECalenMultiDbName);
-      
-      TRACE_EXIT_POINT;
+    TPtr summary = iCalendarName->Des();
+
+    CEikEdwin* edwin = reinterpret_cast<CEikEdwin*> (Control(
+            ECalenMultiDbName));
+    GetEdwinText(summary, ECalenMultiDbName);
+
+    TRACE_EXIT_POINT;
     }
 // ---------------------------------------------------------------------------
 // CCalenMultiDBEditor::IsNameEditedL
@@ -968,8 +1004,6 @@
             case ECalenMultiDbColor:
                 {
                 GetColorL();
-                iColors = TRgb(iColVal);
-                GetLineByLineAndPageIndex(1,0)->DrawNow();
                 }
                 break;
                     
@@ -1175,6 +1209,32 @@
     CleanupStack::PopAndDestroy( syncString );    
     TRACE_EXIT_POINT;
     }
+
+// -----------------------------------------------------------------------------
+// CheckSpaceBelowCriticalLevelL
+// Checks if the Flash File System storage will fall below critical level. 
+// If there is not enough space, display an error message and return EFalse.
+// Return ETrue otherwise.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CCalenMultiDBEditor::CheckSpaceBelowCriticalLevelL()
+    {
+    TRACE_ENTRY_POINT;
+    
+    TBool retcode(EFalse);
+    if ( SysUtil::FFSSpaceBelowCriticalLevelL( &( iCoeEnv->FsSession() ) ) )
+        {
+        CErrorUI* errorUi = CErrorUI::NewLC();
+        errorUi->ShowGlobalErrorNoteL( KErrDiskFull );
+        CleanupStack::PopAndDestroy( errorUi ); 
+        retcode = ETrue;
+        }
+    TRACE_EXIT_POINT;
+    return retcode;
+    }
+
+
 // -----------------------------------------------------------------------------
 // CDbColorPicture::CDbColorPicture
 // C++ Constructor
@@ -1209,6 +1269,10 @@
     TRACE_EXIT_POINT;	 
     }
 
+// -----------------------------------------------------------------------------
+// CDbColorPicture::SetRgbColorsL
+// -----------------------------------------------------------------------------
+//
 void CDbColorPicture::SetRgbColorsL(TRgb aColors)  
     {
     TRACE_ENTRY_POINT;
@@ -1234,10 +1298,10 @@
     
 	TSize pixelsize;
     pixelsize.iWidth = 225;
-    pixelsize.iHeight = 25;
+    pixelsize.iHeight = 16;
     TPoint aPoint;
     TRect area = TRect(aTopLeft, pixelsize);
-    area.Move(0,-20);
+    area.Move(0,-11);
     // Draw a datbase color rectangle
     aGc.SetBrushColor(iColors);
     aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
--- a/calendarui/controller/src/calenmultipledbui.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenmultipledbui.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -42,6 +42,9 @@
 #include <CalenInterimUtils2.h>
 #include <calenmulticalutil.h>
 #include <calenmulticaluids.hrh>
+#include <featmgr.h>
+#include <hlplch.h>
+#include <csxhelp/cale.hlp.hrh>
 
 // User includes
 #include "calendarui_debug.h"
@@ -50,6 +53,7 @@
 #include "calenmultidbeditor.h"
 #include "CalendarPrivateCRKeys.h"
 #include "calencontroller.h"
+#include "CalenUid.h"
 
 // Constants
 _LIT( KListSeparatorFormat, "\t" );
@@ -111,11 +115,10 @@
      
      iGc->Reset();
              
-     TAknWindowComponentLayout tempLayout = 
-                AknLayoutScalable_Apps::list_cale_time_pane_g6( aItemIndex - iListBox->TopItemIndex()) ;     
+     TAknWindowComponentLayout tempLayout = AknLayoutScalable_Apps::list_cale_time_pane_g6(0);     
 
-        TAknLayoutRect colourstrips;
-        colourstrips.LayoutRect( actualItemRect, tempLayout.LayoutLine() );
+     TAknLayoutRect colourstrips;
+     colourstrips.LayoutRect( actualItemRect, tempLayout.LayoutLine() );
       
      iGc->SetPenColor( CGraphicsContext::ENullPen );
      iGc->DrawRect( colourstrips.Rect() );
@@ -183,8 +186,7 @@
 // ----------------------------------------------------------------------------
 //
 CCalenMultipleDbUi::CCalenMultipleDbUi(CCalenController& aController) : 
-    iController(aController),
-    iDialogLaunched(EFalse)
+    iController(aController)
     {
     TRACE_ENTRY_POINT;
     TRACE_EXIT_POINT;
@@ -218,9 +220,10 @@
     TRACE_ENTRY_POINT;
     CAknDialog::ConstructL( R_CALEN_MULTIPLEDB_MENUBAR );
     SetTitlePaneL();
-    TCallBack callBack(CCalenMultipleDbUi::DoAsyncExit,this);
-    iAsyncExit = new(ELeave) CAsyncCallBack(callBack,CActive::EPriorityStandard);
     
+    TCallBack actionCallBack(CCalenMultipleDbUi::AsyncCallBackL, this);
+    iAsyncAction = new(ELeave) CAsyncCallBack(actionCallBack,CActive::EPriorityStandard);
+   
 	// register for calendar file change notifications
     RArray<TCalenNotification> notificationArray;
     notificationArray.Append(ECalenNotifyCalendarInfoCreated);
@@ -228,6 +231,8 @@
     notificationArray.Append(ECalenNotifyCalendarFileDeleted);
     iController.RegisterForNotificationsL(this, notificationArray);
     
+    notificationArray.Close();
+    
     iConflictOccured = EFalse;
     
     TRACE_EXIT_POINT;
@@ -251,19 +256,35 @@
         }
     
     delete iBgContext;
+    iBgContext = NULL;
     
     iListBox->Reset();
-    delete iListBox; 
+    delete iListBox;
+    iListBox = NULL;
     
     delete iDesArray;
+    iDesArray = NULL;
     
     iColorUidArray.Close();
     
     iIconIndices.Reset();
     iIconIndices.Close();
     
-    iAsyncExit->Cancel();
-    delete iAsyncExit;
+    iAsyncAction->Cancel();
+    delete iAsyncAction;
+    iAsyncAction = NULL;
+        
+    if(iCalendarInfoNew)
+        {
+        delete iCalendarInfoNew;
+        iCalendarInfoNew = NULL;
+        }
+    
+    if(iCalendarInfoOriginal)
+        {
+        delete iCalendarInfoOriginal;
+        iCalendarInfoOriginal = NULL;
+        }
 
     TRACE_EXIT_POINT;
     }
@@ -324,6 +345,10 @@
 void CCalenMultipleDbUi::UpdateListboxL()
     {
     TRACE_ENTRY_POINT;
+    
+    if(!iListBox)
+        return;
+    
     iListBox->View()->SetDisableRedraw( ETrue );
     iDesArray->Reset();
     iColorUidArray.Close();
@@ -443,14 +468,23 @@
    // Set title text
     CAknTitlePane* tp = static_cast<CAknTitlePane*>(
                                  sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
-
-    HBufC* titleText = StringLoader::LoadLC( R_QTN_CALE_TITLE_CALENDARS , iCoeEnv );
+    HBufC* titleText;
+    if(iIsDbEditorOpen)
+        {
+        titleText = StringLoader::LoadLC( R_QTN_CALE_TITLE_CALENDAR , iCoeEnv );
+        }
+    else
+        {
+        titleText = StringLoader::LoadLC( R_QTN_CALE_TITLE_CALENDARS , iCoeEnv );
+        }
     tp->SetTextL( *titleText );  // r_qtn_cale_title_calendars
     CleanupStack::PopAndDestroy( titleText );
     
     TRACE_EXIT_POINT;
     }
 
+   
+
 
 // ----------------------------------------------------------------------------
 // CCalenMultipleDbUi::DynInitMenuPaneL
@@ -486,7 +520,7 @@
               HBufC* calendarFileName = 
                   calendarInfoList[currentIndex]->FileNameL().AllocLC();
               if (!(calendarFileName->CompareF(
-                      _L("c:Calendar1"))))
+                        iController.Services().SessionL().DefaultFileNameL())))
                   {
                   aMenuPane->DeleteMenuItem(ECalenCmdDelete);
                   }
@@ -517,36 +551,34 @@
       case ECalenCmdEdit:
           {
           TInt retValue = EditItemL();
-          
           if(retValue == EAknCmdExit || retValue == EAknSoftkeyExit )
               {
-              iAsyncExitCmd = retValue;
-              iAsyncExit->CallBack();
+              DoAsyncActionL(retValue);
               }
           }
           break;
       case ECalenCmdAdd:
           {
           TInt retValue = AddItemL();
-          
           if(retValue == EAknCmdExit || retValue == EAknSoftkeyExit )
              {
-             iAsyncExitCmd = retValue;
-             iAsyncExit->CallBack();
+             DoAsyncActionL(retValue);
              }
           }
           break;
       case ECalenCmdDelete:
           {
-          DeleteItemL();
+          DoAsyncActionL(ECalenCmdDelete);
           }
           break;
       case ECalenCmdItemSelect:
+      case ECalenCmdShow:
           {
           DoSelectionL(ETrue);
           }
           break;
       case ECalenCmdItemDeselect:
+      case ECalenCmdHide:
           {
           DoSelectionL(EFalse);
           }
@@ -554,22 +586,16 @@
       case EAknCmdExit:
       case EAknSoftkeyExit:
           {
-          iAsyncExitCmd = EAknSoftkeyExit;
-          iAsyncExit->CallBack();
+          DoAsyncActionL(EAknSoftkeyExit);
           }
           break;
-     case ECalenCmdShow:
-          {
-          DoSelectionL( ETrue );
-          }
+      case EAknCmdHelp:      
+            if (FeatureManager::FeatureSupported(KFeatureIdHelp))
+                {
+                HlpLauncher::LaunchHelpApplicationL(
+                        iCoeEnv->WsSession(),iAvkonAppUi->AppHelpContextL());                        
+                }
           break;
-
-      case ECalenCmdHide:   
-          {
-          DoSelectionL( EFalse );
-          }
-          break;             
-          
       default:
           break;
       }
@@ -577,6 +603,23 @@
     }
 
 // ----------------------------------------------------------------------------
+// CCalenMultipleDbUi::GetHelpContext
+// Gets help context
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+void CCalenMultipleDbUi::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    TRACE_ENTRY_POINT;
+
+    aContext.iMajor = KUidCalendar;
+    // This is specified in HRH file.
+    aContext.iContext = KCALE_HLP_DAY_VIEW; //KCALE_HLP_DAY_VIEW should be replaced with MultipleDbUi related help id
+
+    TRACE_EXIT_POINT;
+    }
+
+// ----------------------------------------------------------------------------
 // CCalenMultipleDbUi::DoSelectionL
 // Mark the listbox item as hidden/visible based on aMark status
 // ----------------------------------------------------------------------------
@@ -606,49 +649,90 @@
 TInt CCalenMultipleDbUi::AddItemL()
     {
     TRACE_ENTRY_POINT
-    TInt retValue = KErrNotFound;
+    TInt retValue = 0;
+    
+    if(iCalendarInfoNew)
+        {
+        delete iCalendarInfoNew;
+        iCalendarInfoNew = NULL;
+        }
     
-    CCalCalendarInfo* calendarInfo = CCalCalendarInfo::NewL();
-    calendarInfo->SetNameL(KNullDesC16);
-    calendarInfo->SetColor(255);
-    calendarInfo->SetEnabled(ETrue);
-    iDbEditor = CCalenMultiDBEditor::NewL( *calendarInfo, iController, EFalse );
+    iCalendarInfoNew = CCalCalendarInfo::NewL();
+    iCalendarInfoNew->SetNameL(KNullDesC16);
+    iCalendarInfoNew->SetColor(255);
+    iCalendarInfoNew->SetEnabled(ETrue);
+    iDbEditor = CCalenMultiDBEditor::NewL(*this,*iCalendarInfoNew, iController, EFalse );
   
-    iDialogLaunched = ETrue;
+    //Async dialog
     retValue = iDbEditor->ExecuteLD();
-    iDbEditor = NULL;
-    iDialogLaunched = EFalse; 
-    
+    //iDbEditor = NULL;
+     
     if(EAknCmdExit == retValue )
         {
         iController.BroadcastNotification(ECalenNotifyRealExit);
         }
     
-    HBufC* calendarName = calendarInfo->NameL().AllocLC();
-    calendarName->Des().Trim();
-    if(calendarName->Length() > 0)
+    TRACE_EXIT_POINT
+    return retValue;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CCalenMultipleDbUi::UpdateAddOrEditL
+// ----------------------------------------------------------------------------
+//
+void CCalenMultipleDbUi::UpdateOnAddOrEditL(TBool aItemAdded)
+    {
+    TRACE_ENTRY_POINT
+	
+	iDbEditor = NULL;
+    
+    if(aItemAdded)
         {
-        
         // Set calendar properties for new calendar being created.
-        SetCalendarAddPropertiesL(*calendarInfo);
-        
-        iController.AddCalendarL(calendarInfo);
-        
-        UpdateListboxL();
-        
+        SetCalendarAddPropertiesL(*iCalendarInfoNew);
+       
+        iController.AddCalendarL(iCalendarInfoNew);
+        iCalendarInfoNew = NULL;
+       
         //Highlight the newly created list item
         iListBox->ScrollToMakeItemVisible(iListBox->BottomItemIndex());
         iListBox->SetCurrentItemIndexAndDraw(iDesArray->Count()-1);
         }
-    else 
+    else
         {
-        delete calendarInfo;
+        //Before checking for changes , check if any conflict occured i.e calendar updated / deleted.
+        //if there is conflict iConflictOccured = true then skip below condition.
+        if (!iConflictOccured && iCalendarInfoOriginal &&
+                CheckForChangesL(*iCalendarInfoOriginal,
+                *iCalendarInfoEdited))
+            {
+            // update the calendar properties such as modification time, sync status.
+            SetCalendarUpdatePropertiesL(*iCalendarInfoEdited);
+            
+            iController.UpdateCalendarL(iCalendarInfoEdited);
+            }
+
+        iConflictOccured = EFalse;
+        delete iCalendarInfoOriginal,iCalendarInfoOriginal = NULL;
         }
-    
-    CleanupStack::PopAndDestroy(calendarName);  
+    iIsDbEditorOpen = EFalse ; //iIsDbEditorOpen should be set before calling UpdateListboxL() 
+    UpdateListboxL();
     
     TRACE_EXIT_POINT
-    return retValue;
+    }
+
+// ----------------------------------------------------------------------------
+// CCalenMultipleDbUi::ExitDialogL
+// Edit item from listbox 
+// ----------------------------------------------------------------------------
+//
+void CCalenMultipleDbUi::ExitDialogL()
+    {
+    TRACE_ENTRY_POINT
+    iAsyncActionCmd = EAknSoftkeyExit;
+    iAsyncAction->CallBack();
+    TRACE_EXIT_POINT
     }
 
 // ----------------------------------------------------------------------------
@@ -661,60 +745,41 @@
     TRACE_ENTRY_POINT
     TInt retValue = KErrNotFound;
     TInt currentIndex = iListBox->CurrentItemIndex();
-    TInt listCount = iListBox->Model()->ItemTextArray()->MdcaCount();
-
+    
     RPointerArray<CCalCalendarInfo> calendarInfoList;
     iController.GetAllCalendarInfoL(calendarInfoList);
     CleanupClosePushL(calendarInfoList);
     
-    CCalCalendarInfo* calendarInfoedited = calendarInfoList[currentIndex];
+    iCalendarInfoEdited = calendarInfoList[currentIndex];
+    
+    CleanupStack::PopAndDestroy(&calendarInfoList);
     
     //Take a copy of original before editing
-    CCalCalendarInfo* calendarInfoOriginal = CCalCalendarInfo::NewL();
-    CleanupStack::PushL(calendarInfoOriginal);
-    calendarInfoOriginal->SetNameL(calendarInfoedited->NameL());
-    calendarInfoOriginal->SetColor(calendarInfoedited->Color());
-    calendarInfoOriginal->SetEnabled(calendarInfoedited->Enabled());
+    if(iCalendarInfoOriginal)
+        {
+        delete iCalendarInfoOriginal;
+        iCalendarInfoOriginal = NULL;
+        }
+    iCalendarInfoOriginal = CCalCalendarInfo::NewL();
+    
+    iCalendarInfoOriginal->SetNameL(iCalendarInfoEdited->NameL());
+    iCalendarInfoOriginal->SetColor(iCalendarInfoEdited->Color());
+    iCalendarInfoOriginal->SetEnabled(iCalendarInfoEdited->Enabled());
     TBuf8<KBuffLength> keyBuff;
     TBool syncstatus = EFalse;
     keyBuff.Zero();
     keyBuff.AppendNum( ESyncStatus ); 
     TPckgC<TBool> pckgSyncStatusValue(syncstatus);
-    pckgSyncStatusValue.Set(calendarInfoedited->PropertyValueL( keyBuff ));
-    calendarInfoOriginal->SetPropertyL( keyBuff, pckgSyncStatusValue );                
+    TRAP_IGNORE(pckgSyncStatusValue.Set(iCalendarInfoEdited->PropertyValueL( keyBuff ))); 
+    iCalendarInfoOriginal->SetPropertyL( keyBuff, pckgSyncStatusValue );                
 
-    iDbEditor = CCalenMultiDBEditor::NewL(*calendarInfoedited, iController,
+    iDbEditor = CCalenMultiDBEditor::NewL(*this,*iCalendarInfoEdited, iController,
             ETrue);
 
-    iDialogLaunched = ETrue;
+    //Async dialog
     retValue = iDbEditor->ExecuteLD();
-    iDbEditor = NULL;
-    iDialogLaunched = EFalse;
-
-    //Before checking for changes , check if any conflict occured i.e calendar updated / deleted.
-    //if there is conflict iConflictOccured = true then skip below condition.
-    if (!iConflictOccured && CheckForChangesL(*calendarInfoOriginal,
-            *calendarInfoedited))
-        {
-        // update the calendar properties such as modification time, sync status.
-        SetCalendarUpdatePropertiesL(*calendarInfoedited);
-        
-        iController.UpdateCalendarL(calendarInfoedited);
-        }
-
-    iConflictOccured = EFalse;
-
-    UpdateListboxL();
-
-    //If conflict occured i.e calendar deleted check for list count before and after
-    //and update focus accordingly
-    if (listCount != iListBox->Model()->ItemTextArray()->MdcaCount())
-        {
-        ReAdjustListItemFocusL(currentIndex);
-        }
-
-    CleanupStack::PopAndDestroy(calendarInfoOriginal);
-    CleanupStack::PopAndDestroy(&calendarInfoList);
+    //iDbEditor = NULL;
+    
     return retValue;
     TRACE_EXIT_POINT
     }
@@ -728,7 +793,7 @@
     {
     TRACE_ENTRY_POINT;
     
-    TInt currentIndex =  iListBox->CurrentItemIndex();
+    TInt currentIndex =  iCurrentIndex;
     
     RPointerArray<CCalCalendarInfo> calendarInfoList; 
     iController.GetAllCalendarInfoL(calendarInfoList);
@@ -810,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())
@@ -919,16 +984,18 @@
            }
            break;
        case EAknSoftkeyBack:
+       case EKeyEscape:
            {
            iController.BroadcastNotification(ECalenNotifyDeleteInstanceView);
            okExit = ETrue;
            }
            break;
-	   case EKeyEscape:
+       case EKeyNo:
            {
-           okExit = ETrue;
+           iController.BroadcastNotification(ECalenNotifyDeleteInstanceView);
+           okExit = CAknDialog::OkToExitL(aButtonId);
+           break;
            }
-           break;
        default:
            {
            okExit = CAknDialog::OkToExitL(aButtonId);
@@ -1114,17 +1181,60 @@
     }
 
 // ----------------------------------------------------------------------------
-// CCalenMultipleDbUi::CallBackForAddAndDeleteL
+// CCalenMultipleDbUi::AsyncCallBackL
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+TInt CCalenMultipleDbUi::AsyncCallBackL(TAny* aThisPtr)
+    {
+    TRACE_ENTRY_POINT
+    CCalenMultipleDbUi* self = static_cast<CCalenMultipleDbUi*>(aThisPtr);
+    self->HandleAsyncCommandL(self->iAsyncActionCmd);
+    TRACE_EXIT_POINT
+    return 0;
+    }
+
+// ----------------------------------------------------------------------------
+// CCalenMultipleDbUi::DoAsyncActionL
 // (other items were commented in a header).
 // ----------------------------------------------------------------------------
 //
-TInt CCalenMultipleDbUi::DoAsyncExit(TAny* aPtr)
+void CCalenMultipleDbUi::DoAsyncActionL(const TInt aCommand)
+    {
+    TRACE_ENTRY_POINT
+    iCurrentIndex = iListBox->CurrentItemIndex();
+    iAsyncActionCmd = aCommand;
+    iAsyncAction->CallBack();
+    TRACE_EXIT_POINT
+    }
+
+// ----------------------------------------------------------------------------
+// CCalenMultipleDbUi::DoAsyncActionL
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+void CCalenMultipleDbUi::HandleAsyncCommandL(const TInt aCommand)
     {
     TRACE_ENTRY_POINT
-    CCalenMultipleDbUi* self = static_cast<CCalenMultipleDbUi*>(aPtr);
-    self->TryExitL(self->iAsyncExitCmd);
+    
+    switch(aCommand)
+        {
+        case EAknSoftkeyExit:
+        case EAknCmdExit:
+            {
+            TryExitL(aCommand);
+            }
+            break;
+        case ECalenCmdDelete:
+            {
+            DeleteItemL();
+            }
+            break;
+        default:
+            break;
+        }
+    
     TRACE_EXIT_POINT
-    return 0;
     }
 
 // ----------------------------------------------------------------------------
@@ -1353,7 +1463,7 @@
                {
                iIsDbEditorOpen = ETrue ;
                ProcessCommandL( ECalenCmdEdit );
-               iIsDbEditorOpen = EFalse ;
+               
                }
            }
        }
--- a/calendarui/controller/src/calennotifier.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calennotifier.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -101,13 +101,6 @@
         iEComWatcher = NULL;
         }
 
-    // Stop database change notifications.
-    if( iDbChangeNotifier )
-        {
-        delete iDbChangeNotifier;
-        iDbChangeNotifier = NULL;
-        }
-    
     // Stop settings change notifications
     if( iCenRepChangeNotifier )
         {
@@ -170,10 +163,6 @@
     iCenRepChangeNotifier = CCenRepNotifyHandler::NewL( *this, *iRepository );
     iCenRepChangeNotifier->StartListeningL();
     
-    // Register for changes to our database session
-    iDbChangeNotifier = CCalenDbChangeNotifier::NewL( *iGlobalData );
-    iDbChangeNotifier->RegisterObserverL( *this );
-  
     // Register for changes to the ECom registry
     iEComWatcher = CCalenEComWatcher::NewL( *this );
      
@@ -650,7 +639,10 @@
         );
 
         // Exit application
-        iAvkonAppUi->Exit();
+        if (iAvkonAppUi)
+            {
+            iAvkonAppUi->Exit();
+            }
         }
 
     TRACE_EXIT_POINT;
@@ -771,6 +763,7 @@
 			case MCalFileChangeObserver::ECalendarFileCreated:
 			case MCalFileChangeObserver::ECalendarInfoCreated:
 				{
+				BroadcastNotification(ECalenNotifyDeleteInstanceView);
 				BroadcastNotification(ECalenNotifyCalendarInfoCreated);
 				}
 				break;
@@ -800,9 +793,6 @@
 
                 if (err == KErrNone && markAsdelete)
                     {
-                    //BroadcastNotification(ECalenNotifyCloseDialog);
-                    BroadcastNotification(ECalenNotifyDeleteInstanceView);
-                    BroadcastNotification(ECalenNotifyCalendarFileDeleted);
                     iFilnameDeleted = aCalendarInfoChangeEntries[index]->FileNameL().AllocL();
                     iAsyncCallback->CallBack();
                     }
@@ -815,6 +805,7 @@
 			default:
 				break;
 			}
+		context.ResetCalendarFileName();
 		}
 
 	TRACE_EXIT_POINT;
@@ -837,7 +828,10 @@
 void CCalenNotifier::AsyncRemoveCalendarL()
     {
     TRACE_ENTRY_POINT
+    BroadcastNotification(ECalenNotifyDeleteInstanceView);
     iGlobalData->RemoveCalendarL(iFilnameDeleted->Des());
+    BroadcastNotification(ECalenNotifyCalendarFileDeleted);
+                       
     delete iFilnameDeleted;
     iFilnameDeleted = NULL;
     TRACE_EXIT_POINT
--- a/calendarui/controller/src/calenpopulationstate.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenpopulationstate.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -99,14 +99,6 @@
         RequestCallbackL( handler, aCommand );
         cmdUsed = ETrue;
         }
-    
-    else if( ECalenEventView == cmd )
-        {
-        SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState );
-        ActivateCurrentStateL(aStateMachine);
-        RequestCallbackL( handler, aCommand );
-        cmdUsed = ETrue;
-        }
 
     TRACE_EXIT_POINT;
     return cmdUsed;
--- a/calendarui/controller/src/calenservicesimpl.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenservicesimpl.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -418,12 +418,12 @@
 // (other items were commented in a header).
 // ----------------------------------------------------------------------------
 //
-CGulIcon* CCalenServicesImpl::GetIconL( MCalenServices::TCalenIcons aIndex )
+CGulIcon* CCalenServicesImpl::GetIconL( MCalenServices::TCalenIcons aIndex, const TInt aViewId ) 
     {
     TRACE_ENTRY_POINT;
 
     TRACE_EXIT_POINT;
-    return iController->GetIconL( aIndex );
+    return iController->GetIconL( aIndex, aViewId );
     }
 
 // ----------------------------------------------------------------------------
--- a/calendarui/controller/src/calensettingsstate.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calensettingsstate.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -153,6 +153,8 @@
             ActivateCurrentStateL(aStateMachine);
             }
             break;
+        case ECalenNotifySettingsChanged:
+            break;
         default:
             // default is defer all other notifications when we are in setting state
             iOutstandingNotifications.InsertL(aNotification);
--- a/calendarui/controller/src/calenstate.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenstate.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -128,9 +128,11 @@
         case ECalenNotifyAppBackgrounded:
         	{
         	CCalenStateMachine::TCalenStateIndex cachedState = aStateMachine.GetCurrentState();
-        	if(cachedState != CCalenStateMachine::ECalenMapState) // Never send calendar to background state in MapState as maps will 
-        	                                                        // launched in cahin mode not in stand alone mode
-        	    {
+        	// Never send calendar to background state in MapState as maps will
+        	// launched in cahin mode not in stand alone mode
+        	if((cachedState != CCalenStateMachine::ECalenMapState) &&
+        		(cachedState != CCalenStateMachine::ECalenPopulationState))
+        		{
                 aStateMachine.SetCurrentState(CCalenStateMachine::ECalenBackgroundState);
                 aStateMachine.SetCurrentPreviousState(cachedState);
                 iOutstandingNotifications.InsertL(aNotification);
--- a/calendarui/controller/src/calentoolbarimpl.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calentoolbarimpl.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -390,7 +390,7 @@
     
     ResetToolbarExtensionCommandsL();
     // add toolbar items for native views
-    for(TInt index = viewPositionArray.Count()-1;index >= KPositionZero ;index--)
+    for(TInt index = KPositionZero ;index < viewPositionArray.Count()  ;index++)
         {
         viewPosition = viewInfoArray.Find( viewPositionArray[index],
                                 CCalenViewInfo::ViewInfoIdentifier );
@@ -449,12 +449,13 @@
     TInt currViewInfoPos = aViewInfoArray.Find( aCurrentViewUid , 
                                          CCalenViewInfo::ViewInfoIdentifier );
     
-    TInt index = currViewInfoPos + 1;
-    while( index!= currViewInfoPos )
+    TInt index = aViewInfoArray.Find( KUidCalenMonthView ,  CCalenViewInfo::ViewInfoIdentifier );
+    
+    while( index!= aViewInfoArray.Count() )
         {
-        if( index == aViewInfoArray.Count()) // If last item,
+        if( index == currViewInfoPos) // If last item,
             {
-            index = 0;
+            index ++;
             continue;
             }
         if(( aViewInfoArray[index]->CyclePosition() != CCalenView::ENoCyclePosition ) )
--- a/calendarui/controller/src/calenviewattachmentsdialog.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenviewattachmentsdialog.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -105,7 +105,8 @@
       CCalenAttachmentModel& aAttachmentModel,CCalenController& aController )
     : iAttachmentModel( aAttachmentModel ),
       iController(aController),
-      iNewTitle( aTitle )  
+      iNewTitle( aTitle ),
+      iEmbeddedFileOpened(EFalse)  
     {
     TRACE_ENTRY_POINT;
     TRACE_EXIT_POINT;
@@ -392,6 +393,7 @@
     {
     TRACE_ENTRY_POINT;
     
+    iEmbeddedFileOpened = EFalse;
     if (aReason == EAknCmdExit)
         {
         //issue this notification, which will be handled by attachmentui.
@@ -798,7 +800,7 @@
     {
     TRACE_ENTRY_POINT;
      //Single click integration
-    if ( iListBox )
+    if ( iListBox && !iEmbeddedFileOpened)
         {
         iListBox->HandlePointerEventL( aPointerEvent );
         }
@@ -1098,18 +1100,27 @@
     
     if(datatype == KNotePadTextDataType())
         {
+        if(iEmbeddedFileOpened)
+            {
+            return;
+            }
+        iEmbeddedFileOpened = ETrue;   
         const TDesC& notepadTitle = _L("NotePad");
         ret = CNotepadApi::ExecFileViewerL( aFile, 
                                            &notepadTitle,
                                            ETrue,
                                            ETrue,
                                            KCharacterSetIdentifierIso88591 );
-        
+        iEmbeddedFileOpened = EFalse;        
         }
     else
         {
         //doc handler will open the other files (other than text file).
         TRAP( ret, iDocHandler->OpenFileEmbeddedL( aFile, datatype ) );
+        if(ret == KErrNone)
+            {
+            iEmbeddedFileOpened = ETrue;
+            }
         }
 
     switch(ret)
--- a/calendarui/controller/src/calenviewmanager.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenviewmanager.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -540,6 +540,10 @@
                 iPreviousToDayView.iViewUid = KNullUid;
                 }
             RequestActivationL( KUidCalenDayView, KCalenDummyUid, KNullDesC8() );
+            if(iController.IsLaunchFromExternalApp())
+                {
+                iAvoidRepopulation = ETrue;
+                }
             }
             break;
         case ECalenTodoView:
@@ -574,6 +578,14 @@
             RequestActivationL( KUidCalenDayView, KUidCalenShowBackCba );
             }
             break;
+        case ECalenForwardsToWeekView:
+            {
+            // set the view iPreviousToWeekView to handle the week view's cba
+            // From month view -> week view 
+            iPreviousToWeekView = iCurrentViewId;
+            RequestActivationL( KUidCalenWeekView, KUidCalenShowBackCba );
+            }
+            break;
         case ECalenNextView:
             {
             CycleNextViewL();
@@ -702,7 +714,7 @@
     // check for iAvoidRepopulation to avoid repopulation whenever
     // 1) Application comes to foreground
     // 2) Applictaion is opened after fake exit
-    if(!iAvoidRepopulation)
+    if(!iAvoidRepopulation || iController.IsLaunchFromExternalApp() )
         {
         TRAPD(error,StartActiveStepL());
         if(error!=KErrNone)
@@ -891,8 +903,10 @@
 		}
 	
 	// set the previous view id
-	iPreviousViewId.iViewUid = cachePreviousViewId;
-	
+	if(cachePreviousViewId != KUidCalenEventView) 
+	    {
+        iPreviousViewId.iViewUid = cachePreviousViewId; 
+	    }	
 	TRACE_EXIT_POINT;
     }
 
@@ -1096,6 +1110,10 @@
 			    
 			    ReloadAllPluginsL();
 			    }
+            else
+                {
+                iAvoidRepopulation = EFalse;
+                }
         	}
         	break;
         case ECalenNotifyDayViewClosed:
@@ -1108,6 +1126,16 @@
                 }
             }
             break;
+        case ECalenNotifyWeekViewClosed:
+            {
+            if(iPreviousToWeekView.iViewUid!= KNullUid)
+                {
+                // activate the previous view from where day view is launched
+                // From month/week view -> day view
+                RequestActivationL(iPreviousToWeekView.iViewUid);
+                }
+            }
+            break;
         case ECalenNotifyAppBackgrounded:
             {
             // set the flag iAvoidRepopulation to prevent repopulation
@@ -1338,7 +1366,14 @@
     {
     TRACE_ENTRY_POINT;
     TRACE_EXIT_POINT;
-    return iToolbar;
+    if (iToolbar)
+        {
+        if (iToolbar->IsICalenToolBar())
+            {
+            return iToolbar;
+            }
+        }
+    return NULL;
     }        
     
 // ----------------------------------------------------------------------------
@@ -1514,7 +1549,14 @@
         // the event view 
         if(iPreviousViewId.iViewUid != KNullUid)
             {
-            RequestActivationL(iPreviousViewId.iViewUid);   
+            if(iPreviousToDayView.iViewUid != KNullUid)
+                {
+                RequestActivationL(iPreviousViewId.iViewUid, KUidCalenShowBackCba);
+                }
+            else
+                {
+                RequestActivationL(iPreviousViewId.iViewUid);
+                }
             }
         }
     else
@@ -1718,25 +1760,6 @@
             CleanupStack::PopAndDestroy(repository);  
             }
         }
-    else // If default view is native view, then activate it
-        {
-        iAvoidRepopulation = EFalse;
-        // In case of launching missed event view or missed alarms view, there
-        // is no need to activate default view.
-        if( ( iCurrentViewId.iViewUid.iUid != KCalenMissedEventViewUidValue ) && 
-                          ( iCurrentViewId.iViewUid.iUid != KCalenMissedAlarmsViewUidValue ) )
-            {
-            // Find the default view in the view cycle list
-            TInt position = iViewInfoArray.Find(
-                    defaultViewUid, CCalenViewInfo::ViewInfoIdentifier );
-            if( position != KErrNotFound )
-                {
-                TVwsViewId targetViewId( KUidCalendar, defaultViewUid);
-                RequestActivationL(targetViewId);
-                iViewCycleIndex = position;
-                }
-            }
-        }
     
     TRACE_EXIT_POINT;
     }
@@ -1800,4 +1823,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/controller/src/calenviewpopulator.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/controller/src/calenviewpopulator.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -26,6 +26,9 @@
 #include "calenglobaldata.h"
 #include "calennotifier.h"
 
+#include <eikenv.h> // For CEikonEnv
+#include <apgtask.h>
+
 // ----------------------------------------------------------------------------
 // CCalenViewPopulator::NewL
 // 1st phase of construction
@@ -192,6 +195,16 @@
         	{
         	iPopulatingView = NULL;
             iController.Notifier().BroadcastNotification( ECalenNotifyViewPopulationComplete );
+            
+            if( iController.IsLaunchFromExternalApp() )
+                {
+                CEikonEnv* eikenv = CEikonEnv::Static();
+                iController.SetLaunchFromExternalApp( EFalse );
+                const TUid KCalendarAppUID = { 0x10005901 };
+                TApaTaskList taskList( eikenv->WsSession() );
+                TApaTask task = taskList.FindApp( KCalendarAppUID );
+                task.BringToForeground();
+                }
         	}
             break;
         default:
--- a/calendarui/customisationmanager/inc/calencustomisationmanager.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/customisationmanager/inc/calencustomisationmanager.h	Sun Jun 20 22:55:39 2010 +0200
@@ -200,7 +200,7 @@
 private: // New functions
     void LoadPluginL( TUid aPluginUid );
 
-    void DoImmediatePluginLoadingL();
+    void DoImmediatePluginLoadingL(TBool aLoadViewbasedPulgins = EFalse);   
 
     void OfferMenuPaneToPluginsL( TInt aResourceId, CEikMenuPane* aMenuPane );
 
--- a/calendarui/customisationmanager/src/calencustomisationmanager.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/customisationmanager/src/calencustomisationmanager.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -500,20 +500,24 @@
         TInt position = iPlugins.Find( aPlugins[index], CPluginInfo::Identifier );
         if ( position != KErrNotFound ) 
 	        {
-        	if((iInfoBarProviderUid != iPlugins[position]->Uid())
-        		&& (iPreviewPaneProviderUid != iPlugins[ position]->Uid()))
-	            {
-	            CPluginInfo* removedPlugin = iPlugins[ position ];
-	            iPlugins.Remove( position );
-	            delete removedPlugin;
-	            }
-        	else 
-	        	{
-	        	iPlugins[position]->Disable(ETrue);
-				iDefferedUnloadPluginList.AppendL(iPlugins[position]->Uid());
-				iInfoBarProviderUid = KNullUid;
-				iPreviewPaneProviderUid = KNullUid;
-	        	}
+            TUid pluginUid = iPlugins[ position]->Uid();
+            if(!(iRomBasedPlugins.Find(pluginUid) != KErrNotFound))
+                {
+                    if((iInfoBarProviderUid != iPlugins[position]->Uid())
+                        && (iPreviewPaneProviderUid != iPlugins[ position]->Uid()))
+                        {
+                        CPluginInfo* removedPlugin = iPlugins[ position ];                   
+                        iPlugins.Remove( position );
+                        delete removedPlugin;
+                        }
+                    else 
+                        {
+                        iPlugins[position]->Disable(ETrue);
+                        iDefferedUnloadPluginList.AppendL(iPlugins[position]->Uid());
+                        iInfoBarProviderUid = KNullUid;
+                        iPreviewPaneProviderUid = KNullUid;
+                        }
+                }     
 		   }
         }
     TRACE_EXIT_POINT;
@@ -735,7 +739,7 @@
 // (other items were commented in a header).
 // ----------------------------------------------------------------------------
 //
-void CCalenCustomisationManager::DoImmediatePluginLoadingL()
+void CCalenCustomisationManager::DoImmediatePluginLoadingL(TBool aLoadViewbasedPulgins)
     {
     TRACE_ENTRY_POINT;
 
@@ -755,7 +759,22 @@
     for ( TInt index( 0 ); index < pluginCount; ++index )
         {
         TUid pluginUid = iPluginInfo[index]->ImplementationUid();
-        if ( iActivePlugins.Find( pluginUid ) != KErrNotFound )
+        TBool loadPlugins(EFalse);
+        
+        if(aLoadViewbasedPulgins)
+            {
+            if ( (iActivePlugins.Find( pluginUid ) != KErrNotFound) && 
+                 !(iRomBasedPlugins.Find( pluginUid ) != KErrNotFound) )
+                {
+                loadPlugins = ETrue;
+                }                
+            }
+        else if((iActivePlugins.Find( pluginUid ) != KErrNotFound))
+            {
+            loadPlugins = ETrue;
+            }       
+        
+        if (loadPlugins)
             {
             TRAPD( error, LoadPluginL( pluginUid ) );
             if ( error )
@@ -1473,8 +1492,8 @@
 EXPORT_C void CCalenCustomisationManager::DoPluginLoadingL()
     {
     TRACE_ENTRY_POINT;
-    // Reset and destroy the contents of the owned arrays
-    iPlugins.ResetAndDestroy();
+    // Reset and destroy the contents of the owned arrays    
+    //iPlugins.ResetAndDestroy();
 
     iPluginInfo.ResetAndDestroy();
 
@@ -1485,7 +1504,7 @@
     // create active plugin list
     CreateActivePluginListL();
     
-    DoImmediatePluginLoadingL();
+    DoImmediatePluginLoadingL(ETrue);
     iSetting->LoadL();
     iSetting->UpdatePluginListL(*this);
     
--- a/calendarui/editors/data/CalenDefaultEditorsData.rss	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/editors/data/CalenDefaultEditorsData.rss	Sun Jun 20 22:55:39 2010 +0200
@@ -202,7 +202,7 @@
             },
         MENU_ITEM
             {
-            command = EAknCmdExit;
+            command = EAknSoftkeyExit;
             txt = qtn_options_exit;
             }
         };
@@ -273,7 +273,7 @@
             },
         MENU_ITEM
             {
-            command = EAknCmdExit;
+            command = EAknSoftkeyExit;
             txt = qtn_options_exit;
             }
         };
@@ -365,6 +365,25 @@
             }
         };
     }
+    RESOURCE DIALOG r_calen_db_change_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items = 
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                layout = EConfirmationQueryLayout;
+                label = qtn_calen_db_change_del_exeptions;
+                };
+            }
+        };
+    }
+
 
 RESOURCE TBUF r_qtn_cale_inote_desc_del_memo
     {
@@ -1015,7 +1034,7 @@
 //
 RESOURCE TBUF r_qtn_calen_editor_date_of_birth
     {
-    buf = qtn_cale_label_date;
+    buf = qtn_cale_viewer_date; 
     }
 
 // ---------------------------------------------------------
@@ -1624,7 +1643,7 @@
             },
         MENU_ITEM
             {
-            command = EAknCmdExit;
+            command = EAknSoftkeyExit;
             txt = qtn_options_exit;
             }
         };
--- a/calendarui/editors/inc/calendbfield.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/editors/inc/calendbfield.h	Sun Jun 20 22:55:39 2010 +0200
@@ -116,6 +116,24 @@
           */
          static TBool CalendarInfoNameIdentifierL( const HBufC* aName,
                                     const CCalCalendarInfo& aInfoItem );
+         
+         /**
+          * @brief show infonote when database changes and entry having
+          * childs.
+          */
+         void ShowChangeDBQueryL();
+         /*
+          * Callback for CAsyncCallBack class
+          * @param aThisPtr* this pointer.
+          * @return TInt status.
+          */         
+         static TInt DoAsyncShowChangeDBQueryL(TAny* aThisPtr);
+         
+         /**
+          * @brief Update data in editor
+          * @param aColId collection Id of selected database
+          */    
+         void SetDataToEditorL(const TCalCollectionId& aColId);
 
     public:
          //previous calendar collection id  
@@ -153,6 +171,7 @@
         //services referance not owned
         MCalenServices* iServices;
         HBufC* iCalendarFileName;
+        CAsyncCallBack* iAsyncDBquery;        
         
     };
 
--- a/calendarui/editors/inc/calenunifiededitor.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/editors/inc/calenunifiededitor.h	Sun Jun 20 22:55:39 2010 +0200
@@ -297,8 +297,9 @@
 
         /**
          * @brief Handles "Exit" command.
+         * @param aCmd Holds the command issued.
          */
-        void OnCmdExitL();
+        void OnCmdExitL(TInt aCmd);
         
         /**
          * @brief Delete note from Calendar.
@@ -355,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
@@ -501,6 +507,7 @@
          */
         void GetAttachmentNamesL(RPointerArray<HBufC>& aAttachmentNames);
         
+        TBool iCheck;
     protected:
         /**
          * From CEikDialog
--- a/calendarui/editors/src/CalenEditorDataHandler.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/editors/src/CalenEditorDataHandler.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -790,7 +790,22 @@
         case ERepeatDaily:
         case ERepeatWorkdays:
             {
-            TTimeIntervalDays durDays = Edited().EndDateTime().DaysFrom( Edited().StartDateTime() );
+            TTime startDate = Edited().StartDateTime();
+            TTime endDate = Edited().EndDateTime();
+            // In case AllDay event end at "12:00am" 24/06/2009. 
+            // editor should display EndDate as 23/06/2009.
+            if(Edited().IsAllDayEvent())
+                {
+                if( endDate > startDate )
+                    {
+                    endDate -= TTimeIntervalDays( 1 );
+                    if( endDate < startDate )
+                        {
+                        endDate = startDate;
+                        }
+                    }
+                }
+            TTimeIntervalDays durDays = endDate.DaysFrom( startDate);
             isError = durDays >= TTimeIntervalDays(1);
             break;
             }
--- a/calendarui/editors/src/calenalldayfield.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/editors/src/calenalldayfield.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -162,11 +162,11 @@
         // editor should display EndDate as 23/06/2009.
         if( endDate > startDate )
             {
-            //endDate -= TTimeIntervalDays( 1 );
-            //endDate contains the time component also, even for same day endDate would be greater then startDate
-            //subtracting 1 from endate will give endDate as one day before startDate.
-            //For All day event Start date and End Date are same so assigning startDate to endDate.
-            endDate = startDate;
+            endDate -= TTimeIntervalDays( 1 );
+            if( endDate < startDate )
+                {
+                endDate = startDate;
+                }
             }
 		
 		iUnifiedEditor.EditorFields().SetDateField( ECalenEditorStartDate, startDate, ETrue );
--- a/calendarui/editors/src/calendbfield.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/editors/src/calendbfield.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -18,6 +18,7 @@
 // system includes
 #include <AknPopupField.h>
 #include <AknQueryValueText.h>
+#include <AknQueryDialog.h>
 #include <badesca.h>
 #include <calentry.h>
 #include <centralrepository.h>
@@ -111,6 +112,13 @@
     {
     TRACE_ENTRY_POINT;
 
+    if( iAsyncDBquery )
+        {
+        iAsyncDBquery->Cancel();
+        delete iAsyncDBquery;
+        iAsyncDBquery = NULL;
+        }
+    
     delete iDbNamesArrayText;
     delete iDbNamesArray;
     delete iDbNamesTextValues;
@@ -203,6 +211,41 @@
     }
 
 // -----------------------------------------------------------------------------
+// CCalenDbField::SetDataToEditorL
+// update data in form
+// -----------------------------------------------------------------------------
+//
+void CCalenDbField::SetDataToEditorL(const TCalCollectionId& aColId)
+    {
+    TRACE_ENTRY_POINT;
+    //Get MultipleDbInfo array
+    RPointerArray<CCalCalendarInfo> calendarInfoList;
+    iServices->GetAllCalendarInfoL(calendarInfoList);
+    CleanupClosePushL(calendarInfoList);
+
+    TInt index = KErrNotFound;   
+    
+    HBufC* calendarFileName= iServices->GetCalFileNameForCollectionId(aColId).AllocLC();
+    index = calendarInfoList.Find(*calendarFileName, CCalenDbField::CalendarInfoNameIdentifierL);
+    CleanupStack::PopAndDestroy(calendarFileName);        
+    
+    if (KErrNotFound == index)
+        {
+        iDbNamesTextValues->SetCurrentValueIndex(0);
+        }
+    else
+        {
+        iDbNamesTextValues->SetCurrentValueIndex(index);
+        }
+    iUnifiedEditor.EditorDataHandler().SetCalendarFieldEditedL(
+            IsCalendarEdited(), iPreviousColId, iCurrentColId);
+
+    CleanupStack::PopAndDestroy(&calendarInfoList);
+   
+    TRACE_EXIT_POINT;
+    }
+
+// -----------------------------------------------------------------------------
 // CCalenDbField::HandleControlStateChangeL
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
@@ -219,6 +262,10 @@
             ReadDataFromFormL( continueOnError );
             iUnifiedEditor.EditorDataHandler().SetCalendarFieldEditedL(IsCalendarEdited()
                                                             ,iPreviousColId,iCurrentColId);
+            
+            TCallBack callback(DoAsyncShowChangeDBQueryL,this);
+            iAsyncDBquery = new(ELeave) CAsyncCallBack(callback,CActive::EPriorityStandard);
+            iAsyncDBquery->CallBack();
             break;
             }
         default: 
@@ -228,6 +275,23 @@
     TRACE_EXIT_POINT;
     }
 
+// ----------------------------------------------------------------------------
+// CallBackForShowinginfonote
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+//
+TInt CCalenDbField::DoAsyncShowChangeDBQueryL(TAny* aThisPtr)
+    {
+    TRACE_ENTRY_POINT
+    CCalenDbField* self = static_cast<CCalenDbField*>(aThisPtr);
+    if(self)
+        {
+        self->ShowChangeDBQueryL();
+        }
+    TRACE_EXIT_POINT
+    return 0;
+    }
+
 // -----------------------------------------------------------------------------
 // CCalenDbField::ReadDataFromFormL
 // (other items were commented in a header).
@@ -240,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);
@@ -335,4 +408,34 @@
     TRACE_EXIT_POINT;
     return (!calendarFileName.CompareF(*aName));
     }
+// -----------------------------------------------------------------------------
+// CCalenDbField::ShowChangeDBQueryL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CCalenDbField::ShowChangeDBQueryL()
+    {
+    
+    //Check the child entries for the repeated entry
+    //The entry which is changing the calendar having any childs 
+    //show this information note to the user.
+    CCalEntry& originalEntry = iUnifiedEditor.EditorDataHandler().Entry();
+    RPointerArray<CCalEntry> childEntries;
+    CleanupClosePushL(childEntries);
+    iServices->EntryViewL(iPreviousColId)->FetchL(originalEntry.UidL(), childEntries);            
+    if(IsCalendarEdited() && (childEntries.Count() > 1))
+        {
+        TCalCollectionId  currentId = iCurrentColId;
+        SetDataToEditorL();                    
+        iUnifiedEditor.UpdateFormL();
+        CAknQueryDialog* dlg = CAknQueryDialog::NewL();
+        if( dlg->ExecuteLD( R_CALEN_DB_CHANGE_QUERY ) )
+            {
+            iCurrentColId = currentId;
+            SetDataToEditorL(iCurrentColId);
+            iUnifiedEditor.UpdateFormL();
+            }
+        }            
+    CleanupStack::PopAndDestroy( &childEntries );                
+    }
 // End of File
--- a/calendarui/editors/src/calenrepeatfield.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/editors/src/calenrepeatfield.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -34,6 +34,9 @@
 // debug
 #include "calendarui_debug.h"
 
+//Feb 29th will be read as 28 as indexing of days starts from 0,1,2....
+const TInt KLastDayInFebLeapYear = 28;
+
 // CONSTRUCTION AND DESTRUCTION METHODS
 
 // -----------------------------------------------------------------------------
@@ -263,8 +266,22 @@
             }
         else
             {
-            TDateTime repUntilDateTime( ECalenMaxYear, TMonth(ECalenMaxMonth), ECalenMaxDay, 0, 0, 0, 0 );
-            TTime aTime( repUntilDateTime );
+			//Fix for repeated event date change:
+            TDateTime startDate = start.DateTime();
+            
+            //Checking for leap year feb.29th, next year it should be 28.
+            TInt untilDay;
+            if(startDate.Month() == EFebruary && startDate.Day() == KLastDayInFebLeapYear)
+                {
+                untilDay = KLastDayInFebLeapYear - 1;
+                }
+            else
+                {
+                untilDay = startDate.Day();
+                }
+            
+            TDateTime repOneYear(startDate.Year()+1,startDate.Month(), untilDay, 0, 0, 0, 0);
+            TTime aTime( repOneYear );
             until = aTime;
             }
 
--- a/calendarui/editors/src/calenunifiededitor.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/editors/src/calenunifiededitor.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -288,7 +288,7 @@
     
     isReplaceLocation = EFalse;
     
-   
+    iCheck = EFalse;
     TCallBack callback(CCalenUnifiedEditor::AsyncProcessCommandL,this);
     iAsyncCallback = new(ELeave) CAsyncCallBack(callback,CActive::EPriorityStandard);
     
@@ -569,11 +569,21 @@
              // Intentional fall through to EEikBidCancel below
              iEntryUiOutParams.iAction = ENoAction;
              iEntryUiOutParams.iSpare = 0;
+             MCalenContext& context = iServices->Context();
+             HBufC* fileNamePtr = context.GetCalAlarmEntryFileNameL();             
+             TCalLocalUid localUid = context.CalAlarmLocalUidL();           
+             if (fileNamePtr != NULL && !fileNamePtr->CompareF(iGlobalData->GetCalFileNameForCollectionId(context.InstanceId().iColId)) 
+                     && localUid == context.InstanceId().iEntryLocalUid)
+                 {
+                 context.ResetCalAlarmEntryFileName();
+                 break;
+                 }
              // Fall through...
              }
          case ECalenEditSeries:
          case ECalenEditOccurrence:
          case EAknCmdExit:
+         case EAknSoftkeyExit:
          case EEikBidCancel:
              {
              // EEikBidCancel is called when Red End key is pressed or
@@ -591,7 +601,11 @@
              if( iServices->EntryViewL(colId) )
                  {
                  PIM_TRAPD_HANDLE( TryToSaveNoteOnForcedExitL() );
+                 iCheck = EFalse;
                  }
+             if(EAknSoftkeyExit == aButtonId)
+                 iServices->IssueCommandL(aButtonId);
+             
              break;
              }
          case EAknSoftkeyDone:
@@ -658,8 +672,8 @@
 TKeyResponse CCalenUnifiedEditor::OfferKeyEventL( const TKeyEvent& aKeyEvent,
                                                   TEventCode aType )
     {
-    TRACE_ENTRY_POINT;
-    TBool isMapIconHandled = EFalse;
+    
+     TRACE_ENTRY_POINT;
     TKeyResponse keyResponse( EKeyWasNotConsumed );
     TInt ctrlid=IdOfFocusControl();
    
@@ -696,102 +710,18 @@
                 keyResponse = EKeyWasConsumed;
                 break;
             case EKeyEnter: // For Enter key
+            case EKeyDelete: // For Delete key
 				{
 				keyResponse = CAknForm::OfferKeyEventL(aKeyEvent,aType); // Let framework handle the key event
-				// when enter key is pressed on subject line or on location line, call AddPictureL to recalculate the map icon position properly
-				// as location field could habe moved up or down
-				if(ctrlid == ECalenEditorPlace || ctrlid == ECalenEditorSubject)
-					{
-					CCalGeoValue* geoValue = iEditorDataHandler->Entry().GeoValueL();
-					if(geoValue)
-						{
-						isMapIconHandled = ETrue;
-						AddPictureL();
-						delete geoValue;
-						}
-					}
-				}
-				break;
-			case EKeyDelete:
-				{
-				if(ctrlid == ECalenEditorPlace)
-					{
-					CCalGeoValue* geoValue = iEditorDataHandler->Entry().GeoValueL();
-					if(geoValue)
-						{
-						CEikRichTextEditor* locationControl = static_cast<CEikRichTextEditor*>(Control(ECalenEditorPlace));
-						CRichText* text = locationControl->RichText();
-						TPtrC ptr = text->Read(0,text->DocumentLength());
-						TInt pos = ptr.Locate(TChar(CEditableText::EPictureCharacter));
-						if(locationControl->CursorPos() == pos)
-							{
-							isMapIconHandled = ETrue;
-							keyResponse = EKeyWasConsumed;
-							delete geoValue;
-							break;
-							}
-						delete geoValue;
-						}
-					}
-					keyResponse = CAknForm::OfferKeyEventL(aKeyEvent,aType); // Let framework handle the key event
 				}
 				break;
 			case EKeyBackspace:  // For back space character
 				{
-				if(ctrlid == ECalenEditorPlace)
-					{
-					CCalGeoValue* geoValue = iEditorDataHandler->Entry().GeoValueL();
-					if(geoValue)
-						{
-						CEikRichTextEditor* locationControl = static_cast<CEikRichTextEditor*>(Control(ECalenEditorPlace));
-						CRichText* text = locationControl->RichText();
-						TPtrC ptr = text->Read(0,text->DocumentLength());
-						TInt pos = ptr.Locate(TChar(CEditableText::EPictureCharacter));
-						TInt curpos = locationControl->CursorPos();
-						
-						// When only one visible character is there and picture byte is there at second position, then
-						// empty the location field and redraw the map icon
-						if(text->DocumentLength() <= 2) 
-							{
-							TBuf<1> newLocation;
-							SetEdwinTextL(ECalenEditorPlace, &newLocation);
-							keyResponse = EKeyWasConsumed;
-							delete geoValue;
-							isMapIconHandled = ETrue;
-							AddPictureL();
-							break;
-							}
-						//  when cursor position is at the end, then since, picture byte is at the end
-						// delete last but one character (for user, it looks as if last visible character is being deleted)
-						// and redraw the icon
-						 else if( curpos == pos + 1)
-							{
-							text->DeleteL(text->DocumentLength() - 2,1);
-							
-							AddPictureL();
-							locationControl->SetCursorPosL(curpos - 1, EFalse);
-							isMapIconHandled = ETrue;
-							keyResponse = EKeyWasConsumed;
-							delete geoValue;
-							break;
-							}
-						delete geoValue;
-						}
-					}
-				// This is to handle backspaces in subject field when there nore that one lines,
-				// location field will move up, hence, need to redraw the map icon
-				else if(ctrlid == ECalenEditorSubject)
+				if(ctrlid == ECalenEditorPlace || ECalenEditorSubject)
 					{
 					keyResponse = CAknForm::OfferKeyEventL(aKeyEvent,aType);
-					CCalGeoValue* geoValue = iEditorDataHandler->Entry().GeoValueL();
-					if(geoValue)
-						{
-						AddPictureL();
-						isMapIconHandled = ETrue;
-						delete geoValue;
-						}
-					break;
 					}
+				break;
 				}
             case EKeyLeftArrow:
             case EKeyRightArrow:
@@ -810,19 +740,6 @@
             default:
                 {
                 keyResponse = CAknForm::OfferKeyEventL(aKeyEvent,aType); 
-                if(!isMapIconHandled)
-                    {
-                    if((ctrlid == ECalenEditorPlace) || (ctrlid == ECalenEditorSubject))
-                        {
-                        CCalGeoValue* geoValue = iEditorDataHandler->Entry().GeoValueL();
-                        if(geoValue)
-                            {
-                            isMapIconHandled = ETrue;
-                            AddPictureL();
-                            delete geoValue;
-                            }
-                        }
-                    }
                 }
                 break;
             }
@@ -1065,12 +982,7 @@
     TRACE_ENTRY_POINT;
     
     SetEditableL(ETrue);
-    CCalGeoValue* geoValue = iEditorDataHandler->Entry().GeoValueL();
-	if(geoValue)
-		{
-		AddPictureL();	
-		delete geoValue;	
-		}
+
     TCallBack callback( LocaleCallback, this );
     iLocaleChangeNotifier =
         CEnvironmentChangeNotifier::NewL( EActivePriorityLogonA, callback );
@@ -1144,7 +1056,8 @@
             OnCmdDeleteNoteL();
             break;
         case EAknCmdExit:
-            OnCmdExitL();
+        case EAknSoftkeyExit:            
+            OnCmdExitL(aCommandId);
             break;
         case EAknCmdHelp:
             OnCmdHelpL();
@@ -1302,7 +1215,9 @@
 TInt CCalenUnifiedEditor::AsyncProcessCommandL( TAny* aThisPtr )
     {
     TInt focusControl( static_cast<CCalenUnifiedEditor*>(aThisPtr)->IdOfFocusControl() );
-    CEikEdwin* edwin = static_cast<CEikEdwin*>( static_cast<CCalenUnifiedEditor*>(aThisPtr)->Control( focusControl ) );  
+    if(focusControl == ECalenEditorDescription)
+        {
+        CEikEdwin* edwin = static_cast<CEikEdwin*>( static_cast<CCalenUnifiedEditor*>(aThisPtr)->Control( focusControl ) );  
         if ( edwin && edwin->Text()->DocumentLength() == 0 )
             {
             static_cast<CCalenUnifiedEditor*>(aThisPtr)->ProcessCommandL(ECalenCmdAddDescription);
@@ -1311,7 +1226,7 @@
             {
             static_cast<CCalenUnifiedEditor*>(aThisPtr)->ProcessCommandL(ECalenCmdShowDescription);
             }
-    
+        }
     return 0;
     }
 
@@ -1332,14 +1247,6 @@
 
     CCoeControl::HandleResourceChange( aType );
     
-    CCalGeoValue* geoValue = NULL;
-	TRAP_IGNORE(geoValue = iEditorDataHandler->Entry().GeoValueL());	
-	if(geoValue)
-		{
-		TRAP_IGNORE(AddPictureL());	
-		delete geoValue;	
-		}
-		
     TRACE_EXIT_POINT;
     }
 
@@ -1380,8 +1287,7 @@
             
             aMenuPane->AddMenuItemsL( R_CALEN_UNIFIED_EDITOR_DEFAULT_MENUPANE );
 
-            if( ( ctrlid != ECalenEditorPlace ) || 
-                    ( !CCalenLocationUtil::IsMapProviderAvailableL() ) )
+            if(  !CCalenLocationUtil::IsMapProviderAvailableL() )   
                 {
                 aMenuPane->DeleteMenuItem( ECalenGetLocation );
                 }
@@ -1521,12 +1427,12 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void CCalenUnifiedEditor::OnCmdExitL()
+void CCalenUnifiedEditor::OnCmdExitL(TInt aCmd)
     {
-    TRACE_ENTRY_POINT;
-
-    TryExitL( EAknCmdExit );
-
+    TRACE_ENTRY_POINT;   
+    
+            TryExitL( aCmd );
+       
     TRACE_EXIT_POINT;
     }
 
@@ -1538,7 +1444,13 @@
 //
 void CCalenUnifiedEditor::TryToDeleteNoteL( TBool /* aIsViaDeleteMenu */ )
     {
-    TRACE_ENTRY_POINT;    
+    TRACE_ENTRY_POINT;
+	
+	TInt attachmentCount = iServices->GetAttachmentData()->NumberOfItems(); 		   
+	 if(Edited().AttachmentCount() || attachmentCount)
+		 {
+		 iServices->GetAttachmentData()->Reset();
+		 }
     if (IsCreatingNewEntry())
         {
         iEntryUpdater->TryDeleteInstanceWithUiL( EditorDataHandler().Entry() ,
@@ -1561,7 +1473,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void CCalenUnifiedEditor::TryInsertSendMenuL( TInt aResourceId, CEikMenuPane* aMenuPane )
+void CCalenUnifiedEditor::TryInsertSendMenuL( TInt /*aResourceId*/, CEikMenuPane* aMenuPane )
     {
     TRACE_ENTRY_POINT;
 
@@ -2002,7 +1914,17 @@
     const TBool continueOnError = EFalse;
     iUnifiedEditorControl->ReadDataFromEditorL( continueOnError );
     
-    TEntryExistenceStatus status = EntryStillExistsL();
+    TEntryExistenceStatus status;
+    
+	if(!IsCreatingNewEntry())
+		{
+        status = EntryStillExistsL();
+		}
+    else
+		{
+		status = EEntryOk;
+		}
+	 
     TTimeIntervalDays aDay(0);
     if( iCurrentDurationDay<aDay )
         {
@@ -2015,16 +1937,20 @@
         
         TTime startDate = Edited().StartDateTime();
         TTime endDate = Edited().EndDateTime();
+        TTimeIntervalDays differenceInTime = endDate.DaysFrom(startDate); // fix for AllDayEntry issue
         
         if( startDate == CalenDateUtils::BeginningOfDay( startDate ) &&
                 endDate == CalenDateUtils::BeginningOfDay( endDate ) )
             {
-            TTimeIntervalDays differenceInTime = endDate.DaysFrom(startDate); // fix for AllDayEntry issue
-            if( CCalEntry::EAppt == Edited().EntryType() && startDate != endDate && differenceInTime.Int() == 1 )
+            if( CCalEntry::EAppt == Edited().EntryType() && startDate != endDate && differenceInTime.Int() >= 1 )
                 {
                 Edited().SetEntryType( CCalEntry::EEvent );
                 }
             }
+        if(differenceInTime.Int() == 0 && (CCalEntry::EAppt == Edited().EntryType() || CCalEntry::EEvent == Edited().EntryType()))
+            {
+            Edited().SetEntryType( CCalEntry::EAppt ); //changed
+            }
         
         switch ( EditorDataHandler().ShouldSaveOrDeleteOrDoNothingL() ) 
             {
@@ -2335,7 +2261,7 @@
 void CCalenUnifiedEditor::TryToSaveNoteOnForcedExitL()
     {
     TRACE_ENTRY_POINT;
-    
+    iCheck = ETrue;
     if( EntryStillExistsL() == EEntryOk )
         {
         if( CheckSpaceBelowCriticalLevelL() )
@@ -2684,7 +2610,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();
@@ -2709,7 +2636,6 @@
 			{
 			isReplaceLocation = EFalse;
 			StoreLocationDetailsToEntryL(landmark);
-			AddPictureL(0);
 			}
 		}
 		
@@ -2733,7 +2659,6 @@
 	if(userResponse)
 		{
 		StoreLocationDetailsToEntryL(landmark);
-		AddPictureL();
 		}
 		
 	TRACE_EXIT_POINT;	
@@ -2797,7 +2722,6 @@
             break;
         }
         StoreLocationDetailsToEntryL(landmark);
-        AddPictureL(0);
         
     TRACE_EXIT_POINT;   
     }
@@ -2848,7 +2772,6 @@
         ShowAddressUpdatedNoticeL();
         }
 	 
-	PreLayoutDynInitL();
 	
 	TRACE_EXIT_POINT;	
 	}
@@ -3096,6 +3019,7 @@
     if( attachmentCount )
         {
         RPointerArray<HBufC> attachmentNames;
+        CleanupResetAndDestroyPushL(attachmentNames);
         GetAttachmentNamesL(attachmentNames);
         attachmentCount = attachmentNames.Count();            
         TInt attachmentLength(0);        
@@ -3120,7 +3044,7 @@
         
         // Cleanup
         delete attachmentNamesString;
-        attachmentNames.ResetAndDestroy();
+        CleanupStack::PopAndDestroy(&attachmentNames);
         }
     
     TRACE_EXIT_POINT;
@@ -3174,14 +3098,7 @@
 void CCalenUnifiedEditor::LineChangedL( TInt /* aControlId */ )
     {
     TRACE_ENTRY_POINT;
-    
-    CCalGeoValue* geoValue = iEditorDataHandler->Entry().GeoValueL();
-	if(geoValue)
-		{
-		AddPictureL();	
-		delete geoValue;	
-		}
-		
+
     SetMskFromResourceL();
     TRACE_EXIT_POINT;
     }
@@ -3342,51 +3259,6 @@
     TRACE_EXIT_POINT;
     }
 
-// -----------------------------------------------------------------------------
-// CCalenUnifiedEditor::AddPictureL
-// Adds Map icon onto the editors
-// -----------------------------------------------------------------------------
-//      
-void CCalenUnifiedEditor::AddPictureL(TInt isNotFirstTime)
-    {
-    TRACE_ENTRY_POINT;
-    return;
-    
-    // Instantiate CMapIconPicture object 300x300 twips in size
-    CEikRichTextEditor* locationControl = static_cast<CEikRichTextEditor*>(Control(ECalenEditorPlace));
-    
-    CRichText* text = locationControl->RichText();
-    if(isNotFirstTime)
-        {
-        TPtrC ptr = text->Read(0,text->DocumentLength());
-        TInt pos = ptr.Locate(TChar(CEditableText::EPictureCharacter));
-        if(pos != -1) // If picture found, delete it so that it cna be drawn at new place
-            {
-            TRAP_IGNORE(text->DeleteL(pos,1));
-            }
-        }
-    
-    // Get the rect of the caption of ECalenEditorPlace control
-    CEikLabel* label = this->ControlCaption(ECalenEditorPlace);
-    TRect rect = label->Rect();
-    
-    CMapsIconPicture* picture = new( ELeave )CMapsIconPicture(/* TSize( 300, 300 )*/ *iServices, rect );
-    CleanupStack::PushL(picture);
-    //Prepare the picture header, which will be inserted into the rich text
-    TPictureHeader header;
-    header.iPicture = TSwizzle<CPicture>(picture);
-    
-    // Position where we insert picture is not valid as it always draws icon depending the rect we provide
-    
-        text->InsertL(text->DocumentLength(), header);
-        
-    locationControl->HandleTextChangedL();
-    CleanupStack::Pop(); // picture
-    
-    Control(ECalenEditorPlace)->DrawNow();
-    
-    TRACE_EXIT_POINT;   
-    }
 
 // -----------------------------------------------------------------------------
 // CCalenUnifiedEditor::AttachmentNamesL
@@ -3398,7 +3270,8 @@
     TInt attachCount = iServices->GetAttachmentData()->NumberOfItems();
     if( attachCount )
         {    
-        RPointerArray<CCalenAttachmentInfo> attachmentInfoList;      
+        RPointerArray<CCalenAttachmentInfo> attachmentInfoList;  
+		CleanupClosePushL( attachmentInfoList );
         iServices->GetAttachmentData()->GetAttachmentListL(attachmentInfoList);
         for( TInt index =0; index<attachCount; index++ )
             {
@@ -3408,12 +3281,23 @@
             attachmentName->Des().Copy(fileNameParser.NameAndExt());
             aAttachmentNames.Append(attachmentName);
             }
+		CleanupStack::PopAndDestroy( &attachmentInfoList );		
         }
     else
         {
         Edited().AttachmentNamesL(aAttachmentNames);
         }
     }
+
+// -----------------------------------------------------------------------------
+// CCalenUnifiedEditor::GetServices
+// Gets services reference
+// -----------------------------------------------------------------------------
+//
+MCalenServices& CCalenUnifiedEditor::GetServices()
+    {
+    return *iServices;
+    }
 	
 // -----------------------------------------------------------------------------
 // CMapsIconPicture::CMapsIconPicture
--- a/calendarui/editors/src/calenunifiededitorcontrol.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/editors/src/calenunifiededitorcontrol.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -237,7 +237,10 @@
         iRepeatField->SetDataToEditorL();
         }
     
-    iDbField->SetDataToEditorL();
+    if(!iDbField->IsCalendarEdited())
+        {
+        iDbField->SetDataToEditorL();
+        }
 
     if( CCalEntry::ETodo != iUnifiedEditor.GetEntryType() )
         {
@@ -326,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;
@@ -341,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 );
@@ -356,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 );
@@ -385,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, 
@@ -415,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 );
@@ -438,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,
@@ -452,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 );
@@ -751,21 +811,24 @@
     {
     TRACE_ENTRY_POINT;
     
-    // update Entry type of Edited entry
-    iUnifiedEditor.Edited().SetEntryType( aNewEventType );
-
-    // Delete, previous entry type fields from editor
-    DeletePreviousEntryTypeFieldsL();
-    
-    // Add new fiedls to editor
-    AddNewEntryTypeFieldsL( aNewEventType );
-    iUnifiedEditor.SetEntryType( aNewEventType );
-
-    // after changing the event type, update the fields with default values
-    InitDefaultEditorsL();
-    SetDataToEditorL();
-    
-    iUnifiedEditor.UpdateFormL();
+    if(iUnifiedEditor.GetEntryType() != aNewEventType)
+    	{
+	    // update Entry type of Edited entry
+	    iUnifiedEditor.Edited().SetEntryType( aNewEventType );
+	
+	    // Delete, previous entry type fields from editor
+	    DeletePreviousEntryTypeFieldsL();
+	    
+	    // Add new fiedls to editor
+	    AddNewEntryTypeFieldsL( aNewEventType );
+	    iUnifiedEditor.SetEntryType( aNewEventType );
+	
+	    // after changing the event type, update the fields with default values
+	    InitDefaultEditorsL();
+	    SetDataToEditorL();
+	    
+	    iUnifiedEditor.UpdateFormL();
+	  	}
     
     TRACE_EXIT_POINT;
     }
@@ -865,8 +928,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 );
     
@@ -1096,6 +1162,13 @@
         result = CalenDateUtils::BeginningOfDay( result );
         }
     
+    if( iAllDayField->IsAllDayEvent() )
+        {
+        TTime endDate = iUnifiedEditor.Edited().EndDateTime();
+        endDate = CalenDateUtils::BeginningOfDay( endDate );
+        iUnifiedEditor.Edited().SetEndDateTimeL(endDate);
+        }
+    
     resDT = result.DateTime();
     TRACE_EXIT_POINT;
     return result;
@@ -1139,7 +1212,10 @@
             // In Editor it should be displayed as "StartDate: 15-08-2010 & EndDate:15-08-2010" 
             // But, while saving EndDate is saved as 12:00am, 16-08-2010. 
             TTime startDate = iUnifiedEditor.Edited().StartDateTime();
-            if( result >= startDate )
+            startDate = CalenDateUtils::BeginningOfDay( startDate );
+            iUnifiedEditor.Edited().SetStartDateTimeL(startDate);
+
+            if( result >= startDate && (!iUnifiedEditor.iCheck ) || iUnifiedEditor.Edited().EntryType() == CCalEntry::EEvent)
                 {
                 result += TTimeIntervalDays( KOneDay );
                 }
@@ -1270,9 +1346,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;
             
@@ -1417,20 +1497,11 @@
         // For allday (1 day) event Eg. "Start:- 12:00am, 15-08-2010 &  End:-12:00am, 16-08-2010"
         // In Editor it should be displayed as "StartDate: 15-08-2010 & EndDate:15-08-2010" 
         // No time filed is displayed.
-        if ( end > start )                         
+        end -= TTimeIntervalDays( KOneDay );
+        if ( end < start )                         
             {
-            //end -= TTimeIntervalDays( KOneDay );
-            //end contains the time component also, even for same day end would be greater then start
-            //subtracting 1 from end will give end as one day before start.
-            //For All day event Start date and End Date are same so assigning start to end.
             end = start;
             }
-        else if( end == start )
-            {
-            // For allday event minimum duration is 1day.
-            TTime endDate = start + TTimeIntervalDays( KOneDay );
-            iUnifiedEditor.Edited().SetEndDateTimeL( endDate );
-            }
         }
     
     SetDateField( ECalenEditorEndDate, end, ETrue );
--- a/calendarui/globaldata/BWINS/calenglobaldatau.def	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/globaldata/BWINS/calenglobaldatau.def	Sun Jun 20 22:55:39 2010 +0200
@@ -23,7 +23,7 @@
 	?ResetKeyEventQueue@CCalenGlobalData@@QAEXXZ @ 22 NONAME ; void CCalenGlobalData::ResetKeyEventQueue(void)
 	?GetQueuedKeyEvent@CCalenGlobalData@@QAEHAAUTKeyEvent@@AAW4TEventCode@@@Z @ 23 NONAME ; int CCalenGlobalData::GetQueuedKeyEvent(struct TKeyEvent &, enum TEventCode &)
 	?CalenSendL@CCalenGlobalData@@QAEAAVCCalenSend@@XZ @ 24 NONAME ; class CCalenSend & CCalenGlobalData::CalenSendL(void)
-	?NewL@CCalenGlobalData@@SAPAV1@AAVMCalProgressCallBack@@PAVMCalenContextChangeObserver@@@Z @ 25 NONAME ; class CCalenGlobalData * CCalenGlobalData::NewL(class MCalProgressCallBack &, class MCalenContextChangeObserver *)
+	?NewL@CCalenGlobalData@@SAPAV1@AAVMCalProgressCallBack@@PAVMCalenContextChangeObserver@@PAVMCalenDBChangeObserver@@@Z @ 25 NONAME ; class CCalenGlobalData * CCalenGlobalData::NewL(class MCalProgressCallBack &, class MCalenContextChangeObserver *, class MCalenDBChangeObserver *)
 	?EntryViewExists@CCalenGlobalData@@QAEHXZ @ 26 NONAME ; int CCalenGlobalData::EntryViewExists(void)
 	?AttemptToRetrieveDefaultMailboxL@CCalenGlobalData@@QAEHAAUTMailboxInfo@CMRMailboxUtils@@@Z @ 27 NONAME ; int CCalenGlobalData::AttemptToRetrieveDefaultMailboxL(struct CMRMailboxUtils::TMailboxInfo &)
 	?GetAllCalendarInfoL@CCalenGlobalData@@QAEXAAV?$RPointerArray@VCCalCalendarInfo@@@@@Z @ 28 NONAME ; void CCalenGlobalData::GetAllCalendarInfoL(class RPointerArray<class CCalCalendarInfo> &)
--- a/calendarui/globaldata/eabi/calenglobaldatau.def	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/globaldata/eabi/calenglobaldatau.def	Sun Jun 20 22:55:39 2010 +0200
@@ -31,7 +31,7 @@
 	_ZN16CCalenGlobalData21InitializeGlobalDataLEv @ 30 NONAME
 	_ZN16CCalenGlobalData29GetCalFileNameForCollectionIdEh @ 31 NONAME
 	_ZN16CCalenGlobalData32AttemptToRetrieveDefaultMailboxLERN15CMRMailboxUtils12TMailboxInfoE @ 32 NONAME
-	_ZN16CCalenGlobalData4NewLER20MCalProgressCallBackP27MCalenContextChangeObserver @ 33 NONAME
+	_ZN16CCalenGlobalData4NewLER20MCalProgressCallBackP27MCalenContextChangeObserverP22MCalenDBChangeObserver @ 33 NONAME
 	_ZN16CCalenGlobalData7ContextEv @ 34 NONAME
 	_ZN16CCalenGlobalData7ReleaseEv @ 35 NONAME
 	_ZN16CCalenGlobalData8InstanceEv @ 36 NONAME
--- a/calendarui/globaldata/group/CalenGlobalData.mmp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/globaldata/group/CalenGlobalData.mmp	Sun Jun 20 22:55:39 2010 +0200
@@ -37,7 +37,8 @@
 SOURCE          calenvcalexport.cpp
 
 SOURCE          calencontextimpl.cpp
-SOURCE          calenfilemapping.cpp
+SOURCE          calenfilemapping.cpp 
+SOURCE          calendbchangenotifier.cpp
 
 USERINCLUDE     ../inc
 USERINCLUDE     ../../inc
@@ -45,6 +46,7 @@
 APP_LAYER_SYSTEMINCLUDE
 SYSTEMINCLUDE   ../../../inc   //organizer include
 SYSTEMINCLUDE   /epoc32/include/ecom
+SYSTEMINCLUDE   ../../../alarmengines/inc
 
 LIBRARY         euser.lib
 LIBRARY         ecom.lib
@@ -68,6 +70,7 @@
 LIBRARY			lbs.lib
 LIBRARY			calencommonutils.lib
 LIBRARY         centralrepository.lib
+LIBRARY			missedalarmstore.lib  flogger.lib
 
 CAPABILITY      CAP_GENERAL_DLL
 
--- a/calendarui/globaldata/group/bld.inf	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/globaldata/group/bld.inf	Sun Jun 20 22:55:39 2010 +0200
@@ -27,6 +27,7 @@
 //organizer/calendarui/inc
 ../inc/calensend.h                           |../../inc/calensend.h
 ../inc/calencontextchangeobserver.h          |../../inc/calencontextchangeobserver.h
+../inc/calendbchangenotifier.h               |../../inc/calendbchangenotifier.h
 
 //organizer/inc
 ../inc/calenglobaldata.h                     |../../../inc/calenglobaldata.h
--- a/calendarui/globaldata/inc/calencontextimpl.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/globaldata/inc/calencontextimpl.h	Sun Jun 20 22:55:39 2010 +0200
@@ -214,6 +214,32 @@
 	* @brief Resets calendar file name in context
 	*/
     void ResetCalendarFileName();
+    /**
+    * @brief Set calendar file name of Alarm entry in context
+    */    
+    void SetCalAlarmEntryFileNameL(const TDesC& aName);
+    
+    /**
+    * @brief Get calendar filename 
+    * 
+    * @return HBufC pointer to calendar filename of Alarm entry
+    */
+    HBufC* GetCalAlarmEntryFileNameL() const;
+    
+    /**
+    * @brief Resets Alarm Entry calendar file name in context
+    */ 
+    void ResetCalAlarmEntryFileName();
+    
+    /**
+    * @brief set Alarm Entry LocalUid in context
+    */ 
+    void SetCalAlarmEntryLocalUid(TCalLocalUid aLocalId);
+    
+    /**
+    * @brief Get Alarm Entry LocalUid from context
+    */ 
+    TCalLocalUid CalAlarmLocalUidL() const;
 
 private:  // Data
     MCalenContextChangeObserver* iObserver;
@@ -227,6 +253,8 @@
     // Multiple context ids
     RArray<TCalenInstanceId> iMutlipleContextIds;
     HBufC* iCalenFileName;
+    HBufC* iCalAlarmEntryFileName;
+    TCalLocalUid iCalAlarmLocalUid;
     };
 
 #endif // CALENCONTEXTIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/calendarui/globaldata/inc/calendbchangenotifier.h	Sun Jun 20 22:55:39 2010 +0200
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Notifies observers of external changes to the calendar database
+*
+*/
+
+
+#ifndef __CALENDBCHANGENOTIFIER_H
+#define __CALENDBCHANGENOTIFIER_H
+
+//  INCLUDES
+#include <e32base.h>
+
+#include <calchangecallback.h>      //MCalChangeCallBack
+
+// FORWARD DECLARATIONS
+class CCalSession;                  //Calendar session
+class CCalenGlobalData;             //Calendar global data
+class CMissedAlarm;
+
+// CLASS DECLARATION
+
+/**
+* Observer class for database changes.  Forwards callback from 
+* MCalChangeCallBack2
+*/
+class MCalenDBChangeObserver
+    {
+    public:
+        virtual void HandleDBChangeL() = 0;
+    };
+
+/**
+*  CCalenDbChangeNotifier buffers notifications from MCalChangeCallBack2 and 
+*  only notifies its observers after a set period has elapsed.  This prevents
+*  Calendar views refreshing more often than necessary during a sync operation
+*/
+NONSHARABLE_CLASS(CCalenDbChangeNotifier) : public CActive,
+                                                                  public MCalChangeCallBack2
+    {
+    public:  // Constructors and destructor
+        /**
+        * Constructor.
+        * @param aGlobalData global data reference
+        * @return a pointer to the new CCalenDbChangeNotifier instance
+        */
+        static CCalenDbChangeNotifier* NewL( CCalSession& aSession );
+
+       /**
+        * Destructor.
+        */
+        ~CCalenDbChangeNotifier();
+        
+    public:
+        /**
+        * Allow CCalenViews to register for database change notifications
+        * @param aDBObserver Observer to register
+        */
+        void RegisterObserverL( MCalenDBChangeObserver& aDBObserver );
+        
+        /**
+        * Allow CCalenViews to deregister for database change notifications
+        * @param aDBObserver Observer to deregister
+        */
+        void DeRegisterObserverL( MCalenDBChangeObserver& aDBObserver );
+        
+        /**
+        * Returns the time of the last call to MCalChangeCallBack2::CalChangeNotification
+        * This is not necessarily the same time as the last notification issued by 
+        * this class
+        * @return Time of the last database modification as TTime
+        */
+        TTime LastDBModificationTime() const;
+        
+    public: 
+        /**
+        * From MCalChangeCallBack2
+        * Called when the calendar database is changed through another
+        * CCalSession
+        * @param aChangeItems array of database items changed 
+        */
+        void CalChangeNotification( RArray<TCalChangeEntry>& aChangeItems );
+
+    private:
+        /**
+        * C++ default constructor.
+        * @param aGlobalData global data reference
+        */
+        CCalenDbChangeNotifier( CCalSession& aSession );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        * Performs any construction which may leave
+        */
+        void ConstructL();
+
+        /**
+        * From CActive
+        * Called when outstanding asynchronous request completes
+        * This will be called when iNotificationTimer either completes
+        * or is cancelled
+        */
+        void RunL();
+        
+        /**
+        * From CActive
+        * Called by the active scheduler if RunL leaves
+        * Ensures we are ready to receive the next database event
+        * @param aError System wide error code
+        */
+        TInt RunError( TInt aError );
+
+        /**
+        * From CActive
+        * Implements cancellation of outstanding asynchronous requests
+        * 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
+
+        //Database change observer filter
+        CCalChangeNotificationFilter* iCalChangeFilter;      
+        
+        //Observer array
+        RPointerArray<MCalenDBChangeObserver> iDBObservers;
+        
+        //Timer to limit the amount of notifications issued by this class
+        RTimer iNotificationTimer;
+        
+        //The time of the last received notification
+        TTime iLastDbChangeNotification;
+        
+        //Flag to restart the timer after cancelling last tiemr request
+        TBool iRestartTimer;
+        
+        CCalSession& iSession;
+    };
+
+#endif      // __CALENDBCHANGENOTIFIER_H
+
+// End of File
--- a/calendarui/globaldata/inc/calenfilemapping.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/globaldata/inc/calenfilemapping.h	Sun Jun 20 22:55:39 2010 +0200
@@ -22,6 +22,7 @@
 #include <calsession.h>
 
 class CCalEntryView;
+class CCalenDbChangeNotifier;
 
 
 /**
@@ -107,6 +108,18 @@
      */
     CCalSession *GetSessionPtr();    
     
+    /*
+     * Set the dbchangenotifier observer
+     * @param CCalSession pointer to a session 
+     */
+    void SetDBChangeNotifier(CCalenDbChangeNotifier* aDBChangeNotifier );
+    
+    /*
+     * Get the dbchangenotifier observer.
+     * @return CCalSession pointer to session.
+     */
+    CCalenDbChangeNotifier *GetDBChangeNotifier();
+    
     private:
 
     /**
@@ -125,7 +138,8 @@
     TInt iStatus;
     CCalSession* iSessionPtr;
     TCalCollectionId iColId;        
-    CCalEntryView* iEntryView;        
+    CCalEntryView* iEntryView;
+    CCalenDbChangeNotifier* iDBChangeNotifier;
     };
 
 
--- a/calendarui/globaldata/inc/calenglobaldata.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/globaldata/inc/calenglobaldata.h	Sun Jun 20 22:55:39 2010 +0200
@@ -30,6 +30,8 @@
 #include <calentryview.h>           // Calendar Entry view
 #include <e32hashtab.h>                 //RHashSet
 
+#include "calendbchangenotifier.h"      // MCalenDBChangeObserver
+
 #include <calenmulticaluids.hrh>
 
 
@@ -76,7 +78,8 @@
          */
         IMPORT_C static CCalenGlobalData*
                             NewL( MCalProgressCallBack& aCalCallBack,
-                                  MCalenContextChangeObserver* aNotifier=NULL );
+                                  MCalenContextChangeObserver* aNotifier=NULL,
+                                  MCalenDBChangeObserver* aDBNotifier=NULL);
 
         /**
         * Constructor.  Returns a new instance of CCalenGlobalData if
@@ -315,7 +318,8 @@
         * By default Symbian 2nd phase constructor is private. 
         * Doesn't take ownership of aNotifier.
         */
-        void ConstructL( MCalenContextChangeObserver* aNotifier );
+        void ConstructL( MCalenContextChangeObserver* aNotifier,
+                                MCalenDBChangeObserver* aDBNotifier);
 
         /**
         * Private Destructor.  Users of this class should call Release() instead
@@ -485,6 +489,7 @@
         TBool iCalendarForcedExit;
         CCalSession* iCalendarsSession;
         RPointerArray<CCalCalendarInfo> iCalendarInfoList;
+        MCalenDBChangeObserver* iDBChangeNotifier;
     };
 
 #endif  // CALENGLOBALDATA_H
--- a/calendarui/globaldata/src/calencontextimpl.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/globaldata/src/calencontextimpl.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -85,6 +85,11 @@
 CCalenContextImpl::~CCalenContextImpl()
     {
     TRACE_ENTRY_POINT;
+    if(iCalAlarmEntryFileName)
+        {
+        delete iCalAlarmEntryFileName;
+        iCalAlarmEntryFileName = NULL;
+        }
     TRACE_EXIT_POINT;
     }
 
@@ -506,4 +511,69 @@
     TRACE_EXIT_POINT;
     }
 
+// -----------------------------------------------------------------------------
+// CCalenContextImpl::SetCalAlarmEntryFileNameL
+// Set calendar file name of Alarm entry
+// ----------------------------------------------------------------------------- 
+void CCalenContextImpl::SetCalAlarmEntryFileNameL(const TDesC& aName)
+    {
+    TRACE_ENTRY_POINT
+    if (iCalAlarmEntryFileName)
+        {
+        delete iCalAlarmEntryFileName;
+        iCalAlarmEntryFileName = NULL;
+        }
+    iCalAlarmEntryFileName = aName.AllocL();
+    TRACE_EXIT_POINT   
+    }
+
+// -----------------------------------------------------------------------------
+// CCalenContextImpl::GetCalAlarmEntryFileNameL
+// Get calendar file name of Alarm entry
+// ----------------------------------------------------------------------------- 
+HBufC* CCalenContextImpl::GetCalAlarmEntryFileNameL() const
+    {
+    TRACE_ENTRY_POINT     
+    TRACE_EXIT_POINT 
+    
+    return iCalAlarmEntryFileName;   
+    }
+
+// -----------------------------------------------------------------------------
+// CCalenContextImpl::ResetCalAlarmEntryFileName
+// Resets Alarm Entry file name in context
+// ----------------------------------------------------------------------------- 
+void CCalenContextImpl::ResetCalAlarmEntryFileName()
+    {
+    TRACE_ENTRY_POINT    
+    if(iCalAlarmEntryFileName)
+        {
+        delete iCalAlarmEntryFileName;
+        iCalAlarmEntryFileName = NULL;
+        }
+        
+    TRACE_EXIT_POINT 
+    }
+// -----------------------------------------------------------------------------
+// CCalenContextImpl::ResetCalAlarmEntryFileName
+// set Alarm Entry LocalUid in context
+// ----------------------------------------------------------------------------- 
+void  CCalenContextImpl::SetCalAlarmEntryLocalUid(TCalLocalUid aLocalId)
+    {
+    TRACE_ENTRY_POINT   
+    iCalAlarmLocalUid = aLocalId;
+    TRACE_EXIT_POINT 
+    }
+    
+ 
+// -----------------------------------------------------------------------------
+// CCalenContextImpl::ResetCalAlarmEntryFileName
+// Get Alarm Entry LocalUid from context
+// ----------------------------------------------------------------------------- 
+TCalLocalUid CCalenContextImpl::CalAlarmLocalUidL() const
+    {
+    TRACE_ENTRY_POINT  
+    TRACE_EXIT_POINT 
+    return iCalAlarmLocalUid;
+    }
 // End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/calendarui/globaldata/src/calendbchangenotifier.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -0,0 +1,339 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Notifies observers of external changes to the calendar database
+*
+*/
+
+
+
+//debug
+#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
+// MCalenDBChangeObserver instances.  Notifications may come from 
+// MCalChangeCallBack2 at a very high rate which could impact performance, 
+// for example by causing constant view refreshes.
+// CCalenDbChangeNotifier notifies observers when KTimerResolution has elapsed
+// since the last notification was received from MCalChangeCallBack2
+// -----------------------------------------------------------------------------
+const TInt KTimerResolution = 1000000;  // 1 Second
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCalenDbChangeNotifier::CCalenDbChangeNotifier
+// C++ default constructor can NOT contain any code, that might leave.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CCalenDbChangeNotifier::CCalenDbChangeNotifier( CCalSession& aSession ) 
+    : CActive( EPriorityNormal ),
+      iSession( aSession )
+    {
+    TRACE_ENTRY_POINT;
+
+    iRestartTimer = EFalse;
+
+    TRACE_EXIT_POINT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCalenDbChangeNotifier::NewL
+// Two-phased constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CCalenDbChangeNotifier* CCalenDbChangeNotifier::NewL( CCalSession& aSession )
+    {
+    TRACE_ENTRY_POINT;
+
+    CCalenDbChangeNotifier* self = new( ELeave ) CCalenDbChangeNotifier( aSession );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    TRACE_EXIT_POINT;
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCalenDbChangeNotifier::ConstructL
+// Symbian 2nd phase constructor can leave.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CCalenDbChangeNotifier::ConstructL()
+    {
+    TRACE_ENTRY_POINT;
+
+    // We want to receive notifications for the full agenda date range
+    TCalTime start, end;
+    start.SetTimeUtcL( TCalTime::MinTime() );
+    end.SetTimeUtcL( TCalTime::MaxTime() );
+    CalCommon::TCalTimeRange range( start, end ); 
+
+    // Create a notification filter
+    iCalChangeFilter = CCalChangeNotificationFilter::NewL(
+                                                        MCalChangeCallBack2::EChangeEntryAll, 
+                                                        ETrue, 
+                                                        range );
+
+    // Enable database change notifications on current global data session
+    iSession.StartChangeNotification( *this, *iCalChangeFilter );
+
+    // Create a timer to limit the number of notifications broadcast
+    iNotificationTimer.CreateLocal();
+
+    // Active object, add to active scheduler
+    CActiveScheduler::Add( this );
+
+    TRACE_EXIT_POINT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCalenDbChangeNotifier::~CCalenDbChangeNotifier
+// Destructor
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+CCalenDbChangeNotifier::~CCalenDbChangeNotifier()
+    {
+    TRACE_ENTRY_POINT;
+
+    Cancel();
+    // Reset the observer array.  Array contents are NOT owned by this class
+    iDBObservers.Reset();
+
+    iNotificationTimer.Close();
+
+    // Disable database change notifications on current global data session   
+    PIM_TRAPD_HANDLE( iSession.StopChangeNotification() );
+
+    // Destroy the notification filter
+    delete iCalChangeFilter;
+    
+    TRACE_EXIT_POINT;    
+    }
+
+// -----------------------------------------------------------------------------
+// CCalenDbChangeNotifier::LastDBModificationTime
+// Returns the time of the last database change notification.  This may not be
+// the time of the last notification sent to MCalenDBChangeObservers.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TTime CCalenDbChangeNotifier::LastDBModificationTime() const
+    {
+    TRACE_ENTRY_POINT;
+
+    TRACE_EXIT_POINT;
+    return iLastDbChangeNotification;
+    }
+
+// -----------------------------------------------------------------------------
+// CCalenDbChangeNotifier::CalChangeNotification
+// Called when a change to the agenda database occurs from a different session
+// to the one we are currently using.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+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();
+    if( !IsActive() )
+        {
+        iNotificationTimer.After( iStatus, KTimerResolution );
+        SetActive();
+        }
+    else
+        {
+        iRestartTimer = ETrue;
+        iNotificationTimer.Cancel();
+        }
+
+    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
+// Adds the passed observer to the observer array.  All observers in the array 
+// will be notified of changes to the agenda database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------    
+ void CCalenDbChangeNotifier::RegisterObserverL( MCalenDBChangeObserver& aDBObserver )
+    {
+    TRACE_ENTRY_POINT;
+
+    iDBObservers.Append( &aDBObserver );
+
+    TRACE_EXIT_POINT;
+    }
+
+// -----------------------------------------------------------------------------
+// CCalenDbChangeNotifier::DeRegisterObserverL
+// Removes the passed observer to the observer array.  All observers in the array 
+// will be notified of changes to the agenda database.
+// -----------------------------------------------------------------------------       
+void CCalenDbChangeNotifier::DeRegisterObserverL( MCalenDBChangeObserver& aDBObserver )
+    {
+    TRACE_ENTRY_POINT;
+
+    for( TInt x = 0; x < iDBObservers.Count(); ++x )
+        {
+        if( iDBObservers[x] == &aDBObserver )
+            {
+            iDBObservers.Remove( x );
+            return;
+            }
+        }
+    User::Leave( KErrNotFound );
+
+    TRACE_EXIT_POINT;
+    }
+
+// -----------------------------------------------------------------------------       
+// CCalenDbChangeNotifier::RunL
+// From CActive::RunL
+// Called when notification timer expires
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------       
+void CCalenDbChangeNotifier::RunL()
+    {
+    TRACE_ENTRY_POINT;
+
+    switch( iStatus.Int() )
+        {
+        case KErrCancel:
+            {
+            // The normal reason for the timer being cancelled is another
+            // database change.  Restart the timer.
+            if( iRestartTimer )
+                {
+                iRestartTimer = EFalse;
+                iNotificationTimer.After( iStatus, KTimerResolution );
+                SetActive();
+                }        
+            }
+        break;
+
+        case KErrNone:
+            {
+            //Timer completion, notify observers
+            for( TInt x = 0; x < iDBObservers.Count(); ++x )
+                {
+                iDBObservers[x]->HandleDBChangeL();
+                }
+            }
+        break;
+
+        default:
+            {
+            User::Leave( KErrArgument );
+            }
+        break;
+        }
+
+    TRACE_EXIT_POINT;
+    }
+
+// -----------------------------------------------------------------------------       
+// CCalenDbChangeNotifier::RunError
+// From CActive::RunError
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CCalenDbChangeNotifier::RunError( TInt aError )
+    {
+    TRACE_ENTRY_POINT;
+
+    //RunL leaving means that the view could not be refreshed.
+    //Theres not much we can do except be ready for the next database event.
+    iRestartTimer = EFalse;
+
+    TRACE_EXIT_POINT;
+    return aError;
+    }
+
+// -----------------------------------------------------------------------------       
+// CCalenDbChangeNotifier::DoCancel
+// From CActive::DoCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+void CCalenDbChangeNotifier::DoCancel()
+    {
+    TRACE_ENTRY_POINT;
+
+    // Stop the notification timer
+    iRestartTimer = EFalse;
+    iNotificationTimer.Cancel();
+
+    TRACE_EXIT_POINT;
+    }
+
+// End of File
--- a/calendarui/globaldata/src/calenfilemapping.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/globaldata/src/calenfilemapping.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -16,6 +16,7 @@
  */
 #include "calendarui_debug.h"
 #include "calenfilemapping.h"
+#include "calendbchangenotifier.h"      // MCalenDBChangeObserver
 
 #include <calsession.h>
 #include <calentryview.h>           // Calendar Entry view
@@ -68,6 +69,12 @@
     {
     TRACE_ENTRY_POINT
     
+    if( iDBChangeNotifier )
+        {
+        delete iDBChangeNotifier;
+        iDBChangeNotifier = NULL;
+        }
+    
     if(iEntryView)
         {
         delete iEntryView;
@@ -195,4 +202,27 @@
     return iSessionPtr;
     }
 
+/*
+ * Set the dbchangenotifier observer
+ * @param CCalSession pointer to a session 
+ */
+void CCalenFileMapping::SetDBChangeNotifier(CCalenDbChangeNotifier* aDBChangeNotifier )
+    {
+    TRACE_ENTRY_POINT;
+    
+    iDBChangeNotifier = aDBChangeNotifier;
+    TRACE_EXIT_POINT;
+    }
+
+/*
+ * Get the dbchangenotifier observer.
+ * @return CCalSession pointer to session.
+ */
+CCalenDbChangeNotifier *CCalenFileMapping::GetDBChangeNotifier()
+    {
+    TRACE_ENTRY_POINT;
+    TRACE_EXIT_POINT;
+    return iDBChangeNotifier;
+    }
+
 //End
--- a/calendarui/globaldata/src/calenglobaldata.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/globaldata/src/calenglobaldata.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -48,13 +48,18 @@
 #include <CalendarInternalCRKeys.h>
 #include <calenmulticalutil.h>
 
+#include <bautils.h>
+#include <calensvrmissedalarmmanagerresource.rsg>
 // Default Calendar database path
 _LIT( KCalendarDatabaseFilePath, "c:calendar" );
 _LIT( KPhoneCalendar,"Personal" );
 _LIT( KExtCalendar,"Ext calendar" );
 const TInt KBuffLength = 24;
 
-_LIT(KPhoneCalendarName,"PhoneCalendar");
+
+_LIT(KPersonal,"Personal");
+
+_LIT( KMissedAlarmResourceFile, "z:\\resource\\CalenSvrMissedAlarmManagerResource.rsc"); // changes done
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -87,7 +92,8 @@
 // ----------------------------------------------------------------------------
 //
 EXPORT_C CCalenGlobalData* CCalenGlobalData::NewL( MCalProgressCallBack& aCalCallBack,
-                                                   MCalenContextChangeObserver* aNotifier )
+                                                   MCalenContextChangeObserver* aNotifier,
+                                                   MCalenDBChangeObserver* aDBNotifier)
     {
     TRACE_ENTRY_POINT;
 
@@ -106,7 +112,7 @@
         // calls CCalenGlobalData::InstanceL in ConstructL and then ConstructL
         // leaves, we will double delete the global data.
         ++self->iRefCount;
-        self->ConstructL( aNotifier );
+        self->ConstructL( aNotifier, aDBNotifier );
         CleanupStack::Pop( self );
         }
     else
@@ -206,7 +212,8 @@
 // Symbian 2nd phase constructor can leave.
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
-void CCalenGlobalData::ConstructL( MCalenContextChangeObserver* aNotifier )
+void CCalenGlobalData::ConstructL( MCalenContextChangeObserver* aNotifier,
+                                    MCalenDBChangeObserver* aDBNotifier)
     {
     TRACE_ENTRY_POINT;
 
@@ -214,6 +221,8 @@
     
     iNewInstanceViewCreation = NULL;
     
+    iDBChangeNotifier = aDBNotifier;
+    
     TRACE_EXIT_POINT;
     }
 
@@ -829,7 +838,8 @@
         filemap->SetCalendarFileNameL(calendarFileName);
         
         iNewEntryView  = NULL;
-        iNewEntryViewCreation  = NULL;  
+        iNewEntryViewCreation  = NULL;
+        CCalenDbChangeNotifier* dbChangeNotifier = NULL;
         if(iCalSession)
             {
             iNewCalSession = NULL;
@@ -841,6 +851,9 @@
             filemap->SetCollectionId(tempSession.CollectionIdL());
             CreateEntryViewL(tempSession);
             filemap->SetEntryView( iNewEntryView );
+            dbChangeNotifier = CCalenDbChangeNotifier::NewL( tempSession );
+            dbChangeNotifier->RegisterObserverL(*iDBChangeNotifier);
+            filemap->SetDBChangeNotifier(dbChangeNotifier);
             }            
          else
             {
@@ -851,6 +864,9 @@
             filemap->SetEntryView( iNewEntryView );
             iGlobalDataOwnsEntryView = EFalse;
             iGlobalDataOwnsCalSession = EFalse;
+            dbChangeNotifier = CCalenDbChangeNotifier::NewL( tempSession );
+            dbChangeNotifier->RegisterObserverL(*iDBChangeNotifier);
+            filemap->SetDBChangeNotifier(dbChangeNotifier);
             }
         iFileMappingArray.Append(filemap);        
         CleanupStack::Pop(filemap);
@@ -1278,6 +1294,9 @@
 			CreateEntryViewL(tempSession);
 			}
 		fileMapping->SetEntryView( iNewEntryView );
+		CCalenDbChangeNotifier* dbChangeNotifier = CCalenDbChangeNotifier::NewL( tempSession );
+		dbChangeNotifier->RegisterObserverL(*iDBChangeNotifier);
+		fileMapping->SetDBChangeNotifier(dbChangeNotifier);
 		CleanupStack::PopAndDestroy(aCalendarInfo);
 		iCalendarInfoList.Append(tempSession.CalendarInfoL());
 		}
@@ -1369,8 +1388,18 @@
                 // Mark the CalFile as Hidden
                 caleninfo->SetEnabled( EFalse );
                             
+                
+                TBuf8<KBuffLength> keyBuff;
+                
+                // Set the modification time as home time.
+                keyBuff.Zero();
+                keyBuff.AppendNum(EModificationTime);
+                TTime modificationTime;
+                modificationTime.HomeTime();
+                TPckgC<TTime> pkgModificationTime(modificationTime);
+                caleninfo->SetPropertyL(keyBuff, pkgModificationTime);
+                
                 // Set the SyncStatus to False
-                TBuf8<KBuffLength> keyBuff;
                 keyBuff.Zero();
                 keyBuff.AppendNum( ESyncStatus );
                 TBool syncstatus( EFalse );
@@ -1470,20 +1499,38 @@
                     RPointerArray<CCalCalendarInfo>& aCalendarInfoList )
 	{
 	TRACE_ENTRY_POINT;
+	CleanupClosePushL(aCalendarInfoList);
+    RFs fsSession;
+    CleanupClosePushL( fsSession );
+    RResourceFile resourceFile;
+    CleanupClosePushL( resourceFile );
+    User::LeaveIfError( fsSession.Connect() );
+    TFileName resourceFileName( KMissedAlarmResourceFile );
 		
+    BaflUtils::NearestLanguageFile( fsSession, resourceFileName );
+    resourceFile.OpenL(fsSession, resourceFileName );
+    resourceFile.ConfirmSignatureL( 0 );   
 	for(TInt index=0;index < iCalendarInfoList.Count();index++)
 	    {
-        TPtrC fileNamePtr = iCalendarInfoList[index]->FileNameL();
+        
 	    TPtrC calendarNamePtr = iCalendarInfoList[index]->NameL();
+        if(calendarNamePtr.Compare(KPersonal) == 0)
+            {  
+            HBufC8* personalBuffer = resourceFile.AllocReadLC( R_CALE_DB_PERSONAL );    
+            const TPtrC16 ptrPBuffer(( TText16*) personalBuffer->Ptr(),
+                                             ( personalBuffer->Length()+1 )>>1 );    
+            HBufC *personalCalendar = ptrPBuffer.AllocL();    
+            CleanupStack::PushL(personalCalendar);
+            iCalendarInfoList[index]->SetNameL(*personalCalendar);
+            CleanupStack::PopAndDestroy( 2,personalBuffer );
+            }
+       
+	   
+            aCalendarInfoList.AppendL(iCalendarInfoList[index]);
 	        
-	    //We dont want default calendar PhoneCalendar tobe shown in calendarui.
-	    if(fileNamePtr.CompareF(KCalendarDatabaseFilePath) 
-	                && calendarNamePtr.CompareF(KPhoneCalendarName))
-	            {
-                aCalendarInfoList.AppendL(iCalendarInfoList[index]);
-	            }
 	    }
-	
+	 CleanupStack::PopAndDestroy(2);
+	 CleanupStack::Pop(&aCalendarInfoList);
 	TRACE_EXIT_POINT;
 	}
 
@@ -1651,6 +1698,9 @@
 			fileMapper->SetEntryView( iNewEntryView );
 			
 			iCalendarInfoList.AppendL(newSession->CalendarInfoL());
+		    CCalenDbChangeNotifier* dbChangeNotifier = CCalenDbChangeNotifier::NewL( *newSession );
+		    dbChangeNotifier->RegisterObserverL(*iDBChangeNotifier);
+		    fileMapper->SetDBChangeNotifier(dbChangeNotifier);
 			}
 		else
 			{
@@ -1669,6 +1719,9 @@
 				}
 			
 			fileMapper->SetEntryView(iNewEntryView);
+	        CCalenDbChangeNotifier* dbChangeNotifier = CCalenDbChangeNotifier::NewL( *iCalSession );
+	        fileMapper->SetDBChangeNotifier(dbChangeNotifier);
+	        dbChangeNotifier->RegisterObserverL(*iDBChangeNotifier);
 			iGlobalDataOwnsEntryView = EFalse;
 			iGlobalDataOwnsCalSession = EFalse;
 			iCalendarInfoList.AppendL(iCalSession->CalendarInfoL());
--- a/calendarui/group/bld.inf	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/group/bld.inf	Sun Jun 20 22:55:39 2010 +0200
@@ -20,8 +20,6 @@
 
 #include <platform_paths.hrh>
 
-//  Help exports
-#include "../help/group/bld.inf"
 
 PRJ_EXPORTS
 ../loc/calendar.loc						APP_LAYER_LOC_EXPORT_PATH(calendar.loc)
@@ -80,6 +78,9 @@
 
 PRJ_MMPFILES
 
+//  Help files
+#include "../help/group/bld.inf"
+
 // commonutils
 #include "../commonutils/group/bld.inf"
 
Binary file calendarui/help/data/xhtml.zip has changed
--- a/calendarui/loc/calendar.loc	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/loc/calendar.loc	Sun Jun 20 22:55:39 2010 +0200
@@ -2628,5 +2628,16 @@
 //l:popup_note_wait_window
 //
 #define qtn_todo_wait_updating_status_notes  "Updating status"
+
+//d:Confirmation text when a repeated entry which has exceptions, moving the data base.
+//l:popup_note_window
+//
+#define qtn_calen_db_change_del_exeptions "Exceptions will be deleted, Want to continue?"
+
+//d:Confirmation note shown, when tasks are updated
+//l:popup_note_window
+//w:
+//r:9.2
+#define qtn_todo_all_task_updated  "All to-do notes updated"
         
 // End of File
--- a/calendarui/multicaluidialog/src/caldblistboxitemdrawer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/multicaluidialog/src/caldblistboxitemdrawer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -103,9 +103,8 @@
      
      iGc->Reset();
      
-	 // Ggetting the layout for clolourstrips for list dialog
-	 TAknWindowComponentLayout tempLayout = 
-             AknLayoutScalable_Apps::list_cale_time_pane_g6( aItemIndex - iListBox->TopItemIndex() ) ;     
+	 // Ggetting the layout for clolourstrips for list dialog     
+     TAknWindowComponentLayout tempLayout = AknLayoutScalable_Apps::list_cale_time_pane_g6(0);     
 
      TAknLayoutRect colourstrips;
      colourstrips.LayoutRect( actualItemRect, tempLayout.LayoutLine() );
--- a/calendarui/multicaluidialog/src/multicaluidialogmodel.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/multicaluidialog/src/multicaluidialogmodel.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -22,11 +22,14 @@
 #include <CalenInterimUtils2.h>
 #include <calcalendarinfo.h>
 #include <calcalendariterator.h>
+#include <calenmulticaluids.hrh>
+
 // user include.
 #include "multicaluidialogmodel.h"
 #include "calendarui_debug.h"
+#include "cleanupresetanddestroy.h"
 
-_LIT( KCalendarDatabaseFilePath, "c:calendar" );
+const TInt KBuffLength = 24;
 
 // ----------------------------------------------------------------------------
 // CMultiCalUiDialogModel::CMultiCalUiDialogModel
@@ -150,7 +153,7 @@
         {
         iCalendarStatus.Append(0);
 
-       /* if (!index) //First create the default session
+        if (!index) //First create the default session
             {
             const TPtrC name = iCalendarInfoList[index]->FileNameL();
             defaultSession->OpenL(name);
@@ -160,7 +163,7 @@
             iCalEntryViewArray.Append(entryView);
             CleanupStack::Pop(entryView);
             }
-        else*/
+        else
             {
             CCalSession* session = CCalSession::NewL(*defaultSession);
             CleanupStack::PushL(session);
@@ -262,6 +265,7 @@
     {
     TRACE_ENTRY_POINT;
 
+    CleanupResetAndDestroyPushL(aCalCopyEntries);
     for (TInt i = 0; i < iCalEntries.Count(); i++)
         {
         const CCalEntry* sourceEntry = iCalEntries[i];
@@ -283,7 +287,7 @@
 
         CleanupStack::Pop(copyEntry);
         }
-
+    CleanupStack::Pop(&aCalCopyEntries);
     TRACE_EXIT_POINT;;
     }
 
@@ -304,19 +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())
         {
-        TPtrC fileNamePtr = calendarInfo->FileNameL();
-        if(fileNamePtr.CompareF(KCalendarDatabaseFilePath))
-           {
-           aCalendarInfoList.AppendL(calendarInfo);
-           }
-        else
-           {
-           delete 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/organizerplugin/aiagendaplugin2/src/aicalendarplugin2focusdata.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/organizerplugin/aiagendaplugin2/src/aicalendarplugin2focusdata.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -44,7 +44,6 @@
         {
         const TUid dummyUID = { 0x0 };
         task.SendMessage( dummyUID, tailBuf );
-        task.BringToForeground();
         }
     else  // Launch Calendar into day view
         {
--- a/calendarui/organizerplugin/aiagendapluginengine/inc/AIAgendaPluginEngineImpl.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/organizerplugin/aiagendapluginengine/inc/AIAgendaPluginEngineImpl.h	Sun Jun 20 22:55:39 2010 +0200
@@ -22,7 +22,6 @@
 // INCLUDES
 #include "CalEngineCallback.h"
 #include "CalenEngine.h"
-#include "CalSvrClient.h"
 #include "PropertyObserver.h"
 
 #include <calfilechangenotification.h>
@@ -37,7 +36,6 @@
 // CLASS DECLARATION
 NONSHARABLE_CLASS( CAIAgendaPluginEngineImpl ) : public CBase,
                                                  public MCalenEngineListener,
-                                                 public MCalSvrAgendaUpdateListener,
                                                  public MPropertyChangeHandler,
                                                  public MCalFileChangeObserver
                                                  
@@ -115,13 +113,6 @@
      **/
     void HandleError(TInt aError);
 
- public:  // From MCalSvrAgendaUpdateListener
-    /**
-     * ?member_description.
-     * @since Series 60 2.6
-     **/
-    void CalendarServerInitialized(void);
-
 public:  // From MPropertyChangeHandler
     /**
      * ?member_description.
@@ -267,9 +258,6 @@
     // ?one_line_short_description_of_data
     RPointerArray<CCalInstance> iInstanceArray;
 
-    // Calendar server session
-    RCalSvrSession iSession;
-
     // ?one_line_short_description_of_data
     MPluginDataChangeObserver& iDataChangeObserver;
 
--- a/calendarui/organizerplugin/aiagendapluginengine/src/AIAgendaPluginEngineImpl.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/organizerplugin/aiagendapluginengine/src/AIAgendaPluginEngineImpl.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -51,8 +51,6 @@
 {
     TRACE_ENTRY_POINT;
     
-    iSession.ConnectL();
-
     if( iObserverType == ECalendarObserver || iObserverType == ECalendarAndTodoObserver )
     {
         TCallBack environmentChangeCallBack( EnvironmentChangeCallBack, this );
@@ -150,14 +148,12 @@
     {
         iEnvironmentChangeNotifier->Cancel();
         delete iEnvironmentChangeNotifier;
-    }
-
-    delete iCalendarEngine;  // Close() called in destructor
+    }    
 
     iInstanceArray.ResetAndDestroy();
     iInstanceArray.Close();
 
-    iSession.Close();
+		delete iCalendarEngine;  // Close() called in destructor
     
     TRACE_EXIT_POINT;
 }
@@ -182,9 +178,9 @@
     {
         case EDBOffline:
         {
-            iDBState = EDBInitializing;
-            iSession.Initialize( *this );
-        }
+            iDBState = EDBInitialized;
+            StateMachine();
+         }
         break;
 
         case EDBInitialized:
@@ -556,7 +552,6 @@
     delete iCalendarEngine;
     iCalendarEngine = NULL;
 
-    iSession.Uninitialize();
     
     TRACE_EXIT_POINT;
 }
@@ -880,22 +875,6 @@
 }
 
 // ---------------------------------------------------------
-// CAIAgendaPluginEngineImpl::CalendarServerInitialized
-// ?implementation_description
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CAIAgendaPluginEngineImpl::CalendarServerInitialized(void)
-{
-    TRACE_ENTRY_POINT;
-    
-    iDBState = EDBInitialized;  // EDBInitializing -> EDBInitialized
-    StateMachine();
-    
-    TRACE_EXIT_POINT;
-}
-
-// ---------------------------------------------------------
 // CAIAgendaPluginEngineImpl::EnvironmentChangeCallBack
 // ?implementation_description
 // (other items were commented in a header).
--- a/calendarui/organizerplugin/aiagendapluginengine/src/CalenAsyncCommands.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/organizerplugin/aiagendapluginengine/src/CalenAsyncCommands.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -95,11 +95,13 @@
     TRACE_ENTRY_POINT;
     
     TRequestStatus* pStat = &iStatus;
-    User::RequestComplete( pStat, KErrNone );
-
     if( IsAdded() )
         {
-        SetActive();
+        if (!IsActive())
+            {
+            SetActive();
+            }
+        User::RequestComplete( pStat, KErrNone );
         }
     
     TRACE_EXIT_POINT;
@@ -165,6 +167,11 @@
     {
     TRACE_ENTRY_POINT;
     
+    if (iStatus.Int())
+        {
+        return;
+        }
+    
     switch( iState )
         {
         case ECreateSession:
@@ -365,6 +372,11 @@
     {
     TRACE_ENTRY_POINT;
 
+    if (iStatus.Int())
+        {
+        return;
+        }
+    
     switch( iState )
         {
         case EFetch:
@@ -552,6 +564,11 @@
     {
     TRACE_ENTRY_POINT;
     
+    if (iStatus.Int())
+        {
+        return;
+        }
+    
     switch( iState )
         {
         case EFetch:
@@ -729,6 +746,11 @@
     {
     TRACE_ENTRY_POINT;
 
+    if (iStatus.Int())
+        {
+        return;
+        }
+    
     switch( iState )
         {
         case EFetchInstances:
@@ -888,6 +910,11 @@
     {
     TRACE_ENTRY_POINT;
     
+    if (iStatus.Int())
+        {
+        return;
+        }
+    
     switch( iState )
         {
         case EFetch:
--- a/calendarui/organizerplugin/aiagendapluginengine/src/CalenEngine.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/organizerplugin/aiagendapluginengine/src/CalenEngine.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -188,7 +188,7 @@
     for(CCalCalendarInfo* calendarInfo = calIter->FirstL() ;
         calendarInfo != NULL ; calendarInfo = calIter->NextL() )
         {
-        if(calendarInfo->Enabled() && calendarInfo->FileNameL().CompareF(_L("c:Calendar")))
+        if(calendarInfo->Enabled())
             {
             TCalInfo calInfo;
             calInfo.iFileName = calendarInfo->FileNameL();
--- a/calendarui/regionalplugins/lunarVietnamese/src/calenlunarvietnameselocalizer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/regionalplugins/lunarVietnamese/src/calenlunarvietnameselocalizer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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/regionalplugins/lunarVietnamese/src/calenlunarvietnameseplugin.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/regionalplugins/lunarVietnamese/src/calenlunarvietnameseplugin.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -701,7 +701,8 @@
 	{
 	TRACE_ENTRY_POINT;
 	
-	if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
+	if( AknLayoutUtils::PenEnabled() &&
+	     aPointerEvent.iType == TPointerEvent::EButton1Down )
 	        {
 	        iPlugin.ShowDetailsL();
 	        }
--- a/calendarui/regionalplugins/lunarchinese/src/CalenLunarChinesePlugin.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/regionalplugins/lunarchinese/src/CalenLunarChinesePlugin.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -699,7 +699,8 @@
     {
     TRACE_ENTRY_POINT;
 
-    if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
+    if( AknLayoutUtils::PenEnabled() &&
+        aPointerEvent.iType == TPointerEvent::EButton1Down )
         {
         iPlugin.ShowDetailsL();
         }
--- a/calendarui/server/CalenSvr/data/calensvrmissedalarmmanagerresource.rss	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/server/CalenSvr/data/calensvrmissedalarmmanagerresource.rss	Sun Jun 20 22:55:39 2010 +0200
@@ -47,6 +47,7 @@
     imagefile         = AVKON_ICON_FILE;     // Image file name (including path).
     imageid           = EMbmAvkonQgn_note_alarm_calendar; // Image id.
     imagemask         = EMbmAvkonQgn_note_alarm_calendar_mask;
+    flags             = EAknNoteLeftSoftkeyWhenTapped;
     }
 
 RESOURCE TBUF r_missed_alarm_group_singular {buf = qtn_notif_miss_cale_event_group;}
--- a/calendarui/server/CalenSvr/src/CalenServer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/server/CalenSvr/src/CalenServer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -51,7 +51,9 @@
 
 
 const TInt KComma( ',' );
-_LIT(KPhoneCalendarName,"PhoneCalendar");
+
+_LIT(KPersonal,"Personal");
+
 
 // ================= MEMBER FUNCTIONS =======================
 //
@@ -338,7 +340,6 @@
             {
             TBuf<KMaxFileName> calendarFileName;
             calendarFileName.Append(KCalendarDatabaseFilePath);
-            calendarInfo->SetEnabled(EFalse);
             TRAPD(error,session->CreateCalFileL(calendarFileName,*calendarInfo));
 			User::LeaveIfError(error);
             }
@@ -370,49 +371,18 @@
     {
     TRACE_ENTRY_POINT;
     
-    RFs fsSession;
-    CleanupClosePushL( fsSession );
-    RResourceFile resourceFile;
-    CleanupClosePushL( resourceFile );
-    User::LeaveIfError( fsSession.Connect() );
-    TFileName resourceFileName( KMissedAlarmResourceFile );
+    
     
-    BaflUtils::NearestLanguageFile( fsSession, resourceFileName );
-    
-    resourceFile.OpenL(fsSession, resourceFileName );
-    resourceFile.ConfirmSignatureL( 0 );
     
-    //Phone calendar 
-       HBufC* phoneCalendarBuffer = KPhoneCalendarName().AllocLC();
-       aCalendarNames.AppendL(phoneCalendarBuffer->Des());
-       CleanupStack::PopAndDestroy( phoneCalendarBuffer );
+    
         
     // personal
-        HBufC8* personalBuffer = resourceFile.AllocReadLC( R_CALE_DB_PERSONAL );    
-       const TPtrC16 ptrPBuffer(( TText16*) personalBuffer->Ptr(),
-                                         ( personalBuffer->Length()+1 )>>1 );    
-       HBufC *personalCalendar = ptrPBuffer.AllocL();    
-       aCalendarNames.AppendL( personalCalendar->Des() );    
+         HBufC* personalBuffer = KPersonal().AllocLC();    
+        aCalendarNames.AppendL( personalBuffer->Des() );    
        CleanupStack::PopAndDestroy( personalBuffer );
        
-    // famliy
-       HBufC8* familyBuffer=resourceFile.AllocReadLC( R_CALE_DB_FAMILY );
-       const TPtrC16 ptrFBuffer(( TText16*) familyBuffer->Ptr(),
-               ( familyBuffer->Length()+1 )>>1 );
-       HBufC *familyCalendar = ptrFBuffer.AllocL();
-       aCalendarNames.AppendL( familyCalendar->Des() );
-       CleanupStack::PopAndDestroy( familyBuffer );
-       
-    //friends
-       HBufC8* friendsBuffer = resourceFile.AllocReadLC( R_CALE_DB_FRIENDS );
-       const TPtrC16 ptrFrBuffer(( TText16*) friendsBuffer->Ptr(),
-               ( friendsBuffer->Length()+1 )>>1 );
-       HBufC *friendsCalendar = ptrFrBuffer.AllocL();
-       aCalendarNames.AppendL( friendsCalendar->Des() );
-       CleanupStack::PopAndDestroy( friendsBuffer );
    
-    CleanupStack::PopAndDestroy(&resourceFile);
-    CleanupStack::PopAndDestroy(&fsSession);
+   
     
     TRACE_EXIT_POINT;
     }
@@ -472,8 +442,7 @@
     TPtrC marker = aRepositoryBuffer;
     TInt calendarColorOffset;
     
-    //For phone calendar 
-    aCalendarColors.Append(KRgbRed.Value());
+  
     
     while ((calendarColorOffset = marker.Locate(TChar(KComma)))
             != KErrNotFound)
@@ -545,7 +514,7 @@
     keyBuff.Zero();
     keyBuff.AppendNum(ESyncStatus);
 
-    TBool status = EFalse;
+    TBool status = ETrue;
     TPckgC<TBool> pkgSyncStatus(status);
     aCalendarInfo.SetPropertyL(keyBuff, pkgSyncStatus);
     
--- a/calendarui/server/CalenSvr/src/calensvrmissedalarmmanager.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/server/CalenSvr/src/calensvrmissedalarmmanager.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -237,16 +237,18 @@
 	    }
 	else
 	    {
-		if(iNumOfMissedAlarms > TInt(newCount))
+		/*if(iNumOfMissedAlarms > TInt(newCount))
 		    {
 		    iShowSoftNotification = EFalse;
 		    }
 		else
 		    {
 		    iShowSoftNotification = ETrue;
-		    }
+		    }*/
 		
+	// changes done for missing popup in idle screen when alarm expires in editor mode
 		iNumOfMissedAlarms = TInt(newCount);
+		iShowSoftNotification = ETrue;
 	    }
 	
 	TRACE_EXIT_POINT;
--- a/calendarui/server/CalenSvrClient/src/CalSvrClient.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/server/CalenSvrClient/src/CalSvrClient.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -182,8 +182,8 @@
     {
     TRACE_ENTRY_POINT;
     
-    __ASSERT_ALWAYS(!iInitializer->IsActive(), User::Invariant());
-    if(!iInitializer->IsActive())
+    //__ASSERT_ALWAYS(!iInitializer->IsActive(), User::Invariant());
+    if(!(iInitializer->IsActive()) && (KRequestPending != iInitializer->iStatus.Int()))
         {
         iInitializer->Initialize(&aListener);
         }
--- a/calendarui/settings/GsPlugin/inc/calendummyservices.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/settings/GsPlugin/inc/calendummyservices.h	Sun Jun 20 22:55:39 2010 +0200
@@ -104,7 +104,7 @@
          * Get calendar icon of specific type
          * @return CGulIcon*
          */
-        CGulIcon* GetIconL( MCalenServices::TCalenIcons aIndex );
+        CGulIcon* GetIconL( MCalenServices::TCalenIcons aIndex, const TInt aViewId = 0 ); 
 
         /**
          * Register for notifications of Calendar events
--- a/calendarui/settings/GsPlugin/src/calendummyservices.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/settings/GsPlugin/src/calendummyservices.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -331,7 +331,7 @@
 // (other items were commented in a header).
 // ----------------------------------------------------------------------------
 //
-CGulIcon* CCalenDummyServices::GetIconL( MCalenServices::TCalenIcons /*aIndex*/ )
+CGulIcon* CCalenDummyServices::GetIconL( MCalenServices::TCalenIcons /*aIndex*/, const TInt /*aViewId*/  )
     {
     TRACE_ENTRY_POINT;
     TRACE_EXIT_POINT;
--- a/calendarui/settings/settingsui/src/CalenFileListSettingItem.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/settings/settingsui/src/CalenFileListSettingItem.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -267,7 +267,7 @@
     // default tone
     list->SetNullItemL(*iToneDefaultText, iDefaultToneFile,
             CMediaFileList::EMediaFileTypeAudio,
-            CMediaFileList::ENullItemIconOff);
+            CMediaFileList::ENullItemIconDefaultTone);
     
     list->SetAttrL(CMediaFileList::EAttrExcludeFolder, CMediaFileList::EMediaFileTypeVideo);
     list->SetAttrL(CMediaFileList::EAttrAutomatedType, CDRMHelper::EAutomatedTypeCalendarAlarm);
@@ -293,7 +293,7 @@
     // Make sure that iOffToneFile is passed, in case iToneFile happens to be KNullDesC
     ASSERT(!IsEmpty(iToneFile));
     
-    TBool ok = !list->ShowMediaFileListL(&iToneFile, &nullItem,
+    TBool ok = list->ShowMediaFileListL(&iToneFile, &nullItem,
                 NULL, NULL );
     
     
--- a/calendarui/views/group/calenviews.mmp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/group/calenviews.mmp	Sun Jun 20 22:55:39 2010 +0200
@@ -154,13 +154,14 @@
 LIBRARY			missedalarmstore.lib  
 LIBRARY			apmime.lib
 LIBRARY         multicaluidialog.lib
+LIBRARY			touchfeedback.lib //MTouchFeedBack
 
 // File logging
 LIBRARY flogger.lib
 LIBRARY aknnotify.lib
 
 
-CAPABILITY      CAP_GENERAL_DLL
+CAPABILITY      CAP_GENERAL_DLL NetworkControl
 
 VENDORID        VID_DEFAULT
 
--- a/calendarui/views/inc/calencontainer.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/calencontainer.h	Sun Jun 20 22:55:39 2010 +0200
@@ -50,6 +50,7 @@
 class MAknNaviDecoratorObserver;
 class MCCalenNaviLabelObserver;
 
+class MTouchFeedback;
 
 class CCalenPreview;
 
@@ -166,7 +167,7 @@
     /**
     * Creates icon array according to icon index array passed in
     */
-    CAknIconArray* CreateIconsL( const RArray<MCalenServices::TCalenIcons>& aIndexArray );
+    CAknIconArray* CreateIconsL( const RArray<MCalenServices::TCalenIcons>& aIndexArray, const TInt aViewId = 0 ); 
     
     /**
      * Creates icon index array
@@ -246,6 +247,12 @@
      * returns previewpane pointer
      */
     virtual const MCalenPreview* PreviewPane(){return NULL; };
+    
+    /**
+    * Generates tactile feedback on user touch action
+    */        
+    virtual void GenerateTactileFeedback();
+    
 private: // New functions
     /**
      * Return number of icons needed to be displayed
@@ -337,6 +344,9 @@
     MCalenServices& iServices;
     RArray<MCalenServices::TCalenIcons> iIconIndices;
     CCalenContainerLayoutManager* iLayoutManager;
+    
+private:
+    MTouchFeedback* iFeedBack;
     };
 
 #endif // CALENCONTAINER_H
--- a/calendarui/views/inc/calendaycontainer.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/calendaycontainer.h	Sun Jun 20 22:55:39 2010 +0200
@@ -54,6 +54,7 @@
         TCalenInstanceId iId;
         TBool iTimedNote;
         TInt iTopLine;
+        TInt iBottomLine;
 
         // Fetched instance is temporarily stored to iTmpInstance 
         // This is destroyed after construction phase is over.
--- a/calendarui/views/inc/calendaylistbox.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/calendaylistbox.h	Sun Jun 20 22:55:39 2010 +0200
@@ -98,7 +98,7 @@
      * From CCoeControl Draws itself
      */
     void Draw(const TRect& aRect) const;
-
+   
     /**
      * From CCoeControl Handle global resource change
      */
--- a/calendarui/views/inc/calendaylistboxitemdrawer.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/calendaylistboxitemdrawer.h	Sun Jun 20 22:55:39 2010 +0200
@@ -64,6 +64,9 @@
 private:    // data
     CEikListBox* iListBox;
     mutable TUint32 iColor;
+    mutable TInt iColorStripHeight; //color strip height  
+    mutable TRect iColorStripRect; // color strip rect 
+    
     };
 
 #endif // CALENDAYLISTBOXITEMDRAWER_H
--- a/calendarui/views/inc/caleneventview.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/caleneventview.h	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/caleneventviewcontainer.h	Sun Jun 20 22:55:39 2010 +0200
@@ -236,6 +236,21 @@
      * Returns ETrue if event has location text else EFalse
      */
     TBool IsEventHasNoLocationTextL();
+    
+    /**
+     * Find a phone number in the form
+     */
+    void OnCmdFindPhoneNumL();
+    
+    /**
+     * Find an email address in the form
+     */
+    void OnCmdFindEmailL();
+    
+    /**
+     * Find a URL in the form
+     */
+    void OnCmdFindUrlL();
   
     
  private:
@@ -458,20 +473,6 @@
 	 
      void SetLabelContentL( CEikLabel& aLabel );
 
-    /**
-    * Reads the shared data value used to initialize automatic highlighting
-    * @return TBool, ETrue if automatic highlighting is to be used
-    */
-    void ReadAutoHlCenRepValueAndSetNotifyL();
-    
-    /**
-    * From MCenRepNotifyHandlerCallback
-    * Handles the incoming notifications of key changes
-    * @since Series60 3.0
-    * @param aId, Key that has changed
-    * @param aNewValue, New value of the key    
-    */
-    void HandleNotifyInt( TUint32 aId, TInt aNewValue );
 
     /**
     * From MCenRepNotifyHandlerCallback
@@ -482,32 +483,12 @@
     */
     void HandleNotifyError( TUint32 aId,TInt aError,CCenRepNotifyHandler* aHandler );
     
-	/**
-	* Set the state of automatic highlighting
-	* @param aSwitchON, ETrue if automatic highlighting is to used, otherwise EFalse
-	*/
-    void SetAutomaticHighlightL( const TBool aSwitchON );
-    
-    /**
-	* This method is used when phone number is 
-	* found and pressing phone key would make call
-	*/
-    void HandleNumberCallL();
 
     /**
      * Add calendar info field to the viewer
      */
     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 +528,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:
 
@@ -598,10 +589,8 @@
      // Notifier to listen changes of offline state
      CCenRepNotifyHandler* iNotifier;
      TInt iNumOfLinesBeforeLocField; // Number of lines before locaiton field in the rich text editor
-     TInt iTimeFieldLines;  // Number of lines occupied by time field on the viewer
-     TBool iAutomaticHlValue;
-     TBool iAutomaticHlInitialized;   
-     CItemFinder*  iAutoFinder; // text finder 
+     TInt iTimeFieldLines;  // Number of lines occupied by time field on the viewer   
+     TBool iEmbeddedFileOpened;
      CFindItemMenu* iFindMenu;  
      TCursorSelection iSelectedText; // Cursor selection for the text editor
      TBool iLocaleChanged;
--- a/calendarui/views/inc/calenmissedalarmscontainer.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/calenmissedalarmscontainer.h	Sun Jun 20 22:55:39 2010 +0200
@@ -23,6 +23,7 @@
 #include<coecntrl.h>
 #include<missedalarm.h>
 #include<missedalarmstore.h>
+#include <eiklbo.h>
 #include <caleninstanceid.h>            // TCalenInstanceId
 
 #include "calencontainer.h"
@@ -38,6 +39,7 @@
  * Class declaration for Missed alarms container
  */
 NONSHARABLE_CLASS(CCalenMissedAlarmsContainer) : public CCalenContainer
+									, public MEikListBoxObserver
     {
     public:
         
@@ -141,6 +143,13 @@
         void CreateIconIndicesL( RArray<MCalenServices::TCalenIcons>& aIndexArray );
         
         /**
+          * Handles list box events.
+          * @param aListBox   The originating list box.
+          * @param aEventType A code for the event.
+          */
+         void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+        
+        /**
          * This method is called after pointer event in Navi
          * decoration object.
          * @param aDirection right or left
--- a/calendarui/views/inc/calenmissedalarmsview.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/calenmissedalarmsview.h	Sun Jun 20 22:55:39 2010 +0200
@@ -166,35 +166,6 @@
 	 	 */
 	 	void UpdateCbaL();
      	
-private: 
- 	    /**
- 	     * Create missed alarms view toolbar buttons
- 	     * @ aIcon Icon of the toolbar button
- 	     * @ aText Text to be displayed on toolbar item
- 	     * @ aTooltipID Tool tip Id of the toolbar button
- 	     * @ aToolbar refrence to the calendar toolbar
- 	     */
- 	    CAknButton* CreateButtonL( CGulIcon* aIcon, 
- 	                               const TDesC& aText,
- 	                               TInt aTooltipID,
- 	                               CAknToolbar& aToolbar );
- 	    
- 	    /**
- 	     * Remove missed alarms view's toolbar buttons 
- 	     */                           
- 	    void RemoveToolbarButtonsL();
- 	    
- 	    /**
- 	     * Adds missed alarms view's toolbar buttons 
- 	     */
- 	    void AddToolbarButtonsL();
- 	    
- 	    /**
- 	     * Dim clear and clear all toolbar buttons when there are no
- 	     * missed alarm entries to clear 
- 	     */
- 	    void DimClearAndClearAllButtons();
- 	    
      private: //data members
         TInt iMissedAlarmsCount;
         
--- a/calendarui/views/inc/calenmissedeventcontainer.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/calenmissedeventcontainer.h	Sun Jun 20 22:55:39 2010 +0200
@@ -190,10 +190,6 @@
      */
     void OnCmdRestoreTaskL();
     /**
-     * Get item finder
-     */
-    CItemFinder* GetItemFinder();
-    /**
      * Get find item menu
      */
     CFindItemMenu* GetFindItemMenu();
@@ -207,7 +203,22 @@
      * Returns ETrue if event has location text else EFalse
      */
     TBool IsEventHasNoLocationTextL();
-  
+    
+    /**
+     * Find a phone number in the form
+     */
+    void OnCmdFindPhoneNumL();
+    
+    /**
+     * Find an email address in the form
+     */
+    void OnCmdFindEmailL();
+    
+    /**
+     * Find a URL in the form
+     */
+    void OnCmdFindUrlL();
+    
     
  private:
  	
@@ -406,20 +417,7 @@
     RPointerArray<CCalEntry>& AllInstancesL();
 private: //Auto highlight methods
 
-    /**
-    * Reads the shared data value used to initialize automatic highlighting
-    * @return TBool, ETrue if automatic highlighting is to be used
-    */
-    void ReadAutoHlCenRepValueAndSetNotifyL();
-    
-    /**
-    * From MCenRepNotifyHandlerCallback
-    * Handles the incoming notifications of key changes
-    * @since Series60 3.0
-    * @param aId, Key that has changed
-    * @param aNewValue, New value of the key    
-    */
-    void HandleNotifyInt( TUint32 aId, TInt aNewValue );
+   
 
     /**
     * From MCenRepNotifyHandlerCallback
@@ -430,17 +428,6 @@
     */
     void HandleNotifyError( TUint32 aId,TInt aError,CCenRepNotifyHandler* aHandler );
     
-	/**
-	* Set the state of automatic highlighting
-	* @param aSwitchON, ETrue if automatic highlighting is to used, otherwise EFalse
-	*/
-    void SetAutomaticHighlightL( const TBool aSwitchON );
-    
-    /**
-	* This method is used when phone number is 
-	* found and pressing phone key would make call
-	*/
-    void HandleNumberCallL();
 
 public:
     
@@ -490,9 +477,6 @@
      CRepository* iCenRepSession; // Central Repository session
      // Notifier to listen changes of offline state
      CCenRepNotifyHandler* iNotifier;
-     TBool iAutomaticHlValue;
-     TBool iAutomaticHlInitialized;   
-     CItemFinder*  iAutoFinder; // text finder 
      CFindItemMenu* iFindMenu;  
     
 	};
--- a/calendarui/views/inc/calenmonthcontainer.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/calenmonthcontainer.h	Sun Jun 20 22:55:39 2010 +0200
@@ -369,7 +369,8 @@
     // View specific data, references to views data
     TTime& iDate;
     TTime iOldFirstDayOfGrid;
-	TBool iChangeMonth;	
+	TBool iChangeMonth;
+	TBool iChangeDay;
     };
 
 #endif //CALENMONTHCONT_H
--- a/calendarui/views/inc/calentodocontainer.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/calentodocontainer.h	Sun Jun 20 22:55:39 2010 +0200
@@ -358,7 +358,7 @@
             };
 
         TStepPopulate iStepState;
-        HBufC* iEmptyListText;
+        //HBufC* iEmptyListText;
         // view specific data, references to view data
         TInt& iHighlightedRowNumber;     // The row number highlighted.
         TInt& iFirstEntryOnScreenIndex;  // The offset of the topmost item on screen to the first entry.
--- a/calendarui/views/inc/calenweekcontainer.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/calenweekcontainer.h	Sun Jun 20 22:55:39 2010 +0200
@@ -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.
@@ -438,7 +439,8 @@
     
     TBool iTopRowDefault;
     TBool iRow;
-    TBool iValidDay;   
+    TBool iValidDay;
+    TBool iHourChange;
     };
 
 #endif //CALENWEEKCONT_H
--- a/calendarui/views/inc/calenweeklistbox.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/calenweeklistbox.h	Sun Jun 20 22:55:39 2010 +0200
@@ -92,7 +92,7 @@
      */
     TBool IsValidPointer(TPoint aPos);
     void HandlePointerEventL(const TPointerEvent& aPointerEvent);
-private:
+
     /**
      * Calculates new column from pointer event
      */
--- a/calendarui/views/inc/calenweekview.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/inc/calenweekview.h	Sun Jun 20 22:55:39 2010 +0200
@@ -48,6 +48,8 @@
      * @param aTime Set a time to StatusPane
      */
     void SetStatusPaneFromActiveContextL();
+    
+    void UpdateCbaL();
 
 public:  // From CCalenView
     virtual TNextPopulationStep ActiveStepL();
@@ -148,6 +150,7 @@
     TTime iTime;
     TInt iSelectedRowNumber;      // The row number of the highlighted cell.
     TTimeIntervalMinutes iFirstRowTime;           // The time of the first row on the screen.
+    TBool iShowBackButtonOnCba; 
     };
 
 #endif //CALENWEEKVIEW_H
--- a/calendarui/views/src/calencontainer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calencontainer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -30,6 +30,7 @@
 #include <layoutmetadata.cdl.h>
 #include <calentoolbar.h>
 #include <akntoolbar.h>
+#include <touchfeedback.h>
 
 // user includes
 #include "calendarui_debug.h"
@@ -517,7 +518,7 @@
 // (other items were commented in a header).
 // ----------------------------------------------------------------------------
 //
-CAknIconArray* CCalenContainer::CreateIconsL( const RArray<MCalenServices::TCalenIcons>& aIndexArray )
+CAknIconArray* CCalenContainer::CreateIconsL( const RArray<MCalenServices::TCalenIcons>& aIndexArray, const TInt aViewId ) 
     {
     TRACE_ENTRY_POINT;
     const TInt iconCount( aIndexArray.Count() );
@@ -527,8 +528,8 @@
 
     for( TInt i=0; i<iconCount; ++i )
         {
-        icons->AppendL( iServices.GetIconL( static_cast<MCalenServices::TCalenIcons>(aIndexArray[i] ) ));
-        }
+        icons->AppendL( iServices.GetIconL( static_cast<MCalenServices::TCalenIcons>(aIndexArray[i] ), aViewId ));
+        } 
     CleanupStack::Pop( icons );
     TRACE_EXIT_POINT;
     return icons;
@@ -876,4 +877,25 @@
     TRACE_EXIT_POINT;
     }
 
+
+// ----------------------------------------------------------------------------
+// CCalenContainer::GenerateTactileFeedback()
+// Generates tactile feedback on user touch action
+// ----------------------------------------------------------------------------
+void CCalenContainer::GenerateTactileFeedback()
+    {
+    TRACE_ENTRY_POINT;
+    
+    if(!iFeedBack)
+        {
+        iFeedBack = MTouchFeedback::Instance();
+        }
+    
+    if ( iFeedBack && iFeedBack->TouchFeedbackSupported() )
+        {
+        iFeedBack->InstantFeedback( ETouchFeedbackBasic );
+        }
+    
+    TRACE_EXIT_POINT;
+    }
 // End of File
--- a/calendarui/views/src/calendaycontainer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calendaycontainer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -332,7 +332,7 @@
     for ( TInt i(0); i < iLayoutTable->Count(); ++i )
         {
         SItemInfo& item = (*iLayoutTable)[i];
-        if ( item.iTopLine == aListIndex )
+        if ( aListIndex >= item.iTopLine && aListIndex <= item.iBottomLine )
             {
             TRACE_EXIT_POINT;
             return i;
@@ -1440,6 +1440,7 @@
         
     if(aPointerEvent.iType == TPointerEvent::EButton1Down)
         {
+        this->GenerateTactileFeedback(); //Tactile feedback.
         control = iLayoutManager->ControlOrNull();
         if(control)
             {
--- a/calendarui/views/src/calendaylistbox.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calendaylistbox.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -388,6 +388,8 @@
     }
 
 
+
+
 TKeyResponse CCalenDayListBox::HandleDownwardLoopingL(const TKeyEvent& aKeyEvent)
     {
     TRACE_ENTRY_POINT;
--- a/calendarui/views/src/calendaylistboxitemdrawer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calendaylistboxitemdrawer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -124,30 +124,46 @@
 
     FormattedCellData()->Draw(Properties(aItemIndex), *iGc, &target, 
                               aItemTextRect, aItemIsCurrent&&highlightShown, 
-                              colors);
-    
-    
-    
-    if(CHECK_IF_FIRSTLINE(aItemIndex))
-        {
-        CCalenDayContainer::SItemInfo& itemInfo = 
-                           static_cast<CCalenDayListBox*>(iListBox)->iDayContainer->FindItem(aItemIndex);
-        iColor = itemInfo.iColor;
-        }
-    
-
-    TAknWindowComponentLayout tempLayout =
-                    AknLayoutScalable_Apps::list_cale_time_pane_g6(
-                            aItemIndex - static_cast<CCalenDayListBox*> (iListBox)->TopItemIndex());
+                              colors);   
+  
+    TInt variantIndex = static_cast<CCalenDayListBox*>(iListBox)->iDayContainer->LayoutVariantIndex(CCalenDayContainer::EListScrollCaleDayPane);
+    // get the listbox rect.
+    TRect listBoxRect = iListBox->View()->ViewRect();
+    TAknWindowComponentLayout tempLayout = AknLayoutScalable_Apps::list_cale_time_pane_g6(variantIndex);
 
     TAknLayoutRect colourstrips;
-    colourstrips.LayoutRect( aItemTextRect, tempLayout.LayoutLine() );
-    TRect finalRect(colourstrips.Rect());
-    finalRect.SetHeight(aItemTextRect.Height());
-    iGc->DrawRect( colourstrips.Rect() );
+    colourstrips.LayoutRect( aItemTextRect, tempLayout.LayoutLine() );    
+    if(CHECK_IF_FIRSTLINE(aItemIndex))
+       {
+	     iColorStripHeight = 0;
+       iColorStripRect.SetRect(colourstrips.Rect().iTl,colourstrips.Rect().iBr);
+       }
+    // get itemInfo for each line to set the color
+    CCalenDayContainer::SItemInfo& itemInfo = 
+                             static_cast<CCalenDayListBox*>(iListBox)->iDayContainer->FindItem(aItemIndex);
+    iColor = itemInfo.iColor;    
+
+    if (aItemTextRect.iBr.iY > listBoxRect.iBr.iY)
+        {
+        iColorStripRect.SetRect(iColorStripRect.iTl.iX, iColorStripRect.iTl.iY,
+            iColorStripRect.iBr.iX, listBoxRect.iBr.iY);
+        }
+    else if (aItemTextRect.iTl.iY < listBoxRect.iTl.iY)
+        {
+        iColorStripRect.SetRect(colourstrips.Rect().iTl.iX, listBoxRect.iTl.iY,
+                colourstrips.Rect().iBr.iX, colourstrips.Rect().iBr.iY);
+        iColorStripHeight += iColorStripRect.Height();
+        iColorStripRect.SetHeight(iColorStripHeight);
+        }         
+    else
+        {
+        iColorStripHeight += aItemTextRect.Height();   
+        iColorStripRect.SetHeight(iColorStripHeight);
+        }   
+        
     iGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
     iGc->SetBrushColor( TRgb(iColor) );
-    iGc->DrawRect( finalRect );
+    iGc->DrawRect( iColorStripRect );
     
     iGc->Reset();
     
--- a/calendarui/views/src/calendaylistboxmodel.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calendaylistboxmodel.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -484,6 +484,11 @@
     HBufC* result = NULL;
     if ( doesFit )
         {
+        if ( aLineArray.Count() == 1 )
+            {
+            aLineArray.AppendL( TPtrC(KNullDesC) );
+            }
+            
         // If we could fit, we return visualText and caller has
         // to memory manage it. TPtrs in aLineArray points to this text
         // buffer.
@@ -515,6 +520,11 @@
             {
             aLineArray.AppendL( TPtrC(KNullDesC) );
             }
+            
+        if ( aLineArray.Count() == 1 )
+            {
+            aLineArray.AppendL( TPtrC(KNullDesC) );
+            }
 
         // We return original text, because
         // AknBidiTextUtils::ConvertToVisualAndWrapToArrayL
@@ -661,8 +671,14 @@
                 {
                 isEndDisplayed = EFalse;
                 }
-            for (TInt i(1); i < textLines->Count() || !isEndDisplayed; i++)
+            TInt textLinesCount = textLines->Count();
+            for (TInt i(1); i <= textLinesCount || !isEndDisplayed; i++)
                 {
+                if(i == textLinesCount)
+                    {
+                    itemInfo.iBottomLine = iItemTextArray->Count();
+                    break;
+                    }
                 if (itemInfo.iTopLine == KIndexError)
                     {
                     itemInfo.iTopLine = iItemTextArray->Count();
--- a/calendarui/views/src/calendayview.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calendayview.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -185,7 +185,6 @@
         {
         iShowBackButtonOnCba = EFalse;
         }
-    iDayContainer->UpdateContainerL();
     //UpdateCbaL();
 
     iEventViewCommandHandled = EFalse;
--- a/calendarui/views/src/caleneventview.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/caleneventview.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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;
@@ -421,6 +424,21 @@
             // nothing to do
             }
             break;
+       case ECalenCmdFindPhoneNum:
+            {
+            cnt->OnCmdFindPhoneNumL();
+            }
+            break;
+       case ECalenCmdFindEmail:
+            {
+            cnt->OnCmdFindEmailL();
+            }
+            break;
+       case ECalenCmdFindURL:
+           {
+           cnt->OnCmdFindUrlL();
+           }
+           break;
         default:
             if(cnt->GetFindItemMenu()->CommandIsValidL(aCommand))
                 {
@@ -465,6 +483,16 @@
 	{
     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:
@@ -497,7 +525,7 @@
 	    	        aMenuPane->DeleteMenuItem(ECalenViewAttachmentList);
 	    	        }
 	    	    }
-		  	 cnt->GetFindItemMenu()->AddItemFindMenuL(cnt->GetItemFinder(),aMenuPane,EFindItemMenuPlaceHolder,KNullDesC);
+	
 		  	 
 		  	 if(CCalenLocationUtil::IsMapProviderAvailableL())
             	{
@@ -515,6 +543,14 @@
 	            aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace );
 	            aMenuPane->DeleteMenuItem( ECalenShowLocation );	
 	            }
+		  	if(!(calendarInfoList[index]->Enabled()))
+		  	    {
+                aMenuPane->DeleteMenuItem(ECalenSend);
+                aMenuPane->DeleteMenuItem(ECalenCmdPromptThenEdit);
+                aMenuPane->DeleteMenuItem(ECalenDeleteCurrentEntry);
+		  	    }
+		  	
+		  	 
 		    break;
 		  	}
 		 default:
@@ -523,7 +559,7 @@
 		    }
 			break;
 		}
-    
+    CleanupStack::PopAndDestroy(&calendarInfoList);
     TRACE_EXIT_POINT;	
 	}
 	
@@ -762,5 +798,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/caleneventviewcontainer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/caleneventviewcontainer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -117,8 +117,7 @@
                               MCalenServices& aServices  )
     : CCalenContainer( aView, aServices ),
     					  iEntry(NULL),
-    					  iAutomaticHlValue(ETrue),
-    					  iAutomaticHlInitialized(EFalse)
+						  iEmbeddedFileOpened(EFalse)
     {
 	TRACE_ENTRY_POINT;
 	iNumOfLinesBeforeLocField = 0;
@@ -150,7 +149,6 @@
     delete iTimeFormat;
     delete iDateFormat;
     delete iDocHandler;
-    delete iAutoFinder;
     delete iFindMenu;
     
     if( iNotifier )
@@ -188,9 +186,10 @@
                                                            ETrue );
     
     iDocHandler = CDocumentHandler::NewL( iEikonEnv->Process() );
-    iAutoFinder = CItemFinder::NewL();
+    
     iFindMenu = CFindItemMenu::NewL( EFindItemMenuPlaceHolder );
     iFindMenu->AttachItemFinderMenuL(0);
+   
     
     iParaFormat = CParaFormat::NewL();
 
@@ -205,16 +204,9 @@
     iLabel->SetContainerWindowL(*this);
     iLabel->SetTextL(_L(""));
     iLabel->SetRect(Rect());
-    
-    ReadAutoHlCenRepValueAndSetNotifyL();
-    
-    CCalenEventView* eventView = static_cast<CCalenEventView*>( iView );
-    if( !( eventView->IsAlarmActiveInViewer() ) )
-        {
-        SetAutomaticHighlightL(iAutomaticHlValue);
-        }
-    
+        
     iDocHandler->SetExitObserver( this );
+    iTextEditor->EnableKineticScrollingL(ETrue);
 	TRACE_EXIT_POINT;
 	}
 
@@ -253,12 +245,7 @@
 void CCalenEventViewContainer::CompletePopulationL()
 	{
     TRACE_ENTRY_POINT;
-    if(iTextEditor && iTextEditor->Text()->DocumentLength() > 0 && iAutoFinder &&
-    iSelectedText.iCursorPos == 0 && iSelectedText.iAnchorPos == 0)
-        {
-        iAutoFinder->SetEditor((CEikRichTextEditor**)&iTextEditor);
-        }
-        
+    
     iTextEditor->SetFocus(ETrue);
     ActivateL();
     AddToStackAndMakeVisibleL();
@@ -405,7 +392,6 @@
             {
             case EKeyUpArrow:
                 {
-                 iAutoFinder->NextItemOrScrollL( CItemFinder::ENextUp );
                 // Scroll the text view up by one line
                 iTextEditor->MakeVisible(EFalse);
                 TInt scrollLines = KScrollViewerUp;
@@ -420,7 +406,6 @@
 
             case EKeyDownArrow:
                 {
-                iAutoFinder->NextItemOrScrollL( CItemFinder::ENextDown );
                 // Scroll the text view down by one line
                 iTextEditor->MakeVisible(EFalse);
                 TInt scrollLines = KScrollViewerDown;
@@ -446,11 +431,6 @@
                 keyResponse = EKeyWasConsumed;
             	}
                 break;
-            case EKeyPhoneSend:
-             	{
-             	HandleNumberCallL();
-                break;
-              }
             case EKeyBackspace:  /* fall through... */
             case EKeyDelete:
             	{            
@@ -514,25 +494,6 @@
  
     }
 
-// ----------------------------------------------------------------------------
-// CCalenEventViewContainer::HandleNumberCallL
-// ----------------------------------------------------------------------------
-//
-void CCalenEventViewContainer::HandleNumberCallL()
-	{
-	TRACE_ENTRY_POINT;
-	
-	const CItemFinder::CFindItemExt& findItem = iAutoFinder->CurrentItemExt(); 
-     
-     if(findItem.iItemType != CItemFinder::EPhoneNumber)
-        {
-         return;
-        }
-     
-     iFindMenu->HandleCallL( findItem.iItemDescriptor->Des() );  
-	
-	TRACE_EXIT_POINT;
-	}
 
 // ----------------------------------------------------------------------------
 // CCalenEventViewContainer::HandlePointerEventL
@@ -548,10 +509,8 @@
 	 {
 	 	return;
 	 }
-   
-    CCalenEventView* eventView = static_cast<CCalenEventView*>( iView );
-    if( !( eventView->IsAlarmActiveInViewer() ) )
-        {
+    CCalenContainer::HandlePointerEventL( aPointerEvent );
+    
     if(iTextEditor->Rect().Contains(aPointerEvent.iPosition))
     	{
     	switch(aPointerEvent.iType)
@@ -559,24 +518,26 @@
     		case TPointerEvent::EButton1Down:
     			{
     			iTextEditor->SetFocus(ETrue);
-    			
-    			// TODO: Uncomment this when enabling attachment support
-    			if(iEventViewData)
+    			CCalenEventView* eventView = static_cast<CCalenEventView*>( iView );
+    			if(!( eventView->IsAlarmActiveInViewer() ) )
     			    {
-    		
-    			    if(iEventViewData->AttachmentCount())
-    			        {
-    			        CTextView *textView = iTextEditor->TextView();
-                    
-    			        TTmPosInfo2 *posInfo = new(ELeave) TTmPosInfo2;
-    			        textView->FindXyPosL(aPointerEvent.iPosition,*posInfo);
-                    
-    			        // Check if it is tapped on any attachment name, if yes then open that attachment
-    			        CheckAndOpenTappedAttachment(posInfo);
-    			        delete posInfo;
-    			        }
+    			// TODO: Uncomment this when enabling attachment support
+                    if(iEventViewData && !iEmbeddedFileOpened)
+                        {
+                        if(iEventViewData->AttachmentCount())
+                            {
+                            CTextView *textView = iTextEditor->TextView();
+                        
+                            TTmPosInfo2 *posInfo = new(ELeave) TTmPosInfo2;
+                            textView->FindXyPosL(aPointerEvent.iPosition,*posInfo);
+                        
+                            // Check if it is tapped on any attachment name, if yes then open that attachment
+                            CheckAndOpenTappedAttachment(posInfo);
+                            delete posInfo;
+                            }
+                        }
     			    }
-    			break;
+    				break;
     			}
     		case TPointerEvent::EDrag:
     			{
@@ -588,10 +549,7 @@
     			iTextEditor->SetFocus(ETrue);
     			TInt curPos = iTextEditor->CursorPos();	
 		        TRect rect = iTextEditor->Rect();  
-		       	if ( !iAutoFinder->ItemWasTappedL( aPointerEvent.iPosition - rect.iTl ) )
-		         	{
-				 	//	return;
-				 	} 
+		       	
     			break;	
     			}
     		default:
@@ -599,9 +557,7 @@
     			break;	
     			}	
     		}
-       	iTextEditor->HandlePointerEventL(aPointerEvent);
-       	}    
-      }
+     }
        	
     TRACE_EXIT_POINT;
     }
@@ -638,15 +594,18 @@
             ( aType == KUidValueCoeZoomChangeEvent ) ||
             ( aType == KUidValueCoeFontChangeEvent ) )
         {
-        CEikAppUi* appUi = static_cast<CEikAppUi*>( ControlEnv()->AppUi() );
-        SetRect( appUi->ClientRect() );
+//        CEikAppUi* appUi = static_cast<CEikAppUi*>( ControlEnv()->AppUi() );
+//        SetRect( appUi->ClientRect() );
+        TRect mainPane;
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
+        SetRect( mainPane );
         }
 
     if( KAknsMessageSkinChange == aType || 
             KEikDynamicLayoutVariantSwitch == aType )
         {
 	    SizeChanged();
-	    
+	    SetupFontL();
 	    if(iTextEditor->ScrollBarFrame())
 	        {
 	        // make the scrollbars invisible
@@ -2333,58 +2292,12 @@
 	return iEventViewData;	
 	}
 
-// -----------------------------------------------------------------------------
-// CCalenEventViewContainer::ReadAutoHlCenRepValueAndSetNotifyL
-// 
-// -----------------------------------------------------------------------------
-//
-void CCalenEventViewContainer::ReadAutoHlCenRepValueAndSetNotifyL()
-	{
-	TRACE_ENTRY_POINT;
-	
-	if ( iAutomaticHlInitialized )
-	     return;
-	
-    // Create the session
-    iCenRepSession = CRepository::NewL( KCRUidCommonUi );
-    
-    if( iCenRepSession )
-        {
-        // Get the value of AutomaticHighlight key
-        iCenRepSession->Get( KCuiAutomaticHighlight, iAutomaticHlValue );
-        // Create the notifer
-        iNotifier = 
-            CCenRepNotifyHandler::NewL( 
-                *this, *iCenRepSession, CCenRepNotifyHandler::EIntKey,
-                KCuiAutomaticHighlight );
-        // Start listening
-        iNotifier->StartListeningL();       
-        }
-    
-    iAutomaticHlInitialized = ETrue; // Done once per viewer
-	
-	TRACE_EXIT_POINT;
-	}
 
 // -----------------------------------------------------------------------------
-// CCalenEventViewContainer::HandleNotifyInt
-// Handles the incoming notifications of key changes
+// CCalenEventViewContainer::HandleNotifyError
+// From MCenRepNotifyHandlerCallback
 // -----------------------------------------------------------------------------
-//		
-void CCalenEventViewContainer::HandleNotifyInt( TUint32 /*aId*/, TInt aNewValue )
-	{
-	TRACE_ENTRY_POINT;
-	
-	// Notifies changes on KCuiAutomaticHighlight
-    TRAPD(error,SetAutomaticHighlightL( aNewValue ));
-	if ( error != KErrNone )
-		{
-		 User::Panic(_L("CCalenEventViewContainer"),error);
-		}
-	TRACE_EXIT_POINT;
-	}
-
-
+//	
 void CCalenEventViewContainer::HandleNotifyError( TUint32 /*aId*/,TInt /*aError*/,
 												CCenRepNotifyHandler* /*aHandler*/ )
 	{
@@ -2403,47 +2316,9 @@
 	TRACE_EXIT_POINT;
 	}
 
-// -----------------------------------------------------------------------------
-// CCalenEventViewContainer::SetAutomaticHighlightL
-// -----------------------------------------------------------------------------
-//	
-void CCalenEventViewContainer::SetAutomaticHighlightL( const TBool aSwitchON )
-	{
-	TRACE_ENTRY_POINT;
-	
-	if ( iAutoFinder )
-        {
-        // content highlight
-        if ( aSwitchON )
-            { // switch ON
-            iAutoFinder->SetFindModeL( 
-                CItemFinder::EPhoneNumber |
-                CItemFinder::EUrlAddress |
-                CItemFinder::EEmailAddress );
-               
-            }
-        else
-            { // switch OFF
-            iAutoFinder->SetFindModeL( 
-                CItemFinder::ENoneSelected );
-                
-            }
-        }
-        
-	TRACE_EXIT_POINT;
-	}
-	
-// -----------------------------------------------------------------------------
-// CCalenEventViewContainer::GetItemFinder
-// -----------------------------------------------------------------------------
-//
-CItemFinder* CCalenEventViewContainer::GetItemFinder()
-	{
-	TRACE_ENTRY_POINT;
-	TRACE_EXIT_POINT;
-	
-	return iAutoFinder;
-	}
+
+
+
 // -----------------------------------------------------------------------------
 // CCalenEventViewContainer::GetFindItemMenu
 // -----------------------------------------------------------------------------
@@ -2786,6 +2661,8 @@
     {
     TRACE_ENTRY_POINT;
     
+    iEmbeddedFileOpened = EFalse;
+    iServices.GetAttachmentData()->AttachmentOpen(iEmbeddedFileOpened);  
     if (aReason == EAknCmdExit)
         {
         //issue this notification, which will be handled by attachmentui.
@@ -2953,19 +2830,31 @@
     
     if(datatype == KNotePadTextDataType())
         {
+        if(iEmbeddedFileOpened)
+            {
+            return;
+            }
+        iEmbeddedFileOpened = ETrue; 
         const TDesC& notepadTitle = _L("NotePad");
         ret = CNotepadApi::ExecFileViewerL( aFile, 
                                            &notepadTitle,
                                            ETrue,
                                            ETrue,
                                            KCharacterSetIdentifierIso88591 );
+        iEmbeddedFileOpened = EFalse;
         
         }
     else
         {
         //doc handler will open the other files (other than text file).
         TRAP( ret, iDocHandler->OpenFileEmbeddedL( aFile, datatype ) );
+        
+        if(ret == KErrNone)
+            {
+            iEmbeddedFileOpened = ETrue;
+            }
         }
+    iServices.GetAttachmentData()->AttachmentOpen(iEmbeddedFileOpened);
     
     switch(ret)
         {
@@ -2984,6 +2873,60 @@
     TRACE_EXIT_POINT
     }  
 
+// -----------------------------------------------------------------------------
+// OnCmdFindPhoneNumL
+// Find phone numbers in the form.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCalenEventViewContainer::OnCmdFindPhoneNumL()
+    {
+    TRACE_ENTRY_POINT;
+    BuildSearchBufferL();
+    MCalenToolbar* toolbar = iServices.ToolbarOrNull();
+    CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchPhoneNumberBin);
+    toolbar->SetToolbarVisibilityL(EFalse);
+    finder->ExecuteLD();
+    toolbar->SetToolbarVisibilityL(ETrue);
+    
+    TRACE_EXIT_POINT;
+    }
+
+// -----------------------------------------------------------------------------
+// OnCmdFindUrlL
+// Find urls in the form.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCalenEventViewContainer::OnCmdFindUrlL()
+    {
+    TRACE_ENTRY_POINT;
+    BuildSearchBufferL();
+    MCalenToolbar* toolbar = iServices.ToolbarOrNull();
+    CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchURLBin);
+    toolbar->SetToolbarVisibilityL(EFalse);
+    finder->ExecuteLD();
+    toolbar->SetToolbarVisibilityL(ETrue);
+    TRACE_EXIT_POINT;
+    }
+
+// -----------------------------------------------------------------------------
+// OnCmdFindEmailL
+// Find email addresses in the form.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCalenEventViewContainer::OnCmdFindEmailL()
+    {
+    TRACE_ENTRY_POINT;
+    BuildSearchBufferL();
+    MCalenToolbar* toolbar = iServices.ToolbarOrNull();
+    CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchMailAddressBin);
+    toolbar->SetToolbarVisibilityL(EFalse);
+    finder->ExecuteLD();
+    toolbar->SetToolbarVisibilityL(ETrue);
+    TRACE_EXIT_POINT;
+    }
 
 // end of file
 
--- a/calendarui/views/src/calenicondrawer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calenicondrawer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -24,6 +24,7 @@
 #include "calenicondrawer.h"
 
 #include <calenservices.h>
+#include <CalenUid.h> 
 
 // System includes
 #include <fbs.h>
@@ -347,7 +348,7 @@
 
     for( TInt i=0; i<iconCount; ++i )
         {
-        icons->AppendL( iServices.GetIconL( static_cast<MCalenServices::TCalenIcons>(aIndexArray[i] ) ));
+        icons->AppendL( iServices.GetIconL( static_cast<MCalenServices::TCalenIcons>(aIndexArray[i] ), KCalenMissedEventViewUidValue )); 
         }
     CleanupStack::Pop( icons );
 
--- a/calendarui/views/src/calenmissedalarmscontainer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calenmissedalarmscontainer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -139,12 +139,12 @@
     iListBox->CreateScrollBarFrameL(ETrue);
     iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
             CEikScrollBarFrame::EAuto);
-
+    iListBox->SetListBoxObserver( this ); // single click changes MK
     // set the model array
     iListBox->Model()->SetItemTextArray(iListBoxItemArray);
 
     // set icon array
-    CAknIconArray* iconArray = CreateIconsL( iIconIndices );
+    CAknIconArray* iconArray = CreateIconsL( iIconIndices, KCalenMissedAlarmsViewUidValue ); 
     CleanupStack::PushL(iconArray);
     iListBox->ItemDrawer()->FormattedCellData()->SetIconArray(iconArray);
     CleanupStack::Pop();
@@ -401,7 +401,17 @@
 
     if ( aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch )
         {
-        SizeChanged();
+//        SizeChanged();
+    TRect main_pane;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, main_pane );
+    SetRect( main_pane );
+    if(iListBox)
+        {
+        TRect mainPane;
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
+        TRect bgContextRect( TPoint(0, 0), mainPane.Size() );
+        iListBox->SetRect( bgContextRect );
+        }
 
         // refresh
         TRAPD(error,iView->BeginRepopulationL());
@@ -461,38 +471,31 @@
         {
         case TPointerEvent::EButton1Down:
             {
-            TInt oldCursor = iListBox->View()->CurrentItemIndex();
-            iListBox->HandlePointerEventL(aPointerEvent);
-            TInt newCursor = iListBox->View()->CurrentItemIndex();
-
-            if (oldCursor != newCursor)
+            TBool isItem (iListBox->View()->XYPosToItemIndex(aPointerEvent.iPosition, pointerIndex));
+            
+            if(isItem && MissedAlarmsCount() > 0)
                 {
-                // set the context
-                iHighlightedRowNumber = newCursor;
-                SetContextFromMissedAlarmEntryL(newCursor);
-                iFirstTap = EFalse;
+                iHighlightedRowNumber = iListBox->View()->CurrentItemIndex(); 
+                SetContextFromMissedAlarmEntryL(iListBox->View()->CurrentItemIndex());
                 }
-            else
-                {
-                iFirstTap = ETrue;
-                }
+            
             break;
             }
         case TPointerEvent::EDrag:
             {
-            iListBox->HandlePointerEventL(aPointerEvent);
+            /*iListBox->HandlePointerEventL(aPointerEvent);
             if (iFirstTap && index != iListBox->CurrentItemIndex())
                 {
                 iFirstTap = EFalse;
-                }
+                }*/
             break;
             }
 
         case TPointerEvent::EButton1Up:
             {
-            if (iFirstTap)
+           // if (iFirstTap)
                 {
-                iView->HandleCommandL(ECalenMissedEventView);
+               // iView->HandleCommandL(ECalenMissedEventView);
                 }
             break;
             }
@@ -500,6 +503,11 @@
             break;
         }
 
+   if ( aPointerEvent.iType != TPointerEvent::EButtonRepeat )
+        {
+        iListBox->HandlePointerEventL( aPointerEvent );
+        }
+  
     TRACE_EXIT_POINT;
     }
 
@@ -909,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;
@@ -925,6 +935,7 @@
     context.SetInstanceIdL( id, context.ViewId() ); 
     
     CleanupStack::PopAndDestroy( entry );
+    }
     
     TRACE_EXIT_POINT;
     }
@@ -952,4 +963,43 @@
     return KErrNotFound;
     }
 
+
+void CCalenMissedAlarmsContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, 
+                                                      TListBoxEvent aEventType)
+    {
+    TRACE_ENTRY_POINT;
+    switch( aEventType )
+        {
+        // Single click integration
+        case EEventItemSingleClicked:
+            {
+             iHighlightedRowNumber = iListBox->View()->CurrentItemIndex();
+            
+              SetContextFromMissedAlarmEntryL(iListBox->View()->CurrentItemIndex());
+            //Handle listbox item selection event
+           // iListBox->HandlePointerEventL(aPointerEvent);
+            if(iView->MenuBar()->IsDisplayed() == EFalse)
+                {
+                iView->HandleCommandL( ECalenMissedEventView );
+                }
+            break;
+            }
+            
+        // Single click integration
+        case EEventEnterKeyPressed:
+            {
+            iHighlightedRowNumber = iListBox->View()->CurrentItemIndex();
+            
+              SetContextFromMissedAlarmEntryL(iListBox->View()->CurrentItemIndex());
+            iView->HandleCommandL( ECalenMissedEventView );
+            break;
+            }
+        default:
+            break;
+        };
+    TRACE_EXIT_POINT;
+    }
+
+
+
 // End of File
--- a/calendarui/views/src/calenmissedalarmsview.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calenmissedalarmsview.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -120,24 +120,28 @@
         	break;
         case EPopulationDone:
 	       	{
-	       	// update missed alarm list
-	       	Container()->UpdateMissedAlarmsArrayL();
+	       	if(Container())
+	       	    {
+                // update missed alarm list
+                Container()->UpdateMissedAlarmsArrayL();
 
-	       	// populate with missed alarms
-	       	Container()->PopulateWithMissedAlarmsL();
+                // populate with missed alarms
+                Container()->PopulateWithMissedAlarmsL();
        	    
-       	    // complete population
-       	    Container()->CompletePopulationL();
-       	    RedrawStatusPaneL();
-       	    UpdateCbaL();
-       	    
-       	    // dim clear and clear all buttons
-       	    if(Container()->MissedAlarmsCount()==0)
-       	        {
-       	        DimClearAndClearAllButtons();
-       	        }
-
-        	nextStep = CCalenView::EDone;
+                // complete population
+                Container()->CompletePopulationL();
+                
+                RedrawStatusPaneL();
+                UpdateCbaL();
+                
+                //no tool bar in missed alarms view
+                MCalenToolbar* toolbar = iServices.ToolbarOrNull();
+	       	    if(toolbar && toolbar->IsVisible())
+	       	        {
+                    toolbar->SetToolbarVisibilityL(EFalse);  
+	       	        } 
+	       	    nextStep = CCalenView::EDone;
+	       	    }
         	}
         	break;	
         }
@@ -234,17 +238,28 @@
 		    break;
 		    }
         case ECalenCmdClearAll:
+            {
+            iHighlightedRowNumber = 0;
+            iServices.IssueCommandL(aCommand);
+            }
+            break;
         case ECalenCmdGotoCalendar:            
             {
             iHighlightedRowNumber = 0;
-            iServices.IssueCommandL(aCommand);
+			iServices.IssueCommandL(aCommand);
             }
             break;
         case EAknSoftkeyBack:
         case EAknSoftkeyClose:
             {
             iHighlightedRowNumber = 0;
-            iServices.IssueNotificationL(ECalenNotifyMissedAlarmViewClosed);
+			iServices.IssueNotificationL(ECalenNotifyMissedAlarmViewClosed);
+			}
+            break;
+        case EAknSoftkeyExit:
+            {
+         
+            CCalenNativeView::HandleCommandL(aCommand);
             }
             break;
         default:
@@ -290,9 +305,7 @@
     
     UpdateCbaL();
     
-    // Draw Missed Alarm toolbar by adding clear, clearall and gotocalendar buttons
-    AddToolbarButtonsL();
-    
+   
     TRACE_EXIT_POINT;
     }
 
@@ -304,10 +317,11 @@
 void CCalenMissedAlarmsView::DoDeactivateImpl()
     {
     TRACE_ENTRY_POINT;
-    
-    // Remove the toolbar buttons from Missed Alarm View and
-    // enable native view toolbar buttons
-    TRAP_IGNORE(RemoveToolbarButtonsL());
+    MCalenToolbar* toolbar = iServices.ToolbarOrNull();
+    if(toolbar)
+        {
+        toolbar->SetToolbarVisibilityL(ETrue);  
+        } 
     
     TRACE_EXIT_POINT;
     }
@@ -485,159 +499,4 @@
 	return static_cast<CCalenMissedAlarmsContainer*>( iContainer );
 	}
 
-// ----------------------------------------------------------------------------
-// CCalenMissedAlarmsView::AddToolbarButtonsL
-// Adds missed alarms view's toolbar buttons 
-// ----------------------------------------------------------------------------
-//
-void CCalenMissedAlarmsView::AddToolbarButtonsL()
-    {
-    TRACE_ENTRY_POINT;
-    
-    // Get the existing toolbar from MCalenservices
-    MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
-    
-    if(toolbarImpl)  // If toolbar exists
-        {
-        CAknToolbar& toolbar = toolbarImpl->Toolbar();
-        
-        // Create the new buttons for Missed alarm view toolbar
-        // If layout is mirrored the button order is reversed.
-        // For Non mirrored layouts each button is appended to the toolbar
-        // For mirrored layouts each button is inserted at index 0.
-        TBool mirrored( AknLayoutUtils::LayoutMirrored() );
-        
-        CAknButton* button = NULL;
-        CGulIcon* icon = NULL;
-
-        // First button: Clear
-        icon = iServices.GetIconL( MCalenServices::ECalenClearMissedAlarms );
-        // put icon onto cleanup stack before its 
-        // ownership is transferred to CAknButton
-        button = CreateButtonL( icon, _L(""), R_CALE_MAV_TB_CLEAR, toolbar );
-        if( mirrored )
-            {
-            // Insert the button at index 0
-            toolbar.AddItemL( button, EAknCtButton, ECalenCmdClear, 0, 0 );
-            }
-        else
-            {
-            // Append the button
-            toolbar.AddItemL( button, EAknCtButton, ECalenCmdClear, 0, 0 );
-            }
-        
-        // Second button: Clear All
-        icon = iServices.GetIconL( MCalenServices::ECalenClearAllMissedAlarms );
-        // put icon onto cleanup stack before its
-        // ownership is transferred to CAknButton
-        button = CreateButtonL( icon, _L(""), R_CALE_MAV_TB_CLEARALL, toolbar );
-        if( mirrored )
-            {
-            // Insert the button at index 0
-            toolbar.AddItemL( button, EAknCtButton, ECalenCmdClearAll, 0, 0 );
-            }
-        else
-            {
-            // Append the button
-            toolbar.AddItemL( button, EAknCtButton, ECalenCmdClearAll, 0, 1 );
-            }
-        
-        // Third button: Go To Calendar
-        icon = iServices.GetIconL( MCalenServices::ECalenDayViewIcon );
-        // put icon onto cleanup stack before its
-        // ownership is transferred to CAknButton
-        button = CreateButtonL( icon, _L(""), R_CALE_MAV_TB_GOTO_CALE, toolbar );
-        if( mirrored )
-            {
-            // Insert the button at index 0
-            toolbar.AddItemL( button, EAknCtButton, ECalenCmdGotoCalendar, 0, 0 );
-            }
-        else
-            {
-            // Append the button
-            toolbar.AddItemL( button, EAknCtButton, ECalenCmdGotoCalendar, 0, 2 );
-            }
-        }
-    TRACE_EXIT_POINT;
-    }
-
-// ----------------------------------------------------------------------------
-// CCalenMissedAlarmsView::RemoveToolbarButtonsL
-// Removes the missed alarm view's toolbar buttons 
-// ----------------------------------------------------------------------------
-//
-void CCalenMissedAlarmsView::RemoveToolbarButtonsL()
-    {
-    TRACE_ENTRY_POINT;
-    
-    MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
-    if(toolbarImpl) // If toolbar exists
-        {
-        CAknToolbar& toolbar = toolbarImpl->Toolbar();
-        if(&toolbar)
-            {
-            // Remove the Missed alarm view's toolbar buttons
-            toolbar.RemoveItem(ECalenCmdClear); // Clear button
-            toolbar.RemoveItem(ECalenCmdClearAll);  // Clear All button
-            toolbar.RemoveItem(ECalenCmdGotoCalendar);  // Go To calendar button
-            }
-        }
-    
-    TRACE_EXIT_POINT;
-    }
-    
-// ----------------------------------------------------------------------------
-// CCalenMissedAlarmsView::CreateButtonL
-// Create missed alarms view toolbar buttons
-// ----------------------------------------------------------------------------
-CAknButton* CCalenMissedAlarmsView::CreateButtonL( CGulIcon* aIcon, 
-                                                   const TDesC& aText,
-                                                   TInt aTooltipID,
-                                                   CAknToolbar& aToolbar )
-    {
-    TRACE_ENTRY_POINT;
-
-    TInt flags = 0;
-    CAknButton* button = NULL;
-    
-    CleanupStack::PushL( aIcon );
-    HBufC* tooltipText = StringLoader::LoadLC( aTooltipID );
-    CleanupStack::Pop( tooltipText );
-    // put icon onto cleanup stack before its ownership is transferred to CAknButton
-    CleanupStack::Pop( aIcon );
-    CleanupStack::PushL( tooltipText );
-    button = CAknButton::NewL( aIcon, NULL, NULL, NULL, aText, 
-                               tooltipText->Des(), flags, 0 );
-    CleanupStack::PopAndDestroy( tooltipText );
-
-    button->SetIconScaleMode( EAspectRatioNotPreserved );
-    button->SetFocusing( EFalse );
-    button->SetBackground( &aToolbar );
-
-    TRACE_EXIT_POINT;
-    return button;
-    }    
-
-// ----------------------------------------------------------------------------
-// CCalenMissedAlarmsView::DimClearAndClearAllButtons
-// Dim clear and clear all toolbar buttons when there are no
-// missed alarm entries to clear
-// ----------------------------------------------------------------------------
-void CCalenMissedAlarmsView::DimClearAndClearAllButtons()
-    {
-    TRACE_ENTRY_POINT;
-    
-    MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
-    if(toolbarImpl) 
-        {
-        CAknToolbar& toolbar = toolbarImpl->Toolbar();
-
-        // dim clear and clear all toolbar buttons
-        toolbar.SetItemDimmed(ECalenCmdClear,ETrue,ETrue);
-        toolbar.SetItemDimmed(ECalenCmdClearAll,ETrue,ETrue);
-        }
-
-    TRACE_EXIT_POINT;
-    }
-
 // end of file	
--- a/calendarui/views/src/calenmissedeventcontainer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calenmissedeventcontainer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -46,7 +46,7 @@
 #include <centralrepository.h>
 #include <cenrepnotifyhandler.h>
 #include <CommonUiInternalCRKeys.h>
-#include <AknUtils.h>
+#include <AknUtils.h> 
 #include <avkon.hrh>    // EAknCmdHelp
 #include <avkon.mbg>
 #include <avkon.rsg>
@@ -99,9 +99,8 @@
 CCalenMissedEventContainer::CCalenMissedEventContainer(CCalenNativeView* aView,
                               MCalenServices& aServices  )
     : CCalenContainer( aView, aServices ),
-    					  iEntry(NULL),
-    					  iAutomaticHlValue(ETrue),
-    					  iAutomaticHlInitialized(EFalse)
+    					  iEntry(NULL)
+    					 
     {
 	TRACE_ENTRY_POINT;
 	TRACE_EXIT_POINT;
@@ -131,7 +130,7 @@
     delete iTimeFormat;
     delete iDateFormat;
     
-    delete iAutoFinder;
+ 
     delete iFindMenu;
     
     if( iNotifier )
@@ -162,7 +161,7 @@
                                                            Rect(),
                                                            ETrue );
      
-    iAutoFinder = CItemFinder::NewL();
+   
     iFindMenu = CFindItemMenu::NewL( EFindItemMenuPlaceHolder );
     iFindMenu->AttachItemFinderMenuL(0);
     
@@ -171,14 +170,13 @@
 	
 	iTextEditor = new (ELeave) CEikRichTextEditor;
     iTextEditor->ConstructL(this, 0, 0, CEikEdwin::EReadOnly | CEikEdwin::EAvkonDisableCursor | 
-    									CEikEdwin::ENoAutoSelection|CEikEdwin::EAvkonEditor);
+    									CEikEdwin::ENoAutoSelection|CEikEdwin::EAvkonEditor); 
     iTextEditor->SetMopParent(this);
     iTextEditor->SetRect( Rect() );
 	
     
-    ReadAutoHlCenRepValueAndSetNotifyL();
-    SetAutomaticHighlightL(iAutomaticHlValue);
-	TRACE_EXIT_POINT;
+	iTextEditor->EnableKineticScrollingL(ETrue);
+   	TRACE_EXIT_POINT;
 	}
 
 // ----------------------------------------------------------------------------
@@ -216,11 +214,6 @@
 void CCalenMissedEventContainer::CompletePopulationL()
 	{
 	TRACE_ENTRY_POINT;
-	
-	 if(iTextEditor && iTextEditor->Text()->DocumentLength() > 0 && iAutoFinder)
-    	{
-        iAutoFinder->SetEditor((CEikRichTextEditor**)&iTextEditor);
-    	}
     
     iTextEditor->SetFocus(ETrue);
 	ActivateL();
@@ -345,14 +338,14 @@
             {
             case EKeyUpArrow:
                 {
-                 iAutoFinder->NextItemOrScrollL( CItemFinder::ENextUp );
+               
                 // Scroll the text view up by one line
                 iTextEditor->MakeVisible(EFalse);
                 TInt scrollLines = KScrollViewerUp;
                 iTextEditor->TextView()->ScrollDisplayLinesL(scrollLines);
                 iTextEditor->UpdateScrollBarsL();
                 iTextEditor->MakeVisible(ETrue);
-                //Set focus immediately for highlight of auto find text
+                //Set focus immediately for highlight of auto find text 
                 iTextEditor->SetFocus(ETrue);
                 keyResponse = EKeyWasConsumed;
                 }
@@ -360,7 +353,7 @@
 
             case EKeyDownArrow:
                 {
-                iAutoFinder->NextItemOrScrollL( CItemFinder::ENextDown );
+               
                 // Scroll the text view down by one line
                 iTextEditor->MakeVisible(EFalse);
                 TInt scrollLines = KScrollViewerDown;
@@ -388,7 +381,6 @@
                 break;
             case EKeyPhoneSend:
              	{
-             	HandleNumberCallL();
                 if(CCalenLocationUtil::IsMapProviderAvailableL())	
 					{
 					iServices.IssueCommandL(ECalenGetLocationAndSave);
@@ -429,25 +421,6 @@
  
     }
 
-// ----------------------------------------------------------------------------
-// CCalenMissedEventContainer::HandleNumberCallL
-// ----------------------------------------------------------------------------
-//
-void CCalenMissedEventContainer::HandleNumberCallL()
-	{
-	TRACE_ENTRY_POINT;
-	
-	const CItemFinder::CFindItemExt& findItem = iAutoFinder->CurrentItemExt(); 
-     
-     if(findItem.iItemType != CItemFinder::EPhoneNumber)
-        {
-         return;
-        }
-     
-     iFindMenu->HandleCallL( findItem.iItemDescriptor->Des() );  
-	
-	TRACE_EXIT_POINT;
-	}
 
 // ----------------------------------------------------------------------------
 // CCalenMissedEventContainer::HandlePointerEventL
@@ -463,7 +436,7 @@
 	 {
 	 	return;
 	 }
-   
+    CCalenContainer::HandlePointerEventL( aPointerEvent );
     if(iTextEditor->Rect().Contains(aPointerEvent.iPosition))
     	{
     	switch(aPointerEvent.iType)
@@ -483,10 +456,6 @@
     			iTextEditor->SetFocus(ETrue);
     			TInt curPos = iTextEditor->CursorPos();	
 		        TRect rect = iTextEditor->Rect();  
-		       	if ( !iAutoFinder->ItemWasTappedL( aPointerEvent.iPosition - rect.iTl ) )
-		         	{
-				 	//	return;
-				 	} 
     			break;	
     			}
     		default:
@@ -494,7 +463,6 @@
     			break;	
     			}	
     		}
-       	iTextEditor->HandlePointerEventL(aPointerEvent);
        	}    
        	
     TRACE_EXIT_POINT;
@@ -532,14 +500,18 @@
         ( aType == KUidValueCoeZoomChangeEvent ) ||
         ( aType == KUidValueCoeFontChangeEvent ))
         {
-        CEikAppUi* appUi = static_cast<CEikAppUi*>( ControlEnv()->AppUi() );
-        SetRect( appUi->ClientRect() );
+//        CEikAppUi* appUi = static_cast<CEikAppUi*>( ControlEnv()->AppUi() );
+//        SetRect( appUi->ClientRect() );
+        TRect mainPane;
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
+        SetRect( mainPane );
         }
     
     if(aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch)
         {
         SizeChanged();
 
+        SetupFontL();
         // refresh
         TRAPD(err,iView->BeginRepopulationL());
         if(err!=KErrNone)
@@ -754,7 +726,9 @@
 		        AddRepeatFieldL();
 		        }
 		        
-		    iTitleTextId = R_CALEN_EVENT_VIEW_DAY_TITLE;  			
+		
+		    iTitleTextId = R_CALEN_EVENT_VIEW_ALLDAY_TITLE;
+		    
  			}
             break;
 
@@ -2098,58 +2072,12 @@
 	return iEventViewData;	
 	}
 
-// -----------------------------------------------------------------------------
-// CCalenMissedEventContainer::ReadAutoHlCenRepValueAndSetNotifyL
-// 
-// -----------------------------------------------------------------------------
-//
-void CCalenMissedEventContainer::ReadAutoHlCenRepValueAndSetNotifyL()
-	{
-	TRACE_ENTRY_POINT;
-	
-	if ( iAutomaticHlInitialized )
-	     return;
-	
-    // Create the session
-    iCenRepSession = CRepository::NewL( KCRUidCommonUi );
-    
-    if( iCenRepSession )
-        {
-        // Get the value of AutomaticHighlight key
-        iCenRepSession->Get( KCuiAutomaticHighlight, iAutomaticHlValue );
-        // Create the notifer
-        iNotifier = 
-            CCenRepNotifyHandler::NewL( 
-                *this, *iCenRepSession, CCenRepNotifyHandler::EIntKey,
-                KCuiAutomaticHighlight );
-        // Start listening
-        iNotifier->StartListeningL();       
-        }
-    
-    iAutomaticHlInitialized = ETrue; // Done once per viewer
-	
-	TRACE_EXIT_POINT;
-	}
 
 // -----------------------------------------------------------------------------
-// CCalenMissedEventContainer::HandleNotifyInt
-// Handles the incoming notifications of key changes
+// CCalenMissedEventContainer::HandleNotifyError
+// From MCenRepNotifyHandlerCallback
 // -----------------------------------------------------------------------------
-//		
-void CCalenMissedEventContainer::HandleNotifyInt( TUint32 /*aId*/, TInt aNewValue )
-	{
-	TRACE_ENTRY_POINT;
-	
-	// Notifies changes on KCuiAutomaticHighlight
-    TRAPD(error,SetAutomaticHighlightL( aNewValue ));
-	if ( error != KErrNone )
-		{
-		 User::Panic(_L("CCalenMissedEventContainer"),error);
-		}
-	TRACE_EXIT_POINT;
-	}
-
-
+//	
 void CCalenMissedEventContainer::HandleNotifyError( TUint32 /*aId*/,TInt /*aError*/,
 												CCenRepNotifyHandler* /*aHandler*/ )
 	{
@@ -2168,47 +2096,7 @@
 	TRACE_EXIT_POINT;
 	}
 
-// -----------------------------------------------------------------------------
-// CCalenMissedEventContainer::SetAutomaticHighlightL
-// -----------------------------------------------------------------------------
-//	
-void CCalenMissedEventContainer::SetAutomaticHighlightL( const TBool aSwitchON )
-	{
-	TRACE_ENTRY_POINT;
-	
-	if ( iAutoFinder )
-        {
-        // content highlight
-        if ( aSwitchON )
-            { // switch ON
-            iAutoFinder->SetFindModeL( 
-                CItemFinder::EPhoneNumber |
-                CItemFinder::EUrlAddress |
-                CItemFinder::EEmailAddress );
-               
-            }
-        else
-            { // switch OFF
-            iAutoFinder->SetFindModeL( 
-                CItemFinder::ENoneSelected );
-                
-            }
-        }
-        
-	TRACE_EXIT_POINT;
-	}
-	
-// -----------------------------------------------------------------------------
-// CCalenMissedEventContainer::GetItemFinder
-// -----------------------------------------------------------------------------
-//
-CItemFinder* CCalenMissedEventContainer::GetItemFinder()
-	{
-	TRACE_ENTRY_POINT;
-	TRACE_EXIT_POINT;
-	
-	return iAutoFinder;
-	}
+
 // -----------------------------------------------------------------------------
 // CCalenMissedEventContainer::GetFindItemMenu
 // -----------------------------------------------------------------------------
@@ -2271,6 +2159,56 @@
 		return EFalse;
 		}
 	}
+// -----------------------------------------------------------------------------
+// OnCmdFindPhoneNumL
+// Find phone numbers in the form.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCalenMissedEventContainer::OnCmdFindPhoneNumL()
+    {
+    TRACE_ENTRY_POINT;
+    
+    BuildSearchBufferL();
+    CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchPhoneNumberBin);
+    finder->ExecuteLD();
+       
+    TRACE_EXIT_POINT;
+    }
+
+// -----------------------------------------------------------------------------
+// OnCmdFindUrlL
+// Find urls in the form.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCalenMissedEventContainer::OnCmdFindUrlL()
+    {
+    TRACE_ENTRY_POINT;
+   
+    BuildSearchBufferL();
+    CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchURLBin);
+    finder->ExecuteLD();
+  
+    TRACE_EXIT_POINT;
+    }
+
+// -----------------------------------------------------------------------------
+// OnCmdFindEmailL
+// Find email addresses in the form.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCalenMissedEventContainer::OnCmdFindEmailL()
+    {
+    TRACE_ENTRY_POINT;
+    
+    BuildSearchBufferL();
+    CFindItemDialog* finder = CFindItemDialog::NewL( *iSearchBuf, CFindItemEngine::EFindItemSearchMailAddressBin);
+    finder->ExecuteLD();
+    
+    TRACE_EXIT_POINT;
+    }
 	
 // end of file
 
--- a/calendarui/views/src/calenmissedeventview.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calenmissedeventview.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -151,6 +151,13 @@
         	{
         	cnt->CompletePopulationL();
         	RedrawStatusPaneL();
+        	
+        	//no tool bar in missed event view
+        	MCalenToolbar* toolbar = iServices.ToolbarOrNull(); 
+        	    if(toolbar && toolbar->IsVisible())
+        	      {
+        	      toolbar->SetToolbarVisibilityL(EFalse);  
+        	      } 
         	nextStep = CCalenView::EDone;
         	}
         	break;
@@ -235,9 +242,7 @@
     
     UpdateCbaL();
     
-    // Draw even viewer toolbar by adding Edit, Delete and Send buttons
-	AddToolbarButtonsL();
-	
+   
     TRACE_EXIT_POINT;
     }
 
@@ -251,10 +256,13 @@
     TRACE_ENTRY_POINT;
     
     iPreviousViewId.iViewUid = KNullUid;
+    MCalenToolbar* toolbar = iServices.ToolbarOrNull(); 
+    if(toolbar)
+        {
+        toolbar->SetToolbarVisibilityL(ETrue);  
+        }
 
-    // Remove the toolbar buttons for event viewer before exiting from event view
-    TRAP_IGNORE(RemoveToolbarButtonsL());
-    
+        
     TRACE_EXIT_POINT;
     }
 
@@ -315,9 +323,30 @@
         case EAknSoftkeyClose:   
         case EAknSoftkeyBack:
 			{
+		
 	        iServices.IssueNotificationL(ECalenNotifyMissedEventViewClosed);
 			break;
 			}
+        case EAknSoftkeyExit: 
+            {
+                      
+            CCalenNativeView::HandleCommandL(aCommand);
+            }
+            break;
+        case ECalenCmdFindPhoneNum:
+            {
+            cnt->OnCmdFindPhoneNumL();
+             }
+             break;
+        case ECalenCmdFindEmail:
+            {
+            cnt->OnCmdFindEmailL();
+            }
+            break;
+        case ECalenCmdFindURL:
+            {
+            cnt->OnCmdFindUrlL();
+            }
         default:
             if(cnt->GetFindItemMenu()->CommandIsValidL(aCommand))
                 {
@@ -366,13 +395,13 @@
                       }
                 }
             
-		  	cnt->GetFindItemMenu()->AddItemFindMenuL(cnt->GetItemFinder(),aMenuPane,EFindItemMenuPlaceHolder,KNullDesC);
+		  
 		  	 
 		  	 if(CCalenLocationUtil::IsMapProviderAvailableL())
             	{
 	            if(cnt->IsEventHasMapLocationL() || cnt->IsEventHasNoLocationTextL())
 		            {
-		            aMenuPane->DeleteMenuItem( ECalenGetLocationAndSave );
+		            aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace );
 		            }
 		        if(!cnt->IsEventHasMapLocationL())
 			        {
@@ -384,6 +413,10 @@
 	            aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace );
 	            aMenuPane->DeleteMenuItem( ECalenShowLocation );	
 	            }
+			//as no toolbar in missedeventview no need to handle thees commands
+		  	aMenuPane->DeleteMenuItem( ECalenCmdPromptThenEdit );
+		  	aMenuPane->DeleteMenuItem( ECalenDeleteCurrentEntry ); 
+		  	aMenuPane->DeleteMenuItem( ECalenSend );
 		    break;
 		  	}
 		 default:
@@ -435,6 +468,10 @@
         {
         cba->SetCommandL( KSK2CBAPosition, R_CALEN_CLOSE_CBA_BUTTON );
         }
+    else
+        {
+        cba->SetCommandL( KSK2CBAPosition, R_CALEN_BACK_CBA_BUTTON);
+        }
     
     cba->DrawNow();
        
--- a/calendarui/views/src/calenmonthcontainer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calenmonthcontainer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -1051,6 +1051,7 @@
     TRACE_ENTRY_POINT;
 
     iChangeMonth = EFalse;
+    iChangeDay = EFalse;
     iDayFormat = KMonthCellFormat;
 
     iMonthDataArray = new(ELeave) CMonthDataArray(KCalenDaysInWeek * KNumberOfRows);
@@ -1624,7 +1625,8 @@
         		                                 TVwsViewId( KUidCalendar, KUidCalenMonthView ) );
             
             SetActiveDayL( newActiveDay );
-            iServices.IssueCommandL( ECalenWeekView );
+            //iServices.IssueCommandL( ECalenWeekView );
+            iServices.IssueCommandL( ECalenForwardsToWeekView );
             }
         }
 
@@ -1661,6 +1663,7 @@
         CCoeControl* control( NULL );
         if(aPointerEvent.iType == TPointerEvent::EButton1Down)
             {
+            this->GenerateTactileFeedback(); //Tactile feedback.
             control = iLayoutManager->ControlOrNull();
             if(control)
                 {
@@ -1673,6 +1676,10 @@
             }
         TInt pointerIndex(-1);
         TBool isItem (iGrid->View()->XYPosToItemIndex(aPointerEvent.iPosition, pointerIndex));
+        if( isItem )
+            {
+            pointerIndex = static_cast<CAknGridView*>(iGrid->View())->ActualDataIndex( pointerIndex );
+            }
         CAknGridM* gridModel = static_cast<CAknGridM*>(iGrid->Model());
 
         if(gridModel->NumberOfData() <= 0)
@@ -1705,7 +1712,7 @@
             TPointerEvent pointerEvent( aPointerEvent );
             pointerEvent.iModifiers =
                 ( aPointerEvent.iModifiers & ( ~EAllModifiers ) );
-            TInt index( iGrid->CurrentItemIndex() );
+            TInt index( iGrid->CurrentDataIndex() );
             TTime isValidDay;
             if( TPointerEvent::EButton1Up == aPointerEvent.iType )
                 {
@@ -1735,15 +1742,15 @@
                         iDate + TTimeIntervalDays( pointerIndex - index ) );
                 TDateTime newActiveDayTime = newActiveDay.DateTime();
                 
-                // set the context
-                TCalTime time;
-                time.SetTimeLocalL( newActiveDay );
-                iServices.Context().SetFocusDateL( time,
-                        TVwsViewId( KUidCalendar, KUidCalenMonthView ) );
                 TMonth activeMonth( iDate.DateTime().Month() );
                 TMonth newMonth( newActiveDay.DateTime().Month() );
                 if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
                     {
+                    // set the context
+                    TCalTime time;
+                    time.SetTimeLocalL( newActiveDay );
+                    iServices.Context().SetFocusDateL( time,
+                    TVwsViewId( KUidCalendar, KUidCalenMonthView ) );
                     iGrid->HandlePointerEventL( pointerEvent );
                     if (iPreview)
                         {
@@ -1757,6 +1764,7 @@
                             iChangeMonth = ETrue;   
                             iGrid->View()->SetDisableRedraw(ETrue);
                             iView->BeginRepopulationL();
+                            iDate = newActiveDay;
                             }
                         HandleDayChangeL( newActiveDay );
                         }
@@ -1764,19 +1772,22 @@
                 else if ( activeMonth == newMonth
                         && newActiveDay != iDate  && !iChangeMonth )
                     {
-                    iGrid->HandlePointerEventL( pointerEvent );
+                    iChangeDay = ETrue;
                     // use grid index to make sure that correct grid 
                     // element is focused when dragged
                     TInt gridIndex = GridIndex();
                     newActiveDay =
                         ( iFirstDayOfGrid + TTimeIntervalDays( gridIndex ) );
-                    HandleDayChangeL( newActiveDay );
-                    iChangeMonth = EFalse;
                     }
                 }
             else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
                 {
-                iGrid->HandlePointerEventL( pointerEvent );
+                if( !iChangeDay && !iChangeMonth )
+                    {
+                    iGrid->HandlePointerEventL( pointerEvent );
+                    }
+                    iChangeDay = EFalse;
+                    iChangeMonth = EFalse;
                 }
             }
         }
--- a/calendarui/views/src/calennativeview.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calennativeview.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -707,6 +707,7 @@
     notificationArray.Append(ECalenNotifyStopAlarm);
 	notificationArray.Append(ECalenNotifyDeleteFailed);
 	notificationArray.Append(ECalenNotifyEntryDeleted);
+	notificationArray.Append(ECalenNotifyResourceChanged);
 	
     iServices.RegisterForNotificationsL( this,notificationArray);
     
@@ -797,17 +798,7 @@
 	    DoDeactivate();	
 	    }
 
-    if (!iNaviContainer)
-        {
-        CEikStatusPane* sp = StatusPane();
-        iNaviContainer =
-            static_cast<CAknNavigationControlContainer*>(
-                        sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi)));
-        }
-
-    iNaviContainer->Pop();
-
-    if( AknLayoutUtils::PenEnabled() )
+     if( AknLayoutUtils::PenEnabled() )
         {
         MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
         if(toolbarImpl)
@@ -1174,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/calentodocontainer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calentodocontainer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -21,6 +21,8 @@
 #include <aknlists.h>
 #include <AknsUtils.h>
 #include <avkon.mbg>
+#include <aknbutton.h>
+#include <akntoolbar.h>
 #include <calalarm.h>
 #include <calentry.h>
 #include <calinstance.h>
@@ -149,11 +151,9 @@
                                              aViewIsDimmed);
     
     
+
     
-
-    TAknWindowComponentLayout tempLayout = 
-            AknLayoutScalable_Apps::list_cale_time_pane_g6( aItemIndex - static_cast<CCalenTodoListBox*>(iListBox)->TopItemIndex()) ;     
-    
+    TAknWindowComponentLayout tempLayout = AknLayoutScalable_Apps::list_cale_time_pane_g6(0);    
     TAknLayoutRect colourstrips;
     colourstrips.LayoutRect( actualItemRect, tempLayout.LayoutLine() );
       
@@ -278,7 +278,7 @@
     delete iController;
     delete iDesArray;
     delete iListBox;
-    delete iEmptyListText;
+    //delete iEmptyListText;
     
     iColorUidArray.Close();
     TRACE_EXIT_POINT;
@@ -385,15 +385,21 @@
     model->SetItemTextArray(iDesArray);
     model->SetOwnershipType(ELbmDoesNotOwnItemArray);
 
-    CAknIconArray* iconList = CreateIconsL( iIconIndices );
+    CAknIconArray* iconList = CreateIconsL( iIconIndices, KCalenTodoViewUidValue ); 
 
     // Transfer iconlist ownership to the listbox
     iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconList );
 
-    // Save empty text and set null for list box.
+    /*// Save empty text and set null for list box.
     // It is made not to display "No data".
     iEmptyListText = iListBox->View()->EmptyListText()->AllocL();
-    iListBox->View()->SetListEmptyTextL( KNullDesC );
+    //iListBox->View()->SetListEmptyTextL( KNullDesC );*/
+    
+    // Set text for empty listbox
+    HBufC* emptyText = StringLoader::LoadLC(R_CALEN_QTN_CALE_NO_EVENTS,
+                                            iEikonEnv);
+    iListBox->View()->SetListEmptyTextL( *emptyText ); //Whenever listbox is empty, it will set with this empty text.
+    CleanupStack::PopAndDestroy(emptyText);
 
     TRACE_EXIT_POINT;
     }
@@ -476,11 +482,13 @@
     TRACE_ENTRY_POINT;
 
     TInt focusIx = KErrNotFound;
-
+    TInt topIx = KErrNotFound;
+    
+    topIx = iListBox->TopItemIndex();
     // If top item is specified, set it
-    if ( iFirstEntryOnScreenIndex != KErrNotFound )
+    if ( topIx != KErrNotFound )
         {
-        iListBox->SetTopItemIndex( iFirstEntryOnScreenIndex );
+        iListBox->SetTopItemIndex( topIx );
         }
 
     if ( iHighlightedRowNumber != KErrNotFound )
@@ -591,7 +599,7 @@
     CleanupStack::PopAndDestroy( listDes );
     CleanupStack::PopAndDestroy( &calendarInfoList ); 
     iListBox->HandleItemAdditionL();
-    iListBox->View()->SetListEmptyTextL( *iEmptyListText );
+    //iListBox->View()->SetListEmptyTextL( *iEmptyListText );
 
     TRACE_EXIT_POINT;
     }
@@ -892,7 +900,10 @@
     if ( aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch )
         {
         SizeChanged();
+        CAknIconArray* iconList = CreateIconsL( iIconIndices, KCalenTodoViewUidValue ); 
 
+            // Transfer iconlist ownership to the listbox
+            iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconList );
         // refresh
         TRAPD(error,iView->BeginRepopulationL());
 	    if(error!=KErrNone)
@@ -944,6 +955,29 @@
     // set marked todo items info
     static_cast<CCalenTodoView*>( iView )->SetMarkedToDoItems(newArray);
     
+    MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
+    if( MarkedCount() )
+        {
+        if(toolbarImpl) 
+          {
+            CAknToolbar& toolbar = toolbarImpl->Toolbar();
+
+            // dim clear and clear all toolbar buttons
+            toolbar.SetItemDimmed(ECalenNewMeeting,ETrue,ETrue);
+          }
+
+        }
+    else
+        {
+        if(toolbarImpl) 
+             {
+               CAknToolbar& toolbar = toolbarImpl->Toolbar();
+
+               // dim clear and clear all toolbar buttons
+               toolbar.SetItemDimmed(ECalenNewMeeting,EFalse,ETrue);
+             }
+        }
+    
     CleanupStack::Pop( newArray );
 
     TRACE_EXIT_POINT;
@@ -982,6 +1016,29 @@
         // when all the todo items are unmarked,clear all marked todo items info from View
         static_cast<CCalenTodoView*>( iView )->ClearMarkedToDoItems();
         }
+    
+    MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
+    if( MarkedCount() )
+           {
+           if(toolbarImpl) 
+             {
+               CAknToolbar& toolbar = toolbarImpl->Toolbar();
+
+               // dim clear and clear all toolbar buttons
+               toolbar.SetItemDimmed(ECalenNewMeeting,ETrue,ETrue);
+             }
+
+           }
+       else
+           {
+           if(toolbarImpl) 
+                {
+                  CAknToolbar& toolbar = toolbarImpl->Toolbar();
+
+                  // dim clear and clear all toolbar buttons
+                  toolbar.SetItemDimmed(ECalenNewMeeting,EFalse,ETrue);
+                }
+           }
 
     TRACE_EXIT_POINT;
     }
@@ -1137,7 +1194,12 @@
         {
         TInt pointerIndex(-1);
         TBool isItem (iListBox->View()->XYPosToItemIndex(aPointerEvent.iPosition, pointerIndex));
-
+        
+        if(aPointerEvent.iType == TPointerEvent::EButton1Down)
+		{
+                this->GenerateTactileFeedback(); //Tactile feedback.
+		}	
+        
         if(isItem == EFalse && IsEmptyView())
             {
             iListBox->HandlePointerEventL(aPointerEvent);
--- a/calendarui/views/src/calentodoview.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calentodoview.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -424,6 +424,11 @@
             iServices.IssueCommandL( aCommand );
             }
             break;
+        case ECalenShowCalendars:            
+			SaveCurrentItemIndexL();
+            Container()->MarkAllL( EFalse ); 
+			CCalenNativeView::HandleCommandL( aCommand );
+			break;
         default:
             SaveCurrentItemIndexL();
             CCalenNativeView::HandleCommandL( aCommand );
@@ -681,7 +686,7 @@
             // setup edit/mark menu
             case R_CALENDAR_DONE_UNDONE:
                 {
-                if( Container()->MarkedCount() == 1)
+                if( Container()->MarkedCount() )
                     {
                     TBool crossout( EFalse );
                     crossout = CheckMarkedItemCompletedL();
@@ -928,6 +933,7 @@
             
             if(colIdArray.Count() > 0)
                 {
+                colIdArray.Close();
                 if( !iServices.InstanceViewL(colIdArray) )
                     {
                     TRACE_EXIT_POINT;
@@ -941,6 +947,7 @@
                 }
             else
                 {
+                colIdArray.Close();
                 if( !iServices.InstanceViewL() )
                     {
                     TRACE_EXIT_POINT;
@@ -952,7 +959,6 @@
                     return CCalenView::EKeepGoing;
                     }
                 }
-            colIdArray.Reset();
             }
             // else fall through...
         case ERequestedInstanceView:
--- a/calendarui/views/src/calenweekcontainer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calenweekcontainer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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
@@ -909,6 +904,8 @@
     iListBox->View()->SetDisableRedraw(EFalse);
     DrawDeferred();
 
+//Changing RSK to back / exit
+    WeekView().UpdateCbaL();
     TRACE_EXIT_POINT;
     }
 
@@ -2067,32 +2064,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();
         }
@@ -2193,6 +2190,7 @@
             {
             case TPointerEvent::EButton1Down:
                 {
+                this->GenerateTactileFeedback(); //Tactile feedback.
                 if(isItem)
                     {
                     oldRow = iListBox->View()->CurrentItemIndex();
@@ -2226,26 +2224,21 @@
                 // for themable support - clear Pressed Down State when dragging
                 oldRow = iListBox->View()->CurrentItemIndex();
                 oldColumn = iColumn;
-                iListBox->HandlePointerEventL(aPointerEvent);
-                newRow = iListBox->View()->CurrentItemIndex();
-                newColumn = iColumn;
+                newColumn = iListBox->PointerEventColumn(aPointerEvent.iPosition);
+                newRow = pointerIndex;
                 if (newRow != oldRow || newColumn != oldColumn)
                     {
-                    CalcDayFromColumn();
-                    SetActiveContextFromHighlightL();
-                    if (newColumn != oldColumn)
-                        {
-                        WeekView().SetStatusPaneFromActiveContextL();
-                        }                    
+                    iHourChange = ETrue;
                     }
                 break;
                 }
             case TPointerEvent::EButton1Up:
                 if(isItem &&
-                   iView->MenuBar()->IsDisplayed() == EFalse)
+                   iView->MenuBar()->IsDisplayed() == EFalse && !iHourChange)
                     {
                     iServices.IssueCommandL( ECalenForwardsToDayView );
                     }
+                iHourChange = EFalse;
                 break;
             default:
                 break;
--- a/calendarui/views/src/calenweekview.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calenweekview.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -44,6 +44,9 @@
 #include "calendar.hrh"
 
 
+// Button position of the MSK CBA button
+const TInt KSK2CBAPosition = 2;
+
 //  LOCAL CONSTANTS AND MACROS
 #define iWeekContainer static_cast<CCalenWeekContainer*>( iContainer )
 
@@ -163,12 +166,20 @@
 // (other items were commented in a header).
 // ----------------------------------------------------------------------------
 //
-void CCalenWeekView::DoActivateImplL( const TVwsViewId& /*aPrevViewId*/,
-                                      TUid /*aCustomMessageId*/,
+void CCalenWeekView::DoActivateImplL( const TVwsViewId& aPrevViewId,
+                                      TUid aCustomMessageId,
                                       const TDesC8& /*aCustomMessage*/ )
     {
     TRACE_ENTRY_POINT;
-
+    if( aPrevViewId.iAppUid == KUidCalendar )    // switch from internal view
+            {
+            iShowBackButtonOnCba =
+                ( aCustomMessageId == KUidCalenShowBackCba ? ETrue : EFalse );
+            }
+        else
+            {
+            iShowBackButtonOnCba = EFalse;
+            }
     iWeekContainer->SetCursorToActiveDayL();
     //SetStatusPaneFromActiveContextL();
     
@@ -367,7 +378,14 @@
             iServices.IssueCommandL( aCommand );
             }
             break;
-
+        case EAknSoftkeyBack:
+            {
+            
+            SetCbaL( R_CALEN_MONTH_AND_WEEK_VIEW_CBA );
+            
+            iServices.IssueNotificationL(ECalenNotifyWeekViewClosed);
+            }
+            break;
         default:
             CCalenNativeView::HandleCommandL( aCommand );
             break;
@@ -375,6 +393,29 @@
 
     TRACE_EXIT_POINT;
     }
+// ---------------------------------------------------------
+// CCalenWeekView::UpdateCbaL
+// Set context menubar and also CBA button back / exit.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCalenWeekView::UpdateCbaL()
+    {
+    TRACE_ENTRY_POINT;
+
+    if( iShowBackButtonOnCba )
+        {
+        CEikButtonGroupContainer*  cba = Cba();
+        cba->SetCommandL( KSK2CBAPosition, R_CALEN_BACK_CBA_BUTTON);
+        cba->DrawNow();
+        }
+    else
+        {
+        SetCbaL(R_CALEN_MONTH_AND_WEEK_VIEW_CBA);
+        }
+ 
+    TRACE_EXIT_POINT;
+    }
 
 // ----------------------------------------------------------------------------
 // CCalenWeekView::Id
--- a/clock2/clockengines/clockserver/server/src/clockserverimpl.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockengines/clockserver/server/src/clockserverimpl.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -506,6 +506,13 @@
 		    }
 		}
 	
+	// Initialise the attributes to null.
+	TTime invalidTime( 0 );
+	iTimeAttributes->iDstOffset = TTimeIntervalMinutes( 0 );
+	iTimeAttributes->iTimeZoneOffset =  TTimeIntervalMinutes( 0 );
+	iTimeAttributes->iUtcDateTime = invalidTime.DateTime();
+		
+	
 	// Get all the information related to the plugin.
 	// The UTC time.
 	TRAP_IGNORE( aPluginImpl.GetTimeInformationL( EUTCTime, iTimeAttributes ) );	
@@ -697,9 +704,47 @@
 		// Lets see if we can narrow down to a single timezone with the MCC recieved.
 		RArray< CTzId > tzIdArray;
 		
-		// Try and fetch the timezone ID using the MCC recieved.
-		TRAP_IGNORE( iTzResolver->TzIdFromMccL( iMcc, tzIdArray, KInvalidTimeZoneId ) );
-		
+		// This parte of code introduced due to error ID EASH-82DPPC(3G Tests for NITZ and GPRS Interaction)
+		// Fix is bascially to narrowing down to single timezone id if NITZ packet is received prior to MCC.
+		// In first IF state we are trying to narrowdown to single timezone ID, if not possible try to use MCC to get timezone
+		// In second IF , we are using MCC to narrow down to single timezone ID directly as dont have NITZ info.
+		if( iTimeAttributes )
+		{
+			TTime invalidTime(0);
+			if( iTimeAttributes->iDstOffset != TTimeIntervalMinutes( 0 ) &&
+			iTimeAttributes->iTimeZoneOffset != TTimeIntervalMinutes( 0 ) &&
+			iTimeAttributes->iUtcDateTime.Year() != invalidTime.DateTime().Year() )
+			{
+				// Try to resolve the timezone id with the data that we have recieved.
+				TInt timezoneId;
+				TRAP_IGNORE( TInt errorVal = iTzResolver->GetTimeZoneL( *iTimeAttributes, iMcc, timezoneId ) );
+				
+				__PRINT("TIMEZONE ID %d", timezoneId );
+
+				// Append the timezone id to array.
+
+				CTzId* matchingDSTZoneId = CTzId::NewL( timezoneId );
+				CleanupStack::PushL( matchingDSTZoneId );
+
+				tzIdArray.AppendL( *matchingDSTZoneId );
+
+				CleanupStack::PopAndDestroy( matchingDSTZoneId );
+
+				matchingDSTZoneId = NULL;
+			}
+			else
+			{
+				__PRINTS("NOT ABLE TO NARROW DOWN TO TIMEZONE ID WITH RECEIVED NITZ HENCE TRY WITH MCC");
+				// Not able to narrow down to single timezone id with received NITZ packet hence try with MCC.
+				TRAP_IGNORE( iTzResolver->TzIdFromMccL( iMcc, tzIdArray, KInvalidTimeZoneId ) );	
+			}
+		}
+		else
+		{
+			__PRINTS("NO NITZ INFO HENCE TRY WITH MCC");
+			// No NITZ info hecne try with MCC to get the time zone Id.
+			TRAP_IGNORE( iTzResolver->TzIdFromMccL( iMcc, tzIdArray, KInvalidTimeZoneId ) );
+		}
 		// Code to check if its the first boot.
 		// Get the first boot status from cenrep. If it is the first boot, clockserver will not update the time.
 		TBool staleBoot( EFalse );
@@ -755,6 +800,20 @@
 				}
 			CleanupStack::PopAndDestroy( currentCTzId );
 			CleanupStack::PopAndDestroy( &tz );
+			
+			// Setting the attributes to null again as we dont trust on
+			// previous NITZ data recevied by device.If device receive
+			// NITZ data again attributes would get filled with actual value.
+			// Has been kept outside because this statement is valid for
+			// first boot also.
+			if( iTimeAttributes && staleBoot )
+			{
+				iTimeAttributes->iDstOffset = TTimeIntervalMinutes( 0 );
+				iTimeAttributes->iTimeZoneOffset =  TTimeIntervalMinutes( 0 );
+				TTime invalidTime( 0 );
+				iTimeAttributes->iUtcDateTime = invalidTime.DateTime();	
+			}
+			
 			}
 		}
 	
--- a/clock2/clockengines/clocktimezoneresolver/src/clockmcctzmapper.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockengines/clocktimezoneresolver/src/clockmcctzmapper.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -143,8 +143,6 @@
 //
 TInt CClockMCCTzIdMapper::UTCOffSetWithoutDSTChangesL( RTz& aTz, const CTzId& aTzId ) const
 	{
-	__PRINTS( "CClockMCCTzIdMapper::UTCOffSetWithoutDSTChangesL - Entry" );
-	
 	TInt timeOffset( KErrNotFound );
 
 	TTime universalTime;
@@ -158,8 +156,6 @@
 	    delete currentRules;
 	    }
 	
-	__PRINTS( "CClockMCCTzIdMapper::UTCOffSetWithoutDSTChangesL - Exit" );
-
 	return timeOffset;
 	}
 
--- a/clock2/clockengines/utilities/clockecomlistener/src/clockecomlistener.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockengines/utilities/clockecomlistener/src/clockecomlistener.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -179,12 +179,16 @@
     {
     __PRINTS( "CClockEComListener::Start - Entry" );
     
-    // Start the active object and listen for changes in the ECOM registry.
-    if( iEComSession )
+    if (!IsActive())
         {
-        iEComSession->NotifyOnChange( iStatus );
+       // Start the active object and listen for changes in the ECOM registry.
+        if( iEComSession )
+            {
+            iEComSession->NotifyOnChange( iStatus );
+            SetActive();
+            }
         }
-    SetActive();
+ 
     
     __PRINTS( "CClockEComListener::Start - Exit" );
     }
--- a/clock2/clockui/adtupdater/inc/adtupdatercontainer.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/adtupdater/inc/adtupdatercontainer.h	Sun Jun 20 22:55:39 2010 +0200
@@ -287,7 +287,13 @@
          * @param  aTimeZoneId Carry the timezoneid of which DST status is required
          * @return TBool
          */
-         TBool IsDstOnL( TInt aTimeZoneId );         
+         TBool IsDstOnL( TInt aTimeZoneId );
+         
+         /**
+          * @brief  Checks whether predictiveapplcation enable key is on/off.
+          * @return TBool
+          */
+         TBool PredictiveTimeEnabled();
   
 	private:       //Data members
 		
--- a/clock2/clockui/adtupdater/src/adtupdatercontainer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/adtupdater/src/adtupdatercontainer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -294,7 +294,7 @@
 	{
 	__PRINTS( "CAdtUpdaterContainer::InformAboutNwUpdate - Entry" );
 
-	if( IsFirstBoot() &&  IsSimPresent() && IsNitzPluginActive() )
+	if( IsFirstBoot() &&  IsSimPresent() && IsNitzPluginActive() && PredictiveTimeEnabled())
 		{
 		__PRINTS( "First boot, sim is present and auto time update is ON" );
 		
@@ -315,7 +315,7 @@
 		// Start the timer	
 		iPeriodic->Start( KTimeout, KInterval, timerCallBack );
 		}
-	else if( IsFirstBoot() )
+	else if( IsFirstBoot()&& PredictiveTimeEnabled() )
 		{	
 		__PRINTS( "First boot, normal boot sequence" );
 		
@@ -327,7 +327,7 @@
 		// Exit the application.
 		iAdtUpdaterAppUi->Exit();
 		}
-	else if( !RTCStatus() && !HiddenReset() )
+	else if( !RTCStatus() && !HiddenReset() && PredictiveTimeEnabled())
 		{
 		__PRINTS( "RTC invalid or Hidden Reset" );
 		
@@ -648,8 +648,11 @@
 	if( currentMcc )
 	    {	
 		CTzLocalizedCity* localizedCity( GetLocalizedCityL( currentMcc ) );
+        if( localizedCity ) // added
+            {
 		TInt cityGroupId = localizedCity->GroupId();
 		citySelected = ShowCityListL( cityGroupId );
+		    }
 		delete localizedCity;			
 		}
 		
@@ -1535,4 +1538,25 @@
     
     return TBool( showQueries ); 
     }
+
+// ---------------------------------------------------------------------------
+// CAdtUpdaterContainer::PredictiveTimeEnabled()
+// Rest of the details are commented in headers.
+// ---------------------------------------------------------------------------
+TBool CAdtUpdaterContainer::PredictiveTimeEnabled()
+     {
+     TInt value( EPredictiveTimeEnabled );
+     CRepository* repository(NULL);
+     
+     TRAPD( err, repository = CRepository::NewL( KCRUidStartupConf ) );
+
+     if ( err == KErrNone )
+         {
+         err = repository->Get( KPredictiveTimeAndCountrySelection, value );
+         }
+     delete repository;
+ 
+     return value;
+     } 
+
 // End of file
--- a/clock2/clockui/plugins/clockindicatorpaneplugin/data/clockindicatorpaneplugin.rss	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/plugins/clockindicatorpaneplugin/data/clockindicatorpaneplugin.rss	Sun Jun 20 22:55:39 2010 +0200
@@ -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/plugins/clockindicatorpaneplugin/src/clockindicatorpluginlistener.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/plugins/clockindicatorpaneplugin/src/clockindicatorpluginlistener.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -67,10 +67,7 @@
 //
 CClockIndicatorPluginListener::~CClockIndicatorPluginListener()
 	{
-	if( IsActive() )
-		{
-		Cancel();
-		}
+	Cancel();
 	}
 
 // ---------------------------------------------------------
@@ -97,7 +94,7 @@
 //
 void CClockIndicatorPluginListener::DoCancel()
 	{
-	// No implementation yet.
+    iPanePlugin->NotifyChangeCancel();
 	}
 
 // ---------------------------------------------------------
@@ -133,7 +130,7 @@
 	// First cancel all requests
 	Cancel();
 	
-	iPanePlugin->NotifyChangeCancel();
+	//iPanePlugin->NotifyChangeCancel();
 	}
 	
 // End of file
--- a/clock2/clockui/uilayer/clkdatetimeview/group/clkdatetimeview.mmp	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/clkdatetimeview/group/clkdatetimeview.mmp	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/clkdatetimeview/src/clkdatetimeview.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -56,6 +56,7 @@
 #include <AknGlobalNote.h>
 #include <featdiscovery.h>
 #include <ProfileEngineDomainCRKeys.h>
+#include <mediafilelist.h>
 
 // User Includes
 #include "clkuiclksrvmodel.h"
@@ -1758,16 +1759,7 @@
 //
 void CClkDateTimeView::HandleTimeCmdL()
     {
-    if( iExtension->GetActiveProtocol() )
-		{
-   
-		// User pressed Yes. We disable Automatic time update here.
-		iDateTimeInfo.iNITZ = EFalse;
-		iSrvModel->DeActivateAllProtocols();
-		iExtension->SetActiveProtocol( EFalse );
-       	ShowAutomaticTimeUpdateOffNoteL();
-		}
-
+    
     // User to be notified whether DST rollover happens in a day or has happen within a day if he tries to change the time.
 	TBool dstStatus = CheckForDSTChangesL();
 	
@@ -1778,6 +1770,15 @@
 	    CAknTimeSettingPage* dlg = new ( ELeave ) CAknTimeSettingPage( R_DATE_TIME_TIME_PAGE, newTime );
 	    if( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
 	        {
+	    
+            if( iExtension->GetActiveProtocol() )
+                {
+                // User pressed Yes. We disable Automatic time update here.
+                iDateTimeInfo.iNITZ = EFalse;
+                iSrvModel->DeActivateAllProtocols();
+                iExtension->SetActiveProtocol( EFalse );
+                ShowAutomaticTimeUpdateOffNoteL();
+                }
 	        TTime current;
 	        current.HomeTime();
 	        TDateTime cTime( current.DateTime() );
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/clockalarmeditor/data/clockalarmeditor.ra	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/clockalarmeditor/src/clockalarmeditorimpl.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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.
@@ -299,19 +285,6 @@
     
     // Set the alarm, here we connect to the alarm server and set the alarm.
     SetAlarmL();
-
-    // Check if DST rule gets applied in 24hrs. If so we don't display the remaining time.
-    TBool displayRemainingTime( ETrue );
-    if( !iAlarmForEditing )
-        {
-        displayRemainingTime = CheckForDstChangesL();
-        }
-    
-    // Don't display the remaining time if dst changes are applicable.
-    if( displayRemainingTime )
-        {
-        DisplayRemainingTimeL();
-        }
     
     // Save the previous alarm time value.
     SetPreviousAlarmTimeL( iAlarmInfo.iAlarmTime );
@@ -437,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();
@@ -556,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 );
         }
@@ -668,12 +636,6 @@
             }
             break;
         
-        case KWithIn24HoursIndex:
-            {
-            iAlarmInfo.iRepeat = EAlarmRepeatDefintionRepeatNext24Hours;
-            }
-            break;
-        
         case KDailyIndex:
             {
             iAlarmInfo.iRepeat = EAlarmRepeatDefintionRepeatDaily;
@@ -704,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();
@@ -755,13 +716,6 @@
             iOccuranceIndex = KRepeatOnceIndex;
             }
             break;
-            
-        case EAlarmRepeatDefintionRepeatNext24Hours:
-            {
-            iOccuranceIndex = KWithIn24HoursIndex;
-            }
-            break;
-
         case EAlarmRepeatDefintionRepeatDaily:
             {
             iOccuranceIndex = KDailyIndex;
@@ -955,10 +909,8 @@
 	
     // Here we connect to the alarm server to set the alarm. We don't need to use the alarm model
     // as the alarm editor doesn't need any notification from the alarm server about changes.
-    RASCliSession alarmSrvSes;
     TASShdAlarm newAlarm;
     // Connect to the alarm server.
-    User::LeaveIfError( alarmSrvSes.Connect() );
         
     // Build the alarm properties from the info provided.
     newAlarm.Category()           = KAlarmClockOne;
@@ -976,13 +928,12 @@
 #endif
     
     // This will add the alarm with the alarm server.
-    alarmSrvSes.AlarmAdd( newAlarm );
+	iAlarmSrvSes.AlarmAdd( newAlarm );
     
 	// Save the new alarm id.
     iAlarmId = newAlarm.Id();
     
     // Close the session with alarmserver.
-    alarmSrvSes.Close();
     
     // Update the alarm info.
     GetAlarmInformationL( iAlarmId, iAlarmInfo );
@@ -1001,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 );
 
@@ -1029,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" );
     }
 
@@ -1357,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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/clockmainview/inc/clockalarmarray.h	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/clockmainview/inc/clockmaincontainer.h	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/clockmainview/inc/clockmainview.h	Sun Jun 20 22:55:39 2010 +0200
@@ -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,23 @@
 		*/
         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.
+         */
+        TBool CheckForDstChangesL();
+        
+        /**
+        * @brief Displays the remaining time for the alarm to expire.
+        */
+        void DisplayRemainingTimeL();
+
+        
 	private:		// Data
 	
 		/**
--- a/clock2/clockui/uilayer/clockmainview/src/clockalarmarray.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/clockmainview/src/clockalarmarray.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/clockmainview/src/clockmaincontainer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -38,6 +38,7 @@
 #include <tzlocalizer.h>
 #include <tzlocalizationdatatypes.h>
 #include <vtzrules.h>
+#include <aknbutton.h>
 
 // User includes
 #include "clockmaincontainer.h"
@@ -68,12 +69,15 @@
     R_QTN_WEEK_LONG_SUNDAY
     };
 
+TInt const KSwitchDelay = 200*1000;
+
 // Literals
 _LIT( KIconFileName, "\\resource\\apps\\clockapp.mif" );
 _LIT( KPlusGMT, " \x202A+" );
 _LIT( KMinusGMT, " \x202A" );
 _LIT( KPDF, " \x202C" );
 _LIT( KZero, "0" );
+_LIT( KSpace, " " );
 
 // ---------------------------------------------------------
 // CClockMainContainer::NewL
@@ -155,7 +159,9 @@
 	    delete iTimeZoneString;
 	    iTimeZoneString = NULL;
 	    }
-		
+
+	delete iNewAlarmButton;
+	iNewAlarmButton = NULL;
 	__PRINTS( "CClockMainContainer::~CClockMainContainer - Exit" );
     }
 
@@ -189,12 +195,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 +275,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 +287,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 +371,6 @@
     {
 	__PRINTS( "CClockMainContainer::FocusChanged - Entry" );
 	
-    if( iListBox )
-        {
-        iListBox->SetFocus( IsFocused() );
-        }
-		
 	__PRINTS( "CClockMainContainer::FocusChanged - Exit" );
     }
 
@@ -304,10 +390,41 @@
 		
         return;
         }
-
-    // Let the listbox handle the event.
-    iListBox->HandlePointerEventL( aPointerEvent );
-		
+    
+    // to highlight the item in alarm list after long tapping
+    //( when new alarm button is focused)
+    if( iListBox && iListBox->Rect().Contains( aPointerEvent.iPosition ) &&
+            aPointerEvent.iType == TPointerEvent::EButton1Down &&
+            !iListBox->IsFocused() && iListBox->IsVisible() )
+        {
+        iListBox->View()->ItemDrawer()->ClearFlags( CListItemDrawer::EDisableHighlight );
+        }
+    
+    // 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 );
+            }
+        } 
+    else
+        {
+        CCoeControl::HandlePointerEventL( aPointerEvent );
+        }
 	__PRINTS( "CClockMainContainer::HandlePointerEventL - Exit" );
     }
 
@@ -319,42 +436,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 +468,8 @@
     // Update the listbox.
     iListBox->ScrollToMakeItemVisible( itemIndex );
     iListBox->SetCurrentItemIndexAndDraw( itemIndex );
-	
+    SetCorrectRectForNewAlarmButton();
+    iNewAlarmButton->DrawDeferred();
 	__PRINTS( "CClockMainContainer::UpdateAlarmListL - Exit" );
     }
 
@@ -393,27 +484,32 @@
 	
     // Reinitialize the alarm list.
     iAlarmArray->InitIdList();
+    TInt count = iListBox->Model()->ItemTextArray()->MdcaCount();
     
-    if( ( KZeroAlarms <= aIndex ) &&
-        ( aIndex == iListBox->Model()->ItemTextArray()->MdcaCount() ) )
+    // 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 +864,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 +887,7 @@
 	
 	__PRINTS( "CClockMainContainer::CountComponentControls - Exit" );
 	
-    return 2;
+    return 3;
     }
 
 // ---------------------------------------------------------
@@ -813,6 +911,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 +969,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 +1315,15 @@
 	
     // Cleanup.
 	CleanupStack::Pop( iconArray );
-	
+
+    // construct the "New Alarm" button
+    iNewAlarmButton = CAknButton::NewL( NULL, NULL, NULL, NULL,
+            iAlarmArray->NewAlarmText()->Des(), KNullDesC, 0, 0 );
+    iNewAlarmButton->SetParent( this );
+    iNewAlarmButton->SetContainerWindowL( *this );
+    SetCorrectRectForNewAlarmButton();
+    iNewAlarmButton->SetObserver( this );
+    iNewAlarmButton->ActivateL();
     // Add the icon for DST indicator.
     AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(),
                                  KAknsIIDQgnIndiDstAdd,
@@ -1280,55 +1401,87 @@
         
     TRect mainClockPane( parentRect.Rect() );
    
-    // Get the layout for the day string.
-    layoutText.LayoutText( mainClockPane, AknLayoutScalable_Apps::main_clock2_pane_t1( displayOrientation ).LayoutLine() );
-
-    TPtr dayStringPtr = iDayNameString->Des();
-    // Day long format.
-    layoutText.DrawText( aWindowGc, *iDayNameString, ETrue, cachedColor );
-    
-    // Get the layout for the datestring.
-    layoutText.LayoutText( mainClockPane, AknLayoutScalable_Apps::main_clock2_pane_t2( displayOrientation ).LayoutLine() );
-
-    TPtr dateStringPtr = iDateString->Des();
-    // For mirrored languages.
-    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( dateStringPtr );
-    // Date long format
-    layoutText.DrawText( aWindowGc, *iDateString, ETrue, cachedColor );
-    
-    // Get the layout for the timezone string.
-    layoutText.LayoutText( mainClockPane, AknLayoutScalable_Apps::main_clock2_pane_t3( Layout_Meta_Data::IsLandscapeOrientation() ).LayoutLine() );
-
-    TPtr timeZonePtr = iTimeZoneString->Des();
-    // This is for mirrored languages.
-    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( timeZonePtr );
-    // The timezone string.
-    layoutText.DrawText( aWindowGc, *iTimeZoneString, ETrue, cachedColor );
+    if( Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        // main_clock2_pane_cp01_t1 Day + date
+       HBufC* dayAndDateString = HBufC::NewLC( iDayNameString->Length() + iDateString->Length() + 1 );
+       TPtr dayAndDateStringPtr = dayAndDateString->Des();
+       dayAndDateStringPtr.Append( *iDayNameString );
+       dayAndDateStringPtr.Append( KSpace );
+       TPtr dateStringPtr = iDateString->Des();
+       AknTextUtils::DisplayTextLanguageSpecificNumberConversion( dateStringPtr );
+       dayAndDateStringPtr.Append( *iDateString );
+       
+       layoutText.LayoutText( mainClockPane, AknLayoutScalable_Apps::main_clock2_pane_cp01_t1( displayOrientation ).LayoutLine() );
+       layoutText.DrawText( aWindowGc, *dayAndDateString , ETrue, cachedColor );
+       
+       CleanupStack::PopAndDestroy( dayAndDateString );
+       dayAndDateString = NULL;
+       
+       // main_clock2_pane_cp01_t3 zone + country
+       HBufC* timeZoneAndCountryString = HBufC::NewLC( iTimeZoneString->Length() + iLocationString->Length() + 1 );
+       TPtr timeZoneAndCountryStringPtr = timeZoneAndCountryString->Des();
+       TPtr timeZoneStringPtr = iTimeZoneString->Des();
+       AknTextUtils::DisplayTextLanguageSpecificNumberConversion( timeZoneStringPtr );
+       timeZoneAndCountryStringPtr.Append( *iTimeZoneString );
+       timeZoneAndCountryStringPtr.Append( KSpace );
+       timeZoneAndCountryStringPtr.Append( *iLocationString );
+       
+       layoutText.LayoutText( mainClockPane, AknLayoutScalable_Apps::main_clock2_pane_cp01_t3( displayOrientation ).LayoutLine() );
+       layoutText.DrawText( aWindowGc, *timeZoneAndCountryString, ETrue, cachedColor );
+       /*
+       TAknTextComponentLayout labelLayout;
+       labelLayout = AknLayoutScalable_Apps::main_clock2_pane_cp01_t3( Layout_Meta_Data::IsLandscapeOrientation() );
+       AknLayoutUtils::LayoutLabel( iLocationLabel, parentRect.Rect(), labelLayout.LayoutLine() );
+       
+       // Set the label for the text and start marqueeing.
+       iLocationLabel->SetLabelTextL( *timeZoneAndCountryString );
+       TGulAlignment alignment;
+       alignment.SetHAlignment( EHCenter );
+       iLocationLabel->SetAlignment( alignment );
+       iLocationLabel->StartMarquee();
+       iLocationLabel->RedrawRect( iLocationLabel->Rect() );
+       */
+       CleanupStack::PopAndDestroy( timeZoneAndCountryString );
+       timeZoneAndCountryString  = NULL;
+        }
+    else
+        {
+        // Get the layout for the day string.
+        layoutText.LayoutText( mainClockPane, AknLayoutScalable_Apps::main_clock2_pane_t1( displayOrientation ).LayoutLine() );
     
-    // Get the layout for the country string.
-    TAknTextComponentLayout labelLayout;
-    labelLayout = AknLayoutScalable_Apps::main_clock2_pane_t4( Layout_Meta_Data::IsLandscapeOrientation() );
-    AknLayoutUtils::LayoutLabel( iLocationLabel, parentRect.Rect(), labelLayout.LayoutLine() );
+        TPtr dayStringPtr = iDayNameString->Des();
+        // Day long format.
+        layoutText.DrawText( aWindowGc, *iDayNameString, ETrue, cachedColor );
+        
+        // Get the layout for the datestring.
+        layoutText.LayoutText( mainClockPane, AknLayoutScalable_Apps::main_clock2_pane_t2( displayOrientation ).LayoutLine() );
+    
+        TPtr dateStringPtr = iDateString->Des();
+        // For mirrored languages.
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( dateStringPtr );
+        // Date long format
+        layoutText.DrawText( aWindowGc, *iDateString, ETrue, cachedColor );
+        
+        // Get the layout for the timezone string.
+        layoutText.LayoutText( mainClockPane, AknLayoutScalable_Apps::main_clock2_pane_t3( Layout_Meta_Data::IsLandscapeOrientation() ).LayoutLine() );
     
-    // Set the label for the text and start marqueeing.
-    iLocationLabel->SetLabelTextL( *iLocationString );
-    iLocationLabel->StartMarquee();
-    iLocationLabel->RedrawRect( iLocationLabel->Rect() );
-
-	// We display empty text only if there are no alarms set.
-	// if( !iAlarmArray->MdcaCount() )
-		// {
-		// Set the listbox layout.
-		// TAknLayoutRect listRect;
-		// Get the main clock rect.
-		// listRect.LayoutRect( mainClockPane, AknLayoutScalable_Apps::listscroll_gen_pane_cp06( Layout_Meta_Data::IsLandscapeOrientation() ).LayoutLine() );
-		
-		// Get the rect for the empty text.
-		// layoutText.LayoutText( listRect.Rect(), AknLayoutScalable_Apps::listscroll_gen_pane_cp06_t1( Layout_Meta_Data::IsLandscapeOrientation() ).LayoutLine() );
-		// Draw the text.
-		// layoutText.DrawText( aWindowGc, *iNoAlarmsText, ETrue, cachedColor );
-		//}
-    
+        TPtr timeZonePtr = iTimeZoneString->Des();
+        // This is for mirrored languages.
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( timeZonePtr );
+        // The timezone string.
+        layoutText.DrawText( aWindowGc, *iTimeZoneString, ETrue, cachedColor );
+        
+        // Get the layout for the country string.
+        TAknTextComponentLayout labelLayout;
+        labelLayout = AknLayoutScalable_Apps::main_clock2_pane_t4( Layout_Meta_Data::IsLandscapeOrientation() );
+        AknLayoutUtils::LayoutLabel( iLocationLabel, parentRect.Rect(), labelLayout.LayoutLine() );
+        
+        // Set the label for the text and start marqueeing.
+        iLocationLabel->SetLabelTextL( *iLocationString );
+        iLocationLabel->StartMarquee();
+        iLocationLabel->RedrawRect( iLocationLabel->Rect() );
+        }
 	__PRINTS( "CClockMainContainer::DrawMainViewText - Exit" );
     }
 
@@ -1479,4 +1632,81 @@
         return timeUpdateOn;
 }
 
+void CClockMainContainer::HandleControlEventL( CCoeControl* aControl,
+            TCoeEvent aEventType )
+    {
+    if ( aControl == iNewAlarmButton && aEventType == MCoeControlObserver::EEventStateChanged 
+            && iView && !iView->IsAlarmEditorOpen() )
+        {
+        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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/clockmainview/src/clockmainview.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -26,6 +26,7 @@
 #include <vtzrules.h>
 #include <clockalarmeditor.h>
 #include <hlplch.h>
+#include <touchfeedback.h>
 
 // User includes
 #include "clockmainview.h"
@@ -41,6 +42,18 @@
 #include "clock_debug.h"
 
 // Constants
+const TInt KMaxCharsInNote( 32 );
+const TInt KZerothRule( 0 );
+const TInt KDaysInWeek( 7 );
+const TInt KOneMinuteInMicrosecond( 1000000 * 60 );
+const TInt KOneHourInMinute( 60 );
+const TInt KOneMinute( 1 );
+const TInt KOneHour( 1 );
+const TInt KNoDifference( 0 );
+
+_LIT( KDateTimeFormatter, "%-B%:0%J%:1%T%:3%+B" );  // For the date and time displayed in the rollover note.
+
+
 
 // Literals
 
@@ -183,6 +196,11 @@
         // Update the latest alarm details.
         iAlarmModel->ClockAlarmInfo( iAlarmId, iAlarmInfo );
         
+        if(CheckForDstChangesL())
+            {
+            DisplayRemainingTimeL();
+            }
+
         // First update the model with the latest alarm id.
         iAlarmModel->SaveLatestAlarmId( iAlarmId );
         
@@ -211,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
 // ---------------------------------------------------------
@@ -222,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" );
 		
@@ -237,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 );
         
@@ -348,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.
@@ -399,6 +493,11 @@
         // Update the latest alarm details.
         iAlarmModel->ClockAlarmInfo( iAlarmId, iAlarmInfo );
         
+		if(CheckForDstChangesL())
+            {
+            DisplayRemainingTimeL();
+            }
+
         // First update the model with the latest alarm id.
         iAlarmModel->SaveLatestAlarmId( iAlarmId );
         
@@ -533,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" );
     }
@@ -553,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.
@@ -578,14 +689,7 @@
 		//Single click integration
 	    case EClockSelect:
 		    {
-		    if ( iContainer->ListBox()->CurrentItemIndex() == 0 )
-		        {
-		        SetNewAlarmL(); 
-		        }
-		    else
-		        {
-		        ResetAlarmL(); 
-		        } 
+		    ResetAlarmL();
 		    }
 		    break; 
 
@@ -623,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.
@@ -683,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 );
+                }
         	
         	
             }    
@@ -719,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
         {
@@ -751,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" );
     }
@@ -879,4 +1012,357 @@
     return static_cast< CClockAppUi* > ( AppUi() );
     }
 
+// ---------------------------------------------------------
+// CClockAlarmEditorImpl::DisplayRemainingTimeL
+// rest of the details are commented in the header
+// ---------------------------------------------------------
+//
+void CClockMainView::DisplayRemainingTimeL()
+    {
+    __PRINTS( "CClockAlarmEditorImpl::DisplayRemainingTimeL - Entry" );
+    
+    HBufC* stringHolder( NULL );
+
+    TTime currentTime;
+    currentTime.HomeTime();     
+
+    TTime alarmTime = iAlarmInfo.iOrigExpiryTime;
+    TBool oneDayDifference( EFalse );    
+
+    // Check for the day of the alarm.
+    if( currentTime < alarmTime )
+        {
+        currentTime += TTimeIntervalDays( 1 );
+        // Check if the alarm is for the current day.
+        oneDayDifference = ( currentTime < alarmTime )? ETrue : EFalse;
+        }
+
+    TInt alarmDay( alarmTime.DayNoInWeek() );
+    const TInt KTimeStringLength( 10 );
+    TBuf< KTimeStringLength > timeString;
+
+    HBufC* timeFormat = StringLoader::LoadLC( R_QTN_TIME_USUAL_WITH_ZERO, iCoeEnv );
+    CleanupStack::Pop( timeFormat );
+
+    alarmTime.FormatL( timeString, *timeFormat );
+
+    CDesCArrayFlat* stringArray = new( ELeave ) CDesCArrayFlat( 2 );
+    CDesCArrayFlat* workDaysList = iCoeEnv->ReadDesCArrayResourceL( R_CLOCK_WEEK_DAYS_ARRAY );
+
+    // The day on which alarm is set.
+    stringArray->AppendL( ( *workDaysList )[ alarmDay ] );
+    // The time string.
+    stringArray->AppendL( timeString );
+
+    // Choose the appropriate Repeat type.
+    switch( iAlarmInfo.iRepeat )
+        {
+        case EAlarmRepeatDefintionRepeatNext24Hours:
+        case EAlarmRepeatDefintionRepeatOnce:
+            {
+            if( oneDayDifference )
+                {
+                stringHolder = StringLoader::LoadLC( R_QTN_CLOCK_ALARM_NOTE_ONCE_NEXT, *stringArray, iEikonEnv );
+                }
+            }
+            break;
+        
+        case EAlarmRepeatDefintionRepeatDaily:
+            {
+            stringHolder = StringLoader::LoadLC( R_QTN_CLOCK_ALARM_NOTE_DAY_CLK, timeString, iEikonEnv );
+            }
+            break;
+            
+        case EAlarmRepeatDefintionRepeatWeekly:
+            {
+            stringHolder = StringLoader::LoadLC( R_QTN_CLOCK_ALARM_NOTE_WEEK_CLK, *stringArray, iEikonEnv );
+            }
+            break;
+            
+        case EAlarmRepeatDefintionRepeatWorkday:
+            {
+            stringHolder = StringLoader::LoadLC( R_QTN_CLOCK_ALARM_NOTE_WDAY_CLK, timeString, iEikonEnv );
+            }
+            break;
+            
+        default:
+            {
+            // No implementation yet.
+            }
+            break;
+        }
+    
+    // Cleanup.
+    delete timeFormat;
+    delete stringArray;
+    delete workDaysList;        
+
+    // Need to show the confirmation note.
+    if( ( EAlarmStatusEnabled == iAlarmInfo.iStatus ) && stringHolder )
+        {
+        // TODO: to be verified todo this or not.
+        CAknConfirmationNote* confirmationNote = new( ELeave ) CAknConfirmationNote( ETrue );
+
+        TPtr stringHolderPtr = stringHolder->Des();
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( stringHolderPtr );    
+
+        confirmationNote->ExecuteLD( *stringHolder );
+
+        // Cleanup
+        CleanupStack::PopAndDestroy( stringHolder );
+        } 
+
+    // Dislpay the second note.
+    if( !oneDayDifference )
+        {
+        TTime homeTime;
+        homeTime.HomeTime();
+
+        TDateTime currentDate( homeTime.DateTime() );
+        TDateTime alarmDate( iAlarmInfo.iAlarmTime.DateTime() );
+
+        alarmDate.SetYear( currentDate.Year() );
+        alarmDate.SetMonth( currentDate.Month() );
+        alarmDate.SetDay( currentDate.Day() );
+
+        TTime newAlarmTime( alarmDate );
+
+        if( newAlarmTime < homeTime )
+            {
+            newAlarmTime += TTimeIntervalDays( 1 );
+            }
+
+        // Construct the remaining time.            
+        TTimeIntervalMicroSeconds remainingTime( newAlarmTime.MicroSecondsFrom( homeTime ) );
+        TInt64 tempInt = ( remainingTime.Int64() ) / KOneMinuteInMicrosecond;
+        TInt remainingMinutes = I64INT( tempInt );
+
+        CArrayFix< TInt >* timeArray = new( ELeave ) CArrayFixFlat< TInt >( 2 );
+        CleanupStack::PushL( timeArray );
+
+        TInt remainingHours( remainingMinutes / KOneHourInMinute );
+
+        remainingMinutes -= remainingHours * KOneHourInMinute;
+
+        timeArray->AppendL( remainingHours );
+        timeArray->AppendL( remainingMinutes );
+
+        // Alarm is with in 1 day. Choose the appropriate strings to be displayed.
+        switch( remainingHours )
+            {
+            case KOneMinute:
+                {
+                if( KOneMinute == remainingMinutes )
+                    {
+                    stringHolder = StringLoader::LoadLC( R_CLOCK_ALARM_CONF_SINGULAR, *timeArray, iEikonEnv );
+                    }
+                else
+                    {
+                    stringHolder = StringLoader::LoadLC( R_CLOCK_ALARM_CONF_HOUR_SEV_MIN, *timeArray, iEikonEnv );
+                    }
+                }
+                break;
+                
+            default:
+                {
+                if( KOneMinute == remainingMinutes )
+                    {
+                    stringHolder = StringLoader::LoadLC( R_CLOCK_ALARM_CONF_SEV_HOURS_MIN, *timeArray, iEikonEnv );
+                    }
+                else
+                    {
+                    stringHolder = StringLoader::LoadLC( R_CLOCK_ALARM_CONF_PLURAL, *timeArray, iEikonEnv );
+                    }
+                }
+                break;
+            }
+        
+        // TODO: to be verified todo this or not.
+        if( ( EAlarmStatusEnabled == iAlarmInfo.iStatus )  && stringHolder )
+            {
+            CAknConfirmationNote* confirmationNote = new( ELeave ) CAknConfirmationNote( ETrue );
+
+            TPtr stringHolderPtr = stringHolder->Des();
+            AknTextUtils::DisplayTextLanguageSpecificNumberConversion( stringHolderPtr );    
+
+            confirmationNote->ExecuteLD( *stringHolder ); 
+            }
+
+        // Cleanup.        
+        CleanupStack::PopAndDestroy( stringHolder );
+        CleanupStack::PopAndDestroy( timeArray );
+        }
+    
+    __PRINTS( "CClockAlarmEditorImpl::DisplayRemainingTimeL - Exit" );
+    }
+
+// ---------------------------------------------------------
+// CClockAlarmEditorImpl::CheckForDstChangesL
+// rest of the details are commented in the header
+// ---------------------------------------------------------
+//
+TBool CClockMainView::CheckForDstChangesL()
+    {
+    __PRINTS( "CClockAlarmEditorImpl::CheckForDstChangesL - Entry" );
+    
+    // User to be notified whether DST rollover happens in a day or 
+    // has happen within a day if he tries to change the time.
+    TBool returnValue( ETrue );
+    
+    // Establish connection with RTz to get the timezone ID
+    RTz tzHandle;
+    User::LeaveIfError( tzHandle.Connect() );
+    CleanupClosePushL( tzHandle );
+
+    // The timezone ID (current)
+    CTzId* currentTZId = tzHandle.GetTimeZoneIdL();
+    CleanupStack::PushL( currentTZId );
+
+    // The current time in UTC
+    TTime currentTime;
+    currentTime.UniversalTime();
+
+    // hometime (local time)
+    TTime homeTime;
+    homeTime.HomeTime();
+
+    //(Year, Month, Day, Hour, Minute, Second, Micrsecond)
+    TDateTime dateTime( homeTime.DateTime().Year(), EJanuary, 1, FALSE, FALSE, FALSE, FALSE );
+
+    TTime tempTime( dateTime ); 
+
+    // Get the current rules for the timezone
+    CTzRules* currentRules = tzHandle.GetTimeZoneRulesL( *currentTZId, tempTime, currentTime, ETzUtcTimeReference );
+    CleanupStack::PushL( currentRules );
+
+    // CVTzActualisedRules encapsulates the rules for a specific year.
+    // Every year has a dummy rule and further DST rules if DST is applicable (if Ohlson provides them)
+    CVTzActualisedRules *vActualisedRules = CVTzActualisedRules::NewL(
+            homeTime.DateTime().Year(), 
+            homeTime.DateTime().Year());
+    CleanupStack::PushL( vActualisedRules );
+
+    // The dummy rule is always the begining of the year.
+    // For example there is only 1 rule for India/NewDelhi but USA/Atlanta has 3 rules.
+    currentRules->GetActualisedRulesL( *vActualisedRules );
+
+    const TInt ruleCount( vActualisedRules->Count() );
+    TInt ruleMatchIndex( KNoDifference );
+
+    TTimeIntervalSeconds secondsDifference;
+    TTime ruleMatchTime;
+
+    // Fetch lowest time offset for the year residing at aTime. 
+    // This is used to determine if DST is on.
+    for( TInt ruleIndex( FALSE ); ruleIndex < ruleCount; ++ruleIndex )
+        {
+        const TVTzActualisedRule& actualisedRule = ( *vActualisedRules )[ ruleIndex ];
+
+        // Only check for the same year as requested (aTime)
+        if( actualisedRule.iTimeOfChange.DateTime().Year() == homeTime.DateTime().Year() )
+            {               
+            iAlarmInfo.iAlarmTime.SecondsFrom( actualisedRule.iTimeOfChange, secondsDifference );
+            // Considering the time reference is important as America (North & South) uses
+            // the Wall time (local time) reference where as whole of Europe refers to time
+            // in terms of UTC time. Correspondingly, the choise of local time or utc time 
+            // has to be made.
+            TTime ruleTime;
+
+            if( ETzUtcTimeReference == actualisedRule.iTimeReference )
+                {
+                ruleTime = currentTime;
+                }
+            else if( ETzWallTimeReference == actualisedRule.iTimeReference )
+                {
+                ruleTime = homeTime;
+                }
+            else if( ETzStdTimeReference == actualisedRule.iTimeReference )
+                {
+                // TODO: Testing so far hasn't encountered a rule in this time reference. 
+                // If in case an error is found, corresponding code can be added here.
+                // No support from symbian for this.
+                }
+
+            TDateTime sevenDays( FALSE, EJanuary, KDaysInWeek, FALSE, FALSE, FALSE, FALSE );
+            TTime tempTime( sevenDays );
+            TTime newTime( ruleTime.Int64() + tempTime.Int64() );
+
+            TTimeIntervalDays temp;
+            temp = newTime.DaysFrom( ruleTime );
+
+            if( ( secondsDifference.Int() >= KNoDifference ) &&
+                ( newTime > iAlarmInfo.iAlarmTime ) && 
+                ( actualisedRule.iTimeOfChange < iAlarmInfo.iAlarmTime ) && 
+                ( ruleTime < actualisedRule.iTimeOfChange ) )
+                {
+                // If there is a match, save the index and break.
+                // We've got the rule and there's no need to continue with other rules.
+                ruleMatchIndex = ruleIndex;
+                ruleMatchTime = actualisedRule.iTimeOfChange;
+                break;
+                }
+            }
+        }
+
+    if( ruleMatchIndex > KZerothRule )
+        {
+        // There's a match, display the information note about DST change.
+        TTime displayTime;
+        TTimeIntervalHours oneHour( KOneHour );         
+
+        displayTime = iAlarmInfo.iAlarmTime;
+
+        TBuf< KMaxCharsInNote > dateTimeString;
+
+        // dateString will have "11:59 pm" - as above, but no seconds
+        displayTime.FormatL( dateTimeString, KDateTimeFormatter );
+
+        // If This note is displayed,
+        CAknInformationNote* informationNote = new( ELeave ) CAknInformationNote( ETrue );
+
+        HBufC* noteText = StringLoader::LoadLC(
+                R_QTN_CLOCK_NOTE_ALARM_DST_ROLLOVER, 
+                dateTimeString, 
+                iCoeEnv);               
+        TInt error = informationNote->ExecuteLD( noteText->Des() );
+
+        // Don't display the second note. Not necessary to show both notes.
+        returnValue = ETrue;
+        CleanupStack::PopAndDestroy( noteText );                                
+        } 
+
+    tzHandle.Close();
+    CleanupStack::PopAndDestroy( vActualisedRules);
+    CleanupStack::PopAndDestroy( currentRules );
+    CleanupStack::PopAndDestroy( currentTZId );
+    CleanupStack::PopAndDestroy( &tzHandle );
+    
+    __PRINTS( "CClockAlarmEditorImpl::CheckForDstChangesL - Exit" );
+
+    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/clockworldcontainer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/clockworldview/src/clockworldcontainer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -250,7 +250,7 @@
     {
     __PRINTS( "CClockWorldContainer::HandleListBoxEventL - Entry" );
 
-    if( aListBox == iListBox &&
+/*    if( aListBox == iListBox &&
 		//Single click integration
         aEventType == EEventItemSingleClicked )
 
@@ -266,7 +266,7 @@
             {
             iView->HandleCommandL( EClockWorldMyRegion ); 
             }
-        }
+        }*/
 
         
     __PRINTS( "CClockWorldContainer::HandleListBoxEventL - Entry" );
--- a/clock2/clockui/uilayer/clockworldview/src/clockworlditemprocessor.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/clockworldview/src/clockworlditemprocessor.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -177,17 +177,17 @@
     {
     __PRINTS( "CClockWorldItemProcessor::DoAsyncCallback - Entry" );
     
-    if( !IsActive() )
+    if( IsAdded() )
         {
-        if( IsAdded() )
+        if( !IsActive() )
             {
             // Make sure this is the last Active Object in the list
             Deque();
             CActiveScheduler::Add( this );
+            TRequestStatus* status = &iStatus;
+            User::RequestComplete( status, KErrNone );
+            SetActive();       
             }
-        TRequestStatus* status = &iStatus;
-        User::RequestComplete( status, KErrNone );
-        SetActive();       
         }
     
     __PRINTS( "CClockWorldItemProcessor::DoAsyncCallback - Exit" );
--- a/clock2/clockui/uilayer/clockworldview/src/clockworldview.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/clockworldview/src/clockworldview.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -150,11 +150,20 @@
 			//Single click integration
             // If current item is other than home location set it as new home
 		    // location
-		    if ( iContainer->ListBox()->CurrentItemIndex() > KZerothIndex )
+		    RClkSrvInterface clkSrvInterface;
+            User::LeaveIfError( clkSrvInterface.Connect() );
+
+            TBool timeUpdateOn( EFalse );
+          
+            // Get the state of the plugin.
+            clkSrvInterface.IsAutoTimeUpdateOn( timeUpdateOn );
+		    if ( iContainer->ListBox()->CurrentItemIndex() > KZerothIndex || timeUpdateOn)
                 {
                 SetHomeLocationL();
                 }
 
+		    // Cleanup.
+		    clkSrvInterface.Close();
 		    }
 		    break;
 		    
@@ -294,7 +303,7 @@
     __PRINTS( "CClockWorldView::DynInitMenuBarL - Entry" );
     
 	//single click integration
-    if( aMenuBar && ( IsSelectionListOpen() || IsGalleryOpen() ) )
+    if( aMenuBar && ( /*IsSelectionListOpen() || */IsGalleryOpen() ) )
         {
         // If the selection list open, we should not display the menupane.
         aMenuBar->StopDisplayingMenuBar();
@@ -583,7 +592,15 @@
         }
 
     // Activate the container.
-    iContainer->ActivateL();
+    if( ClockApplicationUi()->TransitionOngoing() )
+        {
+        //ClockApplicationUi()->DoAppearTransition( iContainer );
+        iContainer->ActivateL();
+        }
+    else
+        {
+        iContainer->ActivateL();
+        }
     iContainer->SetRect( ClientRect() );
     
     
@@ -624,7 +641,10 @@
     
     if( aForeground  && iContainer )
         {
-        RestartTimerL();
+        if( iTimer )
+            {
+            RestartTimerL();
+            }
 
         RClkSrvInterface clockServerClt;
         // Connect to clockserver
@@ -925,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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/data/clock.rss	Sun Jun 20 22:55:39 2010 +0200
@@ -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;
@@ -476,7 +482,8 @@
             { 
             command = EClockWorldMyRegion;
             txt = qtn_clk_opt_region_my_region; 
-            flags = EEikMenuItemAction; 
+//            flags = EEikMenuItemAction; 
+            flags = EEikMenuItemSpecific;
             },
         MENU_ITEM 
             { 
@@ -589,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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/group/clock.mmp	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/inc/clock.hrh	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/inc/clockappui.h	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/loc/clockapp.loc	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uilayer/src/clockappui.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -27,6 +27,10 @@
 #include <clockapp_tab.mbg>
 #include <AknsConstants.h>
 #include <featmgr.h>  
+#include <e32property.h>
+#include <startupdomainpskeys.h>
+#include <touchfeedback.h>
+#include <gfxtranseffect/gfxtranseffect.h> 
 
 // User includes
 #include "clock.h"
@@ -51,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" );
@@ -131,7 +142,9 @@
     CClkDateTimeView* dateTimeView = CClkDateTimeView::NewLC( KClockAppMainViewId, ETrue );
     AddViewL( dateTimeView );
     CleanupStack::Pop( dateTimeView );
-	
+
+    iTactileFeedbackSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback );
+    
 	// Start the model.
 	alarmModel->Start();
 	
@@ -223,14 +236,26 @@
     	case EClockAlarmExit:
     	case EAknSoftkeyExit:
     	    {
-    	    if( ExitHidesInBackground() )
+    	    TInt deviceState;
+    	    RProperty::Get( KPSUidStartup, KPSGlobalSystemState , deviceState );
+
+    	    if(  deviceState == ESwStateCharging || deviceState == ESwStateAlarm  ) 
     	        {
-    	        HandleCommandL( EAknCmdHideInBackground );
+
+                Exit();
+
     	        }
     	    else
-    	        {
-    	        Exit();
-    	        }
+                {
+                if( ExitHidesInBackground() )
+                    {
+                    HandleCommandL( EAknCmdHideInBackground );
+                    }
+                else
+                    {
+                    Exit();
+                    }
+                }
     	    }
     	    break;
     	    
@@ -282,6 +307,8 @@
         case EClockAppMainViewId:
             {
             // The main view.
+            iTransitionOngoing = ETrue;
+            iTransitionDirection = ETransitionLeft;
             ActivateLocalViewL( KClockAppMainViewId );
             }
             break;
@@ -289,6 +316,8 @@
         case EClockAppWorldViewId:
             {
             // The clockworld view.
+            iTransitionOngoing = ETrue;
+            iTransitionDirection = ETransitionRight;
             ActivateLocalViewL( KClockAppWorldViewId );
             }
             break;
@@ -336,7 +365,8 @@
     {
     __PRINTS( "CClockAppUi::HandleForegroundEventL - Entry" );
     
-    if( aForeground )
+    // commented as a part of the error ESLM-83LG82.
+    /*if( aForeground )
         {
         __PRINTS( "CClockAppUi::HandleForegroundEventL - aForeground ETrue" );
         
@@ -352,7 +382,7 @@
             iIADUpdateFlag = EFalse;
             __PRINTS( "CClockAppUi::HandleForegroundEventL - iIADUpdateFlag EFalse" );
             }
-        }
+        }*/
 
     // Inform the world clock view about the change
     CClockWorldView* clockWorldView = static_cast< CClockWorldView* > ( View( KClockAppWorldViewId ) );
@@ -489,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 )
         {
@@ -531,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 );
     }
@@ -682,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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uimodel/bwins/clkuimodelu.def	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uimodel/eabi/clkuimodelu.def	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uimodel/inc/clkuialarmmodel.h	Sun Jun 20 22:55:39 2010 +0200
@@ -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/inc/clkuiclksrvlistener.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uimodel/inc/clkuiclksrvlistener.h	Sun Jun 20 22:55:39 2010 +0200
@@ -47,6 +47,11 @@
         */
         CClkUiClkSrvListener( RClkSrvInterface& aClkSrvSes, CClkUiClkSrvModel& aClkSrvModel, TInt& aWhatChanged, TInt& aWhoChanged, TInt aListenerPriority );
         
+        /**
+         * Destructor
+         */
+        ~CClkUiClkSrvListener();
+        
     public:         // Functions from base classes.
         
         /**
--- a/clock2/clockui/uimodel/src/clkuialarmlistener.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uimodel/src/clkuialarmlistener.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -45,7 +45,7 @@
 //
 CClkUiMdlAlarmListener::~CClkUiMdlAlarmListener()
     {
-    // No implementation yet.
+    Cancel();
     }
 
 // ---------------------------------------------------------
--- a/clock2/clockui/uimodel/src/clkuialarmmodel.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uimodel/src/clkuialarmmodel.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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/clock2/clockui/uimodel/src/clkuiclksrvlistener.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/clock2/clockui/uimodel/src/clkuiclksrvlistener.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -43,6 +43,16 @@
     }
 
 // ---------------------------------------------------------
+// CClkUiClkSrvListener::~CClkUiClkSrvListener
+// rest of the details are commented in the header
+// ---------------------------------------------------------
+//
+CClkUiClkSrvListener::~CClkUiClkSrvListener()
+    {
+    Cancel();
+    }
+
+// ---------------------------------------------------------
 // CClkUiClkSrvListener::DoStart
 // rest of the details are commented in the header
 // ---------------------------------------------------------
Binary file clock2/clockui/utilities/data/tzdb.dbz has changed
--- a/notepad/notepad1/LibData/NpdLib.rss	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/LibData/NpdLib.rss	Sun Jun 20 22:55:39 2010 +0200
@@ -35,6 +35,7 @@
 #include <data_caging_paths_strings.hrh>
 #include <AiwCommon.rh>
 #include <AknFep.rsg>
+#include <avkon.hrh>
 
 //  CONSTANTS  
 #define NOTEPAD_DATABASE "c:Notepad.dat"
@@ -84,6 +85,18 @@
     }
 
 // -----------------------------------------------------------------------------
+//
+// r_notepad_the_first_listbox_item
+// the first notepad item, New note.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_notepad_the_first_listbox_item
+	{
+	buf = qtn_nmake_om_add_new;
+	}
+	
+// -----------------------------------------------------------------------------
 //   
 // r_notepad_model
 // Model of Notepad application.
@@ -96,6 +109,7 @@
     listing_style = ENotepadListingStyleNP;
     date_format = R_QTN_DATE_SHORT_WITH_ZERO;
     time_format = R_QTN_TIME_USUAL_WITH_ZERO;
+    first_note = r_notepad_the_first_listbox_item;
     }
 
 // -----------------------------------------------------------------------------
@@ -347,6 +361,40 @@
 
 // -----------------------------------------------------------------------------
 //
+// r_menupane_markable_list_edit_list_implementation
+// mark parent menu
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_menupane_markable_list_edit_list_implementation
+    {
+    items =
+        {
+        MENU_ITEM { cascade=r_menupane_markable_list_implementation; command=EAknCmdEditListMenu; txt=qtn_options_list; }
+        };
+
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_menupane_markable_list_implementation
+// mark child menu
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_menupane_markable_list_implementation
+    {
+    items =
+        {
+        MENU_ITEM{ command=EAknCmdMark; txt=qtn_options_list_mark_one; flags=EEikMenuItemSpecific; },
+        MENU_ITEM{ command=EAknCmdUnmark; txt=qtn_options_list_unmark_one; flags=EEikMenuItemSpecific; },
+        MENU_ITEM{ command=EAknMarkAll; txt=qtn_options_list_mark_all;},
+        MENU_ITEM{ command=EAknUnmarkAll; txt=qtn_options_list_unmark_all;}
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
 // r_notepad_list_menubar
 // Menu bar of Notepad list mode.
 //
@@ -363,7 +411,7 @@
             },
         MENU_TITLE
             {
-            menu_pane=R_AVKON_MENUPANE_MARKABLE_LIST_EDIT_LIST_IMPLEMENTATION;
+            menu_pane = r_menupane_markable_list_edit_list_implementation;
             txt = "";
             },
         MENU_TITLE
@@ -394,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/NpdCoreModel.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/LibSrc/NpdCoreModel.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -750,7 +750,15 @@
     TInt insertIndex=0;
     TInt offset = KErrNotFound;
     TInt cmpOffsetListItem = KErrNotFound;
-    for(insertIndex= 0;insertIndex<aItemArray.MdcaCount();insertIndex++)
+    if ( IsTemplates() )
+    	{
+        insertIndex = 0;
+    	}
+    else
+    	{
+        insertIndex = 1;
+    	}
+    for(;insertIndex<aItemArray.MdcaCount();insertIndex++)
     	{
     	actualBuf.Copy(aItemArray.MdcaPoint(insertIndex));
 		actualTimeBuf.Copy(actualBuf.Left( actualBuf.Match(KCmpColumnListSeparator) ));
--- a/notepad/notepad1/LibSrc/NpdDialogBase.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/LibSrc/NpdDialogBase.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -482,7 +482,11 @@
     TInt index(0);
     aMenuPane.ItemAndPos( aCommandId, index );
 	aSendUi.AddSendMenuItemL( aMenuPane, index+1, ENotepadCmdSend/*, TSendingCapabilities()*/ );
-	aMenuPane.SetItemSpecific(ENotepadCmdSend, ETrue);
+	
+    if ( IsNoteListDialog() )
+        {
+        aMenuPane.SetItemSpecific( ENotepadCmdSend, ETrue );
+        }	
     }
 
 // -----------------------------------------------------------------------------
@@ -869,8 +873,7 @@
 // -----------------------------------------------------------------------------
 
 void CNotepadDialogBase::CCreateAndAppendFiles::StartAttachingL()
-	{
-	iStatus = KRequestPending;
+    {
 	if( iCount < iTotalCount )
 		iAttaching = ETrue;
 	else
@@ -879,20 +882,39 @@
 	
 	if( iAttaching )
 		{
-		TInt tempInt = iKeys[iCount];
-		HBufC* buf = iModel.ContentByKeyL(tempInt);
+        TInt tempInt = iKeys[iCount];
+        HBufC* buf = iModel.ContentByKeyL(tempInt);
 		
         CleanupStack::PushL(buf);
         iText->Reset();
-        iText->InsertL(0, *buf);
+
+        TRAPD( err, iText->InsertL( 0, *buf ) );
+    
+        if( err != KErrNone )
+            {
+            Cancel();
+            
+            if ( iProgressBar )
+                {
+                EndProgressDialog();
+                }
+            // release the member in advance to avoid memory-consumed erupted when endless send Notes by Messaging.			
+            ReleaseMemory();		  	
+        
+            User::LeaveIfError( err );
+            }
+        
         iFiles->AppendL(*iText);
  
         User::LeaveIfError( array->At(iCount).Open( iFs, iFiles->iSendFileName, EFileRead ) );
-   		imessageData->AppendAttachmentHandleL( array->At(iCount));
+        imessageData->AppendAttachmentHandleL( array->At(iCount));
 		
-		iCount++;
+        iCount++;
+    
         CleanupStack::PopAndDestroy(); // buf
-		}
+        }
+	
+	iStatus = KRequestPending;
 	SetActive();
 	TRequestStatus* status = &iStatus;
 	User::RequestComplete(status,KErrNone);
@@ -934,38 +956,9 @@
 			    
 			iListDialog->ClearSaveOrMarkedListItemsL(!iCanceled );   
 			iCanceled = EFalse;
-
-			if(iFiles)		
-			{
-				delete iFiles;
-			 	iFiles =NULL;
-			}
 			
-			if(iText)
-			{
-				delete iText;
-				iText =NULL;
-			}
-			
-			if(imessageData)
-			{
-			
-			delete imessageData;
-			imessageData =NULL;	
-			}
-			
-			if(array)
-			{
-			array->Reset();
-
-			delete array;
-			array =NULL;
-			}
-			
-			
-			iKeys.Close();
-
-			iFs.Close();
+			// release the member in advance in case of memory-consumed erupted when endless send Notes by Messaging.	
+			ReleaseMemory();
 			
 			RFs fs;
 			User::LeaveIfError(fs.Connect());
@@ -1000,4 +993,40 @@
 		}
 
 	}
+
+// -----------------------------------------------------------------------------
+// CNotepadDialogBase::CCreateAndAppendFiles::PrepareToClose
+// -----------------------------------------------------------------------------
+void CNotepadDialogBase::CCreateAndAppendFiles::ReleaseMemory()
+    {
+    if( iFiles )		
+        {
+        delete iFiles;
+        iFiles = NULL;
+        }
+
+    if( iText )
+        {
+        delete iText;
+        iText = NULL;
+        }
+
+    if( imessageData )
+        {	
+        delete imessageData;
+        imessageData = NULL;	
+        }
+
+    if( array )
+        {
+        array->Reset();
+
+        delete array;
+        array = NULL;
+        }
+
+    iKeys.Close();
+    iFs.Close();	
+    }
+
 // End of File  
--- a/notepad/notepad1/LibSrc/NpdEditorDialog.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/LibSrc/NpdEditorDialog.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -215,7 +215,7 @@
     if ( aNeedListRefresh )
         {
         iListDialog->HandleEditorExitL( statOfSave, returnKey,
-            statOfSave == CNotepadModel::ENotepadModelRowNop || 
+            statOfSave != CNotepadModel::ENotepadModelRowNop || 
             iFlags & ENotepadCatchSaveOnExitCallback );
         }
     return statOfSave;
@@ -388,7 +388,7 @@
 				}
             else
                 {
-                if ( IsSequenceAtLast() )
+                if ( IsSequenceAtLast() || iSequence->Count() == 1 )
                     {
                     aMenuPane->DeleteMenuItem(ENotepadCmdNextMemo);
                     }
@@ -531,10 +531,6 @@
         {
 		case EAknSoftkeyExit:
 		case EAknCmdExit:
-            if ( iListDialog )
-                {
-                iListDialog->MakeVisible( EFalse );
-                } 
             TryExitL(EAknSoftkeyExit);
             iAvkonAppUi->ProcessCommandL(EAknCmdExit);
             break;
@@ -877,7 +873,15 @@
         if ( wasModeAdding && 
             rowResult == CNotepadModel::ENotepadModelRowAdded )
             {
-            iSequence->InsertL(0, iKey); // *never leave* because reserved
+            if ( IsNotepad() )
+            	{
+                iSequence->InsertL(1, iKey); // *never leave* because reserved
+            	}
+            else
+            	{
+                iSequence->InsertL(0, iKey); // *never leave* because reserved
+            	}
+            
             }
         else if ( savedCurrentSequence != KNotepadInvalidSequenceIndex &&
             ( rowResult == CNotepadModel::ENotepadModelRowAdded ||
@@ -924,7 +928,7 @@
 //
 void CNotepadEditorDialog::OnCmdNextMemoL()
     {
-    TInt nextIndex(0);
+    TInt nextIndex(1);
     const TBool wasModeAdding( IsModeAdding() );
     if ( !wasModeAdding )
         {
@@ -1089,11 +1093,11 @@
     //
     TInt index( 0 );
     TKeyArrayFix cmpKeyArray(0, ECmpTInt);
-    for (i = keyArray.Count() - 1; i >= 0; --i)
+    for (i = keyArray.Count() - 1; i >= 1; --i)
         {
         if (iSequence->Find(keyArray[i], cmpKeyArray, index) != 0)
             {
-            iSequence->InsertL(0, keyArray[i]);
+            iSequence->InsertL(1, keyArray[i]);
             }
         }
     if (iKey != KNotepadPseudoKeyIdForNewNote 
@@ -1112,7 +1116,7 @@
     {
     __ASSERT_DEBUG( iSequence, 
         Panic(ENotepadLibraryPanicNullSequenceInEditor) );
-    return ( IsModeAdding() ? iSequence->Count() == 0 :
+    return ( IsModeAdding() ? iSequence->Count() == 1 :
         CurrentSequence() == iSequence->Count() - 1 );
     }
 
@@ -1124,7 +1128,7 @@
     {
     __ASSERT_DEBUG( iSequence, 
         Panic(ENotepadLibraryPanicNullSequenceInEditor) );
-    return ( IsModeAdding() || CurrentSequence() == 0);
+    return ( IsModeAdding() ||  CurrentSequence() == 1);
     }
 
 // -----------------------------------------------------------------------------
@@ -1152,10 +1156,14 @@
     TInt nextKey(iKey);
     if ( iKey == KNotepadPseudoKeyIdForNewNote ) // IsModeAdding
         {
-        if ( iSequence->Count() > 0 )
+        if ( iSequence->Count() > 1 )
             {
+            nextKey = (*iSequence)[1];
+            }
+        else if ( iSequence->Count() == 1 )
+        	{
             nextKey = (*iSequence)[0];
-            }
+        	}
         }
     else
         {
@@ -1197,6 +1205,7 @@
 TInt CNotepadEditorDialog::DoSearchL(CFindItemEngine::TFindItemSearchCase aCase)
     {
     CFindItemDialog* dialog = CFindItemDialog::NewL( iEditor->Text()->Read( 0 ), aCase );
+    dialog->EnableSingleClick( ETrue );
     TInt ret = dialog->ExecuteLD();
     return ret;
     }
--- a/notepad/notepad1/LibSrc/NpdExternalTextEditorDialog.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/LibSrc/NpdExternalTextEditorDialog.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -310,9 +310,13 @@
         {
            TInt ret = DoSearchL( iFindItemMenu->SearchCase(aCommandId) );
 		   if ( ret == EAknSoftkeyExit )
-			{
-				aCommandId = ret;
-			}
+		       {
+               aCommandId = ret;
+		       }
+		   else
+               {
+               return;
+               }
         }
 
     switch (aCommandId)
@@ -411,6 +415,7 @@
 TInt CNotepadExternalTextDialog::DoSearchL(CFindItemEngine::TFindItemSearchCase aCase)
 	{
 		CFindItemDialog* dialog = CFindItemDialog::NewL( iEditor->Text()->Read(0), aCase );
+	    dialog->EnableSingleClick( ETrue );
 	    TInt ret = dialog->ExecuteLD();
 	    TBuf<128> test = _L("FI returned: ");
 	    test.AppendNum(ret);
--- a/notepad/notepad1/LibSrc/NpdListDialog.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/LibSrc/NpdListDialog.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -64,6 +64,9 @@
 #include "NpdApi.h"
 #include "NpdLibPanic.h"
 
+//number of fixed item
+//currently, Notepad application have one fixed "New Note" item in main view. 
+const TInt KNumberOfFixedItem = 1; 
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -176,22 +179,19 @@
         {
         iFlags &= ~ENotepadItemAdded;
         }
-    if ( aEagerSync )
+    if ( aEagerSync && iClockValueChange )
         {
-        if(iClockValueChange)
-        	{
-        	iModel->SetItemArrayFlags();
-        	iClockValueChange = EFalse;
-        	}
-        iModel->SyncL(EFalse);
-        RestoreCurrentAndSelectionsL();
-        DrawNow();
+        iModel->SetItemArrayFlags();
+        iClockValueChange = EFalse;        
         }
     if (aStatOfSave == CNotepadModel::ENotepadModelRowDeleted)
     	{
     	iListBox->HandleItemRemovalL();
     	DrawNow();
     	}
+    iModel->SyncL(EFalse);
+    RestoreCurrentAndSelectionsL();
+    DrawNow();
         // MSK 
         MiddleSoftKeyL();
     }
@@ -427,14 +427,11 @@
         SaveCurrentAndSelectionsL();
         TUid serviceUid = SendByKeysL(*iSendUi, aCommandId, *iModel, iSavedSelectedKeys);
         iModel->SyncL(EFalse); // sync might be delayed while SendAsL.
-        RestoreCurrentAndSelectionsL();
-        //RestoreCurrent();
         TUid EmailUid = {0x10001028};
         if ( serviceUid == EmailUid )
         	{
         	iSendingEmail = ETrue;
         	}
-       
         }
     else
         {
@@ -444,7 +441,6 @@
         SendAsL( *iSendUi, aCommandId, EFalse, text );
         CleanupStack::PopAndDestroy(); // text
         iModel->SyncL(EFalse); // sync might be delayed while SendAsL.
-        RestoreCurrentAndSelectionsL();
         }
     }
 
@@ -879,10 +875,10 @@
 		}
     iModel->SyncL(EFalse);
     CNotepadDialogBase::DynInitMenuPaneL( aResourceId, aMenuPane );
-    const TInt memoCount( iModel->MdcaCount() );
-   	const TInt markCount( iListBox->SelectionIndexes()->Count() );
-    TInt index;
-    switch ( aResourceId )
+    const TInt memoCount( iModel->MdcaCount() - KNumberOfFixedItem );
+   	const TInt markCount(iListBox->SelectionIndexes()->Count());
+	TInt index;
+	switch (aResourceId )
         {
         case R_SENDUI_MENU:
             index = 2;
@@ -954,7 +950,7 @@
             TInt ignore;
             TInt itemMarked = iListBox->SelectionIndexes()->Find( currIndex, itemKey, ignore );
             if ( memoCount > 0 && 
-                ( markCount == 0 || IsNotepad() ) )
+                ( markCount == 0 || IsNotepad() || IsTemplates()) )
                 {
                 // this must preceed DeleteMenuItem(ENotepadCmdOpen)
                 InsertSendMenuItemAfterL( *iSendUi, *aMenuPane, 
@@ -969,13 +965,42 @@
                 // this must after InsertSendMenuItemAfterL
                 aMenuPane->DeleteMenuItem(ENotepadCmdOpen);
                 }
-            }
+            if ( markCount >= 1 && IsNoteListDialog() )
+                {
+                aMenuPane->SetItemSpecific( ENotepadCmdSend, EFalse );
+                aMenuPane->SetItemSpecific( ENotepadCmdDelete, EFalse );
+                }
+            
+            if ( IsTemplateListDialog() )
+                {
+                aMenuPane->SetItemSpecific( ENotepadCmdSend, ETrue );
+                if ( markCount >= 1 )
+                    {
+                    aMenuPane->SetItemDimmed( ENotepadCmdSend, ETrue );
+                    }
+                 }
+            
+            if ( iListBox->CurrentItemIndex() == 0 && IsNotepad() && memoCount > 0 && markCount == 0 )
+				{                    
+				aMenuPane->SetItemDimmed( ENotepadCmdDelete, ETrue );				 
+				aMenuPane->SetItemDimmed( ENotepadCmdSend, ETrue );				 
+				}
+			}
             break;
         default:
-            AknSelectionService::HandleMarkableListDynInitMenuPane(
-                aResourceId, aMenuPane, iListBox);
-            break;
-        }
+			{
+			if ( IsTemplates() )
+				{
+				AknSelectionService::HandleMarkableListDynInitMenuPane(
+						aResourceId, aMenuPane, iListBox );				
+				}
+			else
+				{			
+			    HandleMarkListDynInitMenuPane( aResourceId, aMenuPane, iListBox );
+				}	
+			break;
+			}
+		}
     }
     
 // -----------------------------------------------------------------------------
@@ -1029,6 +1054,28 @@
         case ENotepadCmdSend:
         	OnCmdSendL(aCommandId);
         	break;
+		case EAknMarkAll:
+			{
+			if ( IsNotepad() )
+				{
+				iListBox->ClearSelection();
+				TInt num = iListBox->Model()->NumberOfItems();
+				if ( num < 2 )
+					return;
+				TInt ii = 0;
+				CArrayFixFlat<TInt>* array = new (ELeave) CArrayFixFlat<TInt> (
+						20 );
+				CleanupStack::PushL(array);
+				array->SetReserveL(num);
+				for ( ii = 1; ii < num; ii++ )
+					{
+					array->AppendL( ii );
+					}
+				iListBox->SetSelectionIndexesL( array );
+				CleanupStack::PopAndDestroy(); //array
+				break;
+				}
+			}
         default:
             {
             const TInt aiwServiceCmd( iServiceHandler ? iServiceHandler->ServiceCmdByMenuCmd( aCommandId ) : 0 );                
@@ -1303,15 +1350,22 @@
             OnCmdOpenL(aListBox->CurrentItemIndex());
             break;
         case EEventItemSingleClicked:
-            if ( aListBox->Model()->NumberOfItems() != 0 
-                && aListBox->SelectionIndexes()->Count() == 0 )
-                {
-                HandleListBoxPointerEventL( CNotepadListDialog::EOpenListBoxItem );
-                }
-            else
-                {
-                HandleListBoxPointerEventL( CNotepadListDialog::EOpenListBoxContextMenu );
-                }
+        	if ( IsNotepad() )
+				{     
+				if ( aListBox->Model()->NumberOfItems() != 0
+						&& aListBox->SelectionIndexes()->Count() == 0 )
+					{
+				
+					HandleListBoxPointerEventL(
+							CNotepadListDialog::EOpenListBoxItem);
+					}
+				else
+					{
+					HandleListBoxPointerEventL(
+							CNotepadListDialog::EOpenListBoxContextMenu );
+					}
+				}
+            
             if(  IsTemplates() && AknLayoutUtils::PenEnabled() ) 
                 {
                   if( !aListBox->SelectionIndexes()->Count()  )
@@ -1530,7 +1584,7 @@
             iInts = new(ELeave) CArrayFixFlat<TInt>(2);
             iInts->AppendL(0);
             iInts->AppendL(aCount);
-            IncrementL(0); // SetTextL
+            IncrementL( 1 ); // SetTextL
             }
             break;
         default:
@@ -1576,7 +1630,11 @@
 	{
 	if(aEvent == EOpenListBoxContextMenu && !MenuShowing())
 		{
-		if(iEditorFlag==EFalse)
+		if (iListBox->CurrentItemIndex() == 0)
+			{		
+		    OnCmdAddL();
+			}
+		else if (iEditorFlag == EFalse)
 		{
 		iFlags |= ENotepadMenuByOkKey;
 		iMskFlag=ETrue;
@@ -1585,7 +1643,11 @@
 		}
 	else if(aEvent == EOpenListBoxItem)
 		{
-        if ( !iEditorDialog&& !IsTemplates() )
+		if ( iListBox->CurrentItemIndex() == 0 )
+			{		
+			OnCmdAddL();
+			}
+		else if (!iEditorDialog && !IsTemplates())
             {
             OnCmdOpenL( iListBox->CurrentItemIndex() );
             }
@@ -1603,7 +1665,7 @@
     
     if( !IsTemplates() ) // Notepad ListView
         {
-            if( (iModel->MdcaCount() == 0))
+            if( (iModel->MdcaCount() == 1))
             {
               ButtonGroupContainer().SetCommandSetL( R_NOTEPAD_SOFTKEYS_OPTIONS_EXIT_NEW );
             }
@@ -1676,6 +1738,34 @@
     return KErrNone;
     }
     
+// -----------------------------------------------------------------------------
+// CNotepadListDialog::HandleMarkListDynInitMenuPane
+// -----------------------------------------------------------------------------
+//
+void CNotepadListDialog::HandleMarkListDynInitMenuPane( TInt aResourceId, CEikMenuPane *aMenu, CEikListBox *aListBox )
+	{
+    TInt numofNotes = aListBox->Model()->NumberOfItems() - KNumberOfFixedItem;
+    
+	if ( aResourceId == R_MENUPANE_MARKABLE_LIST_IMPLEMENTATION )
+		{
+		TInt currentItemIndex = aListBox->View()->CurrentItemIndex();
+		TBool markHidden = aListBox->View()->ItemIsSelected( currentItemIndex ) || currentItemIndex == 0;
+		TBool unmarkHidden =
+				!aListBox->View()->ItemIsSelected(currentItemIndex) || currentItemIndex == 0;
+		TBool markAllHidden = ( numofNotes == 0 ) || ( aListBox->SelectionIndexes()->Count() == numofNotes );
+		TBool unmarkAllHidden = ( numofNotes == 0 ) || ( aListBox->SelectionIndexes()->Count() == 0 );
+		aMenu->SetItemDimmed(EAknCmdMark, markHidden);
+		aMenu->SetItemDimmed(EAknCmdUnmark, unmarkHidden);
+		aMenu->SetItemDimmed(EAknMarkAll, markAllHidden);
+		aMenu->SetItemDimmed(EAknUnmarkAll, unmarkAllHidden);		
+		}
+	if ( aResourceId == R_MENUPANE_MARKABLE_LIST_EDIT_LIST_IMPLEMENTATION )
+		{
+		TBool editListHidden = numofNotes == 0;
+
+		aMenu->SetItemDimmed(EAknCmdEditListMenu, editListHidden);
+		}
+	}
 // End of File  
 
 
--- a/notepad/notepad1/LibSrc/NpdModel.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/LibSrc/NpdModel.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -79,6 +79,10 @@
     delete iItemArray;
     delete iTimeFormat;
     delete iDateFormat;
+    if ( iFixedFirstNote )
+    	{
+        delete iFixedFirstNote;
+    	}    
     }
 
 // -----------------------------------------------------------------------------
@@ -348,6 +352,7 @@
         = rr.ReadInt16(); // WORD  listing_style;
     TInt dateResId(rr.ReadInt32());               // LLINK date_format
     TInt timeResId(rr.ReadInt32());               // LLINK time_format
+    TInt firstNoteResId(rr.ReadInt32());          // LLINK first_note;
     CleanupStack::PopAndDestroy(); // rr
     if (dateResId)
         {
@@ -357,6 +362,10 @@
         {
         iTimeFormat = iEnv->AllocReadResourceL(timeResId);
         }
+    if ( firstNoteResId )
+    	{
+    iFixedFirstNote = iEnv->AllocReadResourceL( firstNoteResId );
+    	}
     iItemArray = new(ELeave) CDesCArrayFlat(KNotepadItemArrayGranularity);
     iDatabaseChangeNotifier = 
         CNotepadModel::CDatabaseChangeNotifier::NewL(iDatabase, *this);
@@ -385,6 +394,7 @@
         {
         User::LeaveIfError(iSavedDeleteKeys.Append(aKeys[i]));
         }
+    iProgressCount = 0;
     ExecuteDeleteStepL();
     iRetval = iFileSession.ReleaseReserveAccess( KDefaultDrive );
     iFileSession.Close();
@@ -397,7 +407,7 @@
 //
 void CNotepadModel::ExecuteDeleteStepL()
     {
-    iProgressCount = 0;
+    
     iStepCount = iSavedDeleteKeys.Count();
     if ( iStepCount > KNotepadMaxDeleteCountInStep )
         {
@@ -411,12 +421,6 @@
     if ( IsTemplates() )
         {
         iSavedDeleteKeys.Remove(0);
-        for (TInt i(0); i < iStepCount - 1; i++)
-            {
-            sql.Append(KNotepadSqlDeleteByKeysAppend);
-            sql.AppendNum(iSavedDeleteKeys[0]);
-            iSavedDeleteKeys.Remove(0);
-            }
         }
     else // If Notepad, Remove is postponed until remove link phase
         {
@@ -512,6 +516,15 @@
             else // do next step
                 {
                 increment = iStepCount - iProgressCount;
+
+                iProgressCount += increment;
+                if ( iModelObserver )
+                    {
+                    iModelObserver->HandleNotepadModelEventL(
+                            MNotepadModelObserver::EProgressDeletion,
+                            1 );
+                    }
+
                 ExecuteDeleteStepL();
                 }
             }
@@ -530,15 +543,7 @@
         {
         increment = iDbUpdate.RowCount() - iProgressCount;
         }            
-    if ( increment > 0 )
-        {
-        iProgressCount += increment;
-        if ( iModelObserver )
-            {
-            iModelObserver->HandleNotepadModelEventL(
-                MNotepadModelObserver::EProgressDeletion, increment);
-            }
-        }
+    
     if ( deleteFinished || ( stat == 0 && 
         SysUtil::FFSSpaceBelowCriticalLevelL(&(iEnv->FsSession())) ) )
         {
@@ -618,6 +623,20 @@
         }
     iItemArray->Reset();
     iKeyArray.Reset();
+    //insert the New note as the firt note
+    if ( iFixedFirstNote != NULL )
+		{
+		TBuf<256> buf;
+		_LIT( KBlankSpace, "   " );
+		buf.Append( KBlankSpace );	
+		buf.Append( KColumnListSeparator );
+		buf.Append( *iFixedFirstNote );
+		iItemArray->AppendL( buf );
+		//default key for New note, -2 is never used for normal keys.
+		iKeyArray.Append( -2 );
+		}
+    
+  
     TRAPD( err, DoBuildItemArrayL() );
     if ( err != KErrNone)
         {
@@ -716,13 +735,14 @@
 
         TPtrC thisText = 
             aBuf.Mid(textOffset).Left(KNotepadMaxCharactersForSort);
-        if ( iItemArray->Count() == 0 || 
+        if ( (iItemArray->Count() == 0 && iFixedFirstNote == NULL) || (iItemArray->Count() == 1 && iFixedFirstNote != NULL) || 
              dateTime.Day() != prevDateTime.Day() ||
              dateTime.Month() != prevDateTime.Month() ||
              dateTime.Year() != prevDateTime.Year() )
             {
             // first entry or date of the item has changed
             firstIndexOfTheDay = iItemArray->Count();
+
             textArrayOfTheDay.Reset();
             if ( isToday )
                 {
--- a/notepad/notepad1/LibSrc/NpdViewerDialog.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/LibSrc/NpdViewerDialog.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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,39 +583,63 @@
  
     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
 // -----------------------------------------------------------------------------
 //
 void CNotepadViewerDialog::HandleDialogPointerEventL( const TPointerEvent& aPointerEvent )
-{
-	
-	 if(!AknLayoutUtils::PenEnabled())
-	 {
-	 	return;
-	 }
-	 
-    if(aPointerEvent.iType == TPointerEvent::EButton1Up ) 
     {
-   
-       TInt curPos = iEditor->CursorPos();	
-       TRect rect = iEditor->Rect();  
-       if ( !iAutoFinder->ItemWasTappedL( aPointerEvent.iPosition - rect.iTl ) )
-         {
-		 	return;
-		 } 
-		 
-       TInt curPos1 = iEditor->CursorPos();
-       if (curPos == curPos1) 
-       {
-   			iFlags |= ENotepadMenuByOkKey;
-   	    	DisplayMenuL();	       	
-       }
-   
-    
+    if(!AknLayoutUtils::PenEnabled())
+        {
+        return;
+        }
+    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();
+    		}
+    	}
     }
-}
 
 // -----------------------------------------------------------------------------
 // CNotepadViewerDialog::HandleNumberCallL
@@ -699,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);
@@ -720,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/NpdDialogBase.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/inc/NpdDialogBase.h	Sun Jun 20 22:55:39 2010 +0200
@@ -186,6 +186,20 @@
         * @return ETrue if this is a modeless dialog, otherwize EFalse.
         */
         inline TBool IsModeless();
+        
+        /**
+        * Check whether this dialog is for Notepad application ListDialog.
+        *
+        * @return ETrue if this is for for Notepad application ListDialog, otherwize EFalse.
+        */
+        inline TBool IsNoteListDialog() const;
+        
+        /**
+        * Check whether this dialog is for Template List.
+        *
+        * @return ETrue if this is for for Template List, otherwize EFalse.
+        */
+        inline TBool IsTemplateListDialog() const;
 
         /**
         * Set iTitle text to title pane.
@@ -386,7 +400,14 @@
 				void DialogDismissedL( TInt aButtonId );
                 void RunL();
                 void DoCancel();
-            private: // data
+                
+            private:
+				/**
+		        * release memory allocated in the phase of appending Notes to Messaging.
+		        */                
+                void ReleaseMemory();
+                
+    private: // data
 				CSendUi& iSendAppUi;
 				TInt iCommandId;
 				CNotepadModel& iModel;
--- a/notepad/notepad1/inc/NpdDialogBase.inl	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/inc/NpdDialogBase.inl	Sun Jun 20 22:55:39 2010 +0200
@@ -67,4 +67,21 @@
     return iBaseFlags & ENotepadSendUiDelayedExit;
     }
 
+// -----------------------------------------------------------------------------
+// CNotepadDialogBase::IsNoteListDialog
+// -----------------------------------------------------------------------------
+//
+inline TBool CNotepadDialogBase::IsNoteListDialog() const
+    {
+    return iResId == R_NOTEPAD_LIST_DIALOG_ORG;
+    }
+
+// -----------------------------------------------------------------------------
+// CNotepadDialogBase::IsTemplateListDialog
+// -----------------------------------------------------------------------------
+//
+inline TBool CNotepadDialogBase::IsTemplateListDialog() const
+    {
+    return iResId == R_NOTEPAD_TEMPLATE_LIST_DIALOG_ORG;
+    }
 // End of file
--- a/notepad/notepad1/inc/NpdLib.rh	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/inc/NpdLib.rh	Sun Jun 20 22:55:39 2010 +0200
@@ -61,6 +61,7 @@
     //WORD  list_width_in_chars = NOTEPAD_LIST_WIDTH_IN_CHARS; 
     LLINK date_format = 0;
     LLINK time_format = 0;
+    LLINK first_note = 0;
     }
 
 // -----------------------------------------------------------------------------
--- a/notepad/notepad1/inc/NpdListDialog.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/inc/NpdListDialog.h	Sun Jun 20 22:55:39 2010 +0200
@@ -284,6 +284,14 @@
         * @param aEvent view event type.
         */
         void DoHandleViewEventL(const TVwsViewEvent& aEvent);
+        
+        /**
+        * handle the mark/unmark/markall/unmarkall command
+        * @param aResourceId the resouce id
+        * @param aMenu the pane to be processed.
+        * @param aListBox the refered list box for the pane.  
+        */
+        void HandleMarkListDynInitMenuPane( TInt aResourceId, CEikMenuPane *aMenu, CEikListBox *aListBox );
 
     private:  // Functions from base classes
 
@@ -396,7 +404,7 @@
         *
         * @param aType event type.
         */
-		void HandleResourceChange(TInt aType);
+		void HandleResourceChange(TInt aType);		
 
     private:  // Reserved
 
--- a/notepad/notepad1/inc/NpdModel_platsec.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/inc/NpdModel_platsec.h	Sun Jun 20 22:55:39 2010 +0200
@@ -348,6 +348,8 @@
         TInt iListingStyle;
         HBufC* iDateFormat;
         HBufC* iTimeFormat;
+        //used for Notepad's first note. Template does not use.
+        HBufC* iFixedFirstNote;
         TInt iStepCount;
         RFs iFileSession;
         TInt iRetval;
--- a/notepad/notepad1/inc/NpdViewerDialog.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/notepad/notepad1/inc/NpdViewerDialog.h	Sun Jun 20 22:55:39 2010 +0200
@@ -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/organizer_plat/calendar_custamization_api/inc/calencommands.hrh	Sun Jun 20 22:50:42 2010 +0200
+++ b/organizer_plat/calendar_custamization_api/inc/calencommands.hrh	Sun Jun 20 22:55:39 2010 +0200
@@ -48,6 +48,7 @@
     ECalenDayView,
     ECalenTodoView,
     ECalenForwardsToDayView,
+    ECalenForwardsToWeekView,
     ECalenNextView,
     ECalenPrevView,
     ECalenSwitchView,
@@ -61,6 +62,9 @@
     ECalenGotoDate,
     ECalenEventView,
     ECalenCmdPromptThenEdit,
+    ECalenCmdFindPhoneNum,
+    ECalenCmdFindEmail,
+    ECalenCmdFindURL,
     ECalenFasterAppExit,
     ECalenNewMeeting                            = ECalenEditCommandBase,
     ECalenNewTodo,
--- a/organizer_plat/calendar_custamization_api/inc/calencontext.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/organizer_plat/calendar_custamization_api/inc/calencontext.h	Sun Jun 20 22:55:39 2010 +0200
@@ -22,6 +22,7 @@
 // INCLUDES
 #include <e32base.h>
 #include <e32cmn.h>
+#include <calcommon.h>
 
 // FORWARD DECLARATIONS
 class TVwsViewId;
@@ -214,6 +215,32 @@
 		* @brief Resets calendar file name in context
 		*/
 		virtual void ResetCalendarFileName() = 0;
+		/**
+	    * @brief Set calendar file name of Alarm entry in context
+	    */		
+		virtual void SetCalAlarmEntryFileNameL(const TDesC& aName) = 0;
+		
+	 	/**
+	   	* @brief Get calendar filename 
+	   	* 
+	   	* @return HBufC pointer to calendar filename of Alarm entry
+	   	*/
+		virtual HBufC* GetCalAlarmEntryFileNameL() const = 0;
+		
+		/**
+	   	* @brief Resets Alarm Entry calendar file name in context
+	   	*/ 
+		virtual void ResetCalAlarmEntryFileName() = 0;
+		
+		/**
+	   	* @brief set Alarm Entry LocalUid in context
+	   	*/ 
+		virtual void SetCalAlarmEntryLocalUid(TCalLocalUid aLocalId) = 0;
+    
+	    /**
+	   	* @brief Get Alarm Entry LocalUid from context
+	   	*/ 
+	    virtual TCalLocalUid CalAlarmLocalUidL() const = 0;
     };
 
 #endif // CALENCONTEXT_H
--- a/organizer_plat/calendar_custamization_api/inc/calennotificationhandler.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/organizer_plat/calendar_custamization_api/inc/calennotificationhandler.h	Sun Jun 20 22:55:39 2010 +0200
@@ -61,6 +61,7 @@
     ECalenNotifyEntrySent,
     ECalenNotifyCancelDelete,
     ECalenNotifyDayViewClosed,
+    ECalenNotifyWeekViewClosed,
 	ECalenNotifyMapClosed,
 	ECalenNotifyCancelMapLaunch,
     ECalenNotifyMissedAlarmViewClosed,
--- a/organizer_plat/calendar_custamization_api/inc/calenservices.h	Sun Jun 20 22:50:42 2010 +0200
+++ b/organizer_plat/calendar_custamization_api/inc/calenservices.h	Sun Jun 20 22:55:39 2010 +0200
@@ -154,7 +154,7 @@
 		 * @param aIndex One of the TCalenIcons
 		 * @return CGulIcon* The icon corresponding to aIndex
 		 */
-		virtual CGulIcon* GetIconL( TCalenIcons aIndex ) = 0;
+		virtual CGulIcon* GetIconL( TCalenIcons aIndex, const TInt aViewId = 0 ) = 0;
 
 		/**
 		 * @brief Register for notifications of Calendar events
--- a/organizer_pub/notepad_library_api/tsrc/group/ABLD.BAT	Sun Jun 20 22:50:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-rem
-rem Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-rem All rights reserved.
-rem This component and the accompanying materials are made available
-rem under the terms of "Eclipse Public License v1.0"
-rem which accompanies this distribution, and is available
-rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
-rem
-rem Initial Contributors:
-rem Nokia Corporation - initial contribution.
-rem
-rem Contributors:
-rem
-rem Description:
-rem
-rem
-
-@ECHO OFF
-
-REM Bldmake-generated batch file - ABLD.BAT
-REM ** DO NOT EDIT **
-
-perl -S ABLD.PL "\s60\app\organizer\organizer_sdk\notepad_library_api\tsrc\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9
-if errorlevel==1 goto CheckPerl
-goto End
-
-:CheckPerl
-perl -v >NUL
-if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed?
-goto End
-
-:End
--- a/organizer_pub/notepad_library_api/tsrc/group/TestNpdApi.pkg	Sun Jun 20 22:50:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-;
-; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-; All rights reserved.
-; This component and the accompanying materials are made available
-; under the terms of "Eclipse Public License v1.0"
-; which accompanies this distribution, and is available
-; at the URL "http://www.eclipse.org/legal/epl-v10.html".
-;
-; Initial Contributors:
-; Nokia Corporation - initial contribution.
-;
-; Contributors:
-;
-; Description:  package file
-;
-; Languages
-; =========
-&EN
-
-; Name, UID for installation, Maj.Ver., Min.Ver., Variant, FLAG TO SPECIFY UNICODE, System component
-; ==================================================================================================
-#{"notepad library api Test"},(0x101FB3E7),1,0,1,TYPE=SA
-
-
-; Localised Vendor name
-%{"Nokia-EN"}
-
-; Unique Vendor name
-:"Nokia"
-
-"\epoc32\release\armv5\urel\TestNpdApi.dll"      -"$:\sys\bin\TestNpdApi.dll"
-"..\data\c\TestNpdApi.txt"                                     -"c:\testing\data\TestNpdApi.txt"
-"..\init\testframework.ini"                                     -"c:\TestFramework\testframework.ini"
-"..\conf\TestNpdApi.cfg"                                     -"c:\TestFramework\TestNpdApi.cfg"
-"..\conf\ui_TestNpdApi.cfg"                                     -"c:\TestFramework\ui_TestNpdApi.cfg"
-
-
-; eof
-
Binary file organizer_pub/notepad_library_api/tsrc/group/TestNpdApi.sis has changed
Binary file organizer_pub/notepad_library_api/tsrc/group/TestNpdApi.sisx has changed
--- a/organizer_pub/notepad_library_api/tsrc/group/rd-key.pem	Sun Jun 20 22:50:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQDLRF+r1FGGkCwTrb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW4
-6Y+LWaA8HMlDdoHRB0FgASisYcFagwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh
-7W7Dt9F5FZij8F7/9Pi6+FhhxZFIf1DD+yry9D7+Sp+BgdNALe4XOpf25QIBAwKB
-gQCHgupyjYuvCsgNHn7PNtnvVxInrB5MQNoPli+O+uNJWUK/Q+57Rl+yO8AoEzDX
-pFaLWiuVVhsdloDnAgabT/FXzYncs6uOHyEUV+dSXb78vtLPJqAX+Fg2i3hOXreB
-yskcZ13/OsKVOu5wgrJkx2baZufkqMwOSytf5y9nwjEIKwJBAP+inobagVNrN62j
-KQva3cC+UN/6XnKdTc0CA6bHyLOaJoH1xiMwG/VS2PGjHI0tiSMNtLn/QPpHJ003
-iabGhdUCQQDLjp/9UjFT6K6CF66Chqf30pZXhx+GTSQZmv/gvZiMly7X9fX9BGX3
-2MbJohBC4yI21XKTbisWywkF73Hwh+TRAkEAqmxprzxWN5zPyRdwspHpKymLP/w+
-9xOJM1atGdqFzRFvAU6EF3Vn+OHl9my9s3OwwgkjJqorUYTE3iUGby8D4wJBAIe0
-aqjhdjfwdFa6dFcEb/qMZDpaFQQzbWZnVUB+ZbMPdI/5TqitmU/l2dvBYCyXbCSO
-TGJJcg8yBgP09qBamIsCQFL7j1tM0XPVQJQ89WpKCld7O9ORxRGVj1eG0tWijrH8
-mGbYh8SGCVoWV3vrKSS8GBrFVgQnqUaHuEdtM7tpCAQ=
------END RSA PRIVATE KEY-----
--- a/organizer_pub/notepad_library_api/tsrc/group/rd.cer	Sun Jun 20 22:50:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
------BEGIN CERTIFICATE-----
-MIICzDCCAjWgAwIBAgIBADANBgkqhkiG9w0BAQUFADArMRAwDgYDVQQKEwdSRCBD
-ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZTAeFw0wNDExMTUxMjQyMDZaFw0z
-NzA5MjMxMjQyMDZaMCsxEDAOBgNVBAoTB1JEIENlcnQxFzAVBgNVBAMTDlJEIENl
-cnRpZmljYXRlMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDLRF+r1FGGkCwT
-rb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW46Y+LWaA8HMlDdoHRB0FgASisYcFa
-gwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh7W7Dt9F5FZij8F7/9Pi6+FhhxZFI
-f1DD+yry9D7+Sp+BgdNALe4XOpf25QIBA6OCAQAwgf0wDAYDVR0TBAUwAwEB/zAL
-BgNVHQ8EBAMCAoQwHQYDVR0OBBYEFFi/kuGzxhVpjGxe9ZwlxC3fH9jFMFMGA1Ud
-IwRMMEqAFFi/kuGzxhVpjGxe9ZwlxC3fH9jFoS+kLTArMRAwDgYDVQQKEwdSRCBD
-ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZYIBADBsBgNVHSAEZTBjMGEGBFUd
-IAAwWTATBggrBgEFBQcCARYHaHR0cDovLzBCBggrBgEFBQcCAjA2GjRGb3IgUiZE
-IHVzYWdlIG9ubHkuIFRoaXMgY2VydGlmaWNhdGUgaXMgbm90IHRydXN0ZWQuMA0G
-CSqGSIb3DQEBBQUAA4GBAHGB4RQMAgBdeT2hxfOr6f2nA/dZm+M5yX5daUtZnET9
-Ed0A9sazLawfN2G1KFQT9kxEParAyoAkpbMAsRrnRz/9cM3OHgFm/NiKRnf50DpT
-7oCx0I/65mVD2kt+xXE62/Ii5KPnTufIkPi2uLvURCia1tTS8JmJ8dtxDGyQt8BR
------END CERTIFICATE-----
--- a/pimappservices/appenginesdocs/app-engines_documentation.history.xml	Sun Jun 20 22:50:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<relnotes name="DEVELOPERLIBRARY">
-  <purpose>
-  </purpose>
-</relnotes>
--- a/pimappservices/appenginesdocs/app-engines_documentation.mrp	Sun Jun 20 22:50:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-component	app-engines_documentation
-
-source	\sf\app\organizer\pimappservices\appenginesdocs\
-
-notes_source	\component_defs\release.src
-
-
-ipr E 
-
--- a/pimappservices/calendar/client/src/calclient.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/pimappservices/calendar/client/src/calclient.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -35,8 +35,6 @@
 #include "calcalendarinfoimpl.h"
 #include "agmfilechangenotification.h"
 
-const TUint KDefaultMessageSlots = 3;
-
 _LIT(KAgendaMutex, "AgnMutex");
 
 //
@@ -205,7 +203,7 @@
 	
 TInt RAgendaServ::DoConnect()
 	{
-	return CreateSession(KAgendaServerName,Version(), KDefaultMessageSlots);
+	return CreateSession(KAgendaServerName,Version());
 	}
 
 
--- a/pimappservices/calendar/client/src/calentryimpl.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/pimappservices/calendar/client/src/calentryimpl.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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/agsasyncdelete.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/pimappservices/calendar/server/src/agsasyncdelete.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -288,7 +288,11 @@
 			for (TInt i = 0; i < KCount && todelete; ++i)
 				{
 				const CAgnSimpleEntry* KChildEntry = iModel.GetSimpleEntryFromIndexes(KChildIds[i].ChildId());
-				todelete = FallInTimeRangeL(*KChildEntry);
+				if(KChildEntry != NULL)
+				    {
+                    todelete = FallInTimeRangeL(*KChildEntry);
+				    }
+				
 				}
 			}
 
--- a/pimappservices/calendar/server/src/agsattachmentindex.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/pimappservices/calendar/server/src/agsattachmentindex.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -281,7 +281,8 @@
 		{
 		// check every attachment
 		const CAgnAttachmentIndexItem* KAttachmentItem = iIndex[i];
-		for (TInt j = 0; j < KAttachmentItem->Entries().Count(); ++j)
+		const TInt entryCount = KAttachmentItem->Entries().Count();
+		for (TInt j = 0; j < entryCount; ++j)
 			{
 			// check every entry associated with each attachment
 			if (KEntryLocalUid == (KAttachmentItem->Entries())[j])
--- a/pimappservices/calendar/server/src/agsentrymanager.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/pimappservices/calendar/server/src/agsentrymanager.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -574,7 +574,7 @@
 		}
 	CleanupStack::PopAndDestroy();
 	iLastRestored = type;
-	return (count);
+	return (buffer->Count());
 	}
 
 CAgnEntry* CAgnEntryManager::SearchBuffers(const TAgnEntryId& aEntryId, TInt& aPos)
--- a/pimappservices/calendar/server/src/agsentrymodel.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/pimappservices/calendar/server/src/agsentrymodel.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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/agsfilemanager.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/pimappservices/calendar/server/src/agsfilemanager.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -1263,7 +1263,7 @@
     
     TStreamId calendarInfoStreamId = iDictionary->At(KUidAgnCalendarInfo);
     
-    if (calendarInfoStreamId != KNullStreamId)
+    if (calendarInfoStreamId != KNullStreamId && iStore)
         {
         // Calendar info has been set on this file
         RStoreReadStream readStream;
--- a/pimappservices/calendar/server/src/agssess.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/pimappservices/calendar/server/src/agssess.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -4046,7 +4046,7 @@
             {
              // Clear all the notifications in the buffer
             iFileBufferedNotification->Reset();
-            iFileBufferedNotificationStream.Open(*iBufferedNotification);       
+            iFileBufferedNotificationStream.Open(*iFileBufferedNotification);       
         
             // Add a single 'Undefined Change' notification to the notification buffer
             CAgnFileChangeInfo* fileChang = CAgnFileChangeInfo::NewL(NULL, MCalFileChangeObserver::ECalendarInfoUpdated);
--- a/pimappservices/calendar/server/src/agstzruleindex.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/pimappservices/calendar/server/src/agstzruleindex.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/pimappservices/calendar/shared/src/agmcalendarinfo.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/pimappservices/calendar/shared/src/agmrptdef.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/pimappservices/calendar/shared/src/agmsimpleentry.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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	Sun Jun 20 22:50:42 2010 +0200
+++ b/pimappservices/calendar/tsrc/instance_iterator/tcal_fetchinstance.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -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);
--- a/pimappsupport/vcardandvcal/documentation/TestVersit.rtf	Sun Jun 20 22:50:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
-{\f85\froman\fcharset238\fprq2 Times New Roman CE;}{\f86\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f88\froman\fcharset161\fprq2 Times New Roman Greek;}{\f89\froman\fcharset162\fprq2 Times New Roman Tur;}
-{\f90\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f91\fswiss\fcharset238\fprq2 Arial CE;}{\f92\fswiss\fcharset204\fprq2 Arial Cyr;}{\f94\fswiss\fcharset161\fprq2 Arial Greek;}{\f95\fswiss\fcharset162\fprq2 Arial Tur;}
-{\f96\fswiss\fcharset186\fprq2 Arial Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;
-\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\widctlpar\adjustright \fs20\lang2057 \snext0 Normal;}{
-\s1\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\lang2057\kerning28 \sbasedon0 \snext0 heading 1;}{\s2\sb240\sa60\keepn\widctlpar\adjustright \b\i\f1\lang2057 \sbasedon0 \snext0 heading 2;}{\s3\sb240\sa60\keepn\widctlpar\adjustright \f1\lang2057 
-\sbasedon0 \snext0 heading 3;}{\s4\keepn\widctlpar\outlinelevel3\adjustright \b\f1\fs20\lang2057 \sbasedon0 \snext0 heading 4;}{\s5\keepn\widctlpar\outlinelevel4\adjustright \b\f1\lang2057 \sbasedon0 \snext0 heading 5;}{\*\cs10 \additive 
-Default Paragraph Font;}}{\*\listtable{\list\listtemplateid38323078\listsimple{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat0\levelspace0\levelindent0{\leveltext\'01-;}{\levelnumbers;}\f0\fbias0 \fi-360\li1800\jclisttab\tx1800 }{\listname 
-;}\listid817500656}{\list\listtemplateid38323078\listsimple{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat0\levelspace0\levelindent0{\leveltext\'01-;}{\levelnumbers;}\f0\fbias0 \fi-360\li1800\jclisttab\tx1800 }{\listname ;}\listid1308366115}
-{\list\listtemplateid38323078\listsimple{\listlevel\levelnfc23\leveljc0\levelfollow0\levelstartat0\levelspace0\levelindent0{\leveltext\'01-;}{\levelnumbers;}\f0\fbias0 \fi-360\li1800\jclisttab\tx1800 }{\listname ;}\listid1721782559}}{\*\listoverridetable
-{\listoverride\listid1308366115\listoverridecount0\ls1}{\listoverride\listid817500656\listoverridecount0\ls2}{\listoverride\listid1721782559\listoverridecount0\ls3}}{\info{\title BITGDI test code}{\author Lane Roberts}{\operator Symbian}
-{\creatim\yr2001\mo9\dy28\hr15\min24}{\revtim\yr2001\mo12\dy5\hr17\min7}{\version6}{\edmins80}{\nofpages1}{\nofwords171}{\nofchars977}{\*\company Dell Computer Corporation}{\nofcharsws0}{\vern113}}\paperw11909\paperh16834\margl1440\margr1440 
-\widowctrl\ftnbj\aenddoc\hyphcaps0\formshade\viewkind1\viewscale100 \fet0\sectd \psz9\linex0\headery706\footery706\colsx709\endnhere\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2
-\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6
-\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang
-{\pntxtb (}{\pntxta )}}\pard\plain \s1\sb240\sa60\keepn\widctlpar\outlinelevel0\adjustright \b\f1\fs28\lang2057\kerning28 {VERSIT test code
-\par }\pard\plain \widctlpar\adjustright \fs20\lang2057 {\f1 
-\par }{\b\f1\fs24 Test executable file locations
-\par 
-\par }\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
-\brdrs\brdrw10 \clshdng10000\cltxlrtb \cellx3050\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clshdng10000\cltxlrtb \cellx6208\pard \widctlpar\intbl\adjustright {\b\f1 WINS location\cell 
-Hardware location\cell }\pard \widctlpar\intbl\adjustright {\b\f1 \row }\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt
-\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx3050\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx6208\pard 
-\widctlpar\intbl\adjustright {\f1 \\epoc32\\release\\wins\\udeb\\
-\par or
-\par \\epoc32\\release\\wins\\urel\\\cell z:\\system\cell }\pard \widctlpar\intbl\adjustright {\f1 \row }\pard \widctlpar\adjustright {\f1 
-\par }\pard\plain \s5\keepn\widctlpar\outlinelevel4\adjustright \b\f1\lang2057 {Automatic test executables - should be run before every release
-\par }\pard\plain \widctlpar\adjustright \fs20\lang2057 {\f1 Success: Test program exits cleanly 
-\par Failure: Test program stops with an error message._
-\par }{\b\f1 
-\par }\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
-\brdrs\brdrw10 \clshdng10000\cltxlrtb \cellx2552\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clshdng10000\cltxlrtb \cellx8155\pard\plain \s4\keepn\widctlpar\intbl\outlinelevel3\adjustright 
-\b\f1\fs20\lang2057 {Filename\cell Purpose\cell }\pard\plain \widctlpar\intbl\adjustright \fs20\lang2057 {\b\f1 \row }\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh
-\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx2552\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
-\brdrs\brdrw10 \cltxlrtb \cellx8155\pard \widctlpar\intbl\adjustright {\f1 TBUGFIX.EXE\tab \cell  General test. It should be updated each time when a defect has been fixed.}{\b\f1 \cell }\pard \widctlpar\intbl\adjustright {\b\f1 \row }\pard 
-\widctlpar\intbl\adjustright {\f1 TPERFORMANCE.EXE\tab \tab \cell Do the bench marking in terms of performance and heap usage.}{\b\f1 \cell }\pard \widctlpar\intbl\adjustright {\b\f1 \row }\pard \widctlpar\intbl\adjustright {\f1 TCHARSETVCARD.EXE\tab 
-\tab \cell Internalise dozens of vCard from files in \\c\\ TestvCards and externalise them by setting different charset and encoding}{\b\f1 \cell }\pard \widctlpar\intbl\adjustright {\b\f1 \row }\pard \widctlpar\intbl\adjustright {\f1 TOOM.EXE\tab \tab 
-\cell  Out of memory test}{\b\f1 \cell }\pard \widctlpar\intbl\adjustright {\b\f1 \row }\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 
-\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx2552\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx8155\pard 
-\widctlpar\intbl\adjustright {\f1 TVGEN.EXE\tab \tab \cell  Build a vCard\\vCal randomly and internalise\\externalise it}{\b\f1 \cell }\pard \widctlpar\intbl\adjustright {\b\f1 \row }\pard \widctlpar\adjustright {\b\f1 
-\par }{\b\f1\fs24 Manual test executables - should be run if relevant changes have been made}{\f1 
-\par }{\b\f1 
-\par }\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
-\brdrs\brdrw10 \clshdng10000\cltxlrtb \cellx1487\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clshdng10000\cltxlrtb \cellx7817\pard \widctlpar\intbl\adjustright {\b\f1 Filename\cell Purpose\cell 
-}\pard \widctlpar\intbl\adjustright {\b\f1 \row }\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 
-\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx2552\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx8155\pard \widctlpar\intbl\adjustright {\f1 
-TVERSIT.EXE\tab \tab \cell  Need interaction from the user to test various cases such build, internalise, externalise a vCard or vCal}{\b\f1 \cell }\pard \widctlpar\intbl\adjustright {\b\f1 \row }\pard \widctlpar\adjustright {\b\f1\fs24 
-\par Test support files}{\f1 
-\par }{\b\f1 
-\par }\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
-\brdrs\brdrw10 \clshdng10000\cltxlrtb \cellx851\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clshdng10000\cltxlrtb \cellx4536\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb
-\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clshdng10000\cltxlrtb \cellx7088\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clshdng10000\cltxlrtb \cellx9639\pard \widctlpar\intbl\adjustright {\b\f1 
-Filename\cell Emulator location\cell Hardware location\cell Used by\cell }\pard \widctlpar\intbl\adjustright {\b\f1 \row }\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh
-\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx851\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
-\brdrs\brdrw10 \cltxlrtb \cellx4536\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx7088\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr
-\brdrs\brdrw10 \cltxlrtb \cellx9639\pard \widctlpar\intbl\adjustright {\f1 All files \cell \\epoc32\\wins\\c\\testfiles\cell c:\\ testfiles\cell TBUGFIX.EXE\cell }\pard \widctlpar\intbl\adjustright {\f1 \row }\pard \widctlpar\intbl\adjustright {\f1 
-All files \cell \\epoc32\\wins\\c\\ tPerformance\\inputfile\cell c:\\ tPerformance\\inputfile\cell TPERFORMANCE.EXE\cell }\pard \widctlpar\intbl\adjustright {\f1 \row }\trowd \trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb
-\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx851\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
-\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx4536\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx7088\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
-\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb \cellx9639\pard \widctlpar\intbl\adjustright {\f1 All files\cell \\epoc32\\wins\\c\\ testvcards\cell c:\\ testvcards\cell TCHARSETVCARD.EXE\cell }\pard \widctlpar\intbl\adjustright {
-\f1 \row }\pard \widctlpar\adjustright {\b\f1\fs24 
-\par Test rom building
-\par }{\f1 
-\par \\versit\\tsrc\\tVersit.iby is listed in bld.inf as a test export with destination \\epoc32\\rom\\include\\.  This automatically includes all test programs and files in a rom when used as follows from \\epoc32\\rom\\: \ldblquote tools\\
-buildrom assabet engbuild tVersit.iby\rdblquote . All testing input files specified in the table above}{\f1  }{\f1 are in}{\f1 cluded in tVersit.iby but need to be copied cross to}{\f1  a related directory in c: drive before testing.
-\par }}