equal
deleted
inserted
replaced
19 #include <ecom/ecom.h> |
19 #include <ecom/ecom.h> |
20 #include <StringLoader.h> |
20 #include <StringLoader.h> |
21 #include <emailwidget.rsg> |
21 #include <emailwidget.rsg> |
22 #include <AknUtils.h> |
22 #include <AknUtils.h> |
23 #include <apgcli.h> |
23 #include <apgcli.h> |
|
24 #include <centralrepository.h> |
|
25 #include <starterdomaincrkeys.h> |
24 |
26 |
25 #include "emailtrace.h" |
27 #include "emailtrace.h" |
26 #include "CFSMailClient.h" |
28 #include "CFSMailClient.h" |
27 #include "CFSMailBox.h" |
29 #include "CFSMailBox.h" |
28 #include "CFSMailFolder.h" |
30 #include "CFSMailFolder.h" |
134 ii--; |
136 ii--; |
135 } |
137 } |
136 else |
138 else |
137 { |
139 { |
138 CleanupStack::PushL( mailbox ); |
140 CleanupStack::PushL( mailbox ); |
139 TInt id(1); |
141 CMailMailboxDetails* mailboxDetails = CreateMailboxDetailsL( *mailbox ); |
140 while (id) |
142 CleanupStack::PushL( mailboxDetails ); |
141 { |
|
142 CMailMailboxDetails* mailboxDetails = CreateMailboxDetailsL( *mailbox ); |
|
143 CleanupStack::PushL( mailboxDetails ); |
|
144 |
143 |
145 if (id > 1) |
144 TBuf<KMaxDescLen> cid; |
146 { |
145 TInt next(1); |
147 iiMax = iiMax - 1; |
146 |
148 } |
147 // Check if same mailbox is already in iAccountsArray once or more |
149 TBuf<KMaxDescLen> cid; |
148 for ( TInt i = 0; i < iAccountsArray.Count(); i++ ) |
150 id = iSettings->GetContentId(mailboxId, id, cid); |
149 { |
151 mailboxDetails->SetWidgetInstance(cid); |
150 TInt id = (TInt)iAccountsArray[i]->iMailboxId.Id(); |
152 iAccountsArray.AppendL( mailboxDetails ); |
151 if (id == mailboxId) |
153 |
152 { |
154 CleanupStack::Pop( mailboxDetails ); |
153 next++; |
155 } |
154 } |
156 |
155 } |
|
156 iSettings->GetContentId(mailboxId, next, cid); |
|
157 mailboxDetails->SetWidgetInstance(cid); |
|
158 iAccountsArray.AppendL( mailboxDetails ); |
|
159 CleanupStack::Pop( mailboxDetails ); |
157 CleanupStack::PopAndDestroy( mailbox ); |
160 CleanupStack::PopAndDestroy( mailbox ); |
158 } |
161 } |
159 } |
162 } |
160 } |
163 } |
161 |
164 |
337 TFSMailMsgId parentFolder( mailbox->GetStandardFolderId( EFSInbox ) ); |
340 TFSMailMsgId parentFolder( mailbox->GetStandardFolderId( EFSInbox ) ); |
338 // Check that folder is correct |
341 // Check that folder is correct |
339 CFSMailFolder* folder = MailClient().GetFolderByUidL( mailBoxId, parentFolder ); |
342 CFSMailFolder* folder = MailClient().GetFolderByUidL( mailBoxId, parentFolder ); |
340 if ( !folder ) |
343 if ( !folder ) |
341 { |
344 { |
|
345 UpdateEmptyMessagesL( aWidgetInstance, aRow ); |
342 return; |
346 return; |
343 } |
347 } |
344 CleanupStack::PushL( folder ); |
348 CleanupStack::PushL( folder ); |
345 |
349 |
346 TInt msgCount = folder->GetMessageCount(); |
350 TInt msgCount = folder->GetMessageCount(); |
1610 |
1614 |
1611 // --------------------------------------------------------------------------- |
1615 // --------------------------------------------------------------------------- |
1612 // CMailCpsHandler::DissociateWidget |
1616 // CMailCpsHandler::DissociateWidget |
1613 // --------------------------------------------------------------------------- |
1617 // --------------------------------------------------------------------------- |
1614 // |
1618 // |
1615 void CMailCpsHandler::DissociateWidgetFromSetting( const TDesC& aContentId ) |
1619 void CMailCpsHandler::DissociateWidgetFromSettingL( const TDesC& aContentId ) |
1616 { |
1620 { |
1617 FUNC_LOG; |
1621 FUNC_LOG; |
1618 iSettings->DissociateWidgetFromSetting( aContentId ); |
1622 iSettings->DissociateWidgetFromSettingL( aContentId ); |
1619 } |
1623 } |
1620 |
1624 |
1621 // --------------------------------------------------------------------------- |
1625 // --------------------------------------------------------------------------- |
1622 // CMailCpsHandler::GetMailboxCount |
1626 // CMailCpsHandler::GetMailboxCount |
1623 // --------------------------------------------------------------------------- |
1627 // --------------------------------------------------------------------------- |
1625 TInt CMailCpsHandler::GetMailboxCount() |
1629 TInt CMailCpsHandler::GetMailboxCount() |
1626 { |
1630 { |
1627 FUNC_LOG; |
1631 FUNC_LOG; |
1628 return iSettings->GetTotalMailboxCount(); |
1632 return iSettings->GetTotalMailboxCount(); |
1629 } |
1633 } |
|
1634 |
|
1635 // --------------------------------------------------------------------------- |
|
1636 // CMailCpsHandler::ManualAccountSelectionL |
|
1637 // --------------------------------------------------------------------------- |
|
1638 // |
|
1639 void CMailCpsHandler::ManualAccountSelectionL( const TDesC& aContentId ) |
|
1640 { |
|
1641 FUNC_LOG; |
|
1642 |
|
1643 if ( FirstBootL() ) |
|
1644 { |
|
1645 if (!iSettings->FindFromContentIdListL(aContentId)) |
|
1646 { |
|
1647 iSettings->AddToContentIdListL(aContentId); |
|
1648 } |
|
1649 } |
|
1650 else |
|
1651 { |
|
1652 if (!iSettings->FindFromContentIdListL(aContentId)) |
|
1653 { |
|
1654 iSettings->AddToContentIdListL(aContentId); |
|
1655 if (GetMailboxCount()) |
|
1656 { |
|
1657 LaunchWidgetSettingsL(aContentId); |
|
1658 } |
|
1659 else |
|
1660 { |
|
1661 LaunchEmailWizardL(); |
|
1662 } |
|
1663 } |
|
1664 } |
|
1665 } |
|
1666 |
|
1667 // --------------------------------------------------------------------------- |
|
1668 // CMailCpsHandler::FirstBootL |
|
1669 // --------------------------------------------------------------------------- |
|
1670 TBool CMailCpsHandler::FirstBootL() |
|
1671 { |
|
1672 FUNC_LOG; |
|
1673 TInt value( 0 ); |
|
1674 TBool ret(EFalse); |
|
1675 |
|
1676 CRepository* repository(NULL); |
|
1677 |
|
1678 TRAPD( err, repository = CRepository::NewL( KCRUidStartup ) ); |
|
1679 if ( err == KErrNone ) |
|
1680 { |
|
1681 err = repository->Get( KStartupFirstBoot, value ); |
|
1682 } |
|
1683 delete repository; |
|
1684 |
|
1685 if (!value) |
|
1686 { |
|
1687 ret = ETrue; |
|
1688 } |
|
1689 |
|
1690 return ret; |
|
1691 } |
|
1692 |