-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 19 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 3 |
2 files changed, 14 insertions, 8 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index f125edb..cc3908a 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -57,34 +57,34 @@ 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 ); ContactEditor::ContactEditor( const OContact &entry, QWidget *parent, const char *name, WFlags fl ) : QDialog( parent, name, TRUE, fl ), m_personalView ( false ) { init(); setEntry( entry ); - cmbDefaultEmail = 0; + defaultEmailChooserPosition = -1; } ContactEditor::~ContactEditor() { } void ContactEditor::init() { useFullName = true; uint i = 0; QStringList trlChooserNames; for (i = 0; i <= 6; i++) { slHomeAddress.append( "" ); slBusinessAddress.append( "" ); @@ -618,69 +618,74 @@ void ContactEditor::init() { this, SLOT(slotCmbChooser4Change(int)) ); connect( cmbAddress, SIGNAL(activated(int)), this, SLOT(slotAddressTypeChange(int)) ); new QPEDialogListener(this); setPersonalView ( m_personalView ); } void ContactEditor::defaultEmailChanged(int i){ qDebug("defaultEmailChanged"); int index = cmbChooserField1->currentItem(); slChooserValues[index] = cmbDefaultEmail->text(i); } -void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid ) { +void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) { + qDebug("defaultEmailChooserPosition %i, widgetPos %i ",defaultEmailChooserPosition,widgetPos); if (slChooserNames[index] == "Default Email"){ if (cmbDefaultEmail) 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(); - } + defaultEmailChooserPosition = widgetPos; + }else if (defaultEmailChooserPosition == widgetPos){ + qDebug("cmbDefaultEmail->hide()"); + if (cmbDefaultEmail) cmbDefaultEmail->hide(); + } slChooserValues[index] = textChanged; } void ContactEditor::slotChooser1Change( const QString &textChanged ) { - chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1); + chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); } void ContactEditor::slotChooser2Change( const QString &textChanged ) { - chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2); + chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); } void ContactEditor::slotChooser3Change( const QString &textChanged ) { - chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3); + chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); } void ContactEditor::slotChooser4Change( const QString &textChanged ) { - chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4); + chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); } void ContactEditor::slotAddressChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { slBusinessAddress[0] = textChanged; } else { slHomeAddress[0] = textChanged; } } void ContactEditor::slotAddress2Change( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { slBusinessAddress[1] = textChanged; } else { diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index d4b7f27..63257f8 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h @@ -90,33 +90,34 @@ class ContactEditor : public QDialog { void slotAddressTypeChange( int index ); void slotAddressChange( const QString &textChanged ); void slotAddress2Change( const QString &textChanged ); void slotPOBoxChange( const QString &textChanged ); void slotCityChange( const QString &textChanged ); void slotStateChange( const QString &textChanged ); void slotZipChange( const QString &textChanged ); void slotCountryChange( const QString &textChanged ); void slotFullNameChange( const QString &textChanged ); void slotAnniversaryDateChanged( int year, int month, int day); void slotBirthdayDateChanged( int year, int month, int day); void slotRemoveBirthday(); void slotRemoveAnniversary(); void defaultEmailChanged(int); private: - void chooserChange( const QString&, int , QLineEdit* ); + int defaultEmailChooserPosition; + void chooserChange( const QString&, int , QLineEdit*, int ); bool useFullName; OContact ent; QDialog *dlgNote; QDialog *dlgName; QList<QLineEdit> listValue; QList<QLabel> listName; QStringList slDynamicEntries; QStringList trlDynamicEntries; bool m_personalView; QStringList slHomeAddress; |