phonebookui/cntcommonui/widgets/cntactionpopup_p.cpp
author hgs
Fri, 15 Oct 2010 12:24:46 +0300
changeset 81 640d30f4fb64
parent 72 6abfb1094884
permissions -rw-r--r--
201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
72
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
#include "cntactionpopup_p.h"
hgs
parents:
diff changeset
    18
#include <qcontact.h>
hgs
parents:
diff changeset
    19
#include <qcontactdetail.h>
hgs
parents:
diff changeset
    20
#include <qcontactphonenumber.h>
hgs
parents:
diff changeset
    21
#include <hbaction.h>
hgs
parents:
diff changeset
    22
#include <QDebug>
hgs
parents:
diff changeset
    23
#include "cntstringmapper.h"
hgs
parents:
diff changeset
    24
#include <hblistview.h>
hgs
parents:
diff changeset
    25
#include <hblistviewitem.h>
hgs
parents:
diff changeset
    26
#include <QStandardItemModel>
hgs
parents:
diff changeset
    27
hgs
parents:
diff changeset
    28
CntActionPopupPrivate::CntActionPopupPrivate( QContact* aContact, QGraphicsItem *parent ) :
hgs
parents:
diff changeset
    29
HbSelectionDialog(parent),
hgs
parents:
diff changeset
    30
mContact( NULL ),
hgs
parents:
diff changeset
    31
mListModel(NULL),
hgs
parents:
diff changeset
    32
mListView(NULL),
hgs
parents:
diff changeset
    33
mCancelAction(NULL)
hgs
parents:
diff changeset
    34
{
hgs
parents:
diff changeset
    35
    mContact = new QContact( *aContact );
hgs
parents:
diff changeset
    36
    mListView = new HbListView(this);
hgs
parents:
diff changeset
    37
    mListModel = new QStandardItemModel(this);
hgs
parents:
diff changeset
    38
    setAttribute(Qt::WA_DeleteOnClose, true);
hgs
parents:
diff changeset
    39
    mDataItemList.clear();
hgs
parents:
diff changeset
    40
}
hgs
parents:
diff changeset
    41
hgs
parents:
diff changeset
    42
CntActionPopupPrivate::~CntActionPopupPrivate()
hgs
parents:
diff changeset
    43
{
hgs
parents:
diff changeset
    44
    delete mContact;
hgs
parents:
diff changeset
    45
    mContact = NULL;
hgs
parents:
diff changeset
    46
}
hgs
parents:
diff changeset
    47
    
hgs
parents:
diff changeset
    48
void CntActionPopupPrivate::buildCallActionPopup()
hgs
parents:
diff changeset
    49
{
hgs
parents:
diff changeset
    50
    // Create call action
hgs
parents:
diff changeset
    51
    QList<QContactPhoneNumber> details = mContact->details<QContactPhoneNumber>();
hgs
parents:
diff changeset
    52
    CntStringMapper map;
hgs
parents:
diff changeset
    53
    for (int index = 0; index < details.count(); index++)
hgs
parents:
diff changeset
    54
    {
hgs
parents:
diff changeset
    55
       if(supportsDetail("call", details[index]))
hgs
parents:
diff changeset
    56
       {
hgs
parents:
diff changeset
    57
           QString context = details[index].contexts().isEmpty() ? QString() : details[index].contexts().first();
hgs
parents:
diff changeset
    58
           QString subtype = details[index].subTypes().isEmpty() ? details[index].definitionName() : details[index].subTypes().first();
hgs
parents:
diff changeset
    59
           
hgs
parents:
diff changeset
    60
           int position = getPosition(subtype, context);
hgs
parents:
diff changeset
    61
           
hgs
parents:
diff changeset
    62
           QString titleText = map.getContactCardListLocString(subtype , context);
hgs
parents:
diff changeset
    63
           QString valueText = details[index].number();
hgs
parents:
diff changeset
    64
           
hgs
parents:
diff changeset
    65
           QStandardItem *labelItem = new QStandardItem();
hgs
parents:
diff changeset
    66
           QStringList textList;
hgs
parents:
diff changeset
    67
           textList << titleText << valueText;
hgs
parents:
diff changeset
    68
           labelItem->setData(textList, Qt::DisplayRole);
hgs
parents:
diff changeset
    69
           labelItem->setData(HbIcon(map.getContactCardIconString(subtype, context)), Qt::DecorationRole);
hgs
parents:
diff changeset
    70
           labelItem->setData(index, Qt::UserRole);
hgs
parents:
diff changeset
    71
           labelItem->setData("call", Qt::UserRole+1);
hgs
parents:
diff changeset
    72
           labelItem->setData(position, Qt::UserRole+2);
hgs
parents:
diff changeset
    73
           mDataItemList.append(labelItem);
hgs
parents:
diff changeset
    74
       }
hgs
parents:
diff changeset
    75
    }
hgs
parents:
diff changeset
    76
}
hgs
parents:
diff changeset
    77
