summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/contacteditor.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/addressbook/contacteditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp605
1 files changed, 118 insertions, 487 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
@@ -18,17 +18,20 @@
* is made to operate exactly in interface with the exception of name.
*
*/
#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>
#include <qlayout.h>
#include <qlineedit.h>
@@ -37,12 +40,15 @@
#include <qtoolbutton.h>
#include <qpushbutton.h>
#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 );
// helper functions, convert our comma delimited list to proper
// file format...
@@ -51,315 +57,46 @@ void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
// helper convert from file format to comma delimited...
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 );
- slChooserValues.append( "" );
- //slDynamicEntries->remove( it );
- continue;
- }
-
- if ( (*it) == "Home Phone" ) {
- trlChooserNames.append( tr( "Home Phone" ) );
- slChooserNames.append( *it );
- slChooserValues.append( "" );
- //slDynamicEntries->remove( it );
- continue;
- }
+ trlChooserNames = OContactFields::trphonefields();
+ slChooserNames = OContactFields::untrphonefields();
+ slDynamicEntries = OContactFields::untrdetailsfields();
+ trlDynamicEntries = OContactFields::trdetailsfields();
+ for (i = 0; i < slChooserNames.count(); i++)
+ slChooserValues.append("");
-/*
- 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 );
vb->addWidget( tabMain );
@@ -417,22 +154,14 @@ void ContactEditor::init() {
gl->addWidget( cmbFileAs, 6, 1 );
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();
- }
+ labCat->show();
+ cmbCat->show();
btnNote = new QPushButton( tr( "Notes..." ), container );
gl->addWidget( btnNote, 8, 1 );
tabMain->insertTab( tabViewport, tr( "General" ) );
@@ -456,23 +185,13 @@ void ContactEditor::init() {
gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 );
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 );
l = new QLabel( tr( "State" ), container );
@@ -733,42 +452,57 @@ void ContactEditor::init() {
gl = new QGridLayout( container, 1, 2, 2, 4 );
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
l = new QLabel( tr("Gender"), container );
gl->addWidget( l, counter, 0 );
@@ -779,22 +513,27 @@ void ContactEditor::init() {
gl->addWidget( cmbGender, counter, 1 );
++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" ) );
dlgNote = new QDialog( this, "Note Dialog", TRUE );
dlgNote->setCaption( tr("Enter Note") );
@@ -875,40 +614,14 @@ void ContactEditor::init() {
connect( cmbChooserField4, SIGNAL(activated(int)),
this, SLOT(slotCmbChooser4Change(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 );
- }
- */
+ setPersonalView ( m_personalView );
}
void ContactEditor::slotChooser1Change( const QString &textChanged ) {
int index = cmbChooserField1->currentItem();
@@ -1068,50 +781,13 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) {
cmbFileAs->insertItem( parseName( textChanged, 1 ) );
cmbFileAs->insertItem( parseName( textChanged, 2 ) );
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() {
if ( isEmpty() ) {
@@ -1133,25 +809,25 @@ 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) );
}
dlgName->showMaximized();
if ( dlgName->exec() ) {
tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text();
txtFullName->setText( tmpName.simplifyWhiteSpace() );
slotFullNameChange( txtFullName->text() );
- useFullName = FALSE;
+ useFullName = false;
}
}
void ContactEditor::setNameFocus() {
@@ -1358,44 +1034,40 @@ 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) = "";
}
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( "" );
- }
-
+ QListIterator<QLineEdit> itLV( listValue );
+ for ( ; itLV.current(); ++itLV ) {
+ (*itLV)->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("");
@@ -1403,16 +1075,15 @@ 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() );
QString *tmpString = new QString;
@@ -1420,59 +1091,49 @@ void ContactEditor::setEntry( const OContact &entry ) {
+ " " + ent.lastName() + " " + ent.suffix();
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" )
(*itLE)->setText( ent.company() );
@@ -1586,13 +1247,16 @@ void ContactEditor::setEntry( const OContact &entry ) {
slotCmbChooser2Change( cmbChooserField2->currentItem() );
slotCmbChooser3Change( cmbChooserField3->currentItem() );
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() );
} else
birthdayButton->setText( tr ("Unknown") );
@@ -1604,83 +1268,69 @@ void ContactEditor::setEntry( const OContact &entry ) {
anniversaryButton->setText( tr ("Unknown") );
}
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;
-}
-
- /*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() );
+ useFullName = false;
+ }
- //}
+ 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" )
ent.setCompany( (*itLE)->text() );
@@ -1704,84 +1354,46 @@ void ContactEditor::saveEntry() {
if ( *it == "Children" )
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;
parseEmailFrom( *itV, defaultmail, allemail );
// ent.clearEmails();
ent.setDefaultEmail( defaultmail );
ent.setEmails( allemail );
}
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" ) )
ent.setBusinessWebpage( *itV );
@@ -1872,19 +1484,24 @@ static inline bool constainsWhiteSpace( const QString &str )
return FALSE;
}
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();
-
+ labCat->show();
}
}
void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day)
{
QDate date;
@@ -1899,6 +1516,20 @@ void ContactEditor::slotBirthdayDateChanged( int year, int month, int day)
QDate date;
date.setYMD( year, month, 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();
+}