author | eilers <eilers> | 2003-03-05 11:45:30 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-03-05 11:45:30 (UTC) |
commit | 97a499b24e53ba4d9f00086f2ec1df1d7f3d7569 (patch) (side-by-side diff) | |
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 @@ -108,64 +108,66 @@ void ContactEditor::init() { // Otherwise we will get problems with field assignments! (se) slDynamicEntries.remove("Anniversary"); slDynamicEntries.remove("Birthday"); slDynamicEntries.remove("Gender"); // The same with translated fields.. But I will // use the translation map to avoid mismatches.. QMap<int, QString> translMap = OContactFields::idToTrFields(); trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); trlDynamicEntries.remove( translMap[Qtopia::Gender] ); // Last Check to be sure.. assert( slDynamicEntries.count() == trlDynamicEntries.count() ); assert( slChooserNames.count() == trlChooserNames.count() ); for (i = 0; i < slChooserNames.count(); i++) slChooserValues.append(""); QVBoxLayout *vb = new QVBoxLayout( this ); tabMain = new QTabWidget( this ); vb->addWidget( tabMain ); QWidget *tabViewport = new QWidget ( tabMain ); vb = new QVBoxLayout( tabViewport ); svGeneral = new QScrollView( tabViewport ); vb->addWidget( svGeneral, 0, 0 ); svGeneral->setResizePolicy( QScrollView::AutoOneFit ); + // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); + // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); svGeneral->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( svGeneral->viewport() ); svGeneral->addChild( container ); QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); gl->setResizeMode( QLayout::FreeResize ); btnFullName = new QPushButton( tr( "Full Name..." ), container ); gl->addWidget( btnFullName, 0, 0 ); txtFullName = new QLineEdit( container ); gl->addWidget( txtFullName, 0, 1 ); QLabel *l = new QLabel( tr( "Job Title" ), container ); gl->addWidget( l, 1, 0 ); txtJobTitle = new QLineEdit( container ); gl->addWidget( txtJobTitle, 1, 1 ); l = new QLabel( tr("Suffix"), container ); gl->addWidget( l, 2, 0 ); txtSuffix = new QLineEdit( container ); gl->addWidget( txtSuffix, 2, 1 ); l = new QLabel( tr( "Organization" ), container ); gl->addWidget( l, 3, 0 ); txtOrganization = new QLineEdit( container ); gl->addWidget( txtOrganization, 3, 1 ); // Chooser 1 cmbChooserField1 = new QComboBox( FALSE, container ); cmbChooserField1->setMaximumWidth( 90 ); gl->addWidget( cmbChooserField1, 4, 0 ); @@ -745,73 +747,72 @@ bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int w defaultEmailChooserPosition != widgetPos && !initializing){ chooserError( widgetPos ); return true; } QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); if ( cmbo ){ inputStack->raiseWidget( TextField ); inputStack -> removeWidget( cmbo ); delete cmbo; } cmbo = new QComboBox( inputStack ); cmbo -> insertStringList( emails ); inputStack -> addWidget( cmbo, Combo ); inputStack -> raiseWidget( Combo ); defaultEmailChooserPosition = widgetPos; cmbDefaultEmail = cmbo; connect( cmbo,SIGNAL( activated(int) ), SLOT( defaultEmailChanged(int) ) ); // Set current default email populateDefaultEmailCmb(); } else { // Something else was selected: Hide combo.. qWarning(" Hiding default-email combo" ); if ( defaultEmailChooserPosition == widgetPos ){ defaultEmailChooserPosition = -1; - QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); - if ( cmbo ){ - inputStack->raiseWidget( TextField ); - inputStack -> removeWidget( cmbo ); - cmbDefaultEmail = 0l; - delete cmbo; - } - - } + } + QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); + if ( cmbo ){ + inputStack->raiseWidget( TextField ); + inputStack -> removeWidget( cmbo ); + cmbDefaultEmail = 0l; + delete cmbo; + } // Caller should initialize the responsible textfield, therefore // "false" is returned return false; } // Everything is worked off .. return true; } // Currently accessed when we select default-email more than once ! void ContactEditor::chooserError( int index ) { qWarning("ContactEditor::chooserError( %d )", index); QMessageBox::warning( this, "Chooser Error", "Multiple selection of this\n" "Item is not allowed !\n\n" "First deselect the previous one !", "&OK", 0, 0, 0, 0 ); // Reset the selected Chooser. Unfortunately the chooser // generates no signal, therfore we have to // call the cmbChooserChange function manually.. switch( index ){ case 1: cmbChooserField1 -> setCurrentItem( 0 ); slotCmbChooser1Change( 0 ); break; case 2: cmbChooserField2 -> setCurrentItem( 0 ); |