summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/contacteditor.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/addressbook/contacteditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp61
1 files changed, 39 insertions, 22 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
@@ -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 );
@@ -623,7 +623,6 @@ void ContactEditor::init() {
-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);
@@ -631,5 +630,19 @@ void ContactEditor::slotChooser1Change( const QString &textChanged ) {
-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();
@@ -639,8 +652,13 @@ void ContactEditor::slotChooser2Change( const QString &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);
}
@@ -648,7 +666,3 @@ void ContactEditor::slotChooser3Change( const QString &textChanged ) {
void ContactEditor::slotChooser4Change( const QString &textChanged ) {
-
- int index = cmbChooserField4->currentItem();
-
- slChooserValues[index] = textChanged;
-
+ chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4);
}
@@ -1373,10 +1387,13 @@ void ContactEditor::saveEntry() {
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" )