javacommons/security/javaunicertstoreplugin/src.s60/confirmquery.cpp
branchRCL_3
changeset 83 26b2b12093af
parent 77 7cee158cb8cd
child 84 0553e2305d00
equal deleted inserted replaced
77:7cee158cb8cd 83:26b2b12093af
     1 /*
       
     2 * Copyright (c) 2010 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 #include "confirmquery.h"
       
    18 #include <hbmessagebox.h>
       
    19 #include <hblabel.h>
       
    20 
       
    21 using namespace java::security;
       
    22 
       
    23 ConfirmQuery::ConfirmQuery()
       
    24     : mAsyncToSyncCallEventLoop(0), mQueryAccepted(false)
       
    25 {
       
    26     mAsyncToSyncCallEventLoop = new QEventLoop();
       
    27 }
       
    28     
       
    29 bool ConfirmQuery::accept(const QString& aQuery)
       
    30 {
       
    31     HbMessageBox confirmQuery(HbMessageBox::MessageTypeQuestion);
       
    32     confirmQuery.setDismissPolicy(HbDialog::NoDismiss);
       
    33     confirmQuery.setTimeout(HbDialog::NoTimeout);
       
    34     confirmQuery.setIconVisible(false);
       
    35     confirmQuery.setText(aQuery);
       
    36     confirmQuery.setAttribute(Qt::WA_DeleteOnClose);
       
    37     confirmQuery.setStandardButtons(HbMessageBox::Yes | HbMessageBox::No);
       
    38     confirmQuery.open(this,SLOT(queryDismissed(int)));
       
    39     mAsyncToSyncCallEventLoop->exec();
       
    40     return mQueryAccepted;
       
    41 }
       
    42 
       
    43 void ConfirmQuery::queryDismissed(int dismissAction)
       
    44 {
       
    45     if (dismissAction == HbMessageBox::Yes) {
       
    46         mQueryAccepted = true;
       
    47     }
       
    48     mAsyncToSyncCallEventLoop->exit();
       
    49 }
       
    50 
       
    51 ConfirmQuery::~ConfirmQuery()
       
    52 {
       
    53     delete mAsyncToSyncCallEventLoop;
       
    54 }
       
    55 
       
    56 #include "moc_confirmquery.cpp"