git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1172727 283d02a7-25f6-0310-bc7c-ecb5cbfe19dav3.5.13-sru
parent
009631d0fc
commit
d8b40941f9
@ -0,0 +1,121 @@
|
|||||||
|
/*
|
||||||
|
This file is part of libqopensync.
|
||||||
|
|
||||||
|
Copyright (c) 2005 Tobias Koenig <tokoe@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., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <opensync/opensync.h>
|
||||||
|
#include <opensync/opensync-group.h>
|
||||||
|
|
||||||
|
#include "group.h"
|
||||||
|
#include "result.h"
|
||||||
|
|
||||||
|
#include "groupenv.h"
|
||||||
|
|
||||||
|
using namespace QSync;
|
||||||
|
|
||||||
|
GroupEnv::GroupEnv()
|
||||||
|
{
|
||||||
|
OSyncError *error = 0;
|
||||||
|
mGroupEnv = osync_group_env_new( &error );
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupEnv::~GroupEnv()
|
||||||
|
{
|
||||||
|
osync_group_env_free( mGroupEnv );
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GroupEnv::initialize()
|
||||||
|
{
|
||||||
|
Q_ASSERT( mGroupEnv );
|
||||||
|
|
||||||
|
OSyncError *error = 0;
|
||||||
|
if ( !osync_group_env_load_groups( mGroupEnv, NULL, &error ) )
|
||||||
|
return Result( &error );
|
||||||
|
else
|
||||||
|
return Result();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GroupEnv::finalize()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int GroupEnv::groupCount() const
|
||||||
|
{
|
||||||
|
Q_ASSERT( mGroupEnv );
|
||||||
|
|
||||||
|
return osync_group_env_num_groups( mGroupEnv );
|
||||||
|
}
|
||||||
|
|
||||||
|
Group GroupEnv::groupAt( int pos ) const
|
||||||
|
{
|
||||||
|
Q_ASSERT( mGroupEnv );
|
||||||
|
|
||||||
|
Group group;
|
||||||
|
|
||||||
|
if ( pos < 0 || pos >= groupCount() )
|
||||||
|
return group;
|
||||||
|
|
||||||
|
OSyncGroup *ogroup = osync_group_env_nth_group( mGroupEnv, pos );
|
||||||
|
group.mGroup = ogroup;
|
||||||
|
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
Group GroupEnv::groupByName( const TQString &name ) const
|
||||||
|
{
|
||||||
|
Q_ASSERT( mGroupEnv );
|
||||||
|
|
||||||
|
Group group;
|
||||||
|
|
||||||
|
OSyncGroup *ogroup = osync_group_env_find_group( mGroupEnv, name.latin1() );
|
||||||
|
if ( ogroup )
|
||||||
|
group.mGroup = ogroup;
|
||||||
|
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
Group GroupEnv::addGroup( const TQString &name )
|
||||||
|
{
|
||||||
|
Q_ASSERT( mGroupEnv );
|
||||||
|
|
||||||
|
Group group;
|
||||||
|
OSyncError *error = 0;
|
||||||
|
|
||||||
|
OSyncGroup *ogroup = osync_group_new( &error );
|
||||||
|
if ( ogroup )
|
||||||
|
group.mGroup = ogroup;
|
||||||
|
|
||||||
|
group.setName( name );
|
||||||
|
|
||||||
|
if ( !osync_group_env_add_group( mGroupEnv, ogroup, &error ) ) {
|
||||||
|
Result res( &error );
|
||||||
|
qDebug( "Error on adding group: %s", res.message().latin1() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GroupEnv::removeGroup( const Group &group )
|
||||||
|
{
|
||||||
|
Q_ASSERT( mGroupEnv );
|
||||||
|
|
||||||
|
group.cleanup();
|
||||||
|
|
||||||
|
osync_group_env_remove_group( mGroupEnv, group.mGroup );
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
This file is part of libqopensync.
|
||||||
|
|
||||||
|
Copyright (c) 2005 Tobias Koenig <tokoe@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., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OSYNC_GROUPENV_H
|
||||||
|
#define OSYNC_GROUPENV_H
|
||||||
|
|
||||||
|
#include <tqstring.h>
|
||||||
|
|
||||||
|
struct OSyncGroupEnv;
|
||||||
|
|
||||||
|
namespace QSync {
|
||||||
|
|
||||||
|
class Group;
|
||||||
|
class Result;
|
||||||
|
|
||||||
|
class GroupEnv
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GroupEnv();
|
||||||
|
~GroupEnv();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initializes the environment ( e.g. loads the groups and plugins ).
|
||||||
|
Has to be called before the groups or plugins can be accessed.
|
||||||
|
*/
|
||||||
|
Result initialize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Finalizes the environment ( e.g. unloads the groups and plugins ).
|
||||||
|
Should be the last call before the object is deleted.
|
||||||
|
*/
|
||||||
|
void finalize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of groups.
|
||||||
|
*/
|
||||||
|
int groupCount() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the group at position @param pos.
|
||||||
|
*/
|
||||||
|
Group groupAt( int pos ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a group by name or an invalid group when the group with this
|
||||||
|
name doesn't exists.
|
||||||
|
*/
|
||||||
|
Group groupByName( const TQString &name ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds a new group to the environment.
|
||||||
|
|
||||||
|
@returns the new group.
|
||||||
|
*/
|
||||||
|
Group addGroup( const TQString &name );
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes a group from the environment.
|
||||||
|
*/
|
||||||
|
void removeGroup( const Group &group );
|
||||||
|
|
||||||
|
private:
|
||||||
|
OSyncGroupEnv *mGroupEnv;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
This file is part of libqopensync.
|
||||||
|
|
||||||
|
Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
|
||||||
|
Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
|
||||||
|
|
||||||
|
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., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <opensync/opensync.h>
|
||||||
|
#include <opensync/opensync-plugin.h>
|
||||||
|
|
||||||
|
#include "plugin.h"
|
||||||
|
#include "result.h"
|
||||||
|
|
||||||
|
#include "pluginenv.h"
|
||||||
|
|
||||||
|
using namespace QSync;
|
||||||
|
|
||||||
|
PluginEnv::PluginEnv()
|
||||||
|
{
|
||||||
|
OSyncError *error = 0;
|
||||||
|
mPluginEnv = osync_plugin_env_new( &error );
|
||||||
|
}
|
||||||
|
|
||||||
|
PluginEnv::~PluginEnv()
|
||||||
|
{
|
||||||
|
osync_plugin_env_free( mPluginEnv );
|
||||||
|
}
|
||||||
|
|
||||||
|
Result PluginEnv::initialize()
|
||||||
|
{
|
||||||
|
OSyncError *error = 0;
|
||||||
|
if ( !osync_plugin_env_load( mPluginEnv, NULL, &error ) )
|
||||||
|
return Result( &error );
|
||||||
|
else
|
||||||
|
return Result();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result PluginEnv::finalize()
|
||||||
|
{
|
||||||
|
osync_plugin_env_free( mPluginEnv );
|
||||||
|
return Result();
|
||||||
|
}
|
||||||
|
|
||||||
|
int PluginEnv::pluginCount() const
|
||||||
|
{
|
||||||
|
return osync_plugin_env_num_plugins( mPluginEnv );
|
||||||
|
}
|
||||||
|
|
||||||
|
Plugin PluginEnv::pluginAt( int pos ) const
|
||||||
|
{
|
||||||
|
Plugin plugin;
|
||||||
|
|
||||||
|
if ( pos < 0 || pos >= pluginCount() )
|
||||||
|
return plugin;
|
||||||
|
|
||||||
|
OSyncPlugin *oplugin = osync_plugin_env_nth_plugin( mPluginEnv, pos );
|
||||||
|
plugin.mPlugin = oplugin;
|
||||||
|
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
Plugin PluginEnv::pluginByName( const TQString &name ) const
|
||||||
|
{
|
||||||
|
Plugin plugin;
|
||||||
|
|
||||||
|
OSyncPlugin *oplugin = osync_plugin_env_find_plugin( mPluginEnv, name.latin1() );
|
||||||
|
if ( oplugin )
|
||||||
|
plugin.mPlugin = oplugin;
|
||||||
|
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Conversion PluginEnv::conversion() const
|
||||||
|
{
|
||||||
|
Conversion conversion;
|
||||||
|
conversion.mPluginEnv = mPluginEnv;
|
||||||
|
|
||||||
|
return conversion;
|
||||||
|
}
|
||||||
|
*/
|
@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
This file is part of libqopensync.
|
||||||
|
|
||||||
|
Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
|
||||||
|
Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
|
||||||
|
|
||||||
|
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., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OSYNC_PLUGINENV_H
|
||||||
|
#define OSYNC_PLUGINENV_H
|
||||||
|
|
||||||
|
#include <tqstring.h>
|
||||||
|
|
||||||
|
struct OSyncPluginEnv;
|
||||||
|
|
||||||
|
namespace QSync {
|
||||||
|
|
||||||
|
class Plugin;
|
||||||
|
class Result;
|
||||||
|
|
||||||
|
class PluginEnv
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PluginEnv();
|
||||||
|
~PluginEnv();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initializes the environment ( e.g. loads the groups and plugins ).
|
||||||
|
Has to be called before the groups or plugins can be accessed.
|
||||||
|
*/
|
||||||
|
Result initialize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Finalizes the environment ( e.g. unloads the groups and plugins ).
|
||||||
|
Should be the last call before the object is deleted.
|
||||||
|
*/
|
||||||
|
Result finalize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the number of plugins.
|
||||||
|
*/
|
||||||
|
int pluginCount() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the plugin at position @param pos.
|
||||||
|
*/
|
||||||
|
Plugin pluginAt( int pos ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a plugin by name or an invalid plugin when the plugin with this
|
||||||
|
name doesn't exists.
|
||||||
|
*/
|
||||||
|
Plugin pluginByName( const TQString &name ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the conversion object of this environment.
|
||||||
|
*/
|
||||||
|
// Conversion conversion() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
OSyncPluginEnv *mPluginEnv;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,166 @@
|
|||||||
|
/*
|
||||||
|
This file is part of KitchenSync.
|
||||||
|
|
||||||
|
Copyright (c) 2006 Daniel Gollub <dgollub@suse.de>
|
||||||
|
|
||||||
|
This program 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., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "xmldiffalgo.h"
|
||||||
|
|
||||||
|
#include <kdebug.h>
|
||||||
|
|
||||||
|
using namespace KSync;
|
||||||
|
|
||||||
|
#ifndef KDE_USE_FINAL
|
||||||
|
// With --enable-final, we get the (identical) compareString from
|
||||||
|
// addresseediffalgo.cpp
|
||||||
|
//
|
||||||
|
static bool compareString( const TQString &left, const TQString &right )
|
||||||
|
{
|
||||||
|
if ( left.isEmpty() && right.isEmpty() )
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return left == right;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
XmlDiffAlgo::XmlDiffAlgo( const TQString &leftXml, const TQString &rightXml )
|
||||||
|
{
|
||||||
|
kdDebug() << __func__ << " " << __LINE__ << endl;
|
||||||
|
|
||||||
|
mLeftXml.setContent( leftXml );
|
||||||
|
mRightXml.setContent( rightXml );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlDiffAlgo::XmlDiffAlgo( const TQDomDocument &leftXml, const TQDomDocument &rightXml )
|
||||||
|
: mLeftXml( leftXml ), mRightXml( rightXml )
|
||||||
|
{
|
||||||
|
kdDebug() << __func__ << " " << __LINE__ << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void XmlDiffAlgo::appendSingleNodes(TQDomElement &element, bool isLeft)
|
||||||
|
{
|
||||||
|
TQDomNode node;
|
||||||
|
|
||||||
|
for ( node = element.firstChild(); !node.isNull(); node = node.nextSibling() ) {
|
||||||
|
TQDomElement child = node.toElement();
|
||||||
|
|
||||||
|
if (isLeft)
|
||||||
|
additionalLeftField( node.nodeName(), child.text() );
|
||||||
|
else
|
||||||
|
additionalRightField( node.nodeName(), child.text() );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void XmlDiffAlgo::appendConflictNodes(TQDomElement &leftElement, TQDomElement &rightElement)
|
||||||
|
{
|
||||||
|
TQDomNode left, right;
|
||||||
|
TQDomElement leftChild, rightChild;
|
||||||
|
|
||||||
|
for ( left = leftElement.firstChild(); !left.isNull(); left = left.nextSibling() ) {
|
||||||
|
leftChild = left.toElement();
|
||||||
|
|
||||||
|
for ( right = rightElement.firstChild(); !right.isNull(); right = right.nextSibling() ) {
|
||||||
|
rightChild = right.toElement();
|
||||||
|
|
||||||
|
if ( leftChild.tagName() != rightChild.tagName() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (leftChild.text().isEmpty() || rightChild.text().isEmpty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
TQString id = leftChild.tagName();
|
||||||
|
if (id == "Content")
|
||||||
|
id = left.parentNode().nodeName();
|
||||||
|
|
||||||
|
conflictField( id, leftChild.text(), rightChild.text() );
|
||||||
|
|
||||||
|
left.parentNode().removeChild( left );
|
||||||
|
left = leftElement.firstChild();
|
||||||
|
|
||||||
|
right.parentNode().removeChild( right );
|
||||||
|
right = rightElement.firstChild();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XmlDiffAlgo::compareNode(TQDomElement &leftElement, TQDomElement &rightElement)
|
||||||
|
{
|
||||||
|
TQDomNode left, right;
|
||||||
|
TQDomElement leftChild, rightChild;
|
||||||
|
TQDomNodeList nlist;
|
||||||
|
top:;
|
||||||
|
|
||||||
|
for ( left = leftElement.firstChild(); !left.isNull(); left = left.nextSibling() ) {
|
||||||
|
leftChild = left.toElement();
|
||||||
|
|
||||||
|
for ( right = rightElement.firstChild(); !right.isNull(); right = right.nextSibling() ) {
|
||||||
|
rightChild = right.toElement();
|
||||||
|
|
||||||
|
if (leftChild.tagName() != rightChild.tagName())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( left.childNodes().count() > 1 && right.childNodes().count() > 1 ) {
|
||||||
|
compareNode( leftChild, rightChild );
|
||||||
|
|
||||||
|
if ( !left.hasChildNodes() && !right.hasChildNodes() ) {
|
||||||
|
left.parentNode().removeChild( left );
|
||||||
|
right.parentNode().removeChild( right );
|
||||||
|
goto top;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( leftChild.text() == rightChild.text() ) {
|
||||||
|
TQString id = leftChild.tagName();
|
||||||
|
|
||||||
|
if ( id == "Content" )
|
||||||
|
id = left.parentNode().nodeName();
|
||||||
|
|
||||||
|
if ( id != "Type" )
|
||||||
|
//matchingField( id, leftChild.text(), rightChild.text() );
|
||||||
|
|
||||||
|
left.parentNode().removeChild( left );
|
||||||
|
right.parentNode().removeChild( right );
|
||||||
|
goto top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
appendConflictNodes(rightElement, leftElement);
|
||||||
|
|
||||||
|
appendSingleNodes(rightElement, false);
|
||||||
|
appendSingleNodes(leftElement, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XmlDiffAlgo::run()
|
||||||
|
{
|
||||||
|
kdDebug() << __func__ << endl;
|
||||||
|
begin();
|
||||||
|
|
||||||
|
TQDomElement leftElement = mLeftXml.documentElement();
|
||||||
|
TQDomElement rightElement = mRightXml.documentElement();
|
||||||
|
|
||||||
|
compareNode( leftElement, rightElement );
|
||||||
|
|
||||||
|
end();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
This file is part of KitchenSync
|
||||||
|
|
||||||
|
Copyright (c) 2006 Daniel Gollub <dgollub@suse.de>
|
||||||
|
|
||||||
|
This program 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., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef KSYNC_XMLDIFFALGO_H
|
||||||
|
#define KSYNC_XMLDIFFALGO_H
|
||||||
|
|
||||||
|
#include <tqdom.h>
|
||||||
|
|
||||||
|
#include <libkdepim/diffalgo.h>
|
||||||
|
|
||||||
|
using namespace KPIM;
|
||||||
|
|
||||||
|
namespace KSync {
|
||||||
|
|
||||||
|
class XmlDiffAlgo : public DiffAlgo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XmlDiffAlgo( const TQString &leftXml, const TQString &rightXml );
|
||||||
|
XmlDiffAlgo( const TQDomDocument &leftXml, const TQDomDocument &rightXml );
|
||||||
|
|
||||||
|
void run();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void appendConflictNodes(TQDomElement &leftElement, TQDomElement &rightElement);
|
||||||
|
void appendSingleNodes(TQDomElement &element, bool isLeft);
|
||||||
|
|
||||||
|
|
||||||
|
void compareNode(TQDomElement &leftElement, TQDomElement &rightElement);
|
||||||
|
|
||||||
|
TQDomDocument mLeftXml;
|
||||||
|
TQDomDocument mRightXml;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in new issue