-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 61 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 4 | ||||
-rw-r--r-- | core/pim/addressbook/ocontactfields.cpp | 4 |
3 files changed, 44 insertions, 25 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 5a7bf1a..7338eeb 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -56,8 +56,8 @@ void parseEmailFrom( const QString &txt, QString &strDefaultEmail, QString &strAll ); // 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 ); ContactEditor::ContactEditor( const OContact &entry, QWidget *parent, @@ -621,36 +621,50 @@ void ContactEditor::init() { setPersonalView ( m_personalView ); } -void ContactEditor::slotChooser1Change( const QString &textChanged ) { - +void ContactEditor::defaultEmailChanged(int i){ + qDebug("defaultEmailChanged"); int index = cmbChooserField1->currentItem(); - - slChooserValues[index] = textChanged; + slChooserValues[index] = cmbDefaultEmail->text(i); } -void ContactEditor::slotChooser2Change( const QString &textChanged ) { +void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid ) { + + if (slChooserNames[index] == "Default Email"){ + delete cmbDefaultEmail; + cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); + cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); + cmbDefaultEmail->insertStringList(ent.emailList()); + 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(); + } - int index = cmbChooserField2->currentItem(); slChooserValues[index] = textChanged; } -void ContactEditor::slotChooser3Change( const QString &textChanged ) { +void ContactEditor::slotChooser1Change( const QString &textChanged ) { + chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1); +} - int index = cmbChooserField3->currentItem(); +void ContactEditor::slotChooser2Change( const QString &textChanged ) { + chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2); - slChooserValues[index] = textChanged; +} +void ContactEditor::slotChooser3Change( const QString &textChanged ) { + chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3); } void ContactEditor::slotChooser4Change( const QString &textChanged ) { - - int index = cmbChooserField4->currentItem(); - - slChooserValues[index] = textChanged; - + chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4); } void ContactEditor::slotAddressChange( const QString &textChanged ) { @@ -1371,14 +1385,17 @@ void ContactEditor::saveEntry() { ent.setBusinessMobile( *itV ); if ( *it == "Emails" ){ - QString allemail; - QString defaultmail; - parseEmailFrom( *itV, defaultmail, allemail ); - // ent.clearEmails(); - ent.setDefaultEmail( defaultmail ); - ent.setEmails( allemail ); + QString allemail; + QString defaultmail; + parseEmailFrom( *itV, defaultmail, allemail ); + // ent.clearEmails(); +// ent.setDefaultEmail( defaultmail ); + ent.setEmails( allemail ); } + if ( *it == "Default Email") + ent.setDefaultEmail( *itV ); + if ( *it == "Home Phone" ) ent.setHomePhone( *itV ); diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index 250b831..d4b7f27 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h @@ -100,10 +100,11 @@ class ContactEditor : public QDialog { void slotBirthdayDateChanged( int year, int month, int day); void slotRemoveBirthday(); void slotRemoveAnniversary(); + void defaultEmailChanged(int); private: + void chooserChange( const QString&, int , QLineEdit* ); bool useFullName; - // bool hasGender, hasTitle, hasCompany, hasNotes, hasStreet, hasStreet2, hasPOBox, hasCity, hasState, hasZip, hasCountry; OContact ent; @@ -147,6 +148,7 @@ class ContactEditor : public QDialog { QComboBox *cmbChooserField2; QComboBox *cmbChooserField3; QComboBox *cmbChooserField4; + QComboBox *cmbDefaultEmail; QComboBox *cmbFileAs; CategorySelect *cmbCat; QLabel *labCat; diff --git a/core/pim/addressbook/ocontactfields.cpp b/core/pim/addressbook/ocontactfields.cpp index df57efa..7823a9c 100644 --- a/core/pim/addressbook/ocontactfields.cpp +++ b/core/pim/addressbook/ocontactfields.cpp @@ -42,7 +42,7 @@ QStringList OContactFields::trphonefields( bool sorted ) list.append( QObject::tr( "Business Fax" ) ); list.append( QObject::tr( "Business Mobile" ) ); - // list.append( QObject::tr( "Default Email" ) ); + list.append( QObject::tr( "Default Email" ) ); list.append( QObject::tr( "Emails" ) ); list.append( QObject::tr( "Home Phone" ) ); @@ -138,7 +138,7 @@ QStringList OContactFields::untrphonefields( bool sorted ) list.append( "Business Fax" ); list.append( "Business Mobile" ); - // list.append( "Default Email" ); + list.append( "Default Email" ); list.append( "Emails" ); list.append( "Home Phone" ); |