18 #include <e32property.h> // RProperty |
18 #include <e32property.h> // RProperty |
19 #include <s32mem.h> // RDesRead/WriteStream |
19 #include <s32mem.h> // RDesRead/WriteStream |
20 |
20 |
21 #include "emailinterfacefactoryimpl.h" |
21 #include "emailinterfacefactoryimpl.h" |
22 #include "emailcontent.h" |
22 #include "emailcontent.h" |
23 #include "cfsmailclient.h" |
23 #include "CFSMailClient.h" |
24 #include "emailclientapiimpldefs.h" |
24 #include "emailclientapiimpldefs.h" |
25 #include "emailclientapiimpl.h" |
25 #include "emailclientapiimpl.h" |
26 #include "emailaddress.h" |
26 #include "emailaddress.h" |
27 #include "emailmessagesearch.h" |
27 #include "emailmessagesearch.h" |
28 #include "emailshutdownconst.h" |
28 #include "emailshutdownconst.h" |
31 const TInt KEmailUidExtraBuffer = 2 * KEmailPlatformApiUidItemSize; |
31 const TInt KEmailUidExtraBuffer = 2 * KEmailPlatformApiUidItemSize; |
32 |
32 |
33 // --------------------------------------------------------------------------- |
33 // --------------------------------------------------------------------------- |
34 // Email client API panic wrapper |
34 // Email client API panic wrapper |
35 // --------------------------------------------------------------------------- |
35 // --------------------------------------------------------------------------- |
36 // |
|
37 void Panic( TEmailImplPanic aPanic ) |
36 void Panic( TEmailImplPanic aPanic ) |
38 { |
37 { |
39 User::Panic( KEmailImplPanic(), aPanic ); |
38 User::Panic( KEmailImplPanic(), aPanic ); |
40 } |
39 } |
41 |
40 |
42 // ======== MEMBER FUNCTIONS ======== |
41 // ======== MEMBER FUNCTIONS ======== |
43 |
42 |
44 // --------------------------------------------------------------------------- |
43 // --------------------------------------------------------------------------- |
45 // CEmailInterfaceFactoryImpl::NewL |
44 // CEmailInterfaceFactoryImpl::NewL |
46 // --------------------------------------------------------------------------- |
45 // --------------------------------------------------------------------------- |
47 // |
|
48 CEmailInterfaceFactoryImpl* CEmailInterfaceFactoryImpl::NewL() |
46 CEmailInterfaceFactoryImpl* CEmailInterfaceFactoryImpl::NewL() |
49 { |
47 { |
50 CEmailInterfaceFactoryImpl* self = new (ELeave) CEmailInterfaceFactoryImpl(); |
48 CEmailInterfaceFactoryImpl* self = new (ELeave) CEmailInterfaceFactoryImpl(); |
51 CleanupStack::PushL( self ); |
49 CleanupStack::PushL( self ); |
52 self->ConstructL(); |
50 self->ConstructL(); |
53 CleanupStack::Pop( self ); |
51 CleanupStack::Pop( self ); |
54 return self; |
52 return self; |
55 } |
53 } |
56 |
54 |
57 // --------------------------------------------------------------------------- |
55 // --------------------------------------------------------------------------- |
58 // CEmailInterfaceFactoryImpl::~CEmailInterfaceFactoryImpl |
56 // CEmailInterfaceFactoryImpl::~CEmailInterfaceFactoryImpl |
59 // --------------------------------------------------------------------------- |
57 // --------------------------------------------------------------------------- |
60 // |
|
61 CEmailInterfaceFactoryImpl::~CEmailInterfaceFactoryImpl() |
58 CEmailInterfaceFactoryImpl::~CEmailInterfaceFactoryImpl() |
62 { |
59 { |
63 TRAP_IGNORE( AppendOrRemoveUidL( EEmailUidModeRemove ) ); |
60 TRAP_IGNORE( AppendOrRemoveUidL( EEmailUidModeRemove ) ); |
64 } |
61 } |
65 |
62 |
66 // --------------------------------------------------------------------------- |
63 // --------------------------------------------------------------------------- |
67 // CEmailInterfaceFactoryImpl::CEmailInterfaceFactoryImpl |
64 // CEmailInterfaceFactoryImpl::CEmailInterfaceFactoryImpl |
68 // --------------------------------------------------------------------------- |
65 // --------------------------------------------------------------------------- |
69 // |
|
70 CEmailInterfaceFactoryImpl::CEmailInterfaceFactoryImpl() : |
66 CEmailInterfaceFactoryImpl::CEmailInterfaceFactoryImpl() : |
71 CEmailInterfaceFactory() |
67 CEmailInterfaceFactory() |
72 { |
68 { |
73 } |
69 } |
74 |
70 |
75 // --------------------------------------------------------------------------- |
71 // --------------------------------------------------------------------------- |
76 // CEmailInterfaceFactoryImpl::ConstructL |
72 // CEmailInterfaceFactoryImpl::ConstructL |
77 // --------------------------------------------------------------------------- |
73 // --------------------------------------------------------------------------- |
78 // |
|
79 void CEmailInterfaceFactoryImpl::ConstructL() |
74 void CEmailInterfaceFactoryImpl::ConstructL() |
80 { |
75 { |
81 // This leaves if related P&S keys are not defined by EmailServerMonitor, |
76 // This leaves if related P&S keys are not defined by EmailServerMonitor, |
82 // so EmailServerMonitor need to be started before using client API. |
77 // so EmailServerMonitor need to be started before using client API. |
83 // TRAP_IGNORE should be removed after EmailServerMonitor is added to |
78 // TRAP_IGNORE should be removed after EmailServerMonitor is added to |
86 } |
81 } |
87 |
82 |
88 // --------------------------------------------------------------------------- |
83 // --------------------------------------------------------------------------- |
89 // CEmailInterfaceFactoryImpl::InterfaceL |
84 // CEmailInterfaceFactoryImpl::InterfaceL |
90 // --------------------------------------------------------------------------- |
85 // --------------------------------------------------------------------------- |
91 // |
|
92 MEmailInterface* CEmailInterfaceFactoryImpl::InterfaceL( const TInt aInterfaceId ) |
86 MEmailInterface* CEmailInterfaceFactoryImpl::InterfaceL( const TInt aInterfaceId ) |
93 { |
87 { |
94 MEmailInterface* interface = NULL; |
88 MEmailInterface* interface = NULL; |
95 switch ( aInterfaceId ) |
89 switch ( aInterfaceId ) |
96 { |
90 { |
97 case KEmailClientApiInterface: |
91 case KEmailClientApiInterface: |
98 interface = CEmailClientApi::NewL(); |
92 interface = CEmailClientApi::NewL(); |
99 break; |
93 break; |
100 case KEmailIFUidTextContent: |
|
101 //interface = CEmailTextContent::NewL(); |
|
102 break; |
|
103 case KEmailIFUidAddress: |
94 case KEmailIFUidAddress: |
104 interface = CEmailAddress::NewL( MEmailAddress::EUndefined, EClientOwns ); |
95 interface = CEmailAddress::NewL( MEmailAddress::EUndefined, EClientOwns ); |
|
96 break; |
|
97 case KEmailIFUidTextContent: |
105 default: |
98 default: |
106 break; |
99 break; |
107 } |
100 } |
108 if ( !interface ) |
101 if ( !interface ) |
109 { |
102 { |