summaryrefslogtreecommitdiff
authortille <tille>2002-12-08 18:20:10 (UTC)
committer tille <tille>2002-12-08 18:20:10 (UTC)
commit741a70d585c5680ccdb2786df4a73e7bde1d7c5d (patch) (unidiff)
tree44af34e66e2b7f895e0f61d74fe2e3bcd793af96
parentc4ffb0ec4797088fbd0a0f5cacee23d68e3e9922 (diff)
downloadopie-741a70d585c5680ccdb2786df4a73e7bde1d7c5d.zip
opie-741a70d585c5680ccdb2786df4a73e7bde1d7c5d.tar.gz
opie-741a70d585c5680ccdb2786df4a73e7bde1d7c5d.tar.bz2
added combo for default email
not perfect but it should do its job (better than i expected in first place ;)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp61
-rw-r--r--core/pim/addressbook/contacteditor.h4
-rw-r--r--core/pim/addressbook/ocontactfields.cpp4
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
@@ -53,14 +53,14 @@ static inline bool constainsWhiteSpace( const QString &str );
53// helper functions, convert our comma delimited list to proper 53// helper functions, convert our comma delimited list to proper
54// file format... 54// file format...
55void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 55void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
56 QString &strAll ); 56 QString &strAll );
57 57
58// helper convert from file format to comma delimited... 58// helper convert from file format to comma delimited...
59void parseEmailTo( const QString &strDefaultEmail, 59//void parseEmailTo( const QString &strDefaultEmail,
60 const QString &strOtherEmail, QString &strBack ); 60 // const QString &strOtherEmail, QString &strBack );
61 61
62 ContactEditor::ContactEditor(const OContact &entry, 62 ContactEditor::ContactEditor(const OContact &entry,
63 QWidget *parent, 63 QWidget *parent,
64 const char *name, 64 const char *name,
65 WFlags fl ) 65 WFlags fl )
66 : QDialog( parent, name, TRUE, fl ), 66 : QDialog( parent, name, TRUE, fl ),
@@ -618,42 +618,56 @@ void ContactEditor::init() {
618 618
619 new QPEDialogListener(this); 619 new QPEDialogListener(this);
620 620
621 setPersonalView ( m_personalView ); 621 setPersonalView ( m_personalView );
622} 622}
623 623
624void ContactEditor::slotChooser1Change( const QString &textChanged ) { 624void ContactEditor::defaultEmailChanged(int i){
625 625 qDebug("defaultEmailChanged");
626 int index = cmbChooserField1->currentItem(); 626 int index = cmbChooserField1->currentItem();
627 627 slChooserValues[index] = cmbDefaultEmail->text(i);
628 slChooserValues[index] = textChanged;
629 628
630} 629}
631 630
632void ContactEditor::slotChooser2Change( const QString &textChanged ) { 631void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid ) {
632
633 if (slChooserNames[index] == "Default Email"){
634 delete cmbDefaultEmail;
635 cmbDefaultEmail = new QComboBox(inputWid->parentWidget());
636 cmbDefaultEmail->setGeometry(inputWid->frameGeometry());
637 cmbDefaultEmail->insertStringList(ent.emailList());
638 connect(cmbDefaultEmail,SIGNAL(activated(int)),
639 SLOT(defaultEmailChanged(int)));
640 QString demail = ent.defaultEmail();
641 for ( int i = 0; i < cmbDefaultEmail->count(); i++)
642 if ( cmbDefaultEmail->text( i ) == demail )
643 cmbDefaultEmail->setCurrentItem( i );
644
645 cmbDefaultEmail->show();
646 }
633 647
634 int index = cmbChooserField2->currentItem();
635 648
636 slChooserValues[index] = textChanged; 649 slChooserValues[index] = textChanged;
637 650
638} 651}
639 652
640void ContactEditor::slotChooser3Change( const QString &textChanged ) { 653void ContactEditor::slotChooser1Change( const QString &textChanged ) {
654 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1);
655}
641 656
642 int index = cmbChooserField3->currentItem(); 657void ContactEditor::slotChooser2Change( const QString &textChanged ) {
658 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2);
643 659
644 slChooserValues[index] = textChanged; 660}
645 661
662void ContactEditor::slotChooser3Change( const QString &textChanged ) {
663 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3);
646} 664}
647 665
648void ContactEditor::slotChooser4Change( const QString &textChanged ) { 666void ContactEditor::slotChooser4Change( const QString &textChanged ) {
649 667 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4);
650 int index = cmbChooserField4->currentItem();
651
652 slChooserValues[index] = textChanged;
653
654} 668}
655 669
656void ContactEditor::slotAddressChange( const QString &textChanged ) { 670void ContactEditor::slotAddressChange( const QString &textChanged ) {
657 671
658 if ( cmbAddress->currentItem() == 0 ) { 672 if ( cmbAddress->currentItem() == 0 ) {
659 slBusinessAddress[0] = textChanged; 673 slBusinessAddress[0] = textChanged;
@@ -1368,20 +1382,23 @@ void ContactEditor::saveEntry() {
1368 ent.setBusinessFax( *itV ); 1382 ent.setBusinessFax( *itV );
1369 1383
1370 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) 1384 if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) )
1371 ent.setBusinessMobile( *itV ); 1385 ent.setBusinessMobile( *itV );
1372 1386
1373 if ( *it == "Emails" ){ 1387 if ( *it == "Emails" ){
1374 QString allemail; 1388 QString allemail;
1375 QString defaultmail; 1389 QString defaultmail;
1376 parseEmailFrom( *itV, defaultmail, allemail ); 1390 parseEmailFrom( *itV, defaultmail, allemail );
1377 // ent.clearEmails(); 1391 // ent.clearEmails();
1378 ent.setDefaultEmail( defaultmail ); 1392 // ent.setDefaultEmail( defaultmail );
1379 ent.setEmails( allemail ); 1393 ent.setEmails( allemail );
1380 } 1394 }
1381 1395
1396 if ( *it == "Default Email")
1397 ent.setDefaultEmail( *itV );
1398
1382 if ( *it == "Home Phone" ) 1399 if ( *it == "Home Phone" )
1383 ent.setHomePhone( *itV ); 1400 ent.setHomePhone( *itV );
1384 1401
1385 if ( *it == "Home Fax" ) 1402 if ( *it == "Home Fax" )
1386 ent.setHomeFax( *itV ); 1403 ent.setHomeFax( *itV );
1387 1404
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
@@ -97,16 +97,17 @@ class ContactEditor : public QDialog {
97 void slotCountryChange( const QString &textChanged ); 97 void slotCountryChange( const QString &textChanged );
98 void slotFullNameChange( const QString &textChanged ); 98 void slotFullNameChange( const QString &textChanged );
99 void slotAnniversaryDateChanged( int year, int month, int day); 99 void slotAnniversaryDateChanged( int year, int month, int day);
100 void slotBirthdayDateChanged( int year, int month, int day); 100 void slotBirthdayDateChanged( int year, int month, int day);
101 void slotRemoveBirthday(); 101 void slotRemoveBirthday();
102 void slotRemoveAnniversary(); 102 void slotRemoveAnniversary();
103 void defaultEmailChanged(int);
103 104
104 private: 105 private:
106 void chooserChange( const QString&, int , QLineEdit* );
105 bool useFullName; 107 bool useFullName;
106 // bool hasGender, hasTitle, hasCompany, hasNotes, hasStreet, hasStreet2, hasPOBox, hasCity, hasState, hasZip, hasCountry;
107 108
108 OContact ent; 109 OContact ent;
109 110
110 QDialog *dlgNote; 111 QDialog *dlgNote;
111 QDialog *dlgName; 112 QDialog *dlgName;
112 113
@@ -144,12 +145,13 @@ class ContactEditor : public QDialog {
144 QLineEdit *txtChooserField3; 145 QLineEdit *txtChooserField3;
145 QLineEdit *txtChooserField4; 146 QLineEdit *txtChooserField4;
146 QComboBox *cmbChooserField1; 147 QComboBox *cmbChooserField1;
147 QComboBox *cmbChooserField2; 148 QComboBox *cmbChooserField2;
148 QComboBox *cmbChooserField3; 149 QComboBox *cmbChooserField3;
149 QComboBox *cmbChooserField4; 150 QComboBox *cmbChooserField4;
151 QComboBox *cmbDefaultEmail;
150 QComboBox *cmbFileAs; 152 QComboBox *cmbFileAs;
151 CategorySelect *cmbCat; 153 CategorySelect *cmbCat;
152 QLabel *labCat; 154 QLabel *labCat;
153 155
154 QScrollView *svAddress; 156 QScrollView *svAddress;
155 QLineEdit *txtAddress; 157 QLineEdit *txtAddress;
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
@@ -39,13 +39,13 @@ QStringList OContactFields::trphonefields( bool sorted )
39{ 39{
40 QStringList list; 40 QStringList list;
41 list.append( QObject::tr( "Business Phone" ) ); 41 list.append( QObject::tr( "Business Phone" ) );
42 list.append( QObject::tr( "Business Fax" ) ); 42 list.append( QObject::tr( "Business Fax" ) );
43 list.append( QObject::tr( "Business Mobile" ) ); 43 list.append( QObject::tr( "Business Mobile" ) );
44 44
45 // list.append( QObject::tr( "Default Email" ) ); 45 list.append( QObject::tr( "Default Email" ) );
46 list.append( QObject::tr( "Emails" ) ); 46 list.append( QObject::tr( "Emails" ) );
47 47
48 list.append( QObject::tr( "Home Phone" ) ); 48 list.append( QObject::tr( "Home Phone" ) );
49 list.append( QObject::tr( "Home Fax" ) ); 49 list.append( QObject::tr( "Home Fax" ) );
50 list.append( QObject::tr( "Home Mobile" ) ); 50 list.append( QObject::tr( "Home Mobile" ) );
51 51
@@ -135,13 +135,13 @@ QStringList OContactFields::untrphonefields( bool sorted )
135 QStringList list; 135 QStringList list;
136 136
137 list.append( "Business Phone" ); 137 list.append( "Business Phone" );
138 list.append( "Business Fax" ); 138 list.append( "Business Fax" );
139 list.append( "Business Mobile" ); 139 list.append( "Business Mobile" );
140 140
141 // list.append( "Default Email" ); 141 list.append( "Default Email" );
142 list.append( "Emails" ); 142 list.append( "Emails" );
143 143
144 list.append( "Home Phone" ); 144 list.append( "Home Phone" );
145 list.append( "Home Fax" ); 145 list.append( "Home Fax" );
146 list.append( "Home Mobile" ); 146 list.append( "Home Mobile" );
147 147