author | eilers <eilers> | 2003-03-05 11:45:30 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-03-05 11:45:30 (UTC) |
commit | 97a499b24e53ba4d9f00086f2ec1df1d7f3d7569 (patch) (unidiff) | |
tree | c79e599a3a175e173f7a903e518c6f6f085268ce | |
parent | a1b76d948b7d45e8813181396ed83c002587feb9 (diff) | |
download | opie-97a499b24e53ba4d9f00086f2ec1df1d7f3d7569.zip opie-97a499b24e53ba4d9f00086f2ec1df1d7f3d7569.tar.gz opie-97a499b24e53ba4d9f00086f2ec1df1d7f3d7569.tar.bz2 |
Fixed bug, again ..
Default-Email Chooser wasn't removed in some rare cases ..
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 7682399..0b65a10 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -116,48 +116,50 @@ void ContactEditor::init() { | |||
116 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); | 116 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); |
117 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); | 117 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); |
118 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 118 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
119 | 119 | ||
120 | // Last Check to be sure.. | 120 | // Last Check to be sure.. |
121 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 121 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
122 | assert( slChooserNames.count() == trlChooserNames.count() ); | 122 | assert( slChooserNames.count() == trlChooserNames.count() ); |
123 | 123 | ||
124 | for (i = 0; i < slChooserNames.count(); i++) | 124 | for (i = 0; i < slChooserNames.count(); i++) |
125 | slChooserValues.append(""); | 125 | slChooserValues.append(""); |
126 | 126 | ||
127 | 127 | ||
128 | QVBoxLayout *vb = new QVBoxLayout( this ); | 128 | QVBoxLayout *vb = new QVBoxLayout( this ); |
129 | 129 | ||
130 | tabMain = new QTabWidget( this ); | 130 | tabMain = new QTabWidget( this ); |
131 | vb->addWidget( tabMain ); | 131 | vb->addWidget( tabMain ); |
132 | 132 | ||
133 | QWidget *tabViewport = new QWidget ( tabMain ); | 133 | QWidget *tabViewport = new QWidget ( tabMain ); |
134 | 134 | ||
135 | vb = new QVBoxLayout( tabViewport ); | 135 | vb = new QVBoxLayout( tabViewport ); |
136 | 136 | ||
137 | svGeneral = new QScrollView( tabViewport ); | 137 | svGeneral = new QScrollView( tabViewport ); |
138 | vb->addWidget( svGeneral, 0, 0 ); | 138 | vb->addWidget( svGeneral, 0, 0 ); |
139 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 139 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
140 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); | ||
141 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); | ||
140 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 142 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
141 | 143 | ||
142 | QWidget *container = new QWidget( svGeneral->viewport() ); | 144 | QWidget *container = new QWidget( svGeneral->viewport() ); |
143 | svGeneral->addChild( container ); | 145 | svGeneral->addChild( container ); |
144 | 146 | ||
145 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 147 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); |
146 | gl->setResizeMode( QLayout::FreeResize ); | 148 | gl->setResizeMode( QLayout::FreeResize ); |
147 | 149 | ||
148 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 150 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
149 | gl->addWidget( btnFullName, 0, 0 ); | 151 | gl->addWidget( btnFullName, 0, 0 ); |
150 | txtFullName = new QLineEdit( container ); | 152 | txtFullName = new QLineEdit( container ); |
151 | gl->addWidget( txtFullName, 0, 1 ); | 153 | gl->addWidget( txtFullName, 0, 1 ); |
152 | 154 | ||
153 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 155 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
154 | gl->addWidget( l, 1, 0 ); | 156 | gl->addWidget( l, 1, 0 ); |
155 | txtJobTitle = new QLineEdit( container ); | 157 | txtJobTitle = new QLineEdit( container ); |
156 | gl->addWidget( txtJobTitle, 1, 1 ); | 158 | gl->addWidget( txtJobTitle, 1, 1 ); |
157 | 159 | ||
158 | l = new QLabel( tr("Suffix"), container ); | 160 | l = new QLabel( tr("Suffix"), container ); |
159 | gl->addWidget( l, 2, 0 ); | 161 | gl->addWidget( l, 2, 0 ); |
160 | txtSuffix = new QLineEdit( container ); | 162 | txtSuffix = new QLineEdit( container ); |
161 | gl->addWidget( txtSuffix, 2, 1 ); | 163 | gl->addWidget( txtSuffix, 2, 1 ); |
162 | 164 | ||
163 | l = new QLabel( tr( "Organization" ), container ); | 165 | l = new QLabel( tr( "Organization" ), container ); |
@@ -753,57 +755,56 @@ bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int w | |||
753 | inputStack -> removeWidget( cmbo ); | 755 | inputStack -> removeWidget( cmbo ); |
754 | delete cmbo; | 756 | delete cmbo; |
755 | } | 757 | } |
756 | cmbo = new QComboBox( inputStack ); | 758 | cmbo = new QComboBox( inputStack ); |
757 | cmbo -> insertStringList( emails ); | 759 | cmbo -> insertStringList( emails ); |
758 | 760 | ||
759 | inputStack -> addWidget( cmbo, Combo ); | 761 | inputStack -> addWidget( cmbo, Combo ); |
760 | inputStack -> raiseWidget( Combo ); | 762 | inputStack -> raiseWidget( Combo ); |
761 | 763 | ||
762 | defaultEmailChooserPosition = widgetPos; | 764 | defaultEmailChooserPosition = widgetPos; |
763 | cmbDefaultEmail = cmbo; | 765 | cmbDefaultEmail = cmbo; |
764 | 766 | ||
765 | connect( cmbo,SIGNAL( activated(int) ), | 767 | connect( cmbo,SIGNAL( activated(int) ), |
766 | SLOT( defaultEmailChanged(int) ) ); | 768 | SLOT( defaultEmailChanged(int) ) ); |
767 | 769 | ||
768 | // Set current default email | 770 | // Set current default email |
769 | populateDefaultEmailCmb(); | 771 | populateDefaultEmailCmb(); |
770 | 772 | ||
771 | 773 | ||
772 | } else { | 774 | } else { |
773 | // Something else was selected: Hide combo.. | 775 | // Something else was selected: Hide combo.. |
774 | qWarning(" Hiding default-email combo" ); | 776 | qWarning(" Hiding default-email combo" ); |
775 | if ( defaultEmailChooserPosition == widgetPos ){ | 777 | if ( defaultEmailChooserPosition == widgetPos ){ |
776 | defaultEmailChooserPosition = -1; | 778 | defaultEmailChooserPosition = -1; |
777 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 779 | } |
778 | if ( cmbo ){ | 780 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
779 | inputStack->raiseWidget( TextField ); | 781 | if ( cmbo ){ |
780 | inputStack -> removeWidget( cmbo ); | 782 | inputStack->raiseWidget( TextField ); |
781 | cmbDefaultEmail = 0l; | 783 | inputStack -> removeWidget( cmbo ); |
782 | delete cmbo; | 784 | cmbDefaultEmail = 0l; |
783 | } | 785 | delete cmbo; |
784 | 786 | } | |
785 | } | ||
786 | 787 | ||
787 | // Caller should initialize the responsible textfield, therefore | 788 | // Caller should initialize the responsible textfield, therefore |
788 | // "false" is returned | 789 | // "false" is returned |
789 | return false; | 790 | return false; |
790 | } | 791 | } |
791 | 792 | ||
792 | // Everything is worked off .. | 793 | // Everything is worked off .. |
793 | return true; | 794 | return true; |
794 | 795 | ||
795 | } | 796 | } |
796 | 797 | ||
797 | // Currently accessed when we select default-email more than once ! | 798 | // Currently accessed when we select default-email more than once ! |
798 | void ContactEditor::chooserError( int index ) | 799 | void ContactEditor::chooserError( int index ) |
799 | { | 800 | { |
800 | qWarning("ContactEditor::chooserError( %d )", index); | 801 | qWarning("ContactEditor::chooserError( %d )", index); |
801 | QMessageBox::warning( this, "Chooser Error", | 802 | QMessageBox::warning( this, "Chooser Error", |
802 | "Multiple selection of this\n" | 803 | "Multiple selection of this\n" |
803 | "Item is not allowed !\n\n" | 804 | "Item is not allowed !\n\n" |
804 | "First deselect the previous one !", | 805 | "First deselect the previous one !", |
805 | "&OK", 0, 0, | 806 | "&OK", 0, 0, |
806 | 0, 0 ); | 807 | 0, 0 ); |
807 | 808 | ||
808 | // Reset the selected Chooser. Unfortunately the chooser | 809 | // Reset the selected Chooser. Unfortunately the chooser |
809 | // generates no signal, therfore we have to | 810 | // generates no signal, therfore we have to |