Home · All Classes · Main Classes · Deprecated

mdialogview.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 "mdialogview.h"
00021 #include "mdialogview_p.h"
00022 
00023 #include "mdialog.h"
00024 #include "mdialog_p.h"
00025 #include "mviewcreator.h"
00026 #include "mpannableviewport.h"
00027 #include "mscenemanager.h"
00028 #include <MLabel>
00029 #include <MButton>
00030 #include <MProgressIndicator>
00031 #include <MLayout>
00032 #include <MGridLayoutPolicy>
00033 #include "mbuttongrouplayoutpolicy_p.h"
00034 
00035 #include <QFont>
00036 #include <QGraphicsLinearLayout>
00037 
00038 MDialogViewPrivate::MDialogViewPrivate()
00039     : q_ptr(0),
00040       controller(0),
00041       rootGrid(0),
00042       rootPolicy(0),
00043       topSpacer(0),
00044       bottomSpacer(0),
00045       leftSpacer(0),
00046       rightSpacer(0),
00047       leftButtonSpacer(0),
00048       rightButtonSpacer(0),
00049       buttonContainer(0),
00050       centerLayout(0),
00051       dialogBox(0),
00052       dialogBoxLayout(0),
00053       contents(0),
00054       contentsLayout(0),
00055       contentsViewport(0),
00056       centralWidget(0),
00057       titleBar(0),
00058       titleLabel(0),
00059       spinner(0),
00060       closeButton(0),
00061       buttonBox(0),
00062       buttonBoxLayout(0),
00063       buttonBoxLayoutPolicy(0)
00064 {
00065 }
00066 
00067 MDialogViewPrivate::~MDialogViewPrivate()
00068 {
00069 }
00070 
00071 void MDialogViewPrivate::createWidgetHierarchy()
00072 {
00073     rootGrid = new MLayout();
00074     rootGrid->setContentsMargins(0, 0, 0, 0);
00075     rootPolicy = new MGridLayoutPolicy(rootGrid);
00076     rootGrid->setPolicy(rootPolicy);
00077     // Cast here is needed to invoke method from QGraphicsWidget, since
00078     // overloaded method invokes dumbMode, preventing dialog from propper
00079     // styling.
00080     static_cast<QGraphicsWidget *>(controller)->setLayout(rootGrid);
00081 
00082     topSpacer = createSpacer();
00083     rootPolicy->addItem(topSpacer, 0, 1);
00084 
00085     leftSpacer = createSpacer();
00086     leftSpacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
00087     rootPolicy->addItem(leftSpacer, 1, 0);
00088     createDialogBox();
00089     rootPolicy->addItem(dialogBox, 1, 1);
00090     rightSpacer = createSpacer();
00091     rightSpacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
00092     rootPolicy->addItem(rightSpacer, 1, 2);
00093     createButtonBox();
00094     dialogBoxLayout->addItem(buttonBox);
00095 
00096 }
00097 
00098 QGraphicsWidget *MDialogViewPrivate::createSpacer()
00099 {
00100     QGraphicsWidget *spacer = new MTransparentWidget();
00101 
00102     spacer->hide();
00103     spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
00104     spacer->setMinimumSize(0, 0);
00105     spacer->setPreferredSize(0, 0);
00106 
00107     return spacer;
00108 }
00109 
00110 QGraphicsLinearLayout *MDialogViewPrivate::createLayout(Qt::Orientation orientation)
00111 {
00112     QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(orientation);
00113     layout->setContentsMargins(0, 0, 0, 0);
00114     layout->setSpacing(0);
00115     return layout;
00116 }
00117 
00118 void MDialogViewPrivate::createDialogBox()
00119 {
00120     dialogBox = new QGraphicsWidget;
00121     dialogBox->setObjectName("MDialogBox");
00122     dialogBoxLayout = createLayout(Qt::Vertical);
00123     dialogBox->setLayout(dialogBoxLayout);
00124 
00125     createTitleBar();
00126     dialogBoxLayout->addItem(titleBar);
00127 
00128     contentsViewport = new MPannableViewport;
00129     contentsViewport->setObjectName("MDialogContentsViewport");
00130     dialogBoxLayout->addItem(contentsViewport);
00131 
00132     contents = new QGraphicsWidget();
00133     contents->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
00134     contentsViewport->setWidget(contents);
00135     contentsLayout = createLayout(Qt::Vertical);
00136     contentsLayout->setContentsMargins(0, 0, 0, 0);
00137     contentsLayout->setSpacing(0);
00138     contents->setLayout(contentsLayout);
00139 }
00140 
00141 void MDialogViewPrivate::createButtonBox()
00142 {
00143     buttonBox = new MLabel;
00144     buttonBox->setObjectName("MDialogButtonBox");
00145     buttonBoxLayout = new MLayout();
00146     buttonBoxLayoutPolicy = new MButtonGroupLayoutPolicy(buttonBoxLayout, Qt::Horizontal);
00147     buttonBoxLayout->setPolicy(buttonBoxLayoutPolicy);
00148     buttonBoxLayout->setContentsMargins(0, 0, 0, 0);
00149     buttonBoxLayoutPolicy->setContentsMargins(0,0,0,0);
00150     buttonBoxLayoutPolicy->setSpacing(0);
00151 
00152     buttonBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
00153     buttonBoxLayout->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
00154 
00155     centerLayout = new QGraphicsLinearLayout(Qt::Horizontal);
00156     buttonBox->setLayout(centerLayout);
00157     centerLayout->setContentsMargins(0, 0, 0, 0);
00158     centerLayout->setSpacing(0);
00159     buttonContainer = new MWidget;
00160     buttonContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
00161     buttonContainer->setContentsMargins(0,0,0,0);
00162     buttonContainer->setLayout(buttonBoxLayout);
00163     centerLayout->addItem(buttonContainer);
00164 }
00165 
00166 void MDialogViewPrivate::realignButtonBox()
00167 {
00168     if (leftButtonSpacer) {
00169         centerLayout->removeItem(leftButtonSpacer);
00170         delete leftButtonSpacer;
00171         leftButtonSpacer = 0;
00172     }
00173     if (rightButtonSpacer) {
00174         centerLayout->removeItem(rightButtonSpacer);
00175         delete rightButtonSpacer;
00176         rightButtonSpacer = 0;
00177     }
00178     if (q_func()->style()->buttonBoxCentered()) {
00179         leftButtonSpacer = createSpacer();
00180         centerLayout->insertItem(0, leftButtonSpacer);
00181         rightButtonSpacer = createSpacer();
00182         centerLayout->insertItem(2, rightButtonSpacer);
00183     }
00184 }
00185 
00186 void MDialogViewPrivate::createTitleBar()
00187 {
00188     QGraphicsLinearLayout *layout = createLayout(Qt::Horizontal);
00189 
00190 
00191     // OBS: Need any simple class whose styling works.
00192     //      For some reason neither MWidgetController nor MStylableWidget get its
00193     //      style loaded.
00194     titleBar = new MDialogInternalBox;
00195     titleBar->setObjectName("MDialogTitleBar");
00196     titleBar->setLayout(layout);
00197     titleBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
00198 
00199     titleLabel = new MLabel(titleBar);
00200     titleLabel->setAlignment(Qt::AlignCenter);
00201     titleLabel->setTextElide(true);
00202     titleLabel->setObjectName("CommonGroupHeader");
00203     layout->addItem(titleLabel);
00204     layout->setAlignment(titleLabel, Qt::AlignCenter);
00205 
00206     closeButton = new MButton(titleBar);
00207     closeButton->setObjectName("MDialogCloseButton");
00208     closeButton->setViewType("icon");
00209     closeButton->setIconID("icon-m-framework-close");
00210     layout->addItem(closeButton);
00211     layout->setAlignment(closeButton, Qt::AlignVCenter | Qt::AlignHCenter);
00212     QObject::connect(closeButton, SIGNAL(clicked()), controller, SLOT(reject()));
00213 }
00214 
00215 MDialogView::MDialogView(MDialog *controller) :
00216     MSceneWindowView(controller),
00217     d_ptr(new MDialogViewPrivate)
00218 {
00219     Q_D(MDialogView);
00220     d->q_ptr = this;
00221     d->controller = controller;
00222     d->createWidgetHierarchy();
00223 }
00224 
00225 MDialogView::MDialogView(MDialogViewPrivate &dd, MDialog *controller)
00226     : MSceneWindowView(controller),
00227       d_ptr(&dd)
00228 {
00229     Q_D(MDialogView);
00230     d->q_ptr = this;
00231     d->controller = controller;
00232     d->createWidgetHierarchy();
00233 }
00234 
00235 
00236 MDialogView::~MDialogView()
00237 {
00238     Q_D(MDialogView);
00239 
00240     // Make sure the model's centralWidget doesn't get deleted along with us.
00241     d->setCentralWidget(0);
00242 
00243     delete d_ptr;
00244 }
00245 
00246 void MDialogView::applyStyle()
00247 {
00248     Q_D(MDialogView);
00249     MDialogPrivate *dialogPrivate = d->controller->d_func();
00250 
00251     if (dialogPrivate->dumbMode) {
00252         return;
00253     }
00254 
00255     MSceneWindowView::applyStyle();
00256     d->realignButtonBox();
00257 
00258     d->closeButton->setVisible(d->hasCloseButton());
00259     d->updateTitleBarVisibility();
00260 
00261     d->titleBar->setMinimumHeight(style()->titleBarHeight());
00262     d->titleBar->setPreferredHeight(style()->titleBarHeight());
00263     d->titleBar->setMaximumHeight(style()->titleBarHeight());
00264 
00265     d->titleLabel->setAlignment(style()->titleBarAlignment());
00266     if (style()->titleCapitalization()) {
00267         QFont labelFont = d->titleLabel->font();
00268         labelFont.setCapitalization(QFont::AllUppercase);
00269         d->titleLabel->setFont(labelFont);
00270     }
00271 
00272     // set dimensions separately to that we may have one dimensions set
00273     // and the other unset (-1).
00274     d->dialogBox->setMinimumWidth(style()->dialogMinimumSize().width());
00275     d->dialogBox->setMinimumHeight(style()->dialogMinimumSize().height());
00276 
00277     // set dimensions separately to that we may have one dimensions set
00278     // and the other unset (-1).
00279     d->dialogBox->setPreferredWidth(style()->dialogPreferredSize().width());
00280     d->dialogBox->setPreferredHeight(style()->dialogPreferredSize().height());
00281     d->buttonBox->setContentsMargins(0, 0, 0, 0);
00282 
00283    // d->buttonBox->setContentsMargins(0, style()->verticalSpacing(), 0, 0);
00284 
00285     d->buttonBoxLayoutPolicy->setButtonWidth(style()->dialogButtonFixedWidth());
00286     d->buttonBoxLayoutPolicy->setSpacing(style()->buttonSpacing());
00287 
00288     d->updateButtonBoxLayoutOrientation();
00289 
00290     d->rootPolicy->setContentsMargins(
00291         style()->dialogLeftMargin(), /* left */
00292         style()->dialogTopMargin(), /* top */
00293         style()->dialogRightMargin(), /* right */
00294         style()->dialogBottomMargin() /* bottom */);
00295 
00296 
00297     d->setupDialogVerticalAlignment();
00298 }
00299 
00300 void MDialogViewPrivate::setupDialogVerticalAlignment()
00301 {
00302     Q_Q(MDialogView);
00303 
00304     if (q->style()->dialogVerticalAlignment() & Qt::AlignVCenter
00305             && bottomSpacer == 0) {
00306 
00307         // switch to center alignment
00308         bottomSpacer = createSpacer();
00309         rootPolicy->addItem(bottomSpacer, 2, 1);
00310 
00311     } else if (!(q->style()->dialogVerticalAlignment() & Qt::AlignVCenter)
00312                && bottomSpacer != 0) {
00313 
00314         // switch to bottom alignment.
00315         rootPolicy->removeItem(bottomSpacer);
00316         delete bottomSpacer;
00317         bottomSpacer = 0;
00318     }
00319 }
00320 
00321 void MDialogViewPrivate::updateTitleBarVisibility()
00322 {
00323     Q_Q(MDialogView);
00324     bool visible = q->style()->titleBarHeight() > 0.0 && q->style()->hasTitleBar();
00325 
00326     if (titleBar->isVisible() == visible) {
00327         // nothing to do here
00328         return;
00329     }
00330 
00331     // invisible items still occupy space in layouts, therefore I manually have
00332     // to remove them.
00333 
00334     if (visible) {
00335         // I am currenly invisible and therefore not part of the layout.
00336         // To become visible I have to be added to the layout.
00337         dialogBoxLayout->insertItem(0, titleBar);
00338     } else {
00339         // I am currently visible and therefore part of the layout.
00340         // To become invisible I have to be removed from it.
00341         dialogBoxLayout->removeItem(titleBar);
00342     }
00343 
00344     // update visibility property
00345     titleBar->setVisible(visible);
00346 
00347     if (visible) {
00348         contentsViewport->setViewType(MPannableWidget::defaultType);
00349     } else {
00350         contentsViewport->setViewType("titlebarless");
00351     }
00352 }
00353 
00354 void MDialogViewPrivate::updateWidgetVisibility(QGraphicsWidget *widget, bool visible, int index,
00355         QGraphicsLinearLayout *layout)
00356 {
00357     if (widget->isVisible() == visible) {
00358         // nothing to do here
00359         return;
00360     }
00361 
00362     // invisible items still occupy space in layouts, therefore I manually have
00363     // to remove them.
00364 
00365     if (visible) {
00366         // I am currenly invisible and therefore not part of the layout.
00367         // To become visible I have to be added to the layout.
00368         layout->insertItem(index, widget);
00369     } else {
00370         // I am currently visible and therefore part of the layout.
00371         // To become invisible I have to be removed from it.
00372         layout->removeItem(widget);
00373     }
00374 
00375     // update visibility property
00376     widget->setVisible(visible);
00377 }
00378 
00379 void MDialogViewPrivate::repopulateButtonBox()
00380 {
00381     Q_Q(MDialogView);
00382     MButton *button;
00383 
00384     while (buttonBoxLayout->count() > 0) {
00385         button = static_cast<MButton *>(buttonBoxLayout->itemAt(0));
00386         buttonBoxLayout->removeAt(0);
00387         delete button;
00388     }
00389 
00390     MDialogButtonsList buttonModelsList = q->model()->buttons();
00391 
00392     const int buttonModelsSize = buttonModelsList.size();
00393     for (int i = 0; i < buttonModelsSize; ++i) {
00394         addButton(q->model()->button(i));
00395     }
00396 }
00397 
00398 void MDialogViewPrivate::updateButtonBox()
00399 {
00400     removeButtonsNotInDialogModel();
00401     addButtonsFromDialogModel();
00402     updateButtonBoxLayoutOrientation();
00403 }
00404 
00405 void MDialogViewPrivate::updateButtonBoxLayoutOrientation()
00406 {
00407     Q_Q(MDialogView);
00408     buttonBoxLayoutPolicy->setOrientation(q->style()->buttonBoxOrientation());
00409 
00410     if (q->style()->maximumHorizontalButtons() < buttonBoxLayoutPolicy->count())
00411             buttonBoxLayoutPolicy->setOrientation(Qt::Vertical);
00412 
00413     if(q->model()->buttons().count()==0) {
00414         buttonBox->setPreferredHeight(0);
00415     } else if (buttonBoxLayoutPolicy->orientation()==Qt::Horizontal) {
00416         buttonBox->setPreferredHeight(buttonBox->minimumHeight() + q->style()->verticalSpacing());
00417     } else {
00418         buttonBox->setPreferredHeight((q->model()->buttons().count() * buttonBox->minimumHeight()) + q->style()->verticalSpacing());
00419     }
00420 }
00421 
00422 void MDialogViewPrivate::removeButtonsNotInDialogModel()
00423 {
00424     Q_Q(MDialogView);
00425     MButton *button;
00426     MDialogButtonsList buttonModelsList = q->model()->buttons();
00427     int i = 0;
00428 
00429     while (i < buttonBoxLayout->count()) {
00430         button = static_cast<MButton *>(buttonBoxLayout->itemAt(i));
00431         if (!buttonModelsList.contains(button->model())) {
00432             buttonBoxLayout->removeAt(i);
00433             delete button;
00434         } else {
00435             ++i;
00436         }
00437     }
00438 }
00439 
00440 void MDialogViewPrivate::addButtonsFromDialogModel()
00441 {
00442     Q_Q(MDialogView);
00443     MButtonModel *buttonModel;
00444     MDialogButtonsList buttonModelsList = q->model()->buttons();
00445 
00446     const int buttonModelsSize = buttonModelsList.size();
00447     for (int i = 0; i < buttonModelsSize; ++i) {
00448         buttonModel = buttonModelsList[i];
00449 
00450         if (!isButtonInButtonBox(buttonModel)) {
00451             addButton(buttonModel);
00452         }
00453     }
00454 }
00455 
00456 bool MDialogViewPrivate::isButtonInButtonBox(MButtonModel *buttonModel)
00457 {
00458     int i = 0;
00459     bool foundButton = false;
00460     const int buttonBoxSize = buttonBoxLayout->count();
00461 
00462     while (i < buttonBoxSize && !foundButton) {
00463         foundButton = static_cast<MButton *>(buttonBoxLayout->itemAt(i))->model() == buttonModel;
00464         if (!foundButton) {
00465             ++i;
00466         }
00467     }
00468 
00469     return foundButton;
00470 }
00471 
00472 void MDialogViewPrivate::addButton(MButtonModel *buttonModel)
00473 {
00474     M::ButtonRole currentButtonRole;
00475     MButton *newButton = new MButton(0, buttonModel);
00476     newButton->setObjectName(buttonModel->objectName());
00477     newButton->setStyleName("CommonQueryButton");
00478     MButton *currButton = 0;
00479     bool buttonAdded = false;
00480     int i = 0;
00481     M::ButtonRole buttonRole = buttonModel->role();
00482 
00483     /* The order of buttons should be arranged so, that from left-to-right,
00484        top-down, the positive/confirming button should be the first one, and
00485        the negative/canceling action should be the last.
00486 
00487        OBS: buttons should be also mirrored in right-to-left-layouts, e.g. Arabic.
00488     */
00489     do {
00490         if (i < buttonBoxLayout->count()) {
00491             currButton = static_cast<MButton *>(buttonBoxLayout->itemAt(i));
00492 
00493             currentButtonRole = currButton->model()->role();
00494 
00495             if (buttonOrder(buttonRole) < buttonOrder(currentButtonRole)) {
00496                 buttonBoxLayoutPolicy->insertItem(i, newButton);
00497                 buttonAdded = true;
00498             }
00499 
00500             ++i;
00501         } else {
00502             // just add it to the end of the layout.
00503             buttonBoxLayoutPolicy->addItem(newButton);
00504             buttonAdded = true;
00505         }
00506     } while (!buttonAdded);
00507     for (i = 0; i < buttonBoxLayout->count(); i++) {
00508         buttonBoxLayoutPolicy->itemAt(i)->setPreferredWidth(
00509                 buttonBox->preferredWidth() / buttonBoxLayout->count());
00510     }
00511 }
00512 
00513 int MDialogViewPrivate::buttonOrder(M::ButtonRole role)
00514 {
00515     int order;
00516 
00517     switch (role) {
00518         // Positive actions
00519     case M::AcceptRole:
00520     case M::ActionRole:
00521     case M::HelpRole:
00522     case M::YesRole:
00523     case M::ApplyRole:
00524         order = 1;
00525         break;
00526 
00527         // Negative actions
00528     case M::RejectRole:
00529     case M::DestructiveRole:
00530     case M::NoRole:
00531     case M::ResetRole:
00532         order = 2;
00533         break;
00534 
00535     default:
00536         order = 3;
00537         break;
00538     };
00539 
00540     return order;
00541 }
00542 
00543 void MDialogViewPrivate::setCentralWidget(QGraphicsWidget *newCentralWidget)
00544 {
00545     if (centralWidget)
00546         contentsLayout->removeItem(centralWidget);
00547 
00548     // Place the new one
00549     if (newCentralWidget) {
00550         newCentralWidget->setObjectName("MDialogContents");
00551         contentsLayout->insertItem(0, newCentralWidget);
00552         centralWidget = newCentralWidget;
00553     }
00554 }
00555 
00556 void MDialogViewPrivate::setSpinnerVisibility(bool visibility)
00557 {
00558     if (spinner) {
00559         spinner->setVisible(visibility);
00560     } else {
00561         if (visibility) {
00562             spinner = new MProgressIndicator(titleBar, MProgressIndicator::spinnerType);
00563             spinner->setUnknownDuration(true);
00564             spinner->setObjectName("MDialogProgressIndicator");
00565             QGraphicsLinearLayout *layout = static_cast<QGraphicsLinearLayout *>(titleBar->layout());
00566             layout->insertItem(0, spinner);
00567             spinner->setVisible(true);
00568         }
00569     }
00570 
00571 }
00572 
00573 void MDialogView::setupModel()
00574 {
00575     Q_D(MDialogView);
00576 
00577     MDialogPrivate *dialogPrivate = d->controller->d_func();
00578 
00579     MSceneWindowView::setupModel();
00580 
00581     if (dialogPrivate->dumbMode) {
00582         return;
00583     }
00584 
00585     d->titleLabel->setText(model()->title());
00586     d->setSpinnerVisibility(model()->progressIndicatorVisible());
00587 
00588     d->updateWidgetVisibility(d->buttonBox,
00589                               model()->buttonBoxVisible(),
00590                               2,
00591                               d->dialogBoxLayout);
00592 
00593     d->repopulateButtonBox();
00594 
00595     d->setCentralWidget(model()->centralWidget());
00596     d->updateButtonBoxLayoutOrientation();
00597     d->contentsViewport->setVerticalPanningPolicy(model()->contentsVerticalPanningPolicy());
00598 }
00599 
00600 void MDialogView::updateData(const QList<const char *> &modifications)
00601 {
00602     Q_D(MDialogView);
00603 
00604     MSceneWindowView::updateData(modifications);
00605 
00606     MDialogPrivate *dialogPrivate = d->controller->d_func();
00607     const char *member;
00608 
00609     if (dialogPrivate->dumbMode) {
00610         return;
00611     }
00612 
00613     foreach(member, modifications) {
00614         if (member == MDialogModel::ProgressIndicatorVisible) {
00615             d->setSpinnerVisibility(model()->progressIndicatorVisible());
00616         } else if (member == MDialogModel::Title) {
00617             d->titleLabel->setText(model()->title());
00618         } else if (member == MDialogModel::ButtonBoxVisible) {
00619             d->updateWidgetVisibility(d->buttonBox,
00620                                       model()->buttonBoxVisible(),
00621                                       2,
00622                                       d->dialogBoxLayout);
00623         } else if (member == MDialogModel::CentralWidget) {
00624             d->setCentralWidget(model()->centralWidget());
00625         } else if (member == MDialogModel::Buttons) {
00626             d->updateButtonBox();
00627         } else if (member == MDialogModel::ContentsVerticalPanningPolicy) {
00628             d->contentsViewport->setVerticalPanningPolicy(model()->contentsVerticalPanningPolicy());
00629         }
00630     }
00631 }
00632 
00633 QPainterPath MDialogView::shape() const
00634 {
00635     Q_D(const MDialogView);
00636     QPainterPath path;
00637 
00638     path = d->dialogBox->shape();
00639     path.translate(d->dialogBox->geometry().x(),
00640                    d->dialogBox->geometry().y());
00641 
00642     return path;
00643 }
00644 
00645 QGraphicsLinearLayout *MDialogView::contentsLayout()
00646 {
00647     Q_D(MDialogView);
00648     return d->contentsLayout;
00649 }
00650 
00651 MPannableViewport *MDialogView::contentsViewport()
00652 {
00653     Q_D(MDialogView);
00654     return d->contentsViewport;
00655 }
00656 
00657 bool MDialogViewPrivate::hasCloseButton() {
00658     Q_Q(MDialogView);
00659     if (q->model()->system() && q->model()->modal())
00660         return false;
00661     else
00662         return q->style()->hasCloseButton();
00663 }
00664 
00665 #include "moc_mdialogview.cpp"
00666 
00667 M_REGISTER_VIEW_NEW(MDialogView, MDialog)

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