summaryrefslogtreecommitdiff
path: root/libopie
Side-by-side diff
Diffstat (limited to 'libopie') (more/less context) (show whitespace changes)
-rw-r--r--libopie/tododb.cpp4
-rw-r--r--libopie/todoevent.cpp35
-rw-r--r--libopie/todoevent.h59
-rw-r--r--libopie/todovcalresource.cpp7
4 files changed, 101 insertions, 4 deletions
diff --git a/libopie/tododb.cpp b/libopie/tododb.cpp
index fe8b8bf..6b10ec2 100644
--- a/libopie/tododb.cpp
+++ b/libopie/tododb.cpp
@@ -15,2 +15,3 @@ public:
FileToDoResource() {};
+ // FIXME better parsing
bool save(const QString &name, const QValueList<ToDoEvent> &m_todos ){
@@ -25,2 +26,3 @@ public:
map.insert( "Priority", QString::number( (*it).priority() ) );
+ map.insert( "Summary", (*it).summary() );
QArray<int> arrat = (*it).categories();
@@ -113,2 +115,4 @@ public:
event.setDescription( dummy );
+ dummy = element->attribute("Summary" );
+ event.setSummary( dummy );
// category
diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp
index aa348a2..fb7073c 100644
--- a/libopie/todoevent.cpp
+++ b/libopie/todoevent.cpp
@@ -19,4 +19,7 @@ ToDoEvent::ToDoEvent(const ToDoEvent &event )
-ToDoEvent::ToDoEvent(bool completed, int priority, const QStringList &category,
- const QString &description, bool hasDate, QDate date, int uid )
+ToDoEvent::ToDoEvent(bool completed, int priority,
+ const QStringList &category,
+ const QString& summary,
+ const QString &description,
+ bool hasDate, QDate date, int uid )
{
@@ -27,2 +30,3 @@ ToDoEvent::ToDoEvent(bool completed, int priority, const QStringList &category,
m_category = category;
+ m_sum = summary;
m_desc = Qtopia::simplifyMultiLineSpace(description );
@@ -68,2 +72,10 @@ QStringList ToDoEvent::allCategories()const
}
+QString ToDoEvent::extra(const QString& )const
+{
+ return QString::null;
+}
+QString ToDoEvent::summary() const
+{
+ return m_sum;
+}
void ToDoEvent::insertCategory(const QString &str )
@@ -101,2 +113,10 @@ void ToDoEvent::setDescription(const QString &desc )
}
+void ToDoEvent::setExtra( const QString&, const QString& )
+{
+
+}
+void ToDoEvent::setSummary( const QString& sum )
+{
+ m_sum = sum;
+}
void ToDoEvent::setCategory( const QString &cat )
@@ -132,2 +152,4 @@ QString ToDoEvent::richText() const
if ( !description().isEmpty() ){
+ text += "<b>" + QObject::tr( "Summary:") + "</b><br>";
+ text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
text += "<b>" + QObject::tr( "Description:" ) + "</b><br>";
@@ -217,3 +239,9 @@ 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_desc )
+ if( m_priority == toDoEvent.m_priority &&
+ m_isCompleted == toDoEvent.m_isCompleted &&
+ m_hasDate == toDoEvent.m_hasDate &&
+ m_date == toDoEvent.m_date &&
+ m_category == toDoEvent.m_category &&
+ m_sum == toDoEvent.m_sum &&
+ m_desc == toDoEvent.m_desc )
return true;
@@ -230,2 +258,3 @@ ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item )
m_uid = item.m_uid;
+ m_sum = item.m_sum;
return *this;
diff --git a/libopie/todoevent.h b/libopie/todoevent.h
index 8a00f99..7454241 100644
--- a/libopie/todoevent.h
+++ b/libopie/todoevent.h
@@ -4,2 +4,3 @@
+#include <qmap.h>
#include <qregexp.h>
@@ -17,2 +18,3 @@ class ToDoEvent {
@param category Which category does it belong( uid )
+ @param summary A small summary of the todo
@param description What is this ToDoEvent about
@@ -24,2 +26,3 @@ class ToDoEvent {
const QStringList &category = QStringList(),
+ const QString &summary = QString::null ,
const QString &description = QString::null ,
@@ -45,11 +48,48 @@ class ToDoEvent {
int priority()const ;
+
+ /*
+ All category numbers as QString in a List
+ **/
QStringList allCategories()const;
+
+ /*
+ * Same as above but with QArray<int>
+ */
QArray<int> categories() const;
+
+ /**
+ * The end Date
+ */
QDate date()const;
+
+ /**
+ * The description of the todo
+ */
QString description()const;
+ /**
+ * A small summary of the todo
+ */
+ QString summary() const;
+
+ /**
+ * Return this todoevent in a RichText formatted QString
+ */
QString richText() const;
+ /**
+ * Returns the UID of the Todo
+ */
int uid()const { return m_uid;};
+
+
+ QString extra(const QString& )const;
+ /**
+ * Set if this Todo is completed
+ */
void setCompleted(bool completed );
+
+ /**
+ * set if this todo got an end data
+ */
void setHasDate( bool hasDate );
@@ -60,8 +100,25 @@ class ToDoEvent {
void insertCategory(const QString &category );
+
+ /**
+ * Removes this event from all categories
+ */
void clearCategories();
+
+ /**
+ * This todo belongs to xxx categories
+ */
void setCategories(const QStringList& );
+ /**
+ * Set the priority of the Todo
+ */
void setPriority(int priority );
+
+ /**
+ * set the end date
+ */
void setDate( QDate date );
void setDescription(const QString& );
+ void setSummary(const QString& );
+ void setExtra( const QString&, const QString& );
bool isOverdue();
@@ -87,2 +144,4 @@ class ToDoEvent {
QString m_desc;
+ QString m_sum;
+ QMap<QString, QString> m_extra;
int m_uid;
diff --git a/libopie/todovcalresource.cpp b/libopie/todovcalresource.cpp
index 75f2197..80f8c60 100644
--- a/libopie/todovcalresource.cpp
+++ b/libopie/todovcalresource.cpp
@@ -52,3 +52,3 @@ static VObject *vobjByEvent( const ToDoEvent &event )
addPropValue( task, VCDescriptionProp, event.description().local8Bit() );
- addPropValue( task, VCSummaryProp, event.description().left(15).local8Bit() );
+ addPropValue( task, VCSummaryProp, event.summary().left(15).local8Bit() );
return task;
@@ -66,2 +66,7 @@ static ToDoEvent eventByVObj( VObject *obj ){
}
+ // summary
+ if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) {
+ name = vObjectStringZValue( ob );
+ event.setSummary( name );
+ }
// completed