116
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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 |
#include <QApplication>
|
|
19 |
|
|
20 |
#include "tsrunningappserver.h"
|
|
21 |
#include "tstaskmonitorglobals.h"
|
|
22 |
#include <apgwgnam.h>
|
|
23 |
#include <eikenv.h>
|
|
24 |
|
|
25 |
int main(int argc, char *argv[])
|
|
26 |
{
|
119
|
27 |
RSemaphore semaphore;
|
|
28 |
int errNo( semaphore.CreateGlobal(KTsServerReadySemaphore, 0) );
|
|
29 |
if (KErrNone == errNo) {
|
|
30 |
QApplication app(argc, argv);
|
|
31 |
TRAP(errNo,
|
|
32 |
// hide server from TaskSwitcher
|
|
33 |
CEikonEnv * env = CEikonEnv::Static();
|
|
34 |
User::LeaveIfNull( env );
|
116
|
35 |
env->RootWin().SetOrdinalPosition(0, ECoeWinPriorityNeverAtFront);
|
119
|
36 |
CApaWindowGroupName *wgName = CApaWindowGroupName::NewLC(env->WsSession());
|
116
|
37 |
wgName->SetHidden(ETrue); // hides us from FSW and protects us from OOM FW etc.
|
119
|
38 |
wgName->SetSystem(ETrue); // Allow only application with PowerManagement cap to shut us down
|
|
39 |
wgName->SetCaptionL(KRunningAppServerName);
|
116
|
40 |
wgName->SetWindowGroupName(env->RootWin());
|
|
41 |
CleanupStack::PopAndDestroy(wgName);
|
119
|
42 |
CServer2* serverObject = CTsRunningAppServer::NewLC();
|
|
43 |
semaphore.Signal();
|
|
44 |
QT_TRYCATCH_LEAVING(errNo = app.exec());
|
|
45 |
User::LeaveIfError(errNo);
|
|
46 |
CleanupStack::PopAndDestroy(serverObject);
|
|
47 |
)//TRAP
|
|
48 |
semaphore.Close();
|
116
|
49 |
}
|
119
|
50 |
return errNo;
|
116
|
51 |
}
|