src/hbwidgets/devicedialogs/hbdevicemessagebox_p.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 HBDEVICEMESSAGEBOXPRIVATE_H
       
    27 #define HBDEVICEMESSAGEBOXPRIVATE_H
       
    28 
       
    29 #include "hbdevicemessagebox.h"
       
    30 #include <QVariant>
       
    31 
       
    32 class HbDeviceDialog;
       
    33 
       
    34 class HbDeviceMessageBoxPrivate : public QObject
       
    35 {
       
    36     Q_OBJECT
       
    37     Q_DECLARE_PUBLIC(HbDeviceMessageBox)
       
    38 
       
    39     enum PropertySelector {
       
    40         Type,
       
    41         Text,
       
    42         IconName,
       
    43         IconAlignment,
       
    44         IconVisible,
       
    45         Timeout,
       
    46         DismissPolicy,
       
    47         AnimationDefinition,
       
    48         NumProperties
       
    49     };
       
    50     enum ActionSelector {
       
    51         InvalidSelector = -1,
       
    52         AcceptButton,
       
    53         RejectButton,
       
    54         NumActions
       
    55     };
       
    56     enum PropertyFlag {
       
    57         NoFlags = 0,
       
    58         Modified = 1,
       
    59         SentToServer = 2
       
    60     };
       
    61     Q_DECLARE_FLAGS(PropertyFlags, PropertyFlag)
       
    62 
       
    63     struct Property{
       
    64         QVariant mValue;
       
    65         PropertyFlags mFlags;
       
    66     };
       
    67     struct Action{
       
    68         QAction *mAction;
       
    69         PropertyFlags mFlags;
       
    70         bool mTriggered;
       
    71     };
       
    72 
       
    73 public:
       
    74     HbDeviceMessageBoxPrivate();
       
    75     virtual ~HbDeviceMessageBoxPrivate();
       
    76 
       
    77     void close();
       
    78     void exec();
       
    79 
       
    80     void init();
       
    81     void initProperties();
       
    82     void setAction(ActionSelector select, QAction *action);
       
    83     void sendToServer(bool show = false);
       
    84     bool propertiesModified() const;
       
    85     void clearActions();
       
    86     void setProperty(PropertySelector propertySelector, int value);
       
    87     void setProperty(PropertySelector propertySelector, const QString &value);
       
    88 
       
    89     static int timeoutValue(HbPopup::DefaultTimeout timeout);
       
    90     static ActionSelector actionSelector(HbDeviceMessageBox::ActionRole role);
       
    91     static HbAction *toHbAction(QAction *action);
       
    92 
       
    93     void scheduleUpdateEvent();
       
    94     void timerEvent(QTimerEvent *event);
       
    95 
       
    96 public slots:
       
    97     void triggerAction(QVariantMap data);
       
    98 
       
    99 public: // data
       
   100     HbDeviceMessageBox *q_ptr;
       
   101     HbDeviceDialog *mDeviceDialog;
       
   102     bool mVisible;
       
   103     int mUpdateTimerId;
       
   104     Property  mProperties[NumProperties];
       
   105     QAction *mDefaultActions[NumActions];
       
   106     Action mActions[NumActions];
       
   107 };
       
   108 
       
   109 #endif // HBDEVICEMESSAGEBOXPRIVATE_H