|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Phonebook 2 SyncML AIW interest item. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "CPbk2AiwInterestItemSyncMl.h" |
|
20 |
|
21 // Phonebook 2 |
|
22 #include "CPbk2SyncMlCmd.h" |
|
23 #include <Pbk2Commands.hrh> |
|
24 #include <MPbk2Command.h> |
|
25 #include <MPbk2ContactUiControl.h> |
|
26 #include <Pbk2Commands.rsg> |
|
27 |
|
28 // System includes |
|
29 #include <AiwServiceHandler.h> |
|
30 #include <AiwCommon.hrh> |
|
31 #include <eikmenup.h> |
|
32 |
|
33 // -------------------------------------------------------------------------- |
|
34 // CPbk2AiwInterestItemSyncMl::CPbk2AiwInterestItemSyncMl |
|
35 // -------------------------------------------------------------------------- |
|
36 // |
|
37 inline CPbk2AiwInterestItemSyncMl::CPbk2AiwInterestItemSyncMl |
|
38 ( TInt aInterestId, CAiwServiceHandler& aServiceHandler ) : |
|
39 CPbk2AiwInterestItemBase( aInterestId, aServiceHandler ) |
|
40 { |
|
41 } |
|
42 |
|
43 // -------------------------------------------------------------------------- |
|
44 // CPbk2AiwInterestItemSyncMl::~CPbk2AiwInterestItemSyncMl |
|
45 // -------------------------------------------------------------------------- |
|
46 // |
|
47 CPbk2AiwInterestItemSyncMl::~CPbk2AiwInterestItemSyncMl() |
|
48 { |
|
49 } |
|
50 |
|
51 // -------------------------------------------------------------------------- |
|
52 // CPbk2AiwInterestItemSyncMl::NewL |
|
53 // -------------------------------------------------------------------------- |
|
54 // |
|
55 CPbk2AiwInterestItemSyncMl* CPbk2AiwInterestItemSyncMl::NewL |
|
56 ( TInt aInterestId, CAiwServiceHandler& aServiceHandler ) |
|
57 { |
|
58 CPbk2AiwInterestItemSyncMl* self = |
|
59 new ( ELeave ) CPbk2AiwInterestItemSyncMl |
|
60 ( aInterestId, aServiceHandler ); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // -------------------------------------------------------------------------- |
|
65 // CPbk2AiwInterestItemSyncMl::DynInitMenuPaneL |
|
66 // -------------------------------------------------------------------------- |
|
67 // |
|
68 TBool CPbk2AiwInterestItemSyncMl::DynInitMenuPaneL |
|
69 ( const TInt aResourceId, CEikMenuPane& aMenuPane, |
|
70 const MPbk2ContactUiControl& aControl ) |
|
71 { |
|
72 TBool ret = EFalse; |
|
73 |
|
74 // Normal menu |
|
75 if ( aResourceId == R_PHONEBOOK2_SYNCML_MENU ) |
|
76 { |
|
77 ret = ETrue; |
|
78 // If the list has marked items, hide SyncML option |
|
79 if ( !aControl.ContactsMarked() ) |
|
80 { |
|
81 // Let provider add its menu items to the menu |
|
82 iServiceHandler.InitializeMenuPaneL( |
|
83 aMenuPane, |
|
84 aResourceId, |
|
85 EPbk2CmdLast, |
|
86 iServiceHandler.InParamListL() ); |
|
87 } |
|
88 else |
|
89 { |
|
90 aMenuPane.SetItemDimmed( KAiwCmdSynchronize, ETrue ); |
|
91 } |
|
92 } |
|
93 |
|
94 return ret; |
|
95 } |
|
96 |
|
97 // -------------------------------------------------------------------------- |
|
98 // CPbk2AiwInterestItemSyncMl::HandleCommandL |
|
99 // -------------------------------------------------------------------------- |
|
100 // |
|
101 TBool CPbk2AiwInterestItemSyncMl::HandleCommandL |
|
102 ( const TInt aMenuCommandId, MPbk2ContactUiControl& /*aControl*/, |
|
103 TInt aServiceCommandId ) |
|
104 { |
|
105 TBool ret = EFalse; |
|
106 |
|
107 // Only handle this command if the service command is SyncML based |
|
108 if ( aServiceCommandId == KAiwCmdSynchronize || |
|
109 aServiceCommandId == KAiwCmdSynchronizeSelected ) |
|
110 { |
|
111 // Create the syncMl command object |
|
112 MPbk2Command* cmd = CPbk2SyncMlCmd::NewL( |
|
113 aMenuCommandId, iServiceHandler ); |
|
114 // Execute the command |
|
115 cmd->ExecuteLD(); |
|
116 ret = ETrue; |
|
117 } |
|
118 |
|
119 return ret; |
|
120 } |
|
121 |
|
122 // -------------------------------------------------------------------------- |
|
123 // CPbk2AiwInterestItemSyncMl::DoCancel |
|
124 // -------------------------------------------------------------------------- |
|
125 // |
|
126 void CPbk2AiwInterestItemSyncMl::DoCancel() |
|
127 { |
|
128 // Do nothing |
|
129 } |
|
130 |
|
131 // -------------------------------------------------------------------------- |
|
132 // CPbk2AiwInterestItemSyncMl::RunL |
|
133 // -------------------------------------------------------------------------- |
|
134 // |
|
135 void CPbk2AiwInterestItemSyncMl::RunL() |
|
136 { |
|
137 // Do nothing |
|
138 } |
|
139 |
|
140 // End of File |