clock2/clockui/uilayer/clockmainview/src/clockalarmarray.cpp
branchRCL_3
changeset 30 d68a4b5d5885
parent 0 f979ecb2b13e
child 67 1539a383d7b6
--- a/clock2/clockui/uilayer/clockmainview/src/clockalarmarray.cpp	Tue May 11 16:12:24 2010 +0300
+++ b/clock2/clockui/uilayer/clockmainview/src/clockalarmarray.cpp	Tue May 25 12:41:10 2010 +0300
@@ -30,8 +30,7 @@
 
 // Constants
 const TInt KTimeStringLength( 25 );
-const TInt KFirstAlarmIndex( 1 );
-const TInt KNewAlarmIndex( 0 );
+const TInt KFirstAlarmIndex( 0 );
 
 // Literals
 _LIT( KFieldSeparator, "\t" );
@@ -151,35 +150,6 @@
 TPtrC16 CClockAlarmArray::MdcaPoint( TInt aIndex ) const
     {
 	__PRINTS( "CClockAlarmArray::MdcaPoint - Entry" );
-	
-    // Set "New Alarm" as the first index of the listitem.
-    if( KNewAlarmIndex == aIndex )
-        {
-        iListBoxEntry->Des().Zero();
-		
-		TPtr listEntryPtr = iListBoxEntry->Des();		      
-        
-        listEntryPtr.Append( KFieldSeparator );    
-           
-		//Single click integration
-        listEntryPtr.Append( iNewAlarmText->Des() );
-
-        listEntryPtr.Append( KFieldSeparator );
-        
-        
-        listEntryPtr.Append( KFieldSeparator );
-    
-        listEntryPtr.AppendNum( EBlankIconIndex );
-    
-        listEntryPtr.Append( KFieldSeparator );
-    
-        listEntryPtr.AppendNum( EBlankIconIndex );
-        
-        __PRINTS( "CClockAlarmArray::MdcaPoint - Exit" );
-        
-        return listEntryPtr;
-        }
-
     SClkAlarmInfo alarmInfo;
     TBuf< KTimeStringLength > timeString;
     TAlarmId alarmId;
@@ -258,13 +228,13 @@
             
         case EAlarmRepeatDefintionRepeatDaily:
             {
-            listEntryPtr.Append( ( *iOccuranceList )[ 2 ] );
+            listEntryPtr.Append( ( *iOccuranceList )[ 1 ] );
             }
             break;
             
         case EAlarmRepeatDefintionRepeatWorkday:
             {
-            listEntryPtr.Append( ( *iOccuranceList )[ 3 ]);
+            listEntryPtr.Append( ( *iOccuranceList )[ 2 ]);
             }
             break;
             
@@ -491,8 +461,6 @@
     // Get the ids from alarmserver.
     iAlarmModel->GetClkAlarmIds( iAlarmIdArray );
     
-    // Add a dummy index for "New Alarm" Option as first item in the Id array.
-    iAlarmIdArray.Insert( KNewAlarmIndex, KNewAlarmIndex );
     
     SClkAlarmInfo alarmInfo;      
     TInt alarmCount( iAlarmIdArray.Count() );
@@ -548,7 +516,7 @@
     TInt enabledAlarmCount( GetEnabledAlarmCount() );
         
     // If info of an active alarm is needed.       
-    if( aIndex <= enabledAlarmCount )
+    if( aIndex < enabledAlarmCount )
     	{
     	GetActiveAlarmInfo( aIndex, aAlarmId , aAlarmInfo );
     	}
@@ -612,21 +580,22 @@
     iAlarmModel->GetClkAlarmIds( alarmIdArray );
     
     TInt alarmIdCount( alarmIdArray.Count() );
-    TInt alarmIndex( NULL );
+    TInt alarmIndex( 0 );
         
-	for( TInt index( NULL ); index < alarmIdCount; index++ )
+	for( TInt index( 0 ); index < alarmIdCount; index++ )
 	    {
 	    // Get information of each alarm.
 	    SClkAlarmInfo alarmInfo;
 	    TInt errorValue( iAlarmModel->ClockAlarmInfo( alarmIdArray[ index ], alarmInfo ) );
 	    
-	    if( ( KErrNone == errorValue ) &&
+	    if(  !( ( KErrNone == errorValue ) &&
 	        ( EAlarmStateInPreparation != alarmInfo.iState &&
 	          EAlarmStateNotified != alarmInfo.iState &&
-	          EAlarmStatusEnabled == alarmInfo.iStatus ) )
+	          EAlarmStatusEnabled == alarmInfo.iStatus ) ) )
 	        {
-	        alarmIndex++;
+	        continue;
 	        }
+	    
 	    if( aIndex == alarmIndex )
 	        {
 	        // We have a match, return the values.
@@ -637,8 +606,9 @@
 	        // Break the loop.
 	        return;
 	        }
-	     }
-   	  }
+	    alarmIndex++;
+	    }
+   	}
     
 // ---------------------------------------------------------
 // CClockAlarmArray::GetInActiveAlarmInfo
@@ -655,19 +625,19 @@
 	
     // Get the alarms which are enabled and active.
     TInt enabledAlarmCount = GetEnabledAlarmCount();
-
-    for( TInt index( NULL ); index < alarmIdCount; index++ )
+    
+    for( TInt index( 0 ); index < alarmIdCount; index++ )
         {
         // Get information of each alarm.
         SClkAlarmInfo alarmInfo;
         TInt errorValue( iAlarmModel->ClockAlarmInfo( alarmIdArray[ index ], alarmInfo ) );
 
-        if( ( KErrNone == errorValue ) &&
+        if( !( ( KErrNone == errorValue ) &&
             ( EAlarmStateInPreparation != alarmInfo.iState &&
               EAlarmStateNotified != alarmInfo.iState &&
-              EAlarmStatusEnabled != alarmInfo.iStatus ) )
+              EAlarmStatusEnabled != alarmInfo.iStatus ) ) )
             {
-            alarmIndex++;
+            continue;
             }
         // Disabled alarms are always indexed after the enabled alarms.
         if( ( enabledAlarmCount + alarmIndex ) == aIndex )
@@ -679,6 +649,7 @@
             // Break the loop.
             return;
             }
+        alarmIndex++;
         }
    	 }
     
@@ -758,4 +729,8 @@
     return returnValue;
     }
 
+HBufC* CClockAlarmArray::NewAlarmText() const
+        {
+        return iNewAlarmText;
+        }
 // End of file