summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.cpp50
-rw-r--r--src/corelib/global/qglobal.h15
-rw-r--r--src/corelib/tools/qscopedpointer.cpp15
-rw-r--r--src/gui/dialogs/qfiledialog.cpp28
-rw-r--r--src/gui/dialogs/qfiledialog_p.h26
-rw-r--r--src/gui/image/qpicture.cpp12
-rw-r--r--src/gui/image/qpicture_p.h2
-rw-r--r--src/gui/kernel/qaction.h2
-rw-r--r--src/gui/kernel/qapplication_s60.cpp5
-rw-r--r--src/gui/kernel/qeventdispatcher_s60.cpp8
-rw-r--r--src/gui/kernel/qwidget.h2
-rw-r--r--src/gui/painting/qpainterpath.cpp18
-rw-r--r--src/gui/painting/qpainterpath.h6
-rw-r--r--src/gui/styles/qs60style.cpp17
-rw-r--r--src/gui/util/qdesktopservices_s60.cpp75
-rw-r--r--src/gui/widgets/qmenu_symbian.cpp11
16 files changed, 169 insertions, 123 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 6590ea6..88f845a 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1929,6 +1929,7 @@ void qt_check_pointer(const char *n, int l)
qWarning("In file %s, line %d: Out of memory", n, l);
}
+#ifndef QT_NO_EXCEPTIONS
/* \internal
Allows you to throw an exception without including <new>
Called internally from Q_CHECK_PTR on certain OS combinations
@@ -1937,6 +1938,7 @@ void qBadAlloc()
{
QT_THROW(std::bad_alloc());
}
+#endif
/*
The Q_ASSERT macro calls this function when the test fails.
@@ -3215,7 +3217,8 @@ bool QInternal::callFunction(InternalFunction func, void **args)
#include <typeinfo>
/*! \macro QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(function)
- \relates QSymbianLeaveException
+ \relates <QtGlobal>
+ \ingroup qts60
TRAP leaves from Symbian \a function and throws an appropriate
standard C++ exception instead.
@@ -3241,7 +3244,7 @@ bool QInternal::callFunction(InternalFunction func, void **args)
*/
/*! \macro QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(error, function)
- \relates QSymbianLeaveException
+ \relates <QtGlobal>
\ingroup qts60
Catch standard C++ exceptions from a \a function and convert them to a Symbian OS
@@ -3272,7 +3275,7 @@ bool QInternal::callFunction(InternalFunction func, void **args)
*/
/*! \macro QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(function)
- \relates QSymbianLeaveException
+ \relates <QtGlobal>
\ingroup qts60
Catch standard C++ exceptions from \a function and convert them to Symbian OS
@@ -3298,37 +3301,22 @@ bool QInternal::callFunction(InternalFunction func, void **args)
\sa QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(), QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR()
*/
-/*! \class QSymbianLeaveException
- \ingroup qts60
- \brief The QSymbianLeaveException class represents a block of Symbian leave code.
-
- \warning This class is only available on Symbian.
-*/
-
-/*! \fn QSymbianLeaveException::QSymbianLeaveException(int error)
+#include <stdexcept>
- Constructs a QSymbianLeaveException object that stores the given
- Symbian \a error code.
-*/
-
-/*! \fn const char *QSymbianLeaveException::what() const
-
- Returns a C-style character string describing the general
- cause of the current error.
-
- The string is not localized.
-*/
-const char *QSymbianLeaveException::what() const throw()
+class QSymbianLeaveException : public std::exception
{
- static char msg[36];
- snprintf(msg, sizeof(msg), "Symbian leave exception %d", error);
- return msg;
-}
+public:
+ inline QSymbianLeaveException(int err) : error(err) {}
+ inline const char* what() const throw() { return "Symbian leave exception"; }
+
+public:
+ int error;
+};
-/*! \relates QSymbianLeaveException
+/*! \relates <QtGlobal>
\ingroup qts60
- Throws a QSymbianLeaveException if the \a error parameter is a symbian error code.
+ Throws an exception if the \a error parameter is a symbian error code.
This is the exception throwing equivalent of Symbian's User::LeaveIfError.
\warning This function is only available on Symbian.
@@ -3347,7 +3335,7 @@ void qt_translateSymbianErrorToException(int error)
}
}
-/*! \relates QSymbianLeaveException
+/*! \relates <QtGlobal>
\ingroup qts60
Convert a caught standard C++ exception \a aThrow to a Symbian leave
@@ -3361,7 +3349,7 @@ void qt_translateExceptionToSymbianErrorL(const std::exception& aThrow)
User::Leave(qt_translateExceptionToSymbianError(aThrow));
}
-/*! \relates QSymbianLeaveException
+/*! \relates <QtGlobal>
\ingroup qts60
Convert a caught standard C++ exception \a aThrow to a Symbian error code
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 450fd86..361c038 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1605,7 +1605,10 @@ Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *
#endif
Q_CORE_EXPORT void qt_check_pointer(const char *, int);
+
+#ifndef QT_NO_EXCEPTIONS
Q_CORE_EXPORT void qBadAlloc();
+#endif
#ifdef QT_NO_EXCEPTIONS
# if defined(QT_NO_DEBUG)
@@ -2312,16 +2315,8 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf();
#if defined(Q_OS_SYMBIAN)
-#include <stdexcept>
-
-class QSymbianLeaveException : public std::exception
-{
-public:
- inline QSymbianLeaveException(int err) : error(err) {}
- const char* what() const throw();
-public:
- int error;
-};
+// forward declare std::exception
+namespace std { class exception; }
Q_CORE_EXPORT void qt_translateSymbianErrorToException(int error);
Q_CORE_EXPORT void qt_translateExceptionToSymbianErrorL(const std::exception& ex);
diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp
index 0239575..6a1ffb6 100644
--- a/src/corelib/tools/qscopedpointer.cpp
+++ b/src/corelib/tools/qscopedpointer.cpp
@@ -134,6 +134,21 @@
*/
/*!
+ \fn bool QScopedPointer::operator==(const QScopedPointer<T> &other) const
+
+ Equality operator. Returns true if the scoped pointer \a other
+ is pointing to the same object as this pointer, otherwise returns false.
+*/
+
+
+/*!
+ \fn bool QScopedPointer::operator!=(const QScopedPointer<T> *other) const
+
+ Inequality operator. Returns true if the scoped pointer \a other
+ is not pointing to the same object as this pointer, otherwise returns false.
+*/
+
+/*!
\fn bool QScopedPointer::isNull() const
Returns \c true if this object is holding a pointer that is \c null.
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 60d3034..9768162 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -487,6 +487,34 @@ void QFileDialog::changeEvent(QEvent *e)
QDialog::changeEvent(e);
}
+QFileDialogPrivate::QFileDialogPrivate()
+ :
+#ifndef QT_NO_PROXYMODEL
+ proxyModel(0),
+#endif
+ model(0),
+ fileMode(QFileDialog::AnyFile),
+ acceptMode(QFileDialog::AcceptOpen),
+ currentHistoryLocation(-1),
+ renameAction(0),
+ deleteAction(0),
+ showHiddenAction(0),
+ useDefaultCaption(true),
+ defaultFileTypes(true),
+ fileNameLabelExplicitlySat(false),
+ nativeDialogInUse(false),
+#ifdef Q_WS_MAC
+ mDelegate(0),
+#ifndef QT_MAC_USE_COCOA
+ mDialog(0),
+ mDialogStarted(false),
+ mDialogClosed(true),
+#endif
+#endif
+ qFileDialogUi(0)
+{
+}
+
QFileDialogPrivate::~QFileDialogPrivate()
{
}
diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h
index 99f61f0..3195583 100644
--- a/src/gui/dialogs/qfiledialog_p.h
+++ b/src/gui/dialogs/qfiledialog_p.h
@@ -113,31 +113,7 @@ class Q_AUTOTEST_EXPORT QFileDialogPrivate : public QDialogPrivate
Q_DECLARE_PUBLIC(QFileDialog)
public:
- QFileDialogPrivate() :
-#ifndef QT_NO_PROXYMODEL
- proxyModel(0),
-#endif
- model(0),
- fileMode(QFileDialog::AnyFile),
- acceptMode(QFileDialog::AcceptOpen),
- currentHistoryLocation(-1),
- renameAction(0),
- deleteAction(0),
- showHiddenAction(0),
- useDefaultCaption(true),
- defaultFileTypes(true),
- fileNameLabelExplicitlySat(false),
- nativeDialogInUse(false),
-#ifdef Q_WS_MAC
- mDelegate(0),
-#ifndef QT_MAC_USE_COCOA
- mDialog(0),
- mDialogStarted(false),
- mDialogClosed(true),
-#endif
-#endif
- qFileDialogUi(0)
- {}
+ QFileDialogPrivate();
void createToolButtons();
void createMenuActions();
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index 8528173..a16305e 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -1041,6 +1041,18 @@ QPicture& QPicture::operator=(const QPicture &p)
/*!
\internal
+ Constructs a QPicturePrivate
+*/
+QPicturePrivate::QPicturePrivate()
+ : in_memory_only(false),
+ q_ptr(0)
+{
+ ref = 1;
+}
+
+/*!
+ \internal
+
Sets formatOk to false and resets the format version numbers to default
*/
diff --git a/src/gui/image/qpicture_p.h b/src/gui/image/qpicture_p.h
index e0c3117..373ff15 100644
--- a/src/gui/image/qpicture_p.h
+++ b/src/gui/image/qpicture_p.h
@@ -143,7 +143,7 @@ public:
PdcReservedStop = 199 // for Qt
};
- inline QPicturePrivate() : in_memory_only(false), q_ptr(0) { ref = 1; }
+ QPicturePrivate();
QAtomicInt ref;
bool checkFormat();
diff --git a/src/gui/kernel/qaction.h b/src/gui/kernel/qaction.h
index 8791a5c..dfa4933 100644
--- a/src/gui/kernel/qaction.h
+++ b/src/gui/kernel/qaction.h
@@ -94,7 +94,7 @@ public:
enum SoftKeyRole { OptionsSoftKey, SelectSoftKey, BackSoftKey, NextSoftKey, PreviousSoftKey,
OkSoftKey, CancelSoftKey, EditSoftKey, ViewSoftKey, BackSpaceSoftKey,
EndEditSoftKey, RevertEditSoftKey, DeselectSoftKey, FinishSoftKey,
- MenuSoftKey, ContextMenuSoftKey, Key1SoftKey, Key2SoftKey,
+ MenuSoftKey, ContextMenuSoftKey, ExitSoftKey, Key1SoftKey, Key2SoftKey,
Key3SoftKey, Key4SoftKey, CustomSoftKey };
explicit QAction(QObject* parent);
QAction(const QString &text, QObject* parent);
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index b33fe19..4c008fb 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -392,7 +392,7 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent)
alienWidget = S60->mousePressTarget;
if (alienWidget != S60->lastPointerEventTarget)
- if (type == QEvent::MouseButtonPress || QEvent::MouseButtonDblClick || type == QEvent::MouseMove)
+ if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove)
{
//moved to another widget, create enter and leave events
if (S60->lastPointerEventTarget)
@@ -1088,6 +1088,9 @@ void QApplication::symbianResourceChange(int type)
switch (type) {
case KEikDynamicLayoutVariantSwitch:
{
+ if (S60)
+ S60->updateScreenSize();
+
#ifndef QT_NO_STYLE_S60
QS60Style *s60Style = 0;
diff --git a/src/gui/kernel/qeventdispatcher_s60.cpp b/src/gui/kernel/qeventdispatcher_s60.cpp
index fcf572e..51878df 100644
--- a/src/gui/kernel/qeventdispatcher_s60.cpp
+++ b/src/gui/kernel/qeventdispatcher_s60.cpp
@@ -70,12 +70,14 @@ bool QEventDispatcherS60::processEvents ( QEventLoop::ProcessEventsFlags flags )
m_noInputEvents = false;
ret = sendDeferredInputEvents() || ret;
}
-
+
ret = QEventDispatcherSymbian::processEvents(flags) || ret;
-
+
m_noInputEvents = oldNoInputEventsValue;
} QT_CATCH (const std::exception& ex) {
- CActiveScheduler::Current()->Error(qt_translateExceptionToSymbianError(ex));
+#ifndef QT_NO_EXCEPTIONS
+ CActiveScheduler::Current()->Error(qt_translateExceptionToSymbianError(ex));
+#endif
}
return ret;
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index 680bbaa..1edd466 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -731,7 +731,7 @@ private:
friend class QGraphicsProxyWidget;
friend class QGraphicsProxyWidgetPrivate;
friend class QStyleSheetStyle;
- friend class QWidgetExceptionCleaner;
+ friend struct QWidgetExceptionCleaner;
#ifdef Q_WS_MAC
friend class QCoreGraphicsPaintEnginePrivate;
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 12dbc62..635218e 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -73,6 +73,24 @@
QT_BEGIN_NAMESPACE
+struct QPainterPathPrivateHandler
+{
+ static inline void cleanup(QPainterPathPrivate *d)
+ {
+ // note - we must up-cast to QPainterPathData since QPainterPathPrivate
+ // has a non-virtual destructor!
+ if (d && !d->ref.deref())
+ delete static_cast<QPainterPathData *>(d);
+ }
+
+ static inline void reset(QPainterPathPrivate *&d, QPainterPathPrivate *other)
+ {
+ QPainterPathPrivate *oldD = d;
+ d = other;
+ cleanup(oldD);
+ }
+};
+
// This value is used to determine the length of control point vectors
// when approximating arc segments as curves. The factor is multiplied
// with the radius of the circle.
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index 0513593..e12194e 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -57,6 +57,7 @@ QT_MODULE(Gui)
class QFont;
class QPainterPathPrivate;
+struct QPainterPathPrivateHandler;
class QPainterPathData;
class QPainterPathStrokerPrivate;
class QPolygonF;
@@ -196,7 +197,7 @@ public:
QPainterPath &operator-=(const QPainterPath &other);
private:
- QScopedSharedPointer<QPainterPathPrivate> d_ptr;
+ QScopedCustomPointer<QPainterPathPrivate, QPainterPathPrivateHandler> d_ptr;
inline void ensureData() { if (!d_ptr) ensureData_helper(); }
void ensureData_helper();
@@ -230,8 +231,7 @@ public:
friend class QPainterPathStrokerPrivate;
friend class QMatrix;
friend class QTransform;
- friend class QScopedSharedPointer<QPainterPathPrivate>;
- friend class QScopedSharedPointerHandler<QPainterPathPrivate>;
+ friend struct QPainterPathPrivateHandler;
#ifndef QT_NO_DATASTREAM
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &);
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &);
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 83f1698..d2bd679 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -559,7 +559,7 @@ void QS60StylePrivate::drawRow(QS60StyleEnums::SkinParts start,
QRect endRect;
if (orientation == Qt::Horizontal) {
- startRect.setWidth(qMin(rect.width() >>1 - 1, startRect.width()));
+ startRect.setWidth(qMin((rect.width() >> 1) - 1, startRect.width()));
endRect = startRect.translated(rect.width() - startRect.width(), 0);
middleRect.adjust(startRect.width(), 0, -startRect.width(), 0);
if (startRect.bottomRight().x() > endRect.topLeft().x()) {
@@ -568,7 +568,7 @@ void QS60StylePrivate::drawRow(QS60StyleEnums::SkinParts start,
endRect.adjust(overlap,0,0,0);
}
} else {
- startRect.setHeight(qMin(rect.height() >>1 - 1, startRect.height()));
+ startRect.setHeight(qMin((rect.height() >> 1) - 1, startRect.height()));
endRect = startRect.translated(0, rect.height() - startRect.height());
middleRect.adjust(0, startRect.height(), 0, -startRect.height());
if (startRect.topRight().y() > endRect.bottomLeft().y()) {
@@ -1387,7 +1387,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags);
// draw the icon
- const QIcon::Mode mode = !(voptAdj.state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled;
+ const QIcon::Mode mode = (voptAdj.state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled;
const QIcon::State state = voptAdj.state & QStyle::State_Open ? QIcon::On : QIcon::Off;
voptAdj.icon.paint(painter, iconRect, voptAdj.decorationAlignment, mode, state);
@@ -2038,16 +2038,12 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
#endif //QT_NO_SPINBOX
case PE_FrameFocusRect:
// Calendar widget and combox both do not use styled itemDelegate
- if ( widget && (
+ if (widget && !(false
#ifndef QT_NO_CALENDARWIDGET
- (qobject_cast<const QCalendarWidget *>(widget->parent()))
-#else
- false
+ || qobject_cast<const QCalendarWidget *>(widget->parent())
#endif //QT_NO_CALENDARWIDGET
#ifndef QT_NO_COMBOBOX
- || (qobject_cast<const QComboBoxListView *>(widget))
-#else
- || false
+ || qobject_cast<const QComboBoxListView *>(widget)
#endif //QT_NO_COMBOBOX
)) {
// no focus selection for touch
@@ -2326,6 +2322,7 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
break;
case SH_UnderlineShortcut:
retValue = 0;
+ break;
default:
break;
}
diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp
index d53c046..3588ec9 100644
--- a/src/gui/util/qdesktopservices_s60.cpp
+++ b/src/gui/util/qdesktopservices_s60.cpp
@@ -89,38 +89,51 @@ static void handleMailtoSchemeL(const QUrl &url)
User::LeaveIfError(sendAs.Connect());
CleanupClosePushL(sendAs);
- RSendAsMessage sendAsMessage;
- sendAsMessage.CreateL(sendAs, KUidMsgTypeSMTP);
- CleanupClosePushL(sendAsMessage);
-
-
- // Subject
- sendAsMessage.SetSubjectL(qt_QString2TPtrC(subject));
-
- // Body
- sendAsMessage.SetBodyTextL(qt_QString2TPtrC(body));
-
- // To
- foreach(QString item, recipients)
- sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo );
-
- foreach(QString item, tos)
- sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo );
-
- // Cc
- foreach(QString item, ccs)
- sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientCc );
-
- // Bcc
- foreach(QString item, bccs)
- sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientBcc );
-
- // send the message
- sendAsMessage.LaunchEditorAndCloseL();
-
- // sendAsMessage (already closed)
- CleanupStack::Pop();
+ CSendAsAccounts* accounts = CSendAsAccounts::NewL();
+ CleanupStack::PushL(accounts);
+ sendAs.AvailableAccountsL(KUidMsgTypeSMTP, *accounts);
+ TInt count = accounts->Count();
+ CleanupStack::PopAndDestroy(accounts);
+
+ if(!count) {
+ // TODO: we should try to create account if count == 0
+ // CSendUi would provide account creation service for us, but it requires ridicilous
+ // capabilities: LocalServices NetworkServices ReadDeviceData ReadUserData WriteDeviceData WriteUserData
+ User::Leave(KErrNotSupported);
+ } else {
+ RSendAsMessage sendAsMessage;
+ sendAsMessage.CreateL(sendAs, KUidMsgTypeSMTP);
+ CleanupClosePushL(sendAsMessage);
+
+
+ // Subject
+ sendAsMessage.SetSubjectL(qt_QString2TPtrC(subject));
+
+ // Body
+ sendAsMessage.SetBodyTextL(qt_QString2TPtrC(body));
+
+ // To
+ foreach(QString item, recipients)
+ sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo );
+
+ foreach(QString item, tos)
+ sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo );
+
+ // Cc
+ foreach(QString item, ccs)
+ sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientCc );
+
+ // Bcc
+ foreach(QString item, bccs)
+ sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientBcc );
+
+ // send the message
+ sendAsMessage.LaunchEditorAndCloseL();
+
+ // sendAsMessage (already closed)
+ CleanupStack::Pop();
+ }
// sendAs
CleanupStack::PopAndDestroy();
}
diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp
index c7b117e..69ce981 100644
--- a/src/gui/widgets/qmenu_symbian.cpp
+++ b/src/gui/widgets/qmenu_symbian.cpp
@@ -74,7 +74,7 @@ struct SymbianMenuItem
static QList<SymbianMenuItem*> symbianMenus;
static QList<QMenuBar*> nativeMenuBars;
static uint qt_symbian_menu_static_cmd_id = QT_FIRST_MENU_ITEM;
-static QWidget* widgetWithContextMenu=0;
+static QPointer<QWidget> widgetWithContextMenu;
static QList<QAction*> contextMenuActionList;
static QAction contextAction(0);
static int contexMenuCommand=0;
@@ -254,7 +254,7 @@ Q_GUI_EXPORT void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id)
void QMenuBarPrivate::symbianCommands(int command)
{
- if (command == contexMenuCommand) {
+ if (command == contexMenuCommand && !widgetWithContextMenu.isNull()) {
QContextMenuEvent* event = new QContextMenuEvent(QContextMenuEvent::Keyboard, QPoint(0,0));
QCoreApplication::postEvent(widgetWithContextMenu, event);
}
@@ -303,7 +303,7 @@ QMenuBarPrivate::QSymbianMenuBarPrivate::~QSymbianMenuBarPrivate()
deleteAll( &symbianMenus );
symbianMenus.clear();
d = 0;
- rebuild();
+ rebuild();
}
QMenuPrivate::QSymbianMenuPrivate::QSymbianMenuPrivate()
@@ -393,7 +393,7 @@ void QMenuBarPrivate::QSymbianMenuBarPrivate::insertNativeMenuItems(const QList<
symbianActionTopLevel->parent = 0;
symbianActionTopLevel->command = qt_symbian_menu_static_cmd_id++;
qt_symbian_insert_action(symbianActionTopLevel, &symbianMenus);
- }
+ }
}
@@ -409,11 +409,10 @@ void QMenuBarPrivate::QSymbianMenuBarPrivate::rebuild()
contextMenuActionList.clear();
if (widgetWithContextMenu) {
contexMenuCommand = qt_symbian_menu_static_cmd_id;
- contextAction.setText(QString("Actions"));
+ contextAction.setText(QMenuBar::tr("Actions"));
contextMenuActionList.append(&contextAction);
insertNativeMenuItems(contextMenuActionList);
}
-
}
QT_END_NAMESPACE