hgs
parents:
diff changeset
    78
void CntActionPopupPrivate::buildEmailActionPopup()
hgs
parents:
diff changeset
    79
{
hgs
parents:
diff changeset
    80
    // Create email action
hgs
parents:
diff changeset
    81
    QList<QContactEmailAddress> details = mContact->details<QContactEmailAddress>();
hgs
parents:
diff changeset
    82
    CntStringMapper map;
hgs
parents:
diff changeset
    83
    for (int index = 0; index < details.count(); index++)
hgs
parents:
diff changeset
    84
    {
hgs
parents:
diff changeset
    85
       if(supportsDetail("email", details[index]))
hgs
parents:
diff changeset
    86
       {
hgs
parents:
diff changeset
    87
           QString context = details[index].contexts().isEmpty() ? QString() : details[index].contexts().first();
hgs
parents:
diff changeset
    88
           int position = getPosition(details[index].definitionName(), context);
hgs
parents:
diff changeset
    89
           
hgs
parents:
diff changeset
    90
           QString titleText = map.getContactCardListLocString(details[index].definitionName() , context);
hgs
parents:
diff changeset
    91
           QString valueText = details[index].emailAddress();
hgs
parents:
diff changeset
    92
           
hgs
parents:
diff changeset
    93
           QStandardItem *labelItem = new QStandardItem();
hgs
parents:
diff changeset
    94
           QStringList textList;
hgs
parents:
diff changeset
    95
           textList << titleText << valueText;
hgs
parents:
diff changeset
    96
           labelItem->setData(textList, Qt::DisplayRole);
hgs
parents:
diff changeset
    97
           labelItem->setData(HbIcon(map.getContactEditorIconString(details[index].definitionName(), context)), Qt::DecorationRole);
hgs
parents:
diff changeset
    98
           labelItem->setData(index, Qt::UserRole);
hgs
parents:
diff changeset
    99
           labelItem->setData("email", Qt::UserRole+1);
hgs
parents:
diff changeset
   100
           labelItem->setData(position, Qt::UserRole+2);
hgs
parents:
diff changeset
   101
           mDataItemList.append(labelItem);
hgs
parents:
diff changeset
   102
       }
hgs
parents:
diff changeset
   103
    }
hgs
parents:
diff changeset
   104
}
hgs
parents:
diff changeset
   105
hgs
parents:
diff changeset
   106
