Home · All Classes · Main Classes · Deprecated

mtoolbarview.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (directui@nokia.com)
00006 **
00007 ** This file is part of libmeegotouch.
00008 **
00009 ** If you have questions regarding the use of this file, please contact
00010 ** Nokia at directui@nokia.com.
00011 **
00012 ** This library is free software; you can redistribute it and/or
00013 ** modify it under the terms of the GNU Lesser General Public
00014 ** License version 2.1 as published by the Free Software Foundation
00015 ** and appearing in the file LICENSE.LGPL included in the packaging
00016 ** of this file.
00017 **
00018 ****************************************************************************/
00019 
00020 #include <QGraphicsLinearLayout>
00021 #include "mtoolbar.h"
00022 #include "mtoolbar_p.h"
00023 #include "mtoolbarlayoutpolicy.h"
00024 #include "mtheme.h"
00025 #include "mbutton.h"
00026 #include "mbuttongroup.h"
00027 #include "mwidgetaction.h"
00028 #include "private/mwidgetview_p.h"
00029 
00030 #include "mlayout.h"
00031 #include "mlinearlayoutpolicy.h"
00032 #include "mtextedit.h"
00033 #include "mtoolbarview.h"
00034 #include "mtoolbarview_p.h"
00035 #include "mscalableimage.h"
00036 #include "mscenemanager.h"
00037 
00038 
00039 MToolBarViewPrivate::MToolBarViewPrivate(MToolBar *controller)
00040     : QObject(),
00041       q_ptr(0),
00042       layout(0),
00043       landscapePolicy(0),
00044       portraitPolicy(0),
00045       buttonGroup(0),
00046       iconsEnabled(true),
00047       labelsEnabled(false),
00048       labelOnlyAsCommonButton(true)
00049 {
00050     this->controller = controller;
00051     controller->installEventFilter(this);
00052 }
00053 
00054 
00055 MToolBarViewPrivate::~MToolBarViewPrivate()
00056 {
00057     removeEventFilter(controller);
00058     if(buttonGroup) {
00059         delete buttonGroup;
00060         buttonGroup = NULL;
00061     }
00062     QHashIterator<QAction *, MWidget *> iterator(leasedWidgets);
00063     while (iterator.hasNext()) {
00064         iterator.next();
00065 
00066         if (!releaseWidget(iterator.key(), iterator.value()))
00067             delete iterator.value(); //Is this the right thing to do ?
00068     }
00069     qDeleteAll(buttons);
00070     delete layout;
00071     layout = NULL;
00072 }
00073 
00074 void MToolBarViewPrivate::init()
00075 {
00076     layout = new MLayout;
00077     layout->setAnimation(NULL);
00078     layout->setContentsMargins(0, 0, 0, 0);
00079 
00080     landscapePolicy = new MToolBarLayoutPolicy(layout);
00081     landscapePolicy->setStyleName("ToolBarLandscapePolicy");
00082     layout->setLandscapePolicy(landscapePolicy);
00083 
00084     portraitPolicy = new MToolBarLayoutPolicy(layout);
00085     portraitPolicy->setStyleName("ToolBarPortraitPolicy");
00086     layout->setPortraitPolicy(portraitPolicy);
00087 
00088     QGraphicsLinearLayout *controllerlayout = (QGraphicsLinearLayout *)(controller->layout());
00089     controllerlayout->addItem(layout);
00090 
00091     //Add any existing actions now
00092     foreach(QAction *action, controller->actions()) {
00093         add(action);
00094     }
00095 
00096     updateWidgetAlignment();
00097 }
00098 
00099 int MToolBarViewPrivate::policyIndexForAddingAction(QAction *action, MToolBarLayoutPolicy *policy) const {
00100     Q_Q(const MToolBarView);
00101     //We need to add the action's given widget to the policy
00102     //This is a bit complicated because we ideally want to add it in the right place,
00103     //preserving the same order as in the controller->actions()
00104     QList< QAction *> actions = controller->actions();
00105     int parentIndex = actions.indexOf(action)+1;
00106     int index = policy->widgetCount();
00107     while(parentIndex < actions.size()) {
00108         MWidget *w = q->getWidget(actions.at(parentIndex));
00109         if(w) {
00110             int policyIndex = policy->widgetIndexOf(w);
00111             if(policyIndex >= 0) {
00112                 index = policyIndex;
00113                 break;
00114             }
00115         }
00116         parentIndex++;
00117     }
00118     if(policy->roomForWidget(index, hasTextEditWidget(action)))
00119         return index;
00120     return -1;
00121 }
00122 
00123 void MToolBarViewPrivate::add(QAction *action)
00124 {
00125     if (!action || !action->isVisible() || hasUnusableWidget(action))
00126         return; //Cancel adding action
00127 
00128     // add to policies only if the action is visible
00129     int landscapeIndex = -1;
00130     int portraitIndex = -1;
00131     if (isLocationValid(action, MAction::ToolBarLandscapeLocation))
00132         landscapeIndex = policyIndexForAddingAction(action, landscapePolicy);
00133     if (isLocationValid(action, MAction::ToolBarPortraitLocation))
00134         portraitIndex = policyIndexForAddingAction(action, portraitPolicy);
00135 
00136     if (landscapeIndex == -1 && portraitIndex == -1)
00137         return; //Cancel adding action
00138     MWidget *widget = createWidget(action);
00139     Q_ASSERT(widget);
00140 
00141     updateWidgetFromAction(widget, action);
00142 
00143     if (landscapeIndex != -1)
00144         landscapePolicy->insertWidgetAndRemoveOverflow( landscapeIndex, widget );
00145     if (portraitIndex != -1)
00146         portraitPolicy->insertWidgetAndRemoveOverflow( portraitIndex, widget );
00147 
00148     updateEmptinessProperty();
00149 }
00150 
00151 void MToolBarViewPrivate::remove(QAction *action, bool hideOnly)
00152 {
00153     MButton *button = buttons.value(action);
00154     MWidget *leased = leasedWidgets.value(action);
00155     MWidget *widget = (button != 0) ? button : leased;
00156     if(!widget)
00157         return;
00158 
00159     if (button && buttonGroup)
00160         buttonGroup->removeButton(button);
00161     if(hideOnly) {
00162         landscapePolicy->removeWidget(widget);
00163         portraitPolicy->removeWidget(widget);
00164         if (button)
00165             button->setChecked(false);
00166     } else {
00167         //Need to fully remove the action
00168         layout->removeItem(widget);
00169 
00170         if (button) {
00171             buttons.remove(action);
00172             delete button;
00173         } else {
00174             releaseWidget(action, leased);
00175             leasedWidgets.remove(action);
00176         }
00177     }
00178 
00179     //There might be space now any actions not already added.  Signal a change action which
00180     //will check if an item now has room to be shown
00181     foreach(QAction *action2, controller->actions()) {
00182         if (action2 != action && action2->isVisible() &&
00183             (isLocationValid(action2, MAction::ToolBarLandscapeLocation) ||
00184              isLocationValid(action2, MAction::ToolBarPortraitLocation)))
00185             change(action2);
00186     }
00187     updateEmptinessProperty();
00188 }
00189 
00190 void MToolBarViewPrivate::change(QAction *action)
00191 {
00192     Q_Q(MToolBarView);
00193     if(hasUnusableWidget(action))
00194         return;
00195     if(!action->isVisible()) {
00196         remove(action, true); //Remove action, but only hiding the widget, not deleting/releasing it
00197         return;
00198     }
00199     bool validInLandscape = isLocationValid(action, MAction::ToolBarLandscapeLocation);
00200     bool validInPortrait = isLocationValid(action, MAction::ToolBarPortraitLocation);
00201     if (!validInLandscape && !validInPortrait) {
00202         remove(action, true);
00203         return;
00204     }
00205 
00206     //Check that the widget is in the controller actions
00207     QList< QAction *> actions = controller->actions();
00208     int indexOfAction = actions.indexOf(action);
00209     if(indexOfAction == -1) {
00210         remove(action, false); // I don't think this is possible
00211         return;
00212     }
00213 
00214     MWidget *widget = q->getWidget(action);
00215     if (!widget) {
00216         //We need to add the action
00217         add(action);
00218         return;
00219     }
00220     if(buttonGroup) {
00221         MButton *button = buttons.value(action);
00222         if(button)
00223             buttonGroup->addButton(button);
00224     }
00225 
00226     //We have now an action and a widget for it
00227     int landscapeIndex = landscapePolicy->widgetIndexOf(widget);
00228     int portraitIndex = portraitPolicy->widgetIndexOf(widget);
00229     if(!validInLandscape && landscapeIndex >= 0) {
00230         //We are showing it in landscape view but should not be
00231         landscapePolicy->removeWidgetAt(landscapeIndex);
00232     }
00233     if(!validInPortrait && portraitIndex >= 0) {
00234         //We are showing it in portrait view but should not be
00235         portraitPolicy->removeWidgetAt(portraitIndex);
00236     }
00237 
00238     updateWidgetFromAction(widget, action);
00239 
00240     if(validInLandscape && landscapeIndex == -1) {
00241         int index = policyIndexForAddingAction(action, landscapePolicy);
00242         if(index != -1)
00243             landscapePolicy->insertWidgetAndRemoveOverflow( index, widget );
00244     }
00245     if(validInPortrait && portraitIndex == -1) {
00246         int index = policyIndexForAddingAction(action, portraitPolicy);
00247         if(index != -1)
00248             portraitPolicy->insertWidgetAndRemoveOverflow( index, widget );
00249     }
00250 }
00251 
00252 void MToolBarViewPrivate::updateWidgetFromAction(MWidget *widget, QAction *action) const
00253 {
00254     widget->setEnabled(action->isEnabled());
00255     MButton *button = qobject_cast<MButton *>(widget);
00256     if (button) {
00257         // Update button data accordingly
00258         button->setCheckable(action->isCheckable());
00259         button->setChecked(action->isChecked());
00260 
00261         // Only update the text and icon if we created the button
00262         if (buttons.contains(action)) {
00263             button->setText(action->text());
00264             button->setTextVisible(labelsEnabled);
00265 
00266             MAction *mAction = qobject_cast<MAction *>(action);
00267             if (mAction) {
00268                 button->setIconID(mAction->iconID());
00269                 button->setIconVisible(iconsEnabled);
00270             }
00271 
00272             updateViewAndStyling(button);
00273         }
00274     }
00275 }
00276 
00277 bool MToolBarViewPrivate::eventFilter(QObject *obj, QEvent *e)
00278 {
00279     switch (e->type()) {
00280         case QEvent::ActionRemoved:
00281             remove(static_cast<QActionEvent *>(e)->action(), false);
00282             break;
00283         case QEvent::ActionAdded:
00284             add(static_cast<QActionEvent *>(e)->action());
00285             break;
00286         case QEvent::ActionChanged:
00287             change(static_cast<QActionEvent *>(e)->action());
00288             break;
00289 
00290         case QEvent::DynamicPropertyChange:
00291             {
00292                 QDynamicPropertyChangeEvent *propertyEvent = static_cast<QDynamicPropertyChangeEvent*>(e);
00293                 if (propertyEvent->propertyName() == _M_IsEnabledPreservingSelection) {
00294                     bool enabledPreservingSelection = obj->property(_M_IsEnabledPreservingSelection).toBool();
00295                     setEnabledPreservingSelection(enabledPreservingSelection);
00296                 } else if (propertyEvent->propertyName() == "widgetAlignment")
00297                     updateWidgetAlignment();
00298             }
00299             break;
00300 
00301         default:
00302             break;
00303     }
00304     return QObject::eventFilter(obj, e);
00305 }
00306 
00307 MWidget *MToolBarViewPrivate::createWidget(QAction *action)
00308 {
00309     Q_Q(MToolBarView);
00310     // If widget is not already created then create it
00311     MWidget *widget = buttons.value(action);
00312     if (!widget)
00313         widget = leasedWidgets.value(action);
00314     if (!widget) {
00315         MWidgetAction *widgetAction = qobject_cast<MWidgetAction *>(action);
00316         if (widgetAction) {
00317             widget = widgetAction->requestWidget(NULL);
00318             leasedWidgets.insert(action, widget);
00319             widget->show();
00320         } else {
00321             MButton *button = new MButton;
00322             button->setMinimumSize(0,0);
00323 
00324             button->setObjectName("toolbaractioncommand");
00325             if (action && !action->objectName().isEmpty())
00326                 button->setObjectName(button->objectName() + "_" + action->objectName());
00327 
00328             if(buttonGroup) {
00329                 button->setCheckable(action->isCheckable());
00330                 //We can't set button->checked until we've added it to the scene
00331                 buttonGroup->addButton(button);
00332                 connect(button, SIGNAL(toggled(bool)), q, SLOT(_q_groupButtonClicked(bool)));
00333                 connect(action, SIGNAL(toggled(bool)), q, SLOT(_q_groupActionToggled(bool)));
00334             }
00335 
00336             connect(button, SIGNAL(clicked(bool)), action, SIGNAL(triggered()));
00337 
00338             buttons.insert(action, button);
00339             widget = button;
00340         }
00341     }
00342     Q_ASSERT(widget);
00343     return widget;
00344 }
00345 bool MToolBarViewPrivate::isLocationValid(QAction *action, MAction::Location loc) const
00346 {
00347     MAction *mAction = qobject_cast<MAction *>(action);
00348     if(!mAction)
00349         return true; //A normal QAction is valid to place on toolbar
00350     return mAction->location().testFlag(loc);
00351 }
00352 
00353 bool MToolBarViewPrivate::releaseWidget(QAction *action, MWidget *widget) const
00354 {
00355     MWidgetAction *widgetAction = qobject_cast<MWidgetAction *>(action);
00356     if (widgetAction) {
00357         widgetAction->releaseWidget(widget);
00358     }
00359     return (widgetAction != 0);
00360 }
00361 
00362 bool MToolBarViewPrivate::hasTextEditWidget(QAction *action) const
00363 {
00364     MTextEdit *textEditWidget = 0;
00365     MWidgetAction *widgetAction = qobject_cast<MWidgetAction *>(action);
00366     if (widgetAction) {
00367         textEditWidget = qobject_cast<MTextEdit *>(widgetAction->widget());
00368     }
00369     return (textEditWidget != 0);
00370 }
00371 
00372 bool MToolBarViewPrivate::hasUnusableWidget(QAction *action) const
00373 {
00374     if( buttons.contains(action) || leasedWidgets.contains(action) )
00375         return false; //If we are already using it, it must be usable
00376     MWidgetAction *widgetAction = qobject_cast<MWidgetAction *>(action);
00377     if(!widgetAction || !widgetAction->widget())
00378         return false; //We can create a button for it
00379     return widgetAction->isWidgetInUse();
00380 }
00381 
00382 MWidget *MToolBarView::getWidget(QAction *action) const
00383 {
00384     Q_D(const MToolBarView);
00385     MWidget *button = d->buttons.value(action);
00386     if( button )
00387         return button;
00388     return d->leasedWidgets.value(action);
00389 }
00390 
00391 MWidget *MToolBarViewPrivate::getWidget(QAction *action) const
00392 {
00393     return buttons.value(action);
00394 }
00395 
00396 void MToolBarViewPrivate::setEnabledPreservingSelection(bool enabled)
00397 {
00398     // To ensure that buttons/widgets are restored correctly to their original state,
00399     // AND the state of their associated actions with the enabled parameter
00400 
00401     for (QHash<QAction *, MButton *>::const_iterator bit = buttons.constBegin(); bit != buttons.constEnd(); ++bit) {
00402         QAction *action = bit.key();
00403         MButton *button = bit.value();
00404         if (!button->isChecked()) {
00405             button->setEnabled(enabled && action->isEnabled());
00406         }
00407     }
00408 
00409     for (QHash<QAction *, MWidget *>::const_iterator wit = leasedWidgets.constBegin(); wit != leasedWidgets.constEnd(); ++wit) {
00410         QAction *action = wit.key();
00411         MWidget *widget = wit.value();
00412         MButton *button = qobject_cast<MButton *>(widget);
00413         if (!button || !button->isChecked()) {
00414             widget->setEnabled(enabled && action->isEnabled());
00415         }
00416     }
00417 }
00418 
00419 void MToolBarViewPrivate::_q_groupButtonClicked(bool checked)
00420 {
00421     Q_Q(MToolBarView);
00422     MButton *button = qobject_cast<MButton *>(q->sender());
00423     if(!button)
00424         return; //impossible?
00425 
00426     button->setChecked(checked);
00427 
00428     QAction *action = buttons.key(button);
00429     if(action->isChecked() != checked)
00430         action->setChecked(checked);
00431 }
00432 
00433 void MToolBarViewPrivate::_q_groupActionToggled(bool checked)
00434 {
00435     Q_Q(MToolBarView);
00436     QAction* action = qobject_cast<QAction *>(q->sender());
00437     Q_ASSERT(action);
00438     MButton *button = buttons.value(action);
00439     if (button) {
00440         button->setChecked(checked);
00441     }
00442 }
00443 
00444 void MToolBarViewPrivate::setCapacity(int newCapacity)
00445 {
00446     if (newCapacity == -1)
00447         newCapacity = MToolBarLayoutPolicy::unlimitedCapacity;
00448 
00449     setCapacity(newCapacity, portraitPolicy);
00450     setCapacity(newCapacity, landscapePolicy);
00451 }
00452 
00453 void MToolBarViewPrivate::setCapacity(int newCapacity, MToolBarLayoutPolicy *policy)
00454 {
00455     if (policy->maxWidgetSlots() == newCapacity)
00456         return;
00457 
00458     bool newRoom = (policy->effectiveMaxWidgetSlots() < newCapacity && policy->freeWidgetSlots() == 0);
00459 
00460     policy->setMaxWidgetSlots(newCapacity);
00461 
00462     if (newRoom)
00463         addActionsFromLeftOvers();
00464 }
00465 
00466 void MToolBarViewPrivate::addActionsFromLeftOvers()
00467 {
00468     foreach (QAction *action, controller->actions()) {
00469         if (action->isVisible() &&
00470             (isLocationValid(action, MAction::ToolBarLandscapeLocation) ||
00471              isLocationValid(action, MAction::ToolBarPortraitLocation)))
00472             change(action);
00473     }
00474 }
00475 
00476 void MToolBarViewPrivate::setIconsEnabled(bool enabled)
00477 {
00478     iconsEnabled = enabled;
00479 
00480     for (QHash<QAction *, MButton *>::const_iterator bit = buttons.constBegin(); bit != buttons.constEnd(); ++bit) {
00481         MButton *button = bit.value();
00482         if (button)
00483             button->setIconVisible(iconsEnabled);
00484     }
00485 }
00486 
00487 void MToolBarViewPrivate::setLabelsEnabled(bool enabled)
00488 {
00489     labelsEnabled = enabled;
00490 
00491     for (QHash<QAction *, MButton *>::const_iterator bit = buttons.constBegin(); bit != buttons.constEnd(); ++bit) {
00492         MButton *button = bit.value();
00493         if (isLabelOnly(button))
00494             button->setTextVisible(true);
00495         else if (button)
00496             button->setTextVisible(labelsEnabled);
00497     }
00498 }
00499 
00500 void MToolBarViewPrivate::setSpacesEnabled(bool enabled)
00501 {
00502     landscapePolicy->setSpacesBetween(enabled);
00503     portraitPolicy->setSpacesBetween(enabled);
00504 }
00505 
00506 void MToolBarViewPrivate::updateViewAndStyling(MButton *button) const
00507 {
00508     QString toolBarButtonDefaultViewType = buttonGroup ? "toolbartab" : "toolbar";
00509 
00510     if (isLabelOnly(button)) {
00511         // Only label -> could use different styling
00512         button->setTextVisible(true); //In this case we will show label (as it is all we have)
00513         if (labelOnlyAsCommonButton) {
00514             if (button->viewType() != MButton::defaultType)
00515                 button->setViewType(MButton::defaultType);
00516             button->setStyleName("ToolBarLabelOnlyCommonButton");
00517         } else {
00518             if (button->viewType() != toolBarButtonDefaultViewType)
00519                 button->setViewType(toolBarButtonDefaultViewType);
00520             button->setStyleName("ToolBarLabelOnlyButton");
00521         }
00522     } else {
00523         if (button->viewType() != toolBarButtonDefaultViewType)
00524             button->setViewType(toolBarButtonDefaultViewType);
00525         button->setStyleName("ToolBarIconButton");
00526         button->setTextVisible(labelsEnabled);
00527     }
00528 }
00529 
00530 void MToolBarViewPrivate::updateWidgetAlignment()
00531 {
00532     QVariant v = controller->property("widgetAlignment");
00533     Qt::AlignmentFlag alignment = v.isValid() ? static_cast<Qt::AlignmentFlag>(v.toInt()) : Qt::AlignHCenter;
00534 
00535     /* In here the Qt::Alignment is used like this:
00536        Qt::Alignment is used like this:
00537        AlignLeft = no prereserved slots on left
00538        AlignRight = no prereserved slots on right
00539        AlignJustify = no prereserved slots on left and right
00540        AlignHCenter = preseserved slots on left and right */
00541 
00542     landscapePolicy->setWidgetAlignment(alignment, v.isValid() ? true : false);
00543     portraitPolicy->setWidgetAlignment(alignment, v.isValid() ? true : false);
00544 
00545     if (alignment != Qt::AlignHCenter || !v.isValid())
00546         addActionsFromLeftOvers();
00547 }
00548 
00549 void MToolBarViewPrivate::updateEmptinessProperty()
00550 {
00551     controller->setProperty("emptyInLandscape", landscapePolicy->widgetCount() == 0);
00552     controller->setProperty("emptyInPortrait", portraitPolicy->widgetCount() == 0);
00553 }
00554 
00555 void MToolBarViewPrivate::setLabelOnlyAsCommonButton(bool enable)
00556 {
00557     if (labelOnlyAsCommonButton == enable)
00558         return;
00559 
00560     labelOnlyAsCommonButton = enable;
00561 
00562     for (QHash<QAction *, MButton *>::const_iterator bit = buttons.constBegin(); bit != buttons.constEnd(); ++bit) {
00563         MButton *button = bit.value();
00564         if (isLabelOnly(button))
00565             updateViewAndStyling(button);
00566     }
00567 
00568     landscapePolicy->setLabelOnlyButtonCentering(labelOnlyAsCommonButton);
00569     portraitPolicy->setLabelOnlyButtonCentering(labelOnlyAsCommonButton);
00570 }
00571 
00572 bool MToolBarViewPrivate::isLabelOnly(MButton *button) const
00573 {
00574     return (button && !button->text().isEmpty() && button->iconID().isEmpty());
00575 }
00576 
00577 
00578 MToolBarView::MToolBarView(MToolBar *controller) :
00579     MWidgetView(controller),
00580     d_ptr(new MToolBarViewPrivate(controller))
00581 {
00582     Q_D(MToolBarView);
00583     d->q_ptr = this;
00584     d->init();
00585 }
00586 
00587 MToolBarView::MToolBarView(MToolBarViewPrivate &dd, MToolBar *controller) :
00588     MWidgetView(controller),
00589     d_ptr(&dd)
00590 {
00591     Q_D(MToolBarView);
00592     d->q_ptr = this;
00593     d->controller = controller;
00594     d->init();
00595 }
00596 
00597 MToolBarView::~MToolBarView()
00598 {
00599     delete d_ptr;
00600 }
00601 
00602 QRectF MToolBarView::boundingRect() const
00603 {
00604     QRectF br = MWidgetView::boundingRect();
00605     if (style()->dropShadowImage()) {
00606         br.setTop(-style()->dropShadowImage()->pixmap()->size().height());
00607     }
00608     return br;
00609 }
00610 
00611 void MToolBarView::drawBackground(QPainter *painter, const QStyleOptionGraphicsItem *option) const
00612 {
00613     Q_D(const MToolBarView);
00614 
00615     //draw shadow on top of the actual toolbar on portrait mode
00616     if (d->controller->sceneManager() && d->controller->sceneManager()->orientation() == M::Portrait) {
00617         if (style()->dropShadowImage()) {
00618             style()->dropShadowImage()->draw(0,
00619                     -style()->dropShadowImage()->pixmap()->size().height(),
00620                     boundingRect().width(),
00621                     style()->dropShadowImage()->pixmap()->size().height(),
00622                     painter);
00623         }
00624     }
00625     MWidgetView::drawBackground(painter, option);
00626 }
00627 
00628 void MToolBarView::applyStyle()
00629 {
00630     Q_D(MToolBarView);
00631 
00632     MWidgetView::applyStyle();
00633 
00634     d->setSpacesEnabled(style()->hasSpaces());
00635     d->setIconsEnabled(style()->hasIcons());
00636     d->setLabelsEnabled(style()->hasLabels());
00637     d->setLabelOnlyAsCommonButton(style()->labelOnlyAsCommonButton());
00638     d->setCapacity(style()->capacity());
00639     d->updateEmptinessProperty();
00640 }
00641 
00642 // bind view and controller together
00643 M_REGISTER_VIEW_NEW(MToolBarView, MToolBar)
00644 
00645 #include "moc_mtoolbarview.cpp"

Copyright © 2010 Nokia Corporation Generated on Thu Nov 4 2010 18:14:22 (PDT)
Doxygen 1.7.1
MeeGo Touch