author | zecke <zecke> | 2002-11-15 21:43:59 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-11-15 21:43:59 (UTC) |
commit | a1306f7603ab9a05f7d0059fad60b68f01a0ae71 (patch) (unidiff) | |
tree | 9af055fb6dea589ac5e5d93a7bf9f192b257c4c8 | |
parent | 11116312592ada97b202f09c6e9ee57c9dd80b84 (diff) | |
download | opie-a1306f7603ab9a05f7d0059fad60b68f01a0ae71.zip opie-a1306f7603ab9a05f7d0059fad60b68f01a0ae71.tar.gz opie-a1306f7603ab9a05f7d0059fad60b68f01a0ae71.tar.bz2 |
Make OTodo compile
add the MaintainerMode to OTodo
-rw-r--r-- | libopie/libopie.pro | 2 | ||||
-rw-r--r-- | libopie/pim/opimmaintainer.cpp | 37 | ||||
-rw-r--r-- | libopie/pim/opimmaintainer.h | 36 | ||||
-rw-r--r-- | libopie/pim/opimxrefmanager.cpp | 2 | ||||
-rw-r--r-- | libopie/pim/otodo.cpp | 20 | ||||
-rw-r--r-- | libopie/pim/otodo.h | 12 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimmaintainer.cpp | 37 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimmaintainer.h | 36 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimxrefmanager.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.cpp | 20 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.h | 12 |
11 files changed, 214 insertions, 2 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro index 3e6156e..a80a407 100644 --- a/libopie/libopie.pro +++ b/libopie/libopie.pro | |||
@@ -1,89 +1,91 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qte warn_on release | 2 | CONFIG += qte warn_on release |
3 | HEADERS = ofontmenu.h \ | 3 | HEADERS = ofontmenu.h \ |
4 | ocolorbutton.h \ | 4 | ocolorbutton.h \ |
5 | ofiledialog.h ofileselector.h tododb.h \ | 5 | ofiledialog.h ofileselector.h tododb.h \ |
6 | ocheckitem.h todoevent.h todoresource.h \ | 6 | ocheckitem.h todoevent.h todoresource.h \ |
7 | todovcalresource.h xmltree.h \ | 7 | todovcalresource.h xmltree.h \ |
8 | colordialog.h colorpopupmenu.h \ | 8 | colordialog.h colorpopupmenu.h \ |
9 | oclickablelabel.h oprocctrl.h \ | 9 | oclickablelabel.h oprocctrl.h \ |
10 | oprocess.h odevice.h \ | 10 | oprocess.h odevice.h \ |
11 | otimepicker.h otabwidget.h \ | 11 | otimepicker.h otabwidget.h \ |
12 | otabbar.h otabinfo.h \ | 12 | otabbar.h otabinfo.h \ |
13 | ofontselector.h \ | 13 | ofontselector.h \ |
14 | pim/opimrecord.h \ | 14 | pim/opimrecord.h \ |
15 | pim/otodo.h \ | 15 | pim/otodo.h \ |
16 | pim/orecordlist.h \ | 16 | pim/orecordlist.h \ |
17 | pim/opimaccesstemplate.h \ | 17 | pim/opimaccesstemplate.h \ |
18 | pim/opimaccessbackend.h \ | 18 | pim/opimaccessbackend.h \ |
19 | pim/otodoaccess.h \ | 19 | pim/otodoaccess.h \ |
20 | pim/otodoaccessbackend.h \ | 20 | pim/otodoaccessbackend.h \ |
21 | pim/ocontact.h \ | 21 | pim/ocontact.h \ |
22 | pim/ocontactaccess.h \ | 22 | pim/ocontactaccess.h \ |
23 | pim/ocontactaccessbackend.h \ | 23 | pim/ocontactaccessbackend.h \ |
24 | pim/ocontactaccessbackend_xml.h \ | 24 | pim/ocontactaccessbackend_xml.h \ |
25 | pim/ocontactaccessbackend_vcard.h \ | 25 | pim/ocontactaccessbackend_vcard.h \ |
26 | pim/obackendfactory.h \ | 26 | pim/obackendfactory.h \ |
27 | pim/opimcache.h \ | 27 | pim/opimcache.h \ |
28 | pim/otodoaccessvcal.h \ | 28 | pim/otodoaccessvcal.h \ |
29 | pim/orecur.h \ | 29 | pim/orecur.h \ |
30 | pim/opimstate.h \ | 30 | pim/opimstate.h \ |
31 | pim/opimxrefpartner.h \ | 31 | pim/opimxrefpartner.h \ |
32 | pim/opimxref.h \ | 32 | pim/opimxref.h \ |
33 | pim/opimxrefmanager.h \ | 33 | pim/opimxrefmanager.h \ |
34 | pim/opimmaintainer.h \ | ||
34 | orecurrancewidget.h \ | 35 | orecurrancewidget.h \ |
35 | oticker.h | 36 | oticker.h |
36 | # pim/otodoaccesssql.h \ | 37 | # pim/otodoaccesssql.h \ |
37 | 38 | ||
38 | SOURCES = ofontmenu.cc \ | 39 | SOURCES = ofontmenu.cc \ |
39 | ocolorbutton.cpp \ | 40 | ocolorbutton.cpp \ |
40 | xmltree.cc \ | 41 | xmltree.cc \ |
41 | ofiledialog.cc ofileselector.cc \ | 42 | ofiledialog.cc ofileselector.cc \ |
42 | ocheckitem.cpp tododb.cpp todoevent.cpp \ | 43 | ocheckitem.cpp tododb.cpp todoevent.cpp \ |
43 | todovcalresource.cpp colordialog.cpp \ | 44 | todovcalresource.cpp colordialog.cpp \ |
44 | colorpopupmenu.cpp oclickablelabel.cpp \ | 45 | colorpopupmenu.cpp oclickablelabel.cpp \ |
45 | oprocctrl.cpp oprocess.cpp \ | 46 | oprocctrl.cpp oprocess.cpp \ |
46 | odevice.cpp otimepicker.cpp \ | 47 | odevice.cpp otimepicker.cpp \ |
47 | otabwidget.cpp otabbar.cpp \ | 48 | otabwidget.cpp otabbar.cpp \ |
48 | ofontselector.cpp \ | 49 | ofontselector.cpp \ |
49 | pim/otodo.cpp \ | 50 | pim/otodo.cpp \ |
50 | pim/opimrecord.cpp \ | 51 | pim/opimrecord.cpp \ |
51 | pim/otodoaccess.cpp \ | 52 | pim/otodoaccess.cpp \ |
52 | pim/otodoaccessbackend.cpp \ | 53 | pim/otodoaccessbackend.cpp \ |
53 | pim/otodoaccessxml.cpp \ | 54 | pim/otodoaccessxml.cpp \ |
54 | pim/ocontact.cpp \ | 55 | pim/ocontact.cpp \ |
55 | pim/ocontactaccess.cpp \ | 56 | pim/ocontactaccess.cpp \ |
56 | pim/ocontactaccessbackend_vcard.cpp \ | 57 | pim/ocontactaccessbackend_vcard.cpp \ |
57 | pim/otodoaccessvcal.cpp \ | 58 | pim/otodoaccessvcal.cpp \ |
58 | pim/orecur.cpp \ | 59 | pim/orecur.cpp \ |
59 | pim/opimstate.cpp \ | 60 | pim/opimstate.cpp \ |
60 | pim/opimxrefpartner.cpp \ | 61 | pim/opimxrefpartner.cpp \ |
61 | pim/opimxref.cpp \ | 62 | pim/opimxref.cpp \ |
62 | pim/opimxrefmanager.cpp \ | 63 | pim/opimxrefmanager.cpp \ |
64 | pim/opimmaintainer.cpp \ | ||
63 | orecurrancewidget.cpp \ | 65 | orecurrancewidget.cpp \ |
64 | oticker.cpp | 66 | oticker.cpp |
65 | # pim/otodoaccesssql.cpp \ | 67 | # pim/otodoaccesssql.cpp \ |
66 | 68 | ||
67 | TARGET = opie | 69 | TARGET = opie |
68 | INCLUDEPATH += $(OPIEDIR)/include | 70 | INCLUDEPATH += $(OPIEDIR)/include |
69 | DESTDIR = $(QTDIR)/lib$(PROJMAK) | 71 | DESTDIR = $(QTDIR)/lib$(PROJMAK) |
70 | #VERSION = 1.0.0 | 72 | #VERSION = 1.0.0 |
71 | 73 | ||
72 | # LIBS += -lopiesql | 74 | # LIBS += -lopiesql |
73 | 75 | ||
74 | INTERFACES = otimepickerbase.ui orecurrancebase.ui | 76 | INTERFACES = otimepickerbase.ui orecurrancebase.ui |
75 | 77 | ||
76 | TRANSLATIONS = ../i18n/de/libopie.ts \ | 78 | TRANSLATIONS = ../i18n/de/libopie.ts \ |
77 | ../i18n/en/libopie.ts \ | 79 | ../i18n/en/libopie.ts \ |
78 | ../i18n/es/libopie.ts \ | 80 | ../i18n/es/libopie.ts \ |
79 | ../i18n/fr/libopie.ts \ | 81 | ../i18n/fr/libopie.ts \ |
80 | ../i18n/hu/libopie.ts \ | 82 | ../i18n/hu/libopie.ts \ |
81 | ../i18n/ja/libopie.ts \ | 83 | ../i18n/ja/libopie.ts \ |
82 | ../i18n/ko/libopie.ts \ | 84 | ../i18n/ko/libopie.ts \ |
83 | ../i18n/no/libopie.ts \ | 85 | ../i18n/no/libopie.ts \ |
84 | ../i18n/pl/libopie.ts \ | 86 | ../i18n/pl/libopie.ts \ |
85 | ../i18n/pt/libopie.ts \ | 87 | ../i18n/pt/libopie.ts \ |
86 | ../i18n/pt_BR/libopie.ts \ | 88 | ../i18n/pt_BR/libopie.ts \ |
87 | ../i18n/sl/libopie.ts \ | 89 | ../i18n/sl/libopie.ts \ |
88 | ../i18n/zh_CN/libopie.ts \ | 90 | ../i18n/zh_CN/libopie.ts \ |
89 | ../i18n/zh_TW/libopie.ts | 91 | ../i18n/zh_TW/libopie.ts |
diff --git a/libopie/pim/opimmaintainer.cpp b/libopie/pim/opimmaintainer.cpp new file mode 100644 index 0000000..e34f035 --- a/dev/null +++ b/libopie/pim/opimmaintainer.cpp | |||
@@ -0,0 +1,37 @@ | |||
1 | #include "opimmaintainer.h" | ||
2 | |||
3 | OPimMaintainer::OPimMaintainer( enum Mode mode, int uid ) | ||
4 | : m_mode(mode), m_uid(uid ) | ||
5 | {} | ||
6 | OPimMaintainer::~OPimMaintainer() { | ||
7 | } | ||
8 | OPimMaintainer::OPimMaintainer( const OPimMaintainer& main ) { | ||
9 | *this = main; | ||
10 | } | ||
11 | OPimMaintainer &OPimMaintainer::operator=( const OPimMaintainer& main ) { | ||
12 | m_mode = main.m_mode; | ||
13 | m_uid = main.m_uid; | ||
14 | |||
15 | return *this; | ||
16 | } | ||
17 | bool OPimMaintainer::operator==( const OPimMaintainer& main ) { | ||
18 | if (m_mode != main.m_mode ) return false; | ||
19 | if (m_uid != main.m_uid ) return false; | ||
20 | |||
21 | return true; | ||
22 | } | ||
23 | bool OPimMaintainer::operator!=( const OPimMaintainer& main ) { | ||
24 | return !(*this == main ); | ||
25 | } | ||
26 | OPimMaintainer::Mode OPimMaintainer::mode()const { | ||
27 | return m_mode; | ||
28 | } | ||
29 | int OPimMaintainer::uid()const { | ||
30 | return m_uid; | ||
31 | } | ||
32 | void OPimMaintainer::setMode( enum Mode mo) { | ||
33 | m_mode = mo; | ||
34 | } | ||
35 | void OPimMaintainer::setUid( int uid ) { | ||
36 | m_uid = uid; | ||
37 | } | ||
diff --git a/libopie/pim/opimmaintainer.h b/libopie/pim/opimmaintainer.h new file mode 100644 index 0000000..310e15a --- a/dev/null +++ b/libopie/pim/opimmaintainer.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef OPIE_PIM_MAINTAINER_H | ||
2 | #define OPIE_PIM_MAINTAINER_H | ||
3 | |||
4 | #include <qstring.h> | ||
5 | |||
6 | /** | ||
7 | * Who maintains what? | ||
8 | */ | ||
9 | class OPimMaintainer { | ||
10 | public: | ||
11 | enum Mode { Undefined = -1, | ||
12 | Responsible = 0, | ||
13 | DoneBy, | ||
14 | Coordinating }; | ||
15 | OPimMaintainer( enum Mode mode = Undefined, int uid = 0); | ||
16 | OPimMaintainer( const OPimMaintainer& ); | ||
17 | ~OPimMaintainer(); | ||
18 | |||
19 | OPimMaintainer &operator=( const OPimMaintainer& ); | ||
20 | bool operator==( const OPimMaintainer& ); | ||
21 | bool operator!=( const OPimMaintainer& ); | ||
22 | |||
23 | |||
24 | Mode mode()const; | ||
25 | int uid()const; | ||
26 | |||
27 | void setMode( enum Mode ); | ||
28 | void setUid( int uid ); | ||
29 | |||
30 | private: | ||
31 | Mode m_mode; | ||
32 | int m_uid; | ||
33 | |||
34 | }; | ||
35 | |||
36 | #endif | ||
diff --git a/libopie/pim/opimxrefmanager.cpp b/libopie/pim/opimxrefmanager.cpp index d49f5f5..965f542 100644 --- a/libopie/pim/opimxrefmanager.cpp +++ b/libopie/pim/opimxrefmanager.cpp | |||
@@ -1,56 +1,58 @@ | |||
1 | #include "opimxrefmanager.h" | 1 | #include "opimxrefmanager.h" |
2 | 2 | ||
3 | 3 | ||
4 | OPimXRefManager::OPimXRefManager() { | 4 | OPimXRefManager::OPimXRefManager() { |
5 | } | 5 | } |
6 | OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { | 6 | OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { |
7 | m_list = ref.m_list; | 7 | m_list = ref.m_list; |
8 | } | 8 | } |
9 | OPimXRefManager::~OPimXRefManager() { | ||
10 | } | ||
9 | OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { | 11 | OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { |
10 | m_list = ref.m_list; | 12 | m_list = ref.m_list; |
11 | return *this; | 13 | return *this; |
12 | } | 14 | } |
13 | bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) { | 15 | bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) { |
14 | // if ( m_list == ref.m_list ) return true; | 16 | // if ( m_list == ref.m_list ) return true; |
15 | 17 | ||
16 | return false; | 18 | return false; |
17 | } | 19 | } |
18 | void OPimXRefManager::add( const OPimXRef& ref) { | 20 | void OPimXRefManager::add( const OPimXRef& ref) { |
19 | m_list.append( ref ); | 21 | m_list.append( ref ); |
20 | } | 22 | } |
21 | void OPimXRefManager::remove( const OPimXRef& ref) { | 23 | void OPimXRefManager::remove( const OPimXRef& ref) { |
22 | m_list.remove( ref ); | 24 | m_list.remove( ref ); |
23 | } | 25 | } |
24 | void OPimXRefManager::replace( const OPimXRef& ref) { | 26 | void OPimXRefManager::replace( const OPimXRef& ref) { |
25 | m_list.remove( ref ); | 27 | m_list.remove( ref ); |
26 | m_list.append( ref ); | 28 | m_list.append( ref ); |
27 | } | 29 | } |
28 | void OPimXRefManager::clear() { | 30 | void OPimXRefManager::clear() { |
29 | m_list.clear(); | 31 | m_list.clear(); |
30 | } | 32 | } |
31 | QStringList OPimXRefManager::apps()const { | 33 | QStringList OPimXRefManager::apps()const { |
32 | OPimXRef::ValueList::ConstIterator it; | 34 | OPimXRef::ValueList::ConstIterator it; |
33 | QStringList list; | 35 | QStringList list; |
34 | 36 | ||
35 | QString str; | 37 | QString str; |
36 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 38 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
37 | str = (*it).partner( OPimXRef::One ).appName(); | 39 | str = (*it).partner( OPimXRef::One ).appName(); |
38 | if ( !list.contains( str ) ) list << str; | 40 | if ( !list.contains( str ) ) list << str; |
39 | 41 | ||
40 | str = (*it).partner( OPimXRef::Two ).appName(); | 42 | str = (*it).partner( OPimXRef::Two ).appName(); |
41 | if ( !list.contains( str ) ) list << str; | 43 | if ( !list.contains( str ) ) list << str; |
42 | } | 44 | } |
43 | return list; | 45 | return list; |
44 | } | 46 | } |
45 | OPimXRef::ValueList OPimXRefManager::list()const { | 47 | OPimXRef::ValueList OPimXRefManager::list()const { |
46 | return m_list; | 48 | return m_list; |
47 | } | 49 | } |
48 | OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{ | 50 | OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{ |
49 | OPimXRef::ValueList list; | 51 | OPimXRef::ValueList list; |
50 | OPimXRef::ValueList::ConstIterator it; | 52 | OPimXRef::ValueList::ConstIterator it; |
51 | 53 | ||
52 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 54 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
53 | if ( (*it).containsString( appName ) ) | 55 | if ( (*it).containsString( appName ) ) |
54 | list.append( (*it) ); | 56 | list.append( (*it) ); |
55 | } | 57 | } |
56 | 58 | ||
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index 4d5cb79..6fcf9f6 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp | |||
@@ -1,83 +1,86 @@ | |||
1 | 1 | ||
2 | #include <qobject.h> | 2 | #include <qobject.h> |
3 | #include <qshared.h> | 3 | #include <qshared.h> |
4 | 4 | ||
5 | 5 | ||
6 | 6 | ||
7 | #include <qpe/palmtopuidgen.h> | 7 | #include <qpe/palmtopuidgen.h> |
8 | #include <qpe/stringutil.h> | 8 | #include <qpe/stringutil.h> |
9 | #include <qpe/palmtoprecord.h> | 9 | #include <qpe/palmtoprecord.h> |
10 | #include <qpe/stringutil.h> | 10 | #include <qpe/stringutil.h> |
11 | #include <qpe/categories.h> | 11 | #include <qpe/categories.h> |
12 | #include <qpe/categoryselect.h> | 12 | #include <qpe/categoryselect.h> |
13 | 13 | ||
14 | 14 | ||
15 | #include "opimstate.h" | 15 | #include "opimstate.h" |
16 | #include "orecur.h" | 16 | #include "orecur.h" |
17 | #include "opimmaintainer.h" | ||
18 | |||
17 | #include "otodo.h" | 19 | #include "otodo.h" |
18 | 20 | ||
19 | 21 | ||
20 | struct OTodo::OTodoData : public QShared { | 22 | struct OTodo::OTodoData : public QShared { |
21 | OTodoData() : QShared() { | 23 | OTodoData() : QShared() { |
22 | }; | 24 | }; |
23 | 25 | ||
24 | QDate date; | 26 | QDate date; |
25 | bool isCompleted:1; | 27 | bool isCompleted:1; |
26 | bool hasDate:1; | 28 | bool hasDate:1; |
27 | int priority; | 29 | int priority; |
28 | QString desc; | 30 | QString desc; |
29 | QString sum; | 31 | QString sum; |
30 | QMap<QString, QString> extra; | 32 | QMap<QString, QString> extra; |
31 | ushort prog; | 33 | ushort prog; |
32 | bool hasAlarmDateTime :1; | 34 | bool hasAlarmDateTime :1; |
33 | QDateTime alarmDateTime; | 35 | QDateTime alarmDateTime; |
34 | OPimState state; | 36 | OPimState state; |
35 | ORecur recur; | 37 | ORecur recur; |
38 | OPimMaintainer maintainer; | ||
36 | }; | 39 | }; |
37 | 40 | ||
38 | OTodo::OTodo(const OTodo &event ) | 41 | OTodo::OTodo(const OTodo &event ) |
39 | : OPimRecord( event ), data( event.data ) | 42 | : OPimRecord( event ), data( event.data ) |
40 | { | 43 | { |
41 | data->ref(); | 44 | data->ref(); |
42 | // qWarning("ref up"); | 45 | // qWarning("ref up"); |
43 | } | 46 | } |
44 | OTodo::~OTodo() { | 47 | OTodo::~OTodo() { |
45 | 48 | ||
46 | // qWarning("~OTodo " ); | 49 | // qWarning("~OTodo " ); |
47 | if ( data->deref() ) { | 50 | if ( data->deref() ) { |
48 | // qWarning("OTodo::dereffing"); | 51 | // qWarning("OTodo::dereffing"); |
49 | delete data; | 52 | delete data; |
50 | data = 0l; | 53 | data = 0l; |
51 | } | 54 | } |
52 | } | 55 | } |
53 | OTodo::OTodo(bool completed, int priority, | 56 | OTodo::OTodo(bool completed, int priority, |
54 | const QArray<int> &category, | 57 | const QArray<int> &category, |
55 | const QString& summary, | 58 | const QString& summary, |
56 | const QString &description, | 59 | const QString &description, |
57 | ushort progress, | 60 | ushort progress, |
58 | bool hasDate, QDate date, int uid ) | 61 | bool hasDate, QDate date, int uid ) |
59 | : OPimRecord( uid ) | 62 | : OPimRecord( uid ) |
60 | { | 63 | { |
61 | // qWarning("OTodoData " + summary); | 64 | // qWarning("OTodoData " + summary); |
62 | setCategories( category ); | 65 | setCategories( category ); |
63 | 66 | ||
64 | data = new OTodoData; | 67 | data = new OTodoData; |
65 | 68 | ||
66 | data->date = date; | 69 | data->date = date; |
67 | data->isCompleted = completed; | 70 | data->isCompleted = completed; |
68 | data->hasDate = hasDate; | 71 | data->hasDate = hasDate; |
69 | data->priority = priority; | 72 | data->priority = priority; |
70 | data->sum = summary; | 73 | data->sum = summary; |
71 | data->prog = progress; | 74 | data->prog = progress; |
72 | data->desc = Qtopia::simplifyMultiLineSpace(description ); | 75 | data->desc = Qtopia::simplifyMultiLineSpace(description ); |
73 | data->hasAlarmDateTime = false; | 76 | data->hasAlarmDateTime = false; |
74 | 77 | ||
75 | } | 78 | } |
76 | OTodo::OTodo(bool completed, int priority, | 79 | OTodo::OTodo(bool completed, int priority, |
77 | const QStringList &category, | 80 | const QStringList &category, |
78 | const QString& summary, | 81 | const QString& summary, |
79 | const QString &description, | 82 | const QString &description, |
80 | ushort progress, | 83 | ushort progress, |
81 | bool hasDate, QDate date, int uid ) | 84 | bool hasDate, QDate date, int uid ) |
82 | : OPimRecord( uid ) | 85 | : OPimRecord( uid ) |
83 | { | 86 | { |
@@ -108,145 +111,152 @@ bool OTodo::match( const QRegExp ®Exp )const | |||
108 | return true; | 111 | return true; |
109 | } | 112 | } |
110 | return false; | 113 | return false; |
111 | } | 114 | } |
112 | bool OTodo::isCompleted() const | 115 | bool OTodo::isCompleted() const |
113 | { | 116 | { |
114 | return data->isCompleted; | 117 | return data->isCompleted; |
115 | } | 118 | } |
116 | bool OTodo::hasDueDate() const | 119 | bool OTodo::hasDueDate() const |
117 | { | 120 | { |
118 | return data->hasDate; | 121 | return data->hasDate; |
119 | } | 122 | } |
120 | bool OTodo::hasAlarmDateTime() const | 123 | bool OTodo::hasAlarmDateTime() const |
121 | { | 124 | { |
122 | return data->hasAlarmDateTime; | 125 | return data->hasAlarmDateTime; |
123 | } | 126 | } |
124 | int OTodo::priority()const | 127 | int OTodo::priority()const |
125 | { | 128 | { |
126 | return data->priority; | 129 | return data->priority; |
127 | } | 130 | } |
128 | QString OTodo::summary() const | 131 | QString OTodo::summary() const |
129 | { | 132 | { |
130 | return data->sum; | 133 | return data->sum; |
131 | } | 134 | } |
132 | ushort OTodo::progress() const | 135 | ushort OTodo::progress() const |
133 | { | 136 | { |
134 | return data->prog; | 137 | return data->prog; |
135 | } | 138 | } |
136 | QDate OTodo::dueDate()const | 139 | QDate OTodo::dueDate()const |
137 | { | 140 | { |
138 | return data->date; | 141 | return data->date; |
139 | } | 142 | } |
140 | 143 | ||
141 | QDateTime OTodo::alarmDateTime() const | 144 | QDateTime OTodo::alarmDateTime() const |
142 | { | 145 | { |
143 | return data->alarmDateTime; | 146 | return data->alarmDateTime; |
144 | } | 147 | } |
145 | 148 | ||
146 | QString OTodo::description()const | 149 | QString OTodo::description()const |
147 | { | 150 | { |
148 | return data->desc; | 151 | return data->desc; |
149 | } | 152 | } |
150 | OPimState OTodo::state()const { | 153 | OPimState OTodo::state()const { |
151 | return data->state; | 154 | return data->state; |
152 | } | 155 | } |
153 | ORecur OTodo::recurrence()const { | 156 | ORecur OTodo::recurrence()const { |
154 | return data->recur; | 157 | return data->recur; |
155 | } | 158 | } |
159 | OPimMaintainer OTodo::maintainer()const { | ||
160 | return data->maintainer; | ||
161 | } | ||
156 | void OTodo::setCompleted( bool completed ) | 162 | void OTodo::setCompleted( bool completed ) |
157 | { | 163 | { |
158 | changeOrModify(); | 164 | changeOrModify(); |
159 | data->isCompleted = completed; | 165 | data->isCompleted = completed; |
160 | } | 166 | } |
161 | void OTodo::setHasDueDate( bool hasDate ) | 167 | void OTodo::setHasDueDate( bool hasDate ) |
162 | { | 168 | { |
163 | changeOrModify(); | 169 | changeOrModify(); |
164 | data->hasDate = hasDate; | 170 | data->hasDate = hasDate; |
165 | } | 171 | } |
166 | void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) | 172 | void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) |
167 | { | 173 | { |
168 | changeOrModify(); | 174 | changeOrModify(); |
169 | data->hasAlarmDateTime = hasAlarmDateTime; | 175 | data->hasAlarmDateTime = hasAlarmDateTime; |
170 | } | 176 | } |
171 | void OTodo::setDescription(const QString &desc ) | 177 | void OTodo::setDescription(const QString &desc ) |
172 | { | 178 | { |
173 | // qWarning( "desc " + desc ); | 179 | // qWarning( "desc " + desc ); |
174 | changeOrModify(); | 180 | changeOrModify(); |
175 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); | 181 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); |
176 | } | 182 | } |
177 | void OTodo::setSummary( const QString& sum ) | 183 | void OTodo::setSummary( const QString& sum ) |
178 | { | 184 | { |
179 | changeOrModify(); | 185 | changeOrModify(); |
180 | data->sum = sum; | 186 | data->sum = sum; |
181 | } | 187 | } |
182 | void OTodo::setPriority(int prio ) | 188 | void OTodo::setPriority(int prio ) |
183 | { | 189 | { |
184 | changeOrModify(); | 190 | changeOrModify(); |
185 | data->priority = prio; | 191 | data->priority = prio; |
186 | } | 192 | } |
187 | void OTodo::setDueDate( QDate date ) | 193 | void OTodo::setDueDate( QDate date ) |
188 | { | 194 | { |
189 | changeOrModify(); | 195 | changeOrModify(); |
190 | data->date = date; | 196 | data->date = date; |
191 | } | 197 | } |
192 | void OTodo::setAlarmDateTime( const QDateTime& alarm ) | 198 | void OTodo::setAlarmDateTime( const QDateTime& alarm ) |
193 | { | 199 | { |
194 | changeOrModify(); | 200 | changeOrModify(); |
195 | data->alarmDateTime = alarm; | 201 | data->alarmDateTime = alarm; |
196 | } | 202 | } |
197 | void OTodo::setState( const OPimState& state ) { | 203 | void OTodo::setState( const OPimState& state ) { |
198 | changeOrModify(); | 204 | changeOrModify(); |
199 | data->state = state; | 205 | data->state = state; |
200 | } | 206 | } |
201 | void OTodo::setRecurrence( const ORecur& rec) { | 207 | void OTodo::setRecurrence( const ORecur& rec) { |
202 | changeOrModify(); | 208 | changeOrModify(); |
203 | data->recur = rec; | 209 | data->recur = rec; |
204 | } | 210 | } |
211 | void OTodo::setMaintainer( const OPimMaintainer& pim ) { | ||
212 | changeOrModify(); | ||
213 | data->maintainer = pim; | ||
214 | } | ||
205 | bool OTodo::isOverdue( ) | 215 | bool OTodo::isOverdue( ) |
206 | { | 216 | { |
207 | if( data->hasDate && !data->isCompleted) | 217 | if( data->hasDate && !data->isCompleted) |
208 | return QDate::currentDate() > data->date; | 218 | return QDate::currentDate() > data->date; |
209 | return false; | 219 | return false; |
210 | } | 220 | } |
211 | void OTodo::setProgress(ushort progress ) | 221 | void OTodo::setProgress(ushort progress ) |
212 | { | 222 | { |
213 | changeOrModify(); | 223 | changeOrModify(); |
214 | data->prog = progress; | 224 | data->prog = progress; |
215 | } | 225 | } |
216 | QString OTodo::toShortText() const { | 226 | QString OTodo::toShortText() const { |
217 | return summary(); | 227 | return summary(); |
218 | } | 228 | } |
219 | /*! | 229 | /*! |
220 | Returns a richt text string | 230 | Returns a richt text string |
221 | */ | 231 | */ |
222 | QString OTodo::toRichText() const | 232 | QString OTodo::toRichText() const |
223 | { | 233 | { |
224 | QString text; | 234 | QString text; |
225 | QStringList catlist; | 235 | QStringList catlist; |
226 | 236 | ||
227 | // Description of the todo | 237 | // Description of the todo |
228 | if ( !summary().isEmpty() ) { | 238 | if ( !summary().isEmpty() ) { |
229 | text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; | 239 | text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; |
230 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 240 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
231 | } | 241 | } |
232 | if( !description().isEmpty() ){ | 242 | if( !description().isEmpty() ){ |
233 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; | 243 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; |
234 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; | 244 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; |
235 | } | 245 | } |
236 | text += "<br><br><br>"; | 246 | text += "<br><br><br>"; |
237 | 247 | ||
238 | text += "<b>" + QObject::tr( "Priority:") +" </b>" | 248 | text += "<b>" + QObject::tr( "Priority:") +" </b>" |
239 | + QString::number( priority() ) + " <br>"; | 249 | + QString::number( priority() ) + " <br>"; |
240 | text += "<b>" + QObject::tr( "Progress:") + " </b>" | 250 | text += "<b>" + QObject::tr( "Progress:") + " </b>" |
241 | + QString::number( progress() ) + " %<br>"; | 251 | + QString::number( progress() ) + " %<br>"; |
242 | if (hasDueDate() ){ | 252 | if (hasDueDate() ){ |
243 | text += "<b>" + QObject::tr( "Deadline:") + " </b>"; | 253 | text += "<b>" + QObject::tr( "Deadline:") + " </b>"; |
244 | text += dueDate().toString(); | 254 | text += dueDate().toString(); |
245 | text += "<br>"; | 255 | text += "<br>"; |
246 | } | 256 | } |
247 | if (hasAlarmDateTime() ){ | 257 | if (hasAlarmDateTime() ){ |
248 | text += "<b>" + QObject::tr( "Alarmed Notification:") + " </b>"; | 258 | text += "<b>" + QObject::tr( "Alarmed Notification:") + " </b>"; |
249 | text += alarmDateTime().toString(); | 259 | text += alarmDateTime().toString(); |
250 | text += "<br>"; | 260 | text += "<br>"; |
251 | } | 261 | } |
252 | 262 | ||
@@ -276,130 +286,138 @@ bool OTodo::operator<=(const OTodo &toDoEvent )const | |||
276 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 286 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
277 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 287 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
278 | return priority() <= toDoEvent.priority(); | 288 | return priority() <= toDoEvent.priority(); |
279 | }else{ | 289 | }else{ |
280 | return dueDate() <= toDoEvent.dueDate(); | 290 | return dueDate() <= toDoEvent.dueDate(); |
281 | } | 291 | } |
282 | } | 292 | } |
283 | return true; | 293 | return true; |
284 | } | 294 | } |
285 | bool OTodo::operator>(const OTodo &toDoEvent )const | 295 | bool OTodo::operator>(const OTodo &toDoEvent )const |
286 | { | 296 | { |
287 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; | 297 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; |
288 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 298 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
289 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 299 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
290 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 300 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
291 | return priority() > toDoEvent.priority(); | 301 | return priority() > toDoEvent.priority(); |
292 | }else{ | 302 | }else{ |
293 | return dueDate() > toDoEvent.dueDate(); | 303 | return dueDate() > toDoEvent.dueDate(); |
294 | } | 304 | } |
295 | } | 305 | } |
296 | return false; | 306 | return false; |
297 | } | 307 | } |
298 | bool OTodo::operator>=(const OTodo &toDoEvent )const | 308 | bool OTodo::operator>=(const OTodo &toDoEvent )const |
299 | { | 309 | { |
300 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 310 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
301 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 311 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
302 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 312 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
303 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 313 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
304 | return priority() > toDoEvent.priority(); | 314 | return priority() > toDoEvent.priority(); |
305 | }else{ | 315 | }else{ |
306 | return dueDate() > toDoEvent.dueDate(); | 316 | return dueDate() > toDoEvent.dueDate(); |
307 | } | 317 | } |
308 | } | 318 | } |
309 | return true; | 319 | return true; |
310 | } | 320 | } |
311 | bool OTodo::operator==(const OTodo &toDoEvent )const | 321 | bool OTodo::operator==(const OTodo &toDoEvent )const |
312 | { | 322 | { |
313 | if ( data->priority != toDoEvent.data->priority ) return false; | 323 | if ( data->priority != toDoEvent.data->priority ) return false; |
314 | if ( data->priority != toDoEvent.data->prog ) return false; | 324 | if ( data->priority != toDoEvent.data->prog ) return false; |
315 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; | 325 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; |
316 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; | 326 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; |
317 | if ( data->date != toDoEvent.data->date ) return false; | 327 | if ( data->date != toDoEvent.data->date ) return false; |
318 | if ( data->sum != toDoEvent.data->sum ) return false; | 328 | if ( data->sum != toDoEvent.data->sum ) return false; |
319 | if ( data->desc != toDoEvent.data->desc ) return false; | 329 | if ( data->desc != toDoEvent.data->desc ) return false; |
320 | if ( data->hasAlarmDateTime != toDoEvent.data->hasAlarmDateTime ) | 330 | if ( data->hasAlarmDateTime != toDoEvent.data->hasAlarmDateTime ) |
321 | return false; | 331 | return false; |
322 | if ( data->alarmDateTime != toDoEvent.data->alarmDateTime ) | 332 | if ( data->alarmDateTime != toDoEvent.data->alarmDateTime ) |
323 | return false; | 333 | return false; |
334 | if ( data->maintainer != toDoEvent.data->maintainer ) | ||
335 | return false; | ||
324 | 336 | ||
325 | return OPimRecord::operator==( toDoEvent ); | 337 | return OPimRecord::operator==( toDoEvent ); |
326 | } | 338 | } |
327 | void OTodo::deref() { | 339 | void OTodo::deref() { |
328 | 340 | ||
329 | // qWarning("deref in ToDoEvent"); | 341 | // qWarning("deref in ToDoEvent"); |
330 | if ( data->deref() ) { | 342 | if ( data->deref() ) { |
331 | // qWarning("deleting"); | 343 | // qWarning("deleting"); |
332 | delete data; | 344 | delete data; |
333 | data= 0; | 345 | data= 0; |
334 | } | 346 | } |
335 | } | 347 | } |
336 | OTodo &OTodo::operator=(const OTodo &item ) | 348 | OTodo &OTodo::operator=(const OTodo &item ) |
337 | { | 349 | { |
338 | OPimRecord::operator=( item ); | 350 | OPimRecord::operator=( item ); |
339 | //qWarning("operator= ref "); | 351 | //qWarning("operator= ref "); |
340 | item.data->ref(); | 352 | item.data->ref(); |
341 | deref(); | 353 | deref(); |
342 | data = item.data; | 354 | data = item.data; |
343 | 355 | ||
344 | return *this; | 356 | return *this; |
345 | } | 357 | } |
346 | 358 | ||
347 | QMap<int, QString> OTodo::toMap() const { | 359 | QMap<int, QString> OTodo::toMap() const { |
348 | QMap<int, QString> map; | 360 | QMap<int, QString> map; |
349 | 361 | ||
350 | map.insert( Uid, QString::number( uid() ) ); | 362 | map.insert( Uid, QString::number( uid() ) ); |
351 | map.insert( Category, idsToString( categories() ) ); | 363 | map.insert( Category, idsToString( categories() ) ); |
352 | map.insert( HasDate, QString::number( data->hasDate ) ); | 364 | map.insert( HasDate, QString::number( data->hasDate ) ); |
353 | map.insert( Completed, QString::number( data->isCompleted ) ); | 365 | map.insert( Completed, QString::number( data->isCompleted ) ); |
354 | map.insert( Description, data->desc ); | 366 | map.insert( Description, data->desc ); |
355 | map.insert( Summary, data->sum ); | 367 | map.insert( Summary, data->sum ); |
356 | map.insert( Priority, QString::number( data->priority ) ); | 368 | map.insert( Priority, QString::number( data->priority ) ); |
357 | map.insert( DateDay, QString::number( data->date.day() ) ); | 369 | map.insert( DateDay, QString::number( data->date.day() ) ); |
358 | map.insert( DateMonth, QString::number( data->date.month() ) ); | 370 | map.insert( DateMonth, QString::number( data->date.month() ) ); |
359 | map.insert( DateYear, QString::number( data->date.year() ) ); | 371 | map.insert( DateYear, QString::number( data->date.year() ) ); |
360 | map.insert( Progress, QString::number( data->prog ) ); | 372 | map.insert( Progress, QString::number( data->prog ) ); |
361 | map.insert( CrossReference, crossToString() ); | 373 | // map.insert( CrossReference, crossToString() ); |
362 | map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) ); | 374 | map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) ); |
363 | map.insert( AlarmDateTime, data->alarmDateTime.toString() ); | 375 | map.insert( AlarmDateTime, data->alarmDateTime.toString() ); |
364 | 376 | ||
365 | return map; | 377 | return map; |
366 | } | 378 | } |
367 | 379 | ||
368 | QMap<QString, QString> OTodo::toExtraMap()const { | 380 | QMap<QString, QString> OTodo::toExtraMap()const { |
369 | return data->extra; | 381 | return data->extra; |
370 | } | 382 | } |
371 | /** | 383 | /** |
372 | * change or modify looks at the ref count and either | 384 | * change or modify looks at the ref count and either |
373 | * creates a new QShared Object or it can modify it | 385 | * creates a new QShared Object or it can modify it |
374 | * right in place | 386 | * right in place |
375 | */ | 387 | */ |
376 | void OTodo::changeOrModify() { | 388 | void OTodo::changeOrModify() { |
377 | if ( data->count != 1 ) { | 389 | if ( data->count != 1 ) { |
378 | qWarning("changeOrModify"); | 390 | qWarning("changeOrModify"); |
379 | data->deref(); | 391 | data->deref(); |
380 | OTodoData* d2 = new OTodoData(); | 392 | OTodoData* d2 = new OTodoData(); |
381 | copy(data, d2 ); | 393 | copy(data, d2 ); |
382 | data = d2; | 394 | data = d2; |
383 | } | 395 | } |
384 | } | 396 | } |
397 | // WATCHOUT | ||
398 | /* | ||
399 | * if you add something to the Data struct | ||
400 | * be sure to copy it here | ||
401 | */ | ||
385 | void OTodo::copy( OTodoData* src, OTodoData* dest ) { | 402 | void OTodo::copy( OTodoData* src, OTodoData* dest ) { |
386 | dest->date = src->date; | 403 | dest->date = src->date; |
387 | dest->isCompleted = src->isCompleted; | 404 | dest->isCompleted = src->isCompleted; |
388 | dest->hasDate = src->hasDate; | 405 | dest->hasDate = src->hasDate; |
389 | dest->priority = src->priority; | 406 | dest->priority = src->priority; |
390 | dest->desc = src->desc; | 407 | dest->desc = src->desc; |
391 | dest->sum = src->sum; | 408 | dest->sum = src->sum; |
392 | dest->extra = src->extra; | 409 | dest->extra = src->extra; |
393 | dest->prog = src->prog; | 410 | dest->prog = src->prog; |
394 | dest->hasAlarmDateTime = src->hasAlarmDateTime; | 411 | dest->hasAlarmDateTime = src->hasAlarmDateTime; |
395 | dest->alarmDateTime = src->alarmDateTime; | 412 | dest->alarmDateTime = src->alarmDateTime; |
396 | dest->state = src->state; | 413 | dest->state = src->state; |
397 | dest->recur = src->recur; | 414 | dest->recur = src->recur; |
415 | dest->maintainer = src->maintainer; | ||
398 | } | 416 | } |
399 | QString OTodo::type() const { | 417 | QString OTodo::type() const { |
400 | return QString::fromLatin1("OTodo"); | 418 | return QString::fromLatin1("OTodo"); |
401 | } | 419 | } |
402 | QString OTodo::recordField(int /*id*/ )const { | 420 | QString OTodo::recordField(int /*id*/ )const { |
403 | return QString::null; | 421 | return QString::null; |
404 | } | 422 | } |
405 | 423 | ||
diff --git a/libopie/pim/otodo.h b/libopie/pim/otodo.h index 2cdc587..70b0253 100644 --- a/libopie/pim/otodo.h +++ b/libopie/pim/otodo.h | |||
@@ -1,68 +1,69 @@ | |||
1 | 1 | ||
2 | #ifndef OPIE_TODO_EVENT_H | 2 | #ifndef OPIE_TODO_EVENT_H |
3 | #define OPIE_TODO_EVENT_H | 3 | #define OPIE_TODO_EVENT_H |
4 | 4 | ||
5 | 5 | ||
6 | #include <qarray.h> | 6 | #include <qarray.h> |
7 | #include <qmap.h> | 7 | #include <qmap.h> |
8 | #include <qregexp.h> | 8 | #include <qregexp.h> |
9 | #include <qstringlist.h> | 9 | #include <qstringlist.h> |
10 | #include <qdatetime.h> | 10 | #include <qdatetime.h> |
11 | #include <qvaluelist.h> | 11 | #include <qvaluelist.h> |
12 | 12 | ||
13 | #include <qpe/recordfields.h> | 13 | #include <qpe/recordfields.h> |
14 | #include <qpe/palmtopuidgen.h> | 14 | #include <qpe/palmtopuidgen.h> |
15 | 15 | ||
16 | #include <opie/opimrecord.h> | 16 | #include <opie/opimrecord.h> |
17 | 17 | ||
18 | 18 | ||
19 | class OPimState; | 19 | class OPimState; |
20 | class ORecur; | 20 | class ORecur; |
21 | class OPimMaintainer; | ||
21 | class OTodo : public OPimRecord { | 22 | class OTodo : public OPimRecord { |
22 | public: | 23 | public: |
23 | typedef QValueList<OTodo> ValueList; | 24 | typedef QValueList<OTodo> ValueList; |
24 | enum RecordFields { | 25 | enum RecordFields { |
25 | Uid = Qtopia::UID_ID, | 26 | Uid = Qtopia::UID_ID, |
26 | Category = Qtopia::CATEGORY_ID, | 27 | Category = Qtopia::CATEGORY_ID, |
27 | HasDate, | 28 | HasDate, |
28 | Completed, | 29 | Completed, |
29 | Description, | 30 | Description, |
30 | Summary, | 31 | Summary, |
31 | Priority, | 32 | Priority, |
32 | DateDay, | 33 | DateDay, |
33 | DateMonth, | 34 | DateMonth, |
34 | DateYear, | 35 | DateYear, |
35 | Progress, | 36 | Progress, |
36 | CrossReference, | 37 | CrossReference, |
37 | HasAlarmDateTime, | 38 | HasAlarmDateTime, |
38 | AlarmDateTime, | 39 | AlarmDateTime, |
39 | State, | 40 | State, |
40 | Recurrance, | 41 | Recurrance, |
41 | Alarms, | 42 | Alarms, |
42 | Reminders, | 43 | Reminders, |
43 | Notifiers | 44 | Notifiers |
44 | }; | 45 | }; |
45 | public: | 46 | public: |
46 | // priorities from Very low to very high | 47 | // priorities from Very low to very high |
47 | enum TaskPriority { VeryHigh=1, High, Normal, Low, VeryLow }; | 48 | enum TaskPriority { VeryHigh=1, High, Normal, Low, VeryLow }; |
48 | 49 | ||
49 | /* Constructs a new ToDoEvent | 50 | /* Constructs a new ToDoEvent |
50 | @param completed Is the TodoEvent completed | 51 | @param completed Is the TodoEvent completed |
51 | @param priority What is the priority of this ToDoEvent | 52 | @param priority What is the priority of this ToDoEvent |
52 | @param category Which category does it belong( uid ) | 53 | @param category Which category does it belong( uid ) |
53 | @param summary A small summary of the todo | 54 | @param summary A small summary of the todo |
54 | @param description What is this ToDoEvent about | 55 | @param description What is this ToDoEvent about |
55 | @param hasDate Does this Event got a deadline | 56 | @param hasDate Does this Event got a deadline |
56 | @param date what is the deadline? | 57 | @param date what is the deadline? |
57 | @param uid what is the UUID of this Event | 58 | @param uid what is the UUID of this Event |
58 | **/ | 59 | **/ |
59 | OTodo( bool completed = false, int priority = Normal, | 60 | OTodo( bool completed = false, int priority = Normal, |
60 | const QStringList &category = QStringList(), | 61 | const QStringList &category = QStringList(), |
61 | const QString &summary = QString::null , | 62 | const QString &summary = QString::null , |
62 | const QString &description = QString::null, | 63 | const QString &description = QString::null, |
63 | ushort progress = 0, | 64 | ushort progress = 0, |
64 | bool hasDate = false, QDate date = QDate::currentDate(), | 65 | bool hasDate = false, QDate date = QDate::currentDate(), |
65 | int uid = 0 /*empty*/ ); | 66 | int uid = 0 /*empty*/ ); |
66 | 67 | ||
67 | OTodo( bool completed, int priority, | 68 | OTodo( bool completed, int priority, |
68 | const QArray<int>& category, | 69 | const QArray<int>& category, |
@@ -83,152 +84,163 @@ public: | |||
83 | ~OTodo(); | 84 | ~OTodo(); |
84 | 85 | ||
85 | /** | 86 | /** |
86 | * Is this event completed? | 87 | * Is this event completed? |
87 | */ | 88 | */ |
88 | bool isCompleted() const; | 89 | bool isCompleted() const; |
89 | 90 | ||
90 | /** | 91 | /** |
91 | * Does this Event have a deadline | 92 | * Does this Event have a deadline |
92 | */ | 93 | */ |
93 | bool hasDueDate() const; | 94 | bool hasDueDate() const; |
94 | 95 | ||
95 | /** | 96 | /** |
96 | * Does this Event has an alarm time ? | 97 | * Does this Event has an alarm time ? |
97 | */ | 98 | */ |
98 | bool hasAlarmDateTime() const; | 99 | bool hasAlarmDateTime() const; |
99 | 100 | ||
100 | /** | 101 | /** |
101 | * What is the priority? | 102 | * What is the priority? |
102 | */ | 103 | */ |
103 | int priority()const ; | 104 | int priority()const ; |
104 | 105 | ||
105 | /** | 106 | /** |
106 | * progress as ushort 0, 20, 40, 60, 80 or 100% | 107 | * progress as ushort 0, 20, 40, 60, 80 or 100% |
107 | */ | 108 | */ |
108 | ushort progress() const; | 109 | ushort progress() const; |
109 | 110 | ||
110 | /** | 111 | /** |
111 | * The due Date | 112 | * The due Date |
112 | */ | 113 | */ |
113 | QDate dueDate()const; | 114 | QDate dueDate()const; |
114 | 115 | ||
115 | /** | 116 | /** |
116 | * Alarm Date and Time | 117 | * Alarm Date and Time |
117 | */ | 118 | */ |
118 | QDateTime alarmDateTime()const; | 119 | QDateTime alarmDateTime()const; |
119 | 120 | ||
120 | /** | 121 | /** |
121 | * What is the state of this OTodo? | 122 | * What is the state of this OTodo? |
122 | */ | 123 | */ |
123 | OPimState state()const; | 124 | OPimState state()const; |
124 | 125 | ||
125 | /** | 126 | /** |
126 | * the recurrance of this | 127 | * the recurrance of this |
127 | */ | 128 | */ |
128 | ORecur recurrence()const; | 129 | ORecur recurrence()const; |
129 | 130 | ||
130 | /** | 131 | /** |
132 | * the Maintainer of this OTodo | ||
133 | */ | ||
134 | OPimMaintainer maintainer()const; | ||
135 | |||
136 | /** | ||
131 | * The description of the todo | 137 | * The description of the todo |
132 | */ | 138 | */ |
133 | QString description()const; | 139 | QString description()const; |
134 | 140 | ||
135 | /** | 141 | /** |
136 | * A small summary of the todo | 142 | * A small summary of the todo |
137 | */ | 143 | */ |
138 | QString summary() const; | 144 | QString summary() const; |
139 | 145 | ||
140 | /** | 146 | /** |
141 | * @reimplemented | 147 | * @reimplemented |
142 | * Return this todoevent in a RichText formatted QString | 148 | * Return this todoevent in a RichText formatted QString |
143 | */ | 149 | */ |
144 | QString toRichText() const; | 150 | QString toRichText() const; |
145 | 151 | ||
146 | /** | 152 | /** |
147 | * reimplementation | 153 | * reimplementation |
148 | */ | 154 | */ |
149 | QString type()const; | 155 | QString type()const; |
150 | QString toShortText()const; | 156 | QString toShortText()const; |
151 | QMap<QString, QString> toExtraMap()const; | 157 | QMap<QString, QString> toExtraMap()const; |
152 | QString recordField(int id )const; | 158 | QString recordField(int id )const; |
153 | 159 | ||
154 | /** | 160 | /** |
155 | * toMap puts all data into the map. int relates | 161 | * toMap puts all data into the map. int relates |
156 | * to ToDoEvent RecordFields enum | 162 | * to ToDoEvent RecordFields enum |
157 | */ | 163 | */ |
158 | QMap<int, QString> toMap()const; | 164 | QMap<int, QString> toMap()const; |
159 | 165 | ||
160 | /** | 166 | /** |
161 | * Set if this Todo is completed | 167 | * Set if this Todo is completed |
162 | */ | 168 | */ |
163 | void setCompleted(bool completed ); | 169 | void setCompleted(bool completed ); |
164 | 170 | ||
165 | /** | 171 | /** |
166 | * set if this todo got an end data | 172 | * set if this todo got an end data |
167 | */ | 173 | */ |
168 | void setHasDueDate( bool hasDate ); | 174 | void setHasDueDate( bool hasDate ); |
169 | 175 | ||
170 | /** | 176 | /** |
171 | * set if this todo has an alarm time and date | 177 | * set if this todo has an alarm time and date |
172 | */ | 178 | */ |
173 | void setHasAlarmDateTime ( bool hasAlarm ); | 179 | void setHasAlarmDateTime ( bool hasAlarm ); |
174 | 180 | ||
175 | /** | 181 | /** |
176 | * Set the priority of the Todo | 182 | * Set the priority of the Todo |
177 | */ | 183 | */ |
178 | void setPriority(int priority ); | 184 | void setPriority(int priority ); |
179 | 185 | ||
180 | /** | 186 | /** |
181 | * Set the progress. | 187 | * Set the progress. |
182 | */ | 188 | */ |
183 | void setProgress( ushort progress ); | 189 | void setProgress( ushort progress ); |
184 | 190 | ||
185 | /** | 191 | /** |
186 | * set the end date | 192 | * set the end date |
187 | */ | 193 | */ |
188 | void setDueDate( QDate date ); | 194 | void setDueDate( QDate date ); |
189 | 195 | ||
190 | 196 | ||
191 | void setRecurrence( const ORecur& ); | 197 | void setRecurrence( const ORecur& ); |
192 | /** | 198 | /** |
193 | * set the alarm time | 199 | * set the alarm time |
194 | */ | 200 | */ |
195 | void setAlarmDateTime ( const QDateTime& alarm ); | 201 | void setAlarmDateTime ( const QDateTime& alarm ); |
196 | 202 | ||
197 | void setDescription(const QString& ); | 203 | void setDescription(const QString& ); |
198 | void setSummary(const QString& ); | 204 | void setSummary(const QString& ); |
199 | 205 | ||
200 | /** | 206 | /** |
201 | * set the state of a Todo | 207 | * set the state of a Todo |
202 | * @param state State what the todo should take | 208 | * @param state State what the todo should take |
203 | */ | 209 | */ |
204 | void setState( const OPimState& state); | 210 | void setState( const OPimState& state); |
211 | |||
212 | /** | ||
213 | * set the Maintainer Mode | ||
214 | */ | ||
215 | void setMaintainer( const OPimMaintainer& ); | ||
216 | |||
205 | bool isOverdue(); | 217 | bool isOverdue(); |
206 | 218 | ||
207 | 219 | ||
208 | bool match( const QRegExp &r )const; | 220 | bool match( const QRegExp &r )const; |
209 | 221 | ||
210 | bool operator<(const OTodo &toDoEvent )const; | 222 | bool operator<(const OTodo &toDoEvent )const; |
211 | bool operator<=(const OTodo &toDoEvent )const; | 223 | bool operator<=(const OTodo &toDoEvent )const; |
212 | bool operator!=(const OTodo &toDoEvent )const; | 224 | bool operator!=(const OTodo &toDoEvent )const; |
213 | bool operator>(const OTodo &toDoEvent )const; | 225 | bool operator>(const OTodo &toDoEvent )const; |
214 | bool operator>=(const OTodo &toDoEvent)const; | 226 | bool operator>=(const OTodo &toDoEvent)const; |
215 | bool operator==(const OTodo &toDoEvent )const; | 227 | bool operator==(const OTodo &toDoEvent )const; |
216 | OTodo &operator=(const OTodo &toDoEvent ); | 228 | OTodo &operator=(const OTodo &toDoEvent ); |
217 | 229 | ||
218 | private: | 230 | private: |
219 | class OTodoPrivate; | 231 | class OTodoPrivate; |
220 | struct OTodoData; | 232 | struct OTodoData; |
221 | 233 | ||
222 | void deref(); | 234 | void deref(); |
223 | inline void changeOrModify(); | 235 | inline void changeOrModify(); |
224 | void copy( OTodoData* src, OTodoData* dest ); | 236 | void copy( OTodoData* src, OTodoData* dest ); |
225 | OTodoPrivate *d; | 237 | OTodoPrivate *d; |
226 | OTodoData *data; | 238 | OTodoData *data; |
227 | 239 | ||
228 | }; | 240 | }; |
229 | inline bool OTodo::operator!=(const OTodo &toDoEvent )const { | 241 | inline bool OTodo::operator!=(const OTodo &toDoEvent )const { |
230 | return !(*this == toDoEvent); | 242 | return !(*this == toDoEvent); |
231 | } | 243 | } |
232 | 244 | ||
233 | 245 | ||
234 | #endif | 246 | #endif |
diff --git a/libopie2/opiepim/core/opimmaintainer.cpp b/libopie2/opiepim/core/opimmaintainer.cpp new file mode 100644 index 0000000..e34f035 --- a/dev/null +++ b/libopie2/opiepim/core/opimmaintainer.cpp | |||
@@ -0,0 +1,37 @@ | |||
1 | #include "opimmaintainer.h" | ||
2 | |||
3 | OPimMaintainer::OPimMaintainer( enum Mode mode, int uid ) | ||
4 | : m_mode(mode), m_uid(uid ) | ||
5 | {} | ||
6 | OPimMaintainer::~OPimMaintainer() { | ||
7 | } | ||
8 | OPimMaintainer::OPimMaintainer( const OPimMaintainer& main ) { | ||
9 | *this = main; | ||
10 | } | ||
11 | OPimMaintainer &OPimMaintainer::operator=( const OPimMaintainer& main ) { | ||
12 | m_mode = main.m_mode; | ||
13 | m_uid = main.m_uid; | ||
14 | |||
15 | return *this; | ||
16 | } | ||
17 | bool OPimMaintainer::operator==( const OPimMaintainer& main ) { | ||
18 | if (m_mode != main.m_mode ) return false; | ||
19 | if (m_uid != main.m_uid ) return false; | ||
20 | |||
21 | return true; | ||
22 | } | ||
23 | bool OPimMaintainer::operator!=( const OPimMaintainer& main ) { | ||
24 | return !(*this == main ); | ||
25 | } | ||
26 | OPimMaintainer::Mode OPimMaintainer::mode()const { | ||
27 | return m_mode; | ||
28 | } | ||
29 | int OPimMaintainer::uid()const { | ||
30 | return m_uid; | ||
31 | } | ||
32 | void OPimMaintainer::setMode( enum Mode mo) { | ||
33 | m_mode = mo; | ||
34 | } | ||
35 | void OPimMaintainer::setUid( int uid ) { | ||
36 | m_uid = uid; | ||
37 | } | ||
diff --git a/libopie2/opiepim/core/opimmaintainer.h b/libopie2/opiepim/core/opimmaintainer.h new file mode 100644 index 0000000..310e15a --- a/dev/null +++ b/libopie2/opiepim/core/opimmaintainer.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef OPIE_PIM_MAINTAINER_H | ||
2 | #define OPIE_PIM_MAINTAINER_H | ||
3 | |||
4 | #include <qstring.h> | ||
5 | |||
6 | /** | ||
7 | * Who maintains what? | ||
8 | */ | ||
9 | class OPimMaintainer { | ||
10 | public: | ||
11 | enum Mode { Undefined = -1, | ||
12 | Responsible = 0, | ||
13 | DoneBy, | ||
14 | Coordinating }; | ||
15 | OPimMaintainer( enum Mode mode = Undefined, int uid = 0); | ||
16 | OPimMaintainer( const OPimMaintainer& ); | ||
17 | ~OPimMaintainer(); | ||
18 | |||
19 | OPimMaintainer &operator=( const OPimMaintainer& ); | ||
20 | bool operator==( const OPimMaintainer& ); | ||
21 | bool operator!=( const OPimMaintainer& ); | ||
22 | |||
23 | |||
24 | Mode mode()const; | ||
25 | int uid()const; | ||
26 | |||
27 | void setMode( enum Mode ); | ||
28 | void setUid( int uid ); | ||
29 | |||
30 | private: | ||
31 | Mode m_mode; | ||
32 | int m_uid; | ||
33 | |||
34 | }; | ||
35 | |||
36 | #endif | ||
diff --git a/libopie2/opiepim/core/opimxrefmanager.cpp b/libopie2/opiepim/core/opimxrefmanager.cpp index d49f5f5..965f542 100644 --- a/libopie2/opiepim/core/opimxrefmanager.cpp +++ b/libopie2/opiepim/core/opimxrefmanager.cpp | |||
@@ -1,56 +1,58 @@ | |||
1 | #include "opimxrefmanager.h" | 1 | #include "opimxrefmanager.h" |
2 | 2 | ||
3 | 3 | ||
4 | OPimXRefManager::OPimXRefManager() { | 4 | OPimXRefManager::OPimXRefManager() { |
5 | } | 5 | } |
6 | OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { | 6 | OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) { |
7 | m_list = ref.m_list; | 7 | m_list = ref.m_list; |
8 | } | 8 | } |
9 | OPimXRefManager::~OPimXRefManager() { | ||
10 | } | ||
9 | OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { | 11 | OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) { |
10 | m_list = ref.m_list; | 12 | m_list = ref.m_list; |
11 | return *this; | 13 | return *this; |
12 | } | 14 | } |
13 | bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) { | 15 | bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) { |
14 | // if ( m_list == ref.m_list ) return true; | 16 | // if ( m_list == ref.m_list ) return true; |
15 | 17 | ||
16 | return false; | 18 | return false; |
17 | } | 19 | } |
18 | void OPimXRefManager::add( const OPimXRef& ref) { | 20 | void OPimXRefManager::add( const OPimXRef& ref) { |
19 | m_list.append( ref ); | 21 | m_list.append( ref ); |
20 | } | 22 | } |
21 | void OPimXRefManager::remove( const OPimXRef& ref) { | 23 | void OPimXRefManager::remove( const OPimXRef& ref) { |
22 | m_list.remove( ref ); | 24 | m_list.remove( ref ); |
23 | } | 25 | } |
24 | void OPimXRefManager::replace( const OPimXRef& ref) { | 26 | void OPimXRefManager::replace( const OPimXRef& ref) { |
25 | m_list.remove( ref ); | 27 | m_list.remove( ref ); |
26 | m_list.append( ref ); | 28 | m_list.append( ref ); |
27 | } | 29 | } |
28 | void OPimXRefManager::clear() { | 30 | void OPimXRefManager::clear() { |
29 | m_list.clear(); | 31 | m_list.clear(); |
30 | } | 32 | } |
31 | QStringList OPimXRefManager::apps()const { | 33 | QStringList OPimXRefManager::apps()const { |
32 | OPimXRef::ValueList::ConstIterator it; | 34 | OPimXRef::ValueList::ConstIterator it; |
33 | QStringList list; | 35 | QStringList list; |
34 | 36 | ||
35 | QString str; | 37 | QString str; |
36 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 38 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
37 | str = (*it).partner( OPimXRef::One ).appName(); | 39 | str = (*it).partner( OPimXRef::One ).appName(); |
38 | if ( !list.contains( str ) ) list << str; | 40 | if ( !list.contains( str ) ) list << str; |
39 | 41 | ||
40 | str = (*it).partner( OPimXRef::Two ).appName(); | 42 | str = (*it).partner( OPimXRef::Two ).appName(); |
41 | if ( !list.contains( str ) ) list << str; | 43 | if ( !list.contains( str ) ) list << str; |
42 | } | 44 | } |
43 | return list; | 45 | return list; |
44 | } | 46 | } |
45 | OPimXRef::ValueList OPimXRefManager::list()const { | 47 | OPimXRef::ValueList OPimXRefManager::list()const { |
46 | return m_list; | 48 | return m_list; |
47 | } | 49 | } |
48 | OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{ | 50 | OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{ |
49 | OPimXRef::ValueList list; | 51 | OPimXRef::ValueList list; |
50 | OPimXRef::ValueList::ConstIterator it; | 52 | OPimXRef::ValueList::ConstIterator it; |
51 | 53 | ||
52 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 54 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
53 | if ( (*it).containsString( appName ) ) | 55 | if ( (*it).containsString( appName ) ) |
54 | list.append( (*it) ); | 56 | list.append( (*it) ); |
55 | } | 57 | } |
56 | 58 | ||
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp index 4d5cb79..6fcf9f6 100644 --- a/libopie2/opiepim/otodo.cpp +++ b/libopie2/opiepim/otodo.cpp | |||
@@ -1,83 +1,86 @@ | |||
1 | 1 | ||
2 | #include <qobject.h> | 2 | #include <qobject.h> |
3 | #include <qshared.h> | 3 | #include <qshared.h> |
4 | 4 | ||
5 | 5 | ||
6 | 6 | ||
7 | #include <qpe/palmtopuidgen.h> | 7 | #include <qpe/palmtopuidgen.h> |
8 | #include <qpe/stringutil.h> | 8 | #include <qpe/stringutil.h> |
9 | #include <qpe/palmtoprecord.h> | 9 | #include <qpe/palmtoprecord.h> |
10 | #include <qpe/stringutil.h> | 10 | #include <qpe/stringutil.h> |
11 | #include <qpe/categories.h> | 11 | #include <qpe/categories.h> |
12 | #include <qpe/categoryselect.h> | 12 | #include <qpe/categoryselect.h> |
13 | 13 | ||
14 | 14 | ||
15 | #include "opimstate.h" | 15 | #include "opimstate.h" |
16 | #include "orecur.h" | 16 | #include "orecur.h" |
17 | #include "opimmaintainer.h" | ||
18 | |||
17 | #include "otodo.h" | 19 | #include "otodo.h" |
18 | 20 | ||
19 | 21 | ||
20 | struct OTodo::OTodoData : public QShared { | 22 | struct OTodo::OTodoData : public QShared { |
21 | OTodoData() : QShared() { | 23 | OTodoData() : QShared() { |
22 | }; | 24 | }; |
23 | 25 | ||
24 | QDate date; | 26 | QDate date; |
25 | bool isCompleted:1; | 27 | bool isCompleted:1; |
26 | bool hasDate:1; | 28 | bool hasDate:1; |
27 | int priority; | 29 | int priority; |
28 | QString desc; | 30 | QString desc; |
29 | QString sum; | 31 | QString sum; |
30 | QMap<QString, QString> extra; | 32 | QMap<QString, QString> extra; |
31 | ushort prog; | 33 | ushort prog; |
32 | bool hasAlarmDateTime :1; | 34 | bool hasAlarmDateTime :1; |
33 | QDateTime alarmDateTime; | 35 | QDateTime alarmDateTime; |
34 | OPimState state; | 36 | OPimState state; |
35 | ORecur recur; | 37 | ORecur recur; |
38 | OPimMaintainer maintainer; | ||
36 | }; | 39 | }; |
37 | 40 | ||
38 | OTodo::OTodo(const OTodo &event ) | 41 | OTodo::OTodo(const OTodo &event ) |
39 | : OPimRecord( event ), data( event.data ) | 42 | : OPimRecord( event ), data( event.data ) |
40 | { | 43 | { |
41 | data->ref(); | 44 | data->ref(); |
42 | // qWarning("ref up"); | 45 | // qWarning("ref up"); |
43 | } | 46 | } |
44 | OTodo::~OTodo() { | 47 | OTodo::~OTodo() { |
45 | 48 | ||
46 | // qWarning("~OTodo " ); | 49 | // qWarning("~OTodo " ); |
47 | if ( data->deref() ) { | 50 | if ( data->deref() ) { |
48 | // qWarning("OTodo::dereffing"); | 51 | // qWarning("OTodo::dereffing"); |
49 | delete data; | 52 | delete data; |
50 | data = 0l; | 53 | data = 0l; |
51 | } | 54 | } |
52 | } | 55 | } |
53 | OTodo::OTodo(bool completed, int priority, | 56 | OTodo::OTodo(bool completed, int priority, |
54 | const QArray<int> &category, | 57 | const QArray<int> &category, |
55 | const QString& summary, | 58 | const QString& summary, |
56 | const QString &description, | 59 | const QString &description, |
57 | ushort progress, | 60 | ushort progress, |
58 | bool hasDate, QDate date, int uid ) | 61 | bool hasDate, QDate date, int uid ) |
59 | : OPimRecord( uid ) | 62 | : OPimRecord( uid ) |
60 | { | 63 | { |
61 | // qWarning("OTodoData " + summary); | 64 | // qWarning("OTodoData " + summary); |
62 | setCategories( category ); | 65 | setCategories( category ); |
63 | 66 | ||
64 | data = new OTodoData; | 67 | data = new OTodoData; |
65 | 68 | ||
66 | data->date = date; | 69 | data->date = date; |
67 | data->isCompleted = completed; | 70 | data->isCompleted = completed; |
68 | data->hasDate = hasDate; | 71 | data->hasDate = hasDate; |
69 | data->priority = priority; | 72 | data->priority = priority; |
70 | data->sum = summary; | 73 | data->sum = summary; |
71 | data->prog = progress; | 74 | data->prog = progress; |
72 | data->desc = Qtopia::simplifyMultiLineSpace(description ); | 75 | data->desc = Qtopia::simplifyMultiLineSpace(description ); |
73 | data->hasAlarmDateTime = false; | 76 | data->hasAlarmDateTime = false; |
74 | 77 | ||
75 | } | 78 | } |
76 | OTodo::OTodo(bool completed, int priority, | 79 | OTodo::OTodo(bool completed, int priority, |
77 | const QStringList &category, | 80 | const QStringList &category, |
78 | const QString& summary, | 81 | const QString& summary, |
79 | const QString &description, | 82 | const QString &description, |
80 | ushort progress, | 83 | ushort progress, |
81 | bool hasDate, QDate date, int uid ) | 84 | bool hasDate, QDate date, int uid ) |
82 | : OPimRecord( uid ) | 85 | : OPimRecord( uid ) |
83 | { | 86 | { |
@@ -108,145 +111,152 @@ bool OTodo::match( const QRegExp ®Exp )const | |||
108 | return true; | 111 | return true; |
109 | } | 112 | } |
110 | return false; | 113 | return false; |
111 | } | 114 | } |
112 | bool OTodo::isCompleted() const | 115 | bool OTodo::isCompleted() const |
113 | { | 116 | { |
114 | return data->isCompleted; | 117 | return data->isCompleted; |
115 | } | 118 | } |
116 | bool OTodo::hasDueDate() const | 119 | bool OTodo::hasDueDate() const |
117 | { | 120 | { |
118 | return data->hasDate; | 121 | return data->hasDate; |
119 | } | 122 | } |
120 | bool OTodo::hasAlarmDateTime() const | 123 | bool OTodo::hasAlarmDateTime() const |
121 | { | 124 | { |
122 | return data->hasAlarmDateTime; | 125 | return data->hasAlarmDateTime; |
123 | } | 126 | } |
124 | int OTodo::priority()const | 127 | int OTodo::priority()const |
125 | { | 128 | { |
126 | return data->priority; | 129 | return data->priority; |
127 | } | 130 | } |
128 | QString OTodo::summary() const | 131 | QString OTodo::summary() const |
129 | { | 132 | { |
130 | return data->sum; | 133 | return data->sum; |
131 | } | 134 | } |
132 | ushort OTodo::progress() const | 135 | ushort OTodo::progress() const |
133 | { | 136 | { |
134 | return data->prog; | 137 | return data->prog; |
135 | } | 138 | } |
136 | QDate OTodo::dueDate()const | 139 | QDate OTodo::dueDate()const |
137 | { | 140 | { |
138 | return data->date; | 141 | return data->date; |
139 | } | 142 | } |
140 | 143 | ||
141 | QDateTime OTodo::alarmDateTime() const | 144 | QDateTime OTodo::alarmDateTime() const |
142 | { | 145 | { |
143 | return data->alarmDateTime; | 146 | return data->alarmDateTime; |
144 | } | 147 | } |
145 | 148 | ||
146 | QString OTodo::description()const | 149 | QString OTodo::description()const |
147 | { | 150 | { |
148 | return data->desc; | 151 | return data->desc; |
149 | } | 152 | } |
150 | OPimState OTodo::state()const { | 153 | OPimState OTodo::state()const { |
151 | return data->state; | 154 | return data->state; |
152 | } | 155 | } |
153 | ORecur OTodo::recurrence()const { | 156 | ORecur OTodo::recurrence()const { |
154 | return data->recur; | 157 | return data->recur; |
155 | } | 158 | } |
159 | OPimMaintainer OTodo::maintainer()const { | ||
160 | return data->maintainer; | ||
161 | } | ||
156 | void OTodo::setCompleted( bool completed ) | 162 | void OTodo::setCompleted( bool completed ) |
157 | { | 163 | { |
158 | changeOrModify(); | 164 | changeOrModify(); |
159 | data->isCompleted = completed; | 165 | data->isCompleted = completed; |
160 | } | 166 | } |
161 | void OTodo::setHasDueDate( bool hasDate ) | 167 | void OTodo::setHasDueDate( bool hasDate ) |
162 | { | 168 | { |
163 | changeOrModify(); | 169 | changeOrModify(); |
164 | data->hasDate = hasDate; | 170 | data->hasDate = hasDate; |
165 | } | 171 | } |
166 | void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) | 172 | void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) |
167 | { | 173 | { |
168 | changeOrModify(); | 174 | changeOrModify(); |
169 | data->hasAlarmDateTime = hasAlarmDateTime; | 175 | data->hasAlarmDateTime = hasAlarmDateTime; |
170 | } | 176 | } |
171 | void OTodo::setDescription(const QString &desc ) | 177 | void OTodo::setDescription(const QString &desc ) |
172 | { | 178 | { |
173 | // qWarning( "desc " + desc ); | 179 | // qWarning( "desc " + desc ); |
174 | changeOrModify(); | 180 | changeOrModify(); |
175 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); | 181 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); |
176 | } | 182 | } |
177 | void OTodo::setSummary( const QString& sum ) | 183 | void OTodo::setSummary( const QString& sum ) |
178 | { | 184 | { |
179 | changeOrModify(); | 185 | changeOrModify(); |
180 | data->sum = sum; | 186 | data->sum = sum; |
181 | } | 187 | } |
182 | void OTodo::setPriority(int prio ) | 188 | void OTodo::setPriority(int prio ) |
183 | { | 189 | { |
184 | changeOrModify(); | 190 | changeOrModify(); |
185 | data->priority = prio; | 191 | data->priority = prio; |
186 | } | 192 | } |
187 | void OTodo::setDueDate( QDate date ) | 193 | void OTodo::setDueDate( QDate date ) |
188 | { | 194 | { |
189 | changeOrModify(); | 195 | changeOrModify(); |
190 | data->date = date; | 196 | data->date = date; |
191 | } | 197 | } |
192 | void OTodo::setAlarmDateTime( const QDateTime& alarm ) | 198 | void OTodo::setAlarmDateTime( const QDateTime& alarm ) |
193 | { | 199 | { |
194 | changeOrModify(); | 200 | changeOrModify(); |
195 | data->alarmDateTime = alarm; | 201 | data->alarmDateTime = alarm; |
196 | } | 202 | } |
197 | void OTodo::setState( const OPimState& state ) { | 203 | void OTodo::setState( const OPimState& state ) { |
198 | changeOrModify(); | 204 | changeOrModify(); |
199 | data->state = state; | 205 | data->state = state; |
200 | } | 206 | } |
201 | void OTodo::setRecurrence( const ORecur& rec) { | 207 | void OTodo::setRecurrence( const ORecur& rec) { |
202 | changeOrModify(); | 208 | changeOrModify(); |
203 | data->recur = rec; | 209 | data->recur = rec; |
204 | } | 210 | } |
211 | void OTodo::setMaintainer( const OPimMaintainer& pim ) { | ||
212 | changeOrModify(); | ||
213 | data->maintainer = pim; | ||
214 | } | ||
205 | bool OTodo::isOverdue( ) | 215 | bool OTodo::isOverdue( ) |
206 | { | 216 | { |
207 | if( data->hasDate && !data->isCompleted) | 217 | if( data->hasDate && !data->isCompleted) |
208 | return QDate::currentDate() > data->date; | 218 | return QDate::currentDate() > data->date; |
209 | return false; | 219 | return false; |
210 | } | 220 | } |
211 | void OTodo::setProgress(ushort progress ) | 221 | void OTodo::setProgress(ushort progress ) |
212 | { | 222 | { |
213 | changeOrModify(); | 223 | changeOrModify(); |
214 | data->prog = progress; | 224 | data->prog = progress; |
215 | } | 225 | } |
216 | QString OTodo::toShortText() const { | 226 | QString OTodo::toShortText() const { |
217 | return summary(); | 227 | return summary(); |
218 | } | 228 | } |
219 | /*! | 229 | /*! |
220 | Returns a richt text string | 230 | Returns a richt text string |
221 | */ | 231 | */ |
222 | QString OTodo::toRichText() const | 232 | QString OTodo::toRichText() const |
223 | { | 233 | { |
224 | QString text; | 234 | QString text; |
225 | QStringList catlist; | 235 | QStringList catlist; |
226 | 236 | ||
227 | // Description of the todo | 237 | // Description of the todo |
228 | if ( !summary().isEmpty() ) { | 238 | if ( !summary().isEmpty() ) { |
229 | text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; | 239 | text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; |
230 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 240 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
231 | } | 241 | } |
232 | if( !description().isEmpty() ){ | 242 | if( !description().isEmpty() ){ |
233 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; | 243 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; |
234 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; | 244 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; |
235 | } | 245 | } |
236 | text += "<br><br><br>"; | 246 | text += "<br><br><br>"; |
237 | 247 | ||
238 | text += "<b>" + QObject::tr( "Priority:") +" </b>" | 248 | text += "<b>" + QObject::tr( "Priority:") +" </b>" |
239 | + QString::number( priority() ) + " <br>"; | 249 | + QString::number( priority() ) + " <br>"; |
240 | text += "<b>" + QObject::tr( "Progress:") + " </b>" | 250 | text += "<b>" + QObject::tr( "Progress:") + " </b>" |
241 | + QString::number( progress() ) + " %<br>"; | 251 | + QString::number( progress() ) + " %<br>"; |
242 | if (hasDueDate() ){ | 252 | if (hasDueDate() ){ |
243 | text += "<b>" + QObject::tr( "Deadline:") + " </b>"; | 253 | text += "<b>" + QObject::tr( "Deadline:") + " </b>"; |
244 | text += dueDate().toString(); | 254 | text += dueDate().toString(); |
245 | text += "<br>"; | 255 | text += "<br>"; |
246 | } | 256 | } |
247 | if (hasAlarmDateTime() ){ | 257 | if (hasAlarmDateTime() ){ |
248 | text += "<b>" + QObject::tr( "Alarmed Notification:") + " </b>"; | 258 | text += "<b>" + QObject::tr( "Alarmed Notification:") + " </b>"; |
249 | text += alarmDateTime().toString(); | 259 | text += alarmDateTime().toString(); |
250 | text += "<br>"; | 260 | text += "<br>"; |
251 | } | 261 | } |
252 | 262 | ||
@@ -276,130 +286,138 @@ bool OTodo::operator<=(const OTodo &toDoEvent )const | |||
276 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 286 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
277 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 287 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
278 | return priority() <= toDoEvent.priority(); | 288 | return priority() <= toDoEvent.priority(); |
279 | }else{ | 289 | }else{ |
280 | return dueDate() <= toDoEvent.dueDate(); | 290 | return dueDate() <= toDoEvent.dueDate(); |
281 | } | 291 | } |
282 | } | 292 | } |
283 | return true; | 293 | return true; |
284 | } | 294 | } |
285 | bool OTodo::operator>(const OTodo &toDoEvent )const | 295 | bool OTodo::operator>(const OTodo &toDoEvent )const |
286 | { | 296 | { |
287 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; | 297 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; |
288 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 298 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
289 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 299 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
290 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 300 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
291 | return priority() > toDoEvent.priority(); | 301 | return priority() > toDoEvent.priority(); |
292 | }else{ | 302 | }else{ |
293 | return dueDate() > toDoEvent.dueDate(); | 303 | return dueDate() > toDoEvent.dueDate(); |
294 | } | 304 | } |
295 | } | 305 | } |
296 | return false; | 306 | return false; |
297 | } | 307 | } |
298 | bool OTodo::operator>=(const OTodo &toDoEvent )const | 308 | bool OTodo::operator>=(const OTodo &toDoEvent )const |
299 | { | 309 | { |
300 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; | 310 | if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; |
301 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; | 311 | if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; |
302 | if( hasDueDate() && toDoEvent.hasDueDate() ){ | 312 | if( hasDueDate() && toDoEvent.hasDueDate() ){ |
303 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide | 313 | if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide |
304 | return priority() > toDoEvent.priority(); | 314 | return priority() > toDoEvent.priority(); |
305 | }else{ | 315 | }else{ |
306 | return dueDate() > toDoEvent.dueDate(); | 316 | return dueDate() > toDoEvent.dueDate(); |
307 | } | 317 | } |
308 | } | 318 | } |
309 | return true; | 319 | return true; |
310 | } | 320 | } |
311 | bool OTodo::operator==(const OTodo &toDoEvent )const | 321 | bool OTodo::operator==(const OTodo &toDoEvent )const |
312 | { | 322 | { |
313 | if ( data->priority != toDoEvent.data->priority ) return false; | 323 | if ( data->priority != toDoEvent.data->priority ) return false; |
314 | if ( data->priority != toDoEvent.data->prog ) return false; | 324 | if ( data->priority != toDoEvent.data->prog ) return false; |
315 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; | 325 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; |
316 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; | 326 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; |
317 | if ( data->date != toDoEvent.data->date ) return false; | 327 | if ( data->date != toDoEvent.data->date ) return false; |
318 | if ( data->sum != toDoEvent.data->sum ) return false; | 328 | if ( data->sum != toDoEvent.data->sum ) return false; |
319 | if ( data->desc != toDoEvent.data->desc ) return false; | 329 | if ( data->desc != toDoEvent.data->desc ) return false; |
320 | if ( data->hasAlarmDateTime != toDoEvent.data->hasAlarmDateTime ) | 330 | if ( data->hasAlarmDateTime != toDoEvent.data->hasAlarmDateTime ) |
321 | return false; | 331 | return false; |
322 | if ( data->alarmDateTime != toDoEvent.data->alarmDateTime ) | 332 | if ( data->alarmDateTime != toDoEvent.data->alarmDateTime ) |
323 | return false; | 333 | return false; |
334 | if ( data->maintainer != toDoEvent.data->maintainer ) | ||
335 | return false; | ||
324 | 336 | ||
325 | return OPimRecord::operator==( toDoEvent ); | 337 | return OPimRecord::operator==( toDoEvent ); |
326 | } | 338 | } |
327 | void OTodo::deref() { | 339 | void OTodo::deref() { |
328 | 340 | ||
329 | // qWarning("deref in ToDoEvent"); | 341 | // qWarning("deref in ToDoEvent"); |
330 | if ( data->deref() ) { | 342 | if ( data->deref() ) { |
331 | // qWarning("deleting"); | 343 | // qWarning("deleting"); |
332 | delete data; | 344 | delete data; |
333 | data= 0; | 345 | data= 0; |
334 | } | 346 | } |
335 | } | 347 | } |
336 | OTodo &OTodo::operator=(const OTodo &item ) | 348 | OTodo &OTodo::operator=(const OTodo &item ) |
337 | { | 349 | { |
338 | OPimRecord::operator=( item ); | 350 | OPimRecord::operator=( item ); |
339 | //qWarning("operator= ref "); | 351 | //qWarning("operator= ref "); |
340 | item.data->ref(); | 352 | item.data->ref(); |
341 | deref(); | 353 | deref(); |
342 | data = item.data; | 354 | data = item.data; |
343 | 355 | ||
344 | return *this; | 356 | return *this; |
345 | } | 357 | } |
346 | 358 | ||
347 | QMap<int, QString> OTodo::toMap() const { | 359 | QMap<int, QString> OTodo::toMap() const { |
348 | QMap<int, QString> map; | 360 | QMap<int, QString> map; |
349 | 361 | ||
350 | map.insert( Uid, QString::number( uid() ) ); | 362 | map.insert( Uid, QString::number( uid() ) ); |
351 | map.insert( Category, idsToString( categories() ) ); | 363 | map.insert( Category, idsToString( categories() ) ); |
352 | map.insert( HasDate, QString::number( data->hasDate ) ); | 364 | map.insert( HasDate, QString::number( data->hasDate ) ); |
353 | map.insert( Completed, QString::number( data->isCompleted ) ); | 365 | map.insert( Completed, QString::number( data->isCompleted ) ); |
354 | map.insert( Description, data->desc ); | 366 | map.insert( Description, data->desc ); |
355 | map.insert( Summary, data->sum ); | 367 | map.insert( Summary, data->sum ); |
356 | map.insert( Priority, QString::number( data->priority ) ); | 368 | map.insert( Priority, QString::number( data->priority ) ); |
357 | map.insert( DateDay, QString::number( data->date.day() ) ); | 369 | map.insert( DateDay, QString::number( data->date.day() ) ); |
358 | map.insert( DateMonth, QString::number( data->date.month() ) ); | 370 | map.insert( DateMonth, QString::number( data->date.month() ) ); |
359 | map.insert( DateYear, QString::number( data->date.year() ) ); | 371 | map.insert( DateYear, QString::number( data->date.year() ) ); |
360 | map.insert( Progress, QString::number( data->prog ) ); | 372 | map.insert( Progress, QString::number( data->prog ) ); |
361 | map.insert( CrossReference, crossToString() ); | 373 | // map.insert( CrossReference, crossToString() ); |
362 | map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) ); | 374 | map.insert( HasAlarmDateTime, QString::number( data->hasAlarmDateTime ) ); |
363 | map.insert( AlarmDateTime, data->alarmDateTime.toString() ); | 375 | map.insert( AlarmDateTime, data->alarmDateTime.toString() ); |
364 | 376 | ||
365 | return map; | 377 | return map; |
366 | } | 378 | } |
367 | 379 | ||
368 | QMap<QString, QString> OTodo::toExtraMap()const { | 380 | QMap<QString, QString> OTodo::toExtraMap()const { |
369 | return data->extra; | 381 | return data->extra; |
370 | } | 382 | } |
371 | /** | 383 | /** |
372 | * change or modify looks at the ref count and either | 384 | * change or modify looks at the ref count and either |
373 | * creates a new QShared Object or it can modify it | 385 | * creates a new QShared Object or it can modify it |
374 | * right in place | 386 | * right in place |
375 | */ | 387 | */ |
376 | void OTodo::changeOrModify() { | 388 | void OTodo::changeOrModify() { |
377 | if ( data->count != 1 ) { | 389 | if ( data->count != 1 ) { |
378 | qWarning("changeOrModify"); | 390 | qWarning("changeOrModify"); |
379 | data->deref(); | 391 | data->deref(); |
380 | OTodoData* d2 = new OTodoData(); | 392 | OTodoData* d2 = new OTodoData(); |
381 | copy(data, d2 ); | 393 | copy(data, d2 ); |
382 | data = d2; | 394 | data = d2; |
383 | } | 395 | } |
384 | } | 396 | } |
397 | // WATCHOUT | ||
398 | /* | ||
399 | * if you add something to the Data struct | ||
400 | * be sure to copy it here | ||
401 | */ | ||
385 | void OTodo::copy( OTodoData* src, OTodoData* dest ) { | 402 | void OTodo::copy( OTodoData* src, OTodoData* dest ) { |
386 | dest->date = src->date; | 403 | dest->date = src->date; |
387 | dest->isCompleted = src->isCompleted; | 404 | dest->isCompleted = src->isCompleted; |
388 | dest->hasDate = src->hasDate; | 405 | dest->hasDate = src->hasDate; |
389 | dest->priority = src->priority; | 406 | dest->priority = src->priority; |
390 | dest->desc = src->desc; | 407 | dest->desc = src->desc; |
391 | dest->sum = src->sum; | 408 | dest->sum = src->sum; |
392 | dest->extra = src->extra; | 409 | dest->extra = src->extra; |
393 | dest->prog = src->prog; | 410 | dest->prog = src->prog; |
394 | dest->hasAlarmDateTime = src->hasAlarmDateTime; | 411 | dest->hasAlarmDateTime = src->hasAlarmDateTime; |
395 | dest->alarmDateTime = src->alarmDateTime; | 412 | dest->alarmDateTime = src->alarmDateTime; |
396 | dest->state = src->state; | 413 | dest->state = src->state; |
397 | dest->recur = src->recur; | 414 | dest->recur = src->recur; |
415 | dest->maintainer = src->maintainer; | ||
398 | } | 416 | } |
399 | QString OTodo::type() const { | 417 | QString OTodo::type() const { |
400 | return QString::fromLatin1("OTodo"); | 418 | return QString::fromLatin1("OTodo"); |
401 | } | 419 | } |
402 | QString OTodo::recordField(int /*id*/ )const { | 420 | QString OTodo::recordField(int /*id*/ )const { |
403 | return QString::null; | 421 | return QString::null; |
404 | } | 422 | } |
405 | 423 | ||
diff --git a/libopie2/opiepim/otodo.h b/libopie2/opiepim/otodo.h index 2cdc587..70b0253 100644 --- a/libopie2/opiepim/otodo.h +++ b/libopie2/opiepim/otodo.h | |||
@@ -1,68 +1,69 @@ | |||
1 | 1 | ||
2 | #ifndef OPIE_TODO_EVENT_H | 2 | #ifndef OPIE_TODO_EVENT_H |
3 | #define OPIE_TODO_EVENT_H | 3 | #define OPIE_TODO_EVENT_H |
4 | 4 | ||
5 | 5 | ||
6 | #include <qarray.h> | 6 | #include <qarray.h> |
7 | #include <qmap.h> | 7 | #include <qmap.h> |
8 | #include <qregexp.h> | 8 | #include <qregexp.h> |
9 | #include <qstringlist.h> | 9 | #include <qstringlist.h> |
10 | #include <qdatetime.h> | 10 | #include <qdatetime.h> |
11 | #include <qvaluelist.h> | 11 | #include <qvaluelist.h> |
12 | 12 | ||
13 | #include <qpe/recordfields.h> | 13 | #include <qpe/recordfields.h> |
14 | #include <qpe/palmtopuidgen.h> | 14 | #include <qpe/palmtopuidgen.h> |
15 | 15 | ||
16 | #include <opie/opimrecord.h> | 16 | #include <opie/opimrecord.h> |
17 | 17 | ||
18 | 18 | ||
19 | class OPimState; | 19 | class OPimState; |
20 | class ORecur; | 20 | class ORecur; |
21 | class OPimMaintainer; | ||
21 | class OTodo : public OPimRecord { | 22 | class OTodo : public OPimRecord { |
22 | public: | 23 | public: |
23 | typedef QValueList<OTodo> ValueList; | 24 | typedef QValueList<OTodo> ValueList; |
24 | enum RecordFields { | 25 | enum RecordFields { |
25 | Uid = Qtopia::UID_ID, | 26 | Uid = Qtopia::UID_ID, |
26 | Category = Qtopia::CATEGORY_ID, | 27 | Category = Qtopia::CATEGORY_ID, |
27 | HasDate, | 28 | HasDate, |
28 | Completed, | 29 | Completed, |
29 | Description, | 30 | Description, |
30 | Summary, | 31 | Summary, |
31 | Priority, | 32 | Priority, |
32 | DateDay, | 33 | DateDay, |
33 | DateMonth, | 34 | DateMonth, |
34 | DateYear, | 35 | DateYear, |
35 | Progress, | 36 | Progress, |
36 | CrossReference, | 37 | CrossReference, |
37 | HasAlarmDateTime, | 38 | HasAlarmDateTime, |
38 | AlarmDateTime, | 39 | AlarmDateTime, |
39 | State, | 40 | State, |
40 | Recurrance, | 41 | Recurrance, |
41 | Alarms, | 42 | Alarms, |
42 | Reminders, | 43 | Reminders, |
43 | Notifiers | 44 | Notifiers |
44 | }; | 45 | }; |
45 | public: | 46 | public: |
46 | // priorities from Very low to very high | 47 | // priorities from Very low to very high |
47 | enum TaskPriority { VeryHigh=1, High, Normal, Low, VeryLow }; | 48 | enum TaskPriority { VeryHigh=1, High, Normal, Low, VeryLow }; |
48 | 49 | ||
49 | /* Constructs a new ToDoEvent | 50 | /* Constructs a new ToDoEvent |
50 | @param completed Is the TodoEvent completed | 51 | @param completed Is the TodoEvent completed |
51 | @param priority What is the priority of this ToDoEvent | 52 | @param priority What is the priority of this ToDoEvent |
52 | @param category Which category does it belong( uid ) | 53 | @param category Which category does it belong( uid ) |
53 | @param summary A small summary of the todo | 54 | @param summary A small summary of the todo |
54 | @param description What is this ToDoEvent about | 55 | @param description What is this ToDoEvent about |
55 | @param hasDate Does this Event got a deadline | 56 | @param hasDate Does this Event got a deadline |
56 | @param date what is the deadline? | 57 | @param date what is the deadline? |
57 | @param uid what is the UUID of this Event | 58 | @param uid what is the UUID of this Event |
58 | **/ | 59 | **/ |
59 | OTodo( bool completed = false, int priority = Normal, | 60 | OTodo( bool completed = false, int priority = Normal, |
60 | const QStringList &category = QStringList(), | 61 | const QStringList &category = QStringList(), |
61 | const QString &summary = QString::null , | 62 | const QString &summary = QString::null , |
62 | const QString &description = QString::null, | 63 | const QString &description = QString::null, |
63 | ushort progress = 0, | 64 | ushort progress = 0, |
64 | bool hasDate = false, QDate date = QDate::currentDate(), | 65 | bool hasDate = false, QDate date = QDate::currentDate(), |
65 | int uid = 0 /*empty*/ ); | 66 | int uid = 0 /*empty*/ ); |
66 | 67 | ||
67 | OTodo( bool completed, int priority, | 68 | OTodo( bool completed, int priority, |
68 | const QArray<int>& category, | 69 | const QArray<int>& category, |
@@ -83,152 +84,163 @@ public: | |||
83 | ~OTodo(); | 84 | ~OTodo(); |
84 | 85 | ||
85 | /** | 86 | /** |
86 | * Is this event completed? | 87 | * Is this event completed? |
87 | */ | 88 | */ |
88 | bool isCompleted() const; | 89 | bool isCompleted() const; |
89 | 90 | ||
90 | /** | 91 | /** |
91 | * Does this Event have a deadline | 92 | * Does this Event have a deadline |
92 | */ | 93 | */ |
93 | bool hasDueDate() const; | 94 | bool hasDueDate() const; |
94 | 95 | ||
95 | /** | 96 | /** |
96 | * Does this Event has an alarm time ? | 97 | * Does this Event has an alarm time ? |
97 | */ | 98 | */ |
98 | bool hasAlarmDateTime() const; | 99 | bool hasAlarmDateTime() const; |
99 | 100 | ||
100 | /** | 101 | /** |
101 | * What is the priority? | 102 | * What is the priority? |
102 | */ | 103 | */ |
103 | int priority()const ; | 104 | int priority()const ; |
104 | 105 | ||
105 | /** | 106 | /** |
106 | * progress as ushort 0, 20, 40, 60, 80 or 100% | 107 | * progress as ushort 0, 20, 40, 60, 80 or 100% |
107 | */ | 108 | */ |
108 | ushort progress() const; | 109 | ushort progress() const; |
109 | 110 | ||
110 | /** | 111 | /** |
111 | * The due Date | 112 | * The due Date |
112 | */ | 113 | */ |
113 | QDate dueDate()const; | 114 | QDate dueDate()const; |
114 | 115 | ||
115 | /** | 116 | /** |
116 | * Alarm Date and Time | 117 | * Alarm Date and Time |
117 | */ | 118 | */ |
118 | QDateTime alarmDateTime()const; | 119 | QDateTime alarmDateTime()const; |
119 | 120 | ||
120 | /** | 121 | /** |
121 | * What is the state of this OTodo? | 122 | * What is the state of this OTodo? |
122 | */ | 123 | */ |
123 | OPimState state()const; | 124 | OPimState state()const; |
124 | 125 | ||
125 | /** | 126 | /** |
126 | * the recurrance of this | 127 | * the recurrance of this |
127 | */ | 128 | */ |
128 | ORecur recurrence()const; | 129 | ORecur recurrence()const; |
129 | 130 | ||
130 | /** | 131 | /** |
132 | * the Maintainer of this OTodo | ||
133 | */ | ||
134 | OPimMaintainer maintainer()const; | ||
135 | |||
136 | /** | ||
131 | * The description of the todo | 137 | * The description of the todo |
132 | */ | 138 | */ |
133 | QString description()const; | 139 | QString description()const; |
134 | 140 | ||
135 | /** | 141 | /** |
136 | * A small summary of the todo | 142 | * A small summary of the todo |
137 | */ | 143 | */ |
138 | QString summary() const; | 144 | QString summary() const; |
139 | 145 | ||
140 | /** | 146 | /** |
141 | * @reimplemented | 147 | * @reimplemented |
142 | * Return this todoevent in a RichText formatted QString | 148 | * Return this todoevent in a RichText formatted QString |
143 | */ | 149 | */ |
144 | QString toRichText() const; | 150 | QString toRichText() const; |
145 | 151 | ||
146 | /** | 152 | /** |
147 | * reimplementation | 153 | * reimplementation |
148 | */ | 154 | */ |
149 | QString type()const; | 155 | QString type()const; |
150 | QString toShortText()const; | 156 | QString toShortText()const; |
151 | QMap<QString, QString> toExtraMap()const; | 157 | QMap<QString, QString> toExtraMap()const; |
152 | QString recordField(int id )const; | 158 | QString recordField(int id )const; |
153 | 159 | ||
154 | /** | 160 | /** |
155 | * toMap puts all data into the map. int relates | 161 | * toMap puts all data into the map. int relates |
156 | * to ToDoEvent RecordFields enum | 162 | * to ToDoEvent RecordFields enum |
157 | */ | 163 | */ |
158 | QMap<int, QString> toMap()const; | 164 | QMap<int, QString> toMap()const; |
159 | 165 | ||
160 | /** | 166 | /** |
161 | * Set if this Todo is completed | 167 | * Set if this Todo is completed |
162 | */ | 168 | */ |
163 | void setCompleted(bool completed ); | 169 | void setCompleted(bool completed ); |
164 | 170 | ||
165 | /** | 171 | /** |
166 | * set if this todo got an end data | 172 | * set if this todo got an end data |
167 | */ | 173 | */ |
168 | void setHasDueDate( bool hasDate ); | 174 | void setHasDueDate( bool hasDate ); |
169 | 175 | ||
170 | /** | 176 | /** |
171 | * set if this todo has an alarm time and date | 177 | * set if this todo has an alarm time and date |
172 | */ | 178 | */ |
173 | void setHasAlarmDateTime ( bool hasAlarm ); | 179 | void setHasAlarmDateTime ( bool hasAlarm ); |
174 | 180 | ||
175 | /** | 181 | /** |
176 | * Set the priority of the Todo | 182 | * Set the priority of the Todo |
177 | */ | 183 | */ |
178 | void setPriority(int priority ); | 184 | void setPriority(int priority ); |
179 | 185 | ||
180 | /** | 186 | /** |
181 | * Set the progress. | 187 | * Set the progress. |
182 | */ | 188 | */ |
183 | void setProgress( ushort progress ); | 189 | void setProgress( ushort progress ); |
184 | 190 | ||
185 | /** | 191 | /** |
186 | * set the end date | 192 | * set the end date |
187 | */ | 193 | */ |
188 | void setDueDate( QDate date ); | 194 | void setDueDate( QDate date ); |
189 | 195 | ||
190 | 196 | ||
191 | void setRecurrence( const ORecur& ); | 197 | void setRecurrence( const ORecur& ); |
192 | /** | 198 | /** |
193 | * set the alarm time | 199 | * set the alarm time |
194 | */ | 200 | */ |
195 | void setAlarmDateTime ( const QDateTime& alarm ); | 201 | void setAlarmDateTime ( const QDateTime& alarm ); |
196 | 202 | ||
197 | void setDescription(const QString& ); | 203 | void setDescription(const QString& ); |
198 | void setSummary(const QString& ); | 204 | void setSummary(const QString& ); |
199 | 205 | ||
200 | /** | 206 | /** |
201 | * set the state of a Todo | 207 | * set the state of a Todo |
202 | * @param state State what the todo should take | 208 | * @param state State what the todo should take |
203 | */ | 209 | */ |
204 | void setState( const OPimState& state); | 210 | void setState( const OPimState& state); |
211 | |||
212 | /** | ||
213 | * set the Maintainer Mode | ||
214 | */ | ||
215 | void setMaintainer( const OPimMaintainer& ); | ||
216 | |||
205 | bool isOverdue(); | 217 | bool isOverdue(); |
206 | 218 | ||
207 | 219 | ||
208 | bool match( const QRegExp &r )const; | 220 | bool match( const QRegExp &r )const; |
209 | 221 | ||
210 | bool operator<(const OTodo &toDoEvent )const; | 222 | bool operator<(const OTodo &toDoEvent )const; |
211 | bool operator<=(const OTodo &toDoEvent )const; | 223 | bool operator<=(const OTodo &toDoEvent )const; |
212 | bool operator!=(const OTodo &toDoEvent )const; | 224 | bool operator!=(const OTodo &toDoEvent )const; |
213 | bool operator>(const OTodo &toDoEvent )const; | 225 | bool operator>(const OTodo &toDoEvent )const; |
214 | bool operator>=(const OTodo &toDoEvent)const; | 226 | bool operator>=(const OTodo &toDoEvent)const; |
215 | bool operator==(const OTodo &toDoEvent )const; | 227 | bool operator==(const OTodo &toDoEvent )const; |
216 | OTodo &operator=(const OTodo &toDoEvent ); | 228 | OTodo &operator=(const OTodo &toDoEvent ); |
217 | 229 | ||
218 | private: | 230 | private: |
219 | class OTodoPrivate; | 231 | class OTodoPrivate; |
220 | struct OTodoData; | 232 | struct OTodoData; |
221 | 233 | ||
222 | void deref(); | 234 | void deref(); |
223 | inline void changeOrModify(); | 235 | inline void changeOrModify(); |
224 | void copy( OTodoData* src, OTodoData* dest ); | 236 | void copy( OTodoData* src, OTodoData* dest ); |
225 | OTodoPrivate *d; | 237 | OTodoPrivate *d; |
226 | OTodoData *data; | 238 | OTodoData *data; |
227 | 239 | ||
228 | }; | 240 | }; |
229 | inline bool OTodo::operator!=(const OTodo &toDoEvent )const { | 241 | inline bool OTodo::operator!=(const OTodo &toDoEvent )const { |
230 | return !(*this == toDoEvent); | 242 | return !(*this == toDoEvent); |
231 | } | 243 | } |
232 | 244 | ||
233 | 245 | ||
234 | #endif | 246 | #endif |