void CntActionPopupPrivate::buildMessageActionPopup()
hgs
parents:
diff changeset
   107
{
hgs
parents:
diff changeset
   108
    // Create message action
hgs
parents:
diff changeset
   109
    QList<QContactPhoneNumber> details = mContact->details<QContactPhoneNumber>();
hgs
parents:
diff changeset
   110
    CntStringMapper map;
hgs
parents:
diff changeset
   111
    for (int index = 0; index < details.count(); index++)
hgs
parents:
diff changeset
   112
    {
hgs
parents:
diff changeset
   113
        if(supportsDetail("message", details[index]))
hgs
parents:
diff changeset
   114
        {
hgs
parents:
diff changeset
   115
            // Todo : Use loc string for this dialog
hgs
parents:
diff changeset
   116
            QString context = details[index].contexts().isEmpty() ? QString() : details[index].contexts().first();
hgs
parents:
diff changeset
   117
            QString subtype = details[index].subTypes().isEmpty() ? details[index].definitionName() : details[index].subTypes().first();
hgs
parents:
diff changeset
   118
            
hgs
parents:
diff changeset
   119
            int position = getPosition(subtype, context);
hgs
parents:
diff changeset
   120
        
hgs
parents:
diff changeset
   121
            QString icon;
hgs
parents:
diff changeset
   122
            if (details[index].contexts().isEmpty())
hgs
parents:
diff changeset
   123
            {
hgs
parents:
diff changeset
   124
              icon = "qtg_large_message";
hgs
parents:
diff changeset
   125
            }
hgs
parents:
diff changeset
   126
            else if (details[index].contexts().first() == QContactDetail::ContextHome)
hgs
parents:
diff changeset
   127
            {
hgs
parents:
diff changeset
   128
              icon = "qtg_large_message_home";
hgs
parents:
diff changeset
   129
            }
hgs
parents:
diff changeset
   130
            else if (details[index].contexts().first() == QContactDetail::ContextWork)
hgs
parents:
diff changeset
   131
            {
hgs
parents:
diff changeset
   132
              icon = "qtg_large_message_work";
hgs
parents:
diff changeset
   133
            }
hgs
parents:
diff changeset
   134
            else
hgs
parents:
diff changeset
   135
            {
hgs
parents:
diff changeset
   136
              icon = "qtg_large_message";
hgs
parents:
diff changeset
   137
            }
hgs
parents:
diff changeset
   138
            
hgs
parents:
diff changeset
   139
            QString titleText( hbTrId("txt_phob_dblist_send_message"));
hgs
parents:
diff changeset
   140
            QString valueText = details[index].number();
hgs
parents:
diff changeset
   141
            
hgs
parents:
diff changeset
   142
            QStandardItem *labelItem = new QStandardItem();
hgs
parents:
diff changeset
   143
            QStringList textList;
hgs
parents:
diff changeset
   144
            textList << titleText << valueText;
hgs
parents:
diff changeset
   145
            labelItem->setData(textList, Qt::DisplayRole);
hgs
parents:
diff changeset
   146
            labelItem->setData(HbIcon(icon), Qt::DecorationRole);
hgs
parents:
diff changeset
   147
            labelItem->setData(index, Qt::UserRole);
hgs
parents:
diff changeset
   148
            labelItem->setData("message", Qt::UserRole+1);
hgs
parents:
diff changeset
   149
            labelItem->setData(position, Qt::UserRole+2);
hgs
parents:
diff changeset
   150
            mDataItemList.append(labelItem);
hgs
parents:
diff changeset
   151
        }
hgs
parents:
diff changeset
   152
    }
hgs
parents:
diff changeset
   153
}
hgs
parents:
diff changeset
   154
hgs
parents:
diff changeset
   155
bool CntActionPopupPrivate::showActionPopup(QString action)
hgs
parents:
diff changeset
   156
{
hgs
parents:
diff changeset
   157
    if (action.compare("call", Qt::CaseInsensitive) == 0 )
hgs
parents:
diff changeset
   158
    {
hgs
parents:
diff changeset
   159
        buildCallActionPopup();
hgs
parents:
diff changeset
   160
    }
hgs
parents:
diff changeset
   161
    else if( action.compare("message", Qt::CaseInsensitive) == 0 )
hgs
parents:
diff changeset
   162
    {       
hgs
parents:
diff changeset
   163
        buildMessageActionPopup();
hgs
parents:
diff changeset
   164
    }
hgs
parents:
diff changeset
   165
    else if (action.compare("email", Qt::CaseInsensitive) == 0 )
hgs
parents:
diff changeset
   166
    {
hgs
parents:
diff changeset
   167
        buildEmailActionPopup();
hgs
parents:
diff changeset
   168
    }
hgs
parents:
diff changeset
   169
    
hgs
parents:
diff changeset
   170
    if(mDataItemList.count())
hgs
parents:
diff changeset
   171
    {
hgs
parents:
diff changeset
   172
        showPopup();
hgs
parents:
diff changeset
   173
        return true;
hgs
parents:
diff changeset
   174
    }
hgs
parents:
diff changeset
   175
    return false; 
hgs
parents:
diff changeset
   176
    
hgs
parents:
diff changeset
   177
}
hgs
parents:
diff changeset
   178
hgs
parents:
diff changeset
   179
