phonebookui/cntcommonui/widgets/cntactionpopup_p.h
changeset 72 6abfb1094884
child 81 640d30f4fb64
equal deleted inserted replaced
67:59984e68247d 72:6abfb1094884
       
     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 CNTACTIONPOPUP_P_H_
       
    19 #define CNTACTIONPOPUP_P_H_
       
    20 
       
    21 #include <QObject>
       
    22 #include <qtcontactsglobal.h>
       
    23 #include <hbselectiondialog.h>
       
    24 #include <qcontactdetail.h>
       
    25 #include "cntglobal.h"
       
    26 #include "cntactionpopup.h"
       
    27 
       
    28 class QStandardItemModel;
       
    29 class QStandardItem;
       
    30 class HbListView;
       
    31 class QModelIndex;
       
    32 QTM_BEGIN_NAMESPACE
       
    33 class QContact;
       
    34 class QContactDetail;
       
    35 QTM_END_NAMESPACE
       
    36 
       
    37 QTM_USE_NAMESPACE
       
    38 
       
    39 /*
       
    40 * Class for showing popup for Call, Message and Email actions if preffered number is not set
       
    41 */
       
    42 
       
    43 class CntActionPopupPrivate : public HbSelectionDialog
       
    44     {
       
    45     Q_OBJECT
       
    46     Q_DECLARE_PUBLIC(CntActionPopup)
       
    47 
       
    48     enum ActionPopupPosition
       
    49     { 
       
    50             EInternalServices = 0,
       
    51             ECallMobile,
       
    52             ECallMobileHome,
       
    53             ECallMobileWork,
       
    54             ECallPhone,
       
    55             ECallPhoneHome,
       
    56             ECallPhoneWork,
       
    57             ECallFax,
       
    58             ECallFaxHome,
       
    59             ECallFaxWork,
       
    60             ECallPager,
       
    61             ECallAssistant,
       
    62             ECallCar,
       
    63             EEmail,
       
    64             EEmailHome,
       
    65             EEmailWork,
       
    66             ENotSupported
       
    67     }; 
       
    68 public:
       
    69     CntActionPopupPrivate( QContact *contact, QGraphicsItem *parent = 0 );
       
    70     ~CntActionPopupPrivate();
       
    71     
       
    72     //returns true if the action is supported else false
       
    73     bool showActionPopup(QString action);
       
    74     
       
    75 signals:
       
    76     //Emit signal for the perticular action with the detail selected from the popup
       
    77     void executeContactAction( QContact& aContact, QContactDetail contactDetail, QString actionName );
       
    78     void actionPopupCancelPressed();
       
    79 
       
    80 private slots:
       
    81 
       
    82     void listItemSelected( QModelIndex index );
       
    83     void handleUserResponse(HbAction* action);
       
    84     void onLongPressed (HbAbstractViewItem *item, const QPointF &coords);
       
    85     
       
    86 private:
       
    87 
       
    88     //Populate the call numbers for popup
       
    89     void buildCallActionPopup();
       
    90     //Populate the emails for popup
       
    91     void buildEmailActionPopup();
       
    92     //Populate the message numbers for popup
       
    93     void buildMessageActionPopup();
       
    94     
       
    95     void showPopup();
       
    96     
       
    97     void sortDataItems();
       
    98     
       
    99     int getPosition(const QString& aId, const QString& aContext);
       
   100     
       
   101     bool supportsDetail(const QString &actionName, const QContactDetail &contactDetail);
       
   102 
       
   103 public:
       
   104     CntActionPopup* q_ptr;
       
   105     
       
   106 private:
       
   107     QContact* mContact;
       
   108     QStandardItemModel  *mListModel;
       
   109     HbListView          *mListView;
       
   110     QList<QStandardItem*>  mDataItemList;
       
   111     HbAction *mCancelAction;
       
   112     
       
   113     friend class T_CntActionPopupTest;
       
   114     };
       
   115 #endif /* CNTACTIONPOPUP_P_H_ */