summaryrefslogtreecommitdiff
authoreilers <eilers>2003-03-04 16:31:18 (UTC)
committer eilers <eilers>2003-03-04 16:31:18 (UTC)
commit628a783e5d7ec07b5c073c94a77b614439d937ba (patch) (side-by-side diff)
tree30e64e15b94051b185b4c4eecb849e3767d7610b
parent8642232f4435bc5341037527d1eb12d1f39781f4 (diff)
downloadopie-628a783e5d7ec07b5c073c94a77b614439d937ba.zip
opie-628a783e5d7ec07b5c073c94a77b614439d937ba.tar.gz
opie-628a783e5d7ec07b5c073c94a77b614439d937ba.tar.bz2
Name parser completely rewritten ! It is now possible to have as much middle
names as your parents payed for ;) If you have a lastname which was build out of words like "Klara Anne Marie Freifrau von Lichtenstein" or "Carlos Marcos del los Rios" you have to use a "," to separate between first andd last names like this: "del los Rios, Carlos Marcos" or "Freifrau von Lichtenstein, Klara Anne Marie"..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/TODO2
-rw-r--r--core/pim/addressbook/contacteditor.cpp803
-rw-r--r--core/pim/addressbook/version.h4
3 files changed, 363 insertions, 446 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO
index a0d50a3..106747e 100644
--- a/core/pim/addressbook/TODO
+++ b/core/pim/addressbook/TODO
@@ -31,3 +31,2 @@ Urgent:
-- Fix handling of 3 Firstnames
@@ -116 +115,2 @@ Fixed/Ready:
- Default Email-Button: Sometimes not hiding the textfields completely
+- Fix handling of 3 Firstnames
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index d1338f6..7bc5bde 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -159,6 +159,11 @@ void ContactEditor::init() {
- l = new QLabel( tr( "Organization" ), container );
+ l = new QLabel( tr("Suffix"), container );
gl->addWidget( l, 2, 0 );
+ txtSuffix = new QLineEdit( container );
+ gl->addWidget( txtSuffix, 2, 1 );
+
+ l = new QLabel( tr( "Organization" ), container );
+ gl->addWidget( l, 3, 0 );
txtOrganization = new QLineEdit( container );
- gl->addWidget( txtOrganization, 2, 1 );
+ gl->addWidget( txtOrganization, 3, 1 );
@@ -167,3 +172,3 @@ void ContactEditor::init() {
cmbChooserField1->setMaximumWidth( 90 );
- gl->addWidget( cmbChooserField1, 3, 0 );
+ gl->addWidget( cmbChooserField1, 4, 0 );
// Textfield for chooser 1.
@@ -173,3 +178,3 @@ void ContactEditor::init() {
m_widgetStack1 -> addWidget( txtChooserField1, TextField );
- gl->addWidget( m_widgetStack1, 3, 1 );
+ gl->addWidget( m_widgetStack1, 4, 1 );
m_widgetStack1 -> raiseWidget( TextField );
@@ -179,3 +184,3 @@ void ContactEditor::init() {
cmbChooserField2->setMaximumWidth( 90 );
- gl->addWidget( cmbChooserField2, 4, 0 );
+ gl->addWidget( cmbChooserField2, 5, 0 );
// Textfield for chooser 2
@@ -185,3 +190,3 @@ void ContactEditor::init() {
m_widgetStack2 -> addWidget( txtChooserField2, TextField );
- gl->addWidget( m_widgetStack2, 4, 1 );
+ gl->addWidget( m_widgetStack2, 5, 1 );
m_widgetStack2 -> raiseWidget( TextField );
@@ -191,3 +196,3 @@ void ContactEditor::init() {
cmbChooserField3->setMaximumWidth( 90 );
- gl->addWidget( cmbChooserField3, 5, 0 );
+ gl->addWidget( cmbChooserField3, 6, 0 );
// Textfield for chooser 2
@@ -197,3 +202,3 @@ void ContactEditor::init() {
m_widgetStack3 -> addWidget( txtChooserField3, TextField );
- gl->addWidget( m_widgetStack3, 5, 1 );
+ gl->addWidget( m_widgetStack3, 6, 1 );
m_widgetStack3 -> raiseWidget( TextField );
@@ -201,10 +206,10 @@ void ContactEditor::init() {
l = new QLabel( tr( "File As" ), container );
- gl->addWidget( l, 6, 0 );
+ gl->addWidget( l, 7, 0 );
cmbFileAs = new QComboBox( TRUE, container );
- gl->addWidget( cmbFileAs, 6, 1 );
+ gl->addWidget( cmbFileAs, 7, 1 );
labCat = new QLabel( tr( "Category" ), container );
- gl->addWidget( labCat, 7, 0 );
+ gl->addWidget( labCat, 8, 0 );
cmbCat = new CategorySelect( container );
- gl->addWidget( cmbCat, 7, 1 );
+ gl->addWidget( cmbCat, 8, 1 );
labCat->show();
@@ -213,3 +218,3 @@ void ContactEditor::init() {
btnNote = new QPushButton( tr( "Notes..." ), container );
- gl->addWidget( btnNote, 8, 1 );
+ gl->addWidget( btnNote, 9, 1 );
@@ -620,6 +625,6 @@ void ContactEditor::init() {
- l = new QLabel( tr("Suffix"), dlgName );
- gl->addWidget( l, 3, 0 );
- txtSuffix = new QLineEdit( dlgName );
- gl->addWidget( txtSuffix, 3, 1 );
+// l = new QLabel( tr("Suffix"), dlgName );
+// gl->addWidget( l, 3, 0 );
+// txtSuffix = new QLineEdit( dlgName );
+// gl->addWidget( txtSuffix, 3, 1 );
space = new QSpacerItem(1,1,
@@ -1017,2 +1022,4 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) {
+ qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() );
+
int index = cmbFileAs->currentItem();
@@ -1021,6 +1028,6 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) {
- cmbFileAs->insertItem( parseName( textChanged, 0 ) );
- cmbFileAs->insertItem( parseName( textChanged, 1 ) );
- cmbFileAs->insertItem( parseName( textChanged, 2 ) );
- cmbFileAs->insertItem( parseName( textChanged, 3 ) );
+ cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) );
+ cmbFileAs->insertItem( parseName( textChanged, NAME_FMLS ) );
+ cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) );
+ cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) );
@@ -1060,3 +1067,3 @@ void ContactEditor::slotName() {
txtLastName->setText( parseName(txtFullName->text(), NAME_L) );
- txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
+ // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) );
}
@@ -1104,174 +1111,79 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
int commapos;
- int spCount;
- int spPos;
- int spPos2;
+ bool haveLastName = false;
+ qWarning("Fullname: %s", simplifiedName.latin1());
commapos = simplifiedName.find( ',', 0, TRUE);
- spCount = simplifiedName.contains( ' ', TRUE );
-
- if ( commapos == -1 ) {
-
- switch (spCount) {
- case 0:
- //return simplifiedName;
- if (txtLastName->text() != "") {
- strLastName = simplifiedName;
- break;
- }
- if (txtMiddleName->text() != "") {
- strMiddleName = simplifiedName;
- break;
- }
- if (txtSuffix->text() != "") {
- strSuffix = simplifiedName;
- break;
- }
- strFirstName = simplifiedName;
- break;
-
- case 1:
- spPos = simplifiedName.find( ' ', 0, TRUE );
- strFirstName = simplifiedName.left( spPos );
- strLastName = simplifiedName.mid( spPos + 1 );
- break;
-
- case 2:
- spPos = simplifiedName.find( ' ', 0, TRUE );
- strFirstName = simplifiedName.left( spPos );
- spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
- strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
- strLastName = simplifiedName.mid( spPos2 + 1 );
- break;
-
- case 3:
- spPos = simplifiedName.find( ' ', 0, TRUE );
- strFirstName = simplifiedName.left( spPos );
- spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
- strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
- spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
- strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
- strSuffix = simplifiedName.mid( spPos + 1 );
- break;
-
- case 4:
- spPos = simplifiedName.find( ' ', 0, TRUE );
- strTitle = simplifiedName.left( spPos );
- spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
- strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
- spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
- strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
- spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
- strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
- strSuffix = simplifiedName.mid( spPos2 + 1 );
- break;
-
- default:
- spPos = simplifiedName.find( ' ', 0, TRUE );
- strTitle = simplifiedName.left( spPos );
- spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
- strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
- spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
- strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
- spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
- strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
- strSuffix = simplifiedName.mid( spPos2 + 1 );
- break;
- }
- } else {
- simplifiedName.replace( commapos, 1, " " );
- simplifiedName = simplifiedName.simplifyWhiteSpace();
-
- switch (spCount) {
- case 0:
- //return simplifiedName;
- if (txtLastName->text() != "") {
- strLastName = simplifiedName;
- break;
- }
- if (txtMiddleName->text() != "") {
- strMiddleName = simplifiedName;
- break;
- }
- if (txtSuffix->text() != "") {
- strSuffix = simplifiedName;
- break;
- }
- strFirstName = simplifiedName;
- break;
-
- case 1:
- spPos = simplifiedName.find( ' ', 0, TRUE );
- strLastName = simplifiedName.left( spPos );
- strFirstName = simplifiedName.mid( spPos + 1 );
- break;
-
- case 2:
- spPos = simplifiedName.find( ' ', 0, TRUE );
- strLastName = simplifiedName.left( spPos );
- spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
- strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
- strMiddleName = simplifiedName.mid( spPos2 + 1 );
- break;
-
- case 3:
- spPos = simplifiedName.find( ' ', 0, TRUE );
- strLastName = simplifiedName.left( spPos );
- spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
- strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
- spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
- strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
- strSuffix = simplifiedName.mid( spPos + 1 );
- break;
-
- case 4:
- spPos = simplifiedName.find( ' ', 0, TRUE );
- strLastName = simplifiedName.left( spPos );
- spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
- strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
- spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
- strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos2 );
- spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
- strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
- strSuffix = simplifiedName.mid( spPos2 + 1 );
- break;
-
- default:
- spPos = simplifiedName.find( ' ', 0, TRUE );
- strLastName = simplifiedName.left( spPos );
- spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
- strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
- spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE );
- strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos );
- spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE );
- strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos );
- strSuffix = simplifiedName.mid( spPos2 + 1 );
- break;
- }
- }
- switch (type) {
- case NAME_FL:
- return strFirstName + " " + strLastName;
-
- case NAME_LF:
- return strLastName + ", " + strFirstName;
-
- case NAME_LFM:
- return strLastName + ", " + strFirstName + " " + strMiddleName;
+ if ( commapos >= 0 ) {
+ qWarning(" Commapos: %d", commapos );
+
+ // A comma (",") separates the lastname from one or
+ // many first names. Thus, remove the lastname from the
+ // String and parse the firstnames.
+
+ strLastName = simplifiedName.left( commapos );
+ simplifiedName= simplifiedName.mid( commapos + 1 );
+ haveLastName = true;
+ qWarning("Fullname without ',': %s", simplifiedName.latin1());
+
+ // If we have any lastname, we should now split all first names.
+ // The first one will be the used as first, the rest as "middle names"
+
+ QStringList allFirstNames = QStringList::split(" ", simplifiedName);
+ QStringList::Iterator it = allFirstNames.begin();
+ strFirstName = *it++;
+ QStringList allSecondNames;
+ for ( ; it != allFirstNames.end(); ++it )
+ allSecondNames.append( *it );
+
+ strMiddleName = allSecondNames.join(" ");
- case NAME_FMLS:
- return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix;
+ } else {
- case NAME_F:
- return strFirstName;
+ // No comma separator used: We use the first word as firstname, the
+ // last as second/lastname and everything in the middle as middlename
- case NAME_M:
- return strMiddleName;
+ QStringList allNames = QStringList::split(" ", simplifiedName);
+ QStringList::Iterator it = allNames.begin();
+ strFirstName = *it++;
+ QStringList allSecondNames;
+ for ( ; it != --allNames.end(); ++it )
+ allSecondNames.append( *it );
+
+ strMiddleName = allSecondNames.join(" ");
+ strLastName = *(--allNames.end());
- case NAME_L:
- return strLastName;
+ }
- case NAME_S:
- return strSuffix;
+ 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;
+
+ case NAME_LF:
+ return strLastName + ", " + strFirstName;
+
+ case NAME_LFM:
+ return strLastName + ", " + strFirstName + " " + strMiddleName;
+
+ case NAME_FMLS:
+ return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix;
+
+ case NAME_F:
+ return strFirstName;
+
+ case NAME_M:
+ return strMiddleName;
+
+ case NAME_L:
+ return strLastName;
+
+ case NAME_S:
+ return strSuffix;
+
}
@@ -1282,3 +1194,3 @@ void ContactEditor::cleanupFields() {
QStringList::Iterator it = slChooserValues.begin();
-
+
for ( int i = 0; it != slChooserValues.end(); i++, ++it ) {
@@ -1286,3 +1198,3 @@ void ContactEditor::cleanupFields() {
}
-
+
for ( int i = 0; i < 7; i++ ) {
@@ -1291,3 +1203,3 @@ void ContactEditor::cleanupFields() {
}
-
+
QListIterator<QLineEdit> itLV( listValue );
@@ -1316,3 +1228,3 @@ void ContactEditor::cleanupFields() {
txtTmp->setText("");
-
+
}
@@ -1320,9 +1232,9 @@ void ContactEditor::cleanupFields() {
void ContactEditor::setEntry( const OContact &entry ) {
-
+
initializing = true;
-
+
cleanupFields();
-
+
ent = entry;
-
+
emails = QStringList(ent.emailList());
@@ -1331,3 +1243,3 @@ void ContactEditor::setEntry( const OContact &entry ) {
qDebug("default email=%s",defaultEmail.latin1());
-
+
useFullName = false;
@@ -1337,45 +1249,50 @@ void ContactEditor::setEntry( const OContact &entry ) {
txtSuffix->setText( ent.suffix() );
-
- QString *tmpString = new QString;
- *tmpString = ent.firstName() + " " + ent.middleName() +
- + " " + ent.lastName() + " " + ent.suffix();
-
- txtFullName->setText( tmpString->simplifyWhiteSpace() );
-
+
+// QString *tmpString = new QString;
+// *tmpString = ent.firstName() + " " + ent.middleName() +
+// + " " + ent.lastName() + " " + ent.suffix();
+// txtFullName->setText( tmpString->simplifyWhiteSpace() );
+
+ // 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() );
+
cmbFileAs->setEditText( ent.fileAs() );
-
+
// if (hasTitle)
- txtJobTitle->setText( ent.jobTitle() );
-
- // if (hasCompany)
- txtOrganization->setText( ent.company() );
-
- // if (hasNotes)
- txtNote->setText( ent.notes() );
-
- // if (hasStreet) {
- slHomeAddress[0] = ent.homeStreet();
- slBusinessAddress[0] = ent.businessStreet();
- // }
-
-// if (hasCity) {
- slHomeAddress[3] = ent.homeCity();
- slBusinessAddress[3] = ent.businessCity();
-//}
-
-//if (hasState) {
- slHomeAddress[4] = ent.homeState();
- slBusinessAddress[4] = ent.businessState();
-//}
-
-//if (hasZip) {
- slHomeAddress[5] = ent.homeZip();
- slBusinessAddress[5] = ent.businessZip();
-//}
-
-//if (hasCountry) {
- slHomeAddress[6] = ent.homeCountry();
- slBusinessAddress[6] = ent.businessCountry();
-//}
-
+ txtJobTitle->setText( ent.jobTitle() );
+
+ // if (hasCompany)
+ txtOrganization->setText( ent.company() );
+
+ // if (hasNotes)
+ txtNote->setText( ent.notes() );
+
+ // if (hasStreet) {
+ slHomeAddress[0] = ent.homeStreet();
+ slBusinessAddress[0] = ent.businessStreet();
+ // }
+
+ // if (hasCity) {
+ slHomeAddress[3] = ent.homeCity();
+ slBusinessAddress[3] = ent.businessCity();
+ //}
+
+ //if (hasState) {
+ slHomeAddress[4] = ent.homeState();
+ slBusinessAddress[4] = ent.businessState();
+ //}
+
+ //if (hasZip) {
+ slHomeAddress[5] = ent.homeZip();
+ slBusinessAddress[5] = ent.businessZip();
+ //}
+
+ //if (hasCountry) {
+ slHomeAddress[6] = ent.homeCountry();
+ slBusinessAddress[6] = ent.businessCountry();
+ //}
+
QStringList::ConstIterator it;
@@ -1383,26 +1300,26 @@ void ContactEditor::setEntry( const OContact &entry ) {
for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) {
-
+
qWarning(" Filling dynamic Field: %s", (*it).latin1() );
-
+
if ( *it == "Department" )
(*itLE)->setText( ent.department() );
-
+
if ( *it == "Company" )
(*itLE)->setText( ent.company() );
-
+
if ( *it == "Office" )
(*itLE)->setText( ent.office() );
-
+
if ( *it == "Profession" )
(*itLE)->setText( ent.profession() );
-
+
if ( *it == "Assistant" )
(*itLE)->setText( ent.assistant() );
-
+
if ( *it == "Manager" )
(*itLE)->setText( ent.manager() );
-
+
if ( *it == "Spouse" )
(*itLE)->setText( ent.spouse() );
-
+
if ( *it == "Nickname" ){
@@ -1411,93 +1328,93 @@ void ContactEditor::setEntry( const OContact &entry ) {
}
-
+
if ( *it == "Children" )
(*itLE)->setText( ent.children() );
-
+
}
-
+
QStringList::Iterator itV;
for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
-
+
if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) )
*itV = ent.businessPhone();
-/*
- if ( *it == "Business 2 Phone" )
- *itV = ent.business2Phone();
-*/
+ /*
+ if ( *it == "Business 2 Phone" )
+ *itV = ent.business2Phone();
+ */
if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) )
*itV = ent.businessFax();
-
+
if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) )
*itV = ent.businessMobile();
-/*
- if ( *it == "Company Phone" )
- *itV = ent.companyPhone();
-*/
+ /*
+ if ( *it == "Company Phone" )
+ *itV = ent.companyPhone();
+ */
if ( *it == "Default Email" )
*itV = ent.defaultEmail();
-
+
if ( *it == "Emails" )
*itV = ent.emailList().join(", "); // :SX
-
+
if ( *it == "Home Phone" )
*itV = ent.homePhone();
-/*
- if ( *it == "Home 2 Phone" )
- *itV = ent.home2Phone();
-*/
+ /*
+ if ( *it == "Home 2 Phone" )
+ *itV = ent.home2Phone();
+ */
if ( *it == "Home Fax" )
*itV = ent.homeFax();
-
+
if ( *it == "Home Mobile" )
*itV = ent.homeMobile();
-/*
- if ( *it == "Car Phone" )
- *itV = ent.carPhone();
-
- if ( *it == "ISDN Phone" )
- *itV = ent.ISDNPhone();
-
- if ( *it == "Other Phone" )
- *itV = ent.otherPhone();
-*/
+ /*
+ if ( *it == "Car Phone" )
+ *itV = ent.carPhone();
+
+ if ( *it == "ISDN Phone" )
+ *itV = ent.ISDNPhone();
+
+ if ( *it == "Other Phone" )
+ *itV = ent.otherPhone();
+ */
if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
*itV = ent.businessPager();
-/*
- if ( *it == "Home Pager")
- *itV = ent.homePager();
-
- if ( *it == "AIM IM" )
- *itV = ent.AIMIM();
-
- if ( *it == "ICQ IM" )
- *itV = ent.ICQIM();
-
- if ( *it == "Jabber IM" )
- *itV = ent.jabberIM();
-
- if ( *it == "MSN IM" )
- *itV = ent.MSNIM();
-
- if ( *it == "Yahoo IM" )
- *itV = ent.yahooIM();
-*/
+ /*
+ if ( *it == "Home Pager")
+ *itV = ent.homePager();
+
+ if ( *it == "AIM IM" )
+ *itV = ent.AIMIM();
+
+ if ( *it == "ICQ IM" )
+ *itV = ent.ICQIM();
+
+ if ( *it == "Jabber IM" )
+ *itV = ent.jabberIM();
+
+ if ( *it == "MSN IM" )
+ *itV = ent.MSNIM();
+
+ if ( *it == "Yahoo IM" )
+ *itV = ent.yahooIM();
+ */
if ( *it == "Home Web Page" )
*itV = ent.homeWebpage();
-
+
if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
*itV = ent.businessWebpage();
-
-
+
+
}
-
+
cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") );
-
+
QString gender = ent.gender();
cmbGender->setCurrentItem( gender.toInt() );
-
+
txtNote->setText( ent.notes() );
-
+
slotAddressTypeChange( cmbAddress->currentItem() );
-
+
// Calling "show()" to arrange all widgets. Otherwise we will get
@@ -1509,3 +1426,3 @@ void ContactEditor::setEntry( const OContact &entry ) {
show();
-
+
// Get combo-settings from contact and set preset..
@@ -1522,5 +1439,5 @@ void ContactEditor::setEntry( const OContact &entry ) {
slotAddressTypeChange( cmbAddress->currentItem() );
-
+
updateDatePicker();
-
+
initializing = false;
@@ -1535,3 +1452,3 @@ void ContactEditor::updateDatePicker()
birthdayButton->setText( tr ("Unknown") );
-
+
if ( !ent.anniversary().isNull() ){
@@ -1541,3 +1458,3 @@ void ContactEditor::updateDatePicker()
anniversaryButton->setText( tr ("Unknown") );
-
+
}
@@ -1545,6 +1462,6 @@ void ContactEditor::updateDatePicker()
void ContactEditor::saveEntry() {
-
+
// Store current combo into contact
contactfields.saveToRecord( ent );
-
+
if ( useFullName ) {
@@ -1553,7 +1470,7 @@ void ContactEditor::saveEntry() {
txtLastName->setText( parseName( txtFullName->text(), NAME_L ) );
- txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
-
+ // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) );
+
useFullName = false;
}
-
+
ent.setFirstName( txtFirstName->text() );
@@ -1562,42 +1479,42 @@ void ContactEditor::saveEntry() {
ent.setSuffix( txtSuffix->text() );
-
+
ent.setFileAs( cmbFileAs->currentText() );
-
+
ent.setCategories( cmbCat->currentCategories() );
-
-
+
+
//if (hasTitle)
- ent.setJobTitle( txtJobTitle->text() );
-
- //if (hasCompany)
- ent.setCompany( txtOrganization->text() );
-
-// if (hasNotes)
- ent.setNotes( txtNote->text() );
-
- //if (hasStreet) {
- ent.setHomeStreet( slHomeAddress[0] );
- ent.setBusinessStreet( slBusinessAddress[0] );
- // }
-
- // if (hasCity) {
- ent.setHomeCity( slHomeAddress[3] );
- ent.setBusinessCity( slBusinessAddress[3] );
- // }
-
- // if (hasState) {
- ent.setHomeState( slHomeAddress[4] );
- ent.setBusinessState( slBusinessAddress[4] );
- // }
-
- // if (hasZip) {
- ent.setHomeZip( slHomeAddress[5] );
- ent.setBusinessZip( slBusinessAddress[5] );
- // }
-
- // if (hasCountry) {
- ent.setHomeCountry( slHomeAddress[6] );
- ent.setBusinessCountry( slBusinessAddress[6] );
- // }
-
+ ent.setJobTitle( txtJobTitle->text() );
+
+ //if (hasCompany)
+ ent.setCompany( txtOrganization->text() );
+
+ // if (hasNotes)
+ ent.setNotes( txtNote->text() );
+
+ //if (hasStreet) {
+ ent.setHomeStreet( slHomeAddress[0] );
+ ent.setBusinessStreet( slBusinessAddress[0] );
+ // }
+
+ // if (hasCity) {
+ ent.setHomeCity( slHomeAddress[3] );
+ ent.setBusinessCity( slBusinessAddress[3] );
+ // }
+
+ // if (hasState) {
+ ent.setHomeState( slHomeAddress[4] );
+ ent.setBusinessState( slBusinessAddress[4] );
+ // }
+
+ // if (hasZip) {
+ ent.setHomeZip( slHomeAddress[5] );
+ ent.setBusinessZip( slBusinessAddress[5] );
+ // }
+
+ // if (hasCountry) {
+ ent.setHomeCountry( slHomeAddress[6] );
+ ent.setBusinessCountry( slBusinessAddress[6] );
+ // }
+
QStringList::ConstIterator it;
@@ -1605,45 +1522,45 @@ void ContactEditor::saveEntry() {
for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) {
-
+
if ( *it == "Department" )
ent.setDepartment( (*itLE)->text() );
-
+
if ( *it == "Company" )
ent.setCompany( (*itLE)->text() );
-
+
if ( *it == "Office" )
ent.setOffice( (*itLE)->text() );
-
+
if ( *it == "Profession" )
ent.setProfession( (*itLE)->text() );
-
+
if ( *it == "Assistant" )
ent.setAssistant( (*itLE)->text() );
-
+
if ( *it == "Manager" )
ent.setManager( (*itLE)->text() );
-
+
if ( *it == "Spouse" )
ent.setSpouse( (*itLE)->text() );
-
+
if ( *it == "Nickname" )
ent.setNickname( (*itLE)->text() );
-
+
if ( *it == "Children" )
ent.setChildren( (*itLE)->text() );
-
+
}
-
-
+
+
QStringList::ConstIterator itV;
for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) {
-
+
if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) )
ent.setBusinessPhone( *itV );
-
+
if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) )
ent.setBusinessFax( *itV );
-
+
if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) )
ent.setBusinessMobile( *itV );
-
+
if ( *it == "Emails" ){
@@ -1659,30 +1576,30 @@ void ContactEditor::saveEntry() {
}
-
+
if ( *it == "Default Email")
ent.setDefaultEmail( defaultEmail /* *itV */ );
-
+
if ( *it == "Home Phone" )
ent.setHomePhone( *itV );
-
+
if ( *it == "Home Fax" )
ent.setHomeFax( *itV );
-
+
if ( *it == "Home Mobile" )
ent.setHomeMobile( *itV );
-
+
if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) )
ent.setBusinessPager( *itV );
-
+
if ( *it == "Home Web Page" )
ent.setHomeWebpage( *itV );
-
+
if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) )
ent.setBusinessWebpage( *itV );
-
-
+
+
}
-
+
int gender = cmbGender->currentItem();
ent.setGender( QString::number( gender ) );
-
+
QString str = txtNote->text();
@@ -1690,3 +1607,3 @@ void ContactEditor::saveEntry() {
ent.setNotes( str );
-
+
}
@@ -1696,24 +1613,24 @@ void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
{
- int where,
- start;
- if ( txt.isEmpty() )
- return;
- // find the first
- where = txt.find( ',' );
- if ( where < 0 ) {
- strDefaultEmail = txt;
- strAll = txt;
- } else {
- strDefaultEmail = txt.left( where ).stripWhiteSpace();
- strAll = strDefaultEmail;
- while ( where > -1 ) {
- strAll.append(" ");
- start = where;
- where = txt.find( ',', where + 1 );
- if ( where > - 1 )
- strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() );
- else // grab until the end...
- strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() );
+ int where,
+ start;
+ if ( txt.isEmpty() )
+ return;
+ // find the first
+ where = txt.find( ',' );
+ if ( where < 0 ) {
+ strDefaultEmail = txt;
+ strAll = txt;
+ } else {
+ strDefaultEmail = txt.left( where ).stripWhiteSpace();
+ strAll = strDefaultEmail;
+ while ( where > -1 ) {
+ strAll.append(" ");
+ start = where;
+ where = txt.find( ',', where + 1 );
+ if ( where > - 1 )
+ strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() );
+ else // grab until the end...
+ strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() );
+ }
}
- }
}
@@ -1723,24 +1640,24 @@ void parseEmailTo( const QString &strDefaultEmail,
{
- // create a comma dilimeted set of emails...
- // use the power of short circuiting...
- bool foundDefault = false;
- QString strTmp;
- int start = 0;
- int where;
- // start at the beginng.
- strBack = strDefaultEmail;
- where = 0;
- while ( where > -1 ) {
- start = where;
- where = strOtherEmail.find( ' ', where + 1 );
- if ( where > 0 ) {
- strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace();
- } else
- strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace();
- if ( foundDefault || strTmp != strDefaultEmail ) {
- strBack.append( ", " );
- strBack.append( strTmp );
- } else
- foundDefault = true;
- }
+ // create a comma dilimeted set of emails...
+ // use the power of short circuiting...
+ bool foundDefault = false;
+ QString strTmp;
+ int start = 0;
+ int where;
+ // start at the beginng.
+ strBack = strDefaultEmail;
+ where = 0;
+ while ( where > -1 ) {
+ start = where;
+ where = strOtherEmail.find( ' ', where + 1 );
+ if ( where > 0 ) {
+ strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace();
+ } else
+ strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace();
+ if ( foundDefault || strTmp != strDefaultEmail ) {
+ strBack.append( ", " );
+ strBack.append( strTmp );
+ } else
+ foundDefault = true;
+ }
}
@@ -1750,8 +1667,8 @@ static inline bool containsAlphaNum( const QString &str )
{
- int i,
- count = str.length();
- for ( i = 0; i < count; i++ )
- if ( !str[i].isSpace() )
- return TRUE;
- return FALSE;
+ int i,
+ count = str.length();
+ for ( i = 0; i < count; i++ )
+ if ( !str[i].isSpace() )
+ return TRUE;
+ return FALSE;
}
@@ -1760,8 +1677,8 @@ static inline bool constainsWhiteSpace( const QString &str )
{
- int i,
- count = str.length();
- for (i = 0; i < count; i++ )
- if ( str[i].isSpace() )
- return TRUE;
- return FALSE;
+ int i,
+ count = str.length();
+ for (i = 0; i < count; i++ )
+ if ( str[i].isSpace() )
+ return TRUE;
+ return FALSE;
}
@@ -1775,3 +1692,3 @@ void ContactEditor::setPersonalView( bool personal )
return;
-
+
if ( personal ){
@@ -1779,3 +1696,3 @@ void ContactEditor::setPersonalView( bool personal )
labCat->hide();
-
+
} else{
@@ -1788,7 +1705,7 @@ void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day)
{
- QDate date;
- date.setYMD( year, month, day );
- QString dateString = TimeString::numberDateString( date );
- anniversaryButton->setText( dateString );
- ent.setAnniversary ( date );
+ QDate date;
+ date.setYMD( year, month, day );
+ QString dateString = TimeString::numberDateString( date );
+ anniversaryButton->setText( dateString );
+ ent.setAnniversary ( date );
}
@@ -1797,7 +1714,7 @@ void ContactEditor::slotBirthdayDateChanged( int year, int month, int day)
{
- QDate date;
- date.setYMD( year, month, day );
- QString dateString = TimeString::numberDateString( date );
- birthdayButton->setText( dateString );
- ent.setBirthday ( date );
+ QDate date;
+ date.setYMD( year, month, day );
+ QString dateString = TimeString::numberDateString( date );
+ birthdayButton->setText( dateString );
+ ent.setBirthday ( date );
}
diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h
index 3becfdc..c2ead05 100644
--- a/core/pim/addressbook/version.h
+++ b/core/pim/addressbook/version.h
@@ -4,4 +4,4 @@
#define MAINVERSION "0"
-#define SUBVERSION "2"
-#define PATCHVERSION "2"
+#define SUBVERSION "3"
+#define PATCHVERSION "0"