taskswitcher/server/src/main.cpp
changeset 121 0b3699f6c654
child 119 50e220be30d1
equal deleted inserted replaced
115:3ab5c078b490 121:0b3699f6c654
       
     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 #include <caservice.h>
       
    26 
       
    27 int main(int argc, char *argv[]) 
       
    28 {
       
    29     QApplication app(argc, argv);
       
    30     
       
    31     // hide server from TaskSwitcher
       
    32     CEikonEnv * env = CEikonEnv::Static();
       
    33     if(env) {
       
    34         env->RootWin().SetOrdinalPosition(0, ECoeWinPriorityNeverAtFront);
       
    35 
       
    36         CApaWindowGroupName *wgName = CApaWindowGroupName::NewLC(env->WsSession());    
       
    37         wgName->SetHidden(ETrue); // hides us from FSW and protects us from OOM FW etc.
       
    38         wgName->SetSystem(ETrue); // Allow only application with PowerManagement cap to shut us down    
       
    39         wgName->SetCaptionL(KRunningAppServerName);    
       
    40         wgName->SetWindowGroupName(env->RootWin());
       
    41         CleanupStack::PopAndDestroy(wgName);
       
    42     }
       
    43     
       
    44     // maintain instance of caservice (needed for getting application icons)
       
    45     QSharedPointer<CaService> service = CaService::instance();    
       
    46     
       
    47     CServer2* serverObject = CTsRunningAppServer::NewLC();    
       
    48     CleanupStack::Pop(serverObject);
       
    49     
       
    50     RSemaphore semaphore;
       
    51     if (KErrNone == semaphore.OpenGlobal(KTsServerReadySemaphore)) {
       
    52         semaphore.Signal();
       
    53     }
       
    54     semaphore.Close();
       
    55     
       
    56     int result = app.exec();
       
    57     
       
    58     delete serverObject;
       
    59     return result;
       
    60 }