emailservices/emailserver/cmailhandlerplugin/src/cmailcpssettings.cpp
changeset 1 12c456ceeff2
parent 0 8466d47a6819
child 2 5253a20d2a1e
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailcpssettings.cpp	Thu Dec 17 08:39:21 2009 +0200
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailcpssettings.cpp	Thu Jan 07 12:38:38 2010 +0200
@@ -429,20 +429,35 @@
 // CMailCpsSettings::GetContentId
 // ---------------------------------------------------------------------------
 //
-void CMailCpsSettings::GetContentId( TInt aId, TDes16& aValue )
+TInt CMailCpsSettings::GetContentId( TInt aMailboxId, TInt aId, TDes16& aValue )
     {
-    FUNC_LOG;    
+    FUNC_LOG;
+    TBool cidFound(EFalse);
+    TInt ret(0);
+    TInt found(0);
     for (TInt i = 0; i < KMaxMailboxCount; i++)
         {       
         TInt value;
         TUint32 mailboxKey(KCMailMailboxIdBase+i);
-        iCenRep->Get( mailboxKey, value );
-        if (aId == value)
+        iCenRep->Get( mailboxKey, value );     
+        if (aMailboxId == value)
             {
-            iCenRep->Get( KCMailWidgetContentIdBase+i, aValue );
-            break;
+            found++;
+            if ( !cidFound && found == aId )
+                {
+                iCenRep->Get( KCMailWidgetContentIdBase+i, aValue );
+                cidFound = ETrue;
+                }            
+            else if ( cidFound && found == aId + 1 )
+                {
+                // There is more widgets with same mailbox accounts. 
+                ret = aId + 1;
+                break;
+                }
             }
-        }    
+        }
+    // if there is more than one mailbox with different cid return id of next mailbox
+    return ret;
     }
 
 // ---------------------------------------------------------------------------