void CntActionPopupPrivate::showPopup()
hgs
parents:
diff changeset
   180
{
hgs
parents:
diff changeset
   181
    for (int i= 0 ;i< mDataItemList.count() ;i++) 
hgs
parents:
diff changeset
   182
        {
hgs
parents:
diff changeset
   183
        mListModel->appendRow(mDataItemList.at(i));
hgs
parents:
diff changeset
   184
        }
hgs
parents:
diff changeset
   185
    mListModel->setSortRole(Qt::UserRole+2);
hgs
parents:
diff changeset
   186
    mListModel->sort(0, Qt::AscendingOrder);
hgs
parents:
diff changeset
   187
hgs
parents:
diff changeset
   188
    clearActions(); 
hgs
parents:
diff changeset
   189
    mListView->setModel(mListModel);
hgs
parents:
diff changeset
   190
    mListView->setScrollingStyle(HbScrollArea::PanWithFollowOn);
hgs
parents:
diff changeset
   191
    mListView->setFrictionEnabled(true);
hgs
parents:
diff changeset
   192
    mListView->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Maximum );
81
hgs
parents: 72
diff changeset
   193
    mListView->setLongPressEnabled(false);//This is to make longpress act like shortpress when no tap menu
72
hgs
parents:
diff changeset
   194
    
hgs
parents:
diff changeset
   195
    QString contactName = mContact->displayLabel();
hgs
parents:
diff changeset
   196
    if (contactName.isEmpty())
hgs
parents:
diff changeset
   197
    {
hgs
parents:
diff changeset
   198
        contactName = hbTrId("txt_phob_list_unnamed");
hgs
parents:
diff changeset
   199
    }
hgs
parents:
diff changeset
   200
    
81
hgs
parents: 72
diff changeset
   201
    setHeadingText(contactName);
72
hgs
parents:
diff changeset
   202
    setContentWidget(mListView);
hgs
parents:
diff changeset
   203
    
hgs
parents:
diff changeset
   204
    mCancelAction = new HbAction(hbTrId("txt_common_button_cancel"), this);
hgs
parents:
diff changeset
   205
    addAction(mCancelAction);
hgs
parents:
diff changeset
   206
    setTimeout(HbDialog::NoTimeout);
hgs
parents:
diff changeset
   207
    setDismissPolicy(HbDialog::NoDismiss);
hgs
parents:
diff changeset
   208
    setModal(true);
hgs
parents:
diff changeset
   209
    
81
hgs
parents: 72
diff changeset
   210
    connect(mListView, SIGNAL(activated (const QModelIndex &)), 
hgs
parents: 72
diff changeset
   211
            this, SLOT(listItemSelected(QModelIndex)) );
72
hgs
parents:
diff changeset
   212
    
hgs
parents:
diff changeset
   213
    //launch dialog asyncronously
hgs
parents:
diff changeset
   214
    open(this, SLOT(handleUserResponse(HbAction*)));
hgs
parents:
diff changeset
   215
hgs
parents:
diff changeset
   216
}
hgs
parents:
diff changeset
   217
hgs
parents:
diff changeset
   218
void CntActionPopupPrivate::handleUserResponse(HbAction* action)
hgs
parents:
diff changeset
   219
{
hgs
parents:
diff changeset
   220
    if (action == mCancelAction )
hgs
parents:
diff changeset
   221
    {
hgs
parents:
diff changeset
   222
    emit actionPopupCancelPressed();
hgs
parents:
diff changeset
   223
    }
hgs
parents:
diff changeset
   224
    mCancelAction = 0;
hgs
parents:
diff changeset
   225
    
hgs
parents:
diff changeset
   226
}
hgs
parents:
diff changeset
   227
hgs
parents:
diff changeset
   228
