homescreenapp/hsutils/src/hsmessageboxwrapper.cpp
changeset 63 52b0f64eeb51
child 69 87476091b3f5
equal deleted inserted replaced
62:341166945d65 63:52b0f64eeb51
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <HbMessageBox>
       
    19 #include <HbLabel>
       
    20 #include <HbAction>
       
    21 #include "hsmessageboxwrapper.h"
       
    22 
       
    23 /*!
       
    24     \class HsMessageBoxWrapper
       
    25     \ingroup group_hsutils
       
    26     \brief 
       
    27 */
       
    28 
       
    29 
       
    30 struct HsMessageBoxWrapperImpl{
       
    31 	 QString mHeader;
       
    32    QString mQueryText;
       
    33 
       
    34 };
       
    35 /*!
       
    36 
       
    37 */
       
    38 HsMessageBoxWrapper::HsMessageBoxWrapper(QObject *parent)
       
    39   : QObject(parent),mImpl(new HsMessageBoxWrapperImpl)
       
    40 {
       
    41 }
       
    42 
       
    43 /*!
       
    44 
       
    45 */
       
    46 HsMessageBoxWrapper::~HsMessageBoxWrapper()
       
    47 {
       
    48   delete mImpl;
       
    49 }
       
    50 
       
    51 /*!
       
    52 
       
    53 */
       
    54 void HsMessageBoxWrapper::setHeader(const QString &header)
       
    55 {
       
    56     mImpl->mHeader = header;
       
    57 }
       
    58 /*!
       
    59 
       
    60 */
       
    61 void HsMessageBoxWrapper::setQueryText(const QString &queryText)
       
    62 {
       
    63     mImpl->mQueryText = queryText;
       
    64 }
       
    65 /*!
       
    66 
       
    67 */
       
    68 #ifdef COVERAGE_MEASUREMENT
       
    69 #pragma CTC SKIP
       
    70 #endif 
       
    71 
       
    72 void HsMessageBoxWrapper::show()
       
    73 {
       
    74     HbMessageBox *box = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
       
    75     box->setAttribute(Qt::WA_DeleteOnClose);
       
    76     box->setHeadingWidget(new HbLabel(mImpl->mHeader));
       
    77     box->setText(mImpl->mQueryText);
       
    78     box->setStandardButtons(HbMessageBox::Yes | HbMessageBox::No);
       
    79 
       
    80     box->open(this,SLOT(onDialogClosed(int)));
       
    81 }
       
    82 /*!
       
    83 
       
    84 */
       
    85 void HsMessageBoxWrapper::onDialogClosed(int action)
       
    86 {
       
    87     if (action == HbMessageBox::Yes){
       
    88        emit accepted();  
       
    89     } else {
       
    90        emit rejected();
       
    91     }
       
    92 }
       
    93 #ifdef COVERAGE_MEASUREMENT
       
    94 #pragma CTC ENDSKIP
       
    95 #endif //COVERAGE_MEASUREMENT