author | tille <tille> | 2002-12-18 13:01:15 (UTC) |
---|---|---|
committer | tille <tille> | 2002-12-18 13:01:15 (UTC) |
commit | 9471f69c44e811781ed9f643f5b84d7b459df601 (patch) (unidiff) | |
tree | f8daf275c36b9a068cbec9ff487a195e639ff8bf | |
parent | 930884a92b064766ed436111778fc55f157c6e1c (diff) | |
download | opie-9471f69c44e811781ed9f643f5b84d7b459df601.zip opie-9471f69c44e811781ed9f643f5b84d7b459df601.tar.gz opie-9471f69c44e811781ed9f643f5b84d7b459df601.tar.bz2 |
changing from defaultemail to something else now hides the combo
-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 | |||
@@ -41,66 +41,66 @@ | |||
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qmainwindow.h> | 42 | #include <qmainwindow.h> |
43 | #include <qvaluelist.h> | 43 | #include <qvaluelist.h> |
44 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
45 | #include <qlistbox.h> | 45 | #include <qlistbox.h> |
46 | #include <qhbox.h> | 46 | #include <qhbox.h> |
47 | #include <qaction.h> | 47 | #include <qaction.h> |
48 | #include <qiconset.h> | 48 | #include <qiconset.h> |
49 | 49 | ||
50 | static inline bool containsAlphaNum( const QString &str ); | 50 | static inline bool containsAlphaNum( const QString &str ); |
51 | static inline bool constainsWhiteSpace( const QString &str ); | 51 | static inline bool constainsWhiteSpace( const QString &str ); |
52 | 52 | ||
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... |
55 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 55 | void 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... |
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 | ||
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 ), |
67 | m_personalView ( false ) | 67 | m_personalView ( false ) |
68 | 68 | ||
69 | { | 69 | { |
70 | 70 | ||
71 | init(); | 71 | init(); |
72 | setEntry( entry ); | 72 | setEntry( entry ); |
73 | |||
74 | cmbDefaultEmail = 0; | 73 | cmbDefaultEmail = 0; |
74 | defaultEmailChooserPosition = -1; | ||
75 | } | 75 | } |
76 | 76 | ||
77 | ContactEditor::~ContactEditor() { | 77 | ContactEditor::~ContactEditor() { |
78 | } | 78 | } |
79 | 79 | ||
80 | void ContactEditor::init() { | 80 | void ContactEditor::init() { |
81 | 81 | ||
82 | useFullName = true; | 82 | useFullName = true; |
83 | 83 | ||
84 | uint i = 0; | 84 | uint i = 0; |
85 | 85 | ||
86 | QStringList trlChooserNames; | 86 | QStringList trlChooserNames; |
87 | 87 | ||
88 | for (i = 0; i <= 6; i++) { | 88 | for (i = 0; i <= 6; i++) { |
89 | slHomeAddress.append( "" ); | 89 | slHomeAddress.append( "" ); |
90 | slBusinessAddress.append( "" ); | 90 | slBusinessAddress.append( "" ); |
91 | } | 91 | } |
92 | 92 | ||
93 | trlChooserNames = OContactFields::trphonefields(); | 93 | trlChooserNames = OContactFields::trphonefields(); |
94 | slChooserNames = OContactFields::untrphonefields(); | 94 | slChooserNames = OContactFields::untrphonefields(); |
95 | slDynamicEntries = OContactFields::untrdetailsfields(); | 95 | slDynamicEntries = OContactFields::untrdetailsfields(); |
96 | trlDynamicEntries = OContactFields::trdetailsfields(); | 96 | trlDynamicEntries = OContactFields::trdetailsfields(); |
97 | for (i = 0; i < slChooserNames.count(); i++) | 97 | for (i = 0; i < slChooserNames.count(); i++) |
98 | slChooserValues.append(""); | 98 | slChooserValues.append(""); |
99 | 99 | ||
100 | 100 | ||
101 | QVBoxLayout *vb = new QVBoxLayout( this ); | 101 | QVBoxLayout *vb = new QVBoxLayout( this ); |
102 | 102 | ||
103 | tabMain = new QTabWidget( this ); | 103 | tabMain = new QTabWidget( this ); |
104 | vb->addWidget( tabMain ); | 104 | vb->addWidget( tabMain ); |
105 | 105 | ||
106 | QWidget *tabViewport = new QWidget ( tabMain ); | 106 | QWidget *tabViewport = new QWidget ( tabMain ); |
@@ -602,101 +602,106 @@ void ContactEditor::init() { | |||
602 | this, SLOT(slotCityChange(const QString &)) ); | 602 | this, SLOT(slotCityChange(const QString &)) ); |
603 | connect( txtState, SIGNAL(textChanged(const QString &)), | 603 | connect( txtState, SIGNAL(textChanged(const QString &)), |
604 | this, SLOT(slotStateChange(const QString &)) ); | 604 | this, SLOT(slotStateChange(const QString &)) ); |
605 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 605 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
606 | this, SLOT(slotZipChange(const QString &)) ); | 606 | this, SLOT(slotZipChange(const QString &)) ); |
607 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 607 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
608 | this, SLOT(slotCountryChange(const QString &)) ); | 608 | this, SLOT(slotCountryChange(const QString &)) ); |
609 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 609 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
610 | this, SLOT(slotCountryChange(const QString &)) ); | 610 | this, SLOT(slotCountryChange(const QString &)) ); |
611 | connect( cmbChooserField1, SIGNAL(activated(int)), | 611 | connect( cmbChooserField1, SIGNAL(activated(int)), |
612 | this, SLOT(slotCmbChooser1Change(int)) ); | 612 | this, SLOT(slotCmbChooser1Change(int)) ); |
613 | connect( cmbChooserField2, SIGNAL(activated(int)), | 613 | connect( cmbChooserField2, SIGNAL(activated(int)), |
614 | this, SLOT(slotCmbChooser2Change(int)) ); | 614 | this, SLOT(slotCmbChooser2Change(int)) ); |
615 | connect( cmbChooserField3, SIGNAL(activated(int)), | 615 | connect( cmbChooserField3, SIGNAL(activated(int)), |
616 | this, SLOT(slotCmbChooser3Change(int)) ); | 616 | this, SLOT(slotCmbChooser3Change(int)) ); |
617 | connect( cmbChooserField4, SIGNAL(activated(int)), | 617 | connect( cmbChooserField4, SIGNAL(activated(int)), |
618 | this, SLOT(slotCmbChooser4Change(int)) ); | 618 | this, SLOT(slotCmbChooser4Change(int)) ); |
619 | connect( cmbAddress, SIGNAL(activated(int)), | 619 | connect( cmbAddress, SIGNAL(activated(int)), |
620 | this, SLOT(slotAddressTypeChange(int)) ); | 620 | this, SLOT(slotAddressTypeChange(int)) ); |
621 | 621 | ||
622 | new QPEDialogListener(this); | 622 | new QPEDialogListener(this); |
623 | 623 | ||
624 | setPersonalView ( m_personalView ); | 624 | setPersonalView ( m_personalView ); |
625 | } | 625 | } |
626 | 626 | ||
627 | void ContactEditor::defaultEmailChanged(int i){ | 627 | void ContactEditor::defaultEmailChanged(int i){ |
628 | qDebug("defaultEmailChanged"); | 628 | qDebug("defaultEmailChanged"); |
629 | int index = cmbChooserField1->currentItem(); | 629 | int index = cmbChooserField1->currentItem(); |
630 | slChooserValues[index] = cmbDefaultEmail->text(i); | 630 | slChooserValues[index] = cmbDefaultEmail->text(i); |
631 | 631 | ||
632 | } | 632 | } |
633 | 633 | ||
634 | void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid ) { | 634 | void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) { |
635 | 635 | ||
636 | qDebug("defaultEmailChooserPosition %i, widgetPos %i ",defaultEmailChooserPosition,widgetPos); | ||
636 | if (slChooserNames[index] == "Default Email"){ | 637 | if (slChooserNames[index] == "Default Email"){ |
637 | if (cmbDefaultEmail) delete cmbDefaultEmail; | 638 | if (cmbDefaultEmail) delete cmbDefaultEmail; |
638 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); | 639 | cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); |
639 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); | 640 | cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); |
640 | cmbDefaultEmail->insertStringList(ent.emailList()); | 641 | cmbDefaultEmail->insertStringList(ent.emailList()); |
641 | connect(cmbDefaultEmail,SIGNAL(activated(int)), | 642 | connect(cmbDefaultEmail,SIGNAL(activated(int)), |
642 | SLOT(defaultEmailChanged(int))); | 643 | SLOT(defaultEmailChanged(int))); |
643 | QString demail = ent.defaultEmail(); | 644 | QString demail = ent.defaultEmail(); |
644 | for ( int i = 0; i < cmbDefaultEmail->count(); i++) | 645 | for ( int i = 0; i < cmbDefaultEmail->count(); i++) |
645 | if ( cmbDefaultEmail->text( i ) == demail ) | 646 | if ( cmbDefaultEmail->text( i ) == demail ) |
646 | cmbDefaultEmail->setCurrentItem( i ); | 647 | cmbDefaultEmail->setCurrentItem( i ); |
647 | 648 | ||
648 | cmbDefaultEmail->show(); | 649 | cmbDefaultEmail->show(); |
649 | } | 650 | defaultEmailChooserPosition = widgetPos; |
651 | }else if (defaultEmailChooserPosition == widgetPos){ | ||
652 | qDebug("cmbDefaultEmail->hide()"); | ||
653 | if (cmbDefaultEmail) cmbDefaultEmail->hide(); | ||
654 | } | ||
650 | 655 | ||
651 | 656 | ||
652 | slChooserValues[index] = textChanged; | 657 | slChooserValues[index] = textChanged; |
653 | 658 | ||
654 | } | 659 | } |
655 | 660 | ||
656 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 661 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
657 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1); | 662 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
658 | } | 663 | } |
659 | 664 | ||
660 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 665 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
661 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2); | 666 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
662 | 667 | ||
663 | } | 668 | } |
664 | 669 | ||
665 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 670 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
666 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3); | 671 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
667 | } | 672 | } |
668 | 673 | ||
669 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 674 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
670 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4); | 675 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
671 | } | 676 | } |
672 | 677 | ||
673 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 678 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
674 | 679 | ||
675 | if ( cmbAddress->currentItem() == 0 ) { | 680 | if ( cmbAddress->currentItem() == 0 ) { |
676 | slBusinessAddress[0] = textChanged; | 681 | slBusinessAddress[0] = textChanged; |
677 | } else { | 682 | } else { |
678 | slHomeAddress[0] = textChanged; | 683 | slHomeAddress[0] = textChanged; |
679 | } | 684 | } |
680 | } | 685 | } |
681 | 686 | ||
682 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 687 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
683 | 688 | ||
684 | if ( cmbAddress->currentItem() == 0 ) { | 689 | if ( cmbAddress->currentItem() == 0 ) { |
685 | slBusinessAddress[1] = textChanged; | 690 | slBusinessAddress[1] = textChanged; |
686 | } else { | 691 | } else { |
687 | slHomeAddress[1] = textChanged; | 692 | slHomeAddress[1] = textChanged; |
688 | } | 693 | } |
689 | } | 694 | } |
690 | 695 | ||
691 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 696 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
692 | 697 | ||
693 | if ( cmbAddress->currentItem() == 0 ) { | 698 | if ( cmbAddress->currentItem() == 0 ) { |
694 | slBusinessAddress[2] = textChanged; | 699 | slBusinessAddress[2] = textChanged; |
695 | } else { | 700 | } else { |
696 | slHomeAddress[2] = textChanged; | 701 | slHomeAddress[2] = textChanged; |
697 | } | 702 | } |
698 | } | 703 | } |
699 | 704 | ||
700 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 705 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
701 | 706 | ||
702 | if ( cmbAddress->currentItem() == 0 ) { | 707 | if ( cmbAddress->currentItem() == 0 ) { |
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 | |||
@@ -74,65 +74,66 @@ class ContactEditor : public QDialog { | |||
74 | private: | 74 | private: |
75 | void init(); | 75 | void init(); |
76 | void saveEntry(); | 76 | void saveEntry(); |
77 | bool isEmpty(); | 77 | bool isEmpty(); |
78 | void cleanupFields(); | 78 | void cleanupFields(); |
79 | void updateDatePicker(); | 79 | void updateDatePicker(); |
80 | QString parseName( QString fullName, int type ); | 80 | QString parseName( QString fullName, int type ); |
81 | private slots: | 81 | private slots: |
82 | void slotChooser1Change( const QString &textChanged ); | 82 | void slotChooser1Change( const QString &textChanged ); |
83 | void slotChooser2Change( const QString &textChanged ); | 83 | void slotChooser2Change( const QString &textChanged ); |
84 | void slotChooser3Change( const QString &textChanged ); | 84 | void slotChooser3Change( const QString &textChanged ); |
85 | void slotChooser4Change( const QString &textChanged ); | 85 | void slotChooser4Change( const QString &textChanged ); |
86 | void slotCmbChooser1Change( int index ); | 86 | void slotCmbChooser1Change( int index ); |
87 | void slotCmbChooser2Change( int index ); | 87 | void slotCmbChooser2Change( int index ); |
88 | void slotCmbChooser3Change( int index ); | 88 | void slotCmbChooser3Change( int index ); |
89 | void slotCmbChooser4Change( int index ); | 89 | void slotCmbChooser4Change( int index ); |
90 | void slotAddressTypeChange( int index ); | 90 | void slotAddressTypeChange( int index ); |
91 | void slotAddressChange( const QString &textChanged ); | 91 | void slotAddressChange( const QString &textChanged ); |
92 | void slotAddress2Change( const QString &textChanged ); | 92 | void slotAddress2Change( const QString &textChanged ); |
93 | void slotPOBoxChange( const QString &textChanged ); | 93 | void slotPOBoxChange( const QString &textChanged ); |
94 | void slotCityChange( const QString &textChanged ); | 94 | void slotCityChange( const QString &textChanged ); |
95 | void slotStateChange( const QString &textChanged ); | 95 | void slotStateChange( const QString &textChanged ); |
96 | void slotZipChange( const QString &textChanged ); | 96 | void slotZipChange( const QString &textChanged ); |
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 | void defaultEmailChanged(int); |
104 | 104 | ||
105 | private: | 105 | private: |
106 | void chooserChange( const QString&, int , QLineEdit* ); | 106 | int defaultEmailChooserPosition; |
107 | void chooserChange( const QString&, int , QLineEdit*, int ); | ||
107 | bool useFullName; | 108 | bool useFullName; |
108 | 109 | ||
109 | OContact ent; | 110 | OContact ent; |
110 | 111 | ||
111 | QDialog *dlgNote; | 112 | QDialog *dlgNote; |
112 | QDialog *dlgName; | 113 | QDialog *dlgName; |
113 | 114 | ||
114 | QList<QLineEdit> listValue; | 115 | QList<QLineEdit> listValue; |
115 | QList<QLabel> listName; | 116 | QList<QLabel> listName; |
116 | 117 | ||
117 | QStringList slDynamicEntries; | 118 | QStringList slDynamicEntries; |
118 | QStringList trlDynamicEntries; | 119 | QStringList trlDynamicEntries; |
119 | 120 | ||
120 | bool m_personalView; | 121 | bool m_personalView; |
121 | 122 | ||
122 | QStringList slHomeAddress; | 123 | QStringList slHomeAddress; |
123 | QStringList slBusinessAddress; | 124 | QStringList slBusinessAddress; |
124 | QStringList slChooserNames; | 125 | QStringList slChooserNames; |
125 | QStringList slChooserValues; | 126 | QStringList slChooserValues; |
126 | 127 | ||
127 | QMultiLineEdit *txtNote; | 128 | QMultiLineEdit *txtNote; |
128 | QLabel *lblNote; | 129 | QLabel *lblNote; |
129 | 130 | ||
130 | //QLineEdit *txtTitle; | 131 | //QLineEdit *txtTitle; |
131 | QLineEdit *txtFirstName; | 132 | QLineEdit *txtFirstName; |
132 | QLineEdit *txtMiddleName; | 133 | QLineEdit *txtMiddleName; |
133 | QLineEdit *txtLastName; | 134 | QLineEdit *txtLastName; |
134 | QLineEdit *txtSuffix; | 135 | QLineEdit *txtSuffix; |
135 | 136 | ||
136 | QTabWidget *tabMain; | 137 | QTabWidget *tabMain; |
137 | QScrollView *svGeneral; | 138 | QScrollView *svGeneral; |
138 | QPushButton *btnFullName; | 139 | QPushButton *btnFullName; |