summaryrefslogtreecommitdiff
authoreilers <eilers>2003-03-05 09:27:33 (UTC)
committer eilers <eilers>2003-03-05 09:27:33 (UTC)
commita1b76d948b7d45e8813181396ed83c002587feb9 (patch) (side-by-side diff)
tree95e4da6aa2c6b6b3b8d8d834dcff76e1fb42b42e
parentcaad9c7b3e7fc0c9046993f6a152cd37f91fdceb (diff)
downloadopie-a1b76d948b7d45e8813181396ed83c002587feb9.zip
opie-a1b76d948b7d45e8813181396ed83c002587feb9.tar.gz
opie-a1b76d948b7d45e8813181396ed83c002587feb9.tar.bz2
Bugfix: Fullname Dialogbox had problems with lastnames out of multiple words
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp62
-rw-r--r--core/pim/addressbook/contacteditor.h8
2 files changed, 29 insertions, 41 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 75dd2c1..7682399 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -91,4 +91,2 @@ void ContactEditor::init() {
- useFullName = true;
-
uint i = 0;
@@ -1033,3 +1031,5 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) {
cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) );
- cmbFileAs->insertItem( parseName( textChanged, NAME_FMLS ) );
+ cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) );
+ if ( ! txtSuffix->text().isEmpty() )
+ cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() );
@@ -1037,3 +1037,2 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) {
- useFullName = true;
@@ -1070,15 +1069,17 @@ void ContactEditor::slotName() {
QString tmpName;
- if (useFullName) {
- txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
- txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
- txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
- // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
- }
+
+ txtFirstName->setText( parseName(txtFullName->text(), NAME_F) );
+ txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) );
+ txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
+ // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
+
dlgName->showMaximized();
if ( dlgName->exec() ) {
+ if ( txtLastName->text().contains( ' ', TRUE ) )
+ tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text();
+ else
+ tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text();
- tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text();
txtFullName->setText( tmpName.simplifyWhiteSpace() );
slotFullNameChange( txtFullName->text() );
- useFullName = false;
}
@@ -1181,4 +1182,4 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
- case NAME_FMLS:
- return strFirstName + " " + strMiddleName + " " + strLastName + " " + txtSuffix->text();
+ case NAME_FML:
+ return strFirstName + " " + strMiddleName + " " + strLastName ;
@@ -1252,3 +1253,2 @@ void ContactEditor::setEntry( const OContact &entry ) {
- useFullName = false;
txtFirstName->setText( ent.firstName() );
@@ -1263,7 +1263,9 @@ void ContactEditor::setEntry( const OContact &entry ) {
- // Lastnames with multiple words need to be protected by a comma !
- if ( ent.lastName().contains( ' ', TRUE ) )
- txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() );
- else
- txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() );
+ if ( !ent.isEmpty() ){
+ // Lastnames with multiple words need to be protected by a comma !
+ if ( ent.lastName().contains( ' ', TRUE ) )
+ txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() );
+ else
+ txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() );
+ }
@@ -1427,10 +1429,2 @@ void ContactEditor::setEntry( const OContact &entry ) {
- // Calling "show()" to arrange all widgets. Otherwise we will get
- // a wrong position of the textfields and are unable to put our
- // default-email combo over it.. This is very ugly !
- // Does anybody has a better solution ?
- // Basically we should rethink the strategy to hide
- // a textfield with overwriting.. (se)
- show();
-
// Get combo-settings from contact and set preset..
@@ -1474,10 +1468,6 @@ void ContactEditor::saveEntry() {
- if ( useFullName ) {
- txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
- txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
- txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
- // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
-
- useFullName = false;
- }
+ txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) );
+ txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) );
+ txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
+ // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h
index 954c77e..c6fa48f 100644
--- a/core/pim/addressbook/contacteditor.h
+++ b/core/pim/addressbook/contacteditor.h
@@ -35,6 +35,6 @@
-const int NAME_LF = 0;
+const int NAME_LF = 0;
const int NAME_LFM = 1;
-const int NAME_FL = 2;
-const int NAME_FMLS = 3;
+const int NAME_FL = 2;
+const int NAME_FML = 3;
@@ -117,4 +117,2 @@ class ContactEditor : public QDialog {
- bool useFullName;
-
OContact ent;