51
|
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 "FotaServer.h"
|
|
28 |
#include "FotaSrvDebug.h"
|
|
29 |
#include "fsview.h"
|
|
30 |
|
|
31 |
int main(int argc, char *argv[])
|
|
32 |
{
|
|
33 |
FLOG(_L("CFotaServer::Main >>"));
|
|
34 |
|
|
35 |
FLOG(_L("CFotaServer::HbApplication >>"));
|
|
36 |
HbApplication a(argc, argv);
|
|
37 |
|
73
|
38 |
HbFSView* view = new HbFSView();
|
51
|
39 |
FLOG(_L("CFotaServer::HbView >>"));
|
|
40 |
view->hideItems(Hb::AllItems);
|
|
41 |
FLOG(_L("CFotaServer::hideItems >>"));
|
|
42 |
view->setContentFullScreen();
|
|
43 |
FLOG(_L("CFotaServer::setContentFullScreen >>"));
|
|
44 |
|
|
45 |
HbMainWindow mainWindow(0, Hb::WindowFlagTransparent);
|
|
46 |
FLOG(_L("CFotaServer::mainWindow >>"));
|
|
47 |
|
|
48 |
HbTransparentWindow *transparentWindow = new HbTransparentWindow;
|
|
49 |
FLOG(_L("CFotaServer::transparentWindow >>"));
|
|
50 |
HbStackedLayout *stackedLayout = new HbStackedLayout;
|
|
51 |
FLOG(_L("CFotaServer::stackedLayout >>"));
|
|
52 |
stackedLayout->addItem(transparentWindow);
|
|
53 |
FLOG(_L("CFotaServer::addItem >>"));
|
|
54 |
view->setLayout(stackedLayout);
|
|
55 |
FLOG(_L("CFotaServer::setLayout >>"));
|
|
56 |
|
|
57 |
mainWindow.addView(view);
|
|
58 |
FLOG(_L("CFotaServer::addView >>"));
|
|
59 |
mainWindow.setCurrentView(view);
|
|
60 |
mainWindow.lower();
|
|
61 |
FLOG(_L("CFotaServer::setCurrentView >>"));
|
|
62 |
|
|
63 |
// create the server (leave it on the cleanup stack)
|
|
64 |
CFotaServer* server = CFotaServer::NewInstance(mainWindow);
|
|
65 |
|
|
66 |
if (server == NULL)
|
|
67 |
{
|
|
68 |
return 0;
|
|
69 |
}
|
|
70 |
|
|
71 |
mainWindow.show();
|
|
72 |
|
|
73 |
FLOG(_L("CFotaServer::show <<"));
|
|
74 |
RSemaphore sem;
|
|
75 |
TInt ret = sem.OpenGlobal(KFotaServerScem);
|
|
76 |
FLOG(_L("CFotaServer::OpenGlobal >>"));
|
|
77 |
|
|
78 |
FLOG(_L("CFotaServer::showMaximized <<"));
|
|
79 |
|
|
80 |
QTranslator *translator = new QTranslator();
|
|
81 |
QString lang = QLocale::system().name();
|
|
82 |
QString path = "Z:/resource/qt/translations/";
|
|
83 |
bool fine = translator->load("deviceupdates_" + lang, path);
|
|
84 |
if (fine)
|
|
85 |
qApp->installTranslator(translator);
|
|
86 |
|
|
87 |
QTranslator *commontranslator = new QTranslator();
|
|
88 |
fine = commontranslator->load("common_" + lang, path);/*finally required once localisation available*/
|
|
89 |
if(fine)
|
|
90 |
qApp->installTranslator(commontranslator);
|
|
91 |
else
|
|
92 |
qDebug("fotaserver common translator loading failed");
|
|
93 |
|
|
94 |
a.setApplicationName("FotaServer");
|
|
95 |
|
|
96 |
|
|
97 |
view->SetServer(server);
|
|
98 |
a.installEventFilter(view);
|
|
99 |
|
|
100 |
|
|
101 |
// Initialisation complete, now signal the client
|
|
102 |
if (ret == KErrNone)
|
|
103 |
{
|
|
104 |
sem.Signal();
|
|
105 |
FLOG(_L("CFotaServer::Signal <<"));
|
|
106 |
sem.Close();
|
|
107 |
FLOG(_L("CFotaServer::Close <<"));
|
|
108 |
}
|
|
109 |
FLOG(_L("CFotaServer::KErrNone <<"));
|
|
110 |
//This will install and start a active scheduler for this thread.
|
|
111 |
ret = a.exec();
|
|
112 |
|
|
113 |
RProperty::Set(TUid::Uid(KOmaDMAppUid), KFotaServerActive, 0);
|
|
114 |
delete server;
|
|
115 |
FLOG(_L("CFotaServer::Main <<"));
|
|
116 |
return ret;
|
|
117 |
}
|