-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 15 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 1 |
2 files changed, 11 insertions, 5 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index c4a7b10..75dd2c1 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -642,12 +642,14 @@ void ContactEditor::init() { cmbChooserField3->setCurrentItem( 2 ); connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); + connect( txtSuffix, SIGNAL(textChanged(const QString &)), this, SLOT(slotSuffixChange(const QString &)) ); + connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) ); connect( txtChooserField2, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser2Change(const QString &)) ); connect( txtChooserField3, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser3Change(const QString &)) ); @@ -1034,12 +1036,17 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) { cmbFileAs->setCurrentItem( index ); useFullName = true; } +void ContactEditor::slotSuffixChange( const QString& ) { + // Just want to update the FileAs combo if the suffix was changed.. + slotFullNameChange( txtFullName->text() ); +} + void ContactEditor::accept() { if ( isEmpty() ) { cleanupFields(); reject(); } else { @@ -1067,13 +1074,13 @@ void ContactEditor::slotName() { txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); } dlgName->showMaximized(); if ( dlgName->exec() ) { - tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); + tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); txtFullName->setText( tmpName.simplifyWhiteSpace() ); slotFullNameChange( txtFullName->text() ); useFullName = false; } } @@ -1103,13 +1110,12 @@ bool ContactEditor::isEmpty() { QString ContactEditor::parseName( const QString fullName, int type ) { QString simplifiedName( fullName.simplifyWhiteSpace() ); QString strFirstName; QString strMiddleName; QString strLastName; - QString strSuffix; QString strTitle; int commapos; bool haveLastName = false; qWarning("Fullname: %s", simplifiedName.latin1()); @@ -1158,13 +1164,12 @@ QString ContactEditor::parseName( const QString fullName, int type ) { if ( strFirstName == strLastName ) strFirstName = ""; qWarning(" strFirstName: %s", strFirstName.latin1()); qWarning(" strMiddleName: %s", strMiddleName.latin1()); qWarning(" strLastName: %s", strLastName.latin1()); - qWarning(" strSuffix: %s", strSuffix.latin1()); qWarning(" strTitle: %s", strTitle.latin1()); switch (type) { case NAME_FL: return strFirstName + " " + strLastName; @@ -1172,25 +1177,25 @@ QString ContactEditor::parseName( const QString fullName, int type ) { return strLastName + ", " + strFirstName; case NAME_LFM: return strLastName + ", " + strFirstName + " " + strMiddleName; case NAME_FMLS: - return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; + return strFirstName + " " + strMiddleName + " " + strLastName + " " + txtSuffix->text(); case NAME_F: return strFirstName; case NAME_M: return strMiddleName; case NAME_L: return strLastName; case NAME_S: - return strSuffix; + return txtSuffix->text(); } return QString::null; } void ContactEditor::cleanupFields() { diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index 703e702..954c77e 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h @@ -97,12 +97,13 @@ class ContactEditor : public QDialog { void slotPOBoxChange( const QString &textChanged ); void slotCityChange( const QString &textChanged ); void slotStateChange( const QString &textChanged ); void slotZipChange( const QString &textChanged ); void slotCountryChange( const QString &textChanged ); void slotFullNameChange( const QString &textChanged ); + void slotSuffixChange( const QString &textChanged ); void slotAnniversaryDateChanged( int year, int month, int day); void slotBirthdayDateChanged( int year, int month, int day); void slotRemoveBirthday(); void slotRemoveAnniversary(); void defaultEmailChanged(int); |