author | zecke <zecke> | 2002-06-15 16:46:37 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-06-15 16:46:37 (UTC) |
commit | ff47b17768607d8819ef5cd3316a1cab0abdcf3a (patch) (side-by-side diff) | |
tree | addbc4d7d8826ce2952aca872e67e3575d77cda7 | |
parent | 9f41969610f9db5d60d6080abae0b21e54a549e2 (diff) | |
download | opie-ff47b17768607d8819ef5cd3316a1cab0abdcf3a.zip opie-ff47b17768607d8819ef5cd3316a1cab0abdcf3a.tar.gz opie-ff47b17768607d8819ef5cd3316a1cab0abdcf3a.tar.bz2 |
Summary support
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 2 | ||||
-rw-r--r-- | core/pim/todo/todoentry.ui | 370 | ||||
-rw-r--r-- | core/pim/todo/todoentryimpl.cpp | 7 | ||||
-rw-r--r-- | core/pim/todo/todotable.cpp | 11 | ||||
-rw-r--r-- | core/pim/todo/todotable.h | 3 | ||||
-rw-r--r-- | libopie/tododb.cpp | 12 | ||||
-rw-r--r-- | libopie/todoevent.cpp | 43 | ||||
-rw-r--r-- | libopie/todoevent.h | 67 | ||||
-rw-r--r-- | libopie/todovcalresource.cpp | 23 |
9 files changed, 353 insertions, 185 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 @@ -596,3 +596,3 @@ void TodoWindow::slotBeam() 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 @@ -32,3 +32,3 @@ <y>0</y> - <width>249</width> + <width>245</width> <height>321</height> @@ -46,188 +46,248 @@ </property> - <vbox> + <widget> + <class>QLayoutWidget</class> <property stdset="1"> - <name>margin</name> - <number>0</number> + <name>name</name> + <cstring>Layout3</cstring> </property> <property stdset="1"> - <name>spacing</name> - <number>0</number> + <name>geometry</name> + <rect> + <x>1</x> + <y>25</y> + <width>243</width> + <height>17</height> + </rect> </property> - <widget> - <class>QLayoutWidget</class> + <hbox> <property stdset="1"> - <name>name</name> - <cstring>Layout4</cstring> + <name>margin</name> + <number>0</number> </property> - <hbox> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> <property stdset="1"> - <name>margin</name> - <number>0</number> + <name>name</name> + <cstring>TextLabel3</cstring> </property> <property stdset="1"> - <name>spacing</name> - <number>6</number> + <name>frameShape</name> + <enum>NoFrame</enum> </property> - <widget> - <class>QLabel</class> + <property stdset="1"> + <name>text</name> + <string>Category:</string> + </property> + </widget> + <widget> + <class>CategorySelect</class> + <property stdset="1"> + <name>name</name> + <cstring>comboCategory</cstring> + </property> + </widget> + </hbox> + </widget> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout6</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>0</x> + <y>0</y> + <width>240</width> + <height>320</height> + </rect> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <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>Layout4</cstring> + </property> + <hbox> <property stdset="1"> - <name>name</name> - <cstring>TextLabel2</cstring> + <name>margin</name> + <number>0</number> </property> <property stdset="1"> - <name>text</name> - <string>Priority:</string> + <name>spacing</name> + <number>6</number> </property> - </widget> - <widget> - <class>QComboBox</class> - <item> - <property> - <name>text</name> - <string>1 - Very High</string> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1</cstring> </property> - </item> - <item> - <property> + <property stdset="1"> <name>text</name> - <string>2 - High</string> + <string>Summary:</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> + </widget> + <widget> + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>lneSum</cstring> </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> - <widget> - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout3</cstring> - </property> - <hbox> + </widget> + </hbox> + </widget> + <widget row="3" column="0" > + <class>QMultiLineEdit</class> <property stdset="1"> - <name>margin</name> - <number>0</number> + <name>name</name> + <cstring>txtTodo</cstring> </property> + </widget> + <widget row="1" column="0" > + <class>QLayoutWidget</class> <property stdset="1"> - <name>spacing</name> - <number>6</number> + <name>name</name> + <cstring>Layout4</cstring> </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3</cstring> - </property> - <property stdset="1"> - <name>frameShape</name> - <enum>NoFrame</enum> - </property> + <hbox> <property stdset="1"> - <name>text</name> - <string>Category:</string> + <name>margin</name> + <number>0</number> </property> - </widget> - <widget> - <class>CategorySelect</class> <property stdset="1"> - <name>name</name> - <cstring>comboCategory</cstring> + <name>spacing</name> + <number>6</number> </property> - </widget> - </hbox> - </widget> - <widget> - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout4</cstring> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>checkCompleted</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>&Completed</string> + </property> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>checkDate</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>D&ue</string> + </property> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>buttonDate</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>text</name> + <string>1 Jan 2001</string> + </property> + </widget> + </hbox> + </widget> + <widget row="0" column="0" > + <class>QLayoutWidget</class> <property stdset="1"> - <name>spacing</name> - <number>6</number> + <name>name</name> + <cstring>Layout4</cstring> </property> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>checkCompleted</cstring> - </property> + <hbox> <property stdset="1"> - <name>text</name> - <string>&Completed</string> + <name>margin</name> + <number>0</number> </property> - </widget> - <widget> - <class>QCheckBox</class> <property stdset="1"> - <name>name</name> - <cstring>checkDate</cstring> + <name>spacing</name> + <number>6</number> </property> - <property stdset="1"> - <name>text</name> - <string>D&ue</string> - </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>buttonDate</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>text</name> - <string>1 Jan 2001</string> - </property> - </widget> - </hbox> - </widget> - <widget> - <class>QMultiLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>txtTodo</cstring> - </property> - </widget> - </vbox> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <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> </widget> 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 @@ -2,2 +2,3 @@ ** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (C) 2002 zecke ** @@ -63,2 +64,3 @@ NewTaskDialog::NewTaskDialog( const ToDoEvent& task, QWidget *parent, txtTodo->setText( task.description() ); + lneSum->setText( task.summary() ); } @@ -132,5 +134,6 @@ ToDoEvent NewTaskDialog::todoEntry() todo.setCompleted( checkCompleted->isChecked() ); - + 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 @@ -574,2 +574,3 @@ void TodoTable::updateJournal( const ToDoEvent &todo, journal_action action ) buf += " Description=\"" + todo.description() + "\""; + buf += " Summary=\"" + todo.summary() + "\""; if(todo.hasDate() ) { @@ -612,4 +613,7 @@ void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row ) { - QString strTodo; - strTodo = todo.description().left(40).simplifyWhiteSpace(); + QString strTodo = todo.summary(); + if( strTodo.isEmpty() ){ + strTodo = todo.description().left(40).simplifyWhiteSpace(); + //todo.setSummary(strTodo ); + } if ( row == -1 ) { @@ -910,2 +914,5 @@ static ToDoEvent xmlToEvent( XMLElement *element ) event.setDescription( dummy ); + // summary + dummy = element->attribute("Summary" ); + event.setSummary( dummy ); // category 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 @@ -201,3 +201,4 @@ inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row ) 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 @@ -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 @@ -116,4 +120,4 @@ public: QStringList ids = QStringList::split(";", dummy ); - event.setCategories( ids ); - + event.setCategories( ids ); + //uid @@ -183,3 +187,3 @@ QValueList<ToDoEvent> ToDoDB::overDue() QValueList<ToDoEvent> events; - for( QValueList<ToDoEvent>::Iterator it = m_todos.begin(); it!= m_todos.end(); ++it ){ + for( QValueList<ToDoEvent>::Iterator it = m_todos.begin(); it!= m_todos.end(); ++it ){ if( (*it).isOverdue() ) @@ -240,3 +244,3 @@ void ToDoDB::load() { - m_todos = m_res->load( m_fileName ); + m_todos = m_res->load( m_fileName ); } 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 ); @@ -33,3 +37,3 @@ ToDoEvent::ToDoEvent(bool completed, int priority, const QStringList &category, }// generate the ids - m_uid = uid; + m_uid = uid; } @@ -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 ) @@ -129,5 +149,7 @@ QString ToDoEvent::richText() const QStringList catlist; - + // 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>"; @@ -142,3 +164,3 @@ QString ToDoEvent::richText() const } - + // Open database of all categories and get the list of @@ -151,3 +173,3 @@ QString ToDoEvent::richText() const catlist = allCategories(); - + text += "<b>" + QObject::tr( "Category:") + "</b> "; @@ -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 @@ -22,5 +24,6 @@ class ToDoEvent { **/ - ToDoEvent( bool completed = false, int priority = NORMAL, - const QStringList &category = QStringList(), - const QString &description = QString::null , + 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 ); @@ -45,14 +48,51 @@ 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 - // this sets the the Category after this call category will be the only category + // this sets the the Category after this call category will be the only category void setCategory( const QString &category ); @@ -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 @@ -4,3 +4,3 @@ .>+-= the use of vobject was inspired by libkcal - _;:, .> :=|. This library is free software; you can + _;:, .> :=|. This library is free software; you can .> <`_, > . <= redistribute it and/or modify it under @@ -10,4 +10,4 @@ ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This library is distributed in the hope that + .%`+i> _;_. + .i_,=:_. -<s. This library is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; @@ -18,6 +18,6 @@ ++= -. .` .: details. - : = ...= . :.=- + : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with - -- :-=` this library; see the file COPYING.LIB. + -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, @@ -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; @@ -65,3 +65,8 @@ static ToDoEvent eventByVObj( VObject *obj ){ event.setDescription( name ); - } + } + // summary + if ( ( ob = isAPropertyOf( obj, VCSummaryProp ) ) != 0 ) { + name = vObjectStringZValue( ob ); + event.setSummary( name ); + } // completed @@ -87,3 +92,3 @@ static ToDoEvent eventByVObj( VObject *obj ){ event.setDate( TimeConversion::fromISO8601( name).date() ); - } + } // categories @@ -98,3 +103,3 @@ static ToDoEvent eventByVObj( VObject *obj ){ -QValueList<ToDoEvent> ToDoVCalResource::load(const QString &file) +QValueList<ToDoEvent> ToDoVCalResource::load(const QString &file) { |