From f67b8df3ebdba2d398b9cce686b7c644adffff08 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sat, 7 May 2011 00:02:01 +0200 Subject: library split --- src/widgets/s60framework/qs60mainapplication.cpp | 165 +++++++++ src/widgets/s60framework/qs60mainapplication.h | 93 +++++ src/widgets/s60framework/qs60mainapplication_p.h | 66 ++++ src/widgets/s60framework/qs60mainappui.cpp | 430 +++++++++++++++++++++++ src/widgets/s60framework/qs60mainappui.h | 152 ++++++++ src/widgets/s60framework/qs60maindocument.cpp | 138 ++++++++ src/widgets/s60framework/qs60maindocument.h | 92 +++++ src/widgets/s60framework/s60framework.pri | 10 + src/widgets/s60framework/s60main.rss | 85 +++++ 9 files changed, 1231 insertions(+) create mode 100644 src/widgets/s60framework/qs60mainapplication.cpp create mode 100644 src/widgets/s60framework/qs60mainapplication.h create mode 100644 src/widgets/s60framework/qs60mainapplication_p.h create mode 100644 src/widgets/s60framework/qs60mainappui.cpp create mode 100644 src/widgets/s60framework/qs60mainappui.h create mode 100644 src/widgets/s60framework/qs60maindocument.cpp create mode 100644 src/widgets/s60framework/qs60maindocument.h create mode 100644 src/widgets/s60framework/s60framework.pri create mode 100644 src/widgets/s60framework/s60main.rss (limited to 'src/widgets/s60framework') diff --git a/src/widgets/s60framework/qs60mainapplication.cpp b/src/widgets/s60framework/qs60mainapplication.cpp new file mode 100644 index 0000000000..289d81cf96 --- /dev/null +++ b/src/widgets/s60framework/qs60mainapplication.cpp @@ -0,0 +1,165 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// INCLUDE FILES +#include +#include +#include "qs60maindocument.h" +#include "qs60mainapplication_p.h" +#include "qs60mainapplication.h" +#include +#include +#ifndef Q_WS_S60 +# include +#endif + +QT_BEGIN_NAMESPACE + +/** + * factory function to create the QS60Main application class + */ +CApaApplication *newS60Application() +{ + return new QS60MainApplication; +} + + +/*! + \class QS60MainApplication + \since 4.6 + \brief The QS60MainApplication class provides support for migration from S60. + + \warning This class is provided only to get access to S60 specific + functionality in the application framework classes. It is not + portable. We strongly recommend against using it in new applications. + + The QS60MainApplication provides a helper class for use in migrating + from existing S60 based applications to Qt based applications. It is + used in the exact same way as the \c CEikApplication class from + Symbian, but internally provides extensions used by Qt. + + When modifying old S60 applications that rely on implementing + functions in \c CEikApplication, the class should be modified to + inherit from this class instead of \c CEikApplication. Then the + application can choose to override only certain functions. To make + Qt use the custom application objects, pass a factory function to + \c{QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **)}. + + For more information on \c CEikApplication, please see the S60 documentation. + + Unlike other Qt classes, QS60MainApplication behaves like an S60 class, and can throw Symbian + leaves. + + \sa QS60MainDocument, QS60MainAppUi, QApplication::QS60MainApplicationFactory + */ + +/*! + * \brief Contructs an instance of QS60MainApplication. + */ +QS60MainApplication::QS60MainApplication() +{ +} + +/*! + * \brief Destroys the QS60MainApplication. + */ +QS60MainApplication::~QS60MainApplication() +{ +} + +/*! + * \brief Creates an instance of QS60MainDocument. + * + * \sa QS60MainDocument + */ +CApaDocument *QS60MainApplication::CreateDocumentL() +{ + // Create an QtS60Main document, and return a pointer to it + return new (ELeave) QS60MainDocument(*this); +} + + +/*! + * \brief Returns the UID of the application. + */ +TUid QS60MainApplication::AppDllUid() const +{ + // Return the UID for the QtS60Main application + return RProcess().SecureId().operator TUid(); +} + +/*! + * \brief Returns the resource file name. + */ +TFileName QS60MainApplication::ResourceFileName() const +{ + return KNullDesC(); +} + +/*! + \internal +*/ +void QS60MainApplication::PreDocConstructL() +{ + QS60MainApplicationBase::PreDocConstructL(); +} + +/*! + \internal +*/ +CDictionaryStore *QS60MainApplication::OpenIniFileLC(RFs &aFs) const +{ + return QS60MainApplicationBase::OpenIniFileLC(aFs); +} + +/*! + \internal +*/ +void QS60MainApplication::NewAppServerL(CApaAppServer *&aAppServer) +{ +#ifdef Q_WS_S60 + QS60MainApplicationBase::NewAppServerL(aAppServer); +#else + aAppServer = new(ELeave) CEikAppServer; +#endif +} + +QT_END_NAMESPACE diff --git a/src/widgets/s60framework/qs60mainapplication.h b/src/widgets/s60framework/qs60mainapplication.h new file mode 100644 index 0000000000..133f69a83d --- /dev/null +++ b/src/widgets/s60framework/qs60mainapplication.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QS60MAINAPPLICATION_H +#define QS60MAINAPPLICATION_H + +#include + +#ifdef Q_OS_SYMBIAN + +#ifdef Q_WS_S60 +#include +typedef CAknApplication QS60MainApplicationBase; +#else +#include +typedef CEikApplication QS60MainApplicationBase; +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QS60MainApplication : public QS60MainApplicationBase +{ +public: + QS60MainApplication(); + // The virtuals are for qdoc. + virtual ~QS60MainApplication(); + + virtual TUid AppDllUid() const; + + virtual TFileName ResourceFileName() const; + +public: + + virtual void PreDocConstructL(); + + virtual CDictionaryStore *OpenIniFileLC(RFs &aFs) const; + + virtual void NewAppServerL(CApaAppServer *&aAppServer); + +protected: + + virtual CApaDocument *CreateDocumentL(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_OS_SYMBIAN + +#endif // QS60MAINAPPLICATION_H diff --git a/src/widgets/s60framework/qs60mainapplication_p.h b/src/widgets/s60framework/qs60mainapplication_p.h new file mode 100644 index 0000000000..bb76676b13 --- /dev/null +++ b/src/widgets/s60framework/qs60mainapplication_p.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QS60MAINAPPLICATION_P_H +#define QS60MAINAPPLICATION_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include + +QT_BEGIN_NAMESPACE + +CApaApplication *newS60Application(); + +QT_END_NAMESPACE + +#endif // QS60MAINAPPLICATION_P_H diff --git a/src/widgets/s60framework/qs60mainappui.cpp b/src/widgets/s60framework/qs60mainappui.cpp new file mode 100644 index 0000000000..f591fcba36 --- /dev/null +++ b/src/widgets/s60framework/qs60mainappui.cpp @@ -0,0 +1,430 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// INCLUDE FILES +#include +#include +#ifdef Q_WS_S60 +#include +#include +#include +#include +#endif +#include +#include +#include + +#include "qs60mainappui.h" +#include +#include +#include +#include +#include +#include + +//Animated wallpapers in Qt applications are not supported. +const TInt KAknDisableAnimationBackground = 0x02000000; +const TInt KAknSingleClickCompatible = 0x01000000; + +QT_BEGIN_NAMESPACE + +/*! + \class QS60MainAppUi + \since 4.6 + \brief The QS60MainAppUi class is a helper class for S60 migration. + + \warning This class is provided only to get access to S60 specific + functionality in the application framework classes. It is not + portable. We strongly recommend against using it in new applications. + + The QS60MainAppUi provides a helper class for use in migrating from + existing S60 based applications to Qt based applications. It is used + in the exact same way as the \c CAknAppUi class from Symbian, but + internally provides extensions used by Qt. + + When modifying old S60 applications that rely on implementing + functions in \c CAknAppUi, the class should be modified to inherit + from this class instead of \c CAknAppUi. Then the application can + choose to override only certain functions. + + For more information on \c CAknAppUi, please see the S60 + documentation. + + Unlike other Qt classes, QS60MainAppUi behaves like an S60 class, + and can throw Symbian leaves. + + \sa QS60MainDocument, QS60MainApplication + */ + +/*! + * \brief Second phase Symbian constructor. + * + * Constructs all the elements of the class that can cause a leave to happen. + * + * If you override this function, you should call the base class implementation as well. + */ +void QS60MainAppUi::ConstructL() +{ + // Cone's heap and handle checks on app destruction are not suitable for Qt apps, as many + // objects can still exist in static data at that point. Instead we will print relevant information + // so that comparative checks may be made for memory leaks, using ~SPrintExitInfo in corelib. + iEikonEnv->DisableExitChecks(ETrue); + + // Initialise app UI with standard value. + // ENoAppResourceFile and ENonStandardResourceFile makes UI to work without + // resource files in most SDKs. S60 3rd FP1 public seems to require resource file + // even these flags are defined + TInt flags = CEikAppUi::ENoScreenFurniture + | CEikAppUi::ENonStandardResourceFile; +#ifdef Q_WS_S60 + flags |= CAknAppUi::EAknEnableSkin; + // After 5th Edition S60, native side supports animated wallpapers. + // However, there is no support for that feature on Qt side, so indicate to + // native UI framework that this application will not support background animations. + + // Also, add support for single touch for post 5th edition platforms. + // This has only impact when launching native dialogs/menus from inside QApplication. + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) { + flags |= (KAknDisableAnimationBackground | KAknSingleClickCompatible); + } +#endif + BaseConstructL(flags); +} + +/*! + * \brief Contructs an instance of QS60MainAppUi. + */ +QS60MainAppUi::QS60MainAppUi() +{ + // No implementation required +} + +/*! + * \brief Destroys the QS60MainAppUi. + */ +QS60MainAppUi::~QS60MainAppUi() +{ +} + +/*! + * \brief Handles commands produced by the S60 framework. + * + * \a command holds the ID of the command to handle, and is S60 specific. + * + * If you override this function, you should call the base class implementation if you do not + * handle the command. + */ +void QS60MainAppUi::HandleCommandL(TInt command) +{ + if (qApp) { + QSymbianEvent event(QSymbianEvent::CommandEvent, command); + QT_TRYCATCH_LEAVING(qApp->symbianProcessEvent(&event)); + } +} + +/*! + * \brief Handles a resource change in the S60 framework. + * + * Resource changes include layout switches. \a type holds the type of resource change that + * occurred. + * + * If you override this function, you should call the base class implementation if you do not + * handle the resource change. + */ +void QS60MainAppUi::HandleResourceChangeL(TInt type) +{ + QS60MainAppUiBase::HandleResourceChangeL(type); + + if (qApp) { + QSymbianEvent event(QSymbianEvent::ResourceChangeEvent, type); + QT_TRYCATCH_LEAVING(qApp->symbianProcessEvent(&event)); + } +} + +/*! + * \brief Handles raw window server events. + * + * The event type and information is passed in \a wsEvent, while the receiving control is passed in + * \a destination. + * + * If you override this function, you should call the base class implementation if you do not + * handle the event. + */ +void QS60MainAppUi::HandleWsEventL(const TWsEvent &wsEvent, CCoeControl *destination) +{ + int result = 0; + if (qApp) { + QSymbianEvent event(&wsEvent); + QT_TRYCATCH_LEAVING( + result = qApp->symbianProcessEvent(&event) + ); + } + + if (result <= 0) + QS60MainAppUiBase::HandleWsEventL(wsEvent, destination); +} + + +/*! + * \brief Handles changes to the status pane size. + * + * Called by the framework when the application status pane size is changed. + * + * If you override this function, you should call the base class implementation if you do not + * handle the size change. + */ +void QS60MainAppUi::HandleStatusPaneSizeChange() +{ + TRAP_IGNORE(HandleResourceChangeL(KInternalStatusPaneChange)); + HandleStackedControlsResourceChange(KInternalStatusPaneChange); +} + +/*! + * \brief Dynamically initializes a menu bar. + * + * The resource associated with the menu is given in \a resourceId, and the actual menu bar is + * passed in \a menuBar. + * + * If you override this function, you should call the base class implementation as well. + */ +void QS60MainAppUi::DynInitMenuBarL(TInt /* resourceId */, CEikMenuBar * /* menuBar */) +{ +} + +/*! + * \brief Dynamically initializes a menu pane. + * + * The resource associated with the menu is given in \a resourceId, and the actual menu pane is + * passed in \a menuPane. + * + * If you override this function, you should call the base class implementation as well. + */ +void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) +{ +#ifdef Q_WS_S60 + if (resourceId == R_AVKON_MENUPANE_EMPTY) { + if (menuPane->NumberOfItemsInPane() <= 1) + QT_TRYCATCH_LEAVING(qt_symbian_show_toplevel(menuPane)); + + } else if (resourceId != R_AVKON_MENUPANE_FEP_DEFAULT + && resourceId != R_AVKON_MENUPANE_EDITTEXT_DEFAULT + && resourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT) { + QT_TRYCATCH_LEAVING(qt_symbian_show_submenu(menuPane, resourceId)); + } +#else + QS60MainAppUiBase::DynInitMenuPaneL(resourceId, menuPane); +#endif +} + +/*! + * \brief Restores a menu window. + * + * The menu window to restore is given in \a menuWindow. The resource ID and type of menu is given + * in \a resourceId and \a menuType, respectively. + * + * If you override this function, you should call the base class implementation as well. + */ +void QS60MainAppUi::RestoreMenuL(CCoeControl *menuWindow, TInt resourceId, TMenuType menuType) +{ +#ifdef Q_WS_S60 + if (resourceId >= QT_SYMBIAN_FIRST_MENU_ITEM && resourceId <= QT_SYMBIAN_LAST_MENU_ITEM) { + if (menuType == EMenuPane) + DynInitMenuPaneL(resourceId, (CEikMenuPane*)menuWindow); + else + DynInitMenuBarL(resourceId, (CEikMenuBar*)menuWindow); + } else if(resourceId == R_AVKON_MENUPANE_EMPTY) { + CEikMenuBarTitle *title = new(ELeave) CEikMenuBarTitle; + CleanupStack::PushL(title); + + title->iData.iMenuPaneResourceId = R_AVKON_MENUPANE_EMPTY; + title->iTitleFlags = 0; + + S60->menuBar()->TitleArray()->AddTitleL(title); + CleanupStack::Pop( title ); + } + else +#endif + { + QS60MainAppUiBase::RestoreMenuL(menuWindow, resourceId, menuType); + } +} + +/*! + \internal +*/ +void QS60MainAppUi::Exit() +{ + QS60MainAppUiBase::Exit(); +} + +/*! + \internal +*/ +void QS60MainAppUi::SetFadedL(TBool aFaded) +{ + QS60MainAppUiBase::SetFadedL(aFaded); +} + +/*! + \internal +*/ +TRect QS60MainAppUi::ApplicationRect() const +{ + return QS60MainAppUiBase::ApplicationRect(); +} + +/*! + \internal +*/ +void QS60MainAppUi::HandleScreenDeviceChangedL() +{ + QS60MainAppUiBase::HandleScreenDeviceChangedL(); +} + +/*! + \internal +*/ +void QS60MainAppUi::HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent) +{ + QS60MainAppUiBase::HandleApplicationSpecificEventL(aType, aEvent); +} + +/*! + \internal +*/ +TTypeUid::Ptr QS60MainAppUi::MopSupplyObject(TTypeUid aId) +{ + return QS60MainAppUiBase::MopSupplyObject(aId); +} + +/*! + \internal +*/ +void QS60MainAppUi::ProcessCommandL(TInt aCommand) +{ + QS60MainAppUiBase::ProcessCommandL(aCommand); +} + +/*! + \internal +*/ +TErrorHandlerResponse QS60MainAppUi::HandleError (TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText) +{ + return QS60MainAppUiBase::HandleError(aError, aExtErr, aErrorText, aContextText); +} + +/*! + \internal +*/ +void QS60MainAppUi::HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId) +{ + QS60MainAppUiBase::HandleViewDeactivation(aViewIdToBeDeactivated, aNewlyActivatedViewId); +} + +/*! + \internal +*/ +void QS60MainAppUi::PrepareToExit() +{ + QS60MainAppUiBase::PrepareToExit(); +} + +/*! + \internal +*/ +void QS60MainAppUi::HandleTouchPaneSizeChange() +{ + QS60MainAppUiBase::HandleTouchPaneSizeChange(); +} + +/*! + \internal +*/ +void QS60MainAppUi::HandleSystemEventL(const TWsEvent &aEvent) +{ + QS60MainAppUiBase::HandleSystemEventL(aEvent); +} + +/*! + \internal +*/ +void QS60MainAppUi::Reserved_MtsmPosition() +{ + QS60MainAppUiBase::Reserved_MtsmPosition(); +} + +/*! + \internal +*/ +void QS60MainAppUi::Reserved_MtsmObject() +{ + QS60MainAppUiBase::Reserved_MtsmObject(); +} + +/*! + \internal +*/ +void QS60MainAppUi::HandleForegroundEventL(TBool aForeground) +{ + QS60MainAppUiBase::HandleForegroundEventL(aForeground); +} + +/*! + \internal +*/ +TBool QS60MainAppUi::ProcessCommandParametersL(TApaCommand /*aCommand*/, TFileName &/*aDocumentName*/, const TDesC8 &/*aTail*/) +{ + // bypass CEikAppUi::ProcessCommandParametersL(..) which modifies aDocumentName, preventing apparc document opening from working. + // The return value is effectively unused in Qt apps (see QS60MainDocument::OpenFileL) + return EFalse; +} + +#ifndef Q_WS_S60 + +void QS60StubAknAppUi::HandleViewDeactivation(const TVwsViewId &, const TVwsViewId &) {} +void QS60StubAknAppUi::HandleTouchPaneSizeChange() {} +void QS60StubAknAppUi::HandleStatusPaneSizeChange() {} +void QS60StubAknAppUi::Reserved_MtsmPosition() {} +void QS60StubAknAppUi::Reserved_MtsmObject() {} + +#endif + +QT_END_NAMESPACE diff --git a/src/widgets/s60framework/qs60mainappui.h b/src/widgets/s60framework/qs60mainappui.h new file mode 100644 index 0000000000..bf118ffbe8 --- /dev/null +++ b/src/widgets/s60framework/qs60mainappui.h @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QS60MAINAPPUI_H +#define QS60MAINAPPUI_H + +#include + +#ifdef Q_OS_SYMBIAN + +#ifdef Q_WS_S60 +#include +typedef CAknAppUi QS60MainAppUiBase; +#else +#include +// these stub classes simulate the structure of CAknAppUi, to help binary compatibility between Qt configured with and without S60/Avkon +class QS60StubAknAppUiBase : public CEikAppUi +{ +private: + int qS60StubAknAppUiBaseSpace[4]; +}; + +class QS60StubMEikStatusPaneObserver +{ +public: + virtual void HandleStatusPaneSizeChange() = 0; +}; + +class QS60StubMAknTouchPaneObserver +{ +public: + virtual void HandleTouchPaneSizeChange() = 0; +}; + +class QS60StubAknAppUi : public QS60StubAknAppUiBase, QS60StubMEikStatusPaneObserver, + public MCoeViewDeactivationObserver, + public QS60StubMAknTouchPaneObserver +{ +public: // MCoeViewDeactivationObserver + virtual void HandleViewDeactivation(const TVwsViewId&, const TVwsViewId &); + +public: // from MAknTouchPaneObserver + virtual void HandleTouchPaneSizeChange(); + +protected: // from MEikStatusPaneObserver + virtual void HandleStatusPaneSizeChange(); + +protected: // from CAknAppUi + virtual void Reserved_MtsmPosition(); + virtual void Reserved_MtsmObject(); + +private: + int qS60StubAknAppUiSpace[4]; +}; + +typedef QS60StubAknAppUi QS60MainAppUiBase; +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QS60MainAppUi : public QS60MainAppUiBase +{ +public: + QS60MainAppUi(); + // The virtuals are for qdoc. + virtual ~QS60MainAppUi(); + + virtual void ConstructL(); + + virtual void RestoreMenuL(CCoeControl *menuWindow,TInt resourceId,TMenuType menuType); + virtual void DynInitMenuBarL(TInt resourceId, CEikMenuBar *menuBar); + virtual void DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane); + + virtual void HandleCommandL( TInt command ); + + virtual void HandleResourceChangeL(TInt type); + + virtual void HandleStatusPaneSizeChange(); + +protected: + virtual void HandleWsEventL(const TWsEvent &event, CCoeControl *destination); + +public: + virtual void Exit(); + virtual void SetFadedL(TBool aFaded); + virtual TRect ApplicationRect() const; + virtual void ProcessCommandL(TInt aCommand); + virtual TErrorHandlerResponse HandleError (TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText); + virtual void HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId); + virtual void PrepareToExit(); + virtual void HandleTouchPaneSizeChange(); + virtual TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName &aDocumentName, const TDesC8 &aTail); + +protected: + virtual void HandleScreenDeviceChangedL(); + virtual void HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent); + virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId); + virtual void HandleSystemEventL(const TWsEvent &aEvent); + virtual void Reserved_MtsmPosition(); + virtual void Reserved_MtsmObject(); + virtual void HandleForegroundEventL(TBool aForeground); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_OS_SYMBIAN + +#endif // QS60MAINAPPUI_H diff --git a/src/widgets/s60framework/qs60maindocument.cpp b/src/widgets/s60framework/qs60maindocument.cpp new file mode 100644 index 0000000000..37bd55f22e --- /dev/null +++ b/src/widgets/s60framework/qs60maindocument.cpp @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qs60mainappui.h" +#include "qs60maindocument.h" +#include "qcoreapplication.h" +#include "qevent.h" +#include "private/qcore_symbian_p.h" + +#include + +QT_BEGIN_NAMESPACE + +/*! + \class QS60MainDocument + \since 4.6 + \brief The QS60MainDocument class is a helper class for S60 migration. + + \warning This class is provided only to get access to S60 specific + functionality in the application framework classes. It is not + portable. We strongly recommend against using it in new applications. + + The QS60MainDocument provides a helper class for use in migrating + from existing S60 based applications to Qt based applications. It is + used in the exact same way as the \c CEikDocument class from + Symbian, but internally provides extensions used by Qt. + + When modifying old S60 applications that rely on implementing + functions in \c CEikDocument, the class should be modified to + inherit from this class instead of \c CEikDocument. Then the + application can choose to override only certain functions. + + For more information on \c CEikDocument, please see the S60 + documentation. + + Unlike other Qt classes, QS60MainDocument behaves like an S60 class, + and can throw Symbian leaves. + + \sa QS60MainApplication, QS60MainAppUi + */ + +/*! + * \brief Constructs an instance of QS60MainDocument. + * + * \a mainApplication should contain a pointer to a QS60MainApplication instance. + */ +QS60MainDocument::QS60MainDocument(CEikApplication &mainApplication) + : QS60MainDocumentBase(mainApplication) +{ + // No implementation required +} + +/*! + * \brief Destroys the QS60MainDocument. + */ +QS60MainDocument::~QS60MainDocument() +{ + // No implementation required +} + +/*! + * \brief Creates an instance of QS60MainAppUi. + * + * \sa QS60MainAppUi + */ +CEikAppUi *QS60MainDocument::CreateAppUiL() +{ + // Create the application user interface, and return a pointer to it; + // the framework takes ownership of this object + return (static_cast (new(ELeave)QS60MainAppUi)); +} + +/*! + \internal + */ +CFileStore *QS60MainDocument::OpenFileL(TBool /*aDoOpen*/, const TDesC &aFilename, RFs &/*aFs*/) +{ + QT_TRYCATCH_LEAVING( { + QCoreApplication* app = QCoreApplication::instance(); + QString qname = qt_TDesC2QString(aFilename); + QFileOpenEvent* event = new QFileOpenEvent(qname); + app->postEvent(app, event); + }) + return 0; +} + +/*! + \internal + */ +void QS60MainDocument::OpenFileL(CFileStore *&aFileStore, RFile &aFile) +{ + QT_TRYCATCH_LEAVING( { + QCoreApplication* app = QCoreApplication::instance(); + QFileOpenEvent* event = new QFileOpenEvent(aFile); + app->postEvent(app, event); + aFileStore = 0; + }) +} + +QT_END_NAMESPACE diff --git a/src/widgets/s60framework/qs60maindocument.h b/src/widgets/s60framework/qs60maindocument.h new file mode 100644 index 0000000000..16ea92281d --- /dev/null +++ b/src/widgets/s60framework/qs60maindocument.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QS60MAINDOCUMENT_H +#define QS60MAINDOCUMENT_H + +#include + +#ifdef Q_OS_SYMBIAN + +#ifdef Q_WS_S60 +#include +typedef CAknDocument QS60MainDocumentBase; +#else +#include +typedef CEikDocument QS60MainDocumentBase; +#endif + +class CEikApplication; + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QS60MainAppUi; + +class Q_GUI_EXPORT QS60MainDocument : public QS60MainDocumentBase +{ +public: + + QS60MainDocument(CEikApplication &mainApplication); + // The virtuals are for qdoc. + virtual ~QS60MainDocument(); + +public: + + virtual CEikAppUi *CreateAppUiL(); + +public: + + virtual CFileStore *OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &aFs); + + virtual void OpenFileL(CFileStore *&aFileStore, RFile &aFile); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_OS_SYMBIAN + +#endif // QS60MAINDOCUMENT_H diff --git a/src/widgets/s60framework/s60framework.pri b/src/widgets/s60framework/s60framework.pri new file mode 100644 index 0000000000..19525b7fdb --- /dev/null +++ b/src/widgets/s60framework/s60framework.pri @@ -0,0 +1,10 @@ +SOURCES += s60framework/qs60mainapplication.cpp \ + s60framework/qs60mainappui.cpp \ + s60framework/qs60maindocument.cpp + +HEADERS += s60framework/qs60mainapplication_p.h \ + s60framework/qs60mainapplication.h \ + s60framework/qs60mainappui.h \ + s60framework/qs60maindocument.h + +!isEmpty(QT_LIBINFIX): DEFINES += QT_LIBINFIX_UNQUOTED=$$QT_LIBINFIX \ No newline at end of file diff --git a/src/widgets/s60framework/s60main.rss b/src/widgets/s60framework/s60main.rss new file mode 100644 index 0000000000..a38087ddfc --- /dev/null +++ b/src/widgets/s60framework/s60main.rss @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Symbian application wrapper of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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 qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// Even S60 application have ENoAppResourceFile and ENonStandardResourceFile +// flags set, the S60 3rd Edition FP1 emulator requires applications to have +// very minimalistic application resource file, otherwise apps refures to start +// This file serves the minimalistic resource file for S60 3.1 platforms. + +// RESOURCE IDENTIFIER +NAME QTMA // 4 letter ID + +// INCLUDES +//#include +#include +#include +#include +#include +#include + +// RESOURCE DEFINITIONS +RESOURCE RSS_SIGNATURE + { + } + +RESOURCE TBUF r_default_document_name + { + buf="QTMA"; + } + +RESOURCE EIK_APP_INFO + { + menubar = r_qt_wrapperapp_menubar; + cba = R_AVKON_SOFTKEYS_EXIT; + } + +RESOURCE MENU_BAR r_qt_wrapperapp_menubar + { + titles = + { + MENU_TITLE { menu_pane = r_qt_wrapperapp_menu; } + }; + } + +RESOURCE MENU_PANE r_qt_wrapperapp_menu + { + } +// End of File -- cgit v1.2.3