messagingapp/msgnotifications/msgnotificationdialogplugin/inc/msgnotificationdialogwidget.h
changeset 23 238255e8b033
child 25 84d9eb65b26f
equal deleted inserted replaced
5:4697dfb2d7ad 23:238255e8b033
       
     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: Message notification plugin widget.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef MSGNOTIFICATIONDIALOGWIDGET_H
       
    19 #define MSGNOTIFICATIONDIALOGWIDGET_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <QVariantMap>
       
    23 
       
    24 
       
    25 #include <hbdevicedialoginterface.h>
       
    26 #include <hbdevicedialog.h>
       
    27 #include <hbnotificationdialog.h>
       
    28 
       
    29 /**
       
    30  * Message notification widget class. 
       
    31  * Widget shown for the new message notifications. 
       
    32  * Part of messagenotificationplugin.
       
    33  */
       
    34 class MsgNotificationDialogWidget : public HbNotificationDialog, 
       
    35                                     public HbDeviceDialogInterface
       
    36 {
       
    37     Q_OBJECT
       
    38     
       
    39 public:
       
    40     
       
    41     /** 
       
    42      * Constructor 
       
    43      * @param parameters variant map list
       
    44      */
       
    45     MsgNotificationDialogWidget(const QVariantMap &parameters);
       
    46 
       
    47     /**
       
    48      * @see HbDeviceDialogInterface
       
    49      */
       
    50     bool setDeviceDialogParameters(const QVariantMap &parameters);
       
    51     
       
    52     /**
       
    53      * @see HbDeviceDialogInterface
       
    54      */
       
    55     int deviceDialogError() const;
       
    56 
       
    57     /**
       
    58      * @see HbDeviceDialogInterface
       
    59      */
       
    60     void closeDeviceDialog(bool byClient);
       
    61     
       
    62     /**
       
    63      * @see HbDeviceDialogInterface
       
    64      */
       
    65     HbDialog *deviceDialogWidget() const;
       
    66 
       
    67 public slots:
       
    68     /**
       
    69      * Called when the widget is tapped. 
       
    70      * This launches the conversation view.
       
    71      */
       
    72     void widgetActivated();
       
    73 
       
    74 private:
       
    75     /**
       
    76      * Prepares the displaname to be shown in the notification.
       
    77      * This extracts firsname, lastname, nick name and address
       
    78      * and prepares the display name.
       
    79      * @param parameters variant map value list
       
    80      */
       
    81     void prepareDisplayName(const QVariantMap &parameters);
       
    82     
       
    83     /**
       
    84      * Hide event call back function
       
    85      * Called when widget is about to hide. Closing effect has ended.
       
    86      * @param event QHideEvent
       
    87      */
       
    88     void hideEvent(QHideEvent *event);
       
    89     
       
    90     /**
       
    91      * Show event call back function
       
    92      * Called when widget is about to show
       
    93      * @param event QShowEvent
       
    94      */
       
    95     void showEvent(QShowEvent *event);
       
    96 
       
    97      /** 
       
    98       * Extracts the information and constrcuts the widget
       
    99       * @param parameters QVariantMap values
       
   100       */
       
   101     bool constructDialog(const QVariantMap &parameters);
       
   102 signals:
       
   103    /**
       
   104     * Signal emitted when dialog is closed
       
   105     */
       
   106     void deviceDialogClosed();
       
   107     
       
   108     /**
       
   109      * Device dialog data signal
       
   110      */
       
   111     void deviceDialogData(QVariantMap data);
       
   112 
       
   113 private:
       
   114     Q_DISABLE_COPY(MsgNotificationDialogWidget)
       
   115 
       
   116      /**
       
   117       * Hold the last error 
       
   118       */
       
   119      int mLastError;
       
   120     
       
   121      /**
       
   122       * Show event has come or not
       
   123       */
       
   124      bool mShowEventReceived;
       
   125     
       
   126      /**
       
   127       * Current conversation id.
       
   128       */
       
   129      qint64 mConversationId;
       
   130 };
       
   131 
       
   132 #endif // MSGNOTIFICATIONDIALOGWIDGET_P_H