summaryrefslogtreecommitdiff
path: root/libopie/pim/opimrecord.h
blob: e4d33d66007f83aad6634f00233d050e69d7da72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef OPIE_PIM_RECORD_H
#define OPIE_PIM_RECORD_H

#include <qmap.h>
#include <qstring.h>
#include <qstringlist.h>

#include <qpe/palmtoprecord.h>

class OPimRecord : public Qtopia::Record {
public:
    /**
     * uid of 0 isEmpty
     * uid of 1 will be assigned a new one
     */
    OPimRecord(int uid = 0);
    ~OPimRecord();

    /**
     * copy c'tor
     */
    OPimRecord( const OPimRecord& rec );

    /**
     * copy operator
     */
    OPimRecord &operator=( const OPimRecord& );

    /**
     * category names resolved
     */
    QStringList categoryNames()const;

    /**
     * set category names they will be resolved
     */
    void setCategoryNames( const QStringList& );

    /**
     * addCategoryName adds a name
     * to the internal category list
     */
    void addCategoryName( const QString& );

    /**
     * if a Record isEmpty
     */
    virtual bool isEmpty()const;

    /**
     * toRichText summary
     */
    virtual QString toRichText()const = 0;

    /**
     * a small one line summary
     */
    virtual QString toShortText()const = 0;

    /**
     * the name of the Record
     */
    virtual QString type()const = 0;

    /**
     * converts the internal structure to a map
     */
    virtual QMap<int, QString> toMap()const = 0;

    /**
     * key value representation of extra items
     */
    virtual QMap<QString, QString> toExtraMap()const = 0;

    /**
     * the name for a recordField
     */
    virtual QString recordField(int)const = 0;

    /**
     * the related apps names
     */
    QStringList relatedApps()const;

    /**
     * the realtions between an app
     */
    QArray<int> relations( const QString& app )const;

    /**
     *
     */
    void clearRelation( const QString& app );

    /**
     *
     */
    void addRelation( const QString& app,  int id );

    /**
     *
     */
    void setRelations( const QString&, QArray<int> ids );
    virtual void setUid( int uid );

protected:
    Qtopia::UidGen &uidGen();
    QString crossToString()const;

private:
    class OPimRecordPrivate;
    OPimRecordPrivate *d;
    QMap<QString, QArray<int> > m_relations;
    static Qtopia::UidGen m_uidGen;

};



#endif