summaryrefslogtreecommitdiff
path: root/library/backend
Unidiff
Diffstat (limited to 'library/backend') (more/less context) (ignore whitespace changes)
-rw-r--r--library/backend/palmtoprecord.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/backend/palmtoprecord.h b/library/backend/palmtoprecord.h
index 15cdd6a..0fce032 100644
--- a/library/backend/palmtoprecord.h
+++ b/library/backend/palmtoprecord.h
@@ -7,96 +7,99 @@
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef QTPALMTOP_RECORD_H 20#ifndef QTPALMTOP_RECORD_H
21#define QTPALMTOP_RECORD_H 21#define QTPALMTOP_RECORD_H
22#include <qglobal.h> 22#include <qglobal.h>
23#include "qpcglobal.h" 23#include "qpcglobal.h"
24#include "palmtopuidgen.h" 24#include "palmtopuidgen.h"
25#include <qarray.h> 25#include <qarray.h>
26#include <qmap.h> 26#include <qmap.h>
27 27
28#if defined(QPC_TEMPLATEDLL) 28#if defined(QPC_TEMPLATEDLL)
29// MOC_SKIP_BEGIN 29// MOC_SKIP_BEGIN
30QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<QString, QString>; 30QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<QString, QString>;
31// MOC_SKIP_END 31// MOC_SKIP_END
32#endif 32#endif
33 33
34class QRegExp; 34class QRegExp;
35/** 35/**
36 * @short Qtopia namespace 36 * @short Qtopia namespace
37 * The namespace of Qtopia 37 * The namespace of Qtopia
38 */ 38 */
39namespace Qtopia { 39namespace Qtopia {
40 40
41class RecordPrivate; 41class RecordPrivate;
42/** 42/**
43 * @short The base class of all Records 43 * @short The base class of all Records
44 * 44 *
45 * The base class for Records in Qtopia 45 * The base class for Records in Qtopia
46 * @see Task 46 * @see Task
47 * @see Event 47 * @see Event
48 * @see Contact 48 * @see Contact
49 */ 49 */
50class QPC_EXPORT Record 50class QPC_EXPORT Record
51{ 51{
52public: 52public:
53 Record() : mUid(0), mCats() { } 53 Record() : mUid(0), mCats() { }
54 Record( const Record &c ) :mUid( c.mUid ), mCats ( c.mCats ), customMap(c.customMap) { } 54 Record( const Record &c ) :mUid( c.mUid ), mCats ( c.mCats ), customMap(c.customMap) { }
55 /**
56 * @todo make non inline in regard to KDE BC guide
57 */
55 virtual ~Record() { } 58 virtual ~Record() { }
56 59
57 Record &operator=( const Record &c ); 60 Record &operator=( const Record &c );
58 61
59 virtual bool match( const QRegExp & ) const { return FALSE; } 62 virtual bool match( const QRegExp & ) const { return FALSE; }
60 63
61 void setCategories( const QArray<int> &v ) { mCats = v; mCats.sort(); } 64 void setCategories( const QArray<int> &v ) { mCats = v; mCats.sort(); }
62 void setCategories( int single ); 65 void setCategories( int single );
63 const QArray<int> &categories() const { return mCats; } 66 const QArray<int> &categories() const { return mCats; }
64 67
65 void reassignCategoryId( int oldId, int newId ) 68 void reassignCategoryId( int oldId, int newId )
66 { 69 {
67 int index = mCats.find( oldId ); 70 int index = mCats.find( oldId );
68 if ( index >= 0 ) 71 if ( index >= 0 )
69 mCats[index] = newId; 72 mCats[index] = newId;
70 } 73 }
71 74
72 int uid() const { return mUid; }; 75 int uid() const { return mUid; };
73 virtual void setUid( int i ) { mUid = i; uidGen().store( mUid ); } 76 virtual void setUid( int i ) { mUid = i; uidGen().store( mUid ); }
74 bool isValidUid() const { return mUid != 0; } 77 bool isValidUid() const { return mUid != 0; }
75 void assignUid() { setUid( uidGen().generate() ); } 78 void assignUid() { setUid( uidGen().generate() ); }
76 79
77 virtual QString customField(const QString &) const; 80 virtual QString customField(const QString &) const;
78 virtual void setCustomField(const QString &, const QString &); 81 virtual void setCustomField(const QString &, const QString &);
79 virtual void removeCustomField(const QString &); 82 virtual void removeCustomField(const QString &);
80 83
81 virtual bool operator == ( const Record &r ) const 84 virtual bool operator == ( const Record &r ) const
82{ return mUid == r.mUid; } 85{ return mUid == r.mUid; }
83 virtual bool operator != ( const Record &r ) const 86 virtual bool operator != ( const Record &r ) const
84{ return mUid != r.mUid; } 87{ return mUid != r.mUid; }
85 88
86 // convenience methods provided for loading and saving to xml 89 // convenience methods provided for loading and saving to xml
87 static QString idsToString( const QArray<int> &ids ); 90 static QString idsToString( const QArray<int> &ids );
88 // convenience methods provided for loading and saving to xml 91 // convenience methods provided for loading and saving to xml
89 static QArray<int> idsFromString( const QString &str ); 92 static QArray<int> idsFromString( const QString &str );
90 93
91 // for debugging 94 // for debugging
92 static void dump( const QMap<int, QString> &map ); 95 static void dump( const QMap<int, QString> &map );
93 96
94protected: 97protected:
95 virtual UidGen &uidGen() = 0; 98 virtual UidGen &uidGen() = 0;
96 virtual QString customToXml() const; 99 virtual QString customToXml() const;
97private: 100private:
98 int mUid; 101 int mUid;
99 QArray<int> mCats; 102 QArray<int> mCats;
100 QMap<QString, QString> customMap; 103 QMap<QString, QString> customMap;
101 RecordPrivate *d; 104 RecordPrivate *d;
102}; 105};