-rw-r--r-- | libopie/todoevent.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp index 7dbf907..28b2e98 100644 --- a/libopie/todoevent.cpp +++ b/libopie/todoevent.cpp @@ -6,13 +6,13 @@ ToDoEvent::ToDoEvent(const ToDoEvent &event ) { *this = event; } -ToDoEvent::ToDoEvent(bool completed, int priority, const QString &category, +ToDoEvent::ToDoEvent(bool completed, int priority, const QStringList &category, const QString &description, bool hasDate, QDate date, int uid ) { qWarning("todoEvent c'tor" ); m_date = date; m_isCompleted = completed; m_hasDate = hasDate; @@ -25,14 +25,14 @@ ToDoEvent::ToDoEvent(bool completed, int priority, const QString &category, delete uidgen; }// generate the ids m_uid = uid; } QArray<int> ToDoEvent::categories()const { - QArray<int> array(1); // currently the datebook can be only in one category - array = Qtopia::Record::idsFromString( category() ); + QArray<int> array(m_category.count() ); // currently the datebook can be only in one category + array = Qtopia::Record::idsFromString( m_category.join(";") ); return array; } bool ToDoEvent::match( const QRegExp ®Exp )const { if( QString::number( m_priority ).find( regExp ) != -1 ){ return true; @@ -52,20 +52,34 @@ bool ToDoEvent::hasDate() const return m_hasDate; } int ToDoEvent::priority()const { return m_priority; } -QString ToDoEvent::category()const +QStringList ToDoEvent::allCategories()const { return m_category; } +void ToDoEvent::insertCategory(const QString &str ) +{ + m_category.append( str ); +} +void ToDoEvent::clearCategories() +{ + m_category.clear(); +} +void ToDoEvent::setCategories(const QStringList &list ) +{ + m_category = list; + qWarning("todoevent: %s", list.join(";" ).latin1() ); +} QDate ToDoEvent::date()const { return m_date; } + QString ToDoEvent::description()const { return m_desc; } void ToDoEvent::setCompleted( bool completed ) { @@ -79,13 +93,14 @@ void ToDoEvent::setDescription(const QString &desc ) { m_desc = Qtopia::simplifyMultiLineSpace(desc ); } void ToDoEvent::setCategory( const QString &cat ) { qWarning("setCategory %s", cat.latin1() ); - m_category = cat; + m_category.clear(); + m_category << cat; } void ToDoEvent::setPriority(int prio ) { m_priority = prio; } void ToDoEvent::setDate( QDate date ) @@ -148,13 +163,13 @@ bool ToDoEvent::operator>=(const ToDoEvent &toDoEvent )const } } return true; } bool ToDoEvent::operator==(const ToDoEvent &toDoEvent )const { - if( m_date == toDoEvent.m_date && m_isCompleted == toDoEvent.m_isCompleted && m_hasDate == toDoEvent.m_hasDate && m_priority == toDoEvent.m_priority && m_category == toDoEvent.m_category && m_desc == toDoEvent.m_category ) + if( m_date == toDoEvent.m_date && m_isCompleted == toDoEvent.m_isCompleted && m_hasDate == toDoEvent.m_hasDate && m_priority == toDoEvent.m_priority && m_category == toDoEvent.m_category && m_desc == toDoEvent.m_desc ) return true; return false; } ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item ) { m_date = item.m_date; |