--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/src/main.cpp Mon Sep 13 13:26:33 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <QApplication>
+
+#include "tsrunningappserver.h"
+#include "tstaskmonitorglobals.h"
+#include <apgwgnam.h>
+#include <eikenv.h>
+
+#include <caservice.h>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ // hide server from TaskSwitcher
+ CEikonEnv * env = CEikonEnv::Static();
+ if(env) {
+ env->RootWin().SetOrdinalPosition(0, ECoeWinPriorityNeverAtFront);
+
+ CApaWindowGroupName *wgName = CApaWindowGroupName::NewLC(env->WsSession());
+ wgName->SetHidden(ETrue); // hides us from FSW and protects us from OOM FW etc.
+ wgName->SetSystem(ETrue); // Allow only application with PowerManagement cap to shut us down
+ wgName->SetCaptionL(KRunningAppServerName);
+ wgName->SetWindowGroupName(env->RootWin());
+ CleanupStack::PopAndDestroy(wgName);
+ }
+
+ // maintain instance of caservice (needed for getting application icons)
+ QSharedPointer<CaService> service = CaService::instance();
+
+ CServer2* serverObject = CTsRunningAppServer::NewLC();
+ CleanupStack::Pop(serverObject);
+
+ RSemaphore semaphore;
+ if (KErrNone == semaphore.OpenGlobal(KTsServerReadySemaphore)) {
+ semaphore.Signal();
+ }
+ semaphore.Close();
+
+ int result = app.exec();
+
+ delete serverObject;
+ return result;
+}