summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/otodoaccessxml.cpp
Unidiff
Diffstat (limited to 'libopie2/opiepim/backend/otodoaccessxml.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp45
1 files changed, 39 insertions, 6 deletions
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index 4a5cb33..2d50ecd 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.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 <sys/mman.h> 32#include <sys/mman.h>
5#include <sys/stat.h> 33#include <sys/stat.h>
6#include <sys/types.h> 34#include <sys/types.h>
7 35
8#include <unistd.h> 36#include <unistd.h>
9 37
10 38
11#include <qfile.h> 39#include <qfile.h>
12#include <qvector.h> 40#include <qvector.h>
13 41
14#include <qpe/global.h> 42#include <qpe/global.h>
15#include <qpe/stringutil.h> 43#include <qpe/stringutil.h>
16#include <qpe/timeconversion.h> 44#include <qpe/timeconversion.h>
17 45
18#include "oconversion.h" 46#include <opie2/oconversion.h>
19#include "opimstate.h" 47#include <opie2/opimstate.h>
20#include "otimezone.h" 48#include <opie2/otimezone.h>
21#include "opimnotifymanager.h" 49#include <opie2/opimnotifymanager.h>
22#include "orecur.h" 50#include <opie2/orecur.h>
23#include "otodoaccessxml.h" 51#include <opie2/otodoaccessxml.h>
52
53using namespace Opie;
24 54
25namespace { 55namespace {
26 time_t rp_end; 56 time_t rp_end;
27 ORecur* rec; 57 ORecur* rec;
28 ORecur *recur() { 58 ORecur *recur() {
29 if (!rec ) rec = new ORecur; 59 if (!rec ) rec = new ORecur;
30 return rec; 60 return rec;
31 } 61 }
32 int snd; 62 int snd;
33 enum MoreAttributes { 63 enum MoreAttributes {
34 FRType = OTodo::CompletedDate + 2, 64 FRType = OTodo::CompletedDate + 2,
35 FRWeekdays, 65 FRWeekdays,
@@ -57,24 +87,25 @@ char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen)
57 if ((haystackChar = *hsearch++) == 0) 87 if ((haystackChar = *hsearch++) == 0)
58 return (0); 88 return (0);
59 if (hsearch >= haystack + hLen) 89 if (hsearch >= haystack + hLen)
60 return (0); 90 return (0);
61 } while (haystackChar != needleChar); 91 } while (haystackChar != needleChar);
62 } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0); 92 } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0);
63 hsearch--; 93 hsearch--;
64 } 94 }
65 return ((char *)hsearch); 95 return ((char *)hsearch);
66} 96}
67} 97}
68 98
99namespace Opie {
69 100
70OTodoAccessXML::OTodoAccessXML( const QString& appName, 101OTodoAccessXML::OTodoAccessXML( const QString& appName,
71 const QString& fileName ) 102 const QString& fileName )
72 : OTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false ) 103 : OTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false )
73{ 104{
74 if (!fileName.isEmpty() ) 105 if (!fileName.isEmpty() )
75 m_file = fileName; 106 m_file = fileName;
76 else 107 else
77 m_file = Global::applicationFileName( "todolist", "todolist.xml" ); 108 m_file = Global::applicationFileName( "todolist", "todolist.xml" );
78} 109}
79OTodoAccessXML::~OTodoAccessXML() { 110OTodoAccessXML::~OTodoAccessXML() {
80 111
@@ -865,12 +896,14 @@ QArray<int> OTodoAccessXML::matchRegexp( const QRegExp &r ) const
865 896
866 QMap<int, OTodo>::ConstIterator it; 897 QMap<int, OTodo>::ConstIterator it;
867 for (it = m_events.begin(); it != m_events.end(); ++it ) { 898 for (it = m_events.begin(); it != m_events.end(); ++it ) {
868 if ( it.data().match( r ) ) 899 if ( it.data().match( r ) )
869 m_currentQuery[arraycounter++] = it.data().uid(); 900 m_currentQuery[arraycounter++] = it.data().uid();
870 901
871 } 902 }
872 // Shrink to fit.. 903 // Shrink to fit..
873 m_currentQuery.resize(arraycounter); 904 m_currentQuery.resize(arraycounter);
874 905
875 return m_currentQuery; 906 return m_currentQuery;
876} 907}
908
909}