Diffstat (limited to 'core/pim/addressbook/abeditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/abeditor.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/core/pim/addressbook/abeditor.cpp b/core/pim/addressbook/abeditor.cpp index 6354db9..91e8722 100644 --- a/core/pim/addressbook/abeditor.cpp +++ b/core/pim/addressbook/abeditor.cpp @@ -30,49 +30,49 @@ #include <qlayout.h> #include <qlineedit.h> #include <qmultilineedit.h> #include <qscrollview.h> #include <qtoolbutton.h> #include <qpushbutton.h> #include <qmainwindow.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 ); -AbEditor::AbEditor( const Contact &entry, const QValueList<int> *newOrdered, +AbEditor::AbEditor( const OContact &entry, const QValueList<int> *newOrdered, QStringList *slNewOrdered, QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ) : QDialog( parent, name, TRUE, fl ), orderedValues( newOrdered ), slOrdered( slNewOrdered ) { init(); initMap(); setEntry( entry ); } AbEditor::~AbEditor() { } void AbEditor::init() { middleEdit = 0; QVBoxLayout *vb = new QVBoxLayout( this ); svPage = new QScrollView( this ); svPage->setHScrollBarMode( QScrollView::AlwaysOff ); vb->addWidget( svPage ); svPage->setResizePolicy( QScrollView::AutoOneFit ); svPage->setFrameStyle( QFrame::NoFrame ); @@ -161,49 +161,49 @@ void AbEditor::initMap() 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 AbEditor::loadFields() { QStringList::ConstIterator it; QListIterator<QLabel> lit( listName ); for ( it = slOrdered->begin(); *lit; ++lit, ++it ) { (*lit)->setText( *it ); } } -void AbEditor::setEntry( const Contact &entry ) +void AbEditor::setEntry( const OContact &entry ) { ent = entry; QListIterator<QLineEdit> it( listValue ); firstEdit->setText( ent.firstName() ); lastEdit->setText( ent.lastName() ); cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); // ### Fix... QValueList<int>::ConstIterator itVl; for ( itVl = orderedValues->begin(); *it && itVl != orderedValues->end(); ++itVl, ++it ) { switch( *itVl ) { case Qtopia::Title: (*it)->setText(ent.title()); break; case Qtopia::MiddleName: (*it)->setText( ent.middleName() ); break; case Qtopia::Suffix: (*it)->setText( ent.suffix() ); break; // email case Qtopia::DefaultEmail: @@ -389,54 +389,54 @@ void AbEditor::saveEntry() switch( *vlIt ) { case Qtopia::Title: ent.setTitle( it.current()->text() ); break; case Qtopia::MiddleName: ent.setMiddleName( it.current()->text() ); break; case Qtopia::Suffix: ent.setSuffix( it.current()->text() ); break; // case Qtopia::Category: // { // // QStringList slCat = QStringList::split( ";", value ); // // QValueList<int> cat; // // for ( QStringList::ConstIterator it = slCat.begin(); // // it != slCat.end(); ++it ) // // cat.append( (*it).toInt() ); // // ent.setCategories( cat ); // } // break; // email case Qtopia::DefaultEmail: case Qtopia::Emails: - parseEmailFrom( it.current()->text(), strDefaultEmail, - strOtherEmail ); - ent.setDefaultEmail( strDefaultEmail ); - ent.setEmails( strOtherEmail ); - break; - + parseEmailFrom( it.current()->text(), strDefaultEmail, + strOtherEmail ); + ent.setDefaultEmail( strDefaultEmail ); + ent.setEmails( strOtherEmail ); + break; + // home case Qtopia::HomeStreet: ent.setHomeStreet( it.current()->text() ); break; case Qtopia::HomeCity: ent.setHomeCity( it.current()->text() ); break; case Qtopia::HomeState: ent.setHomeState( it.current()->text() ); break; case Qtopia::HomeZip: ent.setHomeZip( it.current()->text() ); break; case Qtopia::HomeCountry: ent.setHomeCountry( it.current()->text() ); break; case Qtopia::HomePhone: ent.setHomePhone( it.current()->text() ); break; case Qtopia::HomeFax: ent.setHomeFax( it.current()->text() ); break; case Qtopia::HomeMobile: ent.setHomeMobile( it.current()->text() ); @@ -528,48 +528,49 @@ void AbEditor::saveEntry() ent.setNotes( str ); } void AbEditor::slotNote() { dlgNote->showMaximized(); if ( !dlgNote->exec() ) { // reset the note... txtNote->setText( ent.notes() ); } } void AbEditor::setNameFocus() { firstEdit->setFocus(); } void parseEmailFrom( const QString &txt, QString &strDefaultEmail, QString &strAll ) { int where, start; if ( txt.isEmpty() ) return; + // find the first where = txt.find( ',' ); if ( where < 0 ) { strDefaultEmail = txt; strAll = txt; } else { strDefaultEmail = txt.left( where ).stripWhiteSpace(); strAll = strDefaultEmail; while ( where > -1 ) { strAll.append(" "); start = where; where = txt.find( ',', where + 1 ); if ( where > - 1 ) strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); else // grab until the end... strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); } } } void parseEmailTo( const QString &strDefaultEmail, const QString &strOtherEmail, QString &strBack ) { // create a comma dilimeted set of emails... |