src/hbwidgets/devicedialogs/hbdevicemessagebox.h
changeset 0 16d8024aca5e
child 2 06ff229162e9
equal deleted inserted replaced
-1:000000000000 0:16d8024aca5e
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (developer.feedback@nokia.com)
       
     6 **
       
     7 ** This file is part of the HbWidgets module of the UI Extensions for Mobile.
       
     8 **
       
     9 ** GNU Lesser General Public License Usage
       
    10 ** This file may be used under the terms of the GNU Lesser General Public
       
    11 ** License version 2.1 as published by the Free Software Foundation and
       
    12 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
       
    13 ** Please review the following information to ensure the GNU Lesser General
       
    14 ** Public License version 2.1 requirements will be met:
       
    15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    16 **
       
    17 ** In addition, as a special exception, Nokia gives you certain additional
       
    18 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    20 **
       
    21 ** If you have questions regarding the use of this file, please contact
       
    22 ** Nokia at developer.feedback@nokia.com.
       
    23 **
       
    24 ****************************************************************************/
       
    25 
       
    26 #ifndef HBDEVICEMESSAGEBOX_H
       
    27 #define HBDEVICEMESSAGEBOX_H
       
    28 
       
    29 #include <QObject>
       
    30 #include <hbglobal.h>
       
    31 #include <hbmessagebox.h>
       
    32 
       
    33 class HbDeviceMessageBoxPrivate;
       
    34 class HbAction;
       
    35 class QAction;
       
    36 
       
    37 class HB_WIDGETS_EXPORT HbDeviceMessageBox : public QObject
       
    38 {
       
    39     Q_OBJECT
       
    40 
       
    41     Q_PROPERTY(QString text READ text WRITE setText)
       
    42     Q_PROPERTY(QString iconName READ iconName WRITE setIconName)
       
    43     Q_PROPERTY(Qt::Alignment iconAlignment READ iconAlignment WRITE setIconAlignment)
       
    44     Q_PROPERTY(bool iconVisible READ iconVisible WRITE setIconVisible)
       
    45     Q_PROPERTY(int timeout READ timeout WRITE setTimeout)
       
    46     Q_PROPERTY(QString animationDefinition READ animationDefinition WRITE setAnimationDefinition)
       
    47 
       
    48 public:
       
    49     enum ActionRole {
       
    50         InvalidRole = -1,
       
    51         AcceptButtonRole,
       
    52         RejectButtonRole
       
    53     };
       
    54 
       
    55 public:
       
    56     explicit HbDeviceMessageBox(
       
    57         HbMessageBox::MessageBoxType type = HbMessageBox::MessageTypeInformation,
       
    58         QObject *parent = 0);
       
    59     explicit HbDeviceMessageBox(const QString &text,
       
    60         HbMessageBox::MessageBoxType type = HbMessageBox::MessageTypeInformation,
       
    61         QObject *parent=0);
       
    62     virtual ~HbDeviceMessageBox();
       
    63 
       
    64     static bool question(
       
    65         const QString &text,
       
    66         const QString &acceptButtonText = QString(),
       
    67         const QString &rejectButtonText = QString());
       
    68 
       
    69     static void information(const QString &text);
       
    70     static void warning(const QString &text);
       
    71 
       
    72     void show();
       
    73     void update();
       
    74     void close();
       
    75     HbAction *exec(); // deprecated
       
    76     const QAction *exec() const; // tbd. remove const when HbAction *exec() is removed
       
    77     const QAction *triggeredAction() const;
       
    78     bool isAcceptAction(const QAction *action) const;
       
    79     void setMessageBoxType(HbMessageBox::MessageBoxType type);
       
    80     HbMessageBox::MessageBoxType messageBoxType() const;
       
    81 
       
    82     void setText(const QString &text);
       
    83     QString text() const;
       
    84 
       
    85     void setIconName(const QString &iconName);
       
    86     QString iconName() const;
       
    87 
       
    88     void setIconAlignment(Qt::Alignment align);
       
    89     Qt::Alignment iconAlignment() const;
       
    90 
       
    91     void setIconVisible(bool visible);
       
    92     bool iconVisible() const;
       
    93 
       
    94     void setAnimationDefinition(QString &animationDefinition);
       
    95     QString animationDefinition() const;
       
    96 
       
    97     void setTimeout(int timeout);
       
    98     void setTimeout(HbPopup::DefaultTimeout timeout);
       
    99     int timeout() const;
       
   100 
       
   101     void setDismissPolicy(HbPopup::DismissPolicy dismissPolicy);
       
   102     HbPopup::DismissPolicy dismissPolicy() const;
       
   103 
       
   104     HbAction *primaryAction() const; // deprecated
       
   105     void setPrimaryAction(HbAction *action); // deprecated
       
   106 
       
   107     HbAction *secondaryAction() const; // deprecated
       
   108     void setSecondaryAction(HbAction *action); // deprecated
       
   109 
       
   110     void setAction(QAction *action, ActionRole role);
       
   111     QAction *action(ActionRole role) const;
       
   112 
       
   113 signals:
       
   114     void aboutToClose();
       
   115 
       
   116 private:
       
   117     HbDeviceMessageBoxPrivate *d_ptr;
       
   118     Q_DECLARE_PRIVATE_D(d_ptr, HbDeviceMessageBox)
       
   119     Q_DISABLE_COPY(HbDeviceMessageBox)
       
   120 
       
   121 };
       
   122 
       
   123 #endif // HBDEVICEMESSAGEBOX_H