summaryrefslogtreecommitdiff
authortux_mike <tux_mike>2002-04-02 02:16:45 (UTC)
committer tux_mike <tux_mike>2002-04-02 02:16:45 (UTC)
commit44bfa84cc6d9bcd828f0b08c7bf59dde58dd5288 (patch) (side-by-side diff)
tree75ff5b49b30c27d927f5d170c2d9e60e56af5e5b
parentf830e73250189b0c9ca06df437c04d1c29e81359 (diff)
downloadopie-44bfa84cc6d9bcd828f0b08c7bf59dde58dd5288.zip
opie-44bfa84cc6d9bcd828f0b08c7bf59dde58dd5288.tar.gz
opie-44bfa84cc6d9bcd828f0b08c7bf59dde58dd5288.tar.bz2
Fixed annoying bug with the City field always being the home city... sorry :)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp34
1 files changed, 1 insertions, 33 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 6d92ac3..0e752ca 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -436,306 +436,274 @@ void ContactEditor::init() {
gl->addWidget( txtMiddleName, 1, 1 );
l = new QLabel( tr("Last Name"), dlgName );
gl->addWidget( l, 2, 0 );
txtLastName = new QLineEdit( dlgName );
gl->addWidget( txtLastName, 2, 1 );
l = new QLabel( tr("Suffix"), dlgName );
gl->addWidget( l, 3, 0 );
txtSuffix = new QLineEdit( dlgName );
gl->addWidget( txtSuffix, 3, 1 );
cmbChooserField1->insertStringList( *slChooserNames );
cmbChooserField2->insertStringList( *slChooserNames );
cmbChooserField3->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( 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( 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 );
}
*/
}
void ContactEditor::slotChooser1Change( const QString &textChanged ) {
int index = cmbChooserField1->currentItem();
(*slChooserValues)[index] = textChanged;
}
void ContactEditor::slotChooser2Change( const QString &textChanged ) {
int index = cmbChooserField2->currentItem();
(*slChooserValues)[index] = textChanged;
}
void ContactEditor::slotChooser3Change( const QString &textChanged ) {
int index = cmbChooserField3->currentItem();
(*slChooserValues)[index] = textChanged;
}
void ContactEditor::slotAddressChange( const QString &textChanged ) {
- qDebug((*slBusinessAddress)[0]);
- qDebug((*slHomeAddress)[0]);
- qDebug(textChanged);
if ( cmbAddress->currentItem() == 0 ) {
(*slBusinessAddress)[0] = textChanged;
} else {
(*slHomeAddress)[0] = textChanged;
}
}
void ContactEditor::slotAddress2Change( const QString &textChanged ) {
- qDebug((*slBusinessAddress)[1]);
- qDebug((*slHomeAddress)[1]);
- qDebug(textChanged);
-
if ( cmbAddress->currentItem() == 0 ) {
(*slBusinessAddress)[1] = textChanged;
} else {
(*slHomeAddress)[1] = textChanged;
}
}
void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
- qDebug((*slBusinessAddress)[2]);
- qDebug((*slHomeAddress)[2]);
- qDebug(textChanged);
if ( cmbAddress->currentItem() == 0 ) {
(*slBusinessAddress)[2] = textChanged;
} else {
(*slHomeAddress)[2] = textChanged;
}
}
void ContactEditor::slotCityChange( const QString &textChanged ) {
- qDebug((*slBusinessAddress)[3]);
- qDebug((*slHomeAddress)[3]);
- qDebug(textChanged);
if ( cmbAddress->currentItem() == 0 ) {
(*slBusinessAddress)[3] = textChanged;
} else {
(*slHomeAddress)[3] = textChanged;
}
}
void ContactEditor::slotStateChange( const QString &textChanged ) {
- qDebug((*slBusinessAddress)[4]);
- qDebug((*slHomeAddress)[4]);
- qDebug(textChanged);
if ( cmbAddress->currentItem() == 0 ) {
(*slBusinessAddress)[4] = textChanged;
} else {
(*slHomeAddress)[4] = textChanged;
}
}
void ContactEditor::slotZipChange( const QString &textChanged ) {
- qDebug((*slBusinessAddress)[5]);
- qDebug((*slHomeAddress)[5]);
- qDebug(textChanged);
if ( cmbAddress->currentItem() == 0 ) {
(*slBusinessAddress)[5] = textChanged;
} else {
(*slHomeAddress)[5] = textChanged;
}
}
void ContactEditor::slotCountryChange( const QString &textChanged ) {
- qDebug((*slBusinessAddress)[6]);
- qDebug((*slHomeAddress)[6]);
- qDebug(textChanged);
if ( cmbAddress->currentItem() == 0 ) {
(*slBusinessAddress)[6] = textChanged;
} else {
(*slHomeAddress)[6] = textChanged;
}
}
void ContactEditor::slotCmbChooser1Change( int index ) {
txtChooserField1->setText( (*slChooserValues)[index] );
}
void ContactEditor::slotCmbChooser2Change( int index ) {
txtChooserField2->setText( (*slChooserValues)[index] );
}
void ContactEditor::slotCmbChooser3Change( int index ) {
txtChooserField3->setText( (*slChooserValues)[index] );
}
void ContactEditor::slotAddressTypeChange( int index ) {
- qDebug((*slBusinessAddress)[0]);
- qDebug((*slBusinessAddress)[1]);
- qDebug((*slBusinessAddress)[2]);
-qDebug((*slBusinessAddress)[3]);
-qDebug((*slBusinessAddress)[4]);
-qDebug((*slBusinessAddress)[5]);
-qDebug((*slBusinessAddress)[6]);
-
-
-
if ( index == 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] );
QLineEdit *txtTmp = cmbCountry->lineEdit();
txtTmp->setText( (*slBusinessAddress)[6] );
} else {
txtAddress->setText( (*slHomeAddress)[0] );
//txtAddress2->setText( (*slHomeAddress)[1] );
//txtPOBox->setText( (*slHomeAddress)[2] );
txtCity->setText( (*slHomeAddress)[3] );
txtState->setText( (*slHomeAddress)[4] );
txtZip->setText( (*slHomeAddress)[5] );
QLineEdit *txtTmp = cmbCountry->lineEdit();
txtTmp->setText( (*slHomeAddress)[6] );
}
}
void ContactEditor::slotFullNameChange( const QString &textChanged ) {
int index = cmbFileAs->currentItem();
cmbFileAs->clear();
cmbFileAs->insertItem( parseName( textChanged, 0 ) );
cmbFileAs->insertItem( parseName( textChanged, 1 ) );
cmbFileAs->insertItem( parseName( textChanged, 2 ) );
cmbFileAs->insertItem( parseName( textChanged, 3 ) );
cmbFileAs->setCurrentItem( index );
useFullName = TRUE;
}
void ContactEditor::loadFields() {
QStringList::ConstIterator it;
QListIterator<QLabel> lit( listName );
for ( it = slDynamicEntries->begin(); *lit; ++lit, ++it) {
(*lit)->setText( *it );
}
}
void ContactEditor::accept() {
if ( isEmpty() ) {
cleanupFields();
reject();
} else {
saveEntry();
cleanupFields();
QDialog::accept();
}
}
void ContactEditor::slotNote() {
dlgNote->showMaximized();
if ( !dlgNote->exec() ) {
txtNote->setText( ent.notes() );
}
}
void ContactEditor::slotName() {
if (useFullName = TRUE) {
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) );
}
dlgName->showMaximized();
if ( dlgName->exec() ) {
txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() );
slotFullNameChange( txtFullName->text() );
useFullName = FALSE;
}
}
void ContactEditor::setNameFocus() {
txtFullName->setFocus();
}
@@ -909,193 +877,193 @@ QString ContactEditor::parseName( const QString fullName, int type ) {
case NAME_S:
return strSuffix;
}
}
void ContactEditor::cleanupFields() {
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] = "";
}
QStringList::ConstIterator cit;
QListIterator<QLineEdit> itLE( listValue );
for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) {
(*itLE)->setText( "" );
}
txtFirstName->setText("");
txtMiddleName->setText("");
txtLastName->setText("");
txtSuffix->setText("");
txtNote->setText("");
txtFullName->setText("");
txtJobTitle->setText("");
txtOrganization->setText("");
txtChooserField1->setText("");
txtChooserField2->setText("");
txtChooserField3->setText("");
txtAddress->setText("");
//txtAddress2->setText("");
txtCity->setText("");
//txtPOBox->setText("");
txtState->setText("");
txtZip->setText("");
QLineEdit *txtTmp = cmbCountry->lineEdit();
txtTmp->setText("");
txtTmp = cmbFileAs->lineEdit();
txtTmp->setText("");
}
void ContactEditor::setEntry( const Contact &entry ) {
cleanupFields();
ent = entry;
useFullName = FALSE;
txtFirstName->setText( ent.firstName() );
txtMiddleName->setText( ent.middleName() );
txtLastName->setText( ent.lastName() );
txtSuffix->setText( ent.suffix() );
QString *tmpString = new QString;
*tmpString = ent.firstName() + " " + ent.middleName() +
+ " " + ent.lastName() + " " + ent.suffix();
txtFullName->setText( tmpString->simplifyWhiteSpace() );
cmbFileAs->setEditText( ent.fileAs() );
if (hasTitle)
txtJobTitle->setText( ent.jobTitle() );
if (hasCompany)
txtOrganization->setText( ent.company() );
if (hasNotes)
txtNote->setText( ent.notes() );
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) {
(*slHomeAddress)[3] = ent.homeCity();
- (*slBusinessAddress)[3] = ent.homeCity();
+ (*slBusinessAddress)[3] = ent.businessCity();
}
if (hasState) {
(*slHomeAddress)[4] = ent.homeState();
(*slBusinessAddress)[4] = ent.businessState();
}
if (hasZip) {
(*slHomeAddress)[5] = ent.homeZip();
(*slBusinessAddress)[5] = ent.businessZip();
}
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) {
if ( *it == "Department" )
(*itLE)->setText( ent.department() );
if ( *it == "Company" )
(*itLE)->setText( ent.company() );
if ( *it == "Office" )
(*itLE)->setText( ent.office() );
if ( *it == "Profession" )
(*itLE)->setText( ent.profession() );
if ( *it == "Assistant" )
(*itLE)->setText( ent.assistant() );
if ( *it == "Manager" )
(*itLE)->setText( ent.manager() );
if ( *it == "Spouse" )
(*itLE)->setText( ent.spouse() );
if ( *it == "Birthday" )
(*itLE)->setText( ent.birthday() );
if ( *it == "Anniversary" )
(*itLE)->setText( ent.anniversary() );
if ( *it == "Nickname" )
(*itLE)->setText( ent.nickname() );
if ( *it == "Children" )
(*itLE)->setText( ent.children() );
}
QStringList::Iterator itV;
for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) {
if ( *it == "Business Phone" || *it == "Work Phone" )
*itV = ent.businessPhone();
/*
if ( *it == "Business 2 Phone" )
*itV = ent.business2Phone();
*/
if ( *it == "Business Fax" || *it == "Work Fax" )
*itV = ent.businessFax();
if ( *it == "Business Mobile" || *it == "work Mobile" )
*itV = ent.businessMobile();
/*
if ( *it == "Company Phone" )
*itV = ent.companyPhone();
*/
if ( *it == "Default Email" )
*itV = ent.defaultEmail();
if ( *it == "Emails" )
*itV = ent.emails();
if ( *it == "Home Phone" )
*itV = ent.homePhone();
/*
if ( *it == "Home 2 Phone" )
*itV = ent.home2Phone();
*/
if ( *it == "Home Fax" )
*itV = ent.homeFax();
if ( *it == "Home Mobile" )
*itV = ent.homeMobile();
/*
if ( *it == "Car Phone" )
*itV = ent.carPhone();
if ( *it == "ISDN Phone" )
*itV = ent.ISDNPhone();