| 31 |      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 | #include <QRunnable>
 | 
|  |     24 | #include <hbdevicedialoginterface.h>
 | 
|  |     25 | #include <hbdevicedialog.h>
 | 
|  |     26 | #include <hbnotificationdialog.h>
 | 
|  |     27 | 
 | 
|  |     28 | 
 | 
|  |     29 | /**
 | 
|  |     30 |  * Class for sending service request
 | 
|  |     31 |  */
 | 
|  |     32 | class ServiceRequestSenderTask : public QRunnable
 | 
|  |     33 | {
 | 
|  |     34 | public:
 | 
|  |     35 |     /**
 | 
|  |     36 |      * Constructor
 | 
|  |     37 |      */
 | 
|  |     38 |     ServiceRequestSenderTask(qint64 conversationId);
 | 
|  |     39 |     
 | 
|  |     40 |     /**
 | 
|  |     41 |      * Destructor
 | 
|  |     42 |      */
 | 
|  |     43 |     ~ServiceRequestSenderTask();
 | 
|  |     44 |      
 | 
|  |     45 |     /**
 | 
|  |     46 |      * create and send service request
 | 
|  |     47 |      */
 | 
|  |     48 |      void run();
 | 
|  |     49 | 
 | 
|  |     50 | private: 
 | 
|  |     51 |      qint64 mConvId;
 | 
|  |     52 | };
 | 
|  |     53 | 
 | 
|  |     54 | /**
 | 
|  |     55 |  * Message notification widget class. 
 | 
|  |     56 |  * Widget shown for the new message notifications. 
 | 
|  |     57 |  * Part of messagenotificationplugin.
 | 
|  |     58 |  */
 | 
|  |     59 | class MsgNotificationDialogWidget : public HbNotificationDialog, 
 | 
|  |     60 |                                     public HbDeviceDialogInterface
 | 
|  |     61 | {
 | 
|  |     62 |     Q_OBJECT
 | 
|  |     63 |     
 | 
|  |     64 | public:
 | 
|  |     65 |     
 | 
|  |     66 |     /** 
 | 
|  |     67 |      * Constructor 
 | 
|  |     68 |      * @param parameters variant map list
 | 
|  |     69 |      */
 | 
|  |     70 |     MsgNotificationDialogWidget(const QVariantMap ¶meters);
 | 
|  |     71 | 
 | 
|  |     72 |     /**
 | 
|  |     73 |      * @see HbDeviceDialogInterface
 | 
|  |     74 |      */
 | 
|  |     75 |     bool setDeviceDialogParameters(const QVariantMap ¶meters);
 | 
|  |     76 |     
 | 
|  |     77 |     /**
 | 
|  |     78 |      * @see HbDeviceDialogInterface
 | 
|  |     79 |      */
 | 
|  |     80 |     int deviceDialogError() const;
 | 
|  |     81 | 
 | 
|  |     82 |     /**
 | 
|  |     83 |      * @see HbDeviceDialogInterface
 | 
|  |     84 |      */
 | 
|  |     85 |     void closeDeviceDialog(bool byClient);
 | 
|  |     86 |     
 | 
|  |     87 |     /**
 | 
|  |     88 |      * @see HbDeviceDialogInterface
 | 
|  |     89 |      */
 | 
|  |     90 |     HbDialog *deviceDialogWidget() const;
 | 
|  |     91 | 
 | 
|  |     92 | public slots:
 | 
|  |     93 |     /**
 | 
|  |     94 |      * Called when the widget is tapped. 
 | 
|  |     95 |      * This launches the conversation view.
 | 
|  |     96 |      */
 | 
|  |     97 |     void widgetActivated();
 | 
|  |     98 | 
 | 
|  |     99 | private:
 | 
|  |    100 |     /**
 | 
|  |    101 |      * Prepares the displaname to be shown in the notification.
 | 
|  |    102 |      * This extracts firsname, lastname, nick name and address
 | 
|  |    103 |      * and prepares the display name.
 | 
|  |    104 |      * @param parameters variant map value list
 | 
|  |    105 |      */
 | 
|  |    106 |     void prepareDisplayName(const QVariantMap ¶meters);
 | 
|  |    107 |     
 | 
|  |    108 |     /**
 | 
|  |    109 |      * Hide event call back function
 | 
|  |    110 |      * Called when widget is about to hide. Closing effect has ended.
 | 
|  |    111 |      * @param event QHideEvent
 | 
|  |    112 |      */
 | 
|  |    113 |     void hideEvent(QHideEvent *event);
 | 
|  |    114 |     
 | 
|  |    115 |     /**
 | 
|  |    116 |      * Show event call back function
 | 
|  |    117 |      * Called when widget is about to show
 | 
|  |    118 |      * @param event QShowEvent
 | 
|  |    119 |      */
 | 
|  |    120 |     void showEvent(QShowEvent *event);
 | 
|  |    121 | 
 | 
|  |    122 |      /** 
 | 
|  |    123 |       * Extracts the information and constrcuts the widget
 | 
|  |    124 |       * @param parameters QVariantMap values
 | 
|  |    125 |       */
 | 
|  |    126 |     bool constructDialog(const QVariantMap ¶meters);
 | 
|  |    127 | signals:
 | 
|  |    128 |    /**
 | 
|  |    129 |     * Signal emitted when dialog is closed
 | 
|  |    130 |     */
 | 
|  |    131 |     void deviceDialogClosed();
 | 
|  |    132 |     
 | 
|  |    133 |     /**
 | 
|  |    134 |      * Device dialog data signal
 | 
|  |    135 |      */
 | 
|  |    136 |     void deviceDialogData(QVariantMap data);
 | 
|  |    137 | 
 | 
|  |    138 | private:
 | 
|  |    139 |     Q_DISABLE_COPY(MsgNotificationDialogWidget)
 | 
|  |    140 | 
 | 
|  |    141 |      /**
 | 
|  |    142 |       * Hold the last error 
 | 
|  |    143 |       */
 | 
|  |    144 |      int mLastError;
 | 
|  |    145 |     
 | 
|  |    146 |      /**
 | 
|  |    147 |       * Show event has come or not
 | 
|  |    148 |       */
 | 
|  |    149 |      bool mShowEventReceived;
 | 
|  |    150 |     
 | 
|  |    151 |      /**
 | 
|  |    152 |       * Current conversation id.
 | 
|  |    153 |       */
 | 
|  |    154 |      qint64 mConversationId;
 | 
|  |    155 | };
 | 
|  |    156 | 
 | 
|  |    157 | #endif // MSGNOTIFICATIONDIALOGWIDGET_P_H
 |