messagingapp/msgui/conversationview/inc/msgeditorwidget.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:
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef MSGEDITORWIDGET_H
       
    19 #define MSGEDITORWIDGET_H
       
    20 
       
    21 // SYSTEM INCLUDES
       
    22 #include <HbWidget>
       
    23 #include <HbLineEdit>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class HbPushButton;
       
    27 
       
    28 /**
       
    29  * Custom editor class
       
    30  */
       
    31 class MsgEditor : public HbLineEdit
       
    32 {
       
    33 Q_OBJECT
       
    34     
       
    35 public:    
       
    36     /**
       
    37      * Constructor
       
    38      */
       
    39     MsgEditor(QGraphicsItem *parent = 0);
       
    40     
       
    41     /**
       
    42      * Foucus in Event method from  HbAbstractEdit
       
    43      */
       
    44     
       
    45 protected:
       
    46     /**
       
    47      * reimplemented from base class.
       
    48      */
       
    49     void focusInEvent(QFocusEvent *event);    
       
    50     void focusOutEvent(QFocusEvent * event);
       
    51     
       
    52 signals:  
       
    53     /**
       
    54      * Signal emitted when the focus in event comes
       
    55      * i.e. when editor is tapped for reply
       
    56      */ 
       
    57      void replyStarted();
       
    58 };
       
    59 
       
    60 /**
       
    61  * This class is a custom layout widget for Msg Editor.
       
    62  */
       
    63 
       
    64 class MsgEditorWidget : public HbWidget
       
    65 {
       
    66 Q_OBJECT
       
    67 
       
    68 public:
       
    69 
       
    70     /**
       
    71      * Constructor
       
    72      */
       
    73     MsgEditorWidget(QGraphicsItem *parent = 0);
       
    74 
       
    75     /**
       
    76      * Destructor
       
    77      */
       
    78     virtual ~MsgEditorWidget();
       
    79 
       
    80 public:
       
    81     /* Setter/Getter methods */
       
    82 
       
    83     /**
       
    84      * Returns the editor's contents.
       
    85      * @return Editor contents
       
    86      */
       
    87     QString content() const;
       
    88 
       
    89     /**
       
    90      * Set the editor's content.
       
    91      * @param contentText content text to set.
       
    92      */
       
    93     void setContent(const QString &contentText);
       
    94 
       
    95     /**
       
    96      * Getter method which returns the current service-id.
       
    97      * @return service-id
       
    98      */
       
    99     const QString& serviceId();
       
   100 
       
   101 signals:
       
   102 
       
   103     /**
       
   104      * Emitted when send button from virtual ITUT is pressed.
       
   105      */
       
   106     void sendMessage();
       
   107 
       
   108     /**
       
   109      * Signal emitted when the focus in event comes
       
   110      * i.e. when editor is tapped for reply
       
   111      */ 
       
   112     void replyStarted();
       
   113     
       
   114 public slots:
       
   115 
       
   116     /**
       
   117      * Clears the content.
       
   118      */
       
   119     void clear();
       
   120     
       
   121 private slots:
       
   122 
       
   123     /**
       
   124      * Called when editor content is chaged. to enable/disable send button.
       
   125      */
       
   126     void onTextChanged(const QString& str);
       
   127     
       
   128     /**
       
   129      * called when send button is clicked.
       
   130      */
       
   131     void onClicked();
       
   132 
       
   133 private:
       
   134 
       
   135     /**
       
   136      * Initialization function.
       
   137      */
       
   138     void init();
       
   139 
       
   140 private:
       
   141 
       
   142     /**
       
   143      * Current service-id
       
   144      */
       
   145     QString mServiceId;
       
   146 
       
   147     /**
       
   148      * Instance of message edit.
       
   149      * Will be deleted automatically by parent.
       
   150      * Own.
       
   151      */
       
   152     MsgEditor *mMsgEditor;
       
   153 
       
   154     /**
       
   155      * Instance of push button.
       
   156      * Will be deleted automatically by parent.
       
   157      * Own.
       
   158      */
       
   159     HbPushButton *mSendButton;
       
   160 };
       
   161 
       
   162 #endif // MSGEDITORWIDGET_H
       
   163 // EOF