messagingapp/msgui/unifiededitor/inc/msgunieditoraddress.h
changeset 31 ebfee66fde93
child 34 84197e66a4bd
equal deleted inserted replaced
30:6a20128ce557 31:ebfee66fde93
       
     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:Header for entering To field (phone number, contact name).
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef UNIFIED_EDITOR_ADDRESS_H
       
    19 #define UNIFIED_EDITOR_ADDRESS_H
       
    20 
       
    21 #include <msgunifiededitorbasewidget.h>
       
    22 
       
    23 #include <convergedmessageaddress.h>
       
    24 #include <QMap>
       
    25 
       
    26 class HbTextItem;
       
    27 class HbPushButton;
       
    28 class HbLineEdit;
       
    29 class HbAction;
       
    30 class MsgUnifiedEditorLineEdit;
       
    31 
       
    32 class MsgUnifiedEditorAddress : public MsgUnifiedEditorBaseWidget
       
    33     {
       
    34     Q_OBJECT
       
    35 
       
    36 public:
       
    37 
       
    38     /**
       
    39      * Constructor
       
    40      */
       
    41     MsgUnifiedEditorAddress(const QString& label,
       
    42                             QGraphicsItem *parent = 0);
       
    43 
       
    44     /**
       
    45      * Destructor
       
    46      */
       
    47     ~MsgUnifiedEditorAddress();
       
    48 
       
    49     /**
       
    50      * Seeker method to return back data to editor's view
       
    51      * By default, does not remove duplicates.
       
    52      * @param removeDuplicates, True if duplicate removal is needed
       
    53      */
       
    54     ConvergedMessageAddressList addresses(bool removeDuplicates=false);
       
    55 
       
    56     /**
       
    57      * Get total number of recipient's (including duplicates)
       
    58      */
       
    59     int addressCount();
       
    60 
       
    61     /**
       
    62      * setter method to set address
       
    63      * @param addrlist, list of addresses to be set in address editor
       
    64      */
       
    65     void setAddresses(ConvergedMessageAddressList addrlist);
       
    66 
       
    67     /**
       
    68      * Get amount of digits to be used in contact matching
       
    69      */
       
    70     static int contactMatchDigits();
       
    71 
       
    72     /**
       
    73      * setter method to enable flag to skip max recipient limit query
       
    74      */
       
    75     void skipMaxRecipientQuery(bool skip);
       
    76 
       
    77     /**
       
    78      * validate contacts
       
    79      */
       
    80     bool validateContacts();
       
    81 
       
    82 public slots:
       
    83     /**
       
    84      * To set focus on editable field.
       
    85      */
       
    86     void setFocus();
       
    87 
       
    88 signals:
       
    89     /**
       
    90      * Emitted when send button from virtual ITUT is pressed.
       
    91      */
       
    92     void sendMessage();
       
    93 
       
    94     /**
       
    95      * Emitted when content is added or removed
       
    96      */
       
    97     void contentChanged();
       
    98 
       
    99 private slots:
       
   100 
       
   101     /**
       
   102      * called after selection from pbk.
       
   103      */
       
   104     void fetchContacts();
       
   105     /**
       
   106      * Slot for handling valid returns from the phonebook contacts fetched.
       
   107      */
       
   108     void handleOk(const QVariant& result);
       
   109 
       
   110     /**
       
   111      * Slot for handling errors. Error ids are provided as
       
   112      */
       
   113     void handleError(int errorCode, const QString& errorMessage);
       
   114 
       
   115     /**
       
   116      * Called when contentsChanged signal is emitted by the line edit
       
   117      */
       
   118     void onContentsChanged(const QString&);
       
   119 
       
   120     /**
       
   121      * launch query for recipient limit usecase
       
   122      */
       
   123     void handleRecipientLimitReached();
       
   124    
       
   125 	/**
       
   126      * This slot is called when max recipients reached dialog is launched.
       
   127      * @param action selected action (yes or no).
       
   128      */
       
   129     void onMaxRecipientsReached(HbAction*);
       
   130 
       
   131     /**
       
   132      * Handle invalid contact dialog useraction
       
   133      */
       
   134     void handleInvalidContactDialog(HbAction* act);
       
   135 
       
   136 private:
       
   137     /**
       
   138      * Remove edit-field's user-deleted addresses from Map
       
   139      */
       
   140     void syncDeletionsToMap();
       
   141 
       
   142     /**
       
   143      * Add edit-field's user-added addresses to Map
       
   144      */
       
   145     void syncAdditionsToMap();
       
   146 
       
   147     /**
       
   148      * Removes duplicate addresses and gives unique address list
       
   149      */
       
   150     QStringList uniqueAddressList();
       
   151 
       
   152     /**
       
   153      * Reset the addresslist to previous list
       
   154      */
       
   155     void resetToPrevious();
       
   156 
       
   157 private:
       
   158 
       
   159     /**
       
   160      * Push button to launch phone book.
       
   161      */
       
   162     HbPushButton* mLaunchBtn;
       
   163 
       
   164     /**
       
   165      * line edit field.
       
   166      */
       
   167     MsgUnifiedEditorLineEdit* mAddressEdit;
       
   168 
       
   169     /**
       
   170      * address map.
       
   171      */
       
   172     QMap<QString, QString> mAddressMap;
       
   173 
       
   174     /**
       
   175      * holds the previous buffer inside address field
       
   176      */
       
   177     QString mPrevBuffer;
       
   178 
       
   179     /**
       
   180      * flag to skip max recipient limit query
       
   181      */
       
   182     bool mSkipMaxRecipientQuery;
       
   183 
       
   184     /**
       
   185      * flag to indicate that the SMS recipient limit is about
       
   186      * to be exceeded by a bulk insertion of addresses e.g. multiple
       
   187      * selection from contact selection dialog
       
   188      */
       
   189     bool mAboutToExceedMaxSmsRecipients;
       
   190 
       
   191     /**
       
   192      * flag to indicate that the MMS recipient limit is about
       
   193      * to be exceeded by a bulk insertion of addresses e.g. multiple
       
   194      * selection from contact selection dialog
       
   195      */
       
   196     bool mAboutToExceedMaxMmsRecipients;
       
   197 
       
   198     /**
       
   199      * count by which a bulk-insertion will exceed max MMS recipient
       
   200      * limit e.g. multiple selection from contact selection dialog
       
   201      */
       
   202     int mExceedsMaxMmsRecipientsBy;
       
   203     };
       
   204 
       
   205 #endif //UNIFIED_EDITOR_ADDRESS_H