void CntActionPopupPrivate::listItemSelected( QModelIndex index )
hgs
parents:
diff changeset
   229
{   
hgs
parents:
diff changeset
   230
    if (index.isValid())
hgs
parents:
diff changeset
   231
    {
hgs
parents:
diff changeset
   232
        int selectedDetail = mListModel->item(index.row())->data(Qt::UserRole).toInt();
hgs
parents:
diff changeset
   233
        QString actionName = mListModel->item(index.row())->data(Qt::UserRole+1).toString();   
hgs
parents:
diff changeset
   234
        if (actionName.compare("call", Qt::CaseInsensitive) == 0 
hgs
parents:
diff changeset
   235
            || actionName.compare("message", Qt::CaseInsensitive) == 0 )
hgs
parents:
diff changeset
   236
        {       
hgs
parents:
diff changeset
   237
            QList<QContactPhoneNumber> details = mContact->details<QContactPhoneNumber>();
hgs
parents:
diff changeset
   238
            emit executeContactAction( *mContact, details[selectedDetail], actionName);
hgs
parents:
diff changeset
   239
        }
hgs
parents:
diff changeset
   240
        else if (actionName.compare("email", Qt::CaseInsensitive) == 0 )
hgs
parents:
diff changeset
   241
        {
hgs
parents:
diff changeset
   242
            QList<QContactEmailAddress> details = mContact->details<QContactEmailAddress>();
hgs
parents:
diff changeset
   243
            emit executeContactAction( *mContact, details[selectedDetail], actionName);
hgs
parents:
diff changeset
   244
        }
hgs
parents:
diff changeset
   245
    }
hgs
parents:
diff changeset
   246
    close();
hgs
parents:
diff changeset
   247
}
hgs
parents:
diff changeset
   248
hgs
parents:
diff changeset
   249
/*!
hgs
parents:
diff changeset
   250
Returns position of specific item
hgs
parents:
diff changeset
   251
*/
hgs
parents:
diff changeset
   252
int CntActionPopupPrivate::getPosition(const QString& aId, const QString& aContext)
hgs
parents:
diff changeset
   253
{
hgs
parents:
diff changeset
   254
    int position = CntActionPopupPrivate::ENotSupported;
hgs
parents:
diff changeset
   255
    if (aId == QContactPhoneNumber::SubTypeAssistant && aContext.isEmpty() )
hgs
parents:
diff changeset
   256
    {
hgs
parents:
diff changeset
   257
        position = CntActionPopupPrivate::ECallAssistant;
hgs
parents:
diff changeset
   258
    }
hgs
parents:
diff changeset
   259
    else if (aId == QContactPhoneNumber::SubTypeCar && aContext.isEmpty() )
hgs
parents:
diff changeset
   260
    {
hgs
parents:
diff changeset
   261
        position = CntActionPopupPrivate::ECallCar;
hgs
parents:
diff changeset
   262
    }
hgs
parents:
diff changeset
   263
    else if (aId == QContactPhoneNumber::SubTypeMobile && aContext.isEmpty() )
hgs
parents:
diff changeset
   264
    {
hgs
parents:
diff changeset
   265
        position = CntActionPopupPrivate::ECallMobile;
hgs
parents:
diff changeset
   266
    }
hgs
parents:
diff changeset
   267
    else if (aId == QContactPhoneNumber::SubTypeMobile && aContext == QContactDetail::ContextHome )
hgs
parents:
diff changeset
   268
    {
hgs
parents:
diff changeset
   269
        position = CntActionPopupPrivate::ECallMobileHome;
hgs
parents:
diff changeset
   270
    }
hgs
parents:
diff changeset
   271
    else if (aId == QContactPhoneNumber::SubTypeMobile && aContext == QContactDetail::ContextWork )
hgs
parents:
diff changeset
   272
    {
hgs
parents:
diff changeset
   273
        position = CntActionPopupPrivate::ECallMobileWork;
hgs
parents:
diff changeset
   274
    }
hgs
parents:
diff changeset
   275
    else if (aId == QContactPhoneNumber::SubTypeLandline && aContext.isEmpty() )
hgs
parents:
diff changeset
   276
    {
hgs
parents:
diff changeset
   277
        position = CntActionPopupPrivate::ECallPhone;
hgs
parents:
diff changeset
   278
    }
hgs
parents:
diff changeset
   279
    else if (aId == QContactPhoneNumber::SubTypeLandline && aContext == QContactDetail::ContextHome )
hgs
parents:
diff changeset
   280
    {
hgs
parents:
diff changeset
   281
        position = CntActionPopupPrivate::ECallPhoneHome;    
hgs
parents:
diff changeset
   282
    }
hgs
parents:
diff changeset
   283
    else if (aId == QContactPhoneNumber::SubTypeLandline && aContext == QContactDetail::ContextWork )
hgs
parents:
diff changeset
   284
    {
hgs
parents:
diff changeset
   285
        position = CntActionPopupPrivate::ECallPhoneWork;
hgs
parents:
diff changeset
   286
    }
hgs
parents:
diff changeset
   287
    else if (aId == QContactPhoneNumber::SubTypeFax && aContext.isEmpty() )
hgs
parents:
diff changeset
   288
    {
hgs
parents:
diff changeset
   289
        position = CntActionPopupPrivate::ECallFax;
hgs
parents:
diff changeset
   290
    }
hgs
parents:
diff changeset
   291
    else if (aId == QContactPhoneNumber::SubTypeFax && aContext == QContactDetail::ContextHome )
hgs
parents:
diff changeset
   292
    {
hgs
parents:
diff changeset
   293
        position = CntActionPopupPrivate::ECallFaxHome;
hgs
parents:
diff changeset
   294
    }
hgs
parents:
diff changeset
   295
    else if (aId == QContactPhoneNumber::SubTypeFax && aContext == QContactDetail::ContextWork )
hgs
parents:
diff changeset
   296
    {
hgs
parents:
diff changeset
   297
        position = CntActionPopupPrivate::ECallFaxWork;
hgs
parents:
diff changeset
   298
    }
hgs
parents:
diff changeset
   299
    else if (aId == QContactPhoneNumber::SubTypePager && aContext.isEmpty() )
hgs
parents:
diff changeset
   300
    {
hgs
parents:
diff changeset
   301
        position = CntActionPopupPrivate::ECallPager;
hgs
parents:
diff changeset
   302
    }
hgs
parents:
diff changeset
   303
    else if (aId == QContactEmailAddress::DefinitionName && aContext.isEmpty())
hgs
parents:
diff changeset
   304
    {
hgs
parents:
diff changeset
   305
            position = CntActionPopupPrivate::EEmail;
hgs
parents:
diff changeset
   306
    }
hgs
parents:
diff changeset
   307
    else if (aId == QContactEmailAddress::DefinitionName && aContext == QContactDetail::ContextHome)
hgs
parents:
diff changeset
   308
    {
hgs
parents:
diff changeset
   309
            position = CntActionPopupPrivate::EEmailHome;
hgs
parents:
diff changeset
   310
    }
hgs
parents:
diff changeset
   311
    else if (aId == QContactEmailAddress::DefinitionName && aContext == QContactDetail::ContextWork)
hgs
parents:
diff changeset
   312
    {
hgs
parents:
diff changeset
   313
            position = CntActionPopupPrivate::EEmailWork;
hgs
parents:
diff changeset
   314
    }
hgs
parents:
diff changeset
   315
    else 
hgs
parents:
diff changeset
   316
    {
hgs
parents:
diff changeset
   317
        position = CntActionPopupPrivate::ENotSupported;
hgs
parents:
diff changeset
   318
    }
hgs
parents:
diff changeset
   319
    
hgs
parents:
diff changeset
   320
    return position;
hgs
parents:
diff changeset
   321
}
hgs
parents:
diff changeset
   322
