-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 7bc5bde..c4a7b10 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1005,52 +1005,52 @@ void ContactEditor::slotAddressTypeChange( int index ) { | |||
1005 | 1005 | ||
1006 | } else { | 1006 | } else { |
1007 | 1007 | ||
1008 | txtAddress->setText( slHomeAddress[0] ); | 1008 | txtAddress->setText( slHomeAddress[0] ); |
1009 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1009 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
1010 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1010 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
1011 | txtCity->setText( slHomeAddress[3] ); | 1011 | txtCity->setText( slHomeAddress[3] ); |
1012 | txtState->setText( slHomeAddress[4] ); | 1012 | txtState->setText( slHomeAddress[4] ); |
1013 | txtZip->setText( slHomeAddress[5] ); | 1013 | txtZip->setText( slHomeAddress[5] ); |
1014 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1014 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1015 | txtTmp->setText( slHomeAddress[6] ); | 1015 | txtTmp->setText( slHomeAddress[6] ); |
1016 | 1016 | ||
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1021 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
1022 | 1022 | ||
1023 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); | 1023 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); |
1024 | 1024 | ||
1025 | int index = cmbFileAs->currentItem(); | 1025 | int index = cmbFileAs->currentItem(); |
1026 | 1026 | ||
1027 | cmbFileAs->clear(); | 1027 | cmbFileAs->clear(); |
1028 | 1028 | ||
1029 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | ||
1030 | cmbFileAs->insertItem( parseName( textChanged, NAME_FMLS ) ); | ||
1031 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); | 1029 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); |
1032 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); | 1030 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); |
1031 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | ||
1032 | cmbFileAs->insertItem( parseName( textChanged, NAME_FMLS ) ); | ||
1033 | 1033 | ||
1034 | cmbFileAs->setCurrentItem( index ); | 1034 | cmbFileAs->setCurrentItem( index ); |
1035 | 1035 | ||
1036 | useFullName = true; | 1036 | useFullName = true; |
1037 | 1037 | ||
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | void ContactEditor::accept() { | 1040 | void ContactEditor::accept() { |
1041 | 1041 | ||
1042 | if ( isEmpty() ) { | 1042 | if ( isEmpty() ) { |
1043 | cleanupFields(); | 1043 | cleanupFields(); |
1044 | reject(); | 1044 | reject(); |
1045 | } else { | 1045 | } else { |
1046 | saveEntry(); | 1046 | saveEntry(); |
1047 | cleanupFields(); | 1047 | cleanupFields(); |
1048 | QDialog::accept(); | 1048 | QDialog::accept(); |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | void ContactEditor::slotNote() { | 1053 | void ContactEditor::slotNote() { |
1054 | 1054 | ||
1055 | dlgNote->showMaximized(); | 1055 | dlgNote->showMaximized(); |
1056 | if ( !dlgNote->exec() ) { | 1056 | if ( !dlgNote->exec() ) { |
@@ -1131,51 +1131,54 @@ QString ContactEditor::parseName( const QString fullName, int type ) { | |||
1131 | 1131 | ||
1132 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); | 1132 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); |
1133 | QStringList::Iterator it = allFirstNames.begin(); | 1133 | QStringList::Iterator it = allFirstNames.begin(); |
1134 | strFirstName = *it++; | 1134 | strFirstName = *it++; |
1135 | QStringList allSecondNames; | 1135 | QStringList allSecondNames; |
1136 | for ( ; it != allFirstNames.end(); ++it ) | 1136 | for ( ; it != allFirstNames.end(); ++it ) |
1137 | allSecondNames.append( *it ); | 1137 | allSecondNames.append( *it ); |
1138 | 1138 | ||
1139 | strMiddleName = allSecondNames.join(" "); | 1139 | strMiddleName = allSecondNames.join(" "); |
1140 | 1140 | ||
1141 | } else { | 1141 | } else { |
1142 | 1142 | ||
1143 | // No comma separator used: We use the first word as firstname, the | 1143 | // No comma separator used: We use the first word as firstname, the |
1144 | // last as second/lastname and everything in the middle as middlename | 1144 | // last as second/lastname and everything in the middle as middlename |
1145 | 1145 | ||
1146 | QStringList allNames = QStringList::split(" ", simplifiedName); | 1146 | QStringList allNames = QStringList::split(" ", simplifiedName); |
1147 | QStringList::Iterator it = allNames.begin(); | 1147 | QStringList::Iterator it = allNames.begin(); |
1148 | strFirstName = *it++; | 1148 | strFirstName = *it++; |
1149 | QStringList allSecondNames; | 1149 | QStringList allSecondNames; |
1150 | for ( ; it != --allNames.end(); ++it ) | 1150 | for ( ; it != --allNames.end(); ++it ) |
1151 | allSecondNames.append( *it ); | 1151 | allSecondNames.append( *it ); |
1152 | 1152 | ||
1153 | strMiddleName = allSecondNames.join(" "); | 1153 | strMiddleName = allSecondNames.join(" "); |
1154 | strLastName = *(--allNames.end()); | 1154 | strLastName = *(--allNames.end()); |
1155 | 1155 | ||
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | if ( strFirstName == strLastName ) | ||
1159 | strFirstName = ""; | ||
1160 | |||
1158 | qWarning(" strFirstName: %s", strFirstName.latin1()); | 1161 | qWarning(" strFirstName: %s", strFirstName.latin1()); |
1159 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); | 1162 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); |
1160 | qWarning(" strLastName: %s", strLastName.latin1()); | 1163 | qWarning(" strLastName: %s", strLastName.latin1()); |
1161 | qWarning(" strSuffix: %s", strSuffix.latin1()); | 1164 | qWarning(" strSuffix: %s", strSuffix.latin1()); |
1162 | qWarning(" strTitle: %s", strTitle.latin1()); | 1165 | qWarning(" strTitle: %s", strTitle.latin1()); |
1163 | 1166 | ||
1164 | switch (type) { | 1167 | switch (type) { |
1165 | case NAME_FL: | 1168 | case NAME_FL: |
1166 | return strFirstName + " " + strLastName; | 1169 | return strFirstName + " " + strLastName; |
1167 | 1170 | ||
1168 | case NAME_LF: | 1171 | case NAME_LF: |
1169 | return strLastName + ", " + strFirstName; | 1172 | return strLastName + ", " + strFirstName; |
1170 | 1173 | ||
1171 | case NAME_LFM: | 1174 | case NAME_LFM: |
1172 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1175 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1173 | 1176 | ||
1174 | case NAME_FMLS: | 1177 | case NAME_FMLS: |
1175 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; | 1178 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; |
1176 | 1179 | ||
1177 | case NAME_F: | 1180 | case NAME_F: |
1178 | return strFirstName; | 1181 | return strFirstName; |
1179 | 1182 | ||
1180 | case NAME_M: | 1183 | case NAME_M: |
1181 | return strMiddleName; | 1184 | return strMiddleName; |