--- a/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp Tue Oct 05 13:58:47 2010 +0530
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp Tue Oct 19 11:30:16 2010 +0530
@@ -63,7 +63,8 @@
mSkipMaxRecipientQuery(false),
mAboutToExceedMaxSmsRecipients(false),
mAboutToExceedMaxMmsRecipients(false),
-mExceedsMaxMmsRecipientsBy(0)
+mExceedsMaxMmsRecipientsBy(0),
+mAddressCount(0)
{
this->setContentsMargins(0,0,0,0);
@@ -75,8 +76,6 @@
mAddressEdit = new MsgUnifiedEditorLineEdit(label,this);
HbStyle::setItemName(mAddressEdit,"addressField");
-
- mAddressEdit->setMaxRows(40);
connect(mAddressEdit, SIGNAL(contentsChanged(const QString&)),
this, SLOT(onContentsChanged(const QString&)));
@@ -89,9 +88,6 @@
MsgUnifiedEditorAddress::~MsgUnifiedEditorAddress()
{
- //TODO: Should remove this code depending on orbit's reply whether it is needed
- //to unregister the same plugin registered on two different widgets twice.
- //style()->unregisterPlugin(mPluginPath);
}
void MsgUnifiedEditorAddress::fetchContacts()
@@ -330,6 +326,9 @@
void MsgUnifiedEditorAddress::onContentsChanged(const QString& text)
{
+
+ emitContentsChanged();
+
// Max MMS recipient count check
if( mAboutToExceedMaxMmsRecipients ||
(MsgUnifiedEditorMonitor::msgAddressCount() >= MsgUnifiedEditorMonitor::maxMmsRecipients()) )
@@ -345,20 +344,18 @@
}
else
{
- // update monitor data
- emit contentChanged();
if(MsgUnifiedEditorMonitor::msgAddressCount() > MsgUnifiedEditorMonitor::maxMmsRecipients())
{
HbMessageBox::information(LOC_MMS_RECIPIENT_LIMIT_REACHED, 0, 0, HbMessageBox::Ok);
resetToPrevious();
- // reset monitor data
- emit contentChanged();
}
else
{
mPrevBuffer = text;
}
}
+
+ emitContentsChanged();
return;
}
@@ -379,8 +376,8 @@
{// remember addresses before the block insertion started
mPrevBuffer = text;
}
- emit contentChanged();
}
+ emitContentsChanged();
}
void MsgUnifiedEditorAddress::handleRecipientLimitReached()
@@ -529,14 +526,15 @@
{
HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
if (action == dlg->actions().at(0)) {
- // accept new content, update prev-buffer
- emit contentChanged();
mPrevBuffer = mAddressEdit->content();
}
else {
// reject the new content, keep the old
resetToPrevious();
}
+
+ emitContentsChanged();
+
}
// ----------------------------------------------------------------------------
@@ -593,6 +591,36 @@
mLaunchBtn->blockSignals(false);
}
+void MsgUnifiedEditorAddress::emitContentsChanged()
+{
+ int currentAddressCount = addressCount();
+ bool hasEmail = hasValidEmailAddress();
+
+ if(mAddressCount != currentAddressCount || hasEmail)
+ {
+ mAddressCount = currentAddressCount;
+ QVariantList data;
+ data << mAddressCount << hasEmail;
+ emit contentsChanged(data);
+ }
+}
+
+bool MsgUnifiedEditorAddress::hasValidEmailAddress()
+{
+ bool result = false;
+ QStringList addressList = mAddressEdit->addresses();
+ QRegExp emailExp("\\S+@\\S+");
+ int i = addressList.indexOf(emailExp);//getting item index having @ symbol.
+
+ //check if index is valid.
+ if(i >= 0 )
+ {
+ result = true;
+ }
+
+ return result;
+}
+
Q_IMPLEMENT_USER_METATYPE(CntServicesContact)
Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(CntServicesContactList)