emailuis/nmailui/src/nmrecipientfield.cpp
changeset 54 997a02608b3a
parent 53 bf7eb7911fc5
child 57 ae34e1715e21
equal deleted inserted replaced
53:bf7eb7911fc5 54:997a02608b3a
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include "nmuiheaders.h"
    18 #include "nmuiheaders.h"
    19 
    19 
    20 static const QString ContactsServiceName = "com.nokia.services.phonebookservices";
    20 static const QString NmContactsServiceName = "com.nokia.services.phonebookservices";
    21 static const QString ContactsInterfaceName = "Fetch";
    21 static const QString NmContactsInterfaceName = "Fetch";
    22 static const QString ContactsOperationName = "fetch(QString,QString,QString)";
    22 static const QString NmContactsOperationName = "fetch(QString,QString,QString)";
    23 
    23 
    24 static const int MaxRows = 10000;
    24 static const int NmMaxRows = 10000;
    25 
    25 
    26 /*!
    26 /*!
    27    widget is created using AD/docml
    27    widget is created using AD/docml
    28 */
    28 */
    29 NmRecipientField::NmRecipientField(
    29 NmRecipientField::NmRecipientField(
    44     mLabel = qobject_cast<HbLabel *>
    44     mLabel = qobject_cast<HbLabel *>
    45         (mDocumentLoader.findWidget(mObjectPrefix + "Label"));
    45         (mDocumentLoader.findWidget(mObjectPrefix + "Label"));
    46 
    46 
    47     mRecipientsEditor = qobject_cast<NmRecipientLineEdit *>
    47     mRecipientsEditor = qobject_cast<NmRecipientLineEdit *>
    48         (mDocumentLoader.findWidget(mObjectPrefix + "Edit"));
    48         (mDocumentLoader.findWidget(mObjectPrefix + "Edit"));
    49     mRecipientsEditor->setMaxRows(MaxRows);
    49     if (mRecipientsEditor) {
       
    50         mRecipientsEditor->setMaxRows(NmMaxRows);    
       
    51     }
    50 
    52 
    51     mLaunchContactsPickerButton = qobject_cast<HbPushButton *>
    53     mLaunchContactsPickerButton = qobject_cast<HbPushButton *>
    52         (mDocumentLoader.findWidget(mObjectPrefix + "Button"));
    54         (mDocumentLoader.findWidget(mObjectPrefix + "Button"));
    53 
    55     if (mLaunchContactsPickerButton) {
    54     mLaunchContactsPickerButton->setIcon(NmIcons::getIcon(NmIcons::NmIconContacts));
    56         mLaunchContactsPickerButton->setIcon(NmIcons::getIcon(NmIcons::NmIconContacts));    
       
    57     }
    55 
    58 
    56     createConnections();
    59     createConnections();
    57 }
    60 }
    58 
    61 
    59 /*!
    62 /*!
    71         this, SIGNAL(editingFinished()));
    74         this, SIGNAL(editingFinished()));
    72     connect(mRecipientsEditor, SIGNAL(selectionChanged()),
    75     connect(mRecipientsEditor, SIGNAL(selectionChanged()),
    73         this, SIGNAL(selectionChanged()));
    76         this, SIGNAL(selectionChanged()));
    74     connect(mLaunchContactsPickerButton, SIGNAL(pressed()),
    77     connect(mLaunchContactsPickerButton, SIGNAL(pressed()),
    75             this, SIGNAL(launchContactsPickerButtonClicked()));
    78             this, SIGNAL(launchContactsPickerButtonClicked()));
    76 
    79     connect(mLaunchContactsPickerButton, SIGNAL(pressed()), 
    77 #ifdef Q_OS_SYMBIAN
    80             this, SLOT(launchContactsPicker()));
    78     connect(mLaunchContactsPickerButton, SIGNAL(pressed()), this, SLOT(launchContactsPicker()));
       
    79 #endif
       
    80 }
    81 }
    81 
    82 
    82 
    83 
    83 /*!
    84 /*!
    84    Destructor
    85    Destructor
   132         emit textChanged(newText);
   133         emit textChanged(newText);
   133     }
   134     }
   134 }
   135 }
   135 
   136 
   136 
   137 
   137 #ifdef Q_OS_SYMBIAN
       
   138 /*!
   138 /*!
   139    This Slot launches the contacts-picker
   139    This Slot launches the contacts-picker
   140 */
   140 */
   141 void NmRecipientField::launchContactsPicker()
   141 void NmRecipientField::launchContactsPicker()
   142 {
   142 {
   144     
   144     
   145     XQApplicationManager mAppmgr;
   145     XQApplicationManager mAppmgr;
   146     XQAiwRequest *launchContactsPickerRequest;
   146     XQAiwRequest *launchContactsPickerRequest;
   147     
   147     
   148     bool isEmbeded = true;
   148     bool isEmbeded = true;
   149     launchContactsPickerRequest = mAppmgr.create(ContactsServiceName, ContactsInterfaceName, 
   149     launchContactsPickerRequest = mAppmgr.create(NmContactsServiceName, NmContactsInterfaceName, 
   150                                                  ContactsOperationName, isEmbeded);
   150                                                  NmContactsOperationName, isEmbeded);
   151     
   151     
   152     if (launchContactsPickerRequest) {
   152     if (launchContactsPickerRequest) {
   153         connect(launchContactsPickerRequest, SIGNAL(requestOk(QVariant)),
   153         connect(launchContactsPickerRequest, SIGNAL(requestOk(QVariant)),
   154                 mRecipientsEditor, SLOT(insertSelectedContacts(QVariant)));
   154                 mRecipientsEditor, SLOT(addSelectedContacts(QVariant)));
   155     }
   155     }
   156     else {
   156     else {
   157         // Failed creating request 
   157         // Failed creating request 
   158         NM_ERROR(1,"XQApplicationManager: failed creating fecth contactspicker request");
   158         NM_ERROR(1,"XQApplicationManager: failed creating fecth contactspicker request");
   159 	    return;
   159 	    return;
   170        //Failed sending request 
   170        //Failed sending request 
   171        NM_ERROR(1,"XQApplicationManager: failed sending request");
   171        NM_ERROR(1,"XQApplicationManager: failed sending request");
   172     }
   172     }
   173         
   173         
   174     delete launchContactsPickerRequest;
   174     delete launchContactsPickerRequest;
   175     launchContactsPickerRequest = 0;
   175     launchContactsPickerRequest = NULL;
   176 }
   176 }
   177 #endif