summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/contacteditor.cpp
authoreilers <eilers>2003-03-04 17:23:03 (UTC)
committer eilers <eilers>2003-03-04 17:23:03 (UTC)
commitcaad9c7b3e7fc0c9046993f6a152cd37f91fdceb (patch) (unidiff)
tree189006e4f369cf6a373fd20f277966ff42117b5b /core/pim/addressbook/contacteditor.cpp
parent55e5d2c95f70d296c541e4f2564713a593c3851c (diff)
downloadopie-caad9c7b3e7fc0c9046993f6a152cd37f91fdceb.zip
opie-caad9c7b3e7fc0c9046993f6a152cd37f91fdceb.tar.gz
opie-caad9c7b3e7fc0c9046993f6a152cd37f91fdceb.tar.bz2
Fixing suffix handling
Diffstat (limited to 'core/pim/addressbook/contacteditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp15
1 files changed, 10 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() {
642 cmbChooserField3->setCurrentItem( 2 ); 642 cmbChooserField3->setCurrentItem( 2 );
643 643
644 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 644 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
645 645
646 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 646 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
647 647
648 connect( txtSuffix, SIGNAL(textChanged(const QString &)), this, SLOT(slotSuffixChange(const QString &)) );
649
648 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), 650 connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
649 this, SLOT(slotChooser1Change(const QString &)) ); 651 this, SLOT(slotChooser1Change(const QString &)) );
650 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), 652 connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
651 this, SLOT(slotChooser2Change(const QString &)) ); 653 this, SLOT(slotChooser2Change(const QString &)) );
652 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), 654 connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
653 this, SLOT(slotChooser3Change(const QString &)) ); 655 this, SLOT(slotChooser3Change(const QString &)) );
@@ -1034,12 +1036,17 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) {
1034 cmbFileAs->setCurrentItem( index ); 1036 cmbFileAs->setCurrentItem( index );
1035 1037
1036 useFullName = true; 1038 useFullName = true;
1037 1039
1038} 1040}
1039 1041
1042void ContactEditor::slotSuffixChange( const QString& ) {
1043 // Just want to update the FileAs combo if the suffix was changed..
1044 slotFullNameChange( txtFullName->text() );
1045}
1046
1040void ContactEditor::accept() { 1047void ContactEditor::accept() {
1041 1048
1042 if ( isEmpty() ) { 1049 if ( isEmpty() ) {
1043 cleanupFields(); 1050 cleanupFields();
1044 reject(); 1051 reject();
1045 } else { 1052 } else {
@@ -1067,13 +1074,13 @@ void ContactEditor::slotName() {
1067 txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); 1074 txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
1068 // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); 1075 // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
1069 } 1076 }
1070 dlgName->showMaximized(); 1077 dlgName->showMaximized();
1071 if ( dlgName->exec() ) { 1078 if ( dlgName->exec() ) {
1072 1079
1073 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); 1080 tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text();
1074 txtFullName->setText( tmpName.simplifyWhiteSpace() ); 1081 txtFullName->setText( tmpName.simplifyWhiteSpace() );
1075 slotFullNameChange( txtFullName->text() ); 1082 slotFullNameChange( txtFullName->text() );
1076 useFullName = false; 1083 useFullName = false;
1077 } 1084 }
1078 1085
1079} 1086}
@@ -1103,13 +1110,12 @@ bool ContactEditor::isEmpty() {
1103QString ContactEditor::parseName( const QString fullName, int type ) { 1110QString ContactEditor::parseName( const QString fullName, int type ) {
1104 1111
1105 QString simplifiedName( fullName.simplifyWhiteSpace() ); 1112 QString simplifiedName( fullName.simplifyWhiteSpace() );
1106 QString strFirstName; 1113 QString strFirstName;
1107 QString strMiddleName; 1114 QString strMiddleName;
1108 QString strLastName; 1115 QString strLastName;
1109 QString strSuffix;
1110 QString strTitle; 1116 QString strTitle;
1111 int commapos; 1117 int commapos;
1112 bool haveLastName = false; 1118 bool haveLastName = false;
1113 1119
1114 qWarning("Fullname: %s", simplifiedName.latin1()); 1120 qWarning("Fullname: %s", simplifiedName.latin1());
1115 1121
@@ -1158,13 +1164,12 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
1158 if ( strFirstName == strLastName ) 1164 if ( strFirstName == strLastName )
1159 strFirstName = ""; 1165 strFirstName = "";
1160 1166
1161 qWarning(" strFirstName: %s", strFirstName.latin1()); 1167 qWarning(" strFirstName: %s", strFirstName.latin1());
1162 qWarning(" strMiddleName: %s", strMiddleName.latin1()); 1168 qWarning(" strMiddleName: %s", strMiddleName.latin1());
1163 qWarning(" strLastName: %s", strLastName.latin1()); 1169 qWarning(" strLastName: %s", strLastName.latin1());
1164 qWarning(" strSuffix: %s", strSuffix.latin1());
1165 qWarning(" strTitle: %s", strTitle.latin1()); 1170 qWarning(" strTitle: %s", strTitle.latin1());
1166 1171
1167 switch (type) { 1172 switch (type) {
1168 case NAME_FL: 1173 case NAME_FL:
1169 return strFirstName + " " + strLastName; 1174 return strFirstName + " " + strLastName;
1170 1175
@@ -1172,25 +1177,25 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
1172 return strLastName + ", " + strFirstName; 1177 return strLastName + ", " + strFirstName;
1173 1178
1174 case NAME_LFM: 1179 case NAME_LFM:
1175 return strLastName + ", " + strFirstName + " " + strMiddleName; 1180 return strLastName + ", " + strFirstName + " " + strMiddleName;
1176 1181
1177 case NAME_FMLS: 1182 case NAME_FMLS:
1178 return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; 1183 return strFirstName + " " + strMiddleName + " " + strLastName + " " + txtSuffix->text();
1179 1184
1180 case NAME_F: 1185 case NAME_F:
1181 return strFirstName; 1186 return strFirstName;
1182 1187
1183 case NAME_M: 1188 case NAME_M:
1184 return strMiddleName; 1189 return strMiddleName;
1185 1190
1186 case NAME_L: 1191 case NAME_L:
1187 return strLastName; 1192 return strLastName;
1188 1193
1189 case NAME_S: 1194 case NAME_S:
1190 return strSuffix; 1195 return txtSuffix->text();
1191 1196
1192 } 1197 }
1193 return QString::null; 1198 return QString::null;
1194} 1199}
1195 1200
1196void ContactEditor::cleanupFields() { 1201void ContactEditor::cleanupFields() {