|
1 /* |
|
2 * Copyright (c) 2002-2004 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 the License "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: Supports Download Menu |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CDownloadMgrUiDownloadMenu.h" |
|
22 #include "UiLibLogger.h" |
|
23 #include <e32std.h> |
|
24 #include <e32def.h> |
|
25 #include <DownloadMgrUiLib.rsg> |
|
26 #include <coemain.h> |
|
27 #include <eikmenup.h> |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // CDownloadMgrUiDownloadMenu::CDownloadMgrUiDownloadMenu |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 CDownloadMgrUiDownloadMenu::CDownloadMgrUiDownloadMenu( CCoeEnv& aCoeEnv ) |
|
36 : iCoeEnv( aCoeEnv ) |
|
37 { |
|
38 } |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CDownloadMgrUiDownloadMenu::ConstructL |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 void CDownloadMgrUiDownloadMenu::ConstructL() |
|
45 { |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CDownloadMgrUiDownloadMenu::NewL |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CDownloadMgrUiDownloadMenu* CDownloadMgrUiDownloadMenu::NewL( CCoeEnv& aCoeEnv ) |
|
53 { |
|
54 CDownloadMgrUiDownloadMenu* self = |
|
55 new ( ELeave ) CDownloadMgrUiDownloadMenu( aCoeEnv ); |
|
56 CleanupStack::PushL( self ); |
|
57 self->ConstructL(); |
|
58 CleanupStack::Pop(); |
|
59 return self; |
|
60 } |
|
61 |
|
62 // Destructor |
|
63 CDownloadMgrUiDownloadMenu::~CDownloadMgrUiDownloadMenu() |
|
64 { |
|
65 CLOG_ENTERFN("CDownloadMgrUiDownloadMenu::~CDownloadMgrUiDownloadMenu"); |
|
66 //delete iExtension; |
|
67 iExtension = 0; |
|
68 CLOG_WRITE(" iExtension"); |
|
69 CLOG_LEAVEFN("CDownloadMgrUiDownloadMenu::~CDownloadMgrUiDownloadMenu"); |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CDownloadMgrUiDownloadMenu::AddMenuL |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 EXPORT_C |
|
77 void CDownloadMgrUiDownloadMenu::AddMenuL( TInt aCommandId, |
|
78 CEikMenuPane& aMenuPane, |
|
79 TInt aPreviousId ) |
|
80 { |
|
81 CLOG_ENTERFN("CDownloadMgrUiDownloadMenu::AddMenuL"); |
|
82 |
|
83 CEikMenuPaneItem::SData menuItemData; |
|
84 menuItemData.iCommandId = aCommandId; |
|
85 menuItemData.iFlags = 0; |
|
86 menuItemData.iCascadeId = 0; |
|
87 HBufC* menuText = iCoeEnv.AllocReadResourceLC( R_DMUL_DOWNLOADMENU_ITEM_TEXT ); |
|
88 // Max length of iText is ENominalTextLength! |
|
89 menuItemData.iText = menuText->Left( |
|
90 menuText->Length()>CEikMenuPaneItem::SData::ENominalTextLength ? |
|
91 CEikMenuPaneItem::SData::ENominalTextLength : menuText->Length() ); |
|
92 CleanupStack::PopAndDestroy( menuText ); // menuText |
|
93 if ( aPreviousId == KErrNotFound ) |
|
94 { |
|
95 aMenuPane.AddMenuItemL( menuItemData ); |
|
96 } |
|
97 else |
|
98 { |
|
99 aMenuPane.AddMenuItemL( menuItemData, aPreviousId ); |
|
100 } |
|
101 |
|
102 CLOG_LEAVEFN("CDownloadMgrUiDownloadMenu::AddMenuL"); |
|
103 } |
|
104 |
|
105 // End of file. |