summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontactaccessbackend_vcard.cpp5
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp5
2 files changed, 8 insertions, 2 deletions
diff --git a/libopie/pim/ocontactaccessbackend_vcard.cpp b/libopie/pim/ocontactaccessbackend_vcard.cpp
index 013f3af..faa72b4 100644
--- a/libopie/pim/ocontactaccessbackend_vcard.cpp
+++ b/libopie/pim/ocontactaccessbackend_vcard.cpp
@@ -1,83 +1,86 @@
1/* 1/*
2 * VCard Backend for the OPIE-Contact Database. 2 * VCard Backend for the OPIE-Contact Database.
3 * 3 *
4 * Copyright (C) 2000 Trolltech AS. All rights reserved. 4 * Copyright (C) 2000 Trolltech AS. All rights reserved.
5 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) 5 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
6 * 6 *
7 * ===================================================================== 7 * =====================================================================
8 *This program is free software; you can redistribute it and/or 8 *This program is free software; you can redistribute it and/or
9 *modify it under the terms of the GNU Library General Public 9 *modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * ===================================================================== 12 * =====================================================================
13 * ToDo: 13 * ToDo:
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.3 2002/11/11 16:41:09 kergoth
21 * no default arguments in implementation
22 *
20 * Revision 1.2 2002/11/10 15:41:53 eilers 23 * Revision 1.2 2002/11/10 15:41:53 eilers
21 * Bugfixes.. 24 * Bugfixes..
22 * 25 *
23 * Revision 1.1 2002/11/09 14:34:52 eilers 26 * Revision 1.1 2002/11/09 14:34:52 eilers
24 * Added VCard Backend. 27 * Added VCard Backend.
25 * 28 *
26 */ 29 */
27#include "ocontactaccessbackend_vcard.h" 30#include "ocontactaccessbackend_vcard.h"
28#include "../../library/backend/vobject_p.h" 31#include "../../library/backend/vobject_p.h"
29#include "../../library/backend/qfiledirect_p.h" 32#include "../../library/backend/qfiledirect_p.h"
30 33
31#include <qpe/timeconversion.h> 34#include <qpe/timeconversion.h>
32 35
33#include <qfile.h> 36#include <qfile.h>
34 37
35OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString filename = 0l ): 38OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString filename ):
36 m_dirty( false ), 39 m_dirty( false ),
37 m_file( filename ) 40 m_file( filename )
38{ 41{
39 load(); 42 load();
40} 43}
41 44
42 45
43bool OContactAccessBackend_VCard::load () 46bool OContactAccessBackend_VCard::load ()
44{ 47{
45 m_map.clear(); 48 m_map.clear();
46 m_dirty = false; 49 m_dirty = false;
47 50
48 VObject* obj = 0l; 51 VObject* obj = 0l;
49 obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); 52 obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() );
50 if ( !obj ) 53 if ( !obj )
51 return false; 54 return false;
52 55
53 while ( obj ) { 56 while ( obj ) {
54 OContact con = parseVObject( obj ); 57 OContact con = parseVObject( obj );
55 /* 58 /*
56 * if uid is 0 assign a new one 59 * if uid is 0 assign a new one
57 * this at least happens on 60 * this at least happens on
58 * Nokia6210 61 * Nokia6210
59 */ 62 */
60 if ( con.uid() == 0 ){ 63 if ( con.uid() == 0 ){
61 con.setUid( 1 ); 64 con.setUid( 1 );
62 qWarning("assigned new uid %d",con.uid() ); 65 qWarning("assigned new uid %d",con.uid() );
63 } 66 }
64 67
65 m_map.insert( con.uid(), con ); 68 m_map.insert( con.uid(), con );
66 69
67 VObject *t = obj; 70 VObject *t = obj;
68 obj = nextVObjectInList(obj); 71 obj = nextVObjectInList(obj);
69 cleanVObject( t ); 72 cleanVObject( t );
70 } 73 }
71 74
72 return true; 75 return true;
73 76
74} 77}
75bool OContactAccessBackend_VCard::reload() 78bool OContactAccessBackend_VCard::reload()
76{ 79{
77 return load(); 80 return load();
78} 81}
79bool OContactAccessBackend_VCard::save() 82bool OContactAccessBackend_VCard::save()
80{ 83{
81 if (!m_dirty ) 84 if (!m_dirty )
82 return true; 85 return true;
83 86
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
index 013f3af..faa72b4 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
@@ -1,83 +1,86 @@
1/* 1/*
2 * VCard Backend for the OPIE-Contact Database. 2 * VCard Backend for the OPIE-Contact Database.
3 * 3 *
4 * Copyright (C) 2000 Trolltech AS. All rights reserved. 4 * Copyright (C) 2000 Trolltech AS. All rights reserved.
5 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) 5 * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de)
6 * 6 *
7 * ===================================================================== 7 * =====================================================================
8 *This program is free software; you can redistribute it and/or 8 *This program is free software; you can redistribute it and/or
9 *modify it under the terms of the GNU Library General Public 9 *modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * ===================================================================== 12 * =====================================================================
13 * ToDo: 13 * ToDo:
14 * 14 *
15 * ===================================================================== 15 * =====================================================================
16 * Version: $Id$ 16 * Version: $Id$
17 * ===================================================================== 17 * =====================================================================
18 * History: 18 * History:
19 * $Log$ 19 * $Log$
20 * Revision 1.3 2002/11/11 16:41:09 kergoth
21 * no default arguments in implementation
22 *
20 * Revision 1.2 2002/11/10 15:41:53 eilers 23 * Revision 1.2 2002/11/10 15:41:53 eilers
21 * Bugfixes.. 24 * Bugfixes..
22 * 25 *
23 * Revision 1.1 2002/11/09 14:34:52 eilers 26 * Revision 1.1 2002/11/09 14:34:52 eilers
24 * Added VCard Backend. 27 * Added VCard Backend.
25 * 28 *
26 */ 29 */
27#include "ocontactaccessbackend_vcard.h" 30#include "ocontactaccessbackend_vcard.h"
28#include "../../library/backend/vobject_p.h" 31#include "../../library/backend/vobject_p.h"
29#include "../../library/backend/qfiledirect_p.h" 32#include "../../library/backend/qfiledirect_p.h"
30 33
31#include <qpe/timeconversion.h> 34#include <qpe/timeconversion.h>
32 35
33#include <qfile.h> 36#include <qfile.h>
34 37
35OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString filename = 0l ): 38OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString filename ):
36 m_dirty( false ), 39 m_dirty( false ),
37 m_file( filename ) 40 m_file( filename )
38{ 41{
39 load(); 42 load();
40} 43}
41 44
42 45
43bool OContactAccessBackend_VCard::load () 46bool OContactAccessBackend_VCard::load ()
44{ 47{
45 m_map.clear(); 48 m_map.clear();
46 m_dirty = false; 49 m_dirty = false;
47 50
48 VObject* obj = 0l; 51 VObject* obj = 0l;
49 obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); 52 obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() );
50 if ( !obj ) 53 if ( !obj )
51 return false; 54 return false;
52 55
53 while ( obj ) { 56 while ( obj ) {
54 OContact con = parseVObject( obj ); 57 OContact con = parseVObject( obj );
55 /* 58 /*
56 * if uid is 0 assign a new one 59 * if uid is 0 assign a new one
57 * this at least happens on 60 * this at least happens on
58 * Nokia6210 61 * Nokia6210
59 */ 62 */
60 if ( con.uid() == 0 ){ 63 if ( con.uid() == 0 ){
61 con.setUid( 1 ); 64 con.setUid( 1 );
62 qWarning("assigned new uid %d",con.uid() ); 65 qWarning("assigned new uid %d",con.uid() );
63 } 66 }
64 67
65 m_map.insert( con.uid(), con ); 68 m_map.insert( con.uid(), con );
66 69
67 VObject *t = obj; 70 VObject *t = obj;
68 obj = nextVObjectInList(obj); 71 obj = nextVObjectInList(obj);
69 cleanVObject( t ); 72 cleanVObject( t );
70 } 73 }
71 74
72 return true; 75 return true;
73 76
74} 77}
75bool OContactAccessBackend_VCard::reload() 78bool OContactAccessBackend_VCard::reload()
76{ 79{
77 return load(); 80 return load();
78} 81}
79bool OContactAccessBackend_VCard::save() 82bool OContactAccessBackend_VCard::save()
80{ 83{
81 if (!m_dirty ) 84 if (!m_dirty )
82 return true; 85 return true;
83 86