messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp
changeset 73 ecf6a73a9186
parent 67 fc91263aee62
child 76 60a8a215b0ec
equal deleted inserted replaced
68:e8a69c93c830 73:ecf6a73a9186
    41 const QString REPLACEMENT_STR("; ");
    41 const QString REPLACEMENT_STR("; ");
    42 const QString COMMA_SEPERATOR(",");
    42 const QString COMMA_SEPERATOR(",");
    43 
    43 
    44 // Constants
    44 // Constants
    45 const int KDefaultGsmNumberMatchLength = 7;  //matching unique ph numbers
    45 const int KDefaultGsmNumberMatchLength = 7;  //matching unique ph numbers
       
    46 
       
    47 #define LOC_TITLE hbTrId("txt_messaging_title_messaging")
    46 #define LOC_SMS_RECIPIENT_LIMIT_REACHED hbTrId("txt_messaging_dialog_number_of_recipients_exceeded")
    48 #define LOC_SMS_RECIPIENT_LIMIT_REACHED hbTrId("txt_messaging_dialog_number_of_recipients_exceeded")
    47 #define LOC_MMS_RECIPIENT_LIMIT_REACHED hbTrId("txt_messaging_dpopinfo_unable_to_add_more_recipien")
    49 #define LOC_MMS_RECIPIENT_LIMIT_REACHED hbTrId("txt_messaging_dpopinfo_unable_to_add_more_recipien")
    48 #define LOC_DIALOG_OK hbTrId("txt_common_button_ok")
    50 #define LOC_DIALOG_OK hbTrId("txt_common_button_ok")
    49 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
    51 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
    50 #define LOC_INVALID_RECIPIENT hbTrId("txt_messaging_dialog_invalid_recipient_found")
    52 #define LOC_INVALID_RECIPIENT hbTrId("txt_messaging_dialog_invalid_recipient_found")
    97     mLaunchBtn->blockSignals(true);
    99     mLaunchBtn->blockSignals(true);
    98 
   100 
    99     QString service("phonebookservices");
   101     QString service("phonebookservices");
   100     QString interface("com.nokia.symbian.IContactsFetch");
   102     QString interface("com.nokia.symbian.IContactsFetch");
   101     QString operation("multiFetch(QString,QString)");
   103     QString operation("multiFetch(QString,QString)");
   102     XQAiwRequest* request;
       
   103     XQApplicationManager appManager;
   104     XQApplicationManager appManager;
   104     request = appManager.create(service, interface, operation, true); // embedded
   105     XQAiwRequest* request = appManager.create(service, interface, operation, true); // embedded
       
   106 	
   105     if ( request == NULL )
   107     if ( request == NULL )
   106         {
   108         {
   107         return;
   109         	return;
   108         }
   110         }
   109 
   111 		
       
   112     request->setSynchronous(false);
       
   113 	
   110     // Result handlers
   114     // Result handlers
   111     connect (request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&)));
   115     connect (request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&)));
   112     connect (request, SIGNAL(requestError(int,const QString&)), this, SLOT(handleError(int,const QString&)));
   116     connect (request, SIGNAL(requestError(int,const QString&)), this, SLOT(handleError(int,const QString&)));
   113 
   117 
   114     QList<QVariant> args;
   118     QList<QVariant> args;
   115     args << QString(tr("Phonebook"));
   119     args << LOC_TITLE;
   116     args << KCntActionAll;
   120     args << KCntActionSms;
   117     args << KCntFilterDisplayAll;
   121     args << KCntFilterDisplayAll;
   118 
   122 
   119     request->setArguments(args);
   123     request->setArguments(args);
   120     request->send();
   124     request->send();
   121     delete request;
   125     
   122 
       
   123     //unblock click signal after some delay.
   126     //unblock click signal after some delay.
   124     QTimer::singleShot(250,this,SLOT(unblockSignals()));
   127     QTimer::singleShot(250,this,SLOT(unblockSignals()));
   125 }
   128 }
   126 
   129 
   127 void MsgUnifiedEditorAddress::handleOk(const QVariant& value)
   130 void MsgUnifiedEditorAddress::handleOk(const QVariant& value)
   128 {
   131 {
       
   132     // delete the request
       
   133     XQAiwRequest* request = qobject_cast<XQAiwRequest*>(this->sender());
       
   134     if(request)
       
   135     {
       
   136         delete request;        
       
   137     }
       
   138 	
   129    CntServicesContactList contactList =
   139    CntServicesContactList contactList =
   130            qVariantValue<CntServicesContactList>(value);
   140            qVariantValue<CntServicesContactList>(value);
   131     int count = contactList.count();
   141     int count = contactList.count();
   132 
   142 
   133     ConvergedMessageAddressList addrlist;
   143     ConvergedMessageAddressList addrlist;
   145         }
   155         }
   146         address->setAlias(contactList[i].mDisplayName);
   156         address->setAlias(contactList[i].mDisplayName);
   147         addrlist << address;
   157         addrlist << address;
   148     }
   158     }
   149     setAddresses(addrlist);
   159     setAddresses(addrlist);
       
   160     
   150 }
   161 }
   151 
   162 
   152 void MsgUnifiedEditorAddress::handleError(int errorCode, const QString& errorMessage)
   163 void MsgUnifiedEditorAddress::handleError(int errorCode, const QString& errorMessage)
   153 {
   164 {
   154     Q_UNUSED(errorMessage)
   165     Q_UNUSED(errorMessage)
   155     Q_UNUSED(errorCode)
   166     Q_UNUSED(errorCode)
       
   167 	
       
   168     XQAiwRequest* request = qobject_cast<XQAiwRequest*>(this->sender());
       
   169     if(request)
       
   170     {
       
   171        delete request;      
       
   172     }
   156 }
   173 }
   157 
   174 
   158 // ----------------------------------------------------------------------------
   175 // ----------------------------------------------------------------------------
   159 // MsgUnifiedEditorAddress::addresses
   176 // MsgUnifiedEditorAddress::addresses
   160 // @see header
   177 // @see header