diff options
author | axis <qt-info@nokia.com> | 2009-09-22 11:48:38 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-09-23 14:06:36 (GMT) |
commit | 77166549a95056a9e0ac78a1e2248c78406630a4 (patch) | |
tree | c8bf18cd8bac9c0dcd8a686f902a728487e78c81 /src | |
parent | 4a157ee126fc482cd1954b80f22f790ec544e241 (diff) | |
download | Qt-77166549a95056a9e0ac78a1e2248c78406630a4.zip Qt-77166549a95056a9e0ac78a1e2248c78406630a4.tar.gz Qt-77166549a95056a9e0ac78a1e2248c78406630a4.tar.bz2 |
Added support for using custom application objects on S60.
With this patch, the application developer can use his own
CEikApplication, CEikDocument and CEikAppUi classes with Qt, by
deriving from QS60MainApplication, QSMainDocument and QS60MainAppUi,
respectively. He can then register a factory function in the
QApplication constructor to have his own objects created during the
framework initialization.
This patch also fixes some Qt code style issues.
RevBy: Jason Barron
RevBy: mread
RevBy: Sami Merila
RevBy: Shane Kearns
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qapplication.h | 14 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 41 | ||||
-rw-r--r-- | src/gui/kernel/qt_s60_p.h | 2 | ||||
-rw-r--r-- | src/gui/s60framework/qs60mainapplication.cpp | 81 | ||||
-rw-r--r-- | src/gui/s60framework/qs60mainapplication.h | 79 | ||||
-rw-r--r-- | src/gui/s60framework/qs60mainapplication_p.h | 58 | ||||
-rw-r--r-- | src/gui/s60framework/qs60mainappui.cpp | 181 | ||||
-rw-r--r-- | src/gui/s60framework/qs60mainappui.h | 86 | ||||
-rw-r--r-- | src/gui/s60framework/qs60mainappui_p.h | 130 | ||||
-rw-r--r-- | src/gui/s60framework/qs60maindocument.cpp | 99 | ||||
-rw-r--r-- | src/gui/s60framework/qs60maindocument.h | 80 | ||||
-rw-r--r-- | src/gui/s60framework/qs60maindocument_p.h | 139 | ||||
-rw-r--r-- | src/gui/s60framework/s60framework.pri | 5 |
13 files changed, 526 insertions, 469 deletions
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 0562251..5f21a56 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -64,6 +64,9 @@ QT_BEGIN_HEADER #if defined(Q_OS_SYMBIAN) class TWsEvent; #endif +#if defined(Q_WS_S60) +class CApaApplication; +#endif QT_BEGIN_NAMESPACE @@ -114,6 +117,11 @@ class Q_GUI_EXPORT QApplication : public QCoreApplication public: enum Type { Tty, GuiClient, GuiServer }; + +#ifdef Q_WS_S60 + typedef CApaApplication * (*QS60MainApplicationFactory)(); +#endif + #ifndef qdoc QApplication(int &argc, char **argv, int = QT_VERSION); QApplication(int &argc, char **argv, bool GUIenabled, int = QT_VERSION); @@ -122,6 +130,9 @@ public: QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0, int = QT_VERSION); QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0, int = QT_VERSION); #endif +#if defined(Q_WS_S60) + QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int = QT_VERSION); +#endif #endif virtual ~QApplication(); @@ -357,6 +368,9 @@ public: QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0); QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0); #endif +#if defined(Q_WS_S60) || defined(qdoc) + QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv); +#endif #endif private: diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index a5d07fd..4ca9459 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -817,11 +817,50 @@ TTypeUid::Ptr QSymbianControl::MopSupplyObject(TTypeUid id) return CCoeControl::MopSupplyObject(id); } +/*! + \typedef QApplication::QS60MainApplicationFactory + + This is a typedef for a pointer to a function with the following + signature: + + \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 47 + + \sa QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **) +*/ + +/*! + \since 4.6 + + Creates an application using the application factory given in + \a factory, and using \a argc command line arguments in \a argv. + \a factory can be leaving, but the error will be converted to a + standard exception. + + This function is only available on S60. +*/ +QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv) + : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient)) +{ + Q_D(QApplication); + S60->s60ApplicationFactory = factory; + d->construct(); +} + +QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int _internal) + : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient)) +{ + Q_D(QApplication); + S60->s60ApplicationFactory = factory; + d->construct(); + QApplicationPrivate::app_compile_version = _internal; +} + void qt_init(QApplicationPrivate * /* priv */, int) { if (!CCoeEnv::Static()) { // The S60 framework has not been initalized. We need to do it. - TApaApplicationFactory factory(NewApplication); + TApaApplicationFactory factory(S60->s60ApplicationFactory ? + S60->s60ApplicationFactory : newS60Application); CApaCommandLine* commandLine = 0; TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine); // After this construction, CEikonEnv will be available from CEikonEnv::Static(). diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index aa39f9d..9734d26 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -61,6 +61,7 @@ #include "QtGui/qimage.h" #include "QtGui/qevent.h" #include "qpointer.h" +#include "qapplication.h" #include <w32std.h> #include <coecntrl.h> #include <eikenv.h> @@ -107,6 +108,7 @@ public: int mouseInteractionEnabled : 1; int virtualMouseRequired : 1; int qtOwnsS60Environment : 1; + QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type static inline void updateScreenSize(); static inline RWsSession& wsSession(); static inline RWindowGroup& windowGroup(); diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp index f12ed1f..54fb3b1 100644 --- a/src/gui/s60framework/qs60mainapplication.cpp +++ b/src/gui/s60framework/qs60mainapplication.cpp @@ -41,53 +41,86 @@ // INCLUDE FILES #include <exception> -#include "qs60maindocument_p.h" +#include "qs60maindocument.h" #include "qs60mainapplication_p.h" +#include "qs60mainapplication.h" #include <bautils.h> #include <coemain.h> QT_BEGIN_NAMESPACE /** - * factory function to create the QtS60Main application class + * factory function to create the QS60Main application class */ -CApaApplication* NewApplication() +CApaApplication *newS60Application() { return new QS60MainApplication; } -// ============================ MEMBER FUNCTIONS =============================== +_LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main.rsc"); +/*! + * \class QS60MainApplication + * \obsolete + * \since 4.6 + * \brief Helper class for S60 migration + * + * 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 CAknApplication class from Symbian, but internally provides extensions used by Qt. + * + * When modifying old S60 applications that rely on implementing functions in \c CAknApplication, + * the class should be modified to inherit from this class instead of \c CAknApplication. Then the + * application can choose to override only certain functions. To make Qt use the custom application + * objects, pass a factory function to + * QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **). + * + * For more information on \c CAknApplication, please see the S60 documentation. + * + * Unlike other Qt classes, QS60MainApplication behaves like an S60 class, and can throw Symbian + * leaves. + * + * \sa QS60MainDocument, QS60MainAppUi, QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **) + */ -_LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main.rsc"); +/*! + * \brief Contructs an instance of QS60MainApplication. + */ +QS60MainApplication::QS60MainApplication() +{ +} -// ----------------------------------------------------------------------------- -// QS60MainApplication::CreateDocumentL() -// Creates CApaDocument object -// ----------------------------------------------------------------------------- -// -CApaDocument* QS60MainApplication::CreateDocumentL() +/*! + * \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 (static_cast<CApaDocument*>(QS60MainDocument::NewL(*this))); + return new (ELeave) QS60MainDocument(*this); } -// ----------------------------------------------------------------------------- -// QS60MainApplication::AppDllUid() -// Returns application UID -// ----------------------------------------------------------------------------- -// + +/*! + * \brief Returns the UID of the application. + */ TUid QS60MainApplication::AppDllUid() const { // Return the UID for the QtS60Main application - return ProcessUid(); + return RProcess().SecureId().operator TUid(); } -// ----------------------------------------------------------------------------- -// QS60MainApplication::ResourceFileName() -// Returns application resource filename -// ----------------------------------------------------------------------------- -// +/*! + * \brief Returns the resource file name. + */ TFileName QS60MainApplication::ResourceFileName() const { TFindFile finder(iCoeEnv->FsSession()); @@ -98,5 +131,3 @@ TFileName QS60MainApplication::ResourceFileName() const } QT_END_NAMESPACE - -// End of File diff --git a/src/gui/s60framework/qs60mainapplication.h b/src/gui/s60framework/qs60mainapplication.h new file mode 100644 index 0000000..457764c --- /dev/null +++ b/src/gui/s60framework/qs60mainapplication.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 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 <qglobal.h> + +#ifdef Q_WS_S60 + +#include <aknapp.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QS60MainApplication : public CAknApplication +{ +public: + QS60MainApplication(); + // The virtuals are for qdoc. + virtual ~QS60MainApplication(); + + virtual TUid AppDllUid() const; + + virtual TFileName ResourceFileName() const; + +protected: + + virtual CApaDocument *CreateDocumentL(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_WS_S60 + +#endif // QS60MAINAPPLICATION_H diff --git a/src/gui/s60framework/qs60mainapplication_p.h b/src/gui/s60framework/qs60mainapplication_p.h index 40562da..863d872 100644 --- a/src/gui/s60framework/qs60mainapplication_p.h +++ b/src/gui/s60framework/qs60mainapplication_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Symbian application wrapper of the Qt Toolkit. +** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -46,67 +46,21 @@ // W A R N I N G // ------------- // -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. +// 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. // -// INCLUDES -#include <aknapp.h> - #include <qglobal.h> -// CLASS DECLARATION +#include <apparc.h> QT_BEGIN_NAMESPACE -CApaApplication* NewApplication(); - -static TUid ProcessUid() -{ - RProcess me; - TSecureId securId = me.SecureId(); - me.Close(); - return securId.operator TUid(); -} - -/** -* QS60MainApplication application class. -* Provides factory to create concrete document object. -* An instance of QS60MainApplication is the application part of the -* AVKON application framework for the QtS60Main example application. -*/ -class QS60MainApplication : public CAknApplication -{ -public: // Functions from base classes - - /** - * From CApaApplication, AppDllUid. - * @return Application's UID (KUidQtS60MainApp). - */ - TUid AppDllUid() const; - - /** - * From CApaApplication, ResourceFileName - * @return Application's resource filename (KUidQtS60MainApp). - */ - TFileName ResourceFileName() const; - -protected: // Functions from base classes - - /** - * From CApaApplication, CreateDocumentL. - * Creates QS60MainDocument document object. The returned - * pointer in not owned by the QS60MainApplication object. - * @return A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); -}; +CApaApplication *newS60Application(); QT_END_NAMESPACE #endif // QS60MAINAPPLICATION_P_H - -// End of File diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index 4f5227c..9e2333b 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -48,21 +48,42 @@ #include <s60main.rsg> #include <avkon.rsg> -#include "qs60mainappui_p.h" +#include "qs60mainappui.h" #include <QtGui/qapplication.h> #include <QtGui/qmenu.h> #include <QtGui/private/qt_s60_p.h> QT_BEGIN_NAMESPACE -// ============================ MEMBER FUNCTIONS =============================== - - -// ----------------------------------------------------------------------------- -// QS60MainAppUi::ConstructL() -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// +/*! + * \class QS60MainAppUi + * \obsolete + * \since 4.6 + * \brief Helper class for S60 migration + * + * 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 @@ -80,104 +101,142 @@ void QS60MainAppUi::ConstructL() nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); } -// ----------------------------------------------------------------------------- -// QS60MainAppUi::QS60MainAppUi() -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// +/*! + * \brief Contructs an instance of QS60MainAppUi. + */ QS60MainAppUi::QS60MainAppUi() { // No implementation required } -// ----------------------------------------------------------------------------- -// QS60MainAppUi::~QS60MainAppUi() -// Destructor. -// ----------------------------------------------------------------------------- -// +/*! + * \brief Destroys the QS60MainAppUi. + */ QS60MainAppUi::~QS60MainAppUi() { } -// ----------------------------------------------------------------------------- -// QS60MainAppUi::HandleCommandL() -// Takes care of command handling. -// ----------------------------------------------------------------------------- -// -void QS60MainAppUi::HandleCommandL(TInt aCommand) +/*! + * \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) - qApp->symbianHandleCommand(aCommand); + QT_TRYCATCH_LEAVING(qApp->symbianHandleCommand(command)); } -// ----------------------------------------------------------------------------- -// QS60MainAppUi::HandleResourceChangeL() -// Takes care of event handling. -// ----------------------------------------------------------------------------- -// -void QS60MainAppUi::HandleResourceChangeL(TInt aType) +/*! + * \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) { - CAknAppUi::HandleResourceChangeL(aType); + CAknAppUi::HandleResourceChangeL(type); if (qApp) - qApp->symbianResourceChange(aType); + QT_TRYCATCH_LEAVING(qApp->symbianResourceChange(type)); } -void QS60MainAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl *control) +/*! + * \brief Handles raw window server events. + * + * The event type and information is passed in \a event, 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& event, CCoeControl *destination) { int result = 0; if (qApp) QT_TRYCATCH_LEAVING( - result = qApp->s60ProcessEvent(const_cast<TWsEvent*>(&aEvent)) + result = qApp->s60ProcessEvent(const_cast<TWsEvent*>(&event)) ); if (result <= 0) - CAknAppUi::HandleWsEventL(aEvent, control); + CAknAppUi::HandleWsEventL(event, destination); } -// ----------------------------------------------------------------------------- -// Called by the framework when the application status pane -// size is changed. Passes the new client rectangle to the -// AppView -// ----------------------------------------------------------------------------- -// +/*! + * \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() { - HandleResourceChangeL(KInternalStatusPaneChange); + TRAP_IGNORE(HandleResourceChangeL(KInternalStatusPaneChange)); HandleStackedControlsResourceChange(KInternalStatusPaneChange); } -void QS60MainAppUi::DynInitMenuBarL(TInt, CEikMenuBar *) +/*! + * \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 */) { } -void QS60MainAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane) +/*! + * \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) { - if (aResourceId == R_QT_WRAPPERAPP_MENU) { - if (aMenuPane->NumberOfItemsInPane() <= 1) - qt_symbian_show_toplevel(aMenuPane); - - } else if (aResourceId != R_AVKON_MENUPANE_FEP_DEFAULT && aResourceId != R_AVKON_MENUPANE_EDITTEXT_DEFAULT && aResourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT) { - qt_symbian_show_submenu(aMenuPane, aResourceId); + if (resourceId == R_QT_WRAPPERAPP_MENU) { + 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)); } } -void QS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow, TInt aMenuId, TMenuType aMenuType) +/*! + * \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) { - if ((aMenuId == R_QT_WRAPPERAPP_MENUBAR) || (aMenuId == R_AVKON_MENUPANE_FEP_DEFAULT)) { + if ((resourceId == R_QT_WRAPPERAPP_MENUBAR) || (resourceId == R_AVKON_MENUPANE_FEP_DEFAULT)) { TResourceReader reader; - iCoeEnv->CreateResourceReaderLC(reader, aMenuId); - aMenuWindow->ConstructFromResourceL(reader); + iCoeEnv->CreateResourceReaderLC(reader, resourceId); + menuWindow->ConstructFromResourceL(reader); CleanupStack::PopAndDestroy(); } - if (aMenuType == EMenuPane) - DynInitMenuPaneL(aMenuId, (CEikMenuPane*)aMenuWindow); + if (menuType == EMenuPane) + DynInitMenuPaneL(resourceId, (CEikMenuPane*)menuWindow); else - DynInitMenuBarL(aMenuId, (CEikMenuBar*)aMenuWindow); + DynInitMenuBarL(resourceId, (CEikMenuBar*)menuWindow); } QT_END_NAMESPACE - -// End of File diff --git a/src/gui/s60framework/qs60mainappui.h b/src/gui/s60framework/qs60mainappui.h new file mode 100644 index 0000000..c2c6ef2 --- /dev/null +++ b/src/gui/s60framework/qs60mainappui.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2009 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 <qglobal.h> + +#ifdef Q_WS_S60 + +#include <aknappui.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QS60MainAppUi : public CAknAppUi +{ +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); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_WS_S60 + +#endif // QS60MAINAPPUI_H diff --git a/src/gui/s60framework/qs60mainappui_p.h b/src/gui/s60framework/qs60mainappui_p.h deleted file mode 100644 index 4b10833..0000000 --- a/src/gui/s60framework/qs60mainappui_p.h +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 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_P_H -#define QS60MAINAPPUI_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -// INCLUDES -#include <aknappui.h> - -#include <qglobal.h> - -QT_BEGIN_NAMESPACE - -// FORWARD DECLARATIONS - -// CLASS DECLARATION -/** -* QS60MainAppUi application UI class. -* Interacts with the user through the UI and request message processing -* from the handler class -*/ -class QS60MainAppUi : public CAknAppUi -{ -public: // Constructors and destructor - - /** - * ConstructL. - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * QS60MainAppUi. - * C++ default constructor. This needs to be public due to - * the way the framework constructs the AppUi - */ - QS60MainAppUi(); - - /** - * ~QS60MainAppUi. - * Virtual Destructor. - */ - virtual ~QS60MainAppUi(); - -protected: - void RestoreMenuL(CCoeControl* aMenuWindow,TInt aMenuId,TMenuType aMenuType); - void DynInitMenuBarL(TInt aResourceId, CEikMenuBar *aMenuBar); - void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane); - -private: // Functions from base classes - - /** - * From CEikAppUi, HandleCommandL. - * Takes care of command handling. - * @param aCommand Command to be handled. - */ - void HandleCommandL( TInt aCommand ); - - /** - * From CAknAppUi, HandleResourceChangeL - * Handles resource change events such as layout switches in global level. - * @param aType event type. - */ - void HandleResourceChangeL(TInt aType); - - /** - * HandleStatusPaneSizeChange. - * Called by the framework when the application status pane - * size is changed. - */ - void HandleStatusPaneSizeChange(); - -protected: - void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination); -}; - -QT_END_NAMESPACE - -#endif // QS60MAINAPPUI_P_H - -// End of File diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp index ba66e98..52595db 100644 --- a/src/gui/s60framework/qs60maindocument.cpp +++ b/src/gui/s60framework/qs60maindocument.cpp @@ -39,77 +39,60 @@ ** ****************************************************************************/ -// INCLUDE FILES +#include "qs60mainappui.h" +#include "qs60maindocument.h" + #include <exception> -#include "qs60mainappui_p.h" -#include "qs60maindocument_p.h" QT_BEGIN_NAMESPACE -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// QS60MainDocument::NewL() -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -QS60MainDocument* QS60MainDocument::NewL(CEikApplication& aApp) -{ - QS60MainDocument* self = NewLC(aApp); - CleanupStack::Pop(self); - return self; -} - -// ----------------------------------------------------------------------------- -// QS60MainDocument::NewLC() -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -QS60MainDocument* QS60MainDocument::NewLC(CEikApplication& aApp) -{ - QS60MainDocument* self = new(ELeave) QS60MainDocument(aApp); - CleanupStack::PushL(self); - self->ConstructL(); - return self; -} - -// ----------------------------------------------------------------------------- -// QS60MainDocument::ConstructL() -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void QS60MainDocument::ConstructL() -{ - // No implementation required -} +/*! + * \class QS60MainDocument + * \obsolete + * \since 4.6 + * \brief Helper class for S60 migration + * + * 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 CAknDocument class from Symbian, but internally provides extensions used by Qt. + * + * When modifying old S60 applications that rely on implementing functions in \c CAknDocument, + * the class should be modified to inherit from this class instead of \c CAknDocument. Then the + * application can choose to override only certain functions. + * + * For more information on \c CAknDocument, please see the S60 documentation. + * + * Unlike other Qt classes, QS60MainDocument behaves like an S60 class, and can throw Symbian + * leaves. + * + * \sa QS60MainApplication, QS60MainAppUi + */ -// ----------------------------------------------------------------------------- -// QS60MainDocument::QS60MainDocument() -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// -QS60MainDocument::QS60MainDocument(CEikApplication& aApp) - : CAknDocument(aApp) +/*! + * \brief Constructs an instance of QS60MainDocument. + * + * \a mainApplication should contain a pointer to a QS60MainApplication instance. + */ +QS60MainDocument::QS60MainDocument(CEikApplication& mainApplication) + : CAknDocument(mainApplication) { // No implementation required } -// --------------------------------------------------------------------------- -// QS60MainDocument::~QS60MainDocument() -// Destructor. -// --------------------------------------------------------------------------- -// +/*! + * \brief Destroys the QS60MainDocument. + */ QS60MainDocument::~QS60MainDocument() { // No implementation required } -// --------------------------------------------------------------------------- -// QS60MainDocument::CreateAppUiL() -// Constructs CreateAppUi. -// --------------------------------------------------------------------------- -// -CEikAppUi* QS60MainDocument::CreateAppUiL() +/*! + * \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 @@ -117,5 +100,3 @@ CEikAppUi* QS60MainDocument::CreateAppUiL() } QT_END_NAMESPACE - -// End of File diff --git a/src/gui/s60framework/qs60maindocument.h b/src/gui/s60framework/qs60maindocument.h new file mode 100644 index 0000000..366d311 --- /dev/null +++ b/src/gui/s60framework/qs60maindocument.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2009 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 <qglobal.h> + +#ifdef Q_WS_S60 + +#include <akndoc.h> + +class CEikApplication; + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QS60MainAppUi; + +class Q_GUI_EXPORT QS60MainDocument : public CAknDocument +{ +public: + + QS60MainDocument(CEikApplication &mainApplication); + // The virtuals are for qdoc. + virtual ~QS60MainDocument(); + +public: + + virtual CEikAppUi *CreateAppUiL(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // Q_WS_S60 + +#endif // QS60MAINDOCUMENT_H diff --git a/src/gui/s60framework/qs60maindocument_p.h b/src/gui/s60framework/qs60maindocument_p.h deleted file mode 100644 index d7cee13..0000000 --- a/src/gui/s60framework/qs60maindocument_p.h +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 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_P_H -#define QS60MAINDOCUMENT_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -// INCLUDES -#include <akndoc.h> - -#include <qglobal.h> - -class CEikApplication; - -QT_BEGIN_NAMESPACE - -// FORWARD DECLARATIONS -class QS60MainAppUi; - -// CLASS DECLARATION - -/** -* QS60MainDocument application class. -* An instance of class QS60MainDocument is the Document part of the -* AVKON application framework for the QtS60Main application. -*/ -class QS60MainDocument : public CAknDocument -{ -public: // Constructors and destructor - - /** - * NewL. - * Two-phased constructor. - * Construct a QS60MainDocument for the AVKON application aApp - * using two phase construction, and return a pointer - * to the created object. - * @param aApp Application creating this document. - * @return A pointer to the created instance of QS60MainDocument. - */ - static QS60MainDocument* NewL( CEikApplication& aApp ); - - /** - * NewLC. - * Two-phased constructor. - * Construct a QS60MainDocument for the AVKON application aApp - * using two phase construction, and return a pointer - * to the created object. - * @param aApp Application creating this document. - * @return A pointer to the created instance of QS60MainDocument. - */ - static QS60MainDocument* NewLC( CEikApplication& aApp ); - - /** - * ~QS60MainDocument - * Virtual Destructor. - */ - virtual ~QS60MainDocument(); - -public: // Functions from base classes - - /** - * CreateAppUiL - * From CEikDocument, CreateAppUiL. - * Create a QS60MainAppUi object and return a pointer to it. - * The object returned is owned by the Uikon framework. - * @return Pointer to created instance of AppUi. - */ - CEikAppUi* CreateAppUiL(); - -private: // Constructors - - /** - * ConstructL - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * QS60MainDocument. - * C++ default constructor. - * @param aApp Application creating this document. - */ - QS60MainDocument( CEikApplication& aApp ); - -}; - -QT_END_NAMESPACE - -#endif // QS60MAINDOCUMENT_P_H - -// End of File diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index f9a6d95..fea74fe 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -3,5 +3,6 @@ SOURCES += s60framework/qs60mainapplication.cpp \ s60framework/qs60maindocument.cpp HEADERS += s60framework/qs60mainapplication_p.h \ - s60framework/qs60mainappui_p.h \ - s60framework/qs60maindocument_p.h + s60framework/qs60mainapplication.h \ + s60framework/qs60mainappui.h \ + s60framework/qs60maindocument.h |