author | eilers <eilers> | 2002-11-18 09:38:28 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-11-18 09:38:28 (UTC) |
commit | 8401def65aa4f19d91873bc57a3dcf25c358c490 (patch) (side-by-side diff) | |
tree | 3e64bd2d1b6f92c77304cc2d2c0fd06b07d718e5 /core/pim/addressbook/contacteditor.cpp | |
parent | 4d0773414a0fb59e53f30d4d2363f73304f474dc (diff) | |
download | opie-8401def65aa4f19d91873bc57a3dcf25c358c490.zip opie-8401def65aa4f19d91873bc57a3dcf25c358c490.tar.gz opie-8401def65aa4f19d91873bc57a3dcf25c358c490.tar.bz2 |
Back to main tree. Back to main tree.
Back to main tree. Waiting for moving to feature freeze ..
Diffstat (limited to 'core/pim/addressbook/contacteditor.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 583 |
1 files changed, 107 insertions, 476 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index e034b35..5a7bf1a 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -20,13 +20,16 @@ */ #include "contacteditor.h" #include "addresspicker.h" +#include "ocontactfields.h" #include <qpe/categoryselect.h> #include <qpe/qpeapplication.h> #include <qpe/qpedialog.h> #include <qpe/timeconversion.h> +#include <opie/ocontact.h> +#include <qpe/resource.h> #include <qcombobox.h> #include <qlabel.h> #include <qtabwidget.h> @@ -39,8 +42,11 @@ #include <qmainwindow.h> #include <qvaluelist.h> #include <qpopupmenu.h> #include <qlistbox.h> +#include <qhbox.h> +#include <qaction.h> +#include <qiconset.h> static inline bool containsAlphaNum( const QString &str ); static inline bool constainsWhiteSpace( const QString &str ); @@ -53,311 +59,42 @@ void parseEmailFrom( const QString &txt, QString &strDefaultEmail, void parseEmailTo( const QString &strDefaultEmail, const QString &strOtherEmail, QString &strBack ); ContactEditor::ContactEditor( const OContact &entry, - const QValueList<int> *newOrderedValues, - QStringList *slNewOrdered, QWidget *parent, const char *name, WFlags fl ) : QDialog( parent, name, TRUE, fl ), - orderedValues( newOrderedValues ), - slOrdered( *slNewOrdered ), m_personalView ( false ) { init(); - initMap(); setEntry( entry ); - qDebug("finish"); } ContactEditor::~ContactEditor() { } void ContactEditor::init() { - useFullName = TRUE; + useFullName = true; - int i = 0; -/** SHut up and stop leaking - slHomeAddress = new QStringList; - slBusinessAddress = new QStringList; - slChooserNames = new QStringList; - slChooserValues = new QStringList; - - slDynamicEntries = new QStringList; -*/ - //*slDynamicEntries = *slOrdered; + uint i = 0; QStringList trlChooserNames; for (i = 0; i <= 6; i++) { slHomeAddress.append( "" ); slBusinessAddress.append( "" ); } - { - hasGender = FALSE; - hasTitle = FALSE; - hasCompany = FALSE; - hasNotes = FALSE; - hasStreet = FALSE; - hasStreet2 = FALSE; - hasPOBox = FALSE; - hasCity = FALSE; - hasState = FALSE; - hasZip = FALSE; - hasCountry = FALSE; - - QStringList::ConstIterator it = slOrdered.begin(); - - for ( i = 0; it != slOrdered.end(); i++, ++it ) { - - if ( (*it) == "Business Fax" ) { - trlChooserNames.append( tr( "Business Fax" ) ); - slChooserNames.append( *it ); - slChooserValues.append("" ); - //slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Home Fax" ) { - trlChooserNames.append( tr( "Home Fax" ) ); - slChooserNames.append( *it ); - slChooserValues.append("" ); - //slDynamicEntries->remove( it ); - continue; - } - - - if ( (*it) == "Business Phone" ) { - trlChooserNames.append( tr( "Business Phone" ) ); - slChooserNames.append( *it ); + trlChooserNames = OContactFields::trphonefields(); + slChooserNames = OContactFields::untrphonefields(); + slDynamicEntries = OContactFields::untrdetailsfields(); + trlDynamicEntries = OContactFields::trdetailsfields(); + for (i = 0; i < slChooserNames.count(); i++) slChooserValues.append( "" ); - //slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Home Phone" ) { - trlChooserNames.append( tr( "Home Phone" ) ); - slChooserNames.append( *it ); - slChooserValues.append( "" ); - //slDynamicEntries->remove( it ); - continue; - } - -/* - if ( (*it).right( 2 ) == tr( "IM" ) ) { - slChooserNames.append( *it ); - slChooserValues.append( "" ); - //slDynamicEntries->remove( it ); - continue; - } */ - - if ( (*it) == "Business Mobile" ) { - trlChooserNames.append( tr( "Business Mobile" ) ); - slChooserNames.append( *it ); - slChooserValues.append( "" ); - //slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Home Mobile" ) { - trlChooserNames.append( tr( "Home Mobile" ) ); - slChooserNames.append( *it ); - slChooserValues.append( "" ); - //slDynamicEntries->remove( it ); - continue; - } - - - if ( (*it) == "Business WebPage" ) { - trlChooserNames.append( tr( "Business WebPage" ) ); - slChooserNames.append( *it ); - slChooserValues.append( "" ); - //slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Home Web Page" ) { - trlChooserNames.append( tr( "Home Web Page" ) ); - slChooserNames.append( *it ); - slChooserValues.append( "" ); - //slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Business Pager" ) { - trlChooserNames.append( tr( "Business Pager" ) ); - slChooserNames.append( *it ); - slChooserValues.append( "" ); - //slDynamicEntries->remove( it ); - continue; - } - - if ( *it == "Default Email" ) { - trlChooserNames.append( tr( "Default Email" ) ); - slChooserNames.append( *it ); - slChooserValues.append( "" ); - //slDynamicEntries->remove( it ); - continue; - } - - if ( *it == "Emails" ) { - trlChooserNames.append( tr( "Emails" ) ); - slChooserNames.append( *it ); - slChooserValues.append( "" ); - //slDynamicEntries->remove( it ); - continue; - } - - if ( *it == "Name Title" || - *it == "First Name" || - *it == "Middle Name" || - *it == "Last Name" || - *it == "File As" || - *it == "Default Email" || - *it == "Emails" || - *it == "Groups" || - *it == "Anniversary" || - *it == "Birthday" ) - continue; - - if ( *it == "Name Title" ) { - //slDynamicEntries->remove( it ); - continue; - } - - if ( *it == "First Name" ) { - // slDynamicEntries->remove( it ); - continue; - } - - if ( *it == "Middle Name" ) { - // slDynamicEntries->remove( it ); - continue; - } - - if ( *it == "Last Name" ) { - // slDynamicEntries->remove( it ); - continue; - } - - if ( *it == "Suffix" ) { - // slDynamicEntries->remove( it ); - continue; - } - - if ( *it == "File As" ) { - // slDynamicEntries->remove( it ); - continue; - } - if ( *it == "Gender" ) { - hasGender = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - if ( *it == "Job Title" ) { - hasTitle = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - if ( ( *it == "Company") || (*it == "Organization" ) ) { - hasCompany = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - if ( *it == "Notes" ) { - hasNotes = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - if ( *it == "Groups" ) { - // slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Business Street" ) { - hasStreet = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Home Street" ) { - hasStreet = TRUE; - // slDynamicEntries->remove( it ); - continue; - } -/* - if ( (*it).right( 8 ) == tr( "Street 2" ) ) { - hasStreet2 = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { - hasPOBox = TRUE; - // slDynamicEntries->remove( it ); - continue; - } */ - - if ( (*it) == "Business City" ) { - hasCity = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Business State" ) { - hasState = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Business Zip" ) { - hasZip = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Business Country" ) { - hasCountry = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Home City" ) { - hasCity = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Home State" ) { - hasState = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Home Zip" ) { - hasZip = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - if ( (*it) == "Home Country" ) { - hasCountry = TRUE; - // slDynamicEntries->remove( it ); - continue; - } - - slDynamicEntries.append( *it ); - } - } QVBoxLayout *vb = new QVBoxLayout( this ); tabMain = new QTabWidget( this ); @@ -419,18 +156,10 @@ void ContactEditor::init() { labCat = new QLabel( tr( "Category" ), container ); gl->addWidget( labCat, 7, 0 ); cmbCat = new CategorySelect( container ); gl->addWidget( cmbCat, 7, 1 ); - - // We don't need categories for the personal view - if ( m_personalView ){ - qWarning("Disable Category.."); - labCat->hide(); - cmbCat->hide(); - } else { labCat->show(); cmbCat->show(); - } btnNote = new QPushButton( tr( "Notes..." ), container ); gl->addWidget( btnNote, 8, 1 ); @@ -458,19 +187,9 @@ void ContactEditor::init() { l = new QLabel( tr( "Address" ), container ); gl->addWidget( l, 1, 0 ); txtAddress = new QLineEdit( container ); gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); -/* - l = new QLabel( tr( "Address 2" ), container ); - gl->addWidget( l, 2, 0 ); - txtAddress2 = new QLineEdit( container ); - gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 ); - l = new QLabel( tr( "P.O. Box" ), container ); - gl->addWidget( l, 3, 0 ); - txtPOBox = new QLineEdit( container ); - gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 ); -*/ l = new QLabel( tr( "City" ), container ); gl->addWidget( l, 2, 0 ); txtCity = new QLineEdit( container ); gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); @@ -735,38 +454,53 @@ void ContactEditor::init() { int counter = 0; // Birthday + QHBox* hBox = new QHBox( container ); l = new QLabel( tr("Birthday"), container ); gl->addWidget( l, counter, 0 ); QPopupMenu* m1 = new QPopupMenu( container ); birthdayPicker = new DateBookMonth( m1, 0, TRUE ); m1->insertItem( birthdayPicker ); - birthdayButton= new QToolButton( container, "buttonStart" ); + birthdayButton= new QToolButton( hBox, "buttonStart" ); birthdayButton->setPopup( m1 ); birthdayButton->setPopupDelay(0); - gl->addWidget( birthdayButton, counter , 1 ); + + QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), + tr( "Delete" ), + hBox, 0 ); + + gl->addWidget( hBox, counter , 1 ); + connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); + connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); ++counter; // Anniversary + hBox = new QHBox( container ); l = new QLabel( tr("Anniversary"), container ); gl->addWidget( l, counter, 0 ); m1 = new QPopupMenu( container ); anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); m1->insertItem( anniversaryPicker ); - anniversaryButton= new QToolButton( container, "buttonStart" ); + anniversaryButton= new QToolButton( hBox, "buttonStart" ); anniversaryButton->setPopup( m1 ); anniversaryButton->setPopupDelay(0); - gl->addWidget( anniversaryButton, counter , 1 ); + + deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), + tr( "Delete" ), + hBox, 0 ); + gl->addWidget( hBox, counter , 1 ); + connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); + connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); ++counter; // Gender @@ -781,18 +515,23 @@ void ContactEditor::init() { ++counter; // Create Labels and lineedit fields for every dynamic entry QStringList::ConstIterator it = slDynamicEntries.begin(); - for (i = counter; it != slDynamicEntries.end(); i++, ++it) { - l = new QLabel( QString::null , container ); + QStringList::ConstIterator trit = trlDynamicEntries.begin(); + for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) { + + if (((*it) == "Anniversary") || + ((*it) == "Birthday")|| ((*it) == "Gender")) continue; + + l = new QLabel( (*it).utf8() , container ); listName.append( l ); gl->addWidget( l, i, 0 ); QLineEdit *e = new QLineEdit( container ); listValue.append( e ); gl->addWidget( e, i, 1); } // Fill labels with names.. - loadFields(); + // loadFields(); tabMain->insertTab( tabViewport, tr( "Details" ) ); @@ -877,36 +616,10 @@ void ContactEditor::init() { connect( cmbAddress, SIGNAL(activated(int)), this, SLOT(slotAddressTypeChange(int)) ); new QPEDialogListener(this); -} -void ContactEditor::initMap() -{ - /* - // since the fields and the XML fields exist, create a map - // between them... - Config cfg1( "AddressBook" ); - Config cfg2( "AddressBook" ); - QString strCfg1, - strCfg2; - int i; - - // This stuff better exist... - cfg1.setGroup( "AddressFields" ); -o cfg2.setGroup( "XMLFields" ); - i = 0; - strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); - strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), - QString::null ); - while ( !strCfg1.isNull() && !strCfg2.isNull() ) { - mapField.insert( strCfg1, strCfg2 ); - strCfg1 = cfg1.readEntry( "Field" + QString::number(i), - QString::null ); - strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), - QString::null ); - } - */ + setPersonalView ( m_personalView ); } void ContactEditor::slotChooser1Change( const QString &textChanged ) { @@ -1070,46 +783,9 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) { cmbFileAs->insertItem( parseName( textChanged, 3 ) ); cmbFileAs->setCurrentItem( index ); - useFullName = TRUE; - -} - -// Loads the detail fields -void ContactEditor::loadFields() { - - QStringList::ConstIterator it; - QListIterator<QLabel> lit( listName ); - for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { - - if ( *it == "Department" ) - (*lit)->setText( tr( "Department" ) ); - - if ( *it == "Company" ) - (*lit)->setText( tr( "Company" ) ); - - if ( *it == "Office" ) - (*lit)->setText( tr( "Office" ) ); - - if ( *it == "Profession" ) - (*lit)->setText( tr( "Profession" ) ); - - if ( *it == "Assistant" ) - (*lit)->setText( tr( "Assistant" ) ); - - if ( *it == "Manager" ) - (*lit)->setText( tr( "Manager" ) ); - - if ( *it == "Spouse" ) - (*lit)->setText( tr( "Spouse" ) ); - - if ( *it == "Nickname" ) - (*lit)->setText( tr( "Nickname" ) ); - - if ( *it == "Children" ) - (*lit)->setText( tr( "Children" ) ); - } + useFullName = true; } void ContactEditor::accept() { @@ -1135,9 +811,9 @@ void ContactEditor::slotNote() { void ContactEditor::slotName() { QString tmpName; - if (useFullName == TRUE) { + if (useFullName) { txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); @@ -1147,9 +823,9 @@ void ContactEditor::slotName() { tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); txtFullName->setText( tmpName.simplifyWhiteSpace() ); slotFullNameChange( txtFullName->text() ); - useFullName = FALSE; + useFullName = false; } } @@ -1360,9 +1036,8 @@ QString ContactEditor::parseName( const QString fullName, int type ) { return QString::null; } void ContactEditor::cleanupFields() { - QStringList::Iterator it = slChooserValues.begin(); for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { (*it) = ""; } @@ -1371,12 +1046,11 @@ void ContactEditor::cleanupFields() { slHomeAddress[i] = ""; slBusinessAddress[i] = ""; } - QStringList::ConstIterator cit; - QListIterator<QLineEdit> itLE( listValue ); - for ( cit = slDynamicEntries.begin(); cit != slDynamicEntries.end(); ++cit, ++itLE) { - (*itLE)->setText( "" ); + QListIterator<QLineEdit> itLV( listValue ); + for ( ; itLV.current(); ++itLV ) { + (*itLV)->setText( "" ); } txtFirstName->setText(""); txtMiddleName->setText(""); @@ -1389,11 +1063,9 @@ void ContactEditor::cleanupFields() { txtChooserField1->setText(""); txtChooserField2->setText(""); txtChooserField3->setText(""); txtAddress->setText(""); - //txtAddress2->setText(""); txtCity->setText(""); - //txtPOBox->setText(""); txtState->setText(""); txtZip->setText(""); QLineEdit *txtTmp = cmbCountry->lineEdit(); txtTmp->setText(""); @@ -1405,12 +1077,11 @@ void ContactEditor::cleanupFields() { void ContactEditor::setEntry( const OContact &entry ) { cleanupFields(); - ent = entry; - useFullName = FALSE; + useFullName = false; txtFirstName->setText( ent.firstName() ); txtMiddleName->setText( ent.middleName() ); txtLastName->setText( ent.lastName() ); txtSuffix->setText( ent.suffix() ); @@ -1422,55 +1093,45 @@ void ContactEditor::setEntry( const OContact &entry ) { txtFullName->setText( tmpString->simplifyWhiteSpace() ); cmbFileAs->setEditText( ent.fileAs() ); - if (hasTitle) + // if (hasTitle) txtJobTitle->setText( ent.jobTitle() ); - if (hasCompany) + // if (hasCompany) txtOrganization->setText( ent.company() ); - if (hasNotes) + // if (hasNotes) txtNote->setText( ent.notes() ); - if (hasStreet) { + // if (hasStreet) { slHomeAddress[0] = ent.homeStreet(); slBusinessAddress[0] = ent.businessStreet(); - } -/* - if (hasStreet2) { - (*slHomeAddress)[1] = ent.homeStreet2(); - (*slBusinessAddress)[1] = ent.businessStreet2(); - } + // } - if (hasPOBox) { - (*slHomeAddress)[2] = ent.homePOBox(); - (*slBusinessAddress)[2] = ent.businessPOBox(); - } -*/ - if (hasCity) { +// if (hasCity) { slHomeAddress[3] = ent.homeCity(); slBusinessAddress[3] = ent.businessCity(); - } +//} - if (hasState) { +//if (hasState) { slHomeAddress[4] = ent.homeState(); slBusinessAddress[4] = ent.businessState(); - } +//} - if (hasZip) { +//if (hasZip) { slHomeAddress[5] = ent.homeZip(); slBusinessAddress[5] = ent.businessZip(); - } +//} - if (hasCountry) { +//if (hasCountry) { 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(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { if ( *it == "Department" ) (*itLE)->setText( ent.department() ); if ( *it == "Company" ) @@ -1588,9 +1249,12 @@ void ContactEditor::setEntry( const OContact &entry ) { slotAddressTypeChange( cmbAddress->currentItem() ); // loadFields(); :SX - + updateDatePicker(); +} +void ContactEditor::updateDatePicker() +{ // Set DatePicker if ( !ent.birthday().isNull() ){ birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); birthdayPicker->setDate( ent.birthday() ); @@ -1606,79 +1270,65 @@ void ContactEditor::setEntry( const OContact &entry ) { } void ContactEditor::saveEntry() { - if ( useFullName == TRUE ) { + if ( useFullName ) { txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); - useFullName = FALSE; + useFullName = false; } - /*if ( ent.firstName() != txtFirstName->text() || - ent.lastName != txtLastName->text() || - ent.middleName != txtMiddleName->text() ) { - */ ent.setFirstName( txtFirstName->text() ); ent.setLastName( txtLastName->text() ); ent.setMiddleName( txtMiddleName->text() ); ent.setSuffix( txtSuffix->text() ); - //} - ent.setFileAs( cmbFileAs->currentText() ); ent.setCategories( cmbCat->currentCategories() ); - if (hasTitle) + + //if (hasTitle) ent.setJobTitle( txtJobTitle->text() ); - if (hasCompany) + //if (hasCompany) ent.setCompany( txtOrganization->text() ); - if (hasNotes) +// if (hasNotes) ent.setNotes( txtNote->text() ); - if (hasStreet) { + //if (hasStreet) { ent.setHomeStreet( slHomeAddress[0] ); ent.setBusinessStreet( slBusinessAddress[0] ); - } -/* - if (hasStreet2) { - ent.setHomeStreet2( (*slHomeAddress)[1] ); - ent.setBusinessStreet2( (*slBusinessAddress)[1] ); - } + // } - if (hasPOBox) { - ent.setHomePOBox( (*slHomeAddress)[2] ); - ent.setBusinessPOBox( (*slBusinessAddress)[2] ); - } -*/ - if (hasCity) { + // if (hasCity) { ent.setHomeCity( slHomeAddress[3] ); ent.setBusinessCity( slBusinessAddress[3] ); - } + // } - if (hasState) { + // if (hasState) { ent.setHomeState( slHomeAddress[4] ); ent.setBusinessState( slBusinessAddress[4] ); - } + // } - if (hasZip) { + // if (hasZip) { ent.setHomeZip( slHomeAddress[5] ); ent.setBusinessZip( slBusinessAddress[5] ); - } + // } - if (hasCountry) { + // if (hasCountry) { 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(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { + if ( *it == "Department" ) ent.setDepartment( (*itLE)->text() ); if ( *it == "Company" ) @@ -1706,28 +1356,20 @@ void ContactEditor::saveEntry() { ent.setChildren( (*itLE)->text() ); } + QStringList::ConstIterator itV; for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) ent.setBusinessPhone( *itV ); -/* - if ( *it == tr("Business 2 Phone" ) - ent.setBusiness2Phone( *itV ); -*/ + if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) ent.setBusinessFax( *itV ); if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) ent.setBusinessMobile( *itV ); -/* - if ( *it == "Company Phone" ) - ent.setCompanyPhone( *itV ); -*/ - //if ( *it == "Default Email" ) - //ent.setDefaultEmail( *itV ); if ( *it == "Emails" ){ QString allemail; QString defaultmail; @@ -1738,48 +1380,18 @@ void ContactEditor::saveEntry() { } if ( *it == "Home Phone" ) ent.setHomePhone( *itV ); -/* - if ( *it == "Home 2 Phone" ) - ent.setHome2Phone( *itV ); -*/ + if ( *it == "Home Fax" ) ent.setHomeFax( *itV ); if ( *it == "Home Mobile" ) ent.setHomeMobile( *itV ); -/* - if ( *it == "Car Phone" ) - ent.setCarPhone( *itV ); - if ( *it == "ISDN Phone" ) - ent.setISDNPhone( *itV ); - - if ( *it == "Other Phone" ) - ent.setOtherPhone( *itV ); -*/ if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) ent.setBusinessPager( *itV ); -/* - if ( *it == "Home Pager" ) - ent.setHomePager( *itV ); - - if ( *it == "AIM IM" ) - ent.setAIMIM( *itV ); - - if ( *it == "ICQ IM" ) - ent.setICQIM( *itV ); - - if ( *it == "Jabber IM" ) - ent.setJabberIM( *itV ); - - if ( *it == "MSN IM" ) - ent.setMSNIM( *itV ); - if ( *it == "Yahoo IM" ) - ent.setYahooIM( *itV ); -*/ if ( *it == "Home Web Page" ) ent.setHomeWebpage( *itV ); if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) @@ -1874,15 +1486,20 @@ static inline bool constainsWhiteSpace( const QString &str ) void ContactEditor::setPersonalView( bool personal ) { m_personalView = personal; + + // Currently disbled due to the fact that + // show will not work... + return; + if ( personal ){ cmbCat->hide(); labCat->hide(); + } else{ cmbCat->show(); labCat->show(); - } } void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) @@ -1901,4 +1518,18 @@ void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) QString dateString = TimeString::numberDateString( date ); birthdayButton->setText( dateString ); ent.setBirthday ( date ); } + +void ContactEditor::slotRemoveBirthday() +{ + qWarning("void ContactEditor::slotRemoveBirthday()"); + ent.setBirthday( QDate() ); + updateDatePicker(); +} + +void ContactEditor::slotRemoveAnniversary() +{ + qWarning("void ContactEditor::slotRemoveAnniversary()"); + ent.setAnniversary( QDate() ); + updateDatePicker(); +} |