src/hbservers/hbdevicedialogappserver/hbddappfactorysymbian.cpp
author hgs
Tue, 13 Jul 2010 22:03:02 +0300
changeset 13 5168dbe2168a
parent 7 923ff622b8b9
child 28 b7da29130b0e
child 34 ed14f46c0e55
permissions -rw-r--r--
201027_1

/****************************************************************************
**
** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (developer.feedback@nokia.com)
**
** This file is part of the HbServers module of the UI Extensions for Mobile.
**
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at developer.feedback@nokia.com.
**
****************************************************************************/

#include "hbddappfactorysymbian_p.h"

#include <QApplication>
#include <qs60mainapplication.h>
#include <qs60maindocument.h>
#include <qs60mainappui.h>
#include <QSymbianEvent>

// In order to override CCoeAppUi::FrameworkCallsRendezvous() Application/Document/AppUi needs to be
// derived from.

class DeviceDialogMainAppUi : public QS60MainAppUi
{
public:
    TBool FrameworkCallsRendezvous() const {return false;}
};

class DeviceDialogMainDocument : public QS60MainDocument
{
public:
    DeviceDialogMainDocument(CEikApplication &mainApp) : QS60MainDocument(mainApp) {}
    CEikAppUi *CreateAppUiL()
        {return (static_cast <CEikAppUi*>(new (ELeave) DeviceDialogMainAppUi));}
};

class DeviceDialogMainApplication : public QS60MainApplication
{
protected:
    CApaDocument *CreateDocumentL()
        {return new (ELeave) DeviceDialogMainDocument(*this);}
};

CApaApplication *deviceDialogAppFactory()
{
    return new DeviceDialogMainApplication;
}

HbDeviceDialogServerApp::HbDeviceDialogServerApp(QApplication::QS60MainApplicationFactory factory,
    int &argc, char *argv[], Hb::ApplicationFlags flags) :
    HbApplication(factory, argc, argv, flags)
{
}

// Event filter to block exit
bool HbDeviceDialogServerApp::symbianEventFilter(const QSymbianEvent *event)
{
    if (event->type() == QSymbianEvent::CommandEvent) {
        int command = event->command();
        if (command == EAknSoftkeyExit || command == EEikCmdExit) {
            return true; // block exit commands
        }
    }
    return false;
}

// Block application quit() slot
void HbDeviceDialogServerApp::quit()
{
}