25 #include <xqaiwrequest.h> |
25 #include <xqaiwrequest.h> |
26 #include <xqappmgr.h> |
26 #include <xqappmgr.h> |
27 #include <telconfigcrkeys.h> // KCRUidTelephonyConfiguration |
27 #include <telconfigcrkeys.h> // KCRUidTelephonyConfiguration |
28 #include <centralrepository.h> |
28 #include <centralrepository.h> |
29 #include <HbNotificationDialog> |
29 #include <HbNotificationDialog> |
30 #include <commonphoneparser.h> // Common phone number validity checker |
|
31 #include <xqconversions.h> |
|
32 #include <HbEditorInterface> |
30 #include <HbEditorInterface> |
33 |
31 |
34 // USER INCLUDES |
32 // USER INCLUDES |
35 #include "debugtraces.h" |
33 #include "debugtraces.h" |
36 #include "msgunieditoraddress.h" |
34 #include "msgunieditoraddress.h" |
37 #include "msgunieditorlineedit.h" |
35 #include "msgunieditorlineedit.h" |
38 #include "msgunieditormonitor.h" |
36 #include "msgunieditormonitor.h" |
39 #include "UniEditorGenUtils.h" |
37 #include "UniEditorGenUtils.h" |
|
38 #include "msgsendutil.h" |
40 |
39 |
41 const QString PBK_ICON("qtg_mono_contacts"); |
40 const QString PBK_ICON("qtg_mono_contacts"); |
42 const QString REPLACEMENT_STR("; "); |
41 const QString REPLACEMENT_STR("; "); |
43 const QString COMMA_SEPERATOR(","); |
42 const QString COMMA_SEPERATOR(","); |
44 |
43 |
244 for(int i = 0; i < count; i++ ) |
243 for(int i = 0; i < count; i++ ) |
245 { |
244 { |
246 bool isValid = false; |
245 bool isValid = false; |
247 if(!aSkipCheck) |
246 if(!aSkipCheck) |
248 { |
247 { |
249 isValid = checkValidAddress(addrlist.at(i)->address()); |
248 QScopedPointer<MsgSendUtil> sendUtil(new MsgSendUtil()); |
|
249 isValid = sendUtil->isValidAddress(addrlist.at(i)->address()); |
250 } |
250 } |
251 else |
251 else |
252 { |
252 { |
253 // no need to validate, assume correct |
253 // no need to validate, assume correct |
254 isValid = true; |
254 isValid = true; |
526 // MsgUnifiedEditorAddress::validateContacts |
526 // MsgUnifiedEditorAddress::validateContacts |
527 // @see header |
527 // @see header |
528 // ---------------------------------------------------------------------------- |
528 // ---------------------------------------------------------------------------- |
529 bool MsgUnifiedEditorAddress::validateContacts() |
529 bool MsgUnifiedEditorAddress::validateContacts() |
530 { |
530 { |
531 UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils); |
|
532 |
531 |
533 // sync-up map to account for user-actions on address-field |
532 // sync-up map to account for user-actions on address-field |
534 syncDeletionsToMap(); |
533 syncDeletionsToMap(); |
535 syncAdditionsToMap(); |
534 syncAdditionsToMap(); |
536 |
535 |
542 { |
541 { |
543 // run address validation only if address is unmapped |
542 // run address validation only if address is unmapped |
544 // (i.e. user-inserted) |
543 // (i.e. user-inserted) |
545 if(mAddressMap.contains(addr)) |
544 if(mAddressMap.contains(addr)) |
546 { |
545 { |
547 isValid = checkValidAddress(addr); |
546 QScopedPointer<MsgSendUtil> sendUtil(new MsgSendUtil()); |
|
547 isValid = sendUtil->isValidAddress(addr); |
548 if(!isValid) |
548 if(!isValid) |
549 { |
549 { |
550 mAddressEdit->highlightInvalidString(addr); |
550 mAddressEdit->highlightInvalidString(addr); |
551 QString invalidAddrStr = |
551 QString invalidAddrStr = |
552 QString(LOC_INVALID_RECIPIENT).arg(addr); |
552 QString(LOC_INVALID_RECIPIENT).arg(addr); |
561 } |
561 } |
562 } |
562 } |
563 |
563 |
564 return isValid; |
564 return isValid; |
565 } |
565 } |
566 // ---------------------------------------------------------------------------- |
|
567 // MsgUnifiedEditorAddress::checkValidAddress |
|
568 // @see header |
|
569 // ---------------------------------------------------------------------------- |
|
570 bool MsgUnifiedEditorAddress::checkValidAddress(const QString& addr) |
|
571 { |
|
572 bool isValid = false; |
|
573 |
|
574 HBufC *tempAddr = XQConversions::qStringToS60Desc(addr); |
|
575 |
|
576 // 1. perform number validation |
|
577 isValid = CommonPhoneParser::IsValidPhoneNumber( |
|
578 *tempAddr, |
|
579 CommonPhoneParser::ESMSNumber ); |
|
580 |
|
581 // 2. if number validity fails, then perform email addr validation |
|
582 UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils); |
|
583 if(!isValid) |
|
584 { // additional check for MMS only |
|
585 isValid = genUtils->IsValidEmailAddress( |
|
586 *tempAddr ); |
|
587 } |
|
588 delete genUtils; |
|
589 delete tempAddr; |
|
590 return isValid; |
|
591 } |
|
592 |
566 |
593 void MsgUnifiedEditorAddress::handleInvalidContactDialog( |
567 void MsgUnifiedEditorAddress::handleInvalidContactDialog( |
594 HbAction* act) |
568 HbAction* act) |
595 { |
569 { |
596 Q_UNUSED(act); |
570 Q_UNUSED(act); |