author | mickeyl <mickeyl> | 2003-03-21 14:32:54 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-03-21 14:32:54 (UTC) |
commit | 69086f42072e7fc1ea5256cb9275a27bf5b41f87 (patch) (unidiff) | |
tree | a310ce28e7f332a08e45923df69bf822da88648c /libopie/pim | |
parent | 6d066b0ed3fd7fbedce84616a8fa279eec480f13 (diff) | |
download | opie-69086f42072e7fc1ea5256cb9275a27bf5b41f87.zip opie-69086f42072e7fc1ea5256cb9275a27bf5b41f87.tar.gz opie-69086f42072e7fc1ea5256cb9275a27bf5b41f87.tar.bz2 |
g++ compliance fix: default arguments belong into the declaration, but not the definition
-rw-r--r-- | libopie/pim/ocontactaccessbackend_xml.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libopie/pim/ocontactaccessbackend_xml.cpp b/libopie/pim/ocontactaccessbackend_xml.cpp index 9fe3d1e..c5a7820 100644 --- a/libopie/pim/ocontactaccessbackend_xml.cpp +++ b/libopie/pim/ocontactaccessbackend_xml.cpp | |||
@@ -1,155 +1,158 @@ | |||
1 | /* | 1 | /* |
2 | * XML Backend for the OPIE-Contact Database. | 2 | * XML Backend for the OPIE-Contact Database. |
3 | * | 3 | * |
4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) | 4 | * Copyright (c) 2002 by Stefan Eilers (Eilers.Stefan@epost.de) |
5 | * | 5 | * |
6 | * ===================================================================== | 6 | * ===================================================================== |
7 | *This program is free software; you can redistribute it and/or | 7 | *This program is free software; you can redistribute it and/or |
8 | *modify it under the terms of the GNU Library General Public | 8 | *modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; either | 9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. | 10 | * version 2 of the License, or (at your option) any later version. |
11 | * ===================================================================== | 11 | * ===================================================================== |
12 | * ToDo: XML-Backend: Automatic reload if something was changed... | 12 | * ToDo: XML-Backend: Automatic reload if something was changed... |
13 | * | 13 | * |
14 | * | 14 | * |
15 | * ===================================================================== | 15 | * ===================================================================== |
16 | * Version: $Id$ | 16 | * Version: $Id$ |
17 | * ===================================================================== | 17 | * ===================================================================== |
18 | * History: | 18 | * History: |
19 | * $Log$ | 19 | * $Log$ |
20 | * Revision 1.4 2003/03/21 14:32:54 mickeyl | ||
21 | * g++ compliance fix: default arguments belong into the declaration, but not the definition | ||
22 | * | ||
20 | * Revision 1.3 2003/03/21 12:26:28 eilers | 23 | * Revision 1.3 2003/03/21 12:26:28 eilers |
21 | * Fixing small bug: If we search a birthday from today to today, it returned | 24 | * Fixing small bug: If we search a birthday from today to today, it returned |
22 | * every contact .. | 25 | * every contact .. |
23 | * | 26 | * |
24 | * Revision 1.2 2003/03/21 10:33:09 eilers | 27 | * Revision 1.2 2003/03/21 10:33:09 eilers |
25 | * Merged speed optimized xml backend for contacts to main. | 28 | * Merged speed optimized xml backend for contacts to main. |
26 | * Added QDateTime to querybyexample. For instance, it is now possible to get | 29 | * Added QDateTime to querybyexample. For instance, it is now possible to get |
27 | * all Birthdays/Anniversaries between two dates. This should be used | 30 | * all Birthdays/Anniversaries between two dates. This should be used |
28 | * to show all birthdays in the datebook.. | 31 | * to show all birthdays in the datebook.. |
29 | * This change is sourcecode backward compatible but you have to upgrade | 32 | * This change is sourcecode backward compatible but you have to upgrade |
30 | * the binaries for today-addressbook. | 33 | * the binaries for today-addressbook. |
31 | * | 34 | * |
32 | * Revision 1.1.2.2 2003/02/11 12:17:28 eilers | 35 | * Revision 1.1.2.2 2003/02/11 12:17:28 eilers |
33 | * Speed optimization. Removed the sequential search loops. | 36 | * Speed optimization. Removed the sequential search loops. |
34 | * | 37 | * |
35 | * Revision 1.1.2.1 2003/02/10 15:31:38 eilers | 38 | * Revision 1.1.2.1 2003/02/10 15:31:38 eilers |
36 | * Writing offsets to debug output.. | 39 | * Writing offsets to debug output.. |
37 | * | 40 | * |
38 | * Revision 1.1 2003/02/09 15:05:01 eilers | 41 | * Revision 1.1 2003/02/09 15:05:01 eilers |
39 | * Nothing happened.. Just some cleanup before I will start.. | 42 | * Nothing happened.. Just some cleanup before I will start.. |
40 | * | 43 | * |
41 | * Revision 1.12 2003/01/03 16:58:03 eilers | 44 | * Revision 1.12 2003/01/03 16:58:03 eilers |
42 | * Reenable debug output | 45 | * Reenable debug output |
43 | * | 46 | * |
44 | * Revision 1.11 2003/01/03 12:31:28 eilers | 47 | * Revision 1.11 2003/01/03 12:31:28 eilers |
45 | * Bugfix for calculating data diffs.. | 48 | * Bugfix for calculating data diffs.. |
46 | * | 49 | * |
47 | * Revision 1.10 2003/01/02 14:27:12 eilers | 50 | * Revision 1.10 2003/01/02 14:27:12 eilers |
48 | * Improved query by example: Search by date is possible.. First step | 51 | * Improved query by example: Search by date is possible.. First step |
49 | * for a today plugin for birthdays.. | 52 | * for a today plugin for birthdays.. |
50 | * | 53 | * |
51 | * Revision 1.9 2002/12/08 12:48:57 eilers | 54 | * Revision 1.9 2002/12/08 12:48:57 eilers |
52 | * Moved journal-enum from ocontact into i the xml-backend.. | 55 | * Moved journal-enum from ocontact into i the xml-backend.. |
53 | * | 56 | * |
54 | * Revision 1.8 2002/11/14 17:04:24 eilers | 57 | * Revision 1.8 2002/11/14 17:04:24 eilers |
55 | * Sorting will now work if fullname is identical on some entries | 58 | * Sorting will now work if fullname is identical on some entries |
56 | * | 59 | * |
57 | * Revision 1.7 2002/11/13 15:02:46 eilers | 60 | * Revision 1.7 2002/11/13 15:02:46 eilers |
58 | * Small Bug in sorted fixed | 61 | * Small Bug in sorted fixed |
59 | * | 62 | * |
60 | * Revision 1.6 2002/11/13 14:14:51 eilers | 63 | * Revision 1.6 2002/11/13 14:14:51 eilers |
61 | * Added sorted for Contacts.. | 64 | * Added sorted for Contacts.. |
62 | * | 65 | * |
63 | * Revision 1.5 2002/11/01 15:10:42 eilers | 66 | * Revision 1.5 2002/11/01 15:10:42 eilers |
64 | * Added regExp-search in database for all fields in a contact. | 67 | * Added regExp-search in database for all fields in a contact. |
65 | * | 68 | * |
66 | * Revision 1.4 2002/10/16 10:52:40 eilers | 69 | * Revision 1.4 2002/10/16 10:52:40 eilers |
67 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) | 70 | * Added some docu to the interface and now using the cache infrastucture by zecke.. :) |
68 | * | 71 | * |
69 | * Revision 1.3 2002/10/14 16:21:54 eilers | 72 | * Revision 1.3 2002/10/14 16:21:54 eilers |
70 | * Some minor interface updates | 73 | * Some minor interface updates |
71 | * | 74 | * |
72 | * Revision 1.2 2002/10/07 17:34:24 eilers | 75 | * Revision 1.2 2002/10/07 17:34:24 eilers |
73 | * added OBackendFactory for advanced backend access | 76 | * added OBackendFactory for advanced backend access |
74 | * | 77 | * |
75 | * Revision 1.1 2002/09/27 17:11:44 eilers | 78 | * Revision 1.1 2002/09/27 17:11:44 eilers |
76 | * Added API for accessing the Contact-Database ! It is compiling, but | 79 | * Added API for accessing the Contact-Database ! It is compiling, but |
77 | * please do not expect that anything is working ! | 80 | * please do not expect that anything is working ! |
78 | * I will debug that stuff in the next time .. | 81 | * I will debug that stuff in the next time .. |
79 | * Please read README_COMPILE for compiling ! | 82 | * Please read README_COMPILE for compiling ! |
80 | * | 83 | * |
81 | * | 84 | * |
82 | */ | 85 | */ |
83 | 86 | ||
84 | #include "ocontactaccessbackend_xml.h" | 87 | #include "ocontactaccessbackend_xml.h" |
85 | 88 | ||
86 | #include <qasciidict.h> | 89 | #include <qasciidict.h> |
87 | #include <qdatetime.h> | 90 | #include <qdatetime.h> |
88 | #include <qfile.h> | 91 | #include <qfile.h> |
89 | #include <qfileinfo.h> | 92 | #include <qfileinfo.h> |
90 | #include <qregexp.h> | 93 | #include <qregexp.h> |
91 | #include <qarray.h> | 94 | #include <qarray.h> |
92 | #include <qmap.h> | 95 | #include <qmap.h> |
93 | #include <qdatetime.h> | 96 | #include <qdatetime.h> |
94 | 97 | ||
95 | #include <qpe/global.h> | 98 | #include <qpe/global.h> |
96 | 99 | ||
97 | #include <opie/xmltree.h> | 100 | #include <opie/xmltree.h> |
98 | #include "ocontactaccessbackend.h" | 101 | #include "ocontactaccessbackend.h" |
99 | #include "ocontactaccess.h" | 102 | #include "ocontactaccess.h" |
100 | 103 | ||
101 | #include <stdlib.h> | 104 | #include <stdlib.h> |
102 | #include <errno.h> | 105 | #include <errno.h> |
103 | 106 | ||
104 | using namespace Opie; | 107 | using namespace Opie; |
105 | 108 | ||
106 | 109 | ||
107 | OContactAccessBackend_XML::OContactAccessBackend_XML ( QString appname, QString filename = 0l ): | 110 | OContactAccessBackend_XML::OContactAccessBackend_XML ( QString appname, QString filename ): |
108 | m_changed( false ) | 111 | m_changed( false ) |
109 | { | 112 | { |
110 | // Just m_contactlist should call delete if an entry | 113 | // Just m_contactlist should call delete if an entry |
111 | // is removed. | 114 | // is removed. |
112 | m_contactList.setAutoDelete( true ); | 115 | m_contactList.setAutoDelete( true ); |
113 | m_uidToContact.setAutoDelete( false ); | 116 | m_uidToContact.setAutoDelete( false ); |
114 | 117 | ||
115 | m_appName = appname; | 118 | m_appName = appname; |
116 | 119 | ||
117 | /* Set journalfile name ... */ | 120 | /* Set journalfile name ... */ |
118 | m_journalName = getenv("HOME"); | 121 | m_journalName = getenv("HOME"); |
119 | m_journalName +="/.abjournal" + appname; | 122 | m_journalName +="/.abjournal" + appname; |
120 | 123 | ||
121 | /* Expecting to access the default filename if nothing else is set */ | 124 | /* Expecting to access the default filename if nothing else is set */ |
122 | if ( filename.isEmpty() ){ | 125 | if ( filename.isEmpty() ){ |
123 | m_fileName = Global::applicationFileName( "addressbook","addressbook.xml" ); | 126 | m_fileName = Global::applicationFileName( "addressbook","addressbook.xml" ); |
124 | } else | 127 | } else |
125 | m_fileName = filename; | 128 | m_fileName = filename; |
126 | 129 | ||
127 | /* Load Database now */ | 130 | /* Load Database now */ |
128 | load (); | 131 | load (); |
129 | } | 132 | } |
130 | 133 | ||
131 | bool OContactAccessBackend_XML::save() | 134 | bool OContactAccessBackend_XML::save() |
132 | { | 135 | { |
133 | 136 | ||
134 | if ( !m_changed ) | 137 | if ( !m_changed ) |
135 | return true; | 138 | return true; |
136 | 139 | ||
137 | QString strNewFile = m_fileName + ".new"; | 140 | QString strNewFile = m_fileName + ".new"; |
138 | QFile f( strNewFile ); | 141 | QFile f( strNewFile ); |
139 | if ( !f.open( IO_WriteOnly|IO_Raw ) ) | 142 | if ( !f.open( IO_WriteOnly|IO_Raw ) ) |
140 | return false; | 143 | return false; |
141 | 144 | ||
142 | int total_written; | 145 | int total_written; |
143 | int idx_offset = 0; | 146 | int idx_offset = 0; |
144 | QString out; | 147 | QString out; |
145 | 148 | ||
146 | // Write Header | 149 | // Write Header |
147 | out = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE Addressbook ><AddressBook>\n" | 150 | out = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE Addressbook ><AddressBook>\n" |
148 | " <Groups>\n" | 151 | " <Groups>\n" |
149 | " </Groups>\n" | 152 | " </Groups>\n" |
150 | " <Contacts>\n"; | 153 | " <Contacts>\n"; |
151 | QCString cstr = out.utf8(); | 154 | QCString cstr = out.utf8(); |
152 | f.writeBlock( cstr.data(), cstr.length() ); | 155 | f.writeBlock( cstr.data(), cstr.length() ); |
153 | idx_offset += cstr.length(); | 156 | idx_offset += cstr.length(); |
154 | out = ""; | 157 | out = ""; |
155 | 158 | ||