equal
deleted
inserted
replaced
61 QGraphicsItem *parent ) : |
61 QGraphicsItem *parent ) : |
62 MsgUnifiedEditorBaseWidget(parent), |
62 MsgUnifiedEditorBaseWidget(parent), |
63 mSkipMaxRecipientQuery(false), |
63 mSkipMaxRecipientQuery(false), |
64 mAboutToExceedMaxSmsRecipients(false), |
64 mAboutToExceedMaxSmsRecipients(false), |
65 mAboutToExceedMaxMmsRecipients(false), |
65 mAboutToExceedMaxMmsRecipients(false), |
66 mExceedsMaxMmsRecipientsBy(0) |
66 mExceedsMaxMmsRecipientsBy(0), |
|
67 mAddressCount(0) |
67 { |
68 { |
68 this->setContentsMargins(0,0,0,0); |
69 this->setContentsMargins(0,0,0,0); |
69 |
70 |
70 mLaunchBtn = new HbPushButton(this); |
71 mLaunchBtn = new HbPushButton(this); |
71 HbStyle::setItemName(mLaunchBtn,"launchBtn"); |
72 HbStyle::setItemName(mLaunchBtn,"launchBtn"); |
73 |
74 |
74 mLaunchBtn->setIcon(HbIcon(PBK_ICON)); |
75 mLaunchBtn->setIcon(HbIcon(PBK_ICON)); |
75 |
76 |
76 mAddressEdit = new MsgUnifiedEditorLineEdit(label,this); |
77 mAddressEdit = new MsgUnifiedEditorLineEdit(label,this); |
77 HbStyle::setItemName(mAddressEdit,"addressField"); |
78 HbStyle::setItemName(mAddressEdit,"addressField"); |
78 |
|
79 mAddressEdit->setMaxRows(40); |
|
80 connect(mAddressEdit, SIGNAL(contentsChanged(const QString&)), |
79 connect(mAddressEdit, SIGNAL(contentsChanged(const QString&)), |
81 this, SLOT(onContentsChanged(const QString&))); |
80 this, SLOT(onContentsChanged(const QString&))); |
82 |
81 |
83 mAddressEdit->setInputMethodHints(Qt::ImhPreferNumbers); |
82 mAddressEdit->setInputMethodHints(Qt::ImhPreferNumbers); |
84 |
83 |
87 editorInterface.setInputConstraints(HbEditorConstraintLatinAlphabetOnly); |
86 editorInterface.setInputConstraints(HbEditorConstraintLatinAlphabetOnly); |
88 } |
87 } |
89 |
88 |
90 MsgUnifiedEditorAddress::~MsgUnifiedEditorAddress() |
89 MsgUnifiedEditorAddress::~MsgUnifiedEditorAddress() |
91 { |
90 { |
92 //TODO: Should remove this code depending on orbit's reply whether it is needed |
|
93 //to unregister the same plugin registered on two different widgets twice. |
|
94 //style()->unregisterPlugin(mPluginPath); |
|
95 } |
91 } |
96 |
92 |
97 void MsgUnifiedEditorAddress::fetchContacts() |
93 void MsgUnifiedEditorAddress::fetchContacts() |
98 { |
94 { |
99 mLaunchBtn->blockSignals(true); |
95 mLaunchBtn->blockSignals(true); |
328 return matchDigitCount; |
324 return matchDigitCount; |
329 } |
325 } |
330 |
326 |
331 void MsgUnifiedEditorAddress::onContentsChanged(const QString& text) |
327 void MsgUnifiedEditorAddress::onContentsChanged(const QString& text) |
332 { |
328 { |
|
329 |
|
330 emitContentsChanged(); |
|
331 |
333 // Max MMS recipient count check |
332 // Max MMS recipient count check |
334 if( mAboutToExceedMaxMmsRecipients || |
333 if( mAboutToExceedMaxMmsRecipients || |
335 (MsgUnifiedEditorMonitor::msgAddressCount() >= MsgUnifiedEditorMonitor::maxMmsRecipients()) ) |
334 (MsgUnifiedEditorMonitor::msgAddressCount() >= MsgUnifiedEditorMonitor::maxMmsRecipients()) ) |
336 { |
335 { |
337 if(mAboutToExceedMaxMmsRecipients) |
336 if(mAboutToExceedMaxMmsRecipients) |
343 } |
342 } |
344 resetToPrevious(); |
343 resetToPrevious(); |
345 } |
344 } |
346 else |
345 else |
347 { |
346 { |
348 // update monitor data |
|
349 emit contentChanged(); |
|
350 if(MsgUnifiedEditorMonitor::msgAddressCount() > MsgUnifiedEditorMonitor::maxMmsRecipients()) |
347 if(MsgUnifiedEditorMonitor::msgAddressCount() > MsgUnifiedEditorMonitor::maxMmsRecipients()) |
351 { |
348 { |
352 HbMessageBox::information(LOC_MMS_RECIPIENT_LIMIT_REACHED, 0, 0, HbMessageBox::Ok); |
349 HbMessageBox::information(LOC_MMS_RECIPIENT_LIMIT_REACHED, 0, 0, HbMessageBox::Ok); |
353 resetToPrevious(); |
350 resetToPrevious(); |
354 // reset monitor data |
|
355 emit contentChanged(); |
|
356 } |
351 } |
357 else |
352 else |
358 { |
353 { |
359 mPrevBuffer = text; |
354 mPrevBuffer = text; |
360 } |
355 } |
361 } |
356 } |
|
357 |
|
358 emitContentsChanged(); |
362 return; |
359 return; |
363 } |
360 } |
364 |
361 |
365 // Max SMS recipient count check |
362 // Max SMS recipient count check |
366 if( !mSkipMaxRecipientQuery && |
363 if( !mSkipMaxRecipientQuery && |
377 { |
374 { |
378 if(!mAboutToExceedMaxSmsRecipients) |
375 if(!mAboutToExceedMaxSmsRecipients) |
379 {// remember addresses before the block insertion started |
376 {// remember addresses before the block insertion started |
380 mPrevBuffer = text; |
377 mPrevBuffer = text; |
381 } |
378 } |
382 emit contentChanged(); |
379 } |
383 } |
380 emitContentsChanged(); |
384 } |
381 } |
385 |
382 |
386 void MsgUnifiedEditorAddress::handleRecipientLimitReached() |
383 void MsgUnifiedEditorAddress::handleRecipientLimitReached() |
387 { |
384 { |
388 HbMessageBox* dlg = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
385 HbMessageBox* dlg = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
527 // ---------------------------------------------------------------------------- |
524 // ---------------------------------------------------------------------------- |
528 void MsgUnifiedEditorAddress::onMaxRecipientsReached(HbAction* action) |
525 void MsgUnifiedEditorAddress::onMaxRecipientsReached(HbAction* action) |
529 { |
526 { |
530 HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender()); |
527 HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender()); |
531 if (action == dlg->actions().at(0)) { |
528 if (action == dlg->actions().at(0)) { |
532 // accept new content, update prev-buffer |
|
533 emit contentChanged(); |
|
534 mPrevBuffer = mAddressEdit->content(); |
529 mPrevBuffer = mAddressEdit->content(); |
535 } |
530 } |
536 else { |
531 else { |
537 // reject the new content, keep the old |
532 // reject the new content, keep the old |
538 resetToPrevious(); |
533 resetToPrevious(); |
539 } |
534 } |
|
535 |
|
536 emitContentsChanged(); |
|
537 |
540 } |
538 } |
541 |
539 |
542 // ---------------------------------------------------------------------------- |
540 // ---------------------------------------------------------------------------- |
543 // MsgUnifiedEditorAddress::validateContacts |
541 // MsgUnifiedEditorAddress::validateContacts |
544 // @see header |
542 // @see header |
591 void MsgUnifiedEditorAddress::unblockSignals() |
589 void MsgUnifiedEditorAddress::unblockSignals() |
592 { |
590 { |
593 mLaunchBtn->blockSignals(false); |
591 mLaunchBtn->blockSignals(false); |
594 } |
592 } |
595 |
593 |
|
594 void MsgUnifiedEditorAddress::emitContentsChanged() |
|
595 { |
|
596 int currentAddressCount = addressCount(); |
|
597 bool hasEmail = hasValidEmailAddress(); |
|
598 |
|
599 if(mAddressCount != currentAddressCount || hasEmail) |
|
600 { |
|
601 mAddressCount = currentAddressCount; |
|
602 QVariantList data; |
|
603 data << mAddressCount << hasEmail; |
|
604 emit contentsChanged(data); |
|
605 } |
|
606 } |
|
607 |
|
608 bool MsgUnifiedEditorAddress::hasValidEmailAddress() |
|
609 { |
|
610 bool result = false; |
|
611 QStringList addressList = mAddressEdit->addresses(); |
|
612 QRegExp emailExp("\\S+@\\S+"); |
|
613 int i = addressList.indexOf(emailExp);//getting item index having @ symbol. |
|
614 |
|
615 //check if index is valid. |
|
616 if(i >= 0 ) |
|
617 { |
|
618 result = true; |
|
619 } |
|
620 |
|
621 return result; |
|
622 } |
|
623 |
596 Q_IMPLEMENT_USER_METATYPE(CntServicesContact) |
624 Q_IMPLEMENT_USER_METATYPE(CntServicesContact) |
597 Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(CntServicesContactList) |
625 Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(CntServicesContactList) |
598 |
626 |
599 //EOF |
627 //EOF |