author | zecke <zecke> | 2003-05-12 13:12:45 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-05-12 13:12:45 (UTC) |
commit | 52b74f396416cc1b87d76a0541617512da22157a (patch) (side-by-side diff) | |
tree | dbec31fb8b79cdb6fbe50f588aac280a8fdc2bfa | |
parent | 64f9f964ef690806378d639118f79539a8934d40 (diff) | |
download | opie-52b74f396416cc1b87d76a0541617512da22157a.zip opie-52b74f396416cc1b87d76a0541617512da22157a.tar.gz opie-52b74f396416cc1b87d76a0541617512da22157a.tar.bz2 |
fix up OTodo::hasNotifiers
add a const notifiers() function
and fix OPimNotifyManager::isEmpty
-rw-r--r-- | libopie/pim/opimnotifymanager.cpp | 4 | ||||
-rw-r--r-- | libopie/pim/otodo.cpp | 8 | ||||
-rw-r--r-- | libopie/pim/otodo.h | 8 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimnotifymanager.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.cpp | 8 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.h | 8 |
6 files changed, 34 insertions, 6 deletions
diff --git a/libopie/pim/opimnotifymanager.cpp b/libopie/pim/opimnotifymanager.cpp index 49af757..06b5987 100644 --- a/libopie/pim/opimnotifymanager.cpp +++ b/libopie/pim/opimnotifymanager.cpp @@ -23,50 +23,52 @@ void OPimNotifyManager::remove( const OPimNotify& noti) { const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); m_al.remove( al ); } } void OPimNotifyManager::replace( const OPimNotify& noti) { if ( noti.type() == QString::fromLatin1("OPimReminder") ) { const OPimReminder& rem = static_cast<const OPimReminder&>(noti); m_rem.remove( rem ); m_rem.append( rem ); }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); m_al.remove( al ); m_al.append( al ); } } OPimNotifyManager::Reminders OPimNotifyManager::reminders()const { return m_rem; } OPimNotifyManager::Alarms OPimNotifyManager::alarms()const { return m_al; } void OPimNotifyManager::setAlarms( const Alarms& al) { m_al = al; } void OPimNotifyManager::setReminders( const Reminders& rem) { m_rem = rem; } /* FIXME!!! */ /** * The idea is to check if the provider for our service * is online * if it is we will use QCOP * if not the Factory to get the backend... * Qtopia1.6 services would be kewl to have here.... */ void OPimNotifyManager::registerNotify( const OPimNotify& ) { } /* FIXME!!! */ /** * same as above... * Also implement Url model * have a MainWindow.... */ void OPimNotifyManager::deregister( const OPimNotify& ) { } bool OPimNotifyManager::isEmpty()const { - return ( m_rem.isEmpty() && m_al.isEmpty() ); + qWarning("is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() ); + if ( m_rem.isEmpty() && m_al.isEmpty() ) return true; + else return false; } diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index f3df119..a29d88e 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp @@ -253,103 +253,109 @@ bool OTodo::isOverdue( ) 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>"; text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } if( !description().isEmpty() ){ text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; } text += "<br><br><br>"; text += "<b>" + QObject::tr( "Priority:") +" </b>" + QString::number( priority() ) + " <br>"; text += "<b>" + QObject::tr( "Progress:") + " </b>" + QString::number( progress() ) + " %<br>"; if (hasDueDate() ){ text += "<b>" + QObject::tr( "Deadline:") + " </b>"; text += dueDate().toString(); text += "<br>"; } text += "<b>" + QObject::tr( "Category:") + "</b> "; text += categoryNames( "Todo List" ).join(", "); text += "<br>"; return text; } bool OTodo::hasNotifiers()const { if (!data->notifiers) return false; - return data->notifiers->isEmpty(); + return !data->notifiers->isEmpty(); } OPimNotifyManager& OTodo::notifiers() { if (!data->notifiers ) data->notifiers = new OPimNotifyManager; return (*data->notifiers); } +const OPimNotifyManager& OTodo::notifiers()const{ + if (!data->notifiers ) + data->notifiers = new OPimNotifyManager; + + return (*data->notifiers); +} 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 false; } bool OTodo::operator<=(const OTodo &toDoEvent )const { if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; if( !hasDueDate() && toDoEvent.hasDueDate() ) return true; 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( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; 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 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(); diff --git a/libopie/pim/otodo.h b/libopie/pim/otodo.h index 0e7c73f..4d5ee36 100644 --- a/libopie/pim/otodo.h +++ b/libopie/pim/otodo.h @@ -130,104 +130,110 @@ public: /** * does it have a state? */ bool hasState()const; /** * What is the state of this OTodo? */ OPimState state()const; /** * has recurrence? */ bool hasRecurrence()const; /** * the recurrance of this */ ORecur recurrence()const; /** * does this OTodo have a maintainer? */ bool hasMaintainer()const; /** * the Maintainer of this OTodo */ OPimMaintainer maintainer()const; /** * The description of the todo */ QString description()const; /** * A small summary of the todo */ QString summary() const; /** * @reimplemented * Return this todoevent in a RichText formatted QString */ QString toRichText() const; bool hasNotifiers()const; /* - * check if the sharing is still fine!! -zecke + * FIXME check if the sharing is still fine!! -zecke + * ### CHECK If API is fine */ /** * return a reference to our notifiers... */ OPimNotifyManager ¬ifiers(); /** + * + */ + const OPimNotifyManager ¬ifiers()const; + + /** * reimplementations */ QString type()const; QString toShortText()const; QMap<QString, QString> toExtraMap()const; QString recordField(int id )const; /** * toMap puts all data into the map. int relates * to ToDoEvent RecordFields enum */ QMap<int, QString> toMap()const; /** * Set if this Todo is completed */ void setCompleted(bool completed ); /** * set if this todo got an end data */ void setHasDueDate( bool hasDate ); // FIXME we do not have these for start, completed // cause we'll use the isNull() of QDate for figuring // out if it's has a date... // decide what to do here? -zecke /** * Set the priority of the Todo */ void setPriority(int priority ); /** * Set the progress. */ void setProgress( ushort progress ); /** * set the end date */ void setDueDate( const QDate& date ); /** * set the start date */ void setStartDate( const QDate& date ); /** diff --git a/libopie2/opiepim/core/opimnotifymanager.cpp b/libopie2/opiepim/core/opimnotifymanager.cpp index 49af757..06b5987 100644 --- a/libopie2/opiepim/core/opimnotifymanager.cpp +++ b/libopie2/opiepim/core/opimnotifymanager.cpp @@ -23,50 +23,52 @@ void OPimNotifyManager::remove( const OPimNotify& noti) { const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); m_al.remove( al ); } } void OPimNotifyManager::replace( const OPimNotify& noti) { if ( noti.type() == QString::fromLatin1("OPimReminder") ) { const OPimReminder& rem = static_cast<const OPimReminder&>(noti); m_rem.remove( rem ); m_rem.append( rem ); }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) { const OPimAlarm& al = static_cast<const OPimAlarm&>(noti); m_al.remove( al ); m_al.append( al ); } } OPimNotifyManager::Reminders OPimNotifyManager::reminders()const { return m_rem; } OPimNotifyManager::Alarms OPimNotifyManager::alarms()const { return m_al; } void OPimNotifyManager::setAlarms( const Alarms& al) { m_al = al; } void OPimNotifyManager::setReminders( const Reminders& rem) { m_rem = rem; } /* FIXME!!! */ /** * The idea is to check if the provider for our service * is online * if it is we will use QCOP * if not the Factory to get the backend... * Qtopia1.6 services would be kewl to have here.... */ void OPimNotifyManager::registerNotify( const OPimNotify& ) { } /* FIXME!!! */ /** * same as above... * Also implement Url model * have a MainWindow.... */ void OPimNotifyManager::deregister( const OPimNotify& ) { } bool OPimNotifyManager::isEmpty()const { - return ( m_rem.isEmpty() && m_al.isEmpty() ); + qWarning("is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() ); + if ( m_rem.isEmpty() && m_al.isEmpty() ) return true; + else return false; } diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp index f3df119..a29d88e 100644 --- a/libopie2/opiepim/otodo.cpp +++ b/libopie2/opiepim/otodo.cpp @@ -253,103 +253,109 @@ bool OTodo::isOverdue( ) 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>"; text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } if( !description().isEmpty() ){ text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; } text += "<br><br><br>"; text += "<b>" + QObject::tr( "Priority:") +" </b>" + QString::number( priority() ) + " <br>"; text += "<b>" + QObject::tr( "Progress:") + " </b>" + QString::number( progress() ) + " %<br>"; if (hasDueDate() ){ text += "<b>" + QObject::tr( "Deadline:") + " </b>"; text += dueDate().toString(); text += "<br>"; } text += "<b>" + QObject::tr( "Category:") + "</b> "; text += categoryNames( "Todo List" ).join(", "); text += "<br>"; return text; } bool OTodo::hasNotifiers()const { if (!data->notifiers) return false; - return data->notifiers->isEmpty(); + return !data->notifiers->isEmpty(); } OPimNotifyManager& OTodo::notifiers() { if (!data->notifiers ) data->notifiers = new OPimNotifyManager; return (*data->notifiers); } +const OPimNotifyManager& OTodo::notifiers()const{ + if (!data->notifiers ) + data->notifiers = new OPimNotifyManager; + + return (*data->notifiers); +} 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 false; } bool OTodo::operator<=(const OTodo &toDoEvent )const { if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; if( !hasDueDate() && toDoEvent.hasDueDate() ) return true; 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( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; 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 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(); diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h index 0e7c73f..4d5ee36 100644 --- a/libopie2/opiepim/otodo.h +++ b/libopie2/opiepim/otodo.h @@ -130,104 +130,110 @@ public: /** * does it have a state? */ bool hasState()const; /** * What is the state of this OTodo? */ OPimState state()const; /** * has recurrence? */ bool hasRecurrence()const; /** * the recurrance of this */ ORecur recurrence()const; /** * does this OTodo have a maintainer? */ bool hasMaintainer()const; /** * the Maintainer of this OTodo */ OPimMaintainer maintainer()const; /** * The description of the todo */ QString description()const; /** * A small summary of the todo */ QString summary() const; /** * @reimplemented * Return this todoevent in a RichText formatted QString */ QString toRichText() const; bool hasNotifiers()const; /* - * check if the sharing is still fine!! -zecke + * FIXME check if the sharing is still fine!! -zecke + * ### CHECK If API is fine */ /** * return a reference to our notifiers... */ OPimNotifyManager ¬ifiers(); /** + * + */ + const OPimNotifyManager ¬ifiers()const; + + /** * reimplementations */ QString type()const; QString toShortText()const; QMap<QString, QString> toExtraMap()const; QString recordField(int id )const; /** * toMap puts all data into the map. int relates * to ToDoEvent RecordFields enum */ QMap<int, QString> toMap()const; /** * Set if this Todo is completed */ void setCompleted(bool completed ); /** * set if this todo got an end data */ void setHasDueDate( bool hasDate ); // FIXME we do not have these for start, completed // cause we'll use the isNull() of QDate for figuring // out if it's has a date... // decide what to do here? -zecke /** * Set the priority of the Todo */ void setPriority(int priority ); /** * Set the progress. */ void setProgress( ushort progress ); /** * set the end date */ void setDueDate( const QDate& date ); /** * set the start date */ void setStartDate( const QDate& date ); /** |