summaryrefslogtreecommitdiff
path: root/libopie/pim/otodo.cpp
Side-by-side diff
Diffstat (limited to 'libopie/pim/otodo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/otodo.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp
index cc46b21..6dd4c0e 100644
--- a/libopie/pim/otodo.cpp
+++ b/libopie/pim/otodo.cpp
@@ -116,97 +116,97 @@ bool OTodo::hasDueDate() const
}
bool OTodo::hasAlarmDateTime() const
{
return data->hasAlarmDateTime;
}
int OTodo::priority()const
{
return data->priority;
}
QString OTodo::summary() const
{
return data->sum;
}
ushort OTodo::progress() const
{
return data->prog;
}
QDate OTodo::dueDate()const
{
return data->date;
}
QDateTime OTodo::alarmDateTime() const
{
return data->alarmDateTime;
}
QString OTodo::description()const
{
return data->desc;
}
void OTodo::setCompleted( bool completed )
{
changeOrModify();
data->isCompleted = completed;
}
void OTodo::setHasDueDate( bool hasDate )
{
changeOrModify();
data->hasDate = hasDate;
}
void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime )
{
changeOrModify();
data->hasAlarmDateTime = hasAlarmDateTime;
}
void OTodo::setDescription(const QString &desc )
{
- qWarning( "desc " + desc );
+// qWarning( "desc " + desc );
changeOrModify();
data->desc = Qtopia::simplifyMultiLineSpace(desc );
}
void OTodo::setSummary( const QString& sum )
{
changeOrModify();
data->sum = sum;
}
void OTodo::setPriority(int prio )
{
changeOrModify();
data->priority = prio;
}
void OTodo::setDueDate( QDate date )
{
changeOrModify();
data->date = date;
}
void OTodo::setAlarmDateTime( const QDateTime& alarm )
{
changeOrModify();
data->alarmDateTime = alarm;
}
bool OTodo::isOverdue( )
{
if( data->hasDate )
return QDate::currentDate() > data->date;
return false;
}
void OTodo::setProgress(ushort progress )
{
changeOrModify();
data->prog = progress;
}
QString OTodo::toShortText() const {
return summary();
}
/*!
Returns a richt text string
*/
QString OTodo::toRichText() const
{
QString text;
QStringList catlist;
// Description of the todo
if ( !summary().isEmpty() ) {
text += "<b>" + QObject::tr( "Summary:") + "</b><br>";
@@ -273,97 +273,97 @@ bool OTodo::operator>(const OTodo &toDoEvent )const
if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
return priority() > toDoEvent.priority();
}else{
return dueDate() > toDoEvent.dueDate();
}
}
return false;
}
bool OTodo::operator>=(const OTodo &toDoEvent )const
{
if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
if( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
if( hasDueDate() && toDoEvent.hasDueDate() ){
if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
return priority() > toDoEvent.priority();
}else{
return dueDate() > toDoEvent.dueDate();
}
}
return true;
}
bool OTodo::operator==(const OTodo &toDoEvent )const
{
if ( data->priority != toDoEvent.data->priority ) return false;
if ( data->priority != toDoEvent.data->prog ) return false;
if ( data->isCompleted != toDoEvent.data->isCompleted ) return false;
if ( data->hasDate != toDoEvent.data->hasDate ) return false;
if ( data->date != toDoEvent.data->date ) return false;
if ( data->sum != toDoEvent.data->sum ) return false;
if ( data->desc != toDoEvent.data->desc ) return false;
if ( data->hasAlarmDateTime != toDoEvent.data->hasAlarmDateTime )
return false;
if ( data->alarmDateTime != toDoEvent.data->alarmDateTime )
return false;
return OPimRecord::operator==( toDoEvent );
}
void OTodo::deref() {
// qWarning("deref in ToDoEvent");
if ( data->deref() ) {
// qWarning("deleting");
delete data;
data= 0;
}
}
OTodo &OTodo::operator=(const OTodo &item )
{
-// OPimRecord::operator=( item );
+ OPimRecord::operator=( item );
//qWarning("operator= ref ");
item.data->ref();
deref();
data = item.data;
return *this;
}
QMap<int, QString> OTodo::toMap() const {
QMap<int, QString> map;
map.insert( Uid, QString::number( uid() ) );
map.insert( Category, idsToString( categories() ) );
map.insert( HasDate, QString::number( data->hasDate ) );
map.insert( Completed, QString::number( data->isCompleted ) );
map.insert( Description, data->desc );
map.insert( Summary, data->sum );
map.insert( Priority, QString::number( data->priority ) );
map.insert( DateDay, QString::number( data->date.day() ) );
map.insert( DateMonth, QString::number( data->date.month() ) );
map.insert( DateYear, QString::number( data->date.year() ) );
map.insert( Progress, QString::number( data->prog ) );
map.insert( CrossReference, crossToString() );
map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) );
map.insert( AlarmDateTime, data->alarmDateTime.toString() );
return map;
}
QMap<QString, QString> OTodo::toExtraMap()const {
return data->extra;
}
/**
* change or modify looks at the ref count and either
* creates a new QShared Object or it can modify it
* right in place
*/
void OTodo::changeOrModify() {
if ( data->count != 1 ) {
// qWarning("changeOrModify");
data->deref();
OTodoData* d2 = new OTodoData();
copy(data, d2 );
data = d2;
}
}
void OTodo::copy( OTodoData* src, OTodoData* dest ) {
dest->date = src->date;