applicationmanagement/server/src/main.cpp
changeset 42 aa33c2cb9a50
equal deleted inserted replaced
41:c742e1129640 42:aa33c2cb9a50
       
     1 /*
       
     2  * Copyright (c) 2000 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: Implementation of applicationmanagement components
       
    15  *
       
    16  */
       
    17 
       
    18 
       
    19 #include <hbapplication.h>
       
    20 #include <hbtransparentwindow.h>
       
    21 #include <hbstackedlayout.h>
       
    22 #include <hbmainwindow.h>
       
    23 #include <hbview.h>
       
    24 #include <QTranslator>
       
    25 #include <QLocale>
       
    26 #include <e32property.h>
       
    27 #include "ApplicationManagementCommon.h"
       
    28 #include "debug.h"
       
    29 #include "amview.h"
       
    30 #include "ApplicationManagementServer.h"
       
    31 
       
    32 using namespace NApplicationManagement;
       
    33 
       
    34 int main(int argc, char *argv[])
       
    35     { 
       
    36     RDEBUG( "ApplicationManagementServer: main" );
       
    37 
       
    38     HbApplication app(argc, argv);
       
    39     
       
    40     AMView* view = new AMView();
       
    41     view->hideItems(Hb::AllItems);
       
    42     view->setContentFullScreen();
       
    43     //Defining transparent window
       
    44     HbMainWindow mainWindow(0, Hb::WindowFlagTransparent);
       
    45     HbTransparentWindow *transparentWindow = new HbTransparentWindow;
       
    46     HbStackedLayout *stackedLayout = new HbStackedLayout;
       
    47     stackedLayout->addItem(transparentWindow);
       
    48     view->setLayout(stackedLayout);
       
    49 
       
    50     mainWindow.addView(view);
       
    51     mainWindow.setCurrentView(view);
       
    52       
       
    53     app.installEventFilter(view);
       
    54 
       
    55     //Installing the translator
       
    56     QTranslator *translator = new QTranslator();
       
    57     QString lang = QLocale::system().name();
       
    58     
       
    59     bool fine = translator->load("deviceupdates_" + lang, path);/*finally required once localisation available*/
       
    60     if (fine)
       
    61         qApp->installTranslator(translator);
       
    62     int err = KErrNone;
       
    63     TRAP( err, QT_TRYCATCH_LEAVING(CApplicationManagementServer::NewL(&mainWindow)));
       
    64     
       
    65     RProcess::Rendezvous(KErrNone);
       
    66 
       
    67     //Pushing the server to background
       
    68     mainWindow.lower();
       
    69 
       
    70     TInt serverLaunchStatus = 1;
       
    71     err = RProperty::Set(KProperty, KInteger, serverLaunchStatus);
       
    72     
       
    73     mainWindow.show();
       
    74     int err1 = app.exec();
       
    75     int value = 0;
       
    76     err = RProperty::Set(TUid::Uid(KOmaDMAppUid), KDownloadActive, value);
       
    77     RDEBUG_2("RProperty set (%d)", err  );
       
    78     return err1;
       
    79     }