--- a/emailuis/nmailuiwidgets/inc/nmrecipientlineedit.h Wed Sep 15 17:47:19 2010 +0300
+++ b/emailuis/nmailuiwidgets/inc/nmrecipientlineedit.h Thu Sep 30 11:43:07 2010 +0300
@@ -11,60 +11,98 @@
*
* Contributors:
*
-* Description: nmrecipientlineedit.h
+* Description: implementation of recipient field (to, cc, bcc) line editor
*
*/
#ifndef NMRECIPIENTLINEEDIT_H_
#define NMRECIPIENTLINEEDIT_H_
-#include <nmailuiwidgetsdef.h>
#include <nmhtmllineedit.h>
-#include <nmaddress.h>
class QGraphicsItem;
+class QModelIndex;
+class HbPopup;
+class HbListView;
+
+class NmContactHistoryModel;
+class NmAutoFillListViewItem;
+class NmPopupBackground;
+class NmAddress;
class NMAILUIWIDGETS_EXPORT NmRecipientLineEdit : public NmHtmlLineEdit
{
Q_OBJECT
-
+
public:
- NmRecipientLineEdit(QGraphicsItem *parent = 0);
+ NmRecipientLineEdit(QGraphicsItem *parent = NULL);
virtual ~NmRecipientLineEdit();
-
- // Get the emailaddress list generated from the content of the lineedit.
QList<NmAddress> emailAddressList();
void addContacts(QList<NmAddress *> contacts);
public slots:
-#ifdef Q_OS_SYMBIAN
void addSelectedContacts(const QVariant &selectedContacts);
-#endif
+ void addSelectedContactFromHistory(const QModelIndex &modelIndex);
protected: // from HbLineEdit
void keyPressEvent(QKeyEvent *event);
void inputMethodEvent(QInputMethodEvent *event);
private:
- // Generate emailaddress list from the content of the lineedit.
void generateEmailAddressList();
-
-private slots:
+ void createAutofillComponents();
+ void createAutoFillPopup();
+ void showAutofillPopup();
+ void hideAutofillPopup();
+ void currentTextPart(int& startIndex, int& length);
+ void getChosenAddressFromModel(const QModelIndex &modelIndex, NmAddress &address);
+ void setHighlight(int currentPos);
+ void gestureEvent(QGestureEvent* event);
+ void handleTap();
+ void insertContactText(const QString &text);
+ void keyPressEventSemicolon(QKeyEvent *event);
+ void keyPressEventDelete(QKeyEvent *event);
+ void keyPressEventLeft(QKeyEvent *event);
+ void keyPressEventRight(QKeyEvent *event);
+
+private slots:
void handleTextChanged(const QString &text);
+ void modelCompleted(int err);
private:
// mEmailAddressList contains all emailaddress that appear in the lineedit and
// all emailaddress corresponding to the contact's name added from Contacts,
// including invalid emailaddress user typed or invalid emailaddress added from Contacts.
// Emailaddress validation check is conducted in nmeditorview.
- QList<NmAddress> mEmailAddressList;
-
+ QList<NmAddress> mEmailAddressList;
QList<NmAddress> mRecipientsAddedFromContacts;
// Flag "need to generate mEmailAddressList" is used whenever editing made after
// the emailaddress validation check failed.
bool mNeedToGenerateEmailAddressList;
+
+ NmContactHistoryModel *mContactHistoryModel; // owned
+
+ HbPopup *mAutoFillPopup; // owned
+
+ HbListView *mAutofillListView; // owned
+ NmAutoFillListViewItem *mAutofillListViewItem; //owned
+ NmPopupBackground *mPopupBackground; // pwned
+};
+
+class NmPopupBackground : public QGraphicsItem
+{
+public:
+ explicit NmPopupBackground(HbPopup *popup, QGraphicsItem *parent = 0);
+ bool isModal() { return true; }
+ QRectF boundingRect() const { return QRect(-100, -100, 1000, 1000); }
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+protected:
+ bool sceneEvent(QEvent *event);
+private:
+ mutable QRectF mRect;
+ HbPopup *mPopup; //not owned
};
#endif // NMRECIPIENTLINEEDIT_H_