void KCalConversionTest::testTodoConversion_data() { QTest::addColumn<KCalCore::Todo>( "kcal" ); QTest::addColumn<Kolab::Todo>( "kolab" ); Kolab::cDateTime date(2011,2,2,12,11,10,true); Kolab::cDateTime date2(2011,2,2,12,12,10,true); { KCalCore::Todo kcal; kcal.setUid("uid"); kcal.setDtStart(toDate(date)); kcal.setDtDue(toDate(date2)); kcal.setRelatedTo("uid2", KCalCore::Incidence::RelTypeParent); Kolab::Todo kolab; kolab.setUid("uid"); kolab.setStart(date); kolab.setDue(date2); std::vector<std::string> relateds; relateds.push_back("uid2"); kolab.setRelatedTo(relateds); QTest::newRow( "todo" ) << kcal << kolab; } }
static void setPriority( const QString &value, KCalCore::Todo &todo ) { if ( value == QLatin1String( "High" ) ) { todo.setPriority( 1 ); } else if ( value == QLatin1String( "Medium" ) ) { todo.setPriority( 5 ); } else if ( value == QLatin1String( "Low" ) ) { todo.setPriority( 9 ); } else { todo.setPriority( 0 ); } }
static QString getPriority( const KCalCore::Todo &todo ) { if ( todo.priority() == 1 ) { return QLatin1String( "High" ); } else if ( todo.priority() == 5 ) { return QLatin1String( "Medium" ); } else if ( todo.priority() == 9 ) { return QLatin1String( "Low" ); } else { return QLatin1String( "None" ); } }
static QString getStatus( const KCalCore::Todo &todo ) { if ( todo.status() == KCalCore::Todo::StatusConfirmed ) { return QLatin1String( "Not Started" ); } else if ( todo.status() == KCalCore::Todo::StatusInProcess ) { return QLatin1String( "In Progress" ); } else if ( todo.status() == KCalCore::Todo::StatusCompleted ) { return QLatin1String( "Completed" ); } else if ( todo.status() == KCalCore::Todo::StatusNeedsAction ) { return QLatin1String( "Pending Input" ); } else if ( todo.customStatus() == "StatusDeferred" ) { return QLatin1String( "Deferred" ); } else { return QLatin1String( "None" ); } }
static void setStatus( const QString &value, KCalCore::Todo &todo ) { if ( value == QLatin1String( "Not Started" ) ) { todo.setStatus( KCalCore::Todo::StatusConfirmed ); } else if ( value == QLatin1String( "In Progress" ) ) { todo.setStatus( KCalCore::Todo::StatusInProcess ); } else if ( value == QLatin1String( "Completed" ) ) { todo.setStatus( KCalCore::Todo::StatusCompleted ); } else if ( value == QLatin1String( "Pending Input" ) ) { todo.setStatus( KCalCore::Todo::StatusNeedsAction ); } else if ( value == QLatin1String( "Deferred" ) ) { todo.setCustomStatus( QLatin1String( "StatusDeferred" ) ); } else { todo.setStatus( KCalCore::Todo::StatusNone ); } }
static void setDateStartFlag( const QString &value, KCalCore::Todo &todo ) { todo.setCustomProperty( "SugarCRM", "X-DateStartFlag", value ); }
static void setContactId( const QString &value, KCalCore::Todo &todo ) { todo.setCustomProperty( "SugarCRM", "X-ContactId", value ); }
static void setSummary( const QString &value, KCalCore::Todo &todo ) { todo.setSummary( value ); }
static void setDescription( const QString &value, KCalCore::Todo &todo ) { todo.setDescription( value ); }
static void setCreatedBy( const QString &value, KCalCore::Todo &todo ) { todo.setCustomProperty( "SugarCRM", "X-CreatedBy", value ); }
static void setModifiedUserId( const QString &value, KCalCore::Todo &todo ) { todo.setCustomProperty( "SugarCRM", "X-ModifiedUserId", value ); }
static QString getDateModified( const KCalCore::Todo &todo ) { return todo.customProperty( "SugarCRM", "X-DateModified" ); }
static QString getDateEntered( const KCalCore::Todo &todo ) { return todo.created().toString(); }
static QString getDateStartFlag( const KCalCore::Todo &todo ) { return todo.customProperty( "SugarCRM", "X-DateStartFlag" ); }
static QString getDateDue( const KCalCore::Todo &todo ) { KDateTime dateDue = todo.dtDue(); return dateDue.toString( "%Y-%m-%d %H:%M:%S" ); }
static void setAssignedUserName( const QString &value, KCalCore::Todo &todo ) { todo.setCustomProperty( "SugarCRM", "X-AssignedUserName", value ); }
static QString getAssignedUserName( const KCalCore::Todo &todo ) { return todo.customProperty( "SugarCRM", "X-AssignedUserName" ); }
static void setDeleted( const QString &value, KCalCore::Todo &todo ) { todo.setCustomProperty( "SugarCRM", "X-Deleted", value ); }
static void setDateEntered( const QString &value, KCalCore::Todo &todo ) { todo.setCreated( KDateTime::fromString(value, "%Y-%m-%d %H:%M:%S") ); }
static QString getDateStart( const KCalCore::Todo &todo ) { KDateTime dateStart = todo.dtStart(); return dateStart.toString( "%Y-%m-%d %H:%M:%S" ); }
static QString getModifiedUserId( const KCalCore::Todo &todo ) { return todo.customProperty( "SugarCRM", "X-ModifiedUserId" ); }
static void setDateStart( const QString &value, KCalCore::Todo &todo ) { todo.setDtStart( KDateTime::fromString( value, "%Y-%m-%d %H:%M:%S", 0, true ) ); }
static QString getCreatedBy( const KCalCore::Todo &todo ) { return todo.customProperty( "SugarCRM", "X-CreatedBy" ); }
static QString getParentType( const KCalCore::Todo &todo ) { return todo.customProperty( "SugarCRM", "X-ParentType" ); }
static QString getDescription( const KCalCore::Todo &todo ) { return todo.description(); }
static void setParentType( const QString &value, KCalCore::Todo &todo ) { todo.setCustomProperty( "SugarCRM", "X-ParentType", value ); }
static QString getSummary( const KCalCore::Todo &todo ) { return todo.summary(); }
static QString getContactId( const KCalCore::Todo &todo ) { return todo.customProperty( "SugarCRM", "X-ContactId" ); }