-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 21 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 348 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 18 |
3 files changed, 208 insertions, 179 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index beb953a..8229212 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -191,7 +191,7 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, listContainer = new QWidget( this ); - + QVBoxLayout *vb = new QVBoxLayout( listContainer ); - + abList = new AbTable( &orderedFields, listContainer, "table" ); vb->addWidget(abList); @@ -234,5 +234,5 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, slotSetFont(startFontSize); - + mbList->insertItem( tr("Font"), fontMenu); setCentralWidget(listContainer); @@ -248,5 +248,5 @@ void AddressbookWindow::slotSetFont( int size ) { QFont *currentFont; - + switch (size) { case 0: @@ -472,5 +472,5 @@ static void parseName( const QString& name, QString *first, QString *middle, *middle = rest.mid( space+1 ); } - + } @@ -504,5 +504,5 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) bAbEditFirstTime = FALSE; } else { - abEditor->setEntry( cnt ); + abEditor->setEntry( cnt ); } abView()->init( cnt ); @@ -795,5 +795,5 @@ void AddressbookWindow::initFields() cfg.setGroup( "Font" ); startFontSize = cfg.readNumEntry( "fontSize", 1 ); - + } else { @@ -860,12 +860,12 @@ void AddressbookWindow::slotFind() if ( centralWidget() == abView() ) showList(); - + FindDialog frmFind( "Contacts", this ); QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); - + frmFind.exec(); - + if ( abList->numSelections() ) abList->clearSelection(); @@ -907,4 +907,5 @@ void AddressbookWindow::populateCategories() rememberId; id = 1; + rememberId = 0; catMenu->insertItem( tr( "All" ), id++ ); QStringList categories = abList->categories(); diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index e74da87..fa60f98 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -58,7 +58,7 @@ ContactEditor::ContactEditor( const Contact &entry, : QDialog( parent, name, TRUE, fl ), orderedValues( newOrderedValues ), - slOrdered( slNewOrdered ) + slOrdered( *slNewOrdered ) { - + init(); initMap(); @@ -75,5 +75,5 @@ void ContactEditor::init() { int i = 0; - +/** SHut up and stop leaking slHomeAddress = new QStringList; slBusinessAddress = new QStringList; @@ -82,10 +82,10 @@ void ContactEditor::init() { slDynamicEntries = new QStringList; - +*/ //*slDynamicEntries = *slOrdered; for (i = 0; i <= 6; i++) { - slHomeAddress->append( "" ); - slBusinessAddress->append( "" ); + slHomeAddress.append( "" ); + slBusinessAddress.append( "" ); } @@ -102,11 +102,11 @@ void ContactEditor::init() { hasZip = FALSE; hasCountry = FALSE; - - QStringList::ConstIterator it = slOrdered->begin(); - for ( i = 0; it != slOrdered->end(); i++, ++it ) { + + QStringList::ConstIterator it = slOrdered.begin(); + for ( i = 0; it != slOrdered.end(); i++, ++it ) { if ( (*it).right( 3 ) == tr( "Fax" ) ) { - slChooserNames->append( *it ); - slChooserValues->append( tr( "" ) ); + slChooserNames.append( *it ); + slChooserValues.append("" ); //slDynamicEntries->remove( it ); continue; @@ -114,6 +114,6 @@ void ContactEditor::init() { if ( (*it).right( 5 ) == tr( "Phone" ) ) { - slChooserNames->append( *it ); - slChooserValues->append( "" ); + slChooserNames.append( *it ); + slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; @@ -121,6 +121,6 @@ void ContactEditor::init() { if ( (*it).right( 2 ) == tr( "IM" ) ) { - slChooserNames->append( *it ); - slChooserValues->append( "" ); + slChooserNames.append( *it ); + slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; @@ -128,6 +128,6 @@ void ContactEditor::init() { if ( (*it).right( 6 ) == tr( "Mobile" ) ) { - slChooserNames->append( *it ); - slChooserValues->append( "" ); + slChooserNames.append( *it ); + slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; @@ -135,6 +135,6 @@ void ContactEditor::init() { if ( (*it).right( 4 ) == tr( "Page" ) ) { - slChooserNames->append( *it ); - slChooserValues->append( "" ); + slChooserNames.append( *it ); + slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; @@ -142,6 +142,6 @@ void ContactEditor::init() { if ( (*it).right( 5 ) == tr( "Pager" ) ) { - slChooserNames->append( *it ); - slChooserValues->append( "" ); + slChooserNames.append( *it ); + slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; @@ -149,6 +149,6 @@ void ContactEditor::init() { if ( *it == tr( "Default Email" ) ) { - slChooserNames->append( *it ); - slChooserValues->append( "" ); + slChooserNames.append( *it ); + slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; @@ -156,6 +156,6 @@ void ContactEditor::init() { if ( *it == tr( "Emails" ) ) { - slChooserNames->append( *it ); - slChooserValues->append( "" ); + slChooserNames.append( *it ); + slChooserValues.append( "" ); //slDynamicEntries->remove( it ); continue; @@ -166,20 +166,20 @@ void ContactEditor::init() { continue; } - + if ( *it == tr( "First Name" ) ) { // slDynamicEntries->remove( it ); continue; } - + if ( *it == tr( "Middle Name" ) ) { // slDynamicEntries->remove( it ); continue; } - + if ( *it == tr( "Last Name" ) ) { // slDynamicEntries->remove( it ); continue; } - + if ( *it == tr( "Suffix" ) ) { // slDynamicEntries->remove( it ); @@ -191,5 +191,5 @@ void ContactEditor::init() { continue; } - + if ( *it == tr( "Gender" ) ) { hasGender = TRUE; @@ -197,5 +197,5 @@ void ContactEditor::init() { continue; } - + if ( *it == tr( "Job Title" ) ) { hasTitle = TRUE; @@ -203,5 +203,5 @@ void ContactEditor::init() { continue; } - + if ( *it == tr( "Company" ) ) { hasCompany = TRUE; @@ -209,5 +209,5 @@ void ContactEditor::init() { continue; } - + if ( *it == tr( "Notes" ) ) { hasNotes = TRUE; @@ -215,10 +215,10 @@ void ContactEditor::init() { continue; } - + if ( *it == tr( "Groups" ) ) { // slDynamicEntries->remove( it ); continue; } - + if ( (*it).right( 6 ) == tr( "Street" ) ) { hasStreet = TRUE; @@ -226,5 +226,5 @@ void ContactEditor::init() { continue; } - + if ( (*it).right( 8 ) == tr( "Street 2" ) ) { hasStreet2 = TRUE; @@ -232,5 +232,5 @@ void ContactEditor::init() { continue; } - + if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { hasPOBox = TRUE; @@ -238,5 +238,5 @@ void ContactEditor::init() { continue; } - + if ( (*it).right( 4 ) == tr( "City" ) ) { hasCity = TRUE; @@ -244,5 +244,5 @@ void ContactEditor::init() { continue; } - + if ( (*it).right( 5 ) == tr( "State" ) ) { hasState = TRUE; @@ -250,5 +250,5 @@ void ContactEditor::init() { continue; } - + if ( (*it).right( 3 ) == tr( "Zip" ) ) { hasZip = TRUE; @@ -256,5 +256,5 @@ void ContactEditor::init() { continue; } - + if ( (*it).right( 7 ) == tr( "Country" ) ) { hasCountry = TRUE; @@ -263,13 +263,13 @@ void ContactEditor::init() { } - slDynamicEntries->append( *it ); + slDynamicEntries.append( *it ); } } QVBoxLayout *vb = new QVBoxLayout( this ); - + tabMain = new QTabWidget( this ); vb->addWidget( tabMain ); - + QWidget *tabViewport = new QWidget ( tabMain ); @@ -347,5 +347,5 @@ void ContactEditor::init() { svAddress->addChild( container ); - gl = new QGridLayout( container, 6, 3, 2, 4 ); + gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem cmbAddress = new QComboBox( FALSE, container ); @@ -361,5 +361,5 @@ void ContactEditor::init() { l = new QLabel( tr( "Address 2" ), container ); gl->addWidget( l, 2, 0 ); - txtAddress2 = new QLineEdit( container ); + txtAddress2 = new QLineEdit( container ); gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 ); @@ -608,4 +608,10 @@ void ContactEditor::init() { txtChooserField4 = new QLineEdit( container ); gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); + + QSpacerItem *space = new QSpacerItem(1,1, + QSizePolicy::Maximum, + QSizePolicy::MinimumExpanding ); + gl->addItem( space, 7, 0 ); + tabMain->insertTab( tabViewport, tr( "Address" ) ); @@ -624,6 +630,6 @@ void ContactEditor::init() { gl = new QGridLayout( container, 1, 2, 2, 4 ); - QStringList::ConstIterator it = slDynamicEntries->begin(); - for (i = 0; it != slDynamicEntries->end(); i++, ++it) { + QStringList::ConstIterator it = slDynamicEntries.begin(); + for (i = 0; it != slDynamicEntries.end(); i++, ++it) { l = new QLabel( *it, container ); listName.append( l ); @@ -635,13 +641,13 @@ void ContactEditor::init() { l = new QLabel( tr("Gender"), container ); - gl->addWidget( l, slDynamicEntries->count(), 0 ); + gl->addWidget( l, slDynamicEntries.count(), 0 ); cmbGender = new QComboBox( container ); cmbGender->insertItem( "", 0 ); cmbGender->insertItem( tr("Male"), 1); cmbGender->insertItem( tr("Female"), 2); - gl->addWidget( cmbGender, slDynamicEntries->count(), 1 ); - + gl->addWidget( cmbGender, slDynamicEntries.count(), 1 ); + tabMain->insertTab( tabViewport, tr( "Details" ) ); - + dlgNote = new QDialog( this, "Note Dialog", TRUE ); dlgNote->setCaption( tr("Enter Note") ); @@ -653,5 +659,5 @@ void ContactEditor::init() { dlgName = new QDialog( this, "Name Dialog", TRUE ); dlgName->setCaption( tr("Edit Name") ); - gl = new QGridLayout( dlgName, 4, 2, 2, 3 ); + gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); l = new QLabel( tr("First Name"), dlgName ); @@ -674,35 +680,55 @@ void ContactEditor::init() { txtSuffix = new QLineEdit( dlgName ); gl->addWidget( txtSuffix, 3, 1 ); + space = new QSpacerItem(1,1, + QSizePolicy::Maximum, + QSizePolicy::MinimumExpanding ); + gl->addItem( space, 4, 0 ); - cmbChooserField1->insertStringList( *slChooserNames ); - cmbChooserField2->insertStringList( *slChooserNames ); - cmbChooserField3->insertStringList( *slChooserNames ); - cmbChooserField4->insertStringList( *slChooserNames ); + cmbChooserField1->insertStringList( slChooserNames ); + cmbChooserField2->insertStringList( slChooserNames ); + cmbChooserField3->insertStringList( slChooserNames ); + cmbChooserField4->insertStringList( slChooserNames ); cmbChooserField1->setCurrentItem( 0 ); cmbChooserField2->setCurrentItem( 1 ); cmbChooserField3->setCurrentItem( 2 ); - + connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); - + connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); - - connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) ); - connect( txtChooserField2, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser2Change(const QString &)) ); - connect( txtChooserField3, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser3Change(const QString &)) ); - connect( txtChooserField4, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser4Change(const QString &)) ); - connect( txtAddress, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddressChange(const QString &)) ); - //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); - //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); - connect( txtCity, SIGNAL(textChanged(const QString &)), this, SLOT(slotCityChange(const QString &)) ); - connect( txtState, SIGNAL(textChanged(const QString &)), this, SLOT(slotStateChange(const QString &)) ); - connect( txtZip, SIGNAL(textChanged(const QString &)), this, SLOT(slotZipChange(const QString &)) ); - connect( cmbCountry, SIGNAL(textChanged(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); - connect( cmbCountry, SIGNAL(activated(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); - connect( cmbChooserField1, SIGNAL(activated(int)), this, SLOT(slotCmbChooser1Change(int)) ); - connect( cmbChooserField2, SIGNAL(activated(int)), this, SLOT(slotCmbChooser2Change(int)) ); - connect( cmbChooserField3, SIGNAL(activated(int)), this, SLOT(slotCmbChooser3Change(int)) ); - connect( cmbChooserField4, SIGNAL(activated(int)), this, SLOT(slotCmbChooser4Change(int)) ); - connect( cmbAddress, SIGNAL(activated(int)), this, SLOT(slotAddressTypeChange(int)) ); + + connect( txtChooserField1, SIGNAL(textChanged(const QString &)), + this, SLOT(slotChooser1Change(const QString &)) ); + connect( txtChooserField2, SIGNAL(textChanged(const QString &)), + this, SLOT(slotChooser2Change(const QString &)) ); + connect( txtChooserField3, SIGNAL(textChanged(const QString &)), + this, SLOT(slotChooser3Change(const QString &)) ); + connect( txtChooserField4, SIGNAL(textChanged(const QString &)), + this, SLOT(slotChooser4Change(const QString &)) ); + connect( txtAddress, SIGNAL(textChanged(const QString &)), + this, SLOT(slotAddressChange(const QString &)) ); + //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); + //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); + connect( txtCity, SIGNAL(textChanged(const QString &)), + this, SLOT(slotCityChange(const QString &)) ); + connect( txtState, SIGNAL(textChanged(const QString &)), + this, SLOT(slotStateChange(const QString &)) ); + connect( txtZip, SIGNAL(textChanged(const QString &)), + this, SLOT(slotZipChange(const QString &)) ); + connect( cmbCountry, SIGNAL(textChanged(const QString &)), + this, SLOT(slotCountryChange(const QString &)) ); + connect( cmbCountry, SIGNAL(activated(const QString &)), + this, SLOT(slotCountryChange(const QString &)) ); + connect( cmbChooserField1, SIGNAL(activated(int)), + this, SLOT(slotCmbChooser1Change(int)) ); + connect( cmbChooserField2, SIGNAL(activated(int)), + this, SLOT(slotCmbChooser2Change(int)) ); + connect( cmbChooserField3, SIGNAL(activated(int)), + this, SLOT(slotCmbChooser3Change(int)) ); + connect( cmbChooserField4, SIGNAL(activated(int)), + this, SLOT(slotCmbChooser4Change(int)) ); + connect( cmbAddress, SIGNAL(activated(int)), + this, SLOT(slotAddressTypeChange(int)) ); + new QPEDialogListener(this); } @@ -740,5 +766,5 @@ void ContactEditor::slotChooser1Change( const QString &textChanged ) { int index = cmbChooserField1->currentItem(); - (*slChooserValues)[index] = textChanged; + slChooserValues[index] = textChanged; } @@ -748,5 +774,5 @@ void ContactEditor::slotChooser2Change( const QString &textChanged ) { int index = cmbChooserField2->currentItem(); - (*slChooserValues)[index] = textChanged; + slChooserValues[index] = textChanged; } @@ -756,5 +782,5 @@ void ContactEditor::slotChooser3Change( const QString &textChanged ) { int index = cmbChooserField3->currentItem(); - (*slChooserValues)[index] = textChanged; + slChooserValues[index] = textChanged; } @@ -764,5 +790,5 @@ void ContactEditor::slotChooser4Change( const QString &textChanged ) { int index = cmbChooserField4->currentItem(); - (*slChooserValues)[index] = textChanged; + slChooserValues[index] = textChanged; } @@ -771,7 +797,7 @@ void ContactEditor::slotAddressChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { - (*slBusinessAddress)[0] = textChanged; + slBusinessAddress[0] = textChanged; } else { - (*slHomeAddress)[0] = textChanged; + slHomeAddress[0] = textChanged; } } @@ -780,7 +806,7 @@ void ContactEditor::slotAddress2Change( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { - (*slBusinessAddress)[1] = textChanged; + slBusinessAddress[1] = textChanged; } else { - (*slHomeAddress)[1] = textChanged; + slHomeAddress[1] = textChanged; } } @@ -789,7 +815,7 @@ void ContactEditor::slotPOBoxChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { - (*slBusinessAddress)[2] = textChanged; + slBusinessAddress[2] = textChanged; } else { - (*slHomeAddress)[2] = textChanged; + slHomeAddress[2] = textChanged; } } @@ -798,7 +824,7 @@ void ContactEditor::slotCityChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { - (*slBusinessAddress)[3] = textChanged; + slBusinessAddress[3] = textChanged; } else { - (*slHomeAddress)[3] = textChanged; + slHomeAddress[3] = textChanged; } } @@ -806,9 +832,9 @@ void ContactEditor::slotCityChange( const QString &textChanged ) { void ContactEditor::slotStateChange( const QString &textChanged ) { - + if ( cmbAddress->currentItem() == 0 ) { - (*slBusinessAddress)[4] = textChanged; + slBusinessAddress[4] = textChanged; } else { - (*slHomeAddress)[4] = textChanged; + slHomeAddress[4] = textChanged; } } @@ -817,7 +843,7 @@ void ContactEditor::slotZipChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { - (*slBusinessAddress)[5] = textChanged; + slBusinessAddress[5] = textChanged; } else { - (*slHomeAddress)[5] = textChanged; + slHomeAddress[5] = textChanged; } } @@ -826,7 +852,7 @@ void ContactEditor::slotCountryChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { - (*slBusinessAddress)[6] = textChanged; + slBusinessAddress[6] = textChanged; } else { - (*slHomeAddress)[6] = textChanged; + slHomeAddress[6] = textChanged; } } @@ -834,17 +860,18 @@ void ContactEditor::slotCountryChange( const QString &textChanged ) { void ContactEditor::slotCmbChooser1Change( int index ) { - txtChooserField1->setText( (*slChooserValues)[index] ); - + txtChooserField1->setText( slChooserValues[index] ); + txtChooserField1->setFocus(); } void ContactEditor::slotCmbChooser2Change( int index ) { - txtChooserField2->setText( (*slChooserValues)[index] ); - + txtChooserField2->setText( slChooserValues[index] ); + txtChooserField2->setFocus(); } void ContactEditor::slotCmbChooser3Change( int index ) { - txtChooserField3->setText( (*slChooserValues)[index] ); + txtChooserField3->setText( slChooserValues[index] ); + txtChooserField3->setFocus(); } @@ -852,5 +879,6 @@ void ContactEditor::slotCmbChooser3Change( int index ) { void ContactEditor::slotCmbChooser4Change( int index ) { - txtChooserField4->setText( (*slChooserValues)[index] ); + txtChooserField4->setText( slChooserValues[index] ); + txtChooserField4->setFocus(); } @@ -860,23 +888,23 @@ void ContactEditor::slotAddressTypeChange( int index ) { if ( index == 0 ) { - txtAddress->setText( (*slBusinessAddress)[0] ); + txtAddress->setText( slBusinessAddress[0] ); //txtAddress2->setText( (*slBusinessAddress)[1] ); //txtPOBox->setText( (*slBusinessAddress)[2] ); - txtCity->setText( (*slBusinessAddress)[3] ); - txtState->setText( (*slBusinessAddress)[4] ); - txtZip->setText( (*slBusinessAddress)[5] ); + txtCity->setText( slBusinessAddress[3] ); + txtState->setText( slBusinessAddress[4] ); + txtZip->setText( slBusinessAddress[5] ); QLineEdit *txtTmp = cmbCountry->lineEdit(); - txtTmp->setText( (*slBusinessAddress)[6] ); + txtTmp->setText( slBusinessAddress[6] ); } else { - txtAddress->setText( (*slHomeAddress)[0] ); + txtAddress->setText( slHomeAddress[0] ); //txtAddress2->setText( (*slHomeAddress)[1] ); //txtPOBox->setText( (*slHomeAddress)[2] ); - txtCity->setText( (*slHomeAddress)[3] ); - txtState->setText( (*slHomeAddress)[4] ); - txtZip->setText( (*slHomeAddress)[5] ); + txtCity->setText( slHomeAddress[3] ); + txtState->setText( slHomeAddress[4] ); + txtZip->setText( slHomeAddress[5] ); QLineEdit *txtTmp = cmbCountry->lineEdit(); - txtTmp->setText( (*slHomeAddress)[6] ); + txtTmp->setText( slHomeAddress[6] ); } @@ -899,5 +927,5 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) { useFullName = TRUE; -} +} void ContactEditor::loadFields() { @@ -905,5 +933,5 @@ void ContactEditor::loadFields() { QStringList::ConstIterator it; QListIterator<QLabel> lit( listName ); - for ( it = slDynamicEntries->begin(); *lit; ++lit, ++it) { + for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { (*lit)->setText( *it ); } @@ -960,7 +988,7 @@ bool ContactEditor::isEmpty() { QString t = txtFullName->text(); - if ( !t.isEmpty() && containsAlphaNum( t ) ) + if ( !t.isEmpty() && containsAlphaNum( t ) ) return false; - + t = cmbFileAs->currentText(); if ( !t.isEmpty() && containsAlphaNum( t ) ) @@ -983,5 +1011,5 @@ QString ContactEditor::parseName( const QString fullName, int type ) { int spPos; int spPos2; - + commapos = simplifiedName.find( ',', 0, TRUE); @@ -989,5 +1017,5 @@ QString ContactEditor::parseName( const QString fullName, int type ) { if ( commapos == -1 ) { - + switch (spCount) { case 0: @@ -1045,5 +1073,5 @@ QString ContactEditor::parseName( const QString fullName, int type ) { simplifiedName.replace( commapos, 1, " " ); simplifiedName = simplifiedName.simplifyWhiteSpace(); - + switch (spCount) { case 0: @@ -1099,5 +1127,5 @@ QString ContactEditor::parseName( const QString fullName, int type ) { } } - + switch (type) { case NAME_FL: @@ -1131,17 +1159,17 @@ QString ContactEditor::parseName( const QString fullName, int type ) { void ContactEditor::cleanupFields() { - QStringList::Iterator it = slChooserValues->begin(); - for ( int i = 0; it != slChooserValues->end(); i++, ++it ) { + QStringList::Iterator it = slChooserValues.begin(); + for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { (*it) = ""; } for ( int i = 0; i < 7; i++ ) { - (*slHomeAddress)[i] = ""; - (*slBusinessAddress)[i] = ""; + slHomeAddress[i] = ""; + slBusinessAddress[i] = ""; } QStringList::ConstIterator cit; QListIterator<QLineEdit> itLE( listValue ); - for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) { + for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) { (*itLE)->setText( "" ); } @@ -1175,5 +1203,5 @@ void ContactEditor::setEntry( const Contact &entry ) { cleanupFields(); - + ent = entry; @@ -1185,7 +1213,7 @@ void ContactEditor::setEntry( const Contact &entry ) { QString *tmpString = new QString; - *tmpString = ent.firstName() + " " + ent.middleName() + + *tmpString = ent.firstName() + " " + ent.middleName() + + " " + ent.lastName() + " " + ent.suffix(); - + txtFullName->setText( tmpString->simplifyWhiteSpace() ); @@ -1195,5 +1223,5 @@ void ContactEditor::setEntry( const Contact &entry ) { txtJobTitle->setText( ent.jobTitle() ); - if (hasCompany) + if (hasCompany) txtOrganization->setText( ent.company() ); @@ -1202,6 +1230,6 @@ void ContactEditor::setEntry( const Contact &entry ) { if (hasStreet) { - (*slHomeAddress)[0] = ent.homeStreet(); - (*slBusinessAddress)[0] = ent.businessStreet(); + slHomeAddress[0] = ent.homeStreet(); + slBusinessAddress[0] = ent.businessStreet(); } /* @@ -1217,26 +1245,26 @@ void ContactEditor::setEntry( const Contact &entry ) { */ if (hasCity) { - (*slHomeAddress)[3] = ent.homeCity(); - (*slBusinessAddress)[3] = ent.businessCity(); + slHomeAddress[3] = ent.homeCity(); + slBusinessAddress[3] = ent.businessCity(); } if (hasState) { - (*slHomeAddress)[4] = ent.homeState(); - (*slBusinessAddress)[4] = ent.businessState(); + slHomeAddress[4] = ent.homeState(); + slBusinessAddress[4] = ent.businessState(); } if (hasZip) { - (*slHomeAddress)[5] = ent.homeZip(); - (*slBusinessAddress)[5] = ent.businessZip(); + slHomeAddress[5] = ent.homeZip(); + slBusinessAddress[5] = ent.businessZip(); } if (hasCountry) { - (*slHomeAddress)[6] = ent.homeCountry(); - (*slBusinessAddress)[6] = ent.businessCountry(); + slHomeAddress[6] = ent.homeCountry(); + slBusinessAddress[6] = ent.businessCountry(); } QStringList::ConstIterator it; QListIterator<QLineEdit> itLE( listValue ); - for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { + for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { if ( *it == "Department" ) (*itLE)->setText( ent.department() ); @@ -1275,5 +1303,5 @@ void ContactEditor::setEntry( const Contact &entry ) { QStringList::Iterator itV; - for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { + for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { if ( *it == "Business Phone" || *it == "Work Phone" ) @@ -1347,5 +1375,5 @@ void ContactEditor::setEntry( const Contact &entry ) { } - + cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); @@ -1370,9 +1398,9 @@ void ContactEditor::saveEntry() { txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); - + useFullName = FALSE; } - /*if ( ent.firstName() != txtFirstName->text() || + /*if ( ent.firstName() != txtFirstName->text() || ent.lastName != txtLastName->text() || ent.middleName != txtMiddleName->text() ) { @@ -1386,5 +1414,5 @@ void ContactEditor::saveEntry() { ent.setFileAs( cmbFileAs->currentText() ); - + ent.setCategories( cmbCat->currentCategories() ); @@ -1392,5 +1420,5 @@ void ContactEditor::saveEntry() { ent.setJobTitle( txtJobTitle->text() ); - if (hasCompany) + if (hasCompany) ent.setCompany( txtOrganization->text() ); @@ -1399,6 +1427,6 @@ void ContactEditor::saveEntry() { if (hasStreet) { - ent.setHomeStreet( (*slHomeAddress)[0] ); - ent.setBusinessStreet( (*slBusinessAddress)[0] ); + ent.setHomeStreet( slHomeAddress[0] ); + ent.setBusinessStreet( slBusinessAddress[0] ); } /* @@ -1414,26 +1442,26 @@ void ContactEditor::saveEntry() { */ if (hasCity) { - ent.setHomeCity( (*slHomeAddress)[3] ); - ent.setBusinessCity( (*slBusinessAddress)[3] ); + ent.setHomeCity( slHomeAddress[3] ); + ent.setBusinessCity( slBusinessAddress[3] ); } if (hasState) { - ent.setHomeState( (*slHomeAddress)[4] ); - ent.setBusinessState( (*slBusinessAddress)[4] ); + ent.setHomeState( slHomeAddress[4] ); + ent.setBusinessState( slBusinessAddress[4] ); } if (hasZip) { - ent.setHomeZip( (*slHomeAddress)[5] ); - ent.setBusinessZip( (*slBusinessAddress)[5] ); + ent.setHomeZip( slHomeAddress[5] ); + ent.setBusinessZip( slBusinessAddress[5] ); } - + if (hasCountry) { - ent.setHomeCountry( (*slHomeAddress)[6] ); - ent.setBusinessCountry( (*slBusinessAddress)[6] ); + ent.setHomeCountry( slHomeAddress[6] ); + ent.setBusinessCountry( slBusinessAddress[6] ); } QStringList::ConstIterator it; QListIterator<QLineEdit> itLE( listValue ); - for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { + for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { if ( *it == "Department" ) ent.setDepartment( (*itLE)->text() ); @@ -1472,5 +1500,5 @@ void ContactEditor::saveEntry() { QStringList::ConstIterator itV; - for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { + for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { if ( *it == "Business Phone" || *it == "Work Phone" ) @@ -1549,5 +1577,5 @@ void ContactEditor::saveEntry() { } - + int gender = cmbGender->currentItem(); ent.setGender( QString::number( gender ) ); diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index a58a860..4f3b56e 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h @@ -51,5 +51,5 @@ class QLabel; class ContactEditor : public QDialog { Q_OBJECT - + public: ContactEditor( const Contact &entry, @@ -79,5 +79,5 @@ class ContactEditor : public QDialog { void cleanupFields(); QString parseName( QString fullName, int type ); - + private slots: void slotChooser1Change( const QString &textChanged ); @@ -110,11 +110,11 @@ class ContactEditor : public QDialog { QList<QLabel> listName; const QValueList<int> *orderedValues; - QStringList *slOrdered; - QStringList *slDynamicEntries; + QStringList slOrdered; + QStringList slDynamicEntries; - QStringList *slHomeAddress; - QStringList *slBusinessAddress; - QStringList *slChooserNames; - QStringList *slChooserValues; + QStringList slHomeAddress; + QStringList slBusinessAddress; + QStringList slChooserNames; + QStringList slChooserValues; QMultiLineEdit *txtNote; @@ -144,5 +144,5 @@ class ContactEditor : public QDialog { QComboBox *cmbFileAs; CategorySelect *cmbCat; - + QScrollView *svAddress; QLineEdit *txtAddress; |