summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/libopie.pro6
-rw-r--r--libopie/pim/opimrecord.cpp63
-rw-r--r--libopie/pim/opimrecord.h33
-rw-r--r--libopie/pim/opimxref.cpp47
-rw-r--r--libopie/pim/opimxref.h7
-rw-r--r--libopie/pim/opimxrefmanager.cpp69
-rw-r--r--libopie/pim/opimxrefmanager.h5
-rw-r--r--libopie/pim/opimxrefpartner.cpp43
-rw-r--r--libopie/pim/otodoaccessxml.cpp18
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp18
-rw-r--r--libopie2/opiepim/core/opimrecord.cpp63
-rw-r--r--libopie2/opiepim/core/opimrecord.h33
-rw-r--r--libopie2/opiepim/core/opimxref.cpp47
-rw-r--r--libopie2/opiepim/core/opimxref.h7
-rw-r--r--libopie2/opiepim/core/opimxrefmanager.cpp69
-rw-r--r--libopie2/opiepim/core/opimxrefmanager.h5
-rw-r--r--libopie2/opiepim/core/opimxrefpartner.cpp43
17 files changed, 374 insertions, 202 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro
index 79d15bb..3e6156e 100644
--- a/libopie/libopie.pro
+++ b/libopie/libopie.pro
@@ -19,24 +19,27 @@ HEADERS = ofontmenu.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 \
32 pim/opimxref.h \
33 pim/opimxrefmanager.h \
31 orecurrancewidget.h \ 34 orecurrancewidget.h \
32 oticker.h 35 oticker.h
33# pim/otodoaccesssql.h \ 36# pim/otodoaccesssql.h \
34 37
35SOURCES = ofontmenu.cc \ 38SOURCES = ofontmenu.cc \
36 ocolorbutton.cpp \ 39 ocolorbutton.cpp \
37 xmltree.cc \ 40 xmltree.cc \
38 ofiledialog.cc ofileselector.cc \ 41 ofiledialog.cc ofileselector.cc \
39 ocheckitem.cpp tododb.cpp todoevent.cpp \ 42 ocheckitem.cpp tododb.cpp todoevent.cpp \
40 todovcalresource.cpp colordialog.cpp \ 43 todovcalresource.cpp colordialog.cpp \
41 colorpopupmenu.cpp oclickablelabel.cpp \ 44 colorpopupmenu.cpp oclickablelabel.cpp \
42 oprocctrl.cpp oprocess.cpp \ 45 oprocctrl.cpp oprocess.cpp \
@@ -45,24 +48,27 @@ SOURCES = ofontmenu.cc \
45 ofontselector.cpp \ 48 ofontselector.cpp \
46 pim/otodo.cpp \ 49 pim/otodo.cpp \
47 pim/opimrecord.cpp \ 50 pim/opimrecord.cpp \
48 pim/otodoaccess.cpp \ 51 pim/otodoaccess.cpp \
49 pim/otodoaccessbackend.cpp \ 52 pim/otodoaccessbackend.cpp \
50 pim/otodoaccessxml.cpp \ 53 pim/otodoaccessxml.cpp \
51 pim/ocontact.cpp \ 54 pim/ocontact.cpp \
52 pim/ocontactaccess.cpp \ 55 pim/ocontactaccess.cpp \
53 pim/ocontactaccessbackend_vcard.cpp \ 56 pim/ocontactaccessbackend_vcard.cpp \
54 pim/otodoaccessvcal.cpp \ 57 pim/otodoaccessvcal.cpp \
55 pim/orecur.cpp \ 58 pim/orecur.cpp \
56 pim/opimstate.cpp \ 59 pim/opimstate.cpp \
60 pim/opimxrefpartner.cpp \
61 pim/opimxref.cpp \
62 pim/opimxrefmanager.cpp \
57 orecurrancewidget.cpp \ 63 orecurrancewidget.cpp \
58 oticker.cpp 64 oticker.cpp
59# pim/otodoaccesssql.cpp \ 65# pim/otodoaccesssql.cpp \
60 66
61TARGET = opie 67TARGET = opie
62INCLUDEPATH += $(OPIEDIR)/include 68INCLUDEPATH += $(OPIEDIR)/include
63DESTDIR = $(QTDIR)/lib$(PROJMAK) 69DESTDIR = $(QTDIR)/lib$(PROJMAK)
64#VERSION = 1.0.0 70#VERSION = 1.0.0
65 71
66# LIBS += -lopiesql 72# LIBS += -lopiesql
67 73
68INTERFACES = otimepickerbase.ui orecurrancebase.ui 74INTERFACES = otimepickerbase.ui orecurrancebase.ui
diff --git a/libopie/pim/opimrecord.cpp b/libopie/pim/opimrecord.cpp
index 21cf131..0e3be9d 100644
--- a/libopie/pim/opimrecord.cpp
+++ b/libopie/pim/opimrecord.cpp
@@ -12,25 +12,25 @@ OPimRecord::OPimRecord( int uid )
12 setUid( uid ); 12 setUid( uid );
13} 13}
14OPimRecord::~OPimRecord() { 14OPimRecord::~OPimRecord() {
15} 15}
16OPimRecord::OPimRecord( const OPimRecord& rec ) 16OPimRecord::OPimRecord( const OPimRecord& rec )
17 : Qtopia::Record( rec ) 17 : Qtopia::Record( rec )
18{ 18{
19 (*this) = rec; 19 (*this) = rec;
20} 20}
21 21
22OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { 22OPimRecord &OPimRecord::operator=( const OPimRecord& rec) {
23 Qtopia::Record::operator=( rec ); 23 Qtopia::Record::operator=( rec );
24 m_relations = rec.m_relations; 24 m_xrefman = rec.m_xrefman;
25 25
26 return *this; 26 return *this;
27} 27}
28/* 28/*
29 * category names 29 * category names
30 */ 30 */
31QStringList OPimRecord::categoryNames()const { 31QStringList OPimRecord::categoryNames()const {
32 QStringList list; 32 QStringList list;
33 QArray<int> cats = categories(); 33 QArray<int> cats = categories();
34 Categories catDB; 34 Categories catDB;
35 catDB.load( categoryFileName() ); 35 catDB.load( categoryFileName() );
36 36
@@ -43,90 +43,39 @@ QStringList OPimRecord::categoryNames()const {
43void OPimRecord::setCategoryNames( const QStringList& ) { 43void OPimRecord::setCategoryNames( const QStringList& ) {
44 44
45} 45}
46void OPimRecord::addCategoryName( const QString& ) { 46void OPimRecord::addCategoryName( const QString& ) {
47 Categories catDB; 47 Categories catDB;
48 catDB.load( categoryFileName() ); 48 catDB.load( categoryFileName() );
49 49
50 50
51} 51}
52bool OPimRecord::isEmpty()const { 52bool OPimRecord::isEmpty()const {
53 return ( uid() == 0 ); 53 return ( uid() == 0 );
54} 54}
55QStringList OPimRecord::relatedApps()const{ 55/*QString OPimRecord::crossToString()const {
56 QStringList list;
57 QMap<QString, QArray<int> >::ConstIterator it;
58 for ( it = m_relations.begin(); it != m_relations.end(); ++it ) {
59 list << it.key();
60 }
61 return list;
62}
63QArray<int> OPimRecord::relations(const QString& app )const {
64 QArray<int> tmp;
65 QMap<QString, QArray<int> >::ConstIterator it;
66 it = m_relations.find( app);
67 if ( it != m_relations.end() )
68 tmp = it.data();
69 return tmp;
70}
71void OPimRecord::clearRelation( const QString& app ) {
72 m_relations.remove( app );
73}
74void OPimRecord::addRelation( const QString& app, int id ) {
75
76 QMap<QString, QArray<int> >::Iterator it;
77 QArray<int> tmp;
78
79 it = m_relations.find( app );
80 if ( it == m_relations.end() ) {
81 tmp.resize(1 );
82 tmp[0] = id;
83 }else{
84 tmp = it.data();
85 tmp.resize( tmp.size() + 1 );
86 tmp[tmp.size() - 1] = id;
87 }
88 m_relations.replace( app, tmp );
89}
90void OPimRecord::setRelations( const QString& app, QArray<int> ids ) {
91
92 QMap<QString, QArray<int> >::Iterator it;
93 QArray<int> tmp;
94
95 it = m_relations.find( app);
96 if ( it == m_relations.end() ) {
97 tmp = ids;
98 }else{
99 tmp = it.data();
100 int offset = tmp.size()-1;
101 tmp.resize( tmp.size() + ids.size() );
102 for (uint i = 0; i < ids.size(); i++ ) {
103 tmp[offset+i] = ids[i];
104 }
105
106 }
107 m_relations.replace( app, tmp );
108}
109QString OPimRecord::crossToString()const {
110 QString str; 56 QString str;
111 QMap<QString, QArray<int> >::ConstIterator it; 57 QMap<QString, QArray<int> >::ConstIterator it;
112 for (it = m_relations.begin(); it != m_relations.end(); ++it ) { 58 for (it = m_relations.begin(); it != m_relations.end(); ++it ) {
113 QArray<int> id = it.data(); 59 QArray<int> id = it.data();
114 for ( uint i = 0; i < id.size(); ++i ) { 60 for ( uint i = 0; i < id.size(); ++i ) {
115 str += it.key() + "," + QString::number( i ) + ";"; 61 str += it.key() + "," + QString::number( i ) + ";";
116 } 62 }
117 } 63 }
118 str = str.remove( str.length()-1, 1); // strip the ; 64 str = str.remove( str.length()-1, 1); // strip the ;
119 //qWarning("IDS " + str ); 65 //qWarning("IDS " + str );
120 66
121 return str; 67 return str;
122} 68 }*/
123/* if uid = 1 assign a new one */ 69/* if uid = 1 assign a new one */
124void OPimRecord::setUid( int uid ) { 70void OPimRecord::setUid( int uid ) {
125 if ( uid == 1) 71 if ( uid == 1)
126 uid = uidGen().generate(); 72 uid = uidGen().generate();
127 73
128 Qtopia::Record::setUid( uid ); 74 Qtopia::Record::setUid( uid );
129}; 75};
130Qtopia::UidGen &OPimRecord::uidGen() { 76Qtopia::UidGen &OPimRecord::uidGen() {
131 return m_uidGen; 77 return m_uidGen;
132} 78}
79OPimXRefManager &OPimRecord::xrefmanager() {
80 return m_xrefman;
81}
diff --git a/libopie/pim/opimrecord.h b/libopie/pim/opimrecord.h
index d9ccad4..1642a5e 100644
--- a/libopie/pim/opimrecord.h
+++ b/libopie/pim/opimrecord.h
@@ -1,21 +1,22 @@
1#ifndef OPIE_PIM_RECORD_H 1#ifndef OPIE_PIM_RECORD_H
2#define OPIE_PIM_RECORD_H 2#define OPIE_PIM_RECORD_H
3 3
4#include <qmap.h> 4#include <qmap.h>
5#include <qstring.h> 5#include <qstring.h>
6#include <qstringlist.h> 6#include <qstringlist.h>
7 7
8#include <qpe/palmtoprecord.h> 8#include <qpe/palmtoprecord.h>
9 9
10#include <opie/opimxrefmanager.h>
10 11
11/** 12/**
12 * This is the base class for 13 * This is the base class for
13 * all PIM Records 14 * all PIM Records
14 * 15 *
15 */ 16 */
16class OPimRecord : public Qtopia::Record { 17class OPimRecord : public Qtopia::Record {
17public: 18public:
18 /** 19 /**
19 * c'tor 20 * c'tor
20 * uid of 0 isEmpty 21 * uid of 0 isEmpty
21 * uid of 1 will be assigned a new one 22 * uid of 1 will be assigned a new one
@@ -77,57 +78,39 @@ public:
77 78
78 /** 79 /**
79 * key value representation of extra items 80 * key value representation of extra items
80 */ 81 */
81 virtual QMap<QString, QString> toExtraMap()const = 0; 82 virtual QMap<QString, QString> toExtraMap()const = 0;
82 83
83 /** 84 /**
84 * the name for a recordField 85 * the name for a recordField
85 */ 86 */
86 virtual QString recordField(int)const = 0; 87 virtual QString recordField(int)const = 0;
87 88
88 /** 89 /**
89 * the related apps names 90 * returns a reference of the
91 * Cross Reference Manager
92 * Partner One is THIS PIM RECORD!
93 * Two is the Partner where we link to
90 */ 94 */
91 QStringList relatedApps()const; 95 OPimXRefManager& xrefmanager();
92
93 /**
94 * the realtions between an app
95 */
96 QArray<int> relations( const QString& app )const;
97
98 /**
99 * clear the relations for all relations
100 * with app
101 */
102 void clearRelation( const QString& app );
103
104 /**
105 * add a relation
106 */
107 void addRelation( const QString& app, int id );
108
109 /**
110 * set the relations for an app
111 */
112 void setRelations( const QString&, QArray<int> ids );
113 96
114 /** 97 /**
115 * set the uid 98 * set the uid
116 */ 99 */
117 virtual void setUid( int uid ); 100 virtual void setUid( int uid );
118 101
119protected: 102protected:
120 Qtopia::UidGen &uidGen(); 103 Qtopia::UidGen &uidGen();
121 QString crossToString()const; 104// QString crossToString()const;
122 105
123private: 106private:
124 class OPimRecordPrivate; 107 class OPimRecordPrivate;
125 OPimRecordPrivate *d; 108 OPimRecordPrivate *d;
126 QMap<QString, QArray<int> > m_relations; 109 OPimXRefManager m_xrefman;
127 static Qtopia::UidGen m_uidGen; 110 static Qtopia::UidGen m_uidGen;
128 111
129}; 112};
130 113
131 114
132 115
133#endif 116#endif
diff --git a/libopie/pim/opimxref.cpp b/libopie/pim/opimxref.cpp
new file mode 100644
index 0000000..5cae871
--- a/dev/null
+++ b/libopie/pim/opimxref.cpp
@@ -0,0 +1,47 @@
1#include "opimxref.h"
2
3OPimXRef::OPimXRef( const OPimXRefPartner& one, const OPimXRefPartner& two )
4 : m_partners(2)
5{
6 m_partners[0] = one;
7 m_partners[1] = two;
8}
9OPimXRef::OPimXRef()
10 : m_partners(2)
11{
12
13}
14OPimXRef::OPimXRef( const OPimXRef& ref) {
15 *this = ref;
16}
17OPimXRef::~OPimXRef() {
18}
19OPimXRef &OPimXRef::operator=( const OPimXRef& ref) {
20 m_partners = ref.m_partners;
21 m_partners.detach();
22
23 return* this;
24}
25bool OPimXRef::operator==( const OPimXRef& oper ) {
26 if ( m_partners == oper.m_partners ) return true;
27
28 return false;
29}
30OPimXRefPartner OPimXRef::partner( enum Partners par) const{
31 return m_partners[par];
32}
33void OPimXRef::setPartner( enum Partners par, const OPimXRefPartner& part) {
34 m_partners[par] = part;
35}
36bool OPimXRef::containsString( const QString& string ) const{
37 if ( m_partners[One].appName() == string ||
38 m_partners[Two].appName() == string ) return true;
39
40 return false;
41}
42bool OPimXRef::containsUid( int uid ) const{
43 if ( m_partners[One].uid() == uid ||
44 m_partners[Two].uid() == uid ) return true;
45
46 return false;
47}
diff --git a/libopie/pim/opimxref.h b/libopie/pim/opimxref.h
index 72154ac..354739a 100644
--- a/libopie/pim/opimxref.h
+++ b/libopie/pim/opimxref.h
@@ -11,26 +11,29 @@
11 * two Cross Reference Partners 11 * two Cross Reference Partners
12 */ 12 */
13class OPimXRef { 13class OPimXRef {
14public: 14public:
15 typedef QValueList<OPimXRef> ValueList; 15 typedef QValueList<OPimXRef> ValueList;
16 enum Partners { One, Two }; 16 enum Partners { One, Two };
17 OPimXRef( const OPimXRefPartner& ONE, const OPimXRefPartner& ); 17 OPimXRef( const OPimXRefPartner& ONE, const OPimXRefPartner& );
18 OPimXRef(); 18 OPimXRef();
19 OPimXRef( const OPimXRef& ); 19 OPimXRef( const OPimXRef& );
20 ~OPimXRef(); 20 ~OPimXRef();
21 21
22 OPimXRef &operator=( const OPimXRef& ); 22 OPimXRef &operator=( const OPimXRef& );
23 bool operator==( const OPimXRef ); 23 bool operator==( const OPimXRef& );
24 24
25 OPimXRefPartner partner( enum Partners ); 25 OPimXRefPartner partner( enum Partners )const;
26 26
27 void setPartner( enum Partners, const OPimXRefPartner& ); 27 void setPartner( enum Partners, const OPimXRefPartner& );
28 28
29 bool containsString( const QString& appName)const;
30 bool containsUid( int uid )const;
31
29private: 32private:
30 QArray<OPimXRefPartner> m_partners; 33 QArray<OPimXRefPartner> m_partners;
31 34
32 class Private; 35 class Private;
33 Private *d; 36 Private *d;
34}; 37};
35 38
36#endif 39#endif
diff --git a/libopie/pim/opimxrefmanager.cpp b/libopie/pim/opimxrefmanager.cpp
new file mode 100644
index 0000000..d49f5f5
--- a/dev/null
+++ b/libopie/pim/opimxrefmanager.cpp
@@ -0,0 +1,69 @@
1#include "opimxrefmanager.h"
2
3
4OPimXRefManager::OPimXRefManager() {
5}
6OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) {
7 m_list = ref.m_list;
8}
9OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) {
10 m_list = ref.m_list;
11 return *this;
12}
13bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) {
14 // if ( m_list == ref.m_list ) return true;
15
16 return false;
17}
18void OPimXRefManager::add( const OPimXRef& ref) {
19 m_list.append( ref );
20}
21void OPimXRefManager::remove( const OPimXRef& ref) {
22 m_list.remove( ref );
23}
24void OPimXRefManager::replace( const OPimXRef& ref) {
25 m_list.remove( ref );
26 m_list.append( ref );
27}
28void OPimXRefManager::clear() {
29 m_list.clear();
30}
31QStringList OPimXRefManager::apps()const {
32 OPimXRef::ValueList::ConstIterator it;
33 QStringList list;
34
35 QString str;
36 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
37 str = (*it).partner( OPimXRef::One ).appName();
38 if ( !list.contains( str ) ) list << str;
39
40 str = (*it).partner( OPimXRef::Two ).appName();
41 if ( !list.contains( str ) ) list << str;
42 }
43 return list;
44}
45OPimXRef::ValueList OPimXRefManager::list()const {
46 return m_list;
47}
48OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{
49 OPimXRef::ValueList list;
50 OPimXRef::ValueList::ConstIterator it;
51
52 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
53 if ( (*it).containsString( appName ) )
54 list.append( (*it) );
55 }
56
57 return list;
58}
59OPimXRef::ValueList OPimXRefManager::list( int uid )const {
60 OPimXRef::ValueList list;
61 OPimXRef::ValueList::ConstIterator it;
62
63 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
64 if ( (*it).containsUid( uid ) )
65 list.append( (*it) );
66 }
67
68 return list;
69}
diff --git a/libopie/pim/opimxrefmanager.h b/libopie/pim/opimxrefmanager.h
index 147895d..9b003a3 100644
--- a/libopie/pim/opimxrefmanager.h
+++ b/libopie/pim/opimxrefmanager.h
@@ -1,15 +1,17 @@
1#ifndef OPIM_XREF_MANAGER_H 1#ifndef OPIM_XREF_MANAGER_H
2#define OPIM_XREF_MANAGER_H 2#define OPIM_XREF_MANAGER_H
3 3
4#include <qstringlist.h>
5
4#include <opie/opimxref.h> 6#include <opie/opimxref.h>
5 7
6/** 8/**
7 * This is a simple manager for 9 * This is a simple manager for
8 * OPimXRefs. 10 * OPimXRefs.
9 * It allows addition, removing, replacing 11 * It allows addition, removing, replacing
10 * clearing and 'querying' the XRef... 12 * clearing and 'querying' the XRef...
11 */ 13 */
12class OPimXRefManager { 14class OPimXRefManager {
13public: 15public:
14 OPimXRefManager(); 16 OPimXRefManager();
15 OPimXRefManager( const OPimXRefManager& ); 17 OPimXRefManager( const OPimXRefManager& );
@@ -22,15 +24,18 @@ public:
22 void remove( const OPimXRef& ); 24 void remove( const OPimXRef& );
23 void replace( const OPimXRef& ); 25 void replace( const OPimXRef& );
24 26
25 void clear(); 27 void clear();
26 28
27 /** 29 /**
28 * apps participating 30 * apps participating
29 */ 31 */
30 QStringList apps()const; 32 QStringList apps()const;
31 OPimXRef::ValueList list()const; 33 OPimXRef::ValueList list()const;
32 OPimXRef::ValueList list( const QString& appName )const; 34 OPimXRef::ValueList list( const QString& appName )const;
33 OPimXRef::ValueList list( int uid )const; 35 OPimXRef::ValueList list( int uid )const;
36
37private:
38 OPimXRef::ValueList m_list;
34}; 39};
35 40
36#endif 41#endif
diff --git a/libopie/pim/opimxrefpartner.cpp b/libopie/pim/opimxrefpartner.cpp
new file mode 100644
index 0000000..028f4e6
--- a/dev/null
+++ b/libopie/pim/opimxrefpartner.cpp
@@ -0,0 +1,43 @@
1#include "opimxrefpartner.h"
2
3OPimXRefPartner::OPimXRefPartner( const QString& appName,
4 int uid, int field )
5 : m_app(appName), m_uid(uid), m_field( field ) {
6}
7OPimXRefPartner::OPimXRefPartner( const OPimXRefPartner& ref ) {
8 *this = ref;
9}
10OPimXRefPartner::~OPimXRefPartner() {
11}
12OPimXRefPartner &OPimXRefPartner::operator=( const OPimXRefPartner& par ) {
13 m_app = par.m_app;
14 m_uid = par.m_uid;
15 m_field = par.m_field;
16
17 return *this;
18}
19bool OPimXRefPartner::operator==( const OPimXRefPartner& par ) {
20 if ( m_app != par.m_app ) return false;
21 if ( m_uid != par.m_uid ) return false;
22 if ( m_field != par.m_field ) return false;
23
24 return true;
25}
26QString OPimXRefPartner::appName()const {
27 return m_app;
28}
29int OPimXRefPartner::uid()const {
30 return m_uid;
31}
32int OPimXRefPartner::field()const {
33 return m_field;
34}
35void OPimXRefPartner::setAppName( const QString& appName ) {
36 m_app = appName;
37}
38void OPimXRefPartner::setUid( int uid ) {
39 m_uid = uid;
40}
41void OPimXRefPartner::setField( int field ) {
42 m_field = field;
43}
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp
index 591e467..c1682c6 100644
--- a/libopie/pim/otodoaccessxml.cpp
+++ b/libopie/pim/otodoaccessxml.cpp
@@ -322,25 +322,25 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
322 case OTodo::CrossReference: 322 case OTodo::CrossReference:
323 { 323 {
324 /* 324 /*
325 * A cross refernce looks like 325 * A cross refernce looks like
326 * appname,id;appname,id 326 * appname,id;appname,id
327 * we need to split it up 327 * we need to split it up
328 */ 328 */
329 QStringList refs = QStringList::split(';', val ); 329 QStringList refs = QStringList::split(';', val );
330 QStringList::Iterator strIt; 330 QStringList::Iterator strIt;
331 for (strIt = refs.begin(); strIt != refs.end(); ++strIt ) { 331 for (strIt = refs.begin(); strIt != refs.end(); ++strIt ) {
332 int pos = (*strIt).find(','); 332 int pos = (*strIt).find(',');
333 if ( pos > -1 ) 333 if ( pos > -1 )
334 ev.addRelation( (*strIt).left(pos), (*strIt).mid(pos+1).toInt() ); 334 ; // ev.addRelation( (*strIt).left(pos), (*strIt).mid(pos+1).toInt() );
335 335
336 } 336 }
337 break; 337 break;
338 } 338 }
339 case OTodo::HasAlarmDateTime: 339 case OTodo::HasAlarmDateTime:
340 ev.setHasAlarmDateTime( val.toInt() ); 340 ev.setHasAlarmDateTime( val.toInt() );
341 break; 341 break;
342 case OTodo::AlarmDateTime: { 342 case OTodo::AlarmDateTime: {
343 /* this sounds better ;) zecke */ 343 /* this sounds better ;) zecke */
344 ev.setAlarmDateTime( TimeConversion::fromISO8601( val.local8Bit() ) ); 344 ev.setAlarmDateTime( TimeConversion::fromISO8601( val.local8Bit() ) );
345 break; 345 break;
346 } 346 }
@@ -373,40 +373,24 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
373 * possible you can set custom fields 373 * possible you can set custom fields
374 * but don' iterate over the list 374 * but don' iterate over the list
375 * I may do #define private protected 375 * I may do #define private protected
376 * for this case - cough --zecke 376 * for this case - cough --zecke
377 */ 377 */
378 /* 378 /*
379 QMap<QString, QString> extras = ev.extras(); 379 QMap<QString, QString> extras = ev.extras();
380 QMap<QString, QString>::Iterator extIt; 380 QMap<QString, QString>::Iterator extIt;
381 for (extIt = extras.begin(); extIt != extras.end(); ++extIt ) 381 for (extIt = extras.begin(); extIt != extras.end(); ++extIt )
382 str += extIt.key() + "=\"" + extIt.data() + "\" "; 382 str += extIt.key() + "=\"" + extIt.data() + "\" ";
383 */ 383 */
384 // cross refernce 384 // cross refernce
385 QStringList list = ev.relatedApps();
386 QStringList::Iterator listIt;
387 QString refs;
388 str += "CrossReference=\"";
389 bool added = false;
390 for ( listIt = list.begin(); listIt != list.end(); ++listIt ) {
391 added = true;
392 QArray<int> ints = ev.relations( (*listIt) );
393 for ( uint i = 0; i< ints.count(); i++ ) {
394 str += (*listIt) + "," + QString::number( i ) + ";";
395 }
396 }
397 if ( added )
398 str = str.remove( str.length()-1, 1 );
399
400 str += "\" ";
401 385
402 str += "AlarmDateTime=\"" + TimeConversion::toISO8601( ev.alarmDateTime() ) + "\" "; 386 str += "AlarmDateTime=\"" + TimeConversion::toISO8601( ev.alarmDateTime() ) + "\" ";
403 387
404 return str; 388 return str;
405} 389}
406QString OTodoAccessXML::toString( const QArray<int>& ints ) const { 390QString OTodoAccessXML::toString( const QArray<int>& ints ) const {
407 return Qtopia::Record::idsToString( ints ); 391 return Qtopia::Record::idsToString( ints );
408} 392}
409 393
410/* internal class for sorting 394/* internal class for sorting
411 * 395 *
412 * Inspired by todoxmlio.cpp from TT 396 * Inspired by todoxmlio.cpp from TT
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index 591e467..c1682c6 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -322,25 +322,25 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
322 case OTodo::CrossReference: 322 case OTodo::CrossReference:
323 { 323 {
324 /* 324 /*
325 * A cross refernce looks like 325 * A cross refernce looks like
326 * appname,id;appname,id 326 * appname,id;appname,id
327 * we need to split it up 327 * we need to split it up
328 */ 328 */
329 QStringList refs = QStringList::split(';', val ); 329 QStringList refs = QStringList::split(';', val );
330 QStringList::Iterator strIt; 330 QStringList::Iterator strIt;
331 for (strIt = refs.begin(); strIt != refs.end(); ++strIt ) { 331 for (strIt = refs.begin(); strIt != refs.end(); ++strIt ) {
332 int pos = (*strIt).find(','); 332 int pos = (*strIt).find(',');
333 if ( pos > -1 ) 333 if ( pos > -1 )
334 ev.addRelation( (*strIt).left(pos), (*strIt).mid(pos+1).toInt() ); 334 ; // ev.addRelation( (*strIt).left(pos), (*strIt).mid(pos+1).toInt() );
335 335
336 } 336 }
337 break; 337 break;
338 } 338 }
339 case OTodo::HasAlarmDateTime: 339 case OTodo::HasAlarmDateTime:
340 ev.setHasAlarmDateTime( val.toInt() ); 340 ev.setHasAlarmDateTime( val.toInt() );
341 break; 341 break;
342 case OTodo::AlarmDateTime: { 342 case OTodo::AlarmDateTime: {
343 /* this sounds better ;) zecke */ 343 /* this sounds better ;) zecke */
344 ev.setAlarmDateTime( TimeConversion::fromISO8601( val.local8Bit() ) ); 344 ev.setAlarmDateTime( TimeConversion::fromISO8601( val.local8Bit() ) );
345 break; 345 break;
346 } 346 }
@@ -373,40 +373,24 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
373 * possible you can set custom fields 373 * possible you can set custom fields
374 * but don' iterate over the list 374 * but don' iterate over the list
375 * I may do #define private protected 375 * I may do #define private protected
376 * for this case - cough --zecke 376 * for this case - cough --zecke
377 */ 377 */
378 /* 378 /*
379 QMap<QString, QString> extras = ev.extras(); 379 QMap<QString, QString> extras = ev.extras();
380 QMap<QString, QString>::Iterator extIt; 380 QMap<QString, QString>::Iterator extIt;
381 for (extIt = extras.begin(); extIt != extras.end(); ++extIt ) 381 for (extIt = extras.begin(); extIt != extras.end(); ++extIt )
382 str += extIt.key() + "=\"" + extIt.data() + "\" "; 382 str += extIt.key() + "=\"" + extIt.data() + "\" ";
383 */ 383 */
384 // cross refernce 384 // cross refernce
385 QStringList list = ev.relatedApps();
386 QStringList::Iterator listIt;
387 QString refs;
388 str += "CrossReference=\"";
389 bool added = false;
390 for ( listIt = list.begin(); listIt != list.end(); ++listIt ) {
391 added = true;
392 QArray<int> ints = ev.relations( (*listIt) );
393 for ( uint i = 0; i< ints.count(); i++ ) {
394 str += (*listIt) + "," + QString::number( i ) + ";";
395 }
396 }
397 if ( added )
398 str = str.remove( str.length()-1, 1 );
399
400 str += "\" ";
401 385
402 str += "AlarmDateTime=\"" + TimeConversion::toISO8601( ev.alarmDateTime() ) + "\" "; 386 str += "AlarmDateTime=\"" + TimeConversion::toISO8601( ev.alarmDateTime() ) + "\" ";
403 387
404 return str; 388 return str;
405} 389}
406QString OTodoAccessXML::toString( const QArray<int>& ints ) const { 390QString OTodoAccessXML::toString( const QArray<int>& ints ) const {
407 return Qtopia::Record::idsToString( ints ); 391 return Qtopia::Record::idsToString( ints );
408} 392}
409 393
410/* internal class for sorting 394/* internal class for sorting
411 * 395 *
412 * Inspired by todoxmlio.cpp from TT 396 * Inspired by todoxmlio.cpp from TT
diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp
index 21cf131..0e3be9d 100644
--- a/libopie2/opiepim/core/opimrecord.cpp
+++ b/libopie2/opiepim/core/opimrecord.cpp
@@ -12,25 +12,25 @@ OPimRecord::OPimRecord( int uid )
12 setUid( uid ); 12 setUid( uid );
13} 13}
14OPimRecord::~OPimRecord() { 14OPimRecord::~OPimRecord() {
15} 15}
16OPimRecord::OPimRecord( const OPimRecord& rec ) 16OPimRecord::OPimRecord( const OPimRecord& rec )
17 : Qtopia::Record( rec ) 17 : Qtopia::Record( rec )
18{ 18{
19 (*this) = rec; 19 (*this) = rec;
20} 20}
21 21
22OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { 22OPimRecord &OPimRecord::operator=( const OPimRecord& rec) {
23 Qtopia::Record::operator=( rec ); 23 Qtopia::Record::operator=( rec );
24 m_relations = rec.m_relations; 24 m_xrefman = rec.m_xrefman;
25 25
26 return *this; 26 return *this;
27} 27}
28/* 28/*
29 * category names 29 * category names
30 */ 30 */
31QStringList OPimRecord::categoryNames()const { 31QStringList OPimRecord::categoryNames()const {
32 QStringList list; 32 QStringList list;
33 QArray<int> cats = categories(); 33 QArray<int> cats = categories();
34 Categories catDB; 34 Categories catDB;
35 catDB.load( categoryFileName() ); 35 catDB.load( categoryFileName() );
36 36
@@ -43,90 +43,39 @@ QStringList OPimRecord::categoryNames()const {
43void OPimRecord::setCategoryNames( const QStringList& ) { 43void OPimRecord::setCategoryNames( const QStringList& ) {
44 44
45} 45}
46void OPimRecord::addCategoryName( const QString& ) { 46void OPimRecord::addCategoryName( const QString& ) {
47 Categories catDB; 47 Categories catDB;
48 catDB.load( categoryFileName() ); 48 catDB.load( categoryFileName() );
49 49
50 50
51} 51}
52bool OPimRecord::isEmpty()const { 52bool OPimRecord::isEmpty()const {
53 return ( uid() == 0 ); 53 return ( uid() == 0 );
54} 54}
55QStringList OPimRecord::relatedApps()const{ 55/*QString OPimRecord::crossToString()const {
56 QStringList list;
57 QMap<QString, QArray<int> >::ConstIterator it;
58 for ( it = m_relations.begin(); it != m_relations.end(); ++it ) {
59 list << it.key();
60 }
61 return list;
62}
63QArray<int> OPimRecord::relations(const QString& app )const {
64 QArray<int> tmp;
65 QMap<QString, QArray<int> >::ConstIterator it;
66 it = m_relations.find( app);
67 if ( it != m_relations.end() )
68 tmp = it.data();
69 return tmp;
70}
71void OPimRecord::clearRelation( const QString& app ) {
72 m_relations.remove( app );
73}
74void OPimRecord::addRelation( const QString& app, int id ) {
75
76 QMap<QString, QArray<int> >::Iterator it;
77 QArray<int> tmp;
78
79 it = m_relations.find( app );
80 if ( it == m_relations.end() ) {
81 tmp.resize(1 );
82 tmp[0] = id;
83 }else{
84 tmp = it.data();
85 tmp.resize( tmp.size() + 1 );
86 tmp[tmp.size() - 1] = id;
87 }
88 m_relations.replace( app, tmp );
89}
90void OPimRecord::setRelations( const QString& app, QArray<int> ids ) {
91
92 QMap<QString, QArray<int> >::Iterator it;
93 QArray<int> tmp;
94
95 it = m_relations.find( app);
96 if ( it == m_relations.end() ) {
97 tmp = ids;
98 }else{
99 tmp = it.data();
100 int offset = tmp.size()-1;
101 tmp.resize( tmp.size() + ids.size() );
102 for (uint i = 0; i < ids.size(); i++ ) {
103 tmp[offset+i] = ids[i];
104 }
105
106 }
107 m_relations.replace( app, tmp );
108}
109QString OPimRecord::crossToString()const {
110 QString str; 56 QString str;
111 QMap<QString, QArray<int> >::ConstIterator it; 57 QMap<QString, QArray<int> >::ConstIterator it;
112 for (it = m_relations.begin(); it != m_relations.end(); ++it ) { 58 for (it = m_relations.begin(); it != m_relations.end(); ++it ) {
113 QArray<int> id = it.data(); 59 QArray<int> id = it.data();
114 for ( uint i = 0; i < id.size(); ++i ) { 60 for ( uint i = 0; i < id.size(); ++i ) {
115 str += it.key() + "," + QString::number( i ) + ";"; 61 str += it.key() + "," + QString::number( i ) + ";";
116 } 62 }
117 } 63 }
118 str = str.remove( str.length()-1, 1); // strip the ; 64 str = str.remove( str.length()-1, 1); // strip the ;
119 //qWarning("IDS " + str ); 65 //qWarning("IDS " + str );
120 66
121 return str; 67 return str;
122} 68 }*/
123/* if uid = 1 assign a new one */ 69/* if uid = 1 assign a new one */
124void OPimRecord::setUid( int uid ) { 70void OPimRecord::setUid( int uid ) {
125 if ( uid == 1) 71 if ( uid == 1)
126 uid = uidGen().generate(); 72 uid = uidGen().generate();
127 73
128 Qtopia::Record::setUid( uid ); 74 Qtopia::Record::setUid( uid );
129}; 75};
130Qtopia::UidGen &OPimRecord::uidGen() { 76Qtopia::UidGen &OPimRecord::uidGen() {
131 return m_uidGen; 77 return m_uidGen;
132} 78}
79OPimXRefManager &OPimRecord::xrefmanager() {
80 return m_xrefman;
81}
diff --git a/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h
index d9ccad4..1642a5e 100644
--- a/libopie2/opiepim/core/opimrecord.h
+++ b/libopie2/opiepim/core/opimrecord.h
@@ -1,21 +1,22 @@
1#ifndef OPIE_PIM_RECORD_H 1#ifndef OPIE_PIM_RECORD_H
2#define OPIE_PIM_RECORD_H 2#define OPIE_PIM_RECORD_H
3 3
4#include <qmap.h> 4#include <qmap.h>
5#include <qstring.h> 5#include <qstring.h>
6#include <qstringlist.h> 6#include <qstringlist.h>
7 7
8#include <qpe/palmtoprecord.h> 8#include <qpe/palmtoprecord.h>
9 9
10#include <opie/opimxrefmanager.h>
10 11
11/** 12/**
12 * This is the base class for 13 * This is the base class for
13 * all PIM Records 14 * all PIM Records
14 * 15 *
15 */ 16 */
16class OPimRecord : public Qtopia::Record { 17class OPimRecord : public Qtopia::Record {
17public: 18public:
18 /** 19 /**
19 * c'tor 20 * c'tor
20 * uid of 0 isEmpty 21 * uid of 0 isEmpty
21 * uid of 1 will be assigned a new one 22 * uid of 1 will be assigned a new one
@@ -77,57 +78,39 @@ public:
77 78
78 /** 79 /**
79 * key value representation of extra items 80 * key value representation of extra items
80 */ 81 */
81 virtual QMap<QString, QString> toExtraMap()const = 0; 82 virtual QMap<QString, QString> toExtraMap()const = 0;
82 83
83 /** 84 /**
84 * the name for a recordField 85 * the name for a recordField
85 */ 86 */
86 virtual QString recordField(int)const = 0; 87 virtual QString recordField(int)const = 0;
87 88
88 /** 89 /**
89 * the related apps names 90 * returns a reference of the
91 * Cross Reference Manager
92 * Partner One is THIS PIM RECORD!
93 * Two is the Partner where we link to
90 */ 94 */
91 QStringList relatedApps()const; 95 OPimXRefManager& xrefmanager();
92
93 /**
94 * the realtions between an app
95 */
96 QArray<int> relations( const QString& app )const;
97
98 /**
99 * clear the relations for all relations
100 * with app
101 */
102 void clearRelation( const QString& app );
103
104 /**
105 * add a relation
106 */
107 void addRelation( const QString& app, int id );
108
109 /**
110 * set the relations for an app
111 */
112 void setRelations( const QString&, QArray<int> ids );
113 96
114 /** 97 /**
115 * set the uid 98 * set the uid
116 */ 99 */
117 virtual void setUid( int uid ); 100 virtual void setUid( int uid );
118 101
119protected: 102protected:
120 Qtopia::UidGen &uidGen(); 103 Qtopia::UidGen &uidGen();
121 QString crossToString()const; 104// QString crossToString()const;
122 105
123private: 106private:
124 class OPimRecordPrivate; 107 class OPimRecordPrivate;
125 OPimRecordPrivate *d; 108 OPimRecordPrivate *d;
126 QMap<QString, QArray<int> > m_relations; 109 OPimXRefManager m_xrefman;
127 static Qtopia::UidGen m_uidGen; 110 static Qtopia::UidGen m_uidGen;
128 111
129}; 112};
130 113
131 114
132 115
133#endif 116#endif
diff --git a/libopie2/opiepim/core/opimxref.cpp b/libopie2/opiepim/core/opimxref.cpp
new file mode 100644
index 0000000..5cae871
--- a/dev/null
+++ b/libopie2/opiepim/core/opimxref.cpp
@@ -0,0 +1,47 @@
1#include "opimxref.h"
2
3OPimXRef::OPimXRef( const OPimXRefPartner& one, const OPimXRefPartner& two )
4 : m_partners(2)
5{
6 m_partners[0] = one;
7 m_partners[1] = two;
8}
9OPimXRef::OPimXRef()
10 : m_partners(2)
11{
12
13}
14OPimXRef::OPimXRef( const OPimXRef& ref) {
15 *this = ref;
16}
17OPimXRef::~OPimXRef() {
18}
19OPimXRef &OPimXRef::operator=( const OPimXRef& ref) {
20 m_partners = ref.m_partners;
21 m_partners.detach();
22
23 return* this;
24}
25bool OPimXRef::operator==( const OPimXRef& oper ) {
26 if ( m_partners == oper.m_partners ) return true;
27
28 return false;
29}
30OPimXRefPartner OPimXRef::partner( enum Partners par) const{
31 return m_partners[par];
32}
33void OPimXRef::setPartner( enum Partners par, const OPimXRefPartner& part) {
34 m_partners[par] = part;
35}
36bool OPimXRef::containsString( const QString& string ) const{
37 if ( m_partners[One].appName() == string ||
38 m_partners[Two].appName() == string ) return true;
39
40 return false;
41}
42bool OPimXRef::containsUid( int uid ) const{
43 if ( m_partners[One].uid() == uid ||
44 m_partners[Two].uid() == uid ) return true;
45
46 return false;
47}
diff --git a/libopie2/opiepim/core/opimxref.h b/libopie2/opiepim/core/opimxref.h
index 72154ac..354739a 100644
--- a/libopie2/opiepim/core/opimxref.h
+++ b/libopie2/opiepim/core/opimxref.h
@@ -11,26 +11,29 @@
11 * two Cross Reference Partners 11 * two Cross Reference Partners
12 */ 12 */
13class OPimXRef { 13class OPimXRef {
14public: 14public:
15 typedef QValueList<OPimXRef> ValueList; 15 typedef QValueList<OPimXRef> ValueList;
16 enum Partners { One, Two }; 16 enum Partners { One, Two };
17 OPimXRef( const OPimXRefPartner& ONE, const OPimXRefPartner& ); 17 OPimXRef( const OPimXRefPartner& ONE, const OPimXRefPartner& );
18 OPimXRef(); 18 OPimXRef();
19 OPimXRef( const OPimXRef& ); 19 OPimXRef( const OPimXRef& );
20 ~OPimXRef(); 20 ~OPimXRef();
21 21
22 OPimXRef &operator=( const OPimXRef& ); 22 OPimXRef &operator=( const OPimXRef& );
23 bool operator==( const OPimXRef ); 23 bool operator==( const OPimXRef& );
24 24
25 OPimXRefPartner partner( enum Partners ); 25 OPimXRefPartner partner( enum Partners )const;
26 26
27 void setPartner( enum Partners, const OPimXRefPartner& ); 27 void setPartner( enum Partners, const OPimXRefPartner& );
28 28
29 bool containsString( const QString& appName)const;
30 bool containsUid( int uid )const;
31
29private: 32private:
30 QArray<OPimXRefPartner> m_partners; 33 QArray<OPimXRefPartner> m_partners;
31 34
32 class Private; 35 class Private;
33 Private *d; 36 Private *d;
34}; 37};
35 38
36#endif 39#endif
diff --git a/libopie2/opiepim/core/opimxrefmanager.cpp b/libopie2/opiepim/core/opimxrefmanager.cpp
new file mode 100644
index 0000000..d49f5f5
--- a/dev/null
+++ b/libopie2/opiepim/core/opimxrefmanager.cpp
@@ -0,0 +1,69 @@
1#include "opimxrefmanager.h"
2
3
4OPimXRefManager::OPimXRefManager() {
5}
6OPimXRefManager::OPimXRefManager( const OPimXRefManager& ref) {
7 m_list = ref.m_list;
8}
9OPimXRefManager &OPimXRefManager::operator=( const OPimXRefManager& ref) {
10 m_list = ref.m_list;
11 return *this;
12}
13bool OPimXRefManager::operator==( const OPimXRefManager& /*ref*/) {
14 // if ( m_list == ref.m_list ) return true;
15
16 return false;
17}
18void OPimXRefManager::add( const OPimXRef& ref) {
19 m_list.append( ref );
20}
21void OPimXRefManager::remove( const OPimXRef& ref) {
22 m_list.remove( ref );
23}
24void OPimXRefManager::replace( const OPimXRef& ref) {
25 m_list.remove( ref );
26 m_list.append( ref );
27}
28void OPimXRefManager::clear() {
29 m_list.clear();
30}
31QStringList OPimXRefManager::apps()const {
32 OPimXRef::ValueList::ConstIterator it;
33 QStringList list;
34
35 QString str;
36 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
37 str = (*it).partner( OPimXRef::One ).appName();
38 if ( !list.contains( str ) ) list << str;
39
40 str = (*it).partner( OPimXRef::Two ).appName();
41 if ( !list.contains( str ) ) list << str;
42 }
43 return list;
44}
45OPimXRef::ValueList OPimXRefManager::list()const {
46 return m_list;
47}
48OPimXRef::ValueList OPimXRefManager::list( const QString& appName )const{
49 OPimXRef::ValueList list;
50 OPimXRef::ValueList::ConstIterator it;
51
52 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
53 if ( (*it).containsString( appName ) )
54 list.append( (*it) );
55 }
56
57 return list;
58}
59OPimXRef::ValueList OPimXRefManager::list( int uid )const {
60 OPimXRef::ValueList list;
61 OPimXRef::ValueList::ConstIterator it;
62
63 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
64 if ( (*it).containsUid( uid ) )
65 list.append( (*it) );
66 }
67
68 return list;
69}
diff --git a/libopie2/opiepim/core/opimxrefmanager.h b/libopie2/opiepim/core/opimxrefmanager.h
index 147895d..9b003a3 100644
--- a/libopie2/opiepim/core/opimxrefmanager.h
+++ b/libopie2/opiepim/core/opimxrefmanager.h
@@ -1,15 +1,17 @@
1#ifndef OPIM_XREF_MANAGER_H 1#ifndef OPIM_XREF_MANAGER_H
2#define OPIM_XREF_MANAGER_H 2#define OPIM_XREF_MANAGER_H
3 3
4#include <qstringlist.h>
5
4#include <opie/opimxref.h> 6#include <opie/opimxref.h>
5 7
6/** 8/**
7 * This is a simple manager for 9 * This is a simple manager for
8 * OPimXRefs. 10 * OPimXRefs.
9 * It allows addition, removing, replacing 11 * It allows addition, removing, replacing
10 * clearing and 'querying' the XRef... 12 * clearing and 'querying' the XRef...
11 */ 13 */
12class OPimXRefManager { 14class OPimXRefManager {
13public: 15public:
14 OPimXRefManager(); 16 OPimXRefManager();
15 OPimXRefManager( const OPimXRefManager& ); 17 OPimXRefManager( const OPimXRefManager& );
@@ -22,15 +24,18 @@ public:
22 void remove( const OPimXRef& ); 24 void remove( const OPimXRef& );
23 void replace( const OPimXRef& ); 25 void replace( const OPimXRef& );
24 26
25 void clear(); 27 void clear();
26 28
27 /** 29 /**
28 * apps participating 30 * apps participating
29 */ 31 */
30 QStringList apps()const; 32 QStringList apps()const;
31 OPimXRef::ValueList list()const; 33 OPimXRef::ValueList list()const;
32 OPimXRef::ValueList list( const QString& appName )const; 34 OPimXRef::ValueList list( const QString& appName )const;
33 OPimXRef::ValueList list( int uid )const; 35 OPimXRef::ValueList list( int uid )const;
36
37private:
38 OPimXRef::ValueList m_list;
34}; 39};
35 40
36#endif 41#endif
diff --git a/libopie2/opiepim/core/opimxrefpartner.cpp b/libopie2/opiepim/core/opimxrefpartner.cpp
new file mode 100644
index 0000000..028f4e6
--- a/dev/null
+++ b/libopie2/opiepim/core/opimxrefpartner.cpp
@@ -0,0 +1,43 @@
1#include "opimxrefpartner.h"
2
3OPimXRefPartner::OPimXRefPartner( const QString& appName,
4 int uid, int field )
5 : m_app(appName), m_uid(uid), m_field( field ) {
6}
7OPimXRefPartner::OPimXRefPartner( const OPimXRefPartner& ref ) {
8 *this = ref;
9}
10OPimXRefPartner::~OPimXRefPartner() {
11}
12OPimXRefPartner &OPimXRefPartner::operator=( const OPimXRefPartner& par ) {
13 m_app = par.m_app;
14 m_uid = par.m_uid;
15 m_field = par.m_field;
16
17 return *this;
18}
19bool OPimXRefPartner::operator==( const OPimXRefPartner& par ) {
20 if ( m_app != par.m_app ) return false;
21 if ( m_uid != par.m_uid ) return false;
22 if ( m_field != par.m_field ) return false;
23
24 return true;
25}
26QString OPimXRefPartner::appName()const {
27 return m_app;
28}
29int OPimXRefPartner::uid()const {
30 return m_uid;
31}
32int OPimXRefPartner::field()const {
33 return m_field;
34}
35void OPimXRefPartner::setAppName( const QString& appName ) {
36 m_app = appName;
37}
38void OPimXRefPartner::setUid( int uid ) {
39 m_uid = uid;
40}
41void OPimXRefPartner::setField( int field ) {
42 m_field = field;
43}