activityfw/activitydatabase/hsactivitydbserver/s60/src/main.cpp
changeset 93 82b66994846c
parent 92 782e3408c2ab
child 94 dbb8300717f7
equal deleted inserted replaced
92:782e3408c2ab 93:82b66994846c
     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: Application entry point
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QtCore>
       
    19 #include <QApplication>
       
    20 #include <qs60mainapplication.h>
       
    21 #include <qs60mainappui.h>
       
    22 #include <qs60maindocument.h>
       
    23 
       
    24 #include <eikenv.h>
       
    25 #include <apgwgnam.h>
       
    26 
       
    27 #include "hsactivityserver.h"
       
    28 #include "hsactivitystorage.h"
       
    29 
       
    30 class HsActivityMainAppUi : public QS60MainAppUi
       
    31 {
       
    32 public:
       
    33     TBool FrameworkCallsRendezvous() const {
       
    34         return EFalse;
       
    35     }
       
    36 };
       
    37 
       
    38 class HsActivityMainDocument : public QS60MainDocument
       
    39 {
       
    40 public:
       
    41     HsActivityMainDocument(CEikApplication &mainApplication):QS60MainDocument(mainApplication) {}
       
    42 
       
    43     CEikAppUi *CreateAppUiL() {
       
    44         return (static_cast <CEikAppUi *>(new(ELeave)HsActivityMainAppUi));
       
    45     }
       
    46 };
       
    47 
       
    48 class HsActivityApplication : public QS60MainApplication
       
    49 {
       
    50 protected:
       
    51     CApaDocument *CreateDocumentL() {
       
    52         return new(ELeave) HsActivityMainDocument(*this);
       
    53     }
       
    54 };
       
    55 
       
    56 CApaApplication *newHsActivityApplication()
       
    57 {
       
    58     return new HsActivityApplication;
       
    59 }
       
    60 
       
    61 int main(int argc, char *argv[])
       
    62 {
       
    63     QApplication app(newHsActivityApplication, argc, argv);
       
    64     HsActivityStorage storage;
       
    65     HsActivityServer server(storage);
       
    66     int retVal(KErrGeneral);
       
    67     if (server.start()) {
       
    68         CEikonEnv *env = CEikonEnv::Static();
       
    69         if (env) {
       
    70             CApaWindowGroupName *wgName = CApaWindowGroupName::NewLC(env->WsSession());
       
    71             wgName->SetHidden(ETrue); // hides us from FSW and protects us from OOM FW etc.
       
    72             wgName->SetSystem(ETrue); // Allow only application with PowerManagement cap to shut us down
       
    73             RWindowGroup &rootWindowGroup = env->RootWin();
       
    74             wgName->SetWindowGroupName(rootWindowGroup);
       
    75             rootWindowGroup.SetOrdinalPosition(-1, ECoeWinPriorityNormal); //move to background.
       
    76             CleanupStack::PopAndDestroy();
       
    77         }
       
    78         RProcess::Rendezvous(KErrNone);
       
    79         retVal = app.exec();
       
    80     } else
       
    81         RProcess::Rendezvous(retVal);
       
    82     return retVal;
       
    83 }
       
    84 
       
    85