author | tille <tille> | 2002-12-19 00:00:42 (UTC) |
---|---|---|
committer | tille <tille> | 2002-12-19 00:00:42 (UTC) |
commit | 4fc6648f5953d453a31edaf288480ff2458c431f (patch) (unidiff) | |
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 | 57 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 4 |
2 files changed, 44 insertions, 17 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, | |||
58 | // helper convert from file format to comma delimited... | 58 | // helper convert from file format to comma delimited... |
59 | //void parseEmailTo( const QString &strDefaultEmail, | 59 | void parseEmailTo( const QString &strDefaultEmail, |
60 | // const QString &strOtherEmail, QString &strBack ); | 60 | const QString &strOtherEmail, QString &strBack ); |
61 | 61 | ||
@@ -80,3 +80,3 @@ ContactEditor::~ContactEditor() { | |||
80 | void ContactEditor::init() { | 80 | void ContactEditor::init() { |
81 | 81 | ||
82 | useFullName = true; | 82 | useFullName = true; |
@@ -598,4 +598,2 @@ void ContactEditor::init() { | |||
598 | this, SLOT(slotAddressChange(const QString &)) ); | 598 | this, SLOT(slotAddressChange(const QString &)) ); |
599 | //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); | ||
600 | //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); | ||
601 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 599 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
@@ -633,18 +631,26 @@ void ContactEditor::defaultEmailChanged(int i){ | |||
633 | 631 | ||
634 | void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) { | 632 | void ContactEditor::populateDefaultEmailCmb(){ |
633 | cmbDefaultEmail->clear(); | ||
634 | cmbDefaultEmail->insertStringList(emails); | ||
635 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | ||
636 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",cmbDefaultEmail->text( i ).latin1(),defaultEmail.latin1()); | ||
637 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | ||
638 | cmbDefaultEmail->setCurrentItem( i ); | ||
639 | qDebug("set"); | ||
640 | } | ||
641 | } | ||
642 | } | ||
635 | 643 | ||
636 | qDebug("defaultEmailChooserPosition %i, widgetPos %i ",defaultEmailChooserPosition,widgetPos); | 644 | void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) { |
637 | if (slChooserNames[index] == "Default Email"){ | 645 | QString type = slChooserNames[index]; |
646 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i",type.latin1(),textChanged.latin1(), index, widgetPos ); | ||
647 | if ( type == "Default Email"){ | ||
648 | defaultEmail = textChanged; | ||
638 | if (cmbDefaultEmail) delete cmbDefaultEmail; | 649 | if (cmbDefaultEmail) delete cmbDefaultEmail; |
639 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); | 650 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); |
640 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); | 651 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); |
641 | cmbDefaultEmail->insertStringList(ent.emailList()); | ||
642 | connect(cmbDefaultEmail,SIGNAL(activated(int)), | ||
643 | SLOT(defaultEmailChanged(int))); | ||
644 | QString demail = ent.defaultEmail(); | ||
645 | for ( int i = 0; i < cmbDefaultEmail->count(); i++) | ||
646 | if ( cmbDefaultEmail->text( i ) == demail ) | ||
647 | cmbDefaultEmail->setCurrentItem( i ); | ||
648 | |||
649 | cmbDefaultEmail->show(); | 652 | cmbDefaultEmail->show(); |
653 | populateDefaultEmailCmb(); | ||
654 | connect(cmbDefaultEmail,SIGNAL(activated(int)), | ||
655 | SLOT(defaultEmailChanged(int))); | ||
650 | defaultEmailChooserPosition = widgetPos; | 656 | defaultEmailChooserPosition = widgetPos; |
@@ -653,3 +659,11 @@ void ContactEditor::chooserChange( const QString &textChanged, int index, QLineE | |||
653 | if (cmbDefaultEmail) cmbDefaultEmail->hide(); | 659 | if (cmbDefaultEmail) cmbDefaultEmail->hide(); |
660 | widgetPos=-1; | ||
661 | }else if (type == "Emails"){ | ||
662 | qDebug("emails"); | ||
663 | QString de; | ||
664 | emails = QStringList::split (",", textChanged ); | ||
665 | |||
666 | populateDefaultEmailCmb(); | ||
654 | } | 667 | } |
668 | |||
655 | 669 | ||
@@ -741,2 +755,3 @@ void ContactEditor::slotCountryChange( const QString &textChanged ) { | |||
741 | 755 | ||
756 | |||
742 | void ContactEditor::slotCmbChooser1Change( int index ) { | 757 | void ContactEditor::slotCmbChooser1Change( int index ) { |
@@ -1062,2 +1077,3 @@ void ContactEditor::cleanupFields() { | |||
1062 | QStringList::Iterator it = slChooserValues.begin(); | 1077 | QStringList::Iterator it = slChooserValues.begin(); |
1078 | |||
1063 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1079 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
@@ -1104,2 +1120,9 @@ void ContactEditor::setEntry( const OContact &entry ) { | |||
1104 | 1120 | ||
1121 | |||
1122 | |||
1123 | emails = QStringList(ent.emailList()); | ||
1124 | defaultEmail = ent.defaultEmail(); | ||
1125 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | ||
1126 | qDebug("default email=%s",defaultEmail.latin1()); | ||
1127 | |||
1105 | useFullName = false; | 1128 | 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 { | |||
106 | int defaultEmailChooserPosition; | 106 | int defaultEmailChooserPosition; |
107 | void populateDefaultEmailCmb(); | ||
107 | void chooserChange( const QString&, int , QLineEdit*, int ); | 108 | void chooserChange( const QString&, int , QLineEdit*, int ); |
109 | |||
108 | bool useFullName; | 110 | bool useFullName; |
@@ -126,2 +128,4 @@ class ContactEditor : public QDialog { | |||
126 | QStringList slChooserValues; | 128 | QStringList slChooserValues; |
129 | QStringList emails; | ||
130 | QString defaultEmail; | ||
127 | 131 | ||