messagingapp/msgui/msguiutils/src/msgsendutil.cpp
changeset 72 6f657153cbc5
parent 52 12db4185673b
equal deleted inserted replaced
70:a15d9966050f 72:6f657153cbc5
    21 #include "unieditorpluginloader.h"
    21 #include "unieditorpluginloader.h"
    22 #include "unieditorplugininterface.h"
    22 #include "unieditorplugininterface.h"
    23 // general editor utilities
    23 // general editor utilities
    24 #include "UniEditorGenUtils.h"
    24 #include "UniEditorGenUtils.h"
    25 
    25 
       
    26 #include <xqconversions.h>
       
    27 #include <commonphoneparser.h> // commonengine
    26 
    28 
    27 //---------------------------------------------------------------
    29 //---------------------------------------------------------------
    28 // MsgSendUtil::MsgSendUtil
    30 // MsgSendUtil::MsgSendUtil
    29 // Constructor
    31 // Constructor
    30 //--------------------------------------------------------------
    32 //--------------------------------------------------------------
    99         }
   101         }
   100     }
   102     }
   101 
   103 
   102     QDEBUG_WRITE("END MsgSendUtil::send");
   104     QDEBUG_WRITE("END MsgSendUtil::send");
   103     return retValue;
   105     return retValue;
       
   106 }
       
   107 
       
   108 //---------------------------------------------------------------
       
   109 // MsgSendUtil::isValidAddress
       
   110 // @see header file
       
   111 //--------------------------------------------------------------
       
   112 bool MsgSendUtil::isValidAddress(const QString &address)
       
   113 {
       
   114     bool isValid = false;
       
   115     if (!address.isEmpty()) {
       
   116 
       
   117         HBufC *tempAddr = XQConversions::qStringToS60Desc(address);
       
   118 
       
   119         // 1. perform number validation
       
   120         isValid = CommonPhoneParser::IsValidPhoneNumber(*tempAddr, CommonPhoneParser::ESMSNumber);
       
   121 
       
   122         // 2. if number validity fails, then perform email addr validation
       
   123         if (!isValid) {
       
   124             // additional check for MMS only
       
   125             UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
       
   126             isValid = genUtils->IsValidEmailAddress(*tempAddr);
       
   127             delete genUtils;
       
   128         }
       
   129         delete tempAddr;
       
   130     }
       
   131     return isValid;
   104 }
   132 }
   105 
   133 
   106 //---------------------------------------------------------------
   134 //---------------------------------------------------------------
   107 // MsgSendUtil::checkEmailOverSms
   135 // MsgSendUtil::checkEmailOverSms
   108 // @see header file
   136 // @see header file