Git commit 3846fa0325235e1285bf54a349e07b272e3ab4ca by Jan Kundr?t. Committed on 24/05/2013 at 00:03. Pushed by jkt into branch 'master'.
GUI: validate each address separately and also when filled in programatically Previously, the validation was performed based on the contents of all items. This meant that after a single field contained invalid data, any subsequent modification to any other field would render the newly modified field in red. That's wrong, the validation shall be based exclusively on data from the modified field. This patch also triggers the validator when setting the data programatically. CCMAIL: sreepriya1111 at gmail.com M +8 -3 src/Gui/ComposeWidget.cpp M +1 -0 src/Gui/ComposeWidget.h http://commits.kde.org/trojita/3846fa0325235e1285bf54a349e07b272e3ab4ca diff --git a/src/Gui/ComposeWidget.cpp b/src/Gui/ComposeWidget.cpp index 7ef7e7a..1a3016a 100644 --- a/src/Gui/ComposeWidget.cpp +++ b/src/Gui/ComposeWidget.cpp @@ -419,6 +419,7 @@ void ComposeWidget::addRecipient(int position, Composer::RecipientKind kind, con combo->addItem(tr("Bcc"), Composer::ADDRESS_BCC); combo->setCurrentIndex(combo->findData(kind)); LineEdit *edit = new LineEdit(address, this); + slotCheckAddress(edit); connect(edit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckAddress())); connect(edit, SIGNAL(textEdited(QString)), SLOT(completeRecipients(QString))); connect(edit, SIGNAL(editingFinished()), SLOT(collapseRecipients())); @@ -433,9 +434,13 @@ void ComposeWidget::slotCheckAddress() { LineEdit *edit = qobject_cast<LineEdit*>(sender()); Q_ASSERT(edit); - QString errorMessage; - QList<QPair<Composer::RecipientKind,Imap::Message::MailAddress> > recipients; - if (edit->text().isEmpty() || parseRecipients(recipients, errorMessage)) { + slotCheckAddress(edit); +} + +void ComposeWidget::slotCheckAddress(QLineEdit *edit) +{ + Imap::Message::MailAddress addr; + if (edit->text().isEmpty() || Imap::Message::MailAddress::fromPrettyString(addr, edit->text())) { edit->setPalette(QPalette()); } else { QPalette p; diff --git a/src/Gui/ComposeWidget.h b/src/Gui/ComposeWidget.h index 33b6d4c..999b729 100644 --- a/src/Gui/ComposeWidget.h +++ b/src/Gui/ComposeWidget.h @@ -90,6 +90,7 @@ private slots: void updateRecipientList(); void slotCheckAddress(); + void slotCheckAddress(QLineEdit *edit); void slotAskForFileAttachment(); void slotRemoveAttachment();
