vmbx/vmbxengine/inc/dialogwaiter.h
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
child 21 0a6dd2dc9970
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     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: dialog waiter
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef DIALOGWAITER_H
       
    20 #define DIALOGWAITER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <QObject>
       
    24 #include <QEventLoop>
       
    25 
       
    26 // FORWARD DECLARATION
       
    27 class HbAction;
       
    28 
       
    29 /**
       
    30  * This utility synchronises access to dialogs, popups, menus and
       
    31  * other ORBIT resources. How to use:
       
    32  * <code>
       
    33  * HbDialog* dialog = new HbDialog();
       
    34  * DialogWaiter waiter();
       
    35  * dialog->open(&waiter, SLOT(done(HbAction*)));
       
    36  * HbAction* result = waiter.wait();
       
    37  * delete dialog;
       
    38  * if (result==...) ...
       
    39  * </code>
       
    40  */
       
    41 class DialogWaiter : public QObject
       
    42 {
       
    43     Q_OBJECT
       
    44 
       
    45     public:
       
    46     
       
    47         /**
       
    48          * waits until dialog exits
       
    49          * returns dialog exit action
       
    50          */
       
    51         HbAction* wait();
       
    52 
       
    53     private slots:
       
    54         void done(HbAction* result);
       
    55 
       
    56     private:
       
    57         QEventLoop mLoop;
       
    58         HbAction* mResult;
       
    59 
       
    60 };
       
    61 
       
    62 #endif  // DIALOGWAITER_H