From fabf804b147892abb0e8aeb49d1753359ea5e56e Mon Sep 17 00:00:00 2001 From: mread Date: Wed, 30 Jun 2010 15:00:11 +0100 Subject: Avkon removal configured with -no-s60 Avkon dependencies can be configured out with the -no-s60 configure flag, conversely Qt on Symbian will use Avkon if -s60 is configured. These changes are intended to keep or introduce binary compatibility between the s60 and no-s60 configurations. To do this, it has been necessary to introduce stub equivalents of the CAknAppUi related classes into the no-s60 configuration, and override all Avkon framework virtual functions in the QS60Main... classes. Other than that, these changes are mostly just correcting the use of the Q_WS_S60 flag so that it only refers to Avkon dependencies. Reviewed-by: Sami Merila --- mkspecs/common/symbian/symbian.conf | 4 +- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 2 +- src/corelib/global/qglobal.cpp | 14 +-- src/corelib/io/io.pri | 2 +- src/corelib/io/qfsfileengine_unix.cpp | 10 -- src/corelib/kernel/qcore_symbian_p.cpp | 2 +- src/gui/dialogs/qdialog.cpp | 21 ++-- src/gui/dialogs/qdialog.h | 6 +- src/gui/image/qpixmapdatafactory.cpp | 4 +- src/gui/kernel/kernel.pri | 11 ++- src/gui/kernel/qapplication.cpp | 4 +- src/gui/kernel/qapplication.h | 8 +- src/gui/kernel/qapplication_s60.cpp | 15 +-- src/gui/kernel/qt_s60_p.h | 10 +- src/gui/kernel/qwidget.cpp | 2 +- src/gui/kernel/qwidget_s60.cpp | 3 + src/gui/painting/qgraphicssystem.cpp | 4 +- src/gui/s60framework/qs60mainapplication.cpp | 23 ++++- src/gui/s60framework/qs60mainapplication.h | 20 +++- src/gui/s60framework/qs60mainappui.cpp | 131 ++++++++++++++++++++++--- src/gui/s60framework/qs60mainappui.h | 75 +++++++++++++- src/gui/s60framework/qs60maindocument.cpp | 22 +++-- src/gui/s60framework/qs60maindocument.h | 20 +++- src/gui/s60framework/s60framework.pri | 22 +++-- src/gui/util/qdesktopservices_s60.cpp | 19 ++-- src/gui/util/util.pri | 3 +- src/gui/widgets/qmenubar_p.h | 2 +- 27 files changed, 338 insertions(+), 121 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index baa519f..c1b31e5 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -67,7 +67,7 @@ QMAKE_LINK_OBJECT_SCRIPT= QMAKE_LIBS = -llibc -llibm -leuser -llibdl QMAKE_LIBS_CORE = $$QMAKE_LIBS -lefsrv -lhal -lbafl -QMAKE_LIBS_GUI = $$QMAKE_LIBS_CORE -lfbscli -lbitgdi -lgdi -lws32 -lapgrfx -lcone -leikcore -lmediaclientaudio -leikcoctl -leiksrv -lapparc -lcentralrepository +QMAKE_LIBS_GUI = $$QMAKE_LIBS_CORE -lfbscli -lbitgdi -lgdi -lws32 -lapgrfx -lcone -leikcore -lmediaclientaudio -lapparc -lcentralrepository QMAKE_LIBS_NETWORK = QMAKE_LIBS_EGL = -llibEGL QMAKE_LIBS_OPENGL = @@ -75,7 +75,7 @@ QMAKE_LIBS_OPENVG = -llibOpenVG -lfbscli -lbitgdi -lgdi QMAKE_LIBS_THREAD = -llibpthread QMAKE_LIBS_COMPAT = QMAKE_LIBS_QT_ENTRY = -llibcrt0.lib -QMAKE_LIBS_S60 = -lavkon +QMAKE_LIBS_S60 = -lavkon -leikcoctl exists($${EPOCROOT}epoc32/include/platform/sgresource/sgimage.h) { QMAKE_LIBS_OPENVG += -lsgresource diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 9a4e9b2..dc12881 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -3614,7 +3614,7 @@ QString QWebPage::userAgentForUrl(const QUrl&) const firstPartTemp += QString::fromLatin1("Sun Solaris"); #elif defined Q_OS_ULTRIX firstPartTemp += QString::fromLatin1("DEC Ultrix"); -#elif defined Q_WS_S60 +#elif defined Q_OS_SYMBIAN firstPartTemp += QLatin1Char(' '); QSysInfo::S60Version s60Version = QSysInfo::s60Version(); switch (s60Version) { diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b31c83b..75a51ec 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1622,7 +1622,7 @@ bool qSharedBuild() \macro Q_WS_S60 \relates - Defined on S60. + Defined on S60 with the Avkon UI framework. \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_QWS */ @@ -1813,7 +1813,6 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion() #endif #ifdef Q_OS_SYMBIAN -# ifdef Q_WS_S60 static QSysInfo::S60Version cachedS60Version = QSysInfo::S60Version(-1); QSysInfo::S60Version QSysInfo::s60Version() @@ -1885,17 +1884,6 @@ QSysInfo::SymbianVersion QSysInfo::symbianVersion() return SV_Unknown; } } -#else -QSysInfo::S60Version QSysInfo::s60Version() -{ - return SV_S60_None; -} - -QSysInfo::SymbianVersion QSysInfo::symbianVersion() -{ - return SV_Unknown; -} -# endif // ifdef Q_WS_S60 #endif // ifdef Q_OS_SYMBIAN /*! diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index ef448b1..3d964c6 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -93,6 +93,6 @@ win32 { SOURCES += io/qfilesystemwatcher_symbian.cpp HEADERS += io/qfilesystemwatcher_symbian_p.h INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - contains(QT_CONFIG, s60): LIBS += -lplatformenv + LIBS += -lplatformenv } } diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 5762d94..9464a97 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -634,13 +634,8 @@ QString QFSFileEngine::homePath() QString QFSFileEngine::rootPath() { #if defined(Q_OS_SYMBIAN) -# ifdef Q_WS_S60 TFileName symbianPath = PathInfo::PhoneMemoryRootPath(); return QDir::cleanPath(QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath))); -# else -# warning No fallback implementation of QFSFileEngine::rootPath() - return QString(); -# endif #else return QLatin1String("/"); #endif @@ -649,17 +644,12 @@ QString QFSFileEngine::rootPath() QString QFSFileEngine::tempPath() { #if defined(Q_OS_SYMBIAN) -# ifdef Q_WS_S60 TFileName symbianPath = PathInfo::PhoneMemoryRootPath(); QString temp = QDir::fromNativeSeparators(qt_TDesC2QString(symbianPath)); temp += QLatin1String( "temp/"); // Just to verify that folder really exist on hardware QT_MKDIR(QFile::encodeName(temp), 0777); -# else -# warning No fallback implementation of QFSFileEngine::tempPath() - QString temp; -# endif #else QString temp = QFile::decodeName(qgetenv("TMPDIR")); if (temp.isEmpty()) diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index 402eccf..5afde9a 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -131,7 +131,7 @@ public: private: void init() { -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN _LIT(KLibName_3_1, "qts60plugin_3_1" QT_LIBINFIX_UNICODE L".dll"); _LIT(KLibName_3_2, "qts60plugin_3_2" QT_LIBINFIX_UNICODE L".dll"); _LIT(KLibName_5_0, "qts60plugin_5_0" QT_LIBINFIX_UNICODE L".dll"); diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index c2184f2..a2adb05 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -71,8 +71,9 @@ extern bool qt_wince_is_smartphone(); //is defined in qguifunctions_wce.cpp # include "qwizard.h" #endif -#if defined(Q_WS_S60) #include "private/qt_s60_p.h" +#if defined(Q_WS_S60) +#include // AknLayoutUtils #endif #ifndef SPI_GETSNAPTODEFBUTTON @@ -393,7 +394,7 @@ void QDialogPrivate::resetModalitySetByOpen() resetModalityTo = -1; } -#if defined(Q_WS_WINCE) || defined(Q_WS_S60) +#if defined(Q_WS_WINCE) || defined(Q_OS_SYMBIAN) #ifdef Q_WS_WINCE_WM void QDialogPrivate::_q_doneAction() { @@ -413,7 +414,7 @@ bool QDialog::event(QEvent *e) accept(); result = true; } -#else +#elif defined(Q_WS_S60) if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) { if (!testAttribute(Qt::WA_Moved)) { Qt::WindowStates state = windowState(); @@ -423,6 +424,7 @@ bool QDialog::event(QEvent *e) setWindowState(state); } } + // TODO is Symbian, non-S60 behaviour required? #endif return result; } @@ -823,8 +825,8 @@ void QDialog::adjustPosition(QWidget* w) return; #endif -#ifdef Q_WS_S60 - if (s60AdjustedPosition()) +#ifdef Q_OS_SYMBIAN + if (symbianAdjustedPosition()) //dialog has already been positioned return; #endif @@ -892,10 +894,11 @@ void QDialog::adjustPosition(QWidget* w) move(p); } -#if defined(Q_WS_S60) +#if defined(Q_OS_SYMBIAN) /*! \internal */ -bool QDialog::s60AdjustedPosition() +bool QDialog::symbianAdjustedPosition() { +#if defined(Q_WS_S60) QPoint p; const bool doS60Positioning = !(isFullScreen()||isMaximized()); if (doS60Positioning) { @@ -940,6 +943,10 @@ bool QDialog::s60AdjustedPosition() move(p); } return doS60Positioning; +#else + // TODO - check positioning requirement for Symbian, non-s60 + return false; +#endif } #endif diff --git a/src/gui/dialogs/qdialog.h b/src/gui/dialogs/qdialog.h index 777256a..b2ba93c 100644 --- a/src/gui/dialogs/qdialog.h +++ b/src/gui/dialogs/qdialog.h @@ -107,7 +107,7 @@ public Q_SLOTS: protected: QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = 0); -#if defined(Q_WS_WINCE) || defined(Q_WS_S60) +#if defined(Q_WS_WINCE) || defined(Q_OS_SYMBIAN) bool event(QEvent *e); #endif void keyPressEvent(QKeyEvent *); @@ -123,8 +123,8 @@ private: Q_DECLARE_PRIVATE(QDialog) Q_DISABLE_COPY(QDialog) -#if defined(Q_WS_S60) - bool s60AdjustedPosition(); +#if defined(Q_OS_SYMBIAN) + bool symbianAdjustedPosition(); #endif diff --git a/src/gui/image/qpixmapdatafactory.cpp b/src/gui/image/qpixmapdatafactory.cpp index 8014660..7498a7c 100644 --- a/src/gui/image/qpixmapdatafactory.cpp +++ b/src/gui/image/qpixmapdatafactory.cpp @@ -53,7 +53,7 @@ #ifdef Q_WS_MAC # include #endif -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN # include #endif @@ -82,7 +82,7 @@ QPixmapData* QSimplePixmapDataFactory::create(QPixmapData::PixelType type) return new QRasterPixmapData(type); #elif defined(Q_WS_MAC) return new QMacPixmapData(type); -#elif defined(Q_WS_S60) +#elif defined(Q_OS_SYMBIAN) return new QS60PixmapData(type); #else #error QSimplePixmapDataFactory::create() not implemented diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 6fd45ad..f9c84c1 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -120,18 +120,21 @@ symbian { kernel/qkeymapper_s60.cpp\ kernel/qclipboard_s60.cpp\ kernel/qdnd_s60.cpp \ - kernel/qsound_s60.cpp \ - kernel/qsoftkeymanager_s60.cpp + kernel/qsound_s60.cpp HEADERS += \ kernel/qt_s60_p.h \ - kernel/qeventdispatcher_s60_p.h \ - kernel/qsoftkeymanager_s60_p.h + kernel/qeventdispatcher_s60_p.h LIBS += -lbafl -lestor INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE INCLUDEPATH += ../3rdparty/s60 + + contains(QT_CONFIG, s60) { + SOURCES += kernel/qsoftkeymanager_s60.cpp + HEADERS += kernel/qsoftkeymanager_s60_p.h + } } diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 1680ef4..893de03 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2771,7 +2771,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { qt_win_set_cursor(cursorWidget, true); #elif defined(Q_WS_X11) qt_x11_enforce_cursor(cursorWidget, true); -#elif defined(Q_WS_S60) +#elif defined(Q_OS_SYMBIAN) qt_symbian_set_cursor(cursorWidget, true); #endif } @@ -5338,7 +5338,7 @@ QInputContext *QApplication::inputContext() const qic = QInputContextFactory::create(QLatin1String("xim"), that); that->d_func()->inputContext = qic; } -#elif defined(Q_OS_SYMBIAN) +#elif defined(Q_WS_SYMBIAN) if (!d->inputContext) { QApplication *that = const_cast(this); const QStringList keys = QInputContextFactory::keys(); diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index cb1d063..d31d9e5 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -61,7 +61,7 @@ QT_BEGIN_HEADER -#if defined(Q_WS_S60) +#if defined(Q_OS_SYMBIAN) class CApaApplication; #endif @@ -118,7 +118,7 @@ class Q_GUI_EXPORT QApplication : public QCoreApplication public: enum Type { Tty, GuiClient, GuiServer }; -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN typedef CApaApplication * (*QS60MainApplicationFactory)(); #endif @@ -130,7 +130,7 @@ 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) +#if defined(Q_OS_SYMBIAN) QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int = QT_VERSION); #endif #endif @@ -366,7 +366,7 @@ 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) +#if defined(Q_OS_SYMBIAN) || defined(qdoc) QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv); #endif #endif diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index a7c7310..0d65811 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -69,14 +69,17 @@ #include "apgwgnam.h" // For CApaWindowGroupName #include // For CMdaAudioToneUtility +#if defined(Q_OS_SYMBIAN) +# include +# include +# include "qs60mainappui.h" +# include "qinputcontext.h" +#endif + #if defined(Q_WS_S60) # if !defined(QT_NO_IM) -# include "qinputcontext.h" # include # endif -# include -# include -# include "qs60mainappui.h" #endif #include "private/qstylesheetstyle_p.h" @@ -894,7 +897,7 @@ TKeyResponse QSymbianControl::sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent) if (qic && qic->filterEvent(keyEvent)) return EKeyWasConsumed; } -#endif // !defined(QT_NO_IM) && defined(Q_WS_S60) +#endif // !defined(QT_NO_IM) && defined(Q_OS_SYMBIAN) if (widget && qt_sendSpontaneousEvent(widget, keyEvent)) if (keyEvent->isAccepted()) @@ -1974,10 +1977,10 @@ int QApplicationPrivate::symbianHandleCommand(const QSymbianEvent *symbianEvent) ret = 1; break; default: +#ifdef Q_WS_S60 bool handled = QSoftKeyManager::handleCommand(command); if (handled) ret = 1; -#ifdef Q_WS_S60 else ret = QMenuBarPrivate::symbianCommands(command); #endif diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 204e38c..d8ef67d 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -155,7 +155,9 @@ public: static inline CAknTitlePane* titlePane(); static inline CAknContextPane* contextPane(); static inline CEikButtonGroupContainer* buttonGroupContainer(); +#endif +#ifdef Q_OS_SYMBIAN TTrapHandler *s60InstalledTrapHandler; #endif }; @@ -208,7 +210,7 @@ protected: // from MAknFadedComponent TInt CountFadedComponents() {return 1;} CCoeControl* FadedComponent(TInt /*aIndex*/) {return this;} #else - #warning No fallback implementation for QSymbianControl::FadeBehindPopup + // #warning No fallback implementation for QSymbianControl::FadeBehindPopup void FadeBehindPopup(bool /*fade*/){ } #endif @@ -277,9 +279,9 @@ inline QS60Data::QS60Data() avkonComponentsSupportTransparency(0), menuBeingConstructed(0), memoryLimitForHwRendering(0), - s60ApplicationFactory(0), -#ifdef Q_WS_S60 - s60InstalledTrapHandler(0) + s60ApplicationFactory(0) +#ifdef Q_OS_SYMBIAN + ,s60InstalledTrapHandler(0) #endif { } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index dd568cd..233df15 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -10695,7 +10695,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) break; case Qt::WA_AcceptTouchEvents: -#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_WS_S60) +#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN) if (on) d->registerTouchWindow(); #endif diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 3f351d9..2818d88 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -54,6 +54,7 @@ #ifdef Q_WS_S60 #include +#include #endif // This is necessary in order to be able to perform delayed invokation on slots @@ -1082,12 +1083,14 @@ void QWidget::setWindowState(Qt::WindowStates newstate) Qt::WindowStates oldstate = windowState(); const TBool isFullscreen = newstate & Qt::WindowFullScreen; +#ifdef Q_WS_S60 const TBool cbaRequested = windowFlags() & Qt::WindowSoftkeysVisibleHint; const TBool cbaVisible = CEikButtonGroupContainer::Current() ? true : false; const TBool softkeyVisibilityChange = isFullscreen && (cbaRequested != cbaVisible); if (oldstate == newstate && !softkeyVisibilityChange) return; +#endif // Q_WS_S60 if (isWindow()) { createWinId(); diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index 2ea3d33..bd9e7fc 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -50,7 +50,7 @@ #ifdef Q_WS_MAC # include #endif -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN # include #endif @@ -71,7 +71,7 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ return new QRasterPixmapData(type); #elif defined(Q_WS_MAC) return new QMacPixmapData(type); -#elif defined(Q_WS_S60) +#elif defined(Q_OS_SYMBIAN) return new QS60PixmapData(type); #elif !defined(Q_WS_QWS) #error QGraphicsSystem::createDefaultPixmapData() not implemented diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp index 41ac1a8..0f9367e 100644 --- a/src/gui/s60framework/qs60mainapplication.cpp +++ b/src/gui/s60framework/qs60mainapplication.cpp @@ -71,17 +71,17 @@ _LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main" QT_LIBINFIX_UNICODE L". 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 + 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 CAknApplication, the class should be modified to - inherit from this class instead of \c CAknApplication. Then the + 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 CAknApplication, please see the S60 documentation. + 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. @@ -136,4 +136,19 @@ TFileName QS60MainApplication::ResourceFileName() const return KNullDesC(); } +void QS60MainApplication::PreDocConstructL() +{ + QS60MainApplicationBase::PreDocConstructL(); +} + +CDictionaryStore *QS60MainApplication::OpenIniFileLC(RFs &aFs) const +{ + return QS60MainApplicationBase::OpenIniFileLC(aFs); +} + +void QS60MainApplication::NewAppServerL(CApaAppServer *&aAppServer) +{ + QS60MainApplicationBase::NewAppServerL(aAppServer); +} + QT_END_NAMESPACE diff --git a/src/gui/s60framework/qs60mainapplication.h b/src/gui/s60framework/qs60mainapplication.h index 997f30f..cb22e68 100644 --- a/src/gui/s60framework/qs60mainapplication.h +++ b/src/gui/s60framework/qs60mainapplication.h @@ -44,9 +44,15 @@ #include -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN +#ifdef Q_WS_S60 #include +typedef CAknApplication QS60MainApplicationBase; +#else +#include +typedef CEikApplication QS60MainApplicationBase; +#endif QT_BEGIN_HEADER @@ -54,7 +60,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QS60MainApplication : public CAknApplication +class Q_GUI_EXPORT QS60MainApplication : public QS60MainApplicationBase { public: QS60MainApplication(); @@ -65,6 +71,14 @@ public: virtual TFileName ResourceFileName() const; +public: + + virtual void PreDocConstructL(); + + virtual CDictionaryStore *OpenIniFileLC(RFs &aFs) const; + + virtual void NewAppServerL(CApaAppServer *&aAppServer); + protected: virtual CApaDocument *CreateDocumentL(); @@ -74,6 +88,6 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // Q_WS_S60 +#endif // Q_OS_SYMBIAN #endif // QS60MAINAPPLICATION_H diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index ce13de8..40c2d03 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -41,20 +41,25 @@ // INCLUDE FILES #include +#include +#ifdef Q_WS_S60 #include #include #include +#include +#endif #include #include -#if defined(QT_LIBINFIX_UNQUOTED) +#ifdef Q_WS_S60 +# if defined(QT_LIBINFIX_UNQUOTED) // Two level macro needed for proper expansion of libinfix -# define QT_S60MAIN_RSG_2(x) -# define QT_S60MAIN_RSG(x) QT_S60MAIN_RSG_2(x) -# include QT_S60MAIN_RSG(QT_LIBINFIX_UNQUOTED) -#else -# include +# define QT_S60MAIN_RSG_2(x) +# define QT_S60MAIN_RSG(x) QT_S60MAIN_RSG_2(x) +# include QT_S60MAIN_RSG(QT_LIBINFIX_UNQUOTED) +# else +# include +# endif #endif -#include #include "qs60mainappui.h" #include @@ -115,14 +120,16 @@ void QS60MainAppUi::ConstructL() // 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 = CAknAppUi::EAknEnableSkin - | CAknAppUi::ENoScreenFurniture - | CAknAppUi::ENonStandardResourceFile; + 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. if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) flags |= KAknDisableAnimationBackground; +#endif BaseConstructL(flags); } @@ -168,7 +175,7 @@ void QS60MainAppUi::HandleCommandL(TInt command) */ void QS60MainAppUi::HandleResourceChangeL(TInt type) { - CAknAppUi::HandleResourceChangeL(type); + QS60MainAppUiBase::HandleResourceChangeL(type); if (qApp) { QSymbianEvent event(QSymbianEvent::ResourceChangeEvent, type); @@ -185,7 +192,7 @@ void QS60MainAppUi::HandleResourceChangeL(TInt type) * 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) +void QS60MainAppUi::HandleWsEventL(const TWsEvent &wsEvent, CCoeControl *destination) { int result = 0; if (qApp) { @@ -196,7 +203,7 @@ void QS60MainAppUi::HandleWsEventL(const TWsEvent& wsEvent, CCoeControl *destina } if (result <= 0) - CAknAppUi::HandleWsEventL(wsEvent, destination); + QS60MainAppUiBase::HandleWsEventL(wsEvent, destination); } @@ -236,6 +243,7 @@ void QS60MainAppUi::DynInitMenuBarL(TInt /* resourceId */, CEikMenuBar * /* menu */ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) { +#ifdef Q_WS_S60 if (resourceId == R_QT_WRAPPERAPP_MENU) { if (menuPane->NumberOfItemsInPane() <= 1) QT_TRYCATCH_LEAVING(qt_symbian_show_toplevel(menuPane)); @@ -245,6 +253,9 @@ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) && resourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT) { QT_TRYCATCH_LEAVING(qt_symbian_show_submenu(menuPane, resourceId)); } +#else + QS60MainAppUiBase::DynInitMenuPaneL(resourceId, menuPane); +#endif } /*! @@ -255,16 +266,104 @@ void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane) * * If you override this function, you should call the base class implementation as well. */ -void QS60MainAppUi::RestoreMenuL(CCoeControl* menuWindow, TInt resourceId, TMenuType menuType) +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 { - CAknAppUi::RestoreMenuL(menuWindow, resourceId, menuType); + } else +#endif + { + QS60MainAppUiBase::RestoreMenuL(menuWindow, resourceId, menuType); } } +void QS60MainAppUi::Exit() +{ + QS60MainAppUiBase::Exit(); +} + +void QS60MainAppUi::SetFadedL(TBool aFaded) +{ + QS60MainAppUiBase::SetFadedL(aFaded); +} + +TRect QS60MainAppUi::ApplicationRect() const +{ + return QS60MainAppUiBase::ApplicationRect(); +} + +void QS60MainAppUi::HandleScreenDeviceChangedL() +{ + QS60MainAppUiBase::HandleScreenDeviceChangedL(); +} + +void QS60MainAppUi::HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent) +{ + QS60MainAppUiBase::HandleApplicationSpecificEventL(aType, aEvent); +} + +TTypeUid::Ptr QS60MainAppUi::MopSupplyObject(TTypeUid aId) +{ + return QS60MainAppUiBase::MopSupplyObject(aId); +} + +void QS60MainAppUi::ProcessCommandL(TInt aCommand) +{ + QS60MainAppUiBase::ProcessCommandL(aCommand); +} + +TErrorHandlerResponse QS60MainAppUi::HandleError (TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText) +{ + return QS60MainAppUiBase::HandleError(aError, aExtErr, aErrorText, aContextText); +} + +void QS60MainAppUi::HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId) +{ + QS60MainAppUiBase::HandleViewDeactivation(aViewIdToBeDeactivated, aNewlyActivatedViewId); +} + +void QS60MainAppUi::PrepareToExit() +{ + QS60MainAppUiBase::PrepareToExit(); +} + +void QS60MainAppUi::HandleTouchPaneSizeChange() +{ + QS60MainAppUiBase::HandleTouchPaneSizeChange(); +} + +void QS60MainAppUi::HandleSystemEventL(const TWsEvent &aEvent) +{ + QS60MainAppUiBase::HandleSystemEventL(aEvent); +} + +void QS60MainAppUi::Reserved_MtsmPosition() +{ + QS60MainAppUiBase::Reserved_MtsmPosition(); +} + +void QS60MainAppUi::Reserved_MtsmObject() +{ + QS60MainAppUiBase::Reserved_MtsmObject(); +} + +void QS60MainAppUi::HandleForegroundEventL(TBool aForeground) +{ + QS60MainAppUiBase::HandleForegroundEventL(aForeground); +} + +#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/gui/s60framework/qs60mainappui.h b/src/gui/s60framework/qs60mainappui.h index dcc72d1..796059f 100644 --- a/src/gui/s60framework/qs60mainappui.h +++ b/src/gui/s60framework/qs60mainappui.h @@ -44,9 +44,55 @@ #include -#ifdef Q_WS_S60 +#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 @@ -54,7 +100,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QS60MainAppUi : public CAknAppUi +class Q_GUI_EXPORT QS60MainAppUi : public QS60MainAppUiBase { public: QS60MainAppUi(); @@ -63,7 +109,7 @@ public: virtual void ConstructL(); - virtual void RestoreMenuL(CCoeControl* menuWindow,TInt resourceId,TMenuType menuType); + virtual void RestoreMenuL(CCoeControl *menuWindow,TInt resourceId,TMenuType menuType); virtual void DynInitMenuBarL(TInt resourceId, CEikMenuBar *menuBar); virtual void DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane); @@ -74,13 +120,32 @@ public: virtual void HandleStatusPaneSizeChange(); protected: - virtual void HandleWsEventL(const TWsEvent& event, CCoeControl* destination); + 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(); + +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_WS_S60 +#endif // Q_OS_SYMBIAN #endif // QS60MAINAPPUI_H diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp index 487e067..ed33a41 100644 --- a/src/gui/s60framework/qs60maindocument.cpp +++ b/src/gui/s60framework/qs60maindocument.cpp @@ -57,15 +57,15 @@ QT_BEGIN_NAMESPACE 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 + 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 CAknDocument, the class should be modified to - inherit from this class instead of \c CAknDocument. Then the + 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 CAknDocument, please see the S60 + For more information on \c CEikDocument, please see the S60 documentation. Unlike other Qt classes, QS60MainDocument behaves like an S60 class, @@ -79,8 +79,8 @@ QT_BEGIN_NAMESPACE * * \a mainApplication should contain a pointer to a QS60MainApplication instance. */ -QS60MainDocument::QS60MainDocument(CEikApplication& mainApplication) - : CAknDocument(mainApplication) +QS60MainDocument::QS60MainDocument(CEikApplication &mainApplication) + : QS60MainDocumentBase(mainApplication) { // No implementation required } @@ -105,4 +105,14 @@ CEikAppUi *QS60MainDocument::CreateAppUiL() return (static_cast (new(ELeave)QS60MainAppUi)); } +CFileStore *QS60MainDocument::OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &aFs) +{ + return QS60MainDocumentBase::OpenFileL(aDoOpen, aFilename, aFs); +} + +void QS60MainDocument::OpenFileL(CFileStore *&aFileStore, RFile &aFile) +{ + QS60MainDocumentBase::OpenFileL(aFileStore, aFile); +} + QT_END_NAMESPACE diff --git a/src/gui/s60framework/qs60maindocument.h b/src/gui/s60framework/qs60maindocument.h index 553675f..2f0564f 100644 --- a/src/gui/s60framework/qs60maindocument.h +++ b/src/gui/s60framework/qs60maindocument.h @@ -44,9 +44,15 @@ #include -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN -#include +#ifdef Q_WS_S60 +#include +typedef CAknDocument QS60MainDocumentBase; +#else +#include +typedef CEikDocument QS60MainDocumentBase; +#endif class CEikApplication; @@ -58,7 +64,7 @@ QT_MODULE(Gui) class QS60MainAppUi; -class Q_GUI_EXPORT QS60MainDocument : public CAknDocument +class Q_GUI_EXPORT QS60MainDocument : public QS60MainDocumentBase { public: @@ -69,12 +75,18 @@ public: 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_WS_S60 +#endif // Q_OS_SYMBIAN #endif // QS60MAINDOCUMENT_H diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index f9d89dc..edbacc0 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -1,16 +1,20 @@ +contains(QT_CONFIG, s60) { # This block serves the minimalistic resource file for S60 3.1 platforms. # Note there is no way to ifdef S60 version in mmp file, that is why the resource # file is always compiled for WINSCW -minimalAppResource31 = \ - "SOURCEPATH s60framework" \ - "START RESOURCE s60main.rss" \ - "TARGET s60main$${QT_LIBINFIX}" \ - "HEADER" \ - "TARGETPATH /resource/apps" \ - "END" -MMP_RULES += minimalAppResource31 -SYMBIAN_RESOURCES += s60framework/s60main.rss + minimalAppResource31 = \ + "SOURCEPATH s60framework" \ + "START RESOURCE s60main.rss" \ + "TARGET s60main$${QT_LIBINFIX}" \ + "HEADER" \ + "TARGETPATH /resource/apps" \ + "END" + + MMP_RULES += minimalAppResource31 + + SYMBIAN_RESOURCES += s60framework/s60main.rss +} SOURCES += s60framework/qs60mainapplication.cpp \ s60framework/qs60mainappui.cpp \ diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index a415180..24f6ccf 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -39,9 +39,6 @@ ** ****************************************************************************/ -// This flag changes the implementation to use S60 CDcoumentHandler -// instead of apparch when opening the files -#define USE_DOCUMENTHANDLER #include #include @@ -56,10 +53,16 @@ #include // RSendAs #include // RSendAsMessage +#ifdef Q_WS_S60 +// This flag changes the implementation to use S60 CDcoumentHandler +// instead of apparch when opening the files +#define USE_DOCUMENTHANDLER +#endif + // copied from miutset.h, so we don't get a dependency into the app layer const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN # include // PathInfo # ifdef USE_DOCUMENTHANDLER # include // CDocumentHandler @@ -264,7 +267,7 @@ static TDriveUnit writableExeDrive() static TPtrC writableDataRoot() { TDriveUnit drive = exeDrive(); -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN switch(drive.operator TInt()){ case EDriveC: return PathInfo::PhoneMemoryRootPath(); @@ -391,19 +394,19 @@ QString QDesktopServices::storageLocation(StandardLocation type) break; case MusicLocation: path.Append(writableDataRoot()); -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN path.Append(PathInfo::SoundsPath()); #endif break; case MoviesLocation: path.Append(writableDataRoot()); -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN path.Append(PathInfo::VideosPath()); #endif break; case PicturesLocation: path.Append(writableDataRoot()); -#ifdef Q_WS_S60 +#ifdef Q_OS_SYMBIAN path.Append(PathInfo::ImagesPath()); #endif break; diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index be8db93..bea520e 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -43,9 +43,8 @@ embedded { } symbian { - LIBS += -lsendas2 -letext -lapmime + LIBS += -lsendas2 -letext -lapmime -lplatformenv contains(QT_CONFIG, s60) { - LIBS += -lplatformenv contains(CONFIG, is_using_gnupoc) { LIBS += -lcommonui } else { diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h index 82070fe..fc6701c 100644 --- a/src/gui/widgets/qmenubar_p.h +++ b/src/gui/widgets/qmenubar_p.h @@ -269,10 +269,10 @@ public: } *symbian_menubar; static int symbianCommands(int command); +#endif #ifdef QT_SOFTKEYS_ENABLED QAction *menuBarAction; #endif -#endif }; #endif -- cgit v0.12