5
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-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 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <avkon.hrh>
|
|
20 |
#include <aknnotewrappers.h>
|
|
21 |
#include <e32svr.h>
|
|
22 |
#include <StifParser.h>
|
|
23 |
#include <Stiftestinterface.h>
|
|
24 |
#include <LiwServiceHandler.h>
|
|
25 |
#include "appmanagerservice.h"
|
|
26 |
#include "appmanagercommon.h"
|
|
27 |
#include <f32file.h>
|
|
28 |
#include <e32des16.h>
|
|
29 |
#include <e32base.h>
|
|
30 |
|
|
31 |
#include "appmanagerservice.h"
|
|
32 |
|
|
33 |
#include "testappmngui.pan"
|
|
34 |
#include "testappmnguiAppUi.h"
|
|
35 |
#include "testappmnguiAppView.h"
|
|
36 |
#include "testappmngui.hrh"
|
|
37 |
#include "testappobserver.h"
|
|
38 |
|
|
39 |
_LIT8(KContent,"Type");
|
|
40 |
_LIT8(KDocumentPath,"DocumentPath");
|
|
41 |
_LIT8(KMimeType,"MimeType");
|
|
42 |
_LIT8(KMode,"Mode");
|
|
43 |
_LIT8(KPostion,"Position");
|
|
44 |
_LIT8(KHandle,"Handle");
|
|
45 |
_LIT8(KDocument,"Document");
|
|
46 |
_LIT(KNull,"NULL");
|
|
47 |
|
|
48 |
_LIT8(KService, "Service.AppManager");
|
|
49 |
_LIT8(KIAppManager,"IAppManager");
|
|
50 |
_LIT8(KTransactionID,"TransactionID");
|
|
51 |
_LIT8(KCmdLine,"CmdLine");
|
|
52 |
|
|
53 |
_LIT8(KApplicationID,"ApplicationID");
|
|
54 |
_LIT8(KDocumentName,"DocumentName");
|
|
55 |
|
|
56 |
//Supported Operation
|
|
57 |
_LIT8(KGetList, "GetList");
|
|
58 |
_LIT8(KLaunchApp,"LaunchApp");
|
|
59 |
_LIT8(KLaunchDoc,"LaunchDoc");
|
|
60 |
|
|
61 |
_LIT8(KResponse,"ReturnValue");
|
|
62 |
_LIT8(KErrorCode,"ErrorCode");
|
|
63 |
_LIT8(KOptions,"Options");
|
|
64 |
|
|
65 |
// Filter Map
|
|
66 |
_LIT8(KFilter,"Filter");
|
|
67 |
|
|
68 |
const TInt KDocMaxDigitsInHexString = 8; // 32 bits.
|
|
69 |
|
|
70 |
// ConstructL is called by the application framework
|
|
71 |
void CtestappmnguiAppUi::ConstructL()
|
|
72 |
{
|
|
73 |
BaseConstructL();
|
|
74 |
|
|
75 |
iAppView = CtestappmnguiAppView::NewL(ClientRect());
|
|
76 |
|
|
77 |
AddToStackL(iAppView);
|
|
78 |
}
|
|
79 |
|
|
80 |
CtestappmnguiAppUi::CtestappmnguiAppUi()
|
|
81 |
{
|
|
82 |
// no implementation required
|
|
83 |
}
|
|
84 |
|
|
85 |
CtestappmnguiAppUi::~CtestappmnguiAppUi()
|
|
86 |
{
|
|
87 |
if (iAppView)
|
|
88 |
{
|
|
89 |
RemoveFromStack(iAppView);
|
|
90 |
delete iAppView;
|
|
91 |
iAppView = NULL;
|
|
92 |
}
|
|
93 |
}
|
|
94 |
|
|
95 |
// handle any menu commands
|
|
96 |
void CtestappmnguiAppUi::HandleCommandL(TInt aCommand)
|
|
97 |
{
|
|
98 |
switch(aCommand)
|
|
99 |
{
|
|
100 |
case EEikCmdExit:
|
|
101 |
case EAknSoftkeyExit:
|
|
102 |
Exit();
|
|
103 |
break;
|
|
104 |
|
|
105 |
case EtestappmnguiCommand1:
|
|
106 |
{
|
|
107 |
|
|
108 |
CAppManagerService* coreClass = CAppManagerService::NewL();
|
|
109 |
CAppObserver *observer = CAppObserver::NewL();
|
|
110 |
TOptions options;
|
|
111 |
TDocument criteria;
|
|
112 |
TBuf<100> filename;
|
|
113 |
options.iMode.Set(_L("Chained"));
|
|
114 |
|
|
115 |
options.iDocument.Set(_L("c:\\Data\\Images\\Test1.jpg" ));
|
|
116 |
|
|
117 |
TRAPD(err,coreClass->LaunchApplicationL(_L("s60uid://0x101f4d90"),KNullDesC8 ,options,observer,1) );
|
|
118 |
observer->wait->Start();
|
|
119 |
delete observer;
|
|
120 |
delete coreClass;
|
|
121 |
|
|
122 |
|
|
123 |
}
|
|
124 |
break;
|
|
125 |
|
|
126 |
|
|
127 |
case EtestappmnguiCommand2:
|
|
128 |
{
|
|
129 |
CAppManagerService* coreClass = CAppManagerService::NewL();
|
|
130 |
CAppObserver *observer = CAppObserver::NewL();
|
|
131 |
TOptions options;
|
|
132 |
TDocument criteria;
|
|
133 |
TBuf<100> filename;
|
|
134 |
options.iMode.Set(_L("Chained"));
|
|
135 |
|
|
136 |
criteria.iPath.Set(_L("c:\\Data\\Images\\Test1.jpg" ));
|
|
137 |
|
|
138 |
TRAPD(err,coreClass->LaunchDocumentL(criteria,KNullDesC8 ,options,filename,observer,2) );
|
|
139 |
observer->wait->Start();
|
|
140 |
delete observer;
|
|
141 |
delete coreClass;
|
|
142 |
|
|
143 |
}
|
|
144 |
break;
|
|
145 |
|
|
146 |
default:
|
|
147 |
Panic(EtestappmnguiBasicUi);
|
|
148 |
break;
|
|
149 |
}
|
|
150 |
}
|
|
151 |
|
|
152 |
|
|
153 |
// This function is not used right now but may be used in future onec we support
|
|
154 |
// launching thorugh buffer
|
|
155 |
|
|
156 |
|
|
157 |
TInt CtestappmnguiAppUi::GetBufferFromFile(HBufC8*& aBuffer, const TDesC& aFileName)
|
|
158 |
{
|
|
159 |
|
|
160 |
RFs fsSession;
|
|
161 |
fsSession.Connect();
|
|
162 |
if (fsSession.IsValidName(aFileName))
|
|
163 |
{
|
|
164 |
|
|
165 |
RFile temp;
|
|
166 |
temp.Open(fsSession,aFileName,EFileShareReadersOnly);
|
|
167 |
const TInt preferredBufSize = 400000;
|
|
168 |
HBufC8* const buffer=HBufC8::New(Max(8, preferredBufSize)); // 8 is a sensible minimum
|
|
169 |
if (buffer==NULL)
|
|
170 |
{
|
|
171 |
return KErrNoMemory;
|
|
172 |
}
|
|
173 |
|
|
174 |
TPtr8 buffer_asWritable(buffer->Des());
|
|
175 |
const TInt error=fsSession.ReadFileSection(aFileName, 0, buffer_asWritable, preferredBufSize);
|
|
176 |
if (error!=KErrNone)
|
|
177 |
{
|
|
178 |
delete buffer;
|
|
179 |
}
|
|
180 |
else
|
|
181 |
{
|
|
182 |
aBuffer=buffer;
|
|
183 |
}
|
|
184 |
|
|
185 |
fsSession.Close();
|
|
186 |
return error;
|
|
187 |
}
|
|
188 |
|
|
189 |
}
|
|
190 |
|