62
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 - 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: MpxCollectionTest test module.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
#include <mpxcollectionutility.h>
|
|
20 |
#include <mpxcollectionpath.h>
|
|
21 |
#include <stiflogger.h>
|
|
22 |
#include <e32cmn.h>
|
|
23 |
#include "testutility.h"
|
|
24 |
#include "pathoptionisremote.h"
|
|
25 |
|
|
26 |
// DATA TYPES
|
|
27 |
//Entry properties
|
|
28 |
_LIT(KTestRemoteTitle, "Title: %S");
|
|
29 |
_LIT(KTestRemoteState, "Remote: %S");
|
|
30 |
_LIT(KTestRemoteTrue, "YES");
|
|
31 |
_LIT(KTestRemoteFalse, "NO");
|
|
32 |
|
|
33 |
//CONSTANTS
|
|
34 |
const TInt KMaxStringSize = 256;
|
|
35 |
|
|
36 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
37 |
|
|
38 |
// -----------------------------------------------------------------------------
|
|
39 |
// CPathOptionIsRemote::NewL
|
|
40 |
// Two-phased constructor.
|
|
41 |
// -----------------------------------------------------------------------------
|
|
42 |
//
|
|
43 |
CPathOptionIsRemote* CPathOptionIsRemote::NewL(CConsoleMain* aConsoleMain,
|
|
44 |
CTestBaseView* aParent,
|
|
45 |
const TDesC& aName,
|
|
46 |
CStifLogger* aLogger,
|
|
47 |
CMPXCollectionPath* aPath)
|
|
48 |
{
|
|
49 |
CPathOptionIsRemote* self = new (ELeave) CPathOptionIsRemote(aConsoleMain,
|
|
50 |
aParent,
|
|
51 |
aName,
|
|
52 |
aLogger);
|
|
53 |
|
|
54 |
CleanupStack::PushL( self );
|
|
55 |
self->ConstructL(aPath);
|
|
56 |
CleanupStack::Pop( self );
|
|
57 |
|
|
58 |
return self;
|
|
59 |
}
|
|
60 |
|
|
61 |
// -----------------------------------------------------------------------------
|
|
62 |
// Destructor
|
|
63 |
// -----------------------------------------------------------------------------
|
|
64 |
CPathOptionIsRemote::~CPathOptionIsRemote()
|
|
65 |
{
|
|
66 |
iLogger->Log(_L("+CPathOptionIsRemote::~CPathOptionIsRemote"));
|
|
67 |
iCollectionUtility->Close();
|
|
68 |
if(iCollectionPath)
|
|
69 |
delete iCollectionPath;
|
|
70 |
iLogger->Log(_L("-CPathOptionIsRemote::~CPathOptionIsRemote"));
|
|
71 |
}
|
|
72 |
|
|
73 |
// -----------------------------------------------------------------------------
|
|
74 |
// From CTestBaseView
|
|
75 |
// Initialize the view before display view
|
|
76 |
// -----------------------------------------------------------------------------
|
|
77 |
void CPathOptionIsRemote::InitializeViewL()
|
|
78 |
{
|
|
79 |
iLogger->Log(_L("+CPathOptionIsRemoteL::InitializeViewL"));
|
|
80 |
TBuf<KMaxStringSize> outStr;
|
|
81 |
// TODO: uncomment this after Collection().EntryL() is implemented
|
|
82 |
/*CMPXCollectionEntry* entry =
|
|
83 |
iCollectionUtility->Collection().EntryL(*iCollectionPath);
|
|
84 |
|
|
85 |
if( entry )
|
|
86 |
{
|
|
87 |
//TODO: delete entry???
|
|
88 |
CleanupStack::PushL(entry);
|
|
89 |
//Output title
|
|
90 |
outStr.Format(KTestRemoteTitle, &(entry->Title()));
|
|
91 |
OutputStringL(outStr);
|
|
92 |
CleanupStack::PopAndDestroy(entry);
|
|
93 |
}*/
|
|
94 |
|
|
95 |
TBool remoteState =
|
|
96 |
iCollectionUtility->Collection().IsRemote(*iCollectionPath);
|
|
97 |
if(remoteState)
|
|
98 |
{
|
|
99 |
outStr.Format(KTestRemoteState, &KTestRemoteTrue);
|
|
100 |
}
|
|
101 |
else
|
|
102 |
{
|
|
103 |
outStr.Format(KTestRemoteState, &KTestRemoteFalse);
|
|
104 |
}
|
|
105 |
OutputStringL(outStr);
|
|
106 |
|
|
107 |
iLogger->Log(_L("-CPathOptionIsRemoteL::InitializeViewL"));
|
|
108 |
}
|
|
109 |
|
|
110 |
// -----------------------------------------------------------------------------
|
|
111 |
// From CTestBaseView
|
|
112 |
// Cleanup the view before deactivate/destroy view
|
|
113 |
// -----------------------------------------------------------------------------
|
|
114 |
void CPathOptionIsRemote::CleanupViewL()
|
|
115 |
{
|
|
116 |
}
|
|
117 |
|
|
118 |
// -----------------------------------------------------------------------------
|
|
119 |
// From CTestBaseView
|
|
120 |
// Handle number key press
|
|
121 |
// -----------------------------------------------------------------------------
|
|
122 |
void CPathOptionIsRemote::HandleNumKeyL()
|
|
123 |
{
|
|
124 |
TKeyCode key = LastKeyPressed();
|
|
125 |
}
|
|
126 |
|
|
127 |
// -----------------------------------------------------------------------------
|
|
128 |
// From CTestBaseView
|
|
129 |
// Handle left key press
|
|
130 |
// -----------------------------------------------------------------------------
|
|
131 |
void CPathOptionIsRemote::HandleLeftKeyL()
|
|
132 |
{
|
|
133 |
}
|
|
134 |
|
|
135 |
// -----------------------------------------------------------------------------
|
|
136 |
// From CTestBaseView
|
|
137 |
// Handle right/enter key press
|
|
138 |
// -----------------------------------------------------------------------------
|
|
139 |
void CPathOptionIsRemote::HandleRightKeyL()
|
|
140 |
{
|
|
141 |
}
|
|
142 |
|
|
143 |
// -----------------------------------------------------------------------------
|
|
144 |
// CCollectionBrowser::HandleCollectionMediaL
|
|
145 |
// -----------------------------------------------------------------------------
|
|
146 |
//
|
|
147 |
void CPathOptionIsRemote::HandleCollectionMediaL(
|
|
148 |
const CMPXMedia& /*aMedia*/,
|
|
149 |
TInt /*aError*/)
|
|
150 |
{
|
|
151 |
|
|
152 |
}
|
|
153 |
|
|
154 |
// -----------------------------------------------------------------------------
|
|
155 |
// CCollectionBrowser::HandleCollectionMessageL
|
|
156 |
// -----------------------------------------------------------------------------
|
|
157 |
//
|
|
158 |
void CPathOptionIsRemote::HandleCollectionMessageL(const TMPXCollectionMessage& /*aMessage*/)
|
|
159 |
{
|
|
160 |
|
|
161 |
}
|
|
162 |
|
|
163 |
// -----------------------------------------------------------------------------
|
|
164 |
// CCollectionBrowser::HandleCollectionMessageL
|
|
165 |
// -----------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
void CPathOptionIsRemote::HandleOpenL(const CMPXMedia& /*aEntries*/,
|
|
168 |
TInt /*aIndex*/,TBool /*aComplete*/,TInt /*aError*/)
|
|
169 |
{
|
|
170 |
|
|
171 |
}
|
|
172 |
|
|
173 |
// -----------------------------------------------------------------------------
|
|
174 |
// CCollectionBrowser::HandleCollectionMessageL
|
|
175 |
// -----------------------------------------------------------------------------
|
|
176 |
//
|
|
177 |
void CPathOptionIsRemote::HandleOpenL(const CMPXCollectionPlaylist& /*aPlaylist*/,TInt /*aError*/)
|
|
178 |
{
|
|
179 |
|
|
180 |
}
|
|
181 |
|
|
182 |
// -----------------------------------------------------------------------------
|
|
183 |
// C++ default constructor.
|
|
184 |
// -----------------------------------------------------------------------------
|
|
185 |
CPathOptionIsRemote::CPathOptionIsRemote(CConsoleMain* aConsoleMain,
|
|
186 |
CTestBaseView* aParent,
|
|
187 |
const TDesC& aName,
|
|
188 |
CStifLogger* aLogger)
|
|
189 |
: CTestMenuView(aConsoleMain, aParent, aName)
|
|
190 |
{
|
|
191 |
iLogger = aLogger;
|
|
192 |
iCollectionPath = NULL;
|
|
193 |
}
|
|
194 |
|
|
195 |
// -----------------------------------------------------------------------------
|
|
196 |
// Second phrase constructor
|
|
197 |
// -----------------------------------------------------------------------------
|
|
198 |
void CPathOptionIsRemote::ConstructL(CMPXCollectionPath* aPath)
|
|
199 |
{
|
|
200 |
iLogger->Log(_L("+CPathOptionIsRemote::ConstructL"));
|
|
201 |
iCollectionUtility = MMPXCollectionUtility::NewL( this );
|
|
202 |
iCollectionPath = CMPXCollectionPath::NewL(*aPath);
|
|
203 |
CTestMenuView::ConstructL();
|
|
204 |
iLogger->Log(_L("-CPathOptionIsRemote::ConstructL"));
|
|
205 |
}
|
|
206 |
|
|
207 |
// -----------------------------------------------------------------------------
|
|
208 |
// Output string
|
|
209 |
// -----------------------------------------------------------------------------
|
|
210 |
void CPathOptionIsRemote::OutputStringL(const TDesC& aStr)
|
|
211 |
{
|
|
212 |
// TestUtility::TestLog(iLogger, _L("%S\n"), &aStr);
|
|
213 |
AddItemL(aStr);
|
|
214 |
}
|
|
215 |
|