hgs
parents:
diff changeset
   323
/*!
hgs
parents:
diff changeset
   324
Returns true if contactDetails contains spesific action.
hgs
parents:
diff changeset
   325
*/
hgs
parents:
diff changeset
   326
bool CntActionPopupPrivate::supportsDetail(const QString &actionName, const QContactDetail &contactDetail)
hgs
parents:
diff changeset
   327
{    
hgs
parents:
diff changeset
   328
    QList<QContactActionDescriptor> actionDescriptors = QContactAction::actionDescriptors(actionName, "symbian");
hgs
parents:
diff changeset
   329
    if (actionDescriptors.isEmpty())
hgs
parents:
diff changeset
   330
    {
hgs
parents:
diff changeset
   331
        return false;
hgs
parents:
diff changeset
   332
    }
hgs
parents:
diff changeset
   333
    
hgs
parents:
diff changeset
   334
    QContactAction* contactAction = QContactAction::action(actionDescriptors.first());
hgs
parents:
diff changeset
   335
    bool isSupportDetail = contactAction->isDetailSupported(contactDetail);
hgs
parents:
diff changeset
   336
    
hgs
parents:
diff changeset
   337
    delete contactAction;
hgs
parents:
diff changeset
   338
    
hgs
parents:
diff changeset
   339
    return isSupportDetail;
hgs
parents:
diff changeset
   340
}
hgs
parents:
diff changeset
   341
hgs
parents:
diff changeset
   342
// End of File