-rw-r--r-- | core/pim/todo/mainwindow.cpp | 2 | ||||
-rw-r--r-- | core/pim/todo/todoentry.ui | 196 | ||||
-rw-r--r-- | core/pim/todo/todoentryimpl.cpp | 3 | ||||
-rw-r--r-- | core/pim/todo/todotable.cpp | 9 | ||||
-rw-r--r-- | core/pim/todo/todotable.h | 3 | ||||
-rw-r--r-- | libopie/tododb.cpp | 4 | ||||
-rw-r--r-- | libopie/todoevent.cpp | 35 | ||||
-rw-r--r-- | libopie/todoevent.h | 59 | ||||
-rw-r--r-- | libopie/todovcalresource.cpp | 7 |
9 files changed, 243 insertions, 75 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index b7b1da0..1358f1c 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -595,5 +595,5 @@ void TodoWindow::slotBeam() Ir *ir = new Ir( this ); connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); - QString description = c.description(); + QString description = c.summary(); ir->send( beamfile, description, "text/x-vCalendar" ); } diff --git a/core/pim/todo/todoentry.ui b/core/pim/todo/todoentry.ui index c735e76..87ee68c 100644 --- a/core/pim/todo/todoentry.ui +++ b/core/pim/todo/todoentry.ui @@ -31,5 +31,5 @@ <x>0</x> <y>0</y> - <width>249</width> + <width>245</width> <height>321</height> </rect> @@ -45,18 +45,18 @@ <name>layoutSpacing</name> </property> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>0</number> - </property> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>Layout4</cstring> + <cstring>Layout3</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>1</x> + <y>25</y> + <width>243</width> + <height>17</height> + </rect> </property> <hbox> @@ -73,66 +73,53 @@ <property stdset="1"> <name>name</name> - <cstring>TextLabel2</cstring> + <cstring>TextLabel3</cstring> + </property> + <property stdset="1"> + <name>frameShape</name> + <enum>NoFrame</enum> </property> <property stdset="1"> <name>text</name> - <string>Priority:</string> + <string>Category:</string> </property> </widget> <widget> - <class>QComboBox</class> - <item> - <property> - <name>text</name> - <string>1 - Very High</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>2 - High</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>3 - Normal</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>4 - Low</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>5 - Very Low</string> + <class>CategorySelect</class> + <property stdset="1"> + <name>name</name> + <cstring>comboCategory</cstring> </property> - </item> + </widget> + </hbox> + </widget> + <widget> + <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>comboPriority</cstring> + <cstring>Layout6</cstring> </property> <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> - </sizepolicy> + <name>geometry</name> + <rect> + <x>0</x> + <y>0</y> + <width>240</width> + <height>320</height> + </rect> </property> + <grid> <property stdset="1"> - <name>currentItem</name> - <number>2</number> + <name>margin</name> + <number>0</number> </property> - </widget> - </hbox> - </widget> - <widget> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget row="2" column="0" > <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>Layout3</cstring> + <cstring>Layout4</cstring> </property> <hbox> @@ -149,25 +136,28 @@ <property stdset="1"> <name>name</name> - <cstring>TextLabel3</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>NoFrame</enum> + <cstring>TextLabel1</cstring> </property> <property stdset="1"> <name>text</name> - <string>Category:</string> + <string>Summary:</string> </property> </widget> <widget> - <class>CategorySelect</class> + <class>QLineEdit</class> <property stdset="1"> <name>name</name> - <cstring>comboCategory</cstring> + <cstring>lneSum</cstring> </property> </widget> </hbox> </widget> - <widget> + <widget row="3" column="0" > + <class>QMultiLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>txtTodo</cstring> + </property> + </widget> + <widget row="1" column="0" > <class>QLayoutWidget</class> <property stdset="1"> @@ -223,12 +213,82 @@ </hbox> </widget> + <widget row="0" column="0" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout4</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> <widget> - <class>QMultiLineEdit</class> + <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>txtTodo</cstring> + <cstring>TextLabel2</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Priority:</string> + </property> + </widget> + <widget> + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>1 - Very High</string> </property> + </item> + <item> + <property> + <name>text</name> + <string>2 - High</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>3 - Normal</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>4 - Low</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>5 - Very Low</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>comboPriority</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>currentItem</name> + <number>2</number> + </property> + </widget> + </hbox> + </widget> + </grid> </widget> - </vbox> </widget> <customwidgets> diff --git a/core/pim/todo/todoentryimpl.cpp b/core/pim/todo/todoentryimpl.cpp index 26a685c..dfaf9b4 100644 --- a/core/pim/todo/todoentryimpl.cpp +++ b/core/pim/todo/todoentryimpl.cpp @@ -1,4 +1,5 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (C) 2002 zecke ** ** This file is part of Qtopia Environment. @@ -62,4 +63,5 @@ NewTaskDialog::NewTaskDialog( const ToDoEvent& task, QWidget *parent, txtTodo->setText( task.description() ); + lneSum->setText( task.summary() ); } @@ -133,4 +135,5 @@ ToDoEvent NewTaskDialog::todoEntry() todo.setDescription( txtTodo->text() ); + todo.setSummary( lneSum->text() ); return todo; diff --git a/core/pim/todo/todotable.cpp b/core/pim/todo/todotable.cpp index 52a3087..779b28c 100644 --- a/core/pim/todo/todotable.cpp +++ b/core/pim/todo/todotable.cpp @@ -573,4 +573,5 @@ void TodoTable::updateJournal( const ToDoEvent &todo, journal_action action ) buf += " Categories=\"" + attr + "\""; buf += " Description=\"" + todo.description() + "\""; + buf += " Summary=\"" + todo.summary() + "\""; if(todo.hasDate() ) { buf += " DateYear=\""+QString::number( todo.date().year() ) + "\""; @@ -611,6 +612,9 @@ void TodoTable::loadFile( const QString &/*we use the standard*/ ) void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row ) { - QString strTodo; + QString strTodo = todo.summary(); + if( strTodo.isEmpty() ){ strTodo = todo.description().left(40).simplifyWhiteSpace(); + //todo.setSummary(strTodo ); + } if ( row == -1 ) { QMapIterator<CheckItem*, ToDoEvent *> it; @@ -909,4 +913,7 @@ static ToDoEvent xmlToEvent( XMLElement *element ) dummy = element->attribute("Description" ); event.setDescription( dummy ); + // summary + dummy = element->attribute("Summary" ); + event.setSummary( dummy ); // category dummy = element->attribute("Categories" ); diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h index 7672f21..39e00d1 100644 --- a/core/pim/todo/todotable.h +++ b/core/pim/todo/todotable.h @@ -200,5 +200,6 @@ inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row ) ComboItem *cmb = new ComboItem( this, QTableItem::WhenCurrent ); cmb->setText( QString::number( todo->priority() ) ); - QTableItem *ti = new TodoTextItem( this, todo->description().left(40).simplifyWhiteSpace() ); + QString sum = todo->summary(); + QTableItem *ti = new TodoTextItem( this, sum.isEmpty() ? todo->description().left(40).simplifyWhiteSpace() : sum ); ti->setReplaceable( false ); diff --git a/libopie/tododb.cpp b/libopie/tododb.cpp index fe8b8bf..6b10ec2 100644 --- a/libopie/tododb.cpp +++ b/libopie/tododb.cpp @@ -14,4 +14,5 @@ class FileToDoResource : public ToDoResource { public: FileToDoResource() {}; + // FIXME better parsing bool save(const QString &name, const QValueList<ToDoEvent> &m_todos ){ // prepare the XML @@ -24,4 +25,5 @@ public: map.insert( "HasDate", QString::number((int)(*it).hasDate() ) ); map.insert( "Priority", QString::number( (*it).priority() ) ); + map.insert( "Summary", (*it).summary() ); QArray<int> arrat = (*it).categories(); QString attr; @@ -112,4 +114,6 @@ public: dummy = element->attribute("Description" ); event.setDescription( dummy ); + dummy = element->attribute("Summary" ); + event.setSummary( dummy ); // category dummy = element->attribute("Categories" ); diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp index aa348a2..fb7073c 100644 --- a/libopie/todoevent.cpp +++ b/libopie/todoevent.cpp @@ -18,6 +18,9 @@ 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 ) { m_date = date; @@ -26,4 +29,5 @@ ToDoEvent::ToDoEvent(bool completed, int priority, const QStringList &category, m_priority = priority; m_category = category; + m_sum = summary; m_desc = Qtopia::simplifyMultiLineSpace(description ); if (uid == -1 ) { @@ -67,4 +71,12 @@ QStringList ToDoEvent::allCategories()const return m_category; } +QString ToDoEvent::extra(const QString& )const +{ + return QString::null; +} +QString ToDoEvent::summary() const +{ + return m_sum; +} void ToDoEvent::insertCategory(const QString &str ) { @@ -100,4 +112,12 @@ void ToDoEvent::setDescription(const QString &desc ) m_desc = Qtopia::simplifyMultiLineSpace(desc ); } +void ToDoEvent::setExtra( const QString&, const QString& ) +{ + +} +void ToDoEvent::setSummary( const QString& sum ) +{ + m_sum = sum; +} void ToDoEvent::setCategory( const QString &cat ) { @@ -131,4 +151,6 @@ QString ToDoEvent::richText() const // Description of the todo 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>"; text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; @@ -216,5 +238,11 @@ bool ToDoEvent::operator>=(const ToDoEvent &toDoEvent )const 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; return false; @@ -229,4 +257,5 @@ ToDoEvent &ToDoEvent::operator=(const ToDoEvent &item ) m_desc = item.m_desc; 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 @@ -3,4 +3,5 @@ #define todoevent_h +#include <qmap.h> #include <qregexp.h> #include <qstringlist.h> @@ -16,4 +17,5 @@ class ToDoEvent { @param priority What is the priority of this ToDoEvent @param category Which category does it belong( uid ) + @param summary A small summary of the todo @param description What is this ToDoEvent about @param hasDate Does this Event got a deadline @@ -23,4 +25,5 @@ class ToDoEvent { ToDoEvent( bool completed = false, int priority = NORMAL, const QStringList &category = QStringList(), + const QString &summary = QString::null , const QString &description = QString::null , bool hasDate = false, QDate date = QDate::currentDate(), int uid = -1 ); @@ -44,13 +47,50 @@ 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 ); // if the category doesn't exist we will create it @@ -59,10 +99,27 @@ class ToDoEvent { // adds a category to the Categories of this event 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(); @@ -86,4 +143,6 @@ class ToDoEvent { QStringList m_category; 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 @@ -51,5 +51,5 @@ static VObject *vobjByEvent( const ToDoEvent &event ) addPropValue( task, VCCategoriesProp, event.allCategories().join(";").local8Bit() ); addPropValue( task, VCDescriptionProp, event.description().local8Bit() ); - addPropValue( task, VCSummaryProp, event.description().left(15).local8Bit() ); + addPropValue( task, VCSummaryProp, event.summary().left(15).local8Bit() ); return task; }; @@ -65,4 +65,9 @@ static ToDoEvent eventByVObj( VObject *obj ){ event.setDescription( name ); } + // summary + if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) { + name = vObjectStringZValue( ob ); + event.setSummary( name ); + } // completed if( ( ob = isAPropertyOf( obj, VCStatusProp )) != 0 ){ |