summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core/opimrecord.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/core/opimrecord.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimrecord.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp
index 2365748..72bb372 100644
--- a/libopie2/opiepim/core/opimrecord.cpp
+++ b/libopie2/opiepim/core/opimrecord.cpp
@@ -1,55 +1,84 @@
+/*
+ This file is part of the Opie Project
+ Copyright (C) The Main Author <main-author@whereever.org>
+ =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
+ .=l.
+ .>+-=
+ _;:, .> :=|. This program is free software; you can
+.> <`_, > . <= redistribute it and/or modify it under
+:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
+.="- .-=="i, .._ License as published by the Free Software
+ - . .-<_> .<> Foundation; either version 2 of the License,
+ ._= =} : or (at your option) any later version.
+ .%`+i> _;_.
+ .i_,=:_. -<s. This program is distributed in the hope that
+ + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
+ : .. .:, . . . without even the implied warranty of
+ =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
+ _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.= = ; Library General Public License for more
+++= -. .` .: details.
+ : = ...= . :.=-
+ -. .:....=;==+<; You should have received a copy of the GNU
+ -_. . . )=. = Library General Public License along with
+ -- :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
#include <qarray.h>
#include <qpe/categories.h>
#include <qpe/categoryselect.h>
-#include "opimrecord.h"
+#include <opie2/opimrecord.h>
+namespace Opie {
Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia );
OPimRecord::OPimRecord( int uid )
: Qtopia::Record() {
m_lastHit = -1;
setUid( uid );
}
OPimRecord::~OPimRecord() {
}
OPimRecord::OPimRecord( const OPimRecord& rec )
: Qtopia::Record( rec )
{
(*this) = rec;
}
OPimRecord &OPimRecord::operator=( const OPimRecord& rec) {
if ( this == &rec ) return *this;
Qtopia::Record::operator=( rec );
m_xrefman = rec.m_xrefman;
m_lastHit = rec.m_lastHit;
return *this;
}
/*
* category names
*/
QStringList OPimRecord::categoryNames( const QString& appname ) const {
QStringList list;
QArray<int> cats = categories();
Categories catDB;
catDB.load( categoryFileName() );
for (uint i = 0; i < cats.count(); i++ ) {
list << catDB.label( appname, cats[i] );
}
return list;
}
void OPimRecord::setCategoryNames( const QStringList& ) {
}
void OPimRecord::addCategoryName( const QString& ) {
Categories catDB;
catDB.load( categoryFileName() );
@@ -135,48 +164,50 @@ bool OPimRecord::saveToStream( QDataStream& stream )const {
stream << categories()[i];
}
/*
* first the XRef count
* then the xrefs
*/
stream << m_xrefman.list().count();
for ( OPimXRef::ValueList::ConstIterator it = m_xrefman.list().begin();
it != m_xrefman.list().end(); ++it ) {
flush( (*it).partner( OPimXRef::One), stream );
flush( (*it).partner( OPimXRef::Two), stream );
}
return true;
}
void OPimRecord::flush( const OPimXRefPartner& par, QDataStream& str ) const{
str << par.service();
str << par.uid();
str << par.field();
}
OPimXRefPartner OPimRecord::partner( QDataStream& stream ) {
OPimXRefPartner par;
QString str;
int i;
stream >> str;
par.setService( str );
stream >> i;
par.setUid( i );
stream >> i ;
par.setField( i );
return par;
}
void OPimRecord::setLastHitField( int lastHit )const {
m_lastHit = lastHit;
}
int OPimRecord::lastHitField()const{
return m_lastHit;
}
QMap<QString, QString> OPimRecord::toExtraMap()const {
return customMap;
}
void OPimRecord::setExtraMap( const QMap<QString, QString>& map) {
customMap = map;
}
+
+}