diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-06-18 06:41:10 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-06-18 06:41:10 (GMT) |
commit | 9ad849c8520e3a1efe47f1f67fb675c8e7754054 (patch) | |
tree | 188622a4c277d4ff0f372ec78216fcefec8c466a /src | |
parent | 2b09eb0937985015e1ecc42a8bd39f0bc4c84b17 (diff) | |
parent | f0f77eadbefdae45c70945392f6acdc21d47c601 (diff) | |
download | Qt-9ad849c8520e3a1efe47f1f67fb675c8e7754054.zip Qt-9ad849c8520e3a1efe47f1f67fb675c8e7754054.tar.gz Qt-9ad849c8520e3a1efe47f1f67fb675c8e7754054.tar.bz2 |
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qglobal.h | 6 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 11 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_symbian.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qringbuffer_p.h | 8 | ||||
-rw-r--r-- | src/gui/dialogs/qfscompleter_p.h | 5 | ||||
-rw-r--r-- | src/gui/image/qpixmap.h | 9 | ||||
-rw-r--r-- | src/gui/kernel/qaction.h | 9 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 14 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_s60.cpp | 65 | ||||
-rw-r--r-- | src/gui/widgets/qmainwindow.cpp | 4 |
10 files changed, 90 insertions, 46 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 361c038..14b6895 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2314,10 +2314,12 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); #endif #if defined(Q_OS_SYMBIAN) - +QT_END_NAMESPACE // forward declare std::exception +#ifdef __cplusplus namespace std { class exception; } - +#endif +QT_BEGIN_NAMESPACE Q_CORE_EXPORT void qt_translateSymbianErrorToException(int error); Q_CORE_EXPORT void qt_translateExceptionToSymbianErrorL(const std::exception& ex); Q_CORE_EXPORT int qt_translateExceptionToSymbianError(const std::exception& ex); diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 423fbaa..17bb9a7 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -231,6 +231,9 @@ void QTimerActiveObject::RunL() void QTimerActiveObject::Run() { + if (!okToRun()) + return; + if (m_timerInfo->interval > 0) { // Start a new timer immediately so that we don't lose time. iStatus = KRequestPending; @@ -644,9 +647,9 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla QT_TRY { Q_D(QAbstractEventDispatcher); - // It is safe if this counter overflows. The main importance is that each - // iteration count is different from the last. - m_iterationCount++; + // It is safe if this counter overflows. The main importance is that each + // iteration count is different from the last. + m_iterationCount++; RThread &thread = d->threadData->symbian_thread_handle; @@ -719,7 +722,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla break; } block = false; - if (timeState == TimeStarted && time.elapsed() > 100) { + if (timeState == TimeStarted && time.elapsed() > 100) { priority = m_processHandle.Priority(); m_processHandle.SetPriority(EPriorityLow); time.start(); diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index c11a7b9..976227d 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -47,11 +47,12 @@ #include <e32std.h> #include "private/qcore_symbian_p.h" -// Located in qlocale.cpp -extern void getLangAndCountry(const QString &name, QLocale::Language &lang, QLocale::Country &cntry); QT_BEGIN_NAMESPACE +// Located in qlocale.cpp +extern void getLangAndCountry(const QString &name, QLocale::Language &lang, QLocale::Country &cntry); + static TExtendedLocale _s60Locale; // Type definitions for runtime resolved function pointers diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index ac33353..a1bfab0 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -199,8 +199,12 @@ public: inline void clear() { if(!buffers.isEmpty()) { - // remove all but the first - buffers.erase(buffers.begin() + 1, buffers.end()); + QByteArray tmp = buffers[0]; + buffers.clear(); + buffers << tmp; + //TODO merge this optimization ? + //buffers.erase(buffers.begin() + 1, buffers.end()); + //>>>>>>> 08ae7ee1fb930e7d4b4039e2294cba69f9380964:src/corelib/tools/qringbuffer_p.h if (buffers.at(0).size() != basicBlockSize) buffers[0].resize(basicBlockSize); } diff --git a/src/gui/dialogs/qfscompleter_p.h b/src/gui/dialogs/qfscompleter_p.h index 37d9c74..c65eeea 100644 --- a/src/gui/dialogs/qfscompleter_p.h +++ b/src/gui/dialogs/qfscompleter_p.h @@ -55,8 +55,9 @@ #include "qcompleter.h" #include <QtGui/qfilesystemmodel.h> - +QT_BEGIN_NAMESPACE #ifndef QT_NO_COMPLETER + /*! QCompleter that can deal with QFileSystemModel */ @@ -76,6 +77,6 @@ public: QFileSystemModel *sourceModel; }; #endif // QT_NO_COMPLETER - +QT_END_NAMESPACE #endif // QCOMPLETOR_P_H diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 9ef5347..6c24055 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -51,6 +51,10 @@ QT_BEGIN_HEADER +#if defined(Q_OS_SYMBIAN) +class CFbsBitmap; +#endif + QT_BEGIN_NAMESPACE QT_MODULE(Gui) @@ -59,13 +63,8 @@ class QImageWriter; class QColor; class QVariant; class QX11Info; - class QPixmapData; -#if defined(Q_OS_SYMBIAN) -class CFbsBitmap; -#endif - class Q_GUI_EXPORT QPixmap : public QPaintDevice { public: diff --git a/src/gui/kernel/qaction.h b/src/gui/kernel/qaction.h index dfa4933..3449acf 100644 --- a/src/gui/kernel/qaction.h +++ b/src/gui/kernel/qaction.h @@ -91,11 +91,10 @@ class Q_GUI_EXPORT QAction : public QObject public: enum MenuRole { NoRole, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole, AboutRole, PreferencesRole, QuitRole }; - enum SoftKeyRole { OptionsSoftKey, SelectSoftKey, BackSoftKey, NextSoftKey, PreviousSoftKey, - OkSoftKey, CancelSoftKey, EditSoftKey, ViewSoftKey, BackSpaceSoftKey, - EndEditSoftKey, RevertEditSoftKey, DeselectSoftKey, FinishSoftKey, - MenuSoftKey, ContextMenuSoftKey, ExitSoftKey, Key1SoftKey, Key2SoftKey, - Key3SoftKey, Key4SoftKey, CustomSoftKey }; + enum SoftKeyRole { OptionsSoftKey, SelectSoftKey, BackSoftKey, NextSoftKey, PreviousSoftKey, + OkSoftKey, CancelSoftKey, EditSoftKey, ViewSoftKey, BackSpaceSoftKey, + EndEditSoftKey, RevertEditSoftKey, DeselectSoftKey, FinishSoftKey, + MenuSoftKey, ContextMenuSoftKey, ExitSoftKey }; explicit QAction(QObject* parent); QAction(const QString &text, QObject* parent); QAction(const QIcon &icon, const QString &text, QObject* parent); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 42faf98..b7561e4 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -343,7 +343,7 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons QMouseEvent mEvent(QEvent::MouseButtonPress, alienWidget->mapFrom(qwidget, widgetPos), globalPos, Qt::RightButton, QApplicationPrivate::mouse_buttons, Qt::NoModifier); sendMouseEvent(alienWidget, &mEvent); - m_previousEventLongTap = false; + m_previousEventLongTap = true; } void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) @@ -821,18 +821,20 @@ void QApplicationPrivate::openPopup(QWidget *popup) WId id = popup->effectiveWinId(); id->SetPointerCapture(true); id->SetGloballyCapturing(true); - autoGrabWindow = id; } // popups are not focus-handled by the window system (the first // popup grabbed the keyboard), so we have to do that manually: A // new popup gets the focus - if (popup->focusWidget()) { - popup->focusWidget()->setFocus(Qt::PopupFocusReason); + if (QApplication::focusWidget()) + static_cast<QSymbianControl*>(QApplication::focusWidget()->effectiveWinId())->CancelLongTapTimer(); + QWidget *fw = popup->focusWidget(); + if (fw) { + fw->setFocus(Qt::PopupFocusReason); } else if (QApplicationPrivate::popupWidgets->count() == 1) { // this was the first popup - if (QWidget *fw = QApplication::focusWidget()) { - static_cast<QSymbianControl*>(fw->effectiveWinId())->CancelLongTapTimer(); + fw = QApplication::focusWidget(); + if (fw) { QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason); q_func()->sendEvent(fw, &e); } diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index bc69d6d..6109f17 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -85,29 +85,62 @@ void QWidgetPrivate::setSoftKeys_sys(const QList<QAction*> &softkeys) if (isEqual(old, softkeys )) return; } - CCoeAppUi* appui = CEikonEnv::Static()->AppUi(); - CAknAppUi* aknAppUi = static_cast <CAknAppUi*>(appui); - CEikButtonGroupContainer* nativeContainer = aknAppUi->Cba(); + CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer(); nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); - int placeInScreen=0; + int position = -1; + int command; + bool needsExitButton = true; + for (int index = 0; index < softkeys.count(); index++) { const QAction* softKeyAction = softkeys.at(index); - if (softKeyAction->softKeyRole() != QAction::ContextMenuSoftKey) { + switch (softKeyAction->softKeyRole()) { + // Positive Actions go on LSK + case QAction::OptionsSoftKey: + case QAction::MenuSoftKey: + case QAction::ContextMenuSoftKey: + command = EAknSoftkeyOptions; //Calls DynInitMenuPane in AppUI + position = 0; + break; + case QAction::SelectSoftKey: + case QAction::PreviousSoftKey: + case QAction::OkSoftKey: + case QAction::EditSoftKey: + case QAction::ViewSoftKey: + case QAction::EndEditSoftKey: + case QAction::FinishSoftKey: + command = SOFTKEYSTART + index; + position = 0; + break; + // Negative Actions on the RSK + case QAction::BackSoftKey: + case QAction::NextSoftKey: + case QAction::CancelSoftKey: + case QAction::BackSpaceSoftKey: + case QAction::RevertEditSoftKey: + case QAction::DeselectSoftKey: + needsExitButton = false; + command = SOFTKEYSTART + index; + position = 2; + break; + case QAction::ExitSoftKey: + needsExitButton = false; + command = EAknSoftkeyExit; //Calls HandleCommand in AppUI + position = 2; + break; + default: + break; + } - HBufC* text = qt_QString2HBufC(softKeyAction->text()); - CleanupStack::PushL(text); - if (softKeyAction->softKeyRole() == QAction::MenuSoftKey) { - nativeContainer->SetCommandL(placeInScreen, EAknSoftkeyOptions, *text); - } else { - nativeContainer->SetCommandL(placeInScreen, SOFTKEYSTART + index, *text); - } - CleanupStack::PopAndDestroy(); - placeInScreen++; + if (position != -1) { + TPtrC text = qt_QString2TPtrC(softKeyAction->text()); + nativeContainer->SetCommandL(position, command, text); } - if (placeInScreen==1) - placeInScreen=2; } + + if (needsExitButton) + nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QObject::tr("Exit"))); + nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation } diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 5f8371c..394523a 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -482,7 +482,7 @@ void QMainWindow::setMenuBar(QMenuBar *menuBar) } d->layout->setMenuBar(menuBar); if (menuBar) { - QAction* menu = new QAction(QString::fromLatin1("Menu"), this); + QAction* menu = new QAction(QString::fromLatin1("Options"), this); menu->setSoftKeyRole(QAction::MenuSoftKey); setSoftKey(menu); } @@ -1400,7 +1400,7 @@ bool QMainWindow::event(QEvent *event) case QEvent::WindowActivate: if (d->layout->menuBar()) { // ### TODO: This is evil, there is no need to create a new action every time - QAction* menu = new QAction(QString::fromLatin1("Menu"), this); + QAction* menu = new QAction(QString::fromLatin1("Options"), this); menu->setSoftKeyRole(QAction::MenuSoftKey); setSoftKey(menu); } |