author | zecke <zecke> | 2003-02-21 16:52:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-02-21 16:52:49 (UTC) |
commit | 0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7 (patch) (unidiff) | |
tree | f3ce9c9441a1073762f3e0c61cc85f0d5a1fd81d /libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | |
parent | a298235aa1489937e7657079e6352adfc8746acf (diff) | |
download | opie-0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7.zip opie-0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7.tar.gz opie-0bb9d0f9e7da80f0ae3b91d4ebbb7aab4d2b9df7.tar.bz2 |
-Remove old Todo classes they're deprecated and today I already using the
new API
-Guard against self assignment in OTodo
-Add test apps for OPIM
-Opiefied Event classes
-Added TimeZone handling and pinning of TimeZones to OEvent
-Adjust ORecur and the widget to better timezone behaviour
Diffstat (limited to 'libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp index 622d40a..e537269 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | |||
@@ -1,125 +1,134 @@ | |||
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.8 2003/02/21 16:52:49 zecke | ||
21 | * -Remove old Todo classes they're deprecated and today I already using the | ||
22 | * new API | ||
23 | * -Guard against self assignment in OTodo | ||
24 | * -Add test apps for OPIM | ||
25 | * -Opiefied Event classes | ||
26 | * -Added TimeZone handling and pinning of TimeZones to OEvent | ||
27 | * -Adjust ORecur and the widget to better timezone behaviour | ||
28 | * | ||
20 | * Revision 1.7 2003/02/16 22:25:46 zecke | 29 | * Revision 1.7 2003/02/16 22:25:46 zecke |
21 | * 0000276 Fix for that bug.. or better temp workaround | 30 | * 0000276 Fix for that bug.. or better temp workaround |
22 | * A Preferred Number is HOME|VOICE | 31 | * A Preferred Number is HOME|VOICE |
23 | * A CellPhone is HOME|VOICE|CELL the type & HOME|VOICE test | 32 | * A CellPhone is HOME|VOICE|CELL the type & HOME|VOICE test |
24 | * triggers both | 33 | * triggers both |
25 | * and the cell phone number overrides the other entries.. | 34 | * and the cell phone number overrides the other entries.. |
26 | * | 35 | * |
27 | * as a temp I check that it's not equal to HOME|VOICE|CELL before setting the | 36 | * as a temp I check that it's not equal to HOME|VOICE|CELL before setting the |
28 | * number | 37 | * number |
29 | * | 38 | * |
30 | * The right and final fix would be to reorder the if statement to make it | 39 | * The right and final fix would be to reorder the if statement to make it |
31 | * if else based and the less common thing put to the bottom | 40 | * if else based and the less common thing put to the bottom |
32 | * | 41 | * |
33 | * OTodoAccessVcal fix the date for beaming | 42 | * OTodoAccessVcal fix the date for beaming |
34 | * | 43 | * |
35 | * Revision 1.6 2003/01/13 15:49:31 eilers | 44 | * Revision 1.6 2003/01/13 15:49:31 eilers |
36 | * Fixing crash when businesscard.vcf is missing.. | 45 | * Fixing crash when businesscard.vcf is missing.. |
37 | * | 46 | * |
38 | * Revision 1.5 2002/12/07 13:26:22 eilers | 47 | * Revision 1.5 2002/12/07 13:26:22 eilers |
39 | * Fixing bug in storing anniversary.. | 48 | * Fixing bug in storing anniversary.. |
40 | * | 49 | * |
41 | * Revision 1.4 2002/11/13 14:14:51 eilers | 50 | * Revision 1.4 2002/11/13 14:14:51 eilers |
42 | * Added sorted for Contacts.. | 51 | * Added sorted for Contacts.. |
43 | * | 52 | * |
44 | * Revision 1.3 2002/11/11 16:41:09 kergoth | 53 | * Revision 1.3 2002/11/11 16:41:09 kergoth |
45 | * no default arguments in implementation | 54 | * no default arguments in implementation |
46 | * | 55 | * |
47 | * Revision 1.2 2002/11/10 15:41:53 eilers | 56 | * Revision 1.2 2002/11/10 15:41:53 eilers |
48 | * Bugfixes.. | 57 | * Bugfixes.. |
49 | * | 58 | * |
50 | * Revision 1.1 2002/11/09 14:34:52 eilers | 59 | * Revision 1.1 2002/11/09 14:34:52 eilers |
51 | * Added VCard Backend. | 60 | * Added VCard Backend. |
52 | * | 61 | * |
53 | */ | 62 | */ |
54 | #include "ocontactaccessbackend_vcard.h" | 63 | #include "ocontactaccessbackend_vcard.h" |
55 | #include "../../library/backend/vobject_p.h" | 64 | #include "../../library/backend/vobject_p.h" |
56 | #include "../../library/backend/qfiledirect_p.h" | 65 | #include "../../library/backend/qfiledirect_p.h" |
57 | 66 | ||
58 | #include <qpe/timeconversion.h> | 67 | #include <qpe/timeconversion.h> |
59 | 68 | ||
60 | #include <qfile.h> | 69 | #include <qfile.h> |
61 | 70 | ||
62 | OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString filename ): | 71 | OContactAccessBackend_VCard::OContactAccessBackend_VCard ( QString , QString filename ): |
63 | m_dirty( false ), | 72 | m_dirty( false ), |
64 | m_file( filename ) | 73 | m_file( filename ) |
65 | { | 74 | { |
66 | load(); | 75 | load(); |
67 | } | 76 | } |
68 | 77 | ||
69 | 78 | ||
70 | bool OContactAccessBackend_VCard::load () | 79 | bool OContactAccessBackend_VCard::load () |
71 | { | 80 | { |
72 | m_map.clear(); | 81 | m_map.clear(); |
73 | m_dirty = false; | 82 | m_dirty = false; |
74 | 83 | ||
75 | VObject* obj = 0l; | 84 | VObject* obj = 0l; |
76 | 85 | ||
77 | if ( QFile( m_file ).exists() ){ | 86 | if ( QFile::exists(m_file) ){ |
78 | obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); | 87 | obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); |
79 | if ( !obj ) | 88 | if ( !obj ) |
80 | return false; | 89 | return false; |
81 | }else{ | 90 | }else{ |
82 | qWarning("File \"%s\" not found !", m_file.latin1() ); | 91 | qWarning("File \"%s\" not found !", m_file.latin1() ); |
83 | return false; | 92 | return false; |
84 | } | 93 | } |
85 | 94 | ||
86 | while ( obj ) { | 95 | while ( obj ) { |
87 | OContact con = parseVObject( obj ); | 96 | OContact con = parseVObject( obj ); |
88 | /* | 97 | /* |
89 | * if uid is 0 assign a new one | 98 | * if uid is 0 assign a new one |
90 | * this at least happens on | 99 | * this at least happens on |
91 | * Nokia6210 | 100 | * Nokia6210 |
92 | */ | 101 | */ |
93 | if ( con.uid() == 0 ){ | 102 | if ( con.uid() == 0 ){ |
94 | con.setUid( 1 ); | 103 | con.setUid( 1 ); |
95 | qWarning("assigned new uid %d",con.uid() ); | 104 | qWarning("assigned new uid %d",con.uid() ); |
96 | } | 105 | } |
97 | 106 | ||
98 | m_map.insert( con.uid(), con ); | 107 | m_map.insert( con.uid(), con ); |
99 | 108 | ||
100 | VObject *t = obj; | 109 | VObject *t = obj; |
101 | obj = nextVObjectInList(obj); | 110 | obj = nextVObjectInList(obj); |
102 | cleanVObject( t ); | 111 | cleanVObject( t ); |
103 | } | 112 | } |
104 | 113 | ||
105 | return true; | 114 | return true; |
106 | 115 | ||
107 | } | 116 | } |
108 | bool OContactAccessBackend_VCard::reload() | 117 | bool OContactAccessBackend_VCard::reload() |
109 | { | 118 | { |
110 | return load(); | 119 | return load(); |
111 | } | 120 | } |
112 | bool OContactAccessBackend_VCard::save() | 121 | bool OContactAccessBackend_VCard::save() |
113 | { | 122 | { |
114 | if (!m_dirty ) | 123 | if (!m_dirty ) |
115 | return true; | 124 | return true; |
116 | 125 | ||
117 | QFileDirect file( m_file ); | 126 | QFileDirect file( m_file ); |
118 | if (!file.open(IO_WriteOnly ) ) | 127 | if (!file.open(IO_WriteOnly ) ) |
119 | return false; | 128 | return false; |
120 | 129 | ||
121 | VObject *obj; | 130 | VObject *obj; |
122 | obj = newVObject( VCCalProp ); | 131 | obj = newVObject( VCCalProp ); |
123 | addPropValue( obj, VCVersionProp, "1.0" ); | 132 | addPropValue( obj, VCVersionProp, "1.0" ); |
124 | 133 | ||
125 | VObject *vo; | 134 | VObject *vo; |