summaryrefslogtreecommitdiff
path: root/libopie/pim/opimrecord.cpp
blob: 49b5bf9e9a71bbd23df33310024ad9fcc68aaa30 (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
#include <qpe/categories.h>
#include <qpe/categoryselect.h>

#include "opimrecord.h"

Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia );


OPimRecord::OPimRecord( int uid )
    : Qtopia::Record() {

    setUid( uid );
}
OPimRecord::~OPimRecord() {
}
OPimRecord::OPimRecord( const OPimRecord& rec )
    : Qtopia::Record( rec )
{
    (*this) = rec;
}

OPimRecord &OPimRecord::operator=( const OPimRecord& rec) {
    Qtopia::Record::operator=( rec );
    m_xrefman = rec.m_xrefman;

    return  *this;
}
/*
 * category names
 */
QStringList OPimRecord::categoryNames()const {
    QStringList list;
    QArray<int> cats = categories();
    Categories catDB;
    catDB.load( categoryFileName() );

    for (uint i = 0; i < cats.count(); i++ ) {
        list << catDB.label("Todo List", cats[i] );
    }

    return list;
}
void OPimRecord::setCategoryNames( const QStringList& ) {

}
void OPimRecord::addCategoryName( const QString& ) {
    Categories catDB;
    catDB.load( categoryFileName() );


}
bool OPimRecord::isEmpty()const {
    return ( uid() == 0 );
}
/*QString OPimRecord::crossToString()const {
    QString str;
    QMap<QString, QArray<int> >::ConstIterator it;
    for (it = m_relations.begin(); it != m_relations.end(); ++it ) {
        QArray<int> id = it.data();
        for ( uint i = 0; i < id.size(); ++i ) {
            str += it.key() + "," + QString::number( i ) + ";";
        }
    }
    str = str.remove( str.length()-1, 1); // strip the ;
    //qWarning("IDS " + str );

    return str;
    }*/
/* if uid = 1 assign a new one */
void OPimRecord::setUid( int uid ) {
    if ( uid == 1)
        uid = uidGen().generate();

    Qtopia::Record::setUid( uid );
};
Qtopia::UidGen &OPimRecord::uidGen() {
    return m_uidGen;
}
OPimXRefManager &OPimRecord::xrefmanager() {
    return m_xrefman;
}
int OPimRecord::rtti(){
    return 0;
}