113 FUNC_LOG; |
113 FUNC_LOG; |
114 // Get current configuration from settings interface, |
114 // Get current configuration from settings interface, |
115 // and pass it on to actual publisher interface |
115 // and pass it on to actual publisher interface |
116 iLiwIf->SetConfiguration( iSettings->Configuration() ); |
116 iLiwIf->SetConfiguration( iSettings->Configuration() ); |
117 |
117 |
118 const TInt iiMax( iSettings->Mailboxes().Count() ); |
118 TInt iiMax( iSettings->Mailboxes().Count() ); |
119 for ( TInt ii = 0; ii < iiMax; ii++ ) |
119 for ( TInt ii = 0; ii < iiMax; ii++ ) |
120 { |
120 { |
121 CFSMailBox* mailbox( NULL ); |
121 CFSMailBox* mailbox( NULL ); |
122 mailbox = MailClient().GetMailBoxByUidL( iSettings->Mailboxes()[ii] ); |
122 mailbox = MailClient().GetMailBoxByUidL( iSettings->Mailboxes()[ii] ); |
123 |
123 |
124 TInt id(0); |
124 TInt mailboxId(0); |
125 if (mailbox) |
125 if (mailbox) |
126 { |
126 { |
127 id = mailbox->GetId().Id(); |
127 mailboxId = mailbox->GetId().Id(); |
128 } |
128 } |
129 if ( !id ) |
129 if ( !mailboxId ) |
130 { |
130 { |
131 // Remove box from settings |
131 // Remove box from settings |
132 iSettings->RemoveMailboxL( ii ); |
132 iSettings->RemoveMailboxL( ii ); |
133 // Array indexing changes now since one item was deleted |
133 // Array indexing changes now since one item was deleted |
134 ii--; |
134 ii--; |
135 } |
135 } |
136 else |
136 else |
137 { |
137 { |
138 CleanupStack::PushL( mailbox ); |
138 CleanupStack::PushL( mailbox ); |
139 CMailMailboxDetails* mailboxDetails = CreateMailboxDetailsL( *mailbox ); |
139 TInt id(1); |
140 CleanupStack::PushL( mailboxDetails ); |
140 while (id) |
141 TBuf<KMaxDescLen> cid; |
141 { |
142 iSettings->GetContentId(id, cid); |
142 CMailMailboxDetails* mailboxDetails = CreateMailboxDetailsL( *mailbox ); |
143 mailboxDetails->SetWidgetInstance(cid); |
143 CleanupStack::PushL( mailboxDetails ); |
144 iAccountsArray.AppendL( mailboxDetails ); |
144 |
145 CleanupStack::Pop( mailboxDetails ); |
145 if (id > 1) |
|
146 { |
|
147 iiMax = iiMax - 1; |
|
148 } |
|
149 TBuf<KMaxDescLen> cid; |
|
150 id = iSettings->GetContentId(mailboxId, id, cid); |
|
151 mailboxDetails->SetWidgetInstance(cid); |
|
152 iAccountsArray.AppendL( mailboxDetails ); |
|
153 |
|
154 CleanupStack::Pop( mailboxDetails ); |
|
155 } |
|
156 |
146 CleanupStack::PopAndDestroy( mailbox ); |
157 CleanupStack::PopAndDestroy( mailbox ); |
147 } |
158 } |
148 } |
159 } |
149 } |
160 } |
150 |
161 |