aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Halonen <ext-jukka.a.halonen@nokia.com>2011-01-14 10:16:52 +0200
committerHolger Schröder <holger.schroeder.ext@basyskom.de>2011-01-25 15:47:49 +0100
commitd696f87ce24df0aa277a93f23755cfeaefd4c1ab (patch)
tree98563f24e449d4f6bca4b9294322b41313c7fc19
parent1873b3982f1b5d18ad89824069a859bb65d8534a (diff)
Fixes: NB#218558 - Rotating device while application menu is activated re-enables toolbar actions
RevBy: Stanislav Ionascu
-rw-r--r--src/views/mtoolbarview.cpp9
-rw-r--r--src/views/mtoolbarview_p.h1
2 files changed, 8 insertions, 2 deletions
diff --git a/src/views/mtoolbarview.cpp b/src/views/mtoolbarview.cpp
index 6104d31b..0b6bb46b 100644
--- a/src/views/mtoolbarview.cpp
+++ b/src/views/mtoolbarview.cpp
@@ -47,7 +47,8 @@ MToolBarViewPrivate::MToolBarViewPrivate(MToolBar *controller)
iconsEnabled(true),
labelsEnabled(false),
labelOnlyAsCommonButton(true),
- widgetAlignment(Qt::AlignHCenter)
+ widgetAlignment(Qt::AlignHCenter),
+ itemsEnabled(true)
{
this->controller = controller;
controller->installEventFilter(this);
@@ -271,7 +272,8 @@ void MToolBarViewPrivate::change(QAction *action)
void MToolBarViewPrivate::updateWidgetFromAction(MWidget *widget, QAction *action) const
{
- widget->setEnabled(action->isEnabled());
+ widget->setEnabled(action->isEnabled() && itemsEnabled);
+
MButton *button = qobject_cast<MButton *>(widget);
if (button) {
// Update button data accordingly
@@ -420,6 +422,8 @@ void MToolBarViewPrivate::setEnabledPreservingSelection(bool enabled)
// To ensure that buttons/widgets are restored correctly to their original state,
// AND the state of their associated actions with the enabled parameter
+ itemsEnabled = enabled;
+
for (QHash<QAction *, MButton *>::const_iterator bit = buttons.constBegin(); bit != buttons.constEnd(); ++bit) {
QAction *action = bit.key();
MButton *button = bit.value();
@@ -690,6 +694,7 @@ void MToolBarView::resizeEvent(QGraphicsSceneResizeEvent *event)
d->updateCenterOffset(event->newSize());
}
+
// bind view and controller together
M_REGISTER_VIEW_NEW(MToolBarView, MToolBar)
diff --git a/src/views/mtoolbarview_p.h b/src/views/mtoolbarview_p.h
index aed17b59..4c77121c 100644
--- a/src/views/mtoolbarview_p.h
+++ b/src/views/mtoolbarview_p.h
@@ -99,6 +99,7 @@ protected:
bool labelsEnabled;
bool labelOnlyAsCommonButton;
Qt::AlignmentFlag widgetAlignment;
+ bool itemsEnabled;
};
#endif