Diffstat (limited to 'libopie2/opiepim/core/opimcontact.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimcontact.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/libopie2/opiepim/core/opimcontact.cpp b/libopie2/opiepim/core/opimcontact.cpp index 36e9a93..64f195b 100644 --- a/libopie2/opiepim/core/opimcontact.cpp +++ b/libopie2/opiepim/core/opimcontact.cpp @@ -82,5 +82,4 @@ OPimContact::OPimContact( const QMap<int, QString> &fromMap ):OPimRecord(), mMap if ( uidStr.isEmpty() || ( uidStr.toInt() == 0 ) ) { - owarn << "Invalid UID found. Generate new one.." << oendl; setUid( uidGen().generate() ); } @@ -1139,5 +1138,4 @@ void OPimContact::setBirthday( const QDate &v ) if ( v.isNull() ) { - owarn << "Remove Birthday" << oendl; replace( Qtopia::Birthday, QString::null ); return ; @@ -1158,5 +1156,4 @@ void OPimContact::setAnniversary( const QDate &v ) if ( v.isNull() ) { - owarn << "Remove Anniversary" << oendl; replace( Qtopia::Anniversary, QString::null ); return ; @@ -1174,5 +1171,4 @@ QDate OPimContact::birthday() const { QString str = find( Qtopia::Birthday ); - // owarn << "Birthday " << str << oendl; if ( !str.isEmpty() ) return OPimDateConversion::dateFromString ( str ); @@ -1189,5 +1185,4 @@ QDate OPimContact::anniversary() const QDate empty; QString str = find( Qtopia::Anniversary ); - // owarn << "Anniversary " << str << oendl; if ( !str.isEmpty() ) return OPimDateConversion::dateFromString ( str ); @@ -1283,4 +1278,23 @@ int OPimContact::rtti() const } +/** + * \brief Cast to OPimContact or on failure return 0l + * + * This method tries to cast from a OPimRecord to a + * OPimContact it uses. If the OPimRecord is from type + * OPimContact the case will suceed and a pointer to + * OPimContact is returned otherwise a Null Pointer is returned. + * + * + * @see OPimTodo::safeCast() + * @see OPimEvent::safeCast() + * @return Return a OPimContact or a Null Pointer + */ +OPimContact* OPimContact::safeCast( const OPimRecord* rec ) { + return( rec && rec->rtti() == OPimResolver::AddressBook ) ? + static_cast<OPimContact*>( const_cast<OPimRecord*>(rec) ) : + 0l; +} + void OPimContact::setUid( int i ) |