summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimcontact.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/core/opimcontact.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimcontact.cpp24
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
@@ -81,7 +81,6 @@ 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() );
}
else
@@ -1138,7 +1137,6 @@ void OPimContact::setBirthday( const QDate &v )
{
if ( v.isNull() )
{
- owarn << "Remove Birthday" << oendl;
replace( Qtopia::Birthday, QString::null );
return ;
}
@@ -1157,7 +1155,6 @@ void OPimContact::setAnniversary( const QDate &v )
{
if ( v.isNull() )
{
- owarn << "Remove Anniversary" << oendl;
replace( Qtopia::Anniversary, QString::null );
return ;
}
@@ -1173,7 +1170,6 @@ void OPimContact::setAnniversary( const QDate &v )
QDate OPimContact::birthday() const
{
QString str = find( Qtopia::Birthday );
- // owarn << "Birthday " << str << oendl;
if ( !str.isEmpty() )
return OPimDateConversion::dateFromString ( str );
else
@@ -1188,7 +1184,6 @@ QDate OPimContact::anniversary() const
{
QDate empty;
QString str = find( Qtopia::Anniversary );
- // owarn << "Anniversary " << str << oendl;
if ( !str.isEmpty() )
return OPimDateConversion::dateFromString ( str );
else
@@ -1282,6 +1277,25 @@ int OPimContact::rtti() const
return OPimResolver::AddressBook;
}
+/**
+ * \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 )
{