|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Implements SyncML AIW interest item functionality. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CPbkAiwInterestItemSyncMl.h" |
|
22 |
|
23 #include <CPbkContactEngine.h> |
|
24 #include "CPbkPocAddressSelect.h" |
|
25 #include <Phonebook.hrh> |
|
26 #include <CPbkAppGlobalsBase.h> |
|
27 #include <MPbkCommand.h> |
|
28 #include <MPbkCommandFactory.h> |
|
29 #include <MenuFilteringFlags.h> |
|
30 #include <MPbkAiwCommandObserver.h> |
|
31 |
|
32 #include <Phonebook.rsg> |
|
33 |
|
34 #include <cntdef.h> |
|
35 #include <AiwServiceHandler.h> |
|
36 #include <AiwCommon.hrh> |
|
37 #include <eikmenup.h> |
|
38 |
|
39 |
|
40 // ================= MEMBER FUNCTIONS ======================= |
|
41 |
|
42 inline CPbkAiwInterestItemSyncMl::CPbkAiwInterestItemSyncMl |
|
43 (CAiwServiceHandler& aServiceHandler, |
|
44 CPbkContactEngine& aEngine) : |
|
45 CPbkAiwInterestItemBase(aServiceHandler), |
|
46 iEngine(aEngine) |
|
47 { |
|
48 } |
|
49 |
|
50 |
|
51 CPbkAiwInterestItemSyncMl* CPbkAiwInterestItemSyncMl::NewL( |
|
52 CAiwServiceHandler& aServiceHandler, |
|
53 CPbkContactEngine& aEngine) |
|
54 { |
|
55 CPbkAiwInterestItemSyncMl* self = |
|
56 new (ELeave) CPbkAiwInterestItemSyncMl(aServiceHandler, aEngine); |
|
57 return self; |
|
58 } |
|
59 |
|
60 CPbkAiwInterestItemSyncMl::~CPbkAiwInterestItemSyncMl() |
|
61 { |
|
62 } |
|
63 |
|
64 |
|
65 TBool CPbkAiwInterestItemSyncMl::InitMenuPaneL( |
|
66 TInt aResourceId, |
|
67 CEikMenuPane& aMenuPane, |
|
68 TUint aFlags) |
|
69 { |
|
70 TBool ret(EFalse); |
|
71 |
|
72 // Normal menu |
|
73 if (aResourceId == R_PHONEBOOK_SYNCML_MENU) |
|
74 { |
|
75 ret = ETrue; |
|
76 |
|
77 // If the list is empty or it has marked items, hide syncMl option |
|
78 if (!(aFlags & KPbkControlEmpty) |
|
79 && !(aFlags & KPbkItemsMarked)) |
|
80 { |
|
81 // Let provider add its menu items to the menu |
|
82 iServiceHandler.InitializeMenuPaneL( |
|
83 aMenuPane, |
|
84 aResourceId, |
|
85 KAiwCmdSynchronize, |
|
86 iServiceHandler.InParamListL()); |
|
87 } |
|
88 else |
|
89 { |
|
90 aMenuPane.SetItemDimmed(KAiwCmdSynchronize, ETrue); |
|
91 } |
|
92 } |
|
93 |
|
94 return ret; |
|
95 } |
|
96 |
|
97 |
|
98 TBool CPbkAiwInterestItemSyncMl::HandleCommandL( |
|
99 TInt aMenuCommandId, |
|
100 const CContactIdArray& /*aContacts*/, |
|
101 const TPbkContactItemField* /*aFocusedField*/ /* =NULL */, |
|
102 TInt aServiceCommandId /* =KNullHandle */, |
|
103 MPbkAiwCommandObserver* aObserver /*= NULL*/) |
|
104 { |
|
105 TBool ret(EFalse); |
|
106 |
|
107 // Only handle this command if service command is syncMl |
|
108 // aiw service command uid |
|
109 if (aServiceCommandId == KAiwCmdSynchronize || |
|
110 aServiceCommandId == KAiwCmdSynchronizeSelected) |
|
111 { |
|
112 // Create the syncMl command object |
|
113 MPbkCommand* cmd = CPbkAppGlobalsBase::InstanceL()-> |
|
114 CommandFactory().CreateSyncMlCmdL( |
|
115 aMenuCommandId, |
|
116 iServiceHandler); |
|
117 // Execute the command |
|
118 cmd->ExecuteLD(); |
|
119 // Inform observer |
|
120 if (aObserver) |
|
121 { |
|
122 aObserver->AiwCommandHandledL(aMenuCommandId, |
|
123 aServiceCommandId, KErrNone); |
|
124 } |
|
125 ret = ETrue; |
|
126 } |
|
127 |
|
128 return ret; |
|
129 } |
|
130 |
|
131 void CPbkAiwInterestItemSyncMl::AttachL( |
|
132 TInt aMenuResourceId, |
|
133 TInt aInterestResourceId, |
|
134 TBool aAttachBaseServiceInterest) |
|
135 { |
|
136 // Always delegate to base class! |
|
137 CPbkAiwInterestItemBase::AttachL(aMenuResourceId, |
|
138 aInterestResourceId, |
|
139 aAttachBaseServiceInterest); |
|
140 } |
|
141 |
|
142 // End of File |