messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp
changeset 52 12db4185673b
parent 44 36f374c67aa8
child 70 a15d9966050f
equal deleted inserted replaced
44:36f374c67aa8 52:12db4185673b
    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
    30 #include <commonphoneparser.h>      // Common phone number validity checker
    31 #include <xqconversions.h>
    31 #include <xqconversions.h>
       
    32 #include <HbEditorInterface>
    32 
    33 
    33 // USER INCLUDES
    34 // USER INCLUDES
    34 #include "debugtraces.h"
    35 #include "debugtraces.h"
    35 #include "msgunieditoraddress.h"
    36 #include "msgunieditoraddress.h"
    36 #include "msgunieditorlineedit.h"
    37 #include "msgunieditorlineedit.h"
    77     mAddressEdit->setMaxRows(40);
    78     mAddressEdit->setMaxRows(40);
    78     connect(mAddressEdit, SIGNAL(contentsChanged(const QString&)),
    79     connect(mAddressEdit, SIGNAL(contentsChanged(const QString&)),
    79             this, SLOT(onContentsChanged(const QString&)));
    80             this, SLOT(onContentsChanged(const QString&)));
    80 
    81 
    81     mAddressEdit->setInputMethodHints(Qt::ImhPreferNumbers);
    82     mAddressEdit->setInputMethodHints(Qt::ImhPreferNumbers);
       
    83     
       
    84     //To allow only latin char(s) in address fields.
       
    85     HbEditorInterface editorInterface(mAddressEdit);
       
    86     editorInterface.setInputConstraints(HbEditorConstraintLatinAlphabetOnly);
    82 }
    87 }
    83 
    88 
    84 MsgUnifiedEditorAddress::~MsgUnifiedEditorAddress()
    89 MsgUnifiedEditorAddress::~MsgUnifiedEditorAddress()
    85 {
    90 {
    86 	//TODO: Should remove this code depending on orbit's reply whether it is needed
    91 	//TODO: Should remove this code depending on orbit's reply whether it is needed
   268         QString invalidStr;
   273         QString invalidStr;
   269         (invalidCount == 1)?(invalidStr = QString(LOC_INVALID_RECIPIENT_NOT_ADDED)) :(invalidStr = QString(LOC_INVALID_RECIPIENTS_NOT_ADDED));
   274         (invalidCount == 1)?(invalidStr = QString(LOC_INVALID_RECIPIENT_NOT_ADDED)) :(invalidStr = QString(LOC_INVALID_RECIPIENTS_NOT_ADDED));
   270         // append line seperator
   275         // append line seperator
   271          invalidStr.append("<br>");
   276          invalidStr.append("<br>");
   272          invalidStr.append(invalidContacts);
   277          invalidStr.append(invalidContacts);
   273          HbMessageBox::information(invalidStr);
   278          HbMessageBox::information(invalidStr, 0, 0, HbMessageBox::Ok);
   274         }
   279         }
   275 
   280 
   276     // addition operation complete, reset flags
   281     // addition operation complete, reset flags
   277     mAboutToExceedMaxSmsRecipients = false;
   282     mAboutToExceedMaxSmsRecipients = false;
   278     mAboutToExceedMaxMmsRecipients = false;
   283     mAboutToExceedMaxMmsRecipients = false;
   305         if(mAboutToExceedMaxMmsRecipients)
   310         if(mAboutToExceedMaxMmsRecipients)
   306         {// show discreet note only once
   311         {// show discreet note only once
   307             --mExceedsMaxMmsRecipientsBy;
   312             --mExceedsMaxMmsRecipientsBy;
   308             if(!mExceedsMaxMmsRecipientsBy)
   313             if(!mExceedsMaxMmsRecipientsBy)
   309             {
   314             {
   310                 HbNotificationDialog::launchDialog(
   315                 HbMessageBox::information(LOC_MMS_RECIPIENT_LIMIT_REACHED, 0, 0, HbMessageBox::Ok);
   311                         LOC_MMS_RECIPIENT_LIMIT_REACHED);
       
   312             }
   316             }
   313             resetToPrevious();
   317             resetToPrevious();
   314         }
   318         }
   315         else
   319         else
   316         {
   320         {
   317             // update monitor data
   321             // update monitor data
   318             emit contentChanged();
   322             emit contentChanged();
   319             if(MsgUnifiedEditorMonitor::msgAddressCount() > MsgUnifiedEditorMonitor::maxMmsRecipients())
   323             if(MsgUnifiedEditorMonitor::msgAddressCount() > MsgUnifiedEditorMonitor::maxMmsRecipients())
   320             {
   324             {
   321                 HbNotificationDialog::launchDialog(
   325                 HbMessageBox::information(LOC_MMS_RECIPIENT_LIMIT_REACHED, 0, 0, HbMessageBox::Ok);
   322                         LOC_MMS_RECIPIENT_LIMIT_REACHED);
       
   323                 resetToPrevious();
   326                 resetToPrevious();
   324                 // reset monitor data
   327                 // reset monitor data
   325                 emit contentChanged();
   328                 emit contentChanged();
   326             }
   329             }
   327             else
   330             else
   513 // MsgUnifiedEditorAddress::validateContacts
   516 // MsgUnifiedEditorAddress::validateContacts
   514 // @see header
   517 // @see header
   515 // ----------------------------------------------------------------------------
   518 // ----------------------------------------------------------------------------
   516 bool MsgUnifiedEditorAddress::validateContacts()
   519 bool MsgUnifiedEditorAddress::validateContacts()
   517 {
   520 {
   518     UniEditorGenUtils* genUtils = new UniEditorGenUtils;
   521     UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
   519 
   522 
   520     // sync-up map to account for user-actions on address-field
   523     // sync-up map to account for user-actions on address-field
   521     syncDeletionsToMap();
   524     syncDeletionsToMap();
   522     syncAdditionsToMap();
   525     syncAdditionsToMap();
   523 
   526 
   564     isValid = CommonPhoneParser::IsValidPhoneNumber(
   567     isValid = CommonPhoneParser::IsValidPhoneNumber(
   565             *tempAddr,
   568             *tempAddr,
   566             CommonPhoneParser::ESMSNumber );
   569             CommonPhoneParser::ESMSNumber );
   567 
   570 
   568     // 2. if number validity fails, then perform email addr validation
   571     // 2. if number validity fails, then perform email addr validation
   569     UniEditorGenUtils* genUtils = new UniEditorGenUtils;
   572     UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
   570     if(!isValid)
   573     if(!isValid)
   571         { // additional check for MMS only
   574         { // additional check for MMS only
   572         isValid = genUtils->IsValidEmailAddress(
   575         isValid = genUtils->IsValidEmailAddress(
   573                     *tempAddr );
   576                     *tempAddr );
   574         } 
   577         }