34
|
1 |
/****************************************************************************
|
|
2 |
**
|
|
3 |
** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
** All rights reserved.
|
|
5 |
** Contact: Nokia Corporation (developer.feedback@nokia.com)
|
|
6 |
**
|
|
7 |
** This file is part of the HbServers module of the UI Extensions for Mobile.
|
|
8 |
**
|
|
9 |
** GNU Lesser General Public License Usage
|
|
10 |
** This file may be used under the terms of the GNU Lesser General Public
|
|
11 |
** License version 2.1 as published by the Free Software Foundation and
|
|
12 |
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
13 |
** Please review the following information to ensure the GNU Lesser General
|
|
14 |
** Public License version 2.1 requirements will be met:
|
|
15 |
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
16 |
**
|
|
17 |
** In addition, as a special exception, Nokia gives you certain additional
|
|
18 |
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
19 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
20 |
**
|
|
21 |
** If you have questions regarding the use of this file, please contact
|
|
22 |
** Nokia at developer.feedback@nokia.com.
|
|
23 |
**
|
|
24 |
****************************************************************************/
|
|
25 |
|
|
26 |
#include <QApplication>
|
|
27 |
#include <QMainWindow>
|
|
28 |
#include <QPlainTextEdit>
|
|
29 |
#include "hbinputserver_p.h"
|
|
30 |
|
|
31 |
#if defined(Q_OS_SYMBIAN)
|
|
32 |
#include <e32std.h>
|
|
33 |
#include <eikenv.h>
|
|
34 |
#include <apgwgnam.h>
|
|
35 |
|
|
36 |
_LIT(hbinputserver_name, "hbinputserver");
|
|
37 |
#endif // Q_OS_SYMBIAN
|
|
38 |
|
|
39 |
int main(int argc, char **argv)
|
|
40 |
{
|
|
41 |
QApplication app(argc, argv);
|
|
42 |
HbInputServer server;
|
|
43 |
#if defined(Q_OS_SYMBIAN)
|
|
44 |
// Set necessary window group etc. parameters to hide the input server
|
|
45 |
CEikonEnv *env = CEikonEnv::Static();
|
|
46 |
if (env) {
|
|
47 |
CApaWindowGroupName *wgName = CApaWindowGroupName::NewLC(env->WsSession());
|
|
48 |
env->RootWin().SetOrdinalPosition(0, ECoeWinPriorityNeverAtFront); // avoid coming to foreground
|
|
49 |
wgName->SetHidden(ETrue); // hide from FSW, OOM fw, GOOM fw, etc.
|
|
50 |
wgName->SetSystem(ETrue); // allow only apps with PowerManagement cap to shut us down
|
|
51 |
wgName->SetCaptionL(hbinputserver_name);
|
|
52 |
wgName->SetAppUid(KNullUid);
|
|
53 |
wgName->SetWindowGroupName(env->RootWin());
|
|
54 |
CleanupStack::PopAndDestroy(wgName);
|
|
55 |
RThread::RenameMe(hbinputserver_name);
|
|
56 |
}
|
|
57 |
#else
|
|
58 |
QMainWindow window;
|
|
59 |
QPlainTextEdit *textViewer = new QPlainTextEdit(&window);
|
|
60 |
window.setCentralWidget(textViewer);
|
|
61 |
textViewer->setReadOnly(true);
|
|
62 |
QObject::connect(&server, SIGNAL(debugMessage(QString)), textViewer, SLOT(appendPlainText(QString)));
|
|
63 |
window.show();
|
|
64 |
#endif // Q_OS_SYMBIAN
|
|
65 |
|
|
66 |
// Server start can fail if someone has already created the shared memory blocks,
|
|
67 |
// i.e. the server is already running. In that case just exit.
|
|
68 |
int returnValue = 0;
|
|
69 |
if (server.start()) {
|
|
70 |
returnValue = app.exec();
|
|
71 |
}
|
|
72 |
return returnValue;
|
|
73 |
}
|