0
|
1 |
/*
|
|
2 |
* Copyright (c) 2004, 2006 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDES
|
|
21 |
#include <eikappui.h>
|
|
22 |
#include <eikenv.h>
|
|
23 |
#include <eikapp.h>
|
|
24 |
#include <s32file.h>
|
|
25 |
#include <aknnotewrappers.h>
|
|
26 |
|
|
27 |
#include "EikonEnvironment.h"
|
|
28 |
|
|
29 |
// ============================ MEMBER FUNCTIONS ==============================
|
|
30 |
|
|
31 |
// ----------------------------------------------------------------------------
|
|
32 |
// NEikonEnvironment::AppFullName()
|
|
33 |
// Returns full name of the application.
|
|
34 |
// ----------------------------------------------------------------------------
|
|
35 |
//
|
|
36 |
TFileName NEikonEnvironment::AppFullName()
|
|
37 |
{
|
|
38 |
return EikAppUi().Application()->AppFullName();
|
|
39 |
}
|
|
40 |
|
|
41 |
// ----------------------------------------------------------------------------
|
|
42 |
// NEikonEnvironment::ApplicationDriveAndPath()
|
|
43 |
// Returns the drive and path of the application.
|
|
44 |
// ----------------------------------------------------------------------------
|
|
45 |
//
|
|
46 |
TFileName NEikonEnvironment::ApplicationDriveAndPath()
|
|
47 |
{
|
|
48 |
TParse parse;
|
|
49 |
//On WINS the application is on the z drive
|
|
50 |
#ifdef __WINS__
|
|
51 |
TFileName appfullname = AppFullName();
|
|
52 |
|
|
53 |
_LIT( KDriveC,"c:" ); //create literal
|
|
54 |
parse.Set(KDriveC, &appfullname, NULL);
|
|
55 |
#else
|
|
56 |
parse.Set(AppFullName(), NULL, NULL);
|
|
57 |
#endif
|
|
58 |
return parse.DriveAndPath();
|
|
59 |
}
|
|
60 |
|
|
61 |
// ----------------------------------------------------------------------------
|
|
62 |
// NEikonEnvironment::AddPath()
|
|
63 |
// Returns the drive, path and filename.
|
|
64 |
// ----------------------------------------------------------------------------
|
|
65 |
//
|
|
66 |
TFileName NEikonEnvironment::AddPath( const TDesC& aFileName )
|
|
67 |
{
|
|
68 |
//Check that we have not been sent a file name with the drive included
|
|
69 |
#ifdef _DEBUG
|
|
70 |
TParse theFile;
|
|
71 |
theFile.Set( aFileName, NULL, NULL );
|
|
72 |
ASSERT( theFile.Drive().Length() == 0 );
|
|
73 |
#endif
|
|
74 |
|
|
75 |
TParse thePath;
|
|
76 |
thePath.Set( ApplicationDriveAndPath(), &aFileName, NULL );
|
|
77 |
return thePath.FullName();
|
|
78 |
}
|
|
79 |
|
|
80 |
// ----------------------------------------------------------------------------
|
|
81 |
// NEikonEnvironment::EikEnv()
|
|
82 |
// Return a reference to the CEikonEnv
|
|
83 |
// ----------------------------------------------------------------------------
|
|
84 |
//
|
|
85 |
CEikonEnv& NEikonEnvironment::EikEnv()
|
|
86 |
{
|
|
87 |
return *CEikonEnv::Static();
|
|
88 |
}
|
|
89 |
|
|
90 |
// ----------------------------------------------------------------------------
|
|
91 |
// NEikonEnvironment::EikAppUi()
|
|
92 |
// Return a reference to the CEikAppUi
|
|
93 |
// ----------------------------------------------------------------------------
|
|
94 |
//
|
|
95 |
CEikAppUi& NEikonEnvironment::EikAppUi()
|
|
96 |
{
|
|
97 |
return *( EikEnv().EikAppUi() );
|
|
98 |
}
|
|
99 |
|
|
100 |
// ----------------------------------------------------------------------------
|
|
101 |
// NEikonEnvironment::EikDocument()
|
|
102 |
// Return a reference to CEikDocument.
|
|
103 |
// ----------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
CEikDocument& NEikonEnvironment::EikDocument()
|
|
106 |
{
|
|
107 |
return *( EikAppUi().Document() );
|
|
108 |
}
|
|
109 |
|
|
110 |
// ----------------------------------------------------------------------------
|
|
111 |
// NEikonEnvironment::AddToStackL()
|
|
112 |
// Add a control to the control stack.
|
|
113 |
// ----------------------------------------------------------------------------
|
|
114 |
//
|
|
115 |
void NEikonEnvironment::AddToStackL( CCoeControl& aControl,
|
|
116 |
TInt aPriority,
|
|
117 |
TInt aStackingFlags )
|
|
118 |
{
|
|
119 |
RemoveFromStack( aControl );
|
|
120 |
EikAppUi().AddToStackL( &aControl, aPriority, aStackingFlags );
|
|
121 |
}
|
|
122 |
|
|
123 |
// ----------------------------------------------------------------------------
|
|
124 |
// NEikonEnvironment::AddToStackL()
|
|
125 |
// Add a control to the control stack.
|
|
126 |
// ----------------------------------------------------------------------------
|
|
127 |
//
|
|
128 |
void NEikonEnvironment::AddToStackL( CCoeControl& aControl )
|
|
129 |
{
|
|
130 |
RemoveFromStack( aControl );
|
|
131 |
EikAppUi().AddToStackL( &aControl );
|
|
132 |
}
|
|
133 |
|
|
134 |
// ----------------------------------------------------------------------------
|
|
135 |
// NEikonEnvironment::RemoveFromStack()
|
|
136 |
// Remove a control from the control stack.
|
|
137 |
// ----------------------------------------------------------------------------
|
|
138 |
//
|
|
139 |
void NEikonEnvironment::RemoveFromStack( CCoeControl& aControl )
|
|
140 |
{
|
|
141 |
EikAppUi().RemoveFromStack( &aControl );
|
|
142 |
}
|
|
143 |
|
|
144 |
// ----------------------------------------------------------------------------
|
|
145 |
// NEikonEnvironment::MessageBox()
|
|
146 |
// Display a message box
|
|
147 |
// ----------------------------------------------------------------------------
|
|
148 |
//
|
|
149 |
void NEikonEnvironment::MessageBox( const TDesC& aMessage )
|
|
150 |
{
|
|
151 |
TRAPD( err,
|
|
152 |
CAknInformationNote* informationNote = new (
|
|
153 |
ELeave ) CAknInformationNote;
|
|
154 |
informationNote->ExecuteLD( aMessage );
|
|
155 |
);
|
|
156 |
if ( err != KErrNone )
|
|
157 |
{
|
|
158 |
_LIT( KHelperFunctionsPanic, "Helper" );
|
|
159 |
User::Panic( KHelperFunctionsPanic, 1 );
|
|
160 |
}
|
|
161 |
}
|
|
162 |
|
|
163 |
// ----------------------------------------------------------------------------
|
|
164 |
// NEikonEnvironment::FlushWindowServer()
|
|
165 |
// Flush the windows server to ensure all changes to the
|
|
166 |
// display are reflected on the screen
|
|
167 |
// ----------------------------------------------------------------------------
|
|
168 |
//
|
|
169 |
void NEikonEnvironment::FlushWindowServer()
|
|
170 |
{
|
|
171 |
CCoeEnv::Static()->WsSession().Flush();
|
|
172 |
}
|
|
173 |
|
|
174 |
// ----------------------------------------------------------------------------
|
|
175 |
// NEikonEnvironment::TheRFs()
|
|
176 |
// The eikon frameworks file server connection.
|
|
177 |
// ----------------------------------------------------------------------------
|
|
178 |
//
|
|
179 |
RFs& NEikonEnvironment::TheRFs()
|
|
180 |
{
|
|
181 |
return CCoeEnv::Static()->FsSession();
|
|
182 |
}
|
|
183 |
|
|
184 |
// End of File
|