author | alwin <alwin> | 2004-02-20 02:06:52 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-02-20 02:06:52 (UTC) |
commit | 55f4d502486e01927356908223622e435c975f7e (patch) (unidiff) | |
tree | 824b5c1e8992564677c4f39473bc108a32a2cf2a /libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp | |
parent | 060b4fc7a3fd5c1b5f745167fe084f7486719b7e (diff) | |
download | opie-55f4d502486e01927356908223622e435c975f7e.zip opie-55f4d502486e01927356908223622e435c975f7e.tar.gz opie-55f4d502486e01927356908223622e435c975f7e.tar.bz2 |
moved the opie pim stuff to libopie2 - pim. Tried to resort them, may be someone should take a look for a better file order. but now all applications can start using libopiepim2 instead of libopie1-pim-stuff.
Diffstat (limited to 'libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp index 929d004..0ebda98 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp +++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp | |||
@@ -1,35 +1,65 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) | ||
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
1 | #include <errno.h> | 29 | #include <errno.h> |
2 | #include <fcntl.h> | 30 | #include <fcntl.h> |
3 | 31 | ||
4 | #include <stdio.h> | 32 | #include <stdio.h> |
5 | #include <stdlib.h> | 33 | #include <stdlib.h> |
6 | 34 | ||
7 | #include <sys/types.h> | 35 | #include <sys/types.h> |
8 | #include <sys/mman.h> | 36 | #include <sys/mman.h> |
9 | #include <sys/stat.h> | 37 | #include <sys/stat.h> |
10 | 38 | ||
11 | #include <unistd.h> | 39 | #include <unistd.h> |
12 | 40 | ||
13 | #include <qasciidict.h> | 41 | #include <qasciidict.h> |
14 | #include <qfile.h> | 42 | #include <qfile.h> |
15 | 43 | ||
16 | #include <qtopia/global.h> | 44 | #include <qtopia/global.h> |
17 | #include <qtopia/stringutil.h> | 45 | #include <qtopia/stringutil.h> |
18 | #include <qtopia/timeconversion.h> | 46 | #include <qtopia/timeconversion.h> |
19 | 47 | ||
20 | #include "opimnotifymanager.h" | 48 | #include <opie2/opimnotifymanager.h> |
21 | #include "orecur.h" | 49 | #include <opie2/orecur.h> |
22 | #include "otimezone.h" | 50 | #include <opie2/otimezone.h> |
23 | #include "odatebookaccessbackend_xml.h" | 51 | #include <opie2/odatebookaccessbackend_xml.h> |
52 | |||
53 | using namespace Opie; | ||
24 | 54 | ||
25 | namespace { | 55 | namespace { |
26 | // FROM TT again | 56 | // FROM TT again |
27 | char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) | 57 | char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) |
28 | { | 58 | { |
29 | char needleChar; | 59 | char needleChar; |
30 | char haystackChar; | 60 | char haystackChar; |
31 | if (!needle || !haystack || !hLen || !nLen) | 61 | if (!needle || !haystack || !hLen || !nLen) |
32 | return 0; | 62 | return 0; |
33 | 63 | ||
34 | const char* hsearch = haystack; | 64 | const char* hsearch = haystack; |
35 | 65 | ||
@@ -157,24 +187,25 @@ namespace { | |||
157 | save( it.data(), buf ); | 187 | save( it.data(), buf ); |
158 | buf += " />\n"; | 188 | buf += " />\n"; |
159 | str = buf.utf8(); | 189 | str = buf.utf8(); |
160 | 190 | ||
161 | total_written = file.writeBlock(str.data(), str.length() ); | 191 | total_written = file.writeBlock(str.data(), str.length() ); |
162 | if ( total_written != int(str.length() ) ) | 192 | if ( total_written != int(str.length() ) ) |
163 | return false; | 193 | return false; |
164 | } | 194 | } |
165 | return true; | 195 | return true; |
166 | } | 196 | } |
167 | } | 197 | } |
168 | 198 | ||
199 | namespace Opie { | ||
169 | ODateBookAccessBackend_XML::ODateBookAccessBackend_XML( const QString& , | 200 | ODateBookAccessBackend_XML::ODateBookAccessBackend_XML( const QString& , |
170 | const QString& fileName ) | 201 | const QString& fileName ) |
171 | : ODateBookAccessBackend() { | 202 | : ODateBookAccessBackend() { |
172 | m_name = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.xml" ) : fileName; | 203 | m_name = fileName.isEmpty() ? Global::applicationFileName( "datebook", "datebook.xml" ) : fileName; |
173 | m_changed = false; | 204 | m_changed = false; |
174 | } | 205 | } |
175 | ODateBookAccessBackend_XML::~ODateBookAccessBackend_XML() { | 206 | ODateBookAccessBackend_XML::~ODateBookAccessBackend_XML() { |
176 | } | 207 | } |
177 | bool ODateBookAccessBackend_XML::load() { | 208 | bool ODateBookAccessBackend_XML::load() { |
178 | return loadFile(); | 209 | return loadFile(); |
179 | } | 210 | } |
180 | bool ODateBookAccessBackend_XML::reload() { | 211 | bool ODateBookAccessBackend_XML::reload() { |
@@ -601,12 +632,14 @@ QArray<int> ODateBookAccessBackend_XML::matchRegexp( const QRegExp &r ) const | |||
601 | for ( it = m_raw.begin(); it != m_raw.end(); ++it ) | 632 | for ( it = m_raw.begin(); it != m_raw.end(); ++it ) |
602 | if ( it.data().match( r ) ) | 633 | if ( it.data().match( r ) ) |
603 | m_currentQuery[arraycounter++] = it.data().uid(); | 634 | m_currentQuery[arraycounter++] = it.data().uid(); |
604 | for ( it = m_rep.begin(); it != m_rep.end(); ++it ) | 635 | for ( it = m_rep.begin(); it != m_rep.end(); ++it ) |
605 | if ( it.data().match( r ) ) | 636 | if ( it.data().match( r ) ) |
606 | m_currentQuery[arraycounter++] = it.data().uid(); | 637 | m_currentQuery[arraycounter++] = it.data().uid(); |
607 | 638 | ||
608 | // Shrink to fit.. | 639 | // Shrink to fit.. |
609 | m_currentQuery.resize(arraycounter); | 640 | m_currentQuery.resize(arraycounter); |
610 | 641 | ||
611 | return m_currentQuery; | 642 | return m_currentQuery; |
612 | } | 643 | } |
644 | |||
645 | } | ||