summaryrefslogtreecommitdiff
path: root/libopie2
Side-by-side diff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/opiecore.pro6
-rw-r--r--libopie2/opiecore/xmltree.cpp (renamed from libopie2/opiepim/core/backends/private/xmltree.cc)2
-rw-r--r--libopie2/opiecore/xmltree.h (renamed from libopie2/opiepim/core/backends/private/xmltree.h)4
-rw-r--r--libopie2/opiepim/backend/backends.pro6
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp5
5 files changed, 10 insertions, 13 deletions
diff --git a/libopie2/opiecore/opiecore.pro b/libopie2/opiecore/opiecore.pro
index ff3c036..67ef072 100644
--- a/libopie2/opiecore/opiecore.pro
+++ b/libopie2/opiecore/opiecore.pro
@@ -1,39 +1,41 @@
TEMPLATE = lib
CONFIG += qt warn_on debug
DESTDIR = $(OPIEDIR)/lib
HEADERS = oapplication.h \
oconfig.h \
odebug.h \
oglobal.h \
oglobalsettings.h \
oprocess.h \
oprocctrl.h \
osmartpointer.h \
- ostorageinfo.h
+ ostorageinfo.h \
+ xmltree.h
SOURCES = oapplication.cpp \
oconfig.cpp \
odebug.cpp \
oglobal.cpp \
oglobalsettings.cpp \
oprocess.cpp \
oprocctrl.cpp \
- ostorageinfo.cpp
+ ostorageinfo.cpp \
+ xmltree.cpp
include ( device/device.pro )
INTERFACES =
TARGET = opiecore2
VERSION = 1.9.0
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
!contains( platform, x11 ) {
LIBS = -lqpe
include ( $(OPIEDIR)/include.pro )
}
contains( platform, x11 ) {
LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
}
diff --git a/libopie2/opiepim/core/backends/private/xmltree.cc b/libopie2/opiecore/xmltree.cpp
index 40749ca..72fe9fd 100644
--- a/libopie2/opiepim/core/backends/private/xmltree.cc
+++ b/libopie2/opiecore/xmltree.cpp
@@ -1,76 +1,76 @@
/* This file is part of the KDE project
Copyright (C) 2001 Simon Hausmann <hausmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "xmltree.h"
#include <qpe/stringutil.h>
#include <qxml.h>
#include <assert.h>
-using namespace Opie::Pim::Private;
+using namespace Opie::Core;
XMLElement::XMLElement()
: m_parent( 0 ), m_next( 0 ), m_prev( 0 ), m_first( 0 ), m_last( 0 )
{
}
XMLElement::~XMLElement()
{
XMLElement *n = m_first;
while ( n )
{
XMLElement *tmp = n;
n = n->m_next;
delete tmp;
}
}
void XMLElement::appendChild( XMLElement *child )
{
if ( child->m_parent )
child->m_parent->removeChild( child );
child->m_parent = this;
if ( m_last )
m_last->m_next = child;
child->m_prev = m_last;
if ( !m_first )
m_first = child;
m_last = child;
}
void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild )
{
assert( newChild != refChild );
if ( refChild == m_last )
{
appendChild( newChild );
return;
}
assert( refChild );
assert( refChild->m_parent );
diff --git a/libopie2/opiepim/core/backends/private/xmltree.h b/libopie2/opiecore/xmltree.h
index 9817a02..5fd79e7 100644
--- a/libopie2/opiepim/core/backends/private/xmltree.h
+++ b/libopie2/opiecore/xmltree.h
@@ -1,122 +1,120 @@
/* This file is part of the KDE project
Copyright (C) 2000,2001 Simon Hausmann <hausmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __bookmarks_h__
#define __bookmarks_h__
#include <qstring.h>
#include <qmap.h>
#include <qtextstream.h>
namespace Opie {
-namespace Pim {
-namespace Private{
+namespace Core {
/**
* A small xml lib written by Simon Hausmann.
*/
class XMLElement
{
public:
typedef QMap<QString, QString> AttributeMap;
/**
* The constructor of XMLElement
*/
XMLElement();
~XMLElement();
/** appendChild appends a child to the XMLElement behind the last element.
* The ownership of the child get's transfered to the
* this XMLElement.
* If child is already the child of another parent
* it's get removed from the other parent first.
*/
void appendChild( XMLElement *child );
/** inserts newChild after refChild. If newChild is the child
* of another parent the child will get removed.
* The ownership of child gets transfered.
*
*/
void insertAfter( XMLElement *newChild, XMLElement *refChild );
/** same as insertAfter but the element get's inserted before refChild.
*
*/
void insertBefore( XMLElement *newChild, XMLElement *refChild );
/** removeChild removes the child from the XMLElement.
* The ownership gets dropped. You need to delete the
* child yourself.
*/
void removeChild( XMLElement *child );
/** parent() returns the parent of this XMLElement
* If there is no parent 0l gets returned
*/
XMLElement *parent() const { return m_parent; }
XMLElement *firstChild() const { return m_first; }
XMLElement *nextChild() const { return m_next; }
XMLElement *prevChild() const { return m_prev; }
XMLElement *lastChild() const { return m_last; }
void setTagName( const QString &tag ) { m_tag = tag; }
QString tagName() const { return m_tag; }
void setValue( const QString &val ) { m_value = val; }
QString value() const { return m_value; }
void setAttributes( const AttributeMap &attrs ) { m_attributes = attrs; }
AttributeMap attributes() const { return m_attributes; }
AttributeMap &attributes() { return m_attributes; }
QString attribute( const QString & ) const;
void setAttribute( const QString &attr, const QString &value );
void save( QTextStream &stream, uint indent = 0 );
XMLElement *namedItem( const QString &name );
XMLElement *clone() const;
static XMLElement *load( const QString &fileName );
private:
QString m_tag;
QString m_value;
AttributeMap m_attributes;
XMLElement *m_parent;
XMLElement *m_next;
XMLElement *m_prev;
XMLElement *m_first;
XMLElement *m_last;
XMLElement( const XMLElement &rhs );
XMLElement &operator=( const XMLElement &rhs );
class Private;
Private* d;
};
}
-}
} // namespace Opie
#endif
diff --git a/libopie2/opiepim/backend/backends.pro b/libopie2/opiepim/backend/backends.pro
index d4867ba..953d928 100644
--- a/libopie2/opiepim/backend/backends.pro
+++ b/libopie2/opiepim/backend/backends.pro
@@ -1,33 +1,31 @@
SOURCES += core/backends/ocontactaccessbackend_sql.cpp \
core/backends/ocontactaccessbackend_vcard.cpp \
core/backends/ocontactaccessbackend_xml.cpp \
core/backends/ocontactaccess.cpp \
core/backends/odatebookaccessbackend.cpp \
core/backends/odatebookaccessbackend_xml.cpp \
core/backends/otodoaccessbackend.cpp \
core/backends/otodoaccess.cpp \
core/backends/otodoaccesssql.cpp \
core/backends/otodoaccessvcal.cpp \
core/backends/otodoaccessxml.cpp \
core/backends/odatebookaccess.cpp \
- core/backends/odatebookaccessbackend_sql.cpp \
- core/backends/private/xmltree.cc
+ core/backends/odatebookaccessbackend_sql.cpp
HEADERS += core/backends/obackendfactory.h \
core/backends/ocontactaccessbackend.h \
core/backends/ocontactaccessbackend_sql.h \
core/backends/ocontactaccessbackend_vcard.h \
core/backends/ocontactaccessbackend_xml.h \
core/backends/ocontactaccess.h \
core/backends/odatebookaccessbackend.h \
core/backends/odatebookaccessbackend_sql.h \
core/backends/odatebookaccessbackend_xml.h \
core/backends/opimaccessbackend.h \
core/backends/opimaccesstemplate.h \
core/backends/otodoaccessbackend.h \
core/backends/otodoaccess.h \
core/backends/otodoaccesssql.h \
core/backends/otodoaccessvcal.h \
core/backends/otodoaccessxml.h \
- core/backends/odatebookaccess.h \
- core/backends/private/xmltree.h
+ core/backends/odatebookaccess.h
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
index f5e76d5..2b467c3 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
@@ -1,100 +1,99 @@
/*
This file is part of the Opie Project
Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
=. Copyright (C) The Opie Team <opie-devel@handhelds.org>
.=l.
.>+-=
_;:, .> :=|. This program is free software; you can
.> <`_, > . <= redistribute it and/or modify it under
:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
.="- .-=="i, .._ License as published by the Free Software
- . .-<_> .<> Foundation; either version 2 of the License,
._= =} : or (at your option) any later version.
.%`+i> _;_.
.i_,=:_. -<s. This program is distributed in the hope that
+ . -:. = it will be useful, but WITHOUT ANY WARRANTY;
: .. .:, . . . without even the implied warranty of
=_ + =;=|` MERCHANTABILITY or FITNESS FOR A
_.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.= = ; Library General Public License for more
++= -. .` .: details.
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = Library General Public License along with
-- :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
* XML Backend for the OPIE-Contact Database.
*/
#include <opie2/ocontactaccessbackend_xml.h>
#include <qasciidict.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qregexp.h>
#include <qarray.h>
#include <qmap.h>
#include <qpe/global.h>
-#include "private/xmltree.h"
+#include <opie2/xmltree.h>
#include <opie2/ocontactaccessbackend.h>
#include <opie2/ocontactaccess.h>
#include <stdlib.h>
#include <errno.h>
-using namespace Opie;
-using namespace Opie::Pim::Private;
+using namespace Opie::Core;
namespace Opie {
OPimContactAccessBackend_XML::OPimContactAccessBackend_XML ( const QString& appname, const QString& filename ):
m_changed( false )
{
// Just m_contactlist should call delete if an entry
// is removed.
m_contactList.setAutoDelete( true );
m_uidToContact.setAutoDelete( false );
m_appName = appname;
/* Set journalfile name ... */
m_journalName = getenv("HOME");
m_journalName +="/.abjournal" + appname;
/* Expecting to access the default filename if nothing else is set */
if ( filename.isEmpty() ){
m_fileName = Global::applicationFileName( "addressbook","addressbook.xml" );
} else
m_fileName = filename;
/* Load Database now */
load ();
}
bool OPimContactAccessBackend_XML::save()
{
if ( !m_changed )
return true;
QString strNewFile = m_fileName + ".new";
QFile f( strNewFile );
if ( !f.open( IO_WriteOnly|IO_Raw ) )
return false;
int total_written;
int idx_offset = 0;
QString out;
// Write Header
out = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE Addressbook ><AddressBook>\n"
" <Groups>\n"
" </Groups>\n"
" <Contacts>\n";
QCString cstr = out.utf8();