author | tille <tille> | 2002-12-19 00:00:42 (UTC) |
---|---|---|
committer | tille <tille> | 2002-12-19 00:00:42 (UTC) |
commit | 4fc6648f5953d453a31edaf288480ff2458c431f (patch) (side-by-side diff) | |
tree | aff033c63297fef4c37e561c7ce961ce3f15421f | |
parent | 7f98b97ff4b112ddc7025b34649a4ed331b37548 (diff) | |
download | opie-4fc6648f5953d453a31edaf288480ff2458c431f.zip opie-4fc6648f5953d453a31edaf288480ff2458c431f.tar.gz opie-4fc6648f5953d453a31edaf288480ff2458c431f.tar.bz2 |
fix for email <-> default email bug
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 51 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 4 |
2 files changed, 41 insertions, 14 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index cc3908a..4e73114 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -58,4 +58,4 @@ void parseEmailFrom( const QString &txt, QString &strDefaultEmail, // helper convert from file format to comma delimited... -//void parseEmailTo( const QString &strDefaultEmail, -// const QString &strOtherEmail, QString &strBack ); +void parseEmailTo( const QString &strDefaultEmail, + const QString &strOtherEmail, QString &strBack ); @@ -598,4 +598,2 @@ void ContactEditor::init() { this, SLOT(slotAddressChange(const QString &)) ); - //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); - //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); connect( txtCity, SIGNAL(textChanged(const QString &)), @@ -633,6 +631,19 @@ void ContactEditor::defaultEmailChanged(int i){ -void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) { +void ContactEditor::populateDefaultEmailCmb(){ + cmbDefaultEmail->clear(); + cmbDefaultEmail->insertStringList(emails); + for ( int i = 0; i < cmbDefaultEmail->count(); i++){ + qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",cmbDefaultEmail->text( i ).latin1(),defaultEmail.latin1()); + if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ + cmbDefaultEmail->setCurrentItem( i ); + qDebug("set"); + } + } +} - qDebug("defaultEmailChooserPosition %i, widgetPos %i ",defaultEmailChooserPosition,widgetPos); - if (slChooserNames[index] == "Default Email"){ +void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) { + QString type = slChooserNames[index]; + qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i",type.latin1(),textChanged.latin1(), index, widgetPos ); + if ( type == "Default Email"){ + defaultEmail = textChanged; if (cmbDefaultEmail) delete cmbDefaultEmail; @@ -640,11 +651,6 @@ void ContactEditor::chooserChange( const QString &textChanged, int index, QLineE cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); - cmbDefaultEmail->insertStringList(ent.emailList()); + cmbDefaultEmail->show(); + populateDefaultEmailCmb(); connect(cmbDefaultEmail,SIGNAL(activated(int)), SLOT(defaultEmailChanged(int))); - QString demail = ent.defaultEmail(); - for ( int i = 0; i < cmbDefaultEmail->count(); i++) - if ( cmbDefaultEmail->text( i ) == demail ) - cmbDefaultEmail->setCurrentItem( i ); - - cmbDefaultEmail->show(); defaultEmailChooserPosition = widgetPos; @@ -653,2 +659,9 @@ void ContactEditor::chooserChange( const QString &textChanged, int index, QLineE if (cmbDefaultEmail) cmbDefaultEmail->hide(); + widgetPos=-1; + }else if (type == "Emails"){ + qDebug("emails"); + QString de; + emails = QStringList::split (",", textChanged ); + + populateDefaultEmailCmb(); } @@ -656,2 +669,3 @@ void ContactEditor::chooserChange( const QString &textChanged, int index, QLineE + slChooserValues[index] = textChanged; @@ -741,2 +755,3 @@ void ContactEditor::slotCountryChange( const QString &textChanged ) { + void ContactEditor::slotCmbChooser1Change( int index ) { @@ -1062,2 +1077,3 @@ void ContactEditor::cleanupFields() { QStringList::Iterator it = slChooserValues.begin(); + for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { @@ -1104,2 +1120,9 @@ void ContactEditor::setEntry( const OContact &entry ) { + + + emails = QStringList(ent.emailList()); + defaultEmail = ent.defaultEmail(); + if (defaultEmail.isEmpty()) defaultEmail = emails[0]; + qDebug("default email=%s",defaultEmail.latin1()); + useFullName = false; diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index 63257f8..bcef679 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h @@ -106,3 +106,5 @@ class ContactEditor : public QDialog { int defaultEmailChooserPosition; + void populateDefaultEmailCmb(); void chooserChange( const QString&, int , QLineEdit*, int ); + bool useFullName; @@ -126,2 +128,4 @@ class ContactEditor : public QDialog { QStringList slChooserValues; + QStringList emails; + QString defaultEmail; |