-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 254cff7..1b83308 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -34,32 +34,34 @@ #include <qlabel.h> #include <qtabwidget.h> #include <qlayout.h> #include <qlineedit.h> #include <qmultilineedit.h> #include <qscrollview.h> #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> +#include <assert.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... void parseEmailFrom( const QString &txt, QString &strDefaultEmail, QString &strAll ); // helper convert from file format to comma delimited... void parseEmailTo( const QString &strDefaultEmail, const QString &strOtherEmail, QString &strBack ); ContactEditor::ContactEditor( const OContact &entry, QWidget *parent, const char *name, WFlags fl ) @@ -81,32 +83,51 @@ void ContactEditor::init() { useFullName = true; uint i = 0; QStringList trlChooserNames; for (i = 0; i <= 6; i++) { slHomeAddress.append( "" ); slBusinessAddress.append( "" ); } trlChooserNames = OContactFields::trphonefields( false ); slChooserNames = OContactFields::untrphonefields( false ); slDynamicEntries = OContactFields::untrdetailsfields( false ); trlDynamicEntries = OContactFields::trdetailsfields( false ); + + // Ok, we have to remove elements from the list of dynamic entries + // which are now stored in special (not dynamic) widgets.. + // 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 ); @@ -1163,55 +1184,60 @@ void ContactEditor::setEntry( const OContact &entry ) { 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(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { + + qWarning(" Filling dynamic Field: %s", (*it).latin1() ); + 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 == "Nickname" ) + if ( *it == "Nickname" ){ + qWarning("**** Nichname: %s", ent.nickname().latin1() ); (*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" ) ) |