-rw-r--r-- | libopie/pim/ocontact.cpp | 12 | ||||
-rw-r--r-- | libopie/pim/ocontact.h | 11 | ||||
-rw-r--r-- | libopie2/opiepim/ocontact.cpp | 12 | ||||
-rw-r--r-- | libopie2/opiepim/ocontact.h | 11 |
4 files changed, 26 insertions, 20 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp index 66632f5..828a9de 100644 --- a/libopie/pim/ocontact.cpp +++ b/libopie/pim/ocontact.cpp @@ -1364,70 +1364,70 @@ QValueList<OContact> OContact::readVCard( const QString &filename ) { qDebug("trying to open %s, exists=%d", filename.utf8().data(), QFileInfo( filename.utf8().data() ).size() ); VObject *obj = Parse_MIME_FromFileName( (char *)filename.utf8().data() ); qDebug("vobject = %p", obj ); QValueList<OContact> contacts; while ( obj ) { contacts.append( parseVObject( obj ) ); VObject *t = obj; obj = nextVObjectInList(obj); cleanVObject( t ); } return contacts; } /*! Returns TRUE if the contact matches the regular expression \a regexp. Otherwise returns FALSE. */ bool OContact::match( const QString ®exp ) const { return match(QRegExp(regexp)); } /*! \overload Returns TRUE if the contact matches the regular expression \a regexp. Otherwise returns FALSE. */ bool OContact::match( const QRegExp &r ) const { bool match; match = false; QMap<int, QString>::ConstIterator it; for ( it = mMap.begin(); it != mMap.end(); ++it ) { if ( (*it).find( r ) > -1 ) { match = true; break; } } return match; } -// Noch nicht definiert ! :SX QString OContact::toShortText() const { - return ( QString::fromLatin1( "Not defined!") ); + return ( fullName() ); } QString OContact::type() const { return QString::fromLatin1( "OContact" ); } -// Noch nicht definiert ! :SX +// Definition is missing ! (se) QMap<QString,QString> OContact::toExtraMap() const { + qWarning ("Function not implemented: OContact::toExtraMap()"); QMap <QString,QString> useless; return useless; } -// Noch nicht definiert ! :SX -class QString OContact::recordField(int) const +class QString OContact::recordField( int pos ) const { - return QString::fromLatin1( "Noch nicht implementiert !" ); + QStringList SLFIELDS = fields(); // ?? why this ? (se) + return SLFIELDS[pos]; } diff --git a/libopie/pim/ocontact.h b/libopie/pim/ocontact.h index e0555c8..756c87d 100644 --- a/libopie/pim/ocontact.h +++ b/libopie/pim/ocontact.h @@ -163,106 +163,109 @@ public: QString profession() const { return find( Qtopia::Profession ); } QString assistant() const { return find( Qtopia::Assistant ); } QString manager() const { return find( Qtopia::Manager ); } /** Multi line string containing all non-empty address info in the form * Street * City, State Zip * Country */ QString displayBusinessAddress() const; //personal QString spouse() const { return find( Qtopia::Spouse ); } QString gender() const { return find( Qtopia::Gender ); } QString birthday() const { return find( Qtopia::Birthday ); } QString anniversary() const { return find( Qtopia::Anniversary ); } QString nickname() const { return find( Qtopia::Nickname ); } QString children() const { return find( Qtopia::Children ); } QStringList childrenList() const; // other QString notes() const { return find( Qtopia::Notes ); } QString groups() const { return find( Qtopia::Groups ); } QStringList groupList() const; // // custom // const QString &customField( const QString &key ) // { return find( Custom- + key ); } static QStringList fields(); static QStringList trfields(); QString toRichText() const; QMap<int, QString> toMap() const; QString field( int key ) const { return find( key ); } // journaling... void saveJournal( journal_action action, const QString &key = QString::null ); void save( QString &buf ) const; void setUid( int i ) { Record::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); } QString toShortText()const; QString OContact::type()const; QMap<QString,QString> OContact::toExtraMap() const; class QString OContact::recordField(int) const; + // Why private ? (eilers,se) + QString emailSeparator() const { return " "; } + // the emails should be seperated by a comma + void setEmails( const QString &v ); + QString emails() const { return find( Qtopia::Emails ); } + + private: friend class AbEditor; friend class AbTable; friend class AddressBookAccessPrivate; friend class XMLIO; - QString emailSeparator() const { return " "; } - // the emails should be seperated by a comma - void setEmails( const QString &v ); - QString emails() const { return find( Qtopia::Emails ); } void insert( int key, const QString &value ); void replace( int key, const QString &value ); QString find( int key ) const; QString displayAddress( const QString &street, const QString &city, const QString &state, const QString &zip, const QString &country ) const; Qtopia::UidGen &uidGen() { return sUidGen; } static Qtopia::UidGen sUidGen; QMap<int, QString> mMap; ContactPrivate *d; }; // these methods are inlined to keep binary compatability with Qtopia 1.5 inline void OContact::insertEmail( const QString &v ) { //qDebug("insertEmail %s", v.latin1()); QString e = v.simplifyWhiteSpace(); QString def = defaultEmail(); // if no default, set it as the default email and don't insert if ( def.isEmpty() ) { setDefaultEmail( e ); // will insert into the list for us return; } // otherwise, insert assuming doesn't already exist QString emailsStr = find( Qtopia::Emails ); if ( emailsStr.contains( e )) return; if ( !emailsStr.isEmpty() ) emailsStr += emailSeparator(); emailsStr += e; replace( Qtopia::Emails, emailsStr ); } inline void OContact::removeEmail( const QString &v ) { QString e = v.simplifyWhiteSpace(); QString def = defaultEmail(); QString emailsStr = find( Qtopia::Emails ); QStringList emails = emailList(); // otherwise, must first contain it diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp index 66632f5..828a9de 100644 --- a/libopie2/opiepim/ocontact.cpp +++ b/libopie2/opiepim/ocontact.cpp @@ -1364,70 +1364,70 @@ QValueList<OContact> OContact::readVCard( const QString &filename ) { qDebug("trying to open %s, exists=%d", filename.utf8().data(), QFileInfo( filename.utf8().data() ).size() ); VObject *obj = Parse_MIME_FromFileName( (char *)filename.utf8().data() ); qDebug("vobject = %p", obj ); QValueList<OContact> contacts; while ( obj ) { contacts.append( parseVObject( obj ) ); VObject *t = obj; obj = nextVObjectInList(obj); cleanVObject( t ); } return contacts; } /*! Returns TRUE if the contact matches the regular expression \a regexp. Otherwise returns FALSE. */ bool OContact::match( const QString ®exp ) const { return match(QRegExp(regexp)); } /*! \overload Returns TRUE if the contact matches the regular expression \a regexp. Otherwise returns FALSE. */ bool OContact::match( const QRegExp &r ) const { bool match; match = false; QMap<int, QString>::ConstIterator it; for ( it = mMap.begin(); it != mMap.end(); ++it ) { if ( (*it).find( r ) > -1 ) { match = true; break; } } return match; } -// Noch nicht definiert ! :SX QString OContact::toShortText() const { - return ( QString::fromLatin1( "Not defined!") ); + return ( fullName() ); } QString OContact::type() const { return QString::fromLatin1( "OContact" ); } -// Noch nicht definiert ! :SX +// Definition is missing ! (se) QMap<QString,QString> OContact::toExtraMap() const { + qWarning ("Function not implemented: OContact::toExtraMap()"); QMap <QString,QString> useless; return useless; } -// Noch nicht definiert ! :SX -class QString OContact::recordField(int) const +class QString OContact::recordField( int pos ) const { - return QString::fromLatin1( "Noch nicht implementiert !" ); + QStringList SLFIELDS = fields(); // ?? why this ? (se) + return SLFIELDS[pos]; } diff --git a/libopie2/opiepim/ocontact.h b/libopie2/opiepim/ocontact.h index e0555c8..756c87d 100644 --- a/libopie2/opiepim/ocontact.h +++ b/libopie2/opiepim/ocontact.h @@ -163,106 +163,109 @@ public: QString profession() const { return find( Qtopia::Profession ); } QString assistant() const { return find( Qtopia::Assistant ); } QString manager() const { return find( Qtopia::Manager ); } /** Multi line string containing all non-empty address info in the form * Street * City, State Zip * Country */ QString displayBusinessAddress() const; //personal QString spouse() const { return find( Qtopia::Spouse ); } QString gender() const { return find( Qtopia::Gender ); } QString birthday() const { return find( Qtopia::Birthday ); } QString anniversary() const { return find( Qtopia::Anniversary ); } QString nickname() const { return find( Qtopia::Nickname ); } QString children() const { return find( Qtopia::Children ); } QStringList childrenList() const; // other QString notes() const { return find( Qtopia::Notes ); } QString groups() const { return find( Qtopia::Groups ); } QStringList groupList() const; // // custom // const QString &customField( const QString &key ) // { return find( Custom- + key ); } static QStringList fields(); static QStringList trfields(); QString toRichText() const; QMap<int, QString> toMap() const; QString field( int key ) const { return find( key ); } // journaling... void saveJournal( journal_action action, const QString &key = QString::null ); void save( QString &buf ) const; void setUid( int i ) { Record::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); } QString toShortText()const; QString OContact::type()const; QMap<QString,QString> OContact::toExtraMap() const; class QString OContact::recordField(int) const; + // Why private ? (eilers,se) + QString emailSeparator() const { return " "; } + // the emails should be seperated by a comma + void setEmails( const QString &v ); + QString emails() const { return find( Qtopia::Emails ); } + + private: friend class AbEditor; friend class AbTable; friend class AddressBookAccessPrivate; friend class XMLIO; - QString emailSeparator() const { return " "; } - // the emails should be seperated by a comma - void setEmails( const QString &v ); - QString emails() const { return find( Qtopia::Emails ); } void insert( int key, const QString &value ); void replace( int key, const QString &value ); QString find( int key ) const; QString displayAddress( const QString &street, const QString &city, const QString &state, const QString &zip, const QString &country ) const; Qtopia::UidGen &uidGen() { return sUidGen; } static Qtopia::UidGen sUidGen; QMap<int, QString> mMap; ContactPrivate *d; }; // these methods are inlined to keep binary compatability with Qtopia 1.5 inline void OContact::insertEmail( const QString &v ) { //qDebug("insertEmail %s", v.latin1()); QString e = v.simplifyWhiteSpace(); QString def = defaultEmail(); // if no default, set it as the default email and don't insert if ( def.isEmpty() ) { setDefaultEmail( e ); // will insert into the list for us return; } // otherwise, insert assuming doesn't already exist QString emailsStr = find( Qtopia::Emails ); if ( emailsStr.contains( e )) return; if ( !emailsStr.isEmpty() ) emailsStr += emailSeparator(); emailsStr += e; replace( Qtopia::Emails, emailsStr ); } inline void OContact::removeEmail( const QString &v ) { QString e = v.simplifyWhiteSpace(); QString def = defaultEmail(); QString emailsStr = find( Qtopia::Emails ); QStringList emails = emailList(); // otherwise, must first contain it |