|
1 /* |
|
2 * Copyright (c) 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: A list of CVCommandUiEntry-objects |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <vcommandapi.h> |
|
21 #include <mmfcontrollerpluginresolver.h> |
|
22 #include "vcommanduientryarray.h" |
|
23 #include "rubydebug.h" |
|
24 |
|
25 // ---------------------------------------------------------------------------- |
|
26 // CVCommandUiEntryArray::NewL |
|
27 // ---------------------------------------------------------------------------- |
|
28 // |
|
29 CVCommandUiEntryArray* CVCommandUiEntryArray::NewL( CVCommandArray* aArray ) |
|
30 { |
|
31 RUBY_DEBUG_BLOCK( "CVCommandUiEntryArray::NewL" ); |
|
32 CVCommandUiEntryArray* self = new (ELeave) CVCommandUiEntryArray( aArray ); |
|
33 CleanupStack::PushL( self ); |
|
34 self->ConstructL(); |
|
35 CleanupStack::Pop( self ); |
|
36 return self; |
|
37 } |
|
38 |
|
39 // ---------------------------------------------------------------------------- |
|
40 // CVCommandUiEntryArray::CVCommandUiEntryArray |
|
41 // ---------------------------------------------------------------------------- |
|
42 // |
|
43 CVCommandUiEntryArray::CVCommandUiEntryArray( CVCommandArray* aArray ) |
|
44 : iCommands(aArray) |
|
45 { |
|
46 } |
|
47 |
|
48 // ---------------------------------------------------------------------------- |
|
49 // CVCommandUiEntryArray::ConstructL |
|
50 // ---------------------------------------------------------------------------- |
|
51 // |
|
52 void CVCommandUiEntryArray::ConstructL() |
|
53 { |
|
54 RUBY_DEBUG_BLOCKL( "CVCommandUiEntryArray::ConstructL" ); |
|
55 |
|
56 for( TInt i( 0 ); i < iCommands->Count(); i++ ) |
|
57 { |
|
58 CVCommandUiEntry* addition |
|
59 = CVCommandUiEntry::NewL( iCommands->At( i ) ); |
|
60 CleanupStack::PushL( addition ); |
|
61 iListBoxCommands.AppendL( addition ); |
|
62 CleanupStack::Pop( addition ); |
|
63 } |
|
64 } |
|
65 |
|
66 // ---------------------------------------------------------------------------- |
|
67 // CVCommandUiEntryArray::~CVCommandUiEntryArray |
|
68 // ---------------------------------------------------------------------------- |
|
69 // |
|
70 CVCommandUiEntryArray::~CVCommandUiEntryArray() |
|
71 { |
|
72 iListBoxCommands.ResetAndDestroy(); |
|
73 delete iCommands; |
|
74 } |
|
75 |
|
76 // ---------------------------------------------------------------------------- |
|
77 // CVCommandUiEntryArray::At |
|
78 // ---------------------------------------------------------------------------- |
|
79 // |
|
80 const CVCommandUiEntry& CVCommandUiEntryArray::At( TInt aIndex ) const |
|
81 { |
|
82 return *iListBoxCommands[ aIndex ]; |
|
83 } |
|
84 |
|
85 // ---------------------------------------------------------------------------- |
|
86 // CVCommandUiEntryArray::operator[] |
|
87 // ---------------------------------------------------------------------------- |
|
88 // |
|
89 const CVCommandUiEntry& CVCommandUiEntryArray::operator[]( TInt aIndex ) const |
|
90 { |
|
91 return At( aIndex ); |
|
92 } |
|
93 |
|
94 // ---------------------------------------------------------------------------- |
|
95 // CVCommandUiEntryArray::Count |
|
96 // ---------------------------------------------------------------------------- |
|
97 // |
|
98 TInt CVCommandUiEntryArray::Count() const |
|
99 { |
|
100 return iListBoxCommands.Count(); |
|
101 } |
|
102 |
|
103 // ---------------------------------------------------------------------------- |
|
104 // CVCommandUiEntryArray::iView->Clone |
|
105 // ---------------------------------------------------------------------------- |
|
106 // |
|
107 CVCommandUiEntryArray* CVCommandUiEntryArray::CloneL() |
|
108 { |
|
109 RVCommandArray vcommands; |
|
110 CleanupResetAndDestroyPushL( vcommands ); |
|
111 |
|
112 for( TInt i( 0 ); i < iCommands->Count(); i++ ) |
|
113 { |
|
114 vcommands.AppendL( CVCommand::NewL( iCommands->At( i ) ) ); |
|
115 } |
|
116 |
|
117 CVCommandArray* array = CVCommandArray::NewL( vcommands ); |
|
118 CleanupStack::PopAndDestroy( &vcommands ); |
|
119 |
|
120 CleanupStack::PushL( array ); |
|
121 |
|
122 CVCommandUiEntryArray* ret = CVCommandUiEntryArray::NewL( array ); |
|
123 |
|
124 CleanupStack::Pop( array ); |
|
125 |
|
126 return ret; |
|
127 } |
|
128 |
|
129 |
|
130 //End of file |