Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 202974 | Differences between
and this patch

Collapse All | Expand All

(-)kitchensync.orig/configure.in.bot (-2 / +2 lines)
Lines 1-8 Link Here
1
if test "$HAVE_OPENSYNC" = 0 -o "$HAVE_OPENSYNC_ENGINE" = 0; then
1
if test "$HAVE_OPENSYNC" = 0; then
2
	echo ""
2
	echo ""
3
	echo "You're missing a compatible version of libopensync."
3
	echo "You're missing a compatible version of libopensync."
4
        echo "Version 0.19 or greater is needed."
4
        echo "Version 0.31 or greater is needed."
5
	echo "kitchensync will not be built."
5
	echo "kitchensync will not be built."
6
	echo ""
6
	echo ""
7
	all_tests=bad
7
	all_tests=bad
8
fi
8
fi
(-)kitchensync.orig/configure.in.in (-5 / +3 lines)
Lines 27-39 Link Here
27
fi
27
fi
28
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:$prefix/lib/pkgconfig:/usr/local/lib/pkgconfig
28
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:$prefix/lib/pkgconfig:/usr/local/lib/pkgconfig
29
29
30
30
31
HAVE_OPENSYNC=0
31
HAVE_OPENSYNC=0
32
HAVE_OPENSYNC_ENGINE=0
32
PKG_CHECK_MODULES(OPENSYNC, opensync-1.0 >= 0.33, HAVE_OPENSYNC=1,HAVE_OPENSYNC=0)
33
PKG_CHECK_MODULES(OPENSYNC, opensync-1.0 >= 0.19, HAVE_OPENSYNC=1,HAVE_OPENSYNC=0)
34
PKG_CHECK_MODULES(OPENSYNCENGINE, osengine-1.0 >= 0.19, HAVE_OPENSYNC_ENGINE=1, HAVE_OPENSYNC_ENGINE=0)
35
PKG_CHECK_MODULES(LIBXML,   libxml-2.0, , HAVE_OPENSYNC=0)
33
PKG_CHECK_MODULES(LIBXML,   libxml-2.0, , HAVE_OPENSYNC=0)
36
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6, , HAVE_OPENSYNC=0)
34
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6, , HAVE_OPENSYNC=0)
37
35
38
if test -z "PKG_CONFIG"; then
36
if test -z "PKG_CONFIG"; then
39
    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
37
    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
Lines 50-62 Link Here
50
AC_SUBST(OPENSYNC_PLUGINDIR)
48
AC_SUBST(OPENSYNC_PLUGINDIR)
51
AC_SUBST(OPENSYNC_FORMATSDIR)
49
AC_SUBST(OPENSYNC_FORMATSDIR)
52
AC_SUBST(OPENSYNC_HEADERDIR)
50
AC_SUBST(OPENSYNC_HEADERDIR)
53
51
54
dnl Check if we can compile KitchenSync
52
dnl Check if we can compile KitchenSync
55
AM_CONDITIONAL(compile_kitchensync, test "$HAVE_OPENSYNC" = 1 -a "$HAVE_OPENSYNC_ENGINE" = 1)
53
AM_CONDITIONAL(compile_kitchensync, test "$HAVE_OPENSYNC" = 1)
56
54
57
if test "$HAVE_OPENSYNC" = 1 -a "$HAVE_OPENSYNC_ENGINE" = 1 ; then
55
if test "$HAVE_OPENSYNC" = 1; then
58
    AC_MSG_RESULT([found])
56
    AC_MSG_RESULT([found])
59
else
57
else
60
    AC_MSG_RESULT([not found])
58
    AC_MSG_RESULT([not found])
61
    DO_NOT_COMPILE="$DO_NOT_COMPILE kitchensync"
59
    DO_NOT_COMPILE="$DO_NOT_COMPILE kitchensync"
62
fi
60
fi
(-)kitchensync.orig/libqopensync/callbackhandler.cpp (-11 / +12 lines)
Lines 17-32 Link Here
17
    along with this library; see the file COPYING.LIB.  If not, write to
17
    along with this library; see the file COPYING.LIB.  If not, write to
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
19
    Boston, MA 02110-1301, USA.
20
*/
20
*/
21
21
22
#include <osengine/engine.h>
22
#include <opensync/opensync.h>
23
23
#include <opensync/opensync-engine.h>
24
#include <libqopensync/engine.h>
25
24
26
#include <qapplication.h>
25
#include <qapplication.h>
27
26
27
#include "engine.h"
28
28
#include "callbackhandler.h"
29
#include "callbackhandler.h"
29
30
30
using namespace QSync;
31
using namespace QSync;
31
32
32
class CallbackHandler::ConflictEvent : public QCustomEvent
33
class CallbackHandler::ConflictEvent : public QCustomEvent
Lines 109-123 Link Here
109
110
110
void CallbackHandler::setEngine( Engine *engine )
111
void CallbackHandler::setEngine( Engine *engine )
111
{
112
{
112
  mEngine = engine;
113
  mEngine = engine;
113
114
114
  osengine_set_conflict_callback( engine->mEngine, &conflict_callback, this );
115
  osync_engine_set_conflict_callback( engine->mEngine, &conflict_callback, this );
115
  osengine_set_changestatus_callback( engine->mEngine, &change_callback, this );
116
  osync_engine_set_changestatus_callback( engine->mEngine, &change_callback, this );
116
  osengine_set_mappingstatus_callback( engine->mEngine, &mapping_callback, this );
117
  osync_engine_set_mappingstatus_callback( engine->mEngine, &mapping_callback, this );
117
  osengine_set_enginestatus_callback( engine->mEngine, &engine_callback, this );
118
  osync_engine_set_enginestatus_callback( engine->mEngine, &engine_callback, this );
118
  osengine_set_memberstatus_callback( engine->mEngine, &member_callback, this );
119
  osync_engine_set_memberstatus_callback( engine->mEngine, &member_callback, this );
119
}
120
}
120
121
121
Engine* CallbackHandler::engine() const
122
Engine* CallbackHandler::engine() const
122
{
123
{
123
  return mEngine;
124
  return mEngine;
Lines 141-160 Link Here
141
    MemberEvent *memberEvent = static_cast<MemberEvent*>( event );
142
    MemberEvent *memberEvent = static_cast<MemberEvent*>( event );
142
    emit member( memberEvent->member() );
143
    emit member( memberEvent->member() );
143
  }
144
  }
144
}
145
}
145
146
146
void CallbackHandler::conflict_callback( OSyncEngine *engine, OSyncMapping *omapping, void *data )
147
void CallbackHandler::conflict_callback( OSyncEngine *engine, OSyncMappingEngine *omapping, void *data )
147
{
148
{
148
  SyncMapping mapping( omapping, engine );
149
  SyncMapping mapping( omapping, engine );
149
150
150
  CallbackHandler *handler = static_cast<CallbackHandler*>( data );
151
  CallbackHandler *handler = static_cast<CallbackHandler*>( data );
151
152
152
  QApplication::postEvent( handler, new ConflictEvent( mapping ) );
153
  QApplication::postEvent( handler, new ConflictEvent( mapping ) );
153
}
154
}
154
155
155
void CallbackHandler::change_callback( OSyncEngine*, OSyncChangeUpdate *update, void *data )
156
void CallbackHandler::change_callback( OSyncChangeUpdate *update, void *data )
156
{
157
{
157
  SyncChangeUpdate change( update );
158
  SyncChangeUpdate change( update );
158
159
159
  CallbackHandler *handler = static_cast<CallbackHandler*>( data );
160
  CallbackHandler *handler = static_cast<CallbackHandler*>( data );
160
161
Lines 168-178 Link Here
168
  SyncMappingUpdate mapping( update, handler->engine()->mEngine );
169
  SyncMappingUpdate mapping( update, handler->engine()->mEngine );
169
170
170
  QApplication::postEvent( handler, new MappingEvent( mapping ) );
171
  QApplication::postEvent( handler, new MappingEvent( mapping ) );
171
}
172
}
172
173
173
void CallbackHandler::engine_callback( OSyncEngine*, OSyncEngineUpdate *update, void *data )
174
void CallbackHandler::engine_callback( OSyncEngineUpdate *update, void *data )
174
{
175
{
175
  SyncEngineUpdate engine( update );
176
  SyncEngineUpdate engine( update );
176
177
177
  CallbackHandler *handler = static_cast<CallbackHandler*>( data );
178
  CallbackHandler *handler = static_cast<CallbackHandler*>( data );
178
179
(-)kitchensync.orig/libqopensync/callbackhandler.h (-3 / +3 lines)
Lines 74-87 Link Here
74
    class ChangeEvent;
74
    class ChangeEvent;
75
    class MappingEvent;
75
    class MappingEvent;
76
    class EngineEvent;
76
    class EngineEvent;
77
    class MemberEvent;
77
    class MemberEvent;
78
78
79
    static void conflict_callback( OSyncEngine*, OSyncMapping*, void* );
79
    static void conflict_callback( OSyncEngine*, OSyncMappingEngine*, void* );
80
    static void change_callback( OSyncEngine*, OSyncChangeUpdate*, void* );
80
    static void change_callback( OSyncChangeUpdate*, void* );
81
    static void mapping_callback( OSyncMappingUpdate*, void* );
81
    static void mapping_callback( OSyncMappingUpdate*, void* );
82
    static void engine_callback( OSyncEngine*, OSyncEngineUpdate*, void* );
82
    static void engine_callback( OSyncEngineUpdate*, void* );
83
    static void member_callback( OSyncMemberUpdate*, void* );
83
    static void member_callback( OSyncMemberUpdate*, void* );
84
84
85
    Engine* mEngine;
85
    Engine* mEngine;
86
};
86
};
87
87
(-)kitchensync.orig/libqopensync/conversion.cpp (-6 / +11 lines)
Lines 18-27 Link Here
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
19
    Boston, MA 02110-1301, USA.
20
*/
20
*/
21
21
22
#include <opensync/opensync.h>
22
#include <opensync/opensync.h>
23
#include <opensync/opensync-format.h>
23
24
24
#include "conversion.h"
25
#include "conversion.h"
25
26
26
using namespace QSync;
27
using namespace QSync;
27
28
Lines 41-58 Link Here
41
42
42
QStringList Conversion::objectTypes() const
43
QStringList Conversion::objectTypes() const
43
{
44
{
44
  Q_ASSERT( mEnvironment );
45
  Q_ASSERT( mEnvironment );
45
46
46
  OSyncFormatEnv *formatEnv = osync_conv_env_new( mEnvironment );
47
  OSyncError *error = NULL;
48
  OSyncFormatEnv *formatEnv = osync_format_env_new( &error );
47
  Q_ASSERT( formatEnv );
49
  Q_ASSERT( formatEnv );
48
50
51
  osync_format_env_load_plugins(formatEnv, NULL, &error);
52
49
  QStringList types;	
53
  QStringList types;	
50
  for ( int i = 0; i < osync_conv_num_objtypes( formatEnv ); i++ ) {
51
    OSyncObjType *type = osync_conv_nth_objtype( formatEnv, i );
52
    types.append( QString::fromUtf8( osync_objtype_get_name( type ) ) );
53
  }
54
54
55
  osync_conv_env_free( formatEnv );
55
  for (int i = 0; i < osync_format_env_num_objformats(formatEnv); i++) {
56
    OSyncObjFormat *format = osync_format_env_nth_objformat(formatEnv, i);
57
    types.append( QString::fromUtf8( osync_objformat_get_objtype(format) ) );
58
 }
59
60
  osync_format_env_free( formatEnv );
56
61
57
  return types;
62
  return types;
58
}
63
}
(-)kitchensync.orig/libqopensync/conversion.h (-3 / +3 lines)
Lines 22-38 Link Here
22
#ifndef QSYNC_CONVERSION_H
22
#ifndef QSYNC_CONVERSION_H
23
#define QSYNC_CONVERSION_H
23
#define QSYNC_CONVERSION_H
24
24
25
#include <qstringlist.h>
25
#include <qstringlist.h>
26
26
27
class OSyncEnv;
27
class OSyncGroupEnv;
28
28
29
namespace QSync {
29
namespace QSync {
30
30
31
class Conversion
31
class Conversion
32
{
32
{
33
  friend class Environment;
33
  friend class PluginEnv;
34
34
35
  public:
35
  public:
36
    Conversion();
36
    Conversion();
37
    ~Conversion();
37
    ~Conversion();
38
38
Lines 45-55 Link Here
45
      Returns the list of names of supported object types.
45
      Returns the list of names of supported object types.
46
     */
46
     */
47
    QStringList objectTypes() const;
47
    QStringList objectTypes() const;
48
48
49
  private:
49
  private:
50
    OSyncEnv *mEnvironment;
50
    OSyncGroupEnv *mGroupEnv;
51
};
51
};
52
52
53
}
53
}
54
54
55
#endif
55
#endif
(-)kitchensync.orig/libqopensync/engine.cpp (-7 / +33 lines)
Lines 18-67 Link Here
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
19
    Boston, MA 02110-1301, USA.
20
*/
20
*/
21
21
22
#include <opensync/opensync.h>
22
#include <opensync/opensync.h>
23
#include <osengine/engine.h>
23
#include <opensync/opensync-engine.h>
24
25
#include "group.h"
26
#include "member.h"
27
#include "result.h"
24
28
25
#include "engine.h"
29
#include "engine.h"
26
30
27
using namespace QSync;
31
using namespace QSync;
28
32
29
Engine::Engine( const Group &group )
33
Engine::Engine( const Group &group )
30
{
34
{
31
  OSyncError *error = 0;
35
  OSyncError *error = 0;
32
  mEngine = osengine_new( group.mGroup, &error );
36
  mEngine = osync_engine_new( group.mGroup, &error );
33
}
37
}
34
38
35
Engine::~Engine()
39
Engine::~Engine()
36
{
40
{
37
  osengine_free( mEngine );
41
  osync_engine_unref( mEngine );
38
  mEngine = 0;
42
  mEngine = 0;
39
}
43
}
40
44
41
Result Engine::initialize()
45
Result Engine::initialize()
42
{
46
{
47
  Q_ASSERT( mEngine );
48
43
  OSyncError *error = 0;
49
  OSyncError *error = 0;
44
  if ( !osengine_init( mEngine, &error ) )
50
  if ( !osync_engine_initialize	( mEngine, &error ) )
45
    return Result( &error );
51
    return Result( &error );
46
  else
52
  else
47
    return Result();
53
    return Result();
48
}
54
}
49
55
50
void Engine::finalize()
56
void Engine::finalize()
51
{
57
{
52
  osengine_finalize( mEngine );
58
  Q_ASSERT( mEngine );
59
60
  OSyncError *error = 0;
61
  osync_engine_finalize( mEngine , &error );
53
}
62
}
54
63
55
Result Engine::synchronize()
64
Result Engine::synchronize()
56
{
65
{
66
  Q_ASSERT( mEngine );
67
57
  OSyncError *error = 0;
68
  OSyncError *error = 0;
58
  if ( !osengine_synchronize( mEngine, &error ) )
69
  if ( !osync_engine_synchronize( mEngine, &error ) )
70
    return Result( &error );
71
  else
72
    return Result();
73
}
74
75
Result Engine::discover( const Member &member )
76
{
77
  Q_ASSERT( mEngine );
78
79
  OSyncError *error = 0;
80
  if ( !osync_engine_discover_and_block( mEngine, member.mMember, &error ) )
59
    return Result( &error );
81
    return Result( &error );
60
  else
82
  else
61
    return Result();
83
    return Result();
62
}
84
}
63
85
64
void Engine::abort()
86
void Engine::abort()
65
{
87
{
66
  osengine_abort( mEngine );
88
  Q_ASSERT( mEngine );
89
90
// TODO
91
//  osync_engine_abort( mEngine );
67
}
92
}
93
(-)kitchensync.orig/libqopensync/engine.h (-2 / +9 lines)
Lines 20-35 Link Here
20
*/
20
*/
21
21
22
#ifndef QSYNC_ENGINE_H
22
#ifndef QSYNC_ENGINE_H
23
#define QSYNC_ENGINE_H
23
#define QSYNC_ENGINE_H
24
24
25
#include <libqopensync/group.h>
26
27
class OSyncEngine;
25
class OSyncEngine;
28
26
29
namespace QSync {
27
namespace QSync {
30
28
29
class Group;
30
class Member;
31
class Result;
32
31
class Engine
33
class Engine
32
{
34
{
33
  friend class CallbackHandler;
35
  friend class CallbackHandler;
34
36
35
  public:
37
  public:
Lines 57-66 Link Here
57
      Starts the synchronization process.
59
      Starts the synchronization process.
58
     */
60
     */
59
    Result synchronize();
61
    Result synchronize();
60
62
61
    /**
63
    /**
64
      Starts the discover process for a certain member.
65
     */
66
    Result discover( const Member &member );
67
68
    /**
62
      Stops the synchronization process.
69
      Stops the synchronization process.
63
     */
70
     */
64
    void abort();
71
    void abort();
65
72
66
  private:
73
  private:
(-)kitchensync.orig/libqopensync/environment.cpp (-172 lines)
Lines 1-172 Link Here
1
/*
2
    This file is part of libqopensync.
3
4
    Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
5
6
    This library is free software; you can redistribute it and/or
7
    modify it under the terms of the GNU Library General Public
8
    License as published by the Free Software Foundation; either
9
    version 2 of the License, or (at your option) any later version.
10
11
    This library is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
    Library General Public License for more details.
15
16
    You should have received a copy of the GNU Library General Public License
17
    along with this library; see the file COPYING.LIB.  If not, write to
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
20
*/
21
22
#include "environment.h"
23
24
#include <opensync/opensync.h>
25
26
using namespace QSync;
27
28
Environment::Environment()
29
{
30
  mEnvironment = osync_env_new();
31
}
32
33
Environment::~Environment()
34
{
35
  osync_env_free( mEnvironment );
36
}
37
38
Environment::GroupIterator Environment::groupBegin()
39
{
40
  GroupIterator it( this );
41
  it.mPos = 0;
42
43
  return it;
44
}
45
46
Environment::GroupIterator Environment::groupEnd()
47
{
48
  GroupIterator it( this );
49
  it.mPos = groupCount();
50
51
  return it;
52
}
53
54
Environment::PluginIterator Environment::pluginBegin()
55
{
56
  PluginIterator it( this );
57
  it.mPos = 0;
58
59
  return it;
60
}
61
62
Environment::PluginIterator Environment::pluginEnd()
63
{
64
  PluginIterator it( this );
65
  it.mPos = pluginCount();
66
67
  return it;
68
}
69
70
Result Environment::initialize()
71
{
72
  OSyncError *error = 0;
73
  if ( !osync_env_initialize( mEnvironment, &error ) )
74
    return Result( &error );
75
  else
76
    return Result();
77
}
78
79
Result Environment::finalize()
80
{
81
  OSyncError *error = 0;
82
  if ( !osync_env_finalize( mEnvironment, &error ) )
83
    return Result( &error);
84
  else
85
    return Result();
86
}
87
88
int Environment::groupCount() const
89
{
90
  return osync_env_num_groups( mEnvironment );
91
}
92
93
Group Environment::groupAt( int pos ) const
94
{
95
  Group group;
96
97
  if ( pos < 0 || pos >= groupCount() )
98
    return group;
99
100
  OSyncGroup *ogroup = osync_env_nth_group( mEnvironment, pos );
101
  group.mGroup = ogroup;
102
103
  return group;
104
}
105
106
Group Environment::groupByName( const QString &name ) const
107
{
108
  Group group;
109
110
  OSyncGroup *ogroup = osync_env_find_group( mEnvironment, name.latin1() );
111
  if ( ogroup )
112
    group.mGroup = ogroup;
113
114
  return group;
115
}
116
117
Group Environment::addGroup()
118
{
119
  Group group;
120
121
  OSyncGroup *ogroup = osync_group_new( mEnvironment );
122
  if ( ogroup )
123
    group.mGroup = ogroup;
124
125
  return group;
126
}
127
128
Result Environment::removeGroup( const Group &group )
129
{
130
  OSyncError *error = 0;
131
  if ( !osync_group_delete( group.mGroup, &error ) )
132
    return Result( &error );
133
  else
134
    return Result();
135
}
136
137
int Environment::pluginCount() const
138
{
139
  return osync_env_num_plugins( mEnvironment );
140
}
141
142
Plugin Environment::pluginAt( int pos ) const
143
{
144
  Plugin plugin;
145
146
  if ( pos < 0 || pos >= pluginCount() )
147
    return plugin;
148
149
  OSyncPlugin *oplugin = osync_env_nth_plugin( mEnvironment, pos );
150
  plugin.mPlugin = oplugin;
151
152
  return plugin;
153
}
154
155
Plugin Environment::pluginByName( const QString &name ) const
156
{
157
  Plugin plugin;
158
159
  OSyncPlugin *oplugin = osync_env_find_plugin( mEnvironment, name.latin1() );
160
  if ( oplugin )
161
    plugin.mPlugin = oplugin;
162
163
  return plugin;
164
}
165
166
Conversion Environment::conversion() const
167
{
168
  Conversion conversion;
169
  conversion.mEnvironment = mEnvironment;
170
171
  return conversion;
172
}
(-)kitchensync.orig/libqopensync/environment.h (-199 lines)
Lines 1-199 Link Here
1
/*
2
    This file is part of libqopensync.
3
4
    Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
5
6
    This library is free software; you can redistribute it and/or
7
    modify it under the terms of the GNU Library General Public
8
    License as published by the Free Software Foundation; either
9
    version 2 of the License, or (at your option) any later version.
10
11
    This library is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
    Library General Public License for more details.
15
16
    You should have received a copy of the GNU Library General Public License
17
    along with this library; see the file COPYING.LIB.  If not, write to
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
20
*/
21
22
#ifndef OSYNC_ENVIRONMENT_H
23
#define OSYNC_ENVIRONMENT_H
24
25
#include <qstring.h>
26
27
#include <libqopensync/group.h>
28
#include <libqopensync/plugin.h>
29
#include <libqopensync/result.h>
30
#include <libqopensync/conversion.h>
31
32
struct OSyncEnv;
33
34
namespace QSync {
35
36
class Environment
37
{
38
  public:
39
    Environment();
40
    ~Environment();
41
42
    class GroupIterator
43
    {
44
      friend class Environment;
45
46
      public:
47
        GroupIterator( Environment *environment )
48
          : mEnvironment( environment ), mPos( -1 )
49
        {
50
        }
51
52
        GroupIterator( const GroupIterator &it )
53
        {
54
          mEnvironment = it.mEnvironment;
55
          mPos = it.mPos;
56
        }
57
58
        Group operator*() 
59
        {
60
          return mEnvironment->groupAt( mPos );
61
        }
62
63
        GroupIterator &operator++() { mPos++; return *this; }
64
        GroupIterator &operator++( int ) { mPos++; return *this; }
65
        GroupIterator &operator--() { mPos--; return *this; }
66
        GroupIterator &operator--( int ) { mPos--; return *this; }
67
        bool operator==( const GroupIterator &it ) { return mEnvironment == it.mEnvironment && mPos == it.mPos; }
68
        bool operator!=( const GroupIterator &it ) { return mEnvironment == it.mEnvironment && mPos != it.mPos; }
69
70
      private:
71
        Environment *mEnvironment;
72
        int mPos;
73
    };
74
75
    class PluginIterator
76
    {
77
      friend class Environment;
78
79
      public:
80
        PluginIterator( Environment *environment )
81
          : mEnvironment( environment ), mPos( -1 )
82
        {
83
        }
84
85
        PluginIterator( const PluginIterator &it )
86
        {
87
          mEnvironment = it.mEnvironment;
88
          mPos = it.mPos;
89
        }
90
91
        Plugin operator*() 
92
        {
93
          return mEnvironment->pluginAt( mPos );
94
        }
95
96
        PluginIterator &operator++() { mPos++; return *this; }
97
        PluginIterator &operator++( int ) { mPos++; return *this; }
98
        PluginIterator &operator--() { mPos--; return *this; }
99
        PluginIterator &operator--( int ) { mPos--; return *this; }
100
        bool operator==( const PluginIterator &it ) { return mEnvironment == it.mEnvironment && mPos == it.mPos; }
101
        bool operator!=( const PluginIterator &it ) { return mEnvironment == it.mEnvironment && mPos != it.mPos; }
102
103
      private:
104
        Environment *mEnvironment;
105
        int mPos;
106
    };
107
108
    /**
109
      Returns an iterator pointing to the first item in the group list.
110
      This iterator equals groupEnd() if the group list is empty.
111
     */
112
    GroupIterator groupBegin();
113
114
    /**
115
      Returns an iterator pointing past the last item in the group list.
116
      This iterator equals groupBegin() if the group list is empty.
117
     */
118
    GroupIterator groupEnd();
119
120
    /**
121
      Returns an iterator pointing to the first item in the plugin list.
122
      This iterator equals pluginEnd() if the group list is empty.
123
     */
124
    PluginIterator pluginBegin();
125
126
    /**
127
      Returns an iterator pointing past the last item in the plugin list.
128
      This iterator equals pluginBegin() if the plugin list is empty.
129
     */
130
    PluginIterator pluginEnd();
131
132
    /**
133
      Initializes the environment ( e.g. loads the groups and plugins ).
134
      Has to be called before the groups or plugins can be accessed.
135
     */
136
    Result initialize();
137
138
    /**
139
      Finalizes the environment ( e.g. unloads the groups and plugins ).
140
      Should be the last call before the object is deleted.
141
     */
142
    Result finalize();
143
144
    /**
145
      Returns the number of groups.
146
     */
147
    int groupCount() const;
148
149
    /**
150
      Returns the group at position @param pos.
151
     */
152
    Group groupAt( int pos ) const;
153
154
    /**
155
      Returns a group by name or an invalid group when the group with this
156
      name doesn't exists.
157
     */
158
    Group groupByName( const QString &name ) const;
159
160
    /**
161
      Adds a new group to the environment.
162
163
      @returns the new group.
164
     */
165
    Group addGroup();
166
167
    /**
168
      Removes a group from the environment.
169
     */
170
    Result removeGroup( const Group &group );
171
172
    /**
173
      Returns the number of plugins.
174
     */
175
    int pluginCount() const;
176
177
    /**
178
      Returns the plugin at position @param pos.
179
     */
180
    Plugin pluginAt( int pos ) const;
181
182
    /**
183
      Returns a plugin by name or an invalid plugin when the plugin with this
184
      name doesn't exists.
185
     */
186
    Plugin pluginByName( const QString &name ) const;
187
188
    /**
189
      Returns the conversion object of this environment.
190
     */
191
    Conversion conversion() const;
192
193
  private:
194
    OSyncEnv *mEnvironment;
195
};
196
197
}
198
199
#endif
(-)kitchensync.orig/libqopensync/filter.cpp (+1 lines)
Lines 18-27 Link Here
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
19
    Boston, MA 02110-1301, USA.
20
*/
20
*/
21
21
22
#include <opensync/opensync.h>
22
#include <opensync/opensync.h>
23
#include <opensync/opensync-format.h>
23
24
24
#include "filter.h"
25
#include "filter.h"
25
26
26
using namespace QSync;
27
using namespace QSync;
27
28
(-)kitchensync.orig/libqopensync/group.cpp (-99 / +44 lines)
Lines 23-112 Link Here
23
#include <qdom.h>
23
#include <qdom.h>
24
#include <qfile.h>
24
#include <qfile.h>
25
/** hack includes **/
25
/** hack includes **/
26
26
27
#include <opensync/opensync.h>
27
#include <opensync/opensync.h>
28
#include <opensync/opensync-group.h>
28
29
29
#include "conversion.h"
30
#include "conversion.h"
31
#include "filter.h"
32
#include "member.h"
33
#include "plugin.h"
34
#include "result.h"
35
30
#include "group.h"
36
#include "group.h"
31
37
32
using namespace QSync;
38
using namespace QSync;
33
39
34
/**
35
  This class is a quick hack for OpenSync 0.19 and 0.20 because
36
  the engine doesn't stores the filter settings itself when calling
37
  osync_group_set_objtype_enabled(), so we have to store it for every
38
  group in a separated config file. This class encapsulates it.
39
 */
40
GroupConfig::GroupConfig()
41
  : mGroup( 0 )
42
{
43
}
44
45
QStringList GroupConfig::activeObjectTypes() const
46
{
47
  Q_ASSERT( mGroup );
48
49
  const QString fileName = QString( "%1/filter.conf" ).arg( osync_group_get_configdir( mGroup ) );
50
51
  QFile file( fileName );
52
  if ( !file.open( IO_ReadOnly ) )
53
    return QStringList();
54
55
  QDomDocument document;
56
57
  QString message;
58
  if ( !document.setContent( &file, &message ) ) {
59
    qDebug( "Error on loading %s: %s", fileName.latin1(), message.latin1() );
60
    return QStringList();
61
  }
62
  file.close();
63
64
  QStringList objectTypes;
65
66
  QDomElement element = document.documentElement();
67
  QDomNode node = element.firstChild();
68
  while ( !node.isNull() ) {
69
    QDomElement childElement = node.toElement();
70
    if ( !childElement.isNull() )
71
      objectTypes.append( childElement.tagName() );
72
73
    node = node.nextSibling();
74
  }
75
76
  return objectTypes;
77
}
78
79
void GroupConfig::setActiveObjectTypes( const QStringList &objectTypes )
80
{
81
  Q_ASSERT( mGroup );
82
83
  QDomDocument document( "Filter" );
84
  document.appendChild( document.createProcessingInstruction(
85
                        "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) );
86
87
  QDomElement element = document.createElement( "filter" );
88
  document.appendChild( element );
89
90
  for ( uint i = 0; i < objectTypes.count(); ++i ) {
91
    QDomElement entry = document.createElement( objectTypes[ i ] );
92
    element.appendChild( entry );
93
  }
94
95
  const QString fileName = QString( "%1/filter.conf" ).arg( osync_group_get_configdir( mGroup ) );
96
97
  QFile file( fileName );
98
  if ( !file.open( IO_WriteOnly ) )
99
    return;
100
101
  QTextStream s( &file );
102
  s.setEncoding( QTextStream::UnicodeUTF8 );
103
  s << document.toString();
104
  file.close();
105
}
106
107
108
Group::Group()
40
Group::Group()
109
  : mGroup( 0 )
41
  : mGroup( 0 )
110
{
42
{
111
}
43
}
112
44
Lines 117-142 Link Here
117
bool Group::isValid() const
49
bool Group::isValid() const
118
{
50
{
119
  return ( mGroup != 0 );
51
  return ( mGroup != 0 );
120
}
52
}
121
53
122
Group::Iterator Group::begin()
123
{
124
  Iterator it( this );
125
  it.mPos = 0;
126
127
  return it;
128
}
129
130
Group::Iterator Group::end()
131
{
132
  Iterator it( this );
133
  it.mPos = memberCount();
134
135
  return it;
136
}
137
138
void Group::setName( const QString &name )
54
void Group::setName( const QString &name )
139
{
55
{
140
  Q_ASSERT( mGroup );
56
  Q_ASSERT( mGroup );
141
57
142
  osync_group_set_name( mGroup, name.latin1() );
58
  osync_group_set_name( mGroup, name.latin1() );
Lines 186-207 Link Here
186
      return LockStale;
102
      return LockStale;
187
      break;
103
      break;
188
  }
104
  }
189
}
105
}
190
106
191
void Group::unlock( bool removeFile )
107
void Group::unlock()
192
{
108
{
193
  Q_ASSERT( mGroup );
109
  Q_ASSERT( mGroup );
194
110
195
  osync_group_unlock( mGroup, removeFile );
111
  osync_group_unlock( mGroup );
196
}
112
}
197
113
198
Member Group::addMember()
114
Member Group::addMember( const QSync::Plugin &plugin )
199
{
115
{
200
  Q_ASSERT( mGroup );
116
  Q_ASSERT( mGroup );
201
117
202
  OSyncMember *omember = osync_member_new( mGroup );
118
  OSyncError *error = 0;
119
120
  OSyncMember *omember = osync_member_new( &error );
121
  osync_group_add_member( mGroup, omember );
122
  osync_member_set_pluginname( omember, plugin.name().utf8() );
203
123
204
  Member member;
124
  Member member;
205
  member.mMember = omember;
125
  member.mMember = omember;
206
126
207
  save();
127
  save();
Lines 267-276 Link Here
267
    return Result( &error );
187
    return Result( &error );
268
  else
188
  else
269
    return Result();
189
    return Result();
270
}
190
}
271
191
192
void Group::setUseMerger( bool use )
193
{
194
  Q_ASSERT( mGroup );
195
  osync_group_set_merger_enabled( mGroup, use );
196
}
197
198
bool Group::useMerger() const
199
{
200
  Q_ASSERT( mGroup );
201
  return osync_group_get_merger_enabled( mGroup );
202
}
203
204
void Group::setUseConverter( bool use )
205
{
206
  Q_ASSERT( mGroup );
207
  osync_group_set_converter_enabled( mGroup, use );
208
}
209
210
bool Group::useConverter() const
211
{
212
  Q_ASSERT( mGroup );
213
  return osync_group_get_converter_enabled( mGroup );
214
}
215
272
void Group::setObjectTypeEnabled( const QString &objectType, bool enabled )
216
void Group::setObjectTypeEnabled( const QString &objectType, bool enabled )
273
{
217
{
274
  Q_ASSERT( mGroup );
218
  Q_ASSERT( mGroup );
275
219
276
  osync_group_set_objtype_enabled( mGroup, objectType.utf8(), enabled );
220
  osync_group_set_objtype_enabled( mGroup, objectType.utf8(), enabled );
Lines 279-292 Link Here
279
bool Group::isObjectTypeEnabled( const QString &objectType ) const
223
bool Group::isObjectTypeEnabled( const QString &objectType ) const
280
{
224
{
281
  return osync_group_objtype_enabled( mGroup, objectType.utf8() );
225
  return osync_group_objtype_enabled( mGroup, objectType.utf8() );
282
}
226
}
283
227
284
GroupConfig Group::config() const
228
Result Group::cleanup() const
285
{
229
{
286
  Q_ASSERT( mGroup );
230
  Q_ASSERT( mGroup );
287
231
288
  GroupConfig config;
232
  OSyncError *error = 0;
289
  config.mGroup = mGroup;
233
  if ( !osync_group_delete( mGroup, &error ) )
290
234
    return Result( &error );
291
  return config;
235
  else
236
    return Result();
292
}
237
}
(-)kitchensync.orig/libqopensync/groupenv.cpp (+121 lines)
Line 0 Link Here
1
/*
2
    This file is part of libqopensync.
3
4
    Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
5
6
    This library is free software; you can redistribute it and/or
7
    modify it under the terms of the GNU Library General Public
8
    License as published by the Free Software Foundation; either
9
    version 2 of the License, or (at your option) any later version.
10
11
    This library is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
    Library General Public License for more details.
15
16
    You should have received a copy of the GNU Library General Public License
17
    along with this library; see the file COPYING.LIB.  If not, write to
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
20
*/
21
22
#include <opensync/opensync.h>
23
#include <opensync/opensync-group.h>
24
25
#include "group.h"
26
#include "result.h"
27
28
#include "groupenv.h"
29
30
using namespace QSync;
31
32
GroupEnv::GroupEnv()
33
{
34
  OSyncError *error = 0;
35
  mGroupEnv = osync_group_env_new( &error );
36
}
37
38
GroupEnv::~GroupEnv()
39
{
40
  osync_group_env_free( mGroupEnv );
41
}
42
43
Result GroupEnv::initialize()
44
{
45
  Q_ASSERT( mGroupEnv );
46
47
  OSyncError *error = 0;
48
  if ( !osync_group_env_load_groups( mGroupEnv, NULL, &error ) )
49
    return Result( &error );
50
  else
51
    return Result();
52
}
53
54
void GroupEnv::finalize()
55
{
56
}
57
58
int GroupEnv::groupCount() const
59
{
60
  Q_ASSERT( mGroupEnv );
61
62
  return osync_group_env_num_groups( mGroupEnv );
63
}
64
65
Group GroupEnv::groupAt( int pos ) const
66
{
67
  Q_ASSERT( mGroupEnv );
68
69
  Group group;
70
71
  if ( pos < 0 || pos >= groupCount() )
72
    return group;
73
74
  OSyncGroup *ogroup = osync_group_env_nth_group( mGroupEnv, pos );
75
  group.mGroup = ogroup;
76
77
  return group;
78
}
79
80
Group GroupEnv::groupByName( const QString &name ) const
81
{
82
  Q_ASSERT( mGroupEnv );
83
84
  Group group;
85
86
  OSyncGroup *ogroup = osync_group_env_find_group( mGroupEnv, name.latin1() );
87
  if ( ogroup )
88
    group.mGroup = ogroup;
89
90
  return group;
91
}
92
93
Group GroupEnv::addGroup( const QString &name )
94
{
95
  Q_ASSERT( mGroupEnv );
96
97
  Group group;
98
  OSyncError *error = 0;
99
100
  OSyncGroup *ogroup = osync_group_new( &error );
101
  if ( ogroup )
102
    group.mGroup = ogroup;
103
104
  group.setName( name );
105
106
  if ( !osync_group_env_add_group( mGroupEnv, ogroup, &error ) ) {
107
    Result res( &error );
108
    qDebug( "Error on adding group: %s", res.message().latin1() );
109
  }
110
111
  return group;
112
}
113
114
void GroupEnv::removeGroup( const Group &group )
115
{
116
  Q_ASSERT( mGroupEnv );
117
118
  group.cleanup();
119
120
  osync_group_env_remove_group( mGroupEnv, group.mGroup );
121
}
(-)kitchensync.orig/libqopensync/groupenv.h (+86 lines)
Line 0 Link Here
1
/*
2
    This file is part of libqopensync.
3
4
    Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
5
6
    This library is free software; you can redistribute it and/or
7
    modify it under the terms of the GNU Library General Public
8
    License as published by the Free Software Foundation; either
9
    version 2 of the License, or (at your option) any later version.
10
11
    This library is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
    Library General Public License for more details.
15
16
    You should have received a copy of the GNU Library General Public License
17
    along with this library; see the file COPYING.LIB.  If not, write to
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
20
*/
21
22
#ifndef OSYNC_GROUPENV_H
23
#define OSYNC_GROUPENV_H
24
25
#include <qstring.h>
26
27
struct OSyncGroupEnv;
28
29
namespace QSync {
30
31
class Group;
32
class Result;
33
34
class GroupEnv
35
{
36
  public:
37
    GroupEnv();
38
    ~GroupEnv();
39
40
    /**
41
      Initializes the environment ( e.g. loads the groups and plugins ).
42
      Has to be called before the groups or plugins can be accessed.
43
     */
44
    Result initialize();
45
46
    /**
47
      Finalizes the environment ( e.g. unloads the groups and plugins ).
48
      Should be the last call before the object is deleted.
49
     */
50
    void finalize();
51
52
    /**
53
      Returns the number of groups.
54
     */
55
    int groupCount() const;
56
57
    /**
58
      Returns the group at position @param pos.
59
     */
60
    Group groupAt( int pos ) const;
61
62
    /**
63
      Returns a group by name or an invalid group when the group with this
64
      name doesn't exists.
65
     */
66
    Group groupByName( const QString &name ) const;
67
68
    /**
69
      Adds a new group to the environment.
70
71
      @returns the new group.
72
     */
73
    Group addGroup( const QString &name );
74
75
    /**
76
      Removes a group from the environment.
77
     */
78
    void removeGroup( const Group &group );
79
80
  private:
81
    OSyncGroupEnv *mGroupEnv;
82
};
83
84
}
85
86
#endif
(-)kitchensync.orig/libqopensync/group.h (-73 / +31 lines)
Lines 23-61 Link Here
23
#define QSYNC_GROUP_H
23
#define QSYNC_GROUP_H
24
24
25
#include <qdatetime.h>
25
#include <qdatetime.h>
26
#include <qstringlist.h>
26
#include <qstringlist.h>
27
27
28
#include <libqopensync/filter.h>
29
#include <libqopensync/member.h>
30
31
class OSyncGroup;
28
class OSyncGroup;
32
29
33
namespace QSync {
30
namespace QSync {
34
31
32
class Filter;
33
class Member;
34
class Plugin;
35
class Result;
36
35
/**
37
/**
36
  @internal
38
  @internal
37
 */
39
 */
38
class GroupConfig
39
{
40
  friend class Group;
41
42
  public:
43
    GroupConfig();
44
45
    QStringList activeObjectTypes() const;
46
    void setActiveObjectTypes( const QStringList &objectTypes );
47
48
  private:
49
    OSyncGroup *mGroup;
50
};
51
52
53
class Group
40
class Group
54
{
41
{
55
  friend class Engine;
42
  friend class Engine;
56
  friend class Environment;
43
  friend class GroupEnv;
57
44
58
  public:
45
  public:
59
    enum LockType
46
    enum LockType
60
    {
47
    {
61
      LockOk,
48
      LockOk,
Lines 69-123 Link Here
69
    /**
56
    /**
70
      Returns whether the object is a valid group.
57
      Returns whether the object is a valid group.
71
     */
58
     */
72
    bool isValid() const;
59
    bool isValid() const;
73
60
74
    class Iterator
75
    {
76
      friend class Group;
77
78
      public:
79
        Iterator( Group *group )
80
          : mGroup( group ), mPos( -1 )
81
        {
82
        }
83
84
        Iterator( const Iterator &it )
85
        {
86
          mGroup = it.mGroup;
87
          mPos = it.mPos;
88
        }
89
90
        Member operator*() 
91
        {
92
          return mGroup->memberAt( mPos );
93
        }
94
95
        Iterator &operator++() { mPos++; return *this; }
96
        Iterator &operator++( int ) { mPos++; return *this; }
97
        Iterator &operator--() { mPos--; return *this; }
98
        Iterator &operator--( int ) { mPos--; return *this; }
99
        bool operator==( const Iterator &it ) { return mGroup == it.mGroup && mPos == it.mPos; }
100
        bool operator!=( const Iterator &it ) { return mGroup == it.mGroup && mPos != it.mPos; }
101
102
      private:
103
        Group *mGroup;
104
        int mPos;
105
    };
106
107
    /**
108
      Returns an iterator pointing to the first item in the member list.
109
      This iterator equals end() if the member list is empty.
110
     */
111
    Iterator begin();
112
113
    /**
114
      Returns an iterator pointing past the last item in the member list.
115
      This iterator equals begin() if the member list is empty.
116
     */
117
    Iterator end();
118
119
    /**
61
    /**
120
      Sets the name of the group.
62
      Sets the name of the group.
121
     */
63
     */
122
    void setName( const QString &name );
64
    void setName( const QString &name );
123
65
Lines 143-163 Link Here
143
     */
85
     */
144
    LockType lock();
86
    LockType lock();
145
87
146
    /**
88
    /**
147
      Unlocks the group.
89
      Unlocks the group.
148
149
      @param removeFile Whether the lock file shall be removed.
150
     */
90
     */
151
    void unlock( bool removeFile = true );
91
    void unlock();
152
92
153
    /**
93
    /**
154
      Adds a new member to the group.
94
      Adds a new member to the group.
155
95
156
      @returns the new member.
96
      @returns the new member.
157
     */
97
     */
158
    Member addMember();
98
    Member addMember( const QSync::Plugin &plugin );
159
99
160
    /**
100
    /**
161
      Removes a member from the group.
101
      Removes a member from the group.
162
     */
102
     */
163
    void removeMember( const Member &member );
103
    void removeMember( const Member &member );
Lines 193-215 Link Here
193
      this group.
133
      this group.
194
     */
134
     */
195
    bool isObjectTypeEnabled( const QString &objectType ) const;
135
    bool isObjectTypeEnabled( const QString &objectType ) const;
196
136
197
    /**
137
    /**
198
      Saves the configuration to hard disc.
138
      Sets whether this group uses the merger for synchronization.
199
     */
139
     */
200
    Result save();
140
    void setUseMerger( bool use );
201
141
202
    /**
142
    /**
203
      Returns the config object of this group.
143
      Returns whether this group uses the merger for synchronization.
144
     */
145
    bool useMerger() const;
204
146
205
      Note: This method is only available for OpenSync 0.19 and 0.20.
147
    /**
148
      Sets whether this group uses the converter for synchronization.
206
     */
149
     */
207
    GroupConfig config() const;
150
    void setUseConverter( bool use );
151
152
    /**
153
      Returns whether this group uses the converter for synchronization.
154
     */
155
    bool useConverter() const;
156
157
    /**
158
      Saves the configuration to hard disc.
159
     */
160
    Result save();
208
161
209
    bool operator==( const Group &group ) const { return mGroup == group.mGroup; }
162
    bool operator==( const Group &group ) const { return mGroup == group.mGroup; }
210
163
164
    /**
165
      Removes all group configurations from the hard disc.
166
     */
167
    Result cleanup() const;
168
211
  private:
169
  private:
212
    OSyncGroup *mGroup;
170
    OSyncGroup *mGroup;
213
};
171
};
214
172
215
}
173
}
(-)kitchensync.orig/libqopensync/Makefile.am (-4 / +8 lines)
Lines 1-19 Link Here
1
INCLUDES = -I$(top_srcdir)/kitchensync/src \
1
INCLUDES = -I$(top_srcdir)/kitchensync/src \
2
           -I$(top_srcdir)/kitchensync \
2
           -I$(top_srcdir)/kitchensync \
3
           -I$(top_srcdir) \
3
           -I$(top_srcdir) \
4
           $(OPENSYNC_CFLAGS) \
4
           $(OPENSYNC_CFLAGS) \
5
           $(OPENSYNCENGINE_CFLAGS) \
5
           $(GLIB_CFLAGS) \
6
           $(all_includes)
6
           $(all_includes)
7
7
8
lib_LTLIBRARIES = libqopensync.la
8
lib_LTLIBRARIES = libqopensync.la
9
9
10
libqopensync_la_SOURCES = callbackhandler.cpp conversion.cpp engine.cpp environment.cpp filter.cpp group.cpp \
10
libqopensync_la_SOURCES = callbackhandler.cpp engine.cpp groupenv.cpp pluginenv.cpp filter.cpp group.cpp \
11
	member.cpp plugin.cpp result.cpp syncmapping.cpp syncupdates.cpp \
11
	member.cpp plugin.cpp result.cpp syncmapping.cpp syncupdates.cpp \
12
	syncchange.cpp
12
	syncchange.cpp
13
libqopensync_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -no-undefined
13
14
libqopensync_la_LIBADD = $(LIB_KDEUI) $(OPENSYNC_LIBS) $(OPENSYNCENGINE_LIBS)
14
# FIXME: -no-undefined break the build for some unkown reason - libopensync broken?!
15
#libqopensync_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -no-undefined
16
libqopensync_la_LDFLAGS = $(all_libraries) $(KDE_RPATH)
17
libqopensync_la_LIBADD = $(LIB_KDEUI) $(OPENSYNC_LIBS)
18
15
19
16
METASOURCES = AUTO
20
METASOURCES = AUTO
17
21
18
messages: rc.cpp
22
messages: rc.cpp
19
	$(XGETTEXT) *.cpp *.h -o $(podir)/libqopensync.pot
23
	$(XGETTEXT) *.cpp *.h -o $(podir)/libqopensync.pot
(-)kitchensync.orig/libqopensync/member.cpp (-51 / +22 lines)
Lines 18-29 Link Here
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
19
    Boston, MA 02110-1301, USA.
20
*/
20
*/
21
21
22
#include <opensync/opensync.h>
22
#include <opensync/opensync.h>
23
#include <opensync/opensync-group.h>
24
23
#include <stdlib.h>
25
#include <stdlib.h>
24
26
27
#include "result.h"
28
25
#include "member.h"
29
#include "member.h"
26
30
27
using namespace QSync;
31
using namespace QSync;
28
32
29
Member::Member()
33
Member::Member()
Lines 40-52 Link Here
40
  OSyncError *error = 0;
44
  OSyncError *error = 0;
41
45
42
  if ( !mMember )
46
  if ( !mMember )
43
    return false;
47
    return false;
44
48
45
  if ( !osync_member_instance_plugin( mMember, pluginName().utf8(), &error ) ) {
49
  if ( !osync_member_load( mMember, configurationDirectory().utf8(), &error ) ) {
46
    qDebug( "Plugin %s is not valid: %s", pluginName().latin1(), osync_error_print( &error ) );
50
    qDebug( "Plugin %s is not valid: %s", pluginName().latin1(), osync_error_print( &error ) );
47
    osync_error_free( &error );
51
    osync_error_unref( &error );
48
    return false;
52
    return false;
49
  }
53
  }
50
54
51
  return true;
55
  return true;
52
}
56
}
Lines 63-85 Link Here
63
  Q_ASSERT( mMember );
67
  Q_ASSERT( mMember );
64
68
65
  return QString::fromLatin1( osync_member_get_pluginname( mMember ) );
69
  return QString::fromLatin1( osync_member_get_pluginname( mMember ) );
66
}
70
}
67
71
68
Plugin Member::plugin() const
69
{
70
  Q_ASSERT( mMember );
71
72
  Plugin plugin;
73
74
  OSyncPlugin *oplugin = osync_member_get_plugin( mMember );
75
  if ( oplugin )
76
    plugin.mPlugin = oplugin;
77
78
  return plugin;
79
}
80
81
int Member::id() const
72
int Member::id() const
82
{
73
{
83
  Q_ASSERT( mMember );
74
  Q_ASSERT( mMember );
84
75
85
  return osync_member_get_id( mMember );
76
  return osync_member_get_id( mMember );
Lines 101-131 Link Here
101
92
102
void Member::setConfiguration( const QByteArray &configurationData )
93
void Member::setConfiguration( const QByteArray &configurationData )
103
{
94
{
104
  Q_ASSERT( mMember );
95
  Q_ASSERT( mMember );
105
96
106
  osync_member_set_config( mMember, configurationData.data(), configurationData.size() );
97
  osync_member_set_config( mMember, configurationData.data() );
107
}
98
}
108
99
109
Result Member::configuration( QByteArray &configurationData, bool useDefault )
100
Result Member::configuration( QByteArray &configurationData, bool useDefault )
110
{
101
{
111
  Q_ASSERT( mMember );
102
  Q_ASSERT( mMember );
112
103
113
  char *data;
104
  const char *data;
114
  int size;
105
  int size = 0;
115
106
116
  OSyncError *error = 0;
107
  OSyncError *error = 0;
117
  osync_bool ok = false;
118
  if ( useDefault )
108
  if ( useDefault )
119
    ok = osync_member_get_config_or_default( mMember, &data, &size, &error );
109
    data = osync_member_get_config_or_default( mMember, &error );
120
  else
110
  else
121
    ok = osync_member_get_config( mMember, &data, &size, &error );
111
    data = osync_member_get_config( mMember, &error );
122
112
123
  if ( !ok ) {
113
114
  if ( !data ) {
124
    return Result( &error );
115
    return Result( &error );
125
  } else {
116
  } else {
126
    configurationData.resize( size );
117
    size = strlen(data);
118
    configurationData.resize( size );	  
127
    memcpy( configurationData.data(), data, size );
119
    memcpy( configurationData.data(), data, size );
128
120
129
    return Result();
121
    return Result();
130
  }
122
  }
131
}
123
}
Lines 139-188 Link Here
139
    return Result( &error );
131
    return Result( &error );
140
  else
132
  else
141
    return Result();
133
    return Result();
142
}
134
}
143
135
144
Result Member::instance( const Plugin &plugin )
136
Result Member::instance()
145
{
137
{
146
  OSyncError *error = 0;
138
  OSyncError *error = 0;
147
  if ( !osync_member_instance_plugin( mMember, plugin.name().utf8(), &error ) )
139
  if ( !osync_member_load( mMember, configurationDirectory().utf8(), &error ) )
148
    return Result( &error );
140
    return Result( &error );
149
  else
141
  else
150
    return Result();
142
    return Result();
151
}
143
}
152
144
153
bool Member::operator==( const Member &member ) const
145
bool Member::operator==( const Member &member ) const
154
{
146
{
155
  return mMember == member.mMember;
147
  return mMember == member.mMember;
156
}
148
}
157
149
158
QString Member::scanDevices( const QString &query )
150
Result Member::cleanup() const
159
{
160
  Q_ASSERT( mMember );
161
162
  OSyncError *error = 0;
163
  char *data = (char*)osync_member_call_plugin( mMember, "scan_devices", const_cast<char*>( query.utf8().data() ), &error );
164
  if ( error != 0 ) {
165
    osync_error_free( &error );
166
    return QString();
167
  } else {
168
    QString xml = QString::fromUtf8( data );
169
    free( data );
170
    return xml;
171
  }
172
}
173
174
bool Member::testConnection( const QString &configuration )
175
{
151
{
176
  Q_ASSERT( mMember );
152
  Q_ASSERT( mMember );
177
153
178
  OSyncError *error = 0;
154
  OSyncError *error = 0;
179
  int *result = (int*)osync_member_call_plugin( mMember, "test_connection", const_cast<char*>( configuration.utf8().data() ), &error );
155
  if ( !osync_member_delete( mMember, &error ) )
180
  if ( error != 0 ) {
156
    return Result( &error );
181
    osync_error_free( &error );
157
  else
182
    return false;
158
    return Result();
183
  } else {
184
    bool value = ( *result == 1 ? true : false );
185
    free( result );
186
    return value;
187
  }
188
}
159
}
(-)kitchensync.orig/libqopensync/member.h (-9 / +12 lines)
Lines 20-42 Link Here
20
*/
20
*/
21
21
22
#ifndef QSYNC_MEMBER_H
22
#ifndef QSYNC_MEMBER_H
23
#define QSYNC_MEMBER_H
23
#define QSYNC_MEMBER_H
24
24
25
#include <libqopensync/plugin.h>
25
#include <qstring.h>
26
#include <libqopensync/result.h>
27
#include <libqopensync/plugin.h>
28
26
29
class OSyncMember;
27
class OSyncMember;
30
28
31
namespace QSync {
29
namespace QSync {
32
30
31
class Result;
32
33
class Member
33
class Member
34
{
34
{
35
  friend class Group;
35
  friend class Group;
36
  friend class Engine;
36
  friend class SyncChange;
37
  friend class SyncChange;
37
  friend class SyncMemberUpdate;
38
  friend class SyncMemberUpdate;
39
  friend class SyncChangeUpdate;
38
40
39
  public:
41
  public:
40
    Member();
42
    Member();
41
    ~Member();
43
    ~Member();
42
44
Lines 54-68 Link Here
54
      Returns the name of the plugin, the member belongs to.
56
      Returns the name of the plugin, the member belongs to.
55
     */
57
     */
56
    QString pluginName() const;
58
    QString pluginName() const;
57
59
58
    /**
60
    /**
59
      Returns the plugin, the member belongs to.
60
     */
61
    Plugin plugin() const;
62
63
    /**
64
      Returns the id of the plugin.
61
      Returns the id of the plugin.
65
    */
62
    */
66
    int id() const;
63
    int id() const;
67
64
68
    /**
65
    /**
Lines 100-110 Link Here
100
    Result save();
97
    Result save();
101
98
102
    /**
99
    /**
103
      Make this member an instance of the given plugin.
100
      Make this member an instance of the given plugin.
104
    */
101
    */
105
    Result instance( const Plugin & );
102
    Result instance();
106
103
107
    bool operator==( const Member& ) const;
104
    bool operator==( const Member& ) const;
108
105
109
    /**
106
    /**
110
      This method can be used to query the plugin for scanning devices.
107
      This method can be used to query the plugin for scanning devices.
Lines 117-126 Link Here
117
      This method can be used to test whether the plugin can connect
114
      This method can be used to test whether the plugin can connect
118
      to the device with the given configuration.
115
      to the device with the given configuration.
119
     */
116
     */
120
    bool testConnection( const QString &configuration );
117
    bool testConnection( const QString &configuration );
121
118
119
120
    /**
121
     * Deletes the member's information from the hard disc.
122
     */
123
    Result cleanup() const;
124
122
  private:
125
  private:
123
    OSyncMember *mMember;
126
    OSyncMember *mMember;
124
};
127
};
125
128
126
}
129
}
(-)kitchensync.orig/libqopensync/plugin.cpp (+1 lines)
Lines 18-27 Link Here
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
19
    Boston, MA 02110-1301, USA.
20
*/
20
*/
21
21
22
#include <opensync/opensync.h>
22
#include <opensync/opensync.h>
23
#include <opensync/opensync-plugin.h>
23
24
24
#include "plugin.h"
25
#include "plugin.h"
25
26
26
using namespace QSync;
27
using namespace QSync;
27
28
(-)kitchensync.orig/libqopensync/pluginenv.cpp (+96 lines)
Line 0 Link Here
1
/*
2
    This file is part of libqopensync.
3
4
    Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
5
    Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
6
7
    This library is free software; you can redistribute it and/or
8
    modify it under the terms of the GNU Library General Public
9
    License as published by the Free Software Foundation; either
10
    version 2 of the License, or (at your option) any later version.
11
12
    This library is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
    Library General Public License for more details.
16
17
    You should have received a copy of the GNU Library General Public License
18
    along with this library; see the file COPYING.LIB.  If not, write to
19
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
    Boston, MA 02110-1301, USA.
21
*/
22
23
#include <opensync/opensync.h>
24
#include <opensync/opensync-plugin.h>
25
26
#include "plugin.h"
27
#include "result.h"
28
29
#include "pluginenv.h"
30
31
using namespace QSync;
32
33
PluginEnv::PluginEnv()
34
{
35
  OSyncError *error = 0;
36
  mPluginEnv = osync_plugin_env_new( &error );
37
}
38
39
PluginEnv::~PluginEnv()
40
{
41
  osync_plugin_env_free( mPluginEnv );
42
}
43
44
Result PluginEnv::initialize()
45
{
46
  OSyncError *error = 0;
47
  if ( !osync_plugin_env_load( mPluginEnv, NULL, &error ) )
48
    return Result( &error );
49
  else
50
    return Result();
51
}
52
53
Result PluginEnv::finalize()
54
{
55
  osync_plugin_env_free( mPluginEnv ); 
56
  return Result();
57
}
58
59
int PluginEnv::pluginCount() const
60
{
61
  return osync_plugin_env_num_plugins( mPluginEnv );
62
}
63
64
Plugin PluginEnv::pluginAt( int pos ) const
65
{
66
  Plugin plugin;
67
68
  if ( pos < 0 || pos >= pluginCount() )
69
    return plugin;
70
71
  OSyncPlugin *oplugin = osync_plugin_env_nth_plugin( mPluginEnv, pos );
72
  plugin.mPlugin = oplugin;
73
74
  return plugin;
75
}
76
77
Plugin PluginEnv::pluginByName( const QString &name ) const
78
{
79
  Plugin plugin;
80
81
  OSyncPlugin *oplugin = osync_plugin_env_find_plugin( mPluginEnv, name.latin1() );
82
  if ( oplugin )
83
    plugin.mPlugin = oplugin;
84
85
  return plugin;
86
}
87
88
/*
89
Conversion PluginEnv::conversion() const
90
{
91
  Conversion conversion;
92
  conversion.mPluginEnv = mPluginEnv;
93
94
  return conversion;
95
}
96
*/
(-)kitchensync.orig/libqopensync/pluginenv.h (+80 lines)
Line 0 Link Here
1
/*
2
    This file is part of libqopensync.
3
4
    Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
5
    Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
6
7
    This library is free software; you can redistribute it and/or
8
    modify it under the terms of the GNU Library General Public
9
    License as published by the Free Software Foundation; either
10
    version 2 of the License, or (at your option) any later version.
11
12
    This library is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
    Library General Public License for more details.
16
17
    You should have received a copy of the GNU Library General Public License
18
    along with this library; see the file COPYING.LIB.  If not, write to
19
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
    Boston, MA 02110-1301, USA.
21
*/
22
23
#ifndef OSYNC_PLUGINENV_H
24
#define OSYNC_PLUGINENV_H
25
26
#include <qstring.h>
27
28
struct OSyncPluginEnv;
29
30
namespace QSync {
31
32
class Plugin;
33
class Result;
34
35
class PluginEnv
36
{
37
  public:
38
    PluginEnv();
39
    ~PluginEnv();
40
41
    /**
42
      Initializes the environment ( e.g. loads the groups and plugins ).
43
      Has to be called before the groups or plugins can be accessed.
44
     */
45
    Result initialize();
46
47
    /**
48
      Finalizes the environment ( e.g. unloads the groups and plugins ).
49
      Should be the last call before the object is deleted.
50
     */
51
    Result finalize();
52
53
    /**
54
      Returns the number of plugins.
55
     */
56
    int pluginCount() const;
57
58
    /**
59
      Returns the plugin at position @param pos.
60
     */
61
    Plugin pluginAt( int pos ) const;
62
63
    /**
64
      Returns a plugin by name or an invalid plugin when the plugin with this
65
      name doesn't exists.
66
     */
67
    Plugin pluginByName( const QString &name ) const;
68
69
    /**
70
      Returns the conversion object of this environment.
71
     */
72
//    Conversion conversion() const;
73
74
  private:
75
    OSyncPluginEnv *mPluginEnv;
76
};
77
78
}
79
80
#endif
(-)kitchensync.orig/libqopensync/plugin.h (-1 / +1 lines)
Lines 28-38 Link Here
28
28
29
namespace QSync {
29
namespace QSync {
30
30
31
class Plugin
31
class Plugin
32
{
32
{
33
  friend class Environment;
33
  friend class PluginEnv;
34
  friend class Member;
34
  friend class Member;
35
35
36
  public:
36
  public:
37
    Plugin();
37
    Plugin();
38
    ~Plugin();
38
    ~Plugin();
(-)kitchensync.orig/libqopensync/result.cpp (-1 / +1 lines)
Lines 98-108 Link Here
98
  mType = type;
98
  mType = type;
99
  mName = QString::fromUtf8( osync_error_get_name( error ) );
99
  mName = QString::fromUtf8( osync_error_get_name( error ) );
100
  mMessage = QString::fromUtf8( osync_error_print( error ) );
100
  mMessage = QString::fromUtf8( osync_error_print( error ) );
101
101
102
  if ( deleteError )
102
  if ( deleteError )
103
    osync_error_free( error );
103
    osync_error_unref( error );
104
}
104
}
105
105
106
Result::~Result()
106
Result::~Result()
107
{
107
{
108
}
108
}
(-)kitchensync.orig/libqopensync/syncchange.cpp (-17 / +34 lines)
Lines 17-28 Link Here
17
    along with this library; see the file COPYING.LIB.  If not, write to
17
    along with this library; see the file COPYING.LIB.  If not, write to
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
19
    Boston, MA 02110-1301, USA.
20
*/
20
*/
21
21
22
#include <stdlib.h>
23
22
#include <opensync/file.h>
24
#include <opensync/file.h>
25
23
#include <opensync/opensync.h>
26
#include <opensync/opensync.h>
27
#include <opensync/opensync-data.h>
28
#include <opensync/opensync-format.h>
24
29
25
#include "syncchange.h"
30
#include "syncchange.h"
26
31
27
using namespace QSync;
32
using namespace QSync;
28
33
Lines 62-134 Link Here
62
QString SyncChange::hash() const
67
QString SyncChange::hash() const
63
{
68
{
64
  return QString::fromUtf8( osync_change_get_hash( mSyncChange ) );
69
  return QString::fromUtf8( osync_change_get_hash( mSyncChange ) );
65
}
70
}
66
71
67
void SyncChange::setData( const QString &data )
72
void SyncChange::setData( const QString &data , OSyncObjFormat *format )
68
{
73
{
69
  osync_change_set_data( mSyncChange, const_cast<char*>( data.utf8().data() ), data.utf8().size(), true );
74
  OSyncError *error = 0;	
75
76
  OSyncData *odata = osync_data_new( const_cast<char*>( data.utf8().data() ), data.utf8().size(), format, &error );
77
  osync_change_set_data( mSyncChange, odata );
70
}
78
}
71
79
72
QString SyncChange::data() const
80
QString SyncChange::data() const
73
{
81
{
74
  int size = osync_change_get_datasize( mSyncChange );
82
  char *buf;
83
  unsigned int size;
84
85
  OSyncData *data = osync_change_get_data( mSyncChange );
86
87
  osync_data_get_data( data, &buf, &size );
75
88
76
  QString content;
89
  QString content;
77
  if ( objectFormatName() == "file" ) {
90
  if ( objectFormatName() == "file" ) {
78
    fileFormat *format = (fileFormat*)osync_change_get_data( mSyncChange );
91
    OSyncFileFormat *format = (OSyncFileFormat*) buf;
79
    if ( format )
92
    if ( format )
80
      content = QString::fromUtf8( format->data, format->size );
93
      content = QString::fromUtf8( format->data, format->size );
81
  } else
94
  } else
82
    content = QString::fromUtf8( osync_change_get_data( mSyncChange ), size );
95
    content = QString::fromUtf8( buf, size );
96
97
  free( buf );
83
98
84
  return content;
99
  return content;
85
}
100
}
86
101
87
bool SyncChange::hasData() const
102
bool SyncChange::hasData() const
88
{
103
{
89
  return osync_change_has_data( mSyncChange );
104
  return osync_data_has_data( osync_change_get_data( mSyncChange ) );
90
}
105
}
91
106
92
QString SyncChange::objectFormatName() const
107
QString SyncChange::objectFormatName() const
93
{
108
{
94
  OSyncObjFormat *format = osync_change_get_objformat( mSyncChange );
109
  OSyncObjFormat *format = osync_data_get_objformat( osync_change_get_data( mSyncChange ) );
95
  Q_ASSERT( format );
110
  Q_ASSERT( format );
96
111
97
  return QString::fromUtf8( osync_objformat_get_name( format ) );
112
  return QString::fromUtf8( osync_objformat_get_name( format ) );
98
}
113
}
99
114
115
/*
100
Member SyncChange::member() const
116
Member SyncChange::member() const
101
{
117
{
102
  OSyncMember *omember = osync_change_get_member( mSyncChange );
118
  OSyncMember *omember = osync_change_get_member( mSyncChange );
103
119
104
  Member m;
120
  Member m;
105
  m.mMember = omember;
121
  m.mMember = omember;
106
122
107
  return m;
123
  return m;
108
}
124
}
125
*/
109
126
110
void SyncChange::setChangeType( Type changeType )
127
void SyncChange::setChangeType( Type changeType )
111
{
128
{
112
  OSyncChangeType ochangeType;
129
  OSyncChangeType ochangeType;
113
130
114
  switch ( changeType ) {
131
  switch ( changeType ) {
115
    case AddedChange:
132
    case AddedChange:
116
      ochangeType = CHANGE_ADDED;
133
      ochangeType = OSYNC_CHANGE_TYPE_ADDED;
117
      break;
134
      break;
118
    case UnmodifiedChange:
135
    case UnmodifiedChange:
119
      ochangeType = CHANGE_UNMODIFIED;
136
      ochangeType = OSYNC_CHANGE_TYPE_UNMODIFIED;
120
      break;
137
      break;
121
    case DeletedChange:
138
    case DeletedChange:
122
      ochangeType = CHANGE_DELETED;
139
      ochangeType = OSYNC_CHANGE_TYPE_DELETED;
123
      break;
140
      break;
124
    case ModifiedChange:
141
    case ModifiedChange:
125
      ochangeType = CHANGE_MODIFIED;
142
      ochangeType = OSYNC_CHANGE_TYPE_MODIFIED;
126
      break;
143
      break;
127
    case UnknownChange:
144
    case UnknownChange:
128
    default:
145
    default:
129
      ochangeType = CHANGE_UNKNOWN;
146
      ochangeType = OSYNC_CHANGE_TYPE_UNKNOWN;
130
      break;
147
      break;
131
  }
148
  }
132
149
133
  osync_change_set_changetype( mSyncChange, ochangeType );
150
  osync_change_set_changetype( mSyncChange, ochangeType );
134
}
151
}
Lines 136-158 Link Here
136
SyncChange::Type SyncChange::changeType() const
153
SyncChange::Type SyncChange::changeType() const
137
{
154
{
138
  OSyncChangeType ochangeType = osync_change_get_changetype( mSyncChange );
155
  OSyncChangeType ochangeType = osync_change_get_changetype( mSyncChange );
139
156
140
  switch ( ochangeType ) {
157
  switch ( ochangeType ) {
141
    case CHANGE_ADDED:
158
    case OSYNC_CHANGE_TYPE_ADDED:
142
      return AddedChange;
159
      return AddedChange;
143
      break;
160
      break;
144
    case CHANGE_UNMODIFIED:
161
    case OSYNC_CHANGE_TYPE_UNMODIFIED:
145
      return UnmodifiedChange;
162
      return UnmodifiedChange;
146
      break;
163
      break;
147
    case CHANGE_DELETED:
164
    case OSYNC_CHANGE_TYPE_DELETED:
148
      return DeletedChange;
165
      return DeletedChange;
149
      break;
166
      break;
150
    case CHANGE_MODIFIED:
167
    case OSYNC_CHANGE_TYPE_MODIFIED:
151
      return ModifiedChange;
168
      return ModifiedChange;
152
      break;
169
      break;
153
    case CHANGE_UNKNOWN:
170
    case OSYNC_CHANGE_TYPE_UNKNOWN:
154
    default:
171
    default:
155
      return UnknownChange;
172
      return UnknownChange;
156
      break;
173
      break;
157
  }
174
  }
158
}
175
}
(-)kitchensync.orig/libqopensync/syncchange.h (-2 / +3 lines)
Lines 23-32 Link Here
23
#define QSYNC_SYNCCHANGE_H
23
#define QSYNC_SYNCCHANGE_H
24
24
25
#include <libqopensync/member.h>
25
#include <libqopensync/member.h>
26
26
27
class OSyncChange;
27
class OSyncChange;
28
class OSyncObjFormat;
28
29
29
namespace QSync {
30
namespace QSync {
30
31
31
class SyncChange
32
class SyncChange
32
{
33
{
Lines 72-82 Link Here
72
    QString hash() const;
73
    QString hash() const;
73
74
74
    /**
75
    /**
75
      Sets the data provided by the plugin.
76
      Sets the data provided by the plugin.
76
     */
77
     */
77
    void setData( const QString &data );
78
    void setData( const QString &data, OSyncObjFormat *format );
78
79
79
    /**
80
    /**
80
      Returns the data provided by the plugin.
81
      Returns the data provided by the plugin.
81
     */
82
     */
82
    QString data() const;
83
    QString data() const;
Lines 92-102 Link Here
92
    QString objectFormatName() const;
93
    QString objectFormatName() const;
93
94
94
    /**
95
    /**
95
      Returns the parent member of this change.
96
      Returns the parent member of this change.
96
     */
97
     */
97
    Member member() const;
98
//    Member member() const;
98
99
99
    /**
100
    /**
100
      Sets the change type.
101
      Sets the change type.
101
     */
102
     */
102
    void setChangeType( Type changeType );
103
    void setChangeType( Type changeType );
(-)kitchensync.orig/libqopensync/syncmapping.cpp (-18 / +25 lines)
Lines 18-100 Link Here
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
19
    Boston, MA 02110-1301, USA.
20
*/
20
*/
21
21
22
#include <qstring.h>
22
#include <qstring.h>
23
#include <osengine/engine.h>
23
#include <opensync/opensync.h>
24
#include <opensync/opensync-engine.h>
24
25
25
#include "syncmapping.h"
26
#include "syncmapping.h"
26
27
27
using namespace QSync;
28
using namespace QSync;
28
29
29
SyncMapping::SyncMapping()
30
SyncMapping::SyncMapping()
30
  : mEngine( 0 ), mMapping( 0 )
31
  : mEngine( 0 ), mMappingEngine( 0 )
31
{
32
{
32
}
33
}
33
34
34
SyncMapping::SyncMapping( OSyncMapping *mapping, OSyncEngine *engine )
35
SyncMapping::SyncMapping( OSyncMappingEngine *mapping, OSyncEngine *engine )
35
  : mEngine( engine ), mMapping( mapping )
36
  : mEngine( engine ), mMappingEngine( mapping )
36
{
37
{
37
}
38
}
38
39
39
SyncMapping::~SyncMapping()
40
SyncMapping::~SyncMapping()
40
{
41
{
41
}
42
}
42
43
43
bool SyncMapping::isValid() const
44
bool SyncMapping::isValid() const
44
{
45
{
45
  return ( mEngine != 0 && mMapping != 0 );
46
  return ( mEngine != 0 && mMappingEngine != 0 );
46
}
47
}
47
48
49
/*
48
long long SyncMapping::id() const
50
long long SyncMapping::id() const
49
{
51
{
50
  Q_ASSERT( mMapping );
52
  Q_ASSERT( mMappingEngine );
51
53
52
  return osengine_mapping_get_id( mMapping );
54
  return osync_mapping_engine_get_id( mMappingEngine );
53
}
55
}
56
*/
54
57
55
void SyncMapping::duplicate()
58
void SyncMapping::duplicate()
56
{
59
{
57
  Q_ASSERT( mEngine );
60
  Q_ASSERT( mEngine );
58
  Q_ASSERT( mMapping );
61
  Q_ASSERT( mMappingEngine );
62
63
  OSyncError *error = 0;
59
64
60
  osengine_mapping_duplicate( mEngine, mMapping );
65
  osync_mapping_engine_duplicate( mMappingEngine, &error );
61
}
66
}
62
67
63
void SyncMapping::solve( const SyncChange &change )
68
void SyncMapping::solve( const SyncChange &change )
64
{
69
{
65
  Q_ASSERT( mEngine );
70
  Q_ASSERT( mEngine );
66
  Q_ASSERT( mMapping );
71
  Q_ASSERT( mMappingEngine );
67
  Q_ASSERT( change.isValid() );
72
  Q_ASSERT( change.isValid() );
68
73
69
  osengine_mapping_solve( mEngine, mMapping, change.mSyncChange );
74
  OSyncError *error = 0;
75
76
  osync_mapping_engine_solve( mMappingEngine, change.mSyncChange, &error );
70
}
77
}
71
78
72
void SyncMapping::ignore()
79
void SyncMapping::ignore()
73
{
80
{
74
  Q_ASSERT( mEngine );
81
  Q_ASSERT( mEngine );
75
  Q_ASSERT( mMapping );
82
  Q_ASSERT( mMappingEngine );
76
83
77
  //TODO: error should be returned as Result
84
  //TODO: error should be returned as Result
78
  OSyncError *error = 0;
85
  OSyncError *error = 0;
79
  osengine_mapping_ignore_conflict( mEngine, mMapping, &error );
86
  osync_mapping_engine_ignore( mMappingEngine, &error );
80
}
87
}
81
88
82
int SyncMapping::changesCount() const
89
int SyncMapping::changesCount() const
83
{
90
{
84
  Q_ASSERT( mMapping );
91
  Q_ASSERT( mMappingEngine );
85
92
86
  return osengine_mapping_num_changes( mMapping );
93
  return osync_mapping_engine_num_changes( mMappingEngine );
87
}
94
}
88
95
89
SyncChange SyncMapping::changeAt( int pos )
96
SyncChange SyncMapping::changeAt( int pos )
90
{
97
{
91
  Q_ASSERT( mMapping );
98
  Q_ASSERT( mMappingEngine );
92
99
93
  if ( pos < 0 || pos >= osengine_mapping_num_changes( mMapping ) )
100
  if ( pos < 0 || pos >= osync_mapping_engine_num_changes( mMappingEngine ) )
94
    return SyncChange();
101
    return SyncChange();
95
102
96
  OSyncChange *ochange = osengine_mapping_nth_change( mMapping, pos );
103
  OSyncChange *ochange = osync_mapping_engine_nth_change( mMappingEngine, pos );
97
104
98
  return SyncChange( ochange );
105
  return SyncChange( ochange );
99
}
106
}
100
107
(-)kitchensync.orig/libqopensync/syncmapping.h (-3 / +3 lines)
Lines 23-43 Link Here
23
#define QSYNC_SYNCMAPPING_H
23
#define QSYNC_SYNCMAPPING_H
24
24
25
#include <libqopensync/syncchange.h>
25
#include <libqopensync/syncchange.h>
26
26
27
class OSyncEngine;
27
class OSyncEngine;
28
class OSyncMapping;
28
class OSyncMappingEngine;
29
29
30
namespace QSync {
30
namespace QSync {
31
31
32
class SyncMapping
32
class SyncMapping
33
{
33
{
34
  friend class SyncMappingUpdate;
34
  friend class SyncMappingUpdate;
35
35
36
  public:
36
  public:
37
    SyncMapping();
37
    SyncMapping();
38
    SyncMapping( OSyncMapping*, OSyncEngine* );
38
    SyncMapping( OSyncMappingEngine*, OSyncEngine* );
39
    ~SyncMapping();
39
    ~SyncMapping();
40
40
41
    bool isValid() const;
41
    bool isValid() const;
42
42
43
    long long id() const;
43
    long long id() const;
Lines 49-59 Link Here
49
    int changesCount() const;
49
    int changesCount() const;
50
    SyncChange changeAt( int pos );
50
    SyncChange changeAt( int pos );
51
51
52
  private:
52
  private:
53
    OSyncEngine *mEngine;
53
    OSyncEngine *mEngine;
54
    OSyncMapping *mMapping;
54
    OSyncMappingEngine *mMappingEngine;
55
};
55
};
56
56
57
}
57
}
58
58
59
#endif
59
#endif
(-)kitchensync.orig/libqopensync/syncupdates.cpp (-54 / +48 lines)
Lines 17-27 Link Here
17
    along with this library; see the file COPYING.LIB.  If not, write to
17
    along with this library; see the file COPYING.LIB.  If not, write to
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
19
    Boston, MA 02110-1301, USA.
20
*/
20
*/
21
21
22
#include <osengine/engine.h>
22
#include <opensync/opensync.h>
23
#include <opensync/opensync-engine.h>
23
24
24
#include "syncupdates.h"
25
#include "syncupdates.h"
25
26
26
using namespace QSync;
27
using namespace QSync;
27
28
Lines 30-65 Link Here
30
}
31
}
31
32
32
SyncMemberUpdate::SyncMemberUpdate( OSyncMemberUpdate *update )
33
SyncMemberUpdate::SyncMemberUpdate( OSyncMemberUpdate *update )
33
{
34
{
34
  switch ( update->type ) {
35
  switch ( update->type ) {
35
    case MEMBER_CONNECTED:
36
    case OSYNC_CLIENT_EVENT_CONNECTED:
36
      mType = Connected;
37
      mType = Connected;
37
      break;
38
      break;
38
    case MEMBER_SENT_CHANGES:
39
    case OSYNC_CLIENT_EVENT_DISCONNECTED:
39
      mType = SentChanges;
40
      break;
41
    case MEMBER_COMMITTED_ALL:
42
      mType = CommittedAll;
43
      break;
44
    case MEMBER_DISCONNECTED:
45
      mType = Disconnected;
40
      mType = Disconnected;
46
      break;
41
      break;
47
    case MEMBER_CONNECT_ERROR:
42
    case OSYNC_CLIENT_EVENT_READ:
48
      mType = ConnectError;
43
      mType = Read; 
49
      break;
44
      break;
50
    case MEMBER_GET_CHANGES_ERROR:
45
    case OSYNC_CLIENT_EVENT_WRITTEN:
51
      mType = GetChangesError;
46
      mType = Written;
52
      break;
47
      break;
53
    case MEMBER_COMMITTED_ALL_ERROR:
48
    case OSYNC_CLIENT_EVENT_SYNC_DONE:
54
      mType = CommittedAllError;
49
      mType = SyncDone;
55
      break;
50
      break;
56
    case MEMBER_SYNC_DONE_ERROR:
51
    case OSYNC_CLIENT_EVENT_DISCOVERED:
57
      mType = SyncDoneError;
52
      mType = Discovered;
58
      break;
53
      break;
59
    case MEMBER_DISCONNECT_ERROR:
54
    case OSYNC_CLIENT_EVENT_ERROR:
60
      mType = DisconnectedError;
55
      mType = Error;
61
      break;
56
      break;
62
  }
57
  }
63
58
64
  if ( update->error )
59
  if ( update->error )
65
    mResult = Result( &(update->error) );
60
    mResult = Result( &(update->error) );
Lines 92-123 Link Here
92
}
87
}
93
88
94
SyncChangeUpdate::SyncChangeUpdate( OSyncChangeUpdate *update )
89
SyncChangeUpdate::SyncChangeUpdate( OSyncChangeUpdate *update )
95
{
90
{
96
  switch ( update->type ) {
91
  switch ( update->type ) {
97
    case CHANGE_RECEIVED:
92
    case OSYNC_CHANGE_EVENT_READ:
98
      mType = Received;
93
      mType = Read;
99
      break;
100
    case CHANGE_RECEIVED_INFO:
101
      mType = ReceivedInfo;
102
      break;
94
      break;
103
    case CHANGE_SENT:
95
    case OSYNC_CHANGE_EVENT_WRITTEN:
104
      mType = Sent;
96
      mType = Written;
105
      break;
97
      break;
106
    case CHANGE_WRITE_ERROR:
98
    case OSYNC_CHANGE_EVENT_ERROR:
107
      mType = WriteError;
99
      mType = Error;
108
      break;
109
    case CHANGE_RECV_ERROR:
110
      mType = ReceiveError;
111
      break;
100
      break;
112
  }
101
  }
113
102
114
  if ( update->error )
103
  if ( update->error )
115
    mResult = Result( &(update->error) );
104
    mResult = Result( &(update->error) );
116
105
117
  mChange = SyncChange( update->change );
106
  mChange = SyncChange( update->change );
118
  mMemberId = update->member_id;
107
  mMember.mMember = update->member;
119
  mMappingId = update->mapping_id;
108
  mMappingId = update->mapping_id;
120
}
109
}
121
110
122
SyncChangeUpdate::~SyncChangeUpdate()
111
SyncChangeUpdate::~SyncChangeUpdate()
123
{
112
{
Lines 136-148 Link Here
136
SyncChange SyncChangeUpdate::change() const
125
SyncChange SyncChangeUpdate::change() const
137
{
126
{
138
  return mChange;
127
  return mChange;
139
}
128
}
140
129
141
int SyncChangeUpdate::memberId() const
130
Member SyncChangeUpdate::member() const
142
{
131
{
143
  return mMemberId;
132
  return mMember;
144
}
133
}
145
134
146
int SyncChangeUpdate::mappingId() const
135
int SyncChangeUpdate::mappingId() const
147
{
136
{
148
  return mMappingId;
137
  return mMappingId;
Lines 153-179 Link Here
153
}
142
}
154
143
155
SyncMappingUpdate::SyncMappingUpdate( OSyncMappingUpdate *update, OSyncEngine *engine )
144
SyncMappingUpdate::SyncMappingUpdate( OSyncMappingUpdate *update, OSyncEngine *engine )
156
{
145
{
157
  switch ( update->type ) {
146
  switch ( update->type ) {
158
    case MAPPING_SOLVED:
147
    case OSYNC_MAPPING_EVENT_SOLVED:
159
      mType = Solved;
148
      mType = Solved;
160
      break;
149
      break;
161
    case MAPPING_SYNCED:
150
//    case OSYNC_MAPPING_EVENT_SYNCED:
162
      mType = Synced;
151
  //    mType = Synced;
163
      break;
152
    //  break;
164
    case MAPPING_WRITE_ERROR:
153
    case OSYNC_MAPPING_EVENT_ERROR:
165
      mType = WriteError;
154
      mType = Error;
166
      break;
155
      break;
167
  }
156
  }
168
157
169
  if ( update->error )
158
  if ( update->error )
170
    mResult = Result( &(update->error) );
159
    mResult = Result( &(update->error) );
171
160
172
  mWinner = update->winner;
161
  mWinner = update->winner;
173
  mMapping.mEngine = engine;
162
  mMapping.mEngine = engine;
174
  mMapping.mMapping = update->mapping;
163
164
  // TODO PORTING
165
//  mMapping.mMapping = update->mapping;
175
}
166
}
176
167
177
SyncMappingUpdate::~SyncMappingUpdate()
168
SyncMappingUpdate::~SyncMappingUpdate()
178
{
169
{
179
}
170
}
Lines 203-236 Link Here
203
}
194
}
204
195
205
SyncEngineUpdate::SyncEngineUpdate( OSyncEngineUpdate *update )
196
SyncEngineUpdate::SyncEngineUpdate( OSyncEngineUpdate *update )
206
{
197
{
207
  switch ( update->type ) {
198
  switch ( update->type ) {
208
    case ENG_ENDPHASE_CON:
199
    case OSYNC_ENGINE_EVENT_CONNECTED:
209
      mType = EndPhaseConnected;
200
      mType = Connected;
210
      break;
201
      break;
211
    case ENG_ENDPHASE_READ:
202
    case OSYNC_ENGINE_EVENT_READ:
212
      mType = EndPhaseRead;
203
      mType = Read;
213
      break;
204
      break;
214
    case ENG_ENDPHASE_WRITE:
205
    case OSYNC_ENGINE_EVENT_WRITTEN:
215
      mType = EndPhaseWrite;
206
      mType = Written;
216
      break;
207
      break;
217
    case ENG_ENDPHASE_DISCON:
208
    case OSYNC_ENGINE_EVENT_DISCONNECTED: 
218
      mType = EndPhaseDisconnected;
209
      mType = Disconnected;
219
      break;
210
      break;
220
    case ENG_ERROR:
211
    case OSYNC_ENGINE_EVENT_ERROR:
221
      mType = Error;
212
      mType = Error;
222
      break;
213
      break;
223
    case ENG_SYNC_SUCCESSFULL:
214
    case OSYNC_ENGINE_EVENT_SUCCESSFUL:
224
      mType = SyncSuccessfull;
215
      mType = SyncSuccessful;
225
      break;
216
      break;
226
    case ENG_PREV_UNCLEAN:
217
    case OSYNC_ENGINE_EVENT_PREV_UNCLEAN:
227
      mType = PrevUnclean;
218
      mType = PrevUnclean;
228
      break;
219
      break;
229
    case ENG_END_CONFLICTS:
220
    case OSYNC_ENGINE_EVENT_END_CONFLICTS:
230
      mType = EndConflicts;
221
      mType = EndConflicts;
231
      break;
222
      break;
223
    case OSYNC_ENGINE_EVENT_SYNC_DONE:
224
      mType = SyncDone;
225
      break;
232
  }
226
  }
233
227
234
  if ( update->error )
228
  if ( update->error )
235
    mResult = Result( &(update->error) );
229
    mResult = Result( &(update->error) );
236
}
230
}
(-)kitchensync.orig/libqopensync/syncupdates.h (-22 / +19 lines)
Lines 40-57 Link Here
40
  friend class CallbackHandler;
40
  friend class CallbackHandler;
41
41
42
  public:
42
  public:
43
    enum Type {
43
    enum Type {
44
      Connected,
44
      Connected,
45
      SentChanges,
46
      CommittedAll,
47
      Disconnected,
45
      Disconnected,
48
      ConnectError,
46
      Read,
49
      GetChangesError,
47
      Written,
50
      CommittedAllError,
48
      SyncDone,
51
      SyncDoneError,
49
      Discovered,
52
      DisconnectedError
50
      Error
53
    };
51
    };
54
52
55
    SyncMemberUpdate();
53
    SyncMemberUpdate();
56
    SyncMemberUpdate( OSyncMemberUpdate* );
54
    SyncMemberUpdate( OSyncMemberUpdate* );
57
    ~SyncMemberUpdate();
55
    ~SyncMemberUpdate();
Lines 70-113 Link Here
70
{
68
{
71
  friend class CallbackHandler;
69
  friend class CallbackHandler;
72
70
73
  public:
71
  public:
74
    enum Type {
72
    enum Type {
75
      Received = 1,
73
      Read = 1,
76
      ReceivedInfo,
74
      Written,
77
      Sent,
75
      Error
78
      WriteError,
79
      ReceiveError
80
    };
76
    };
81
77
82
    SyncChangeUpdate();
78
    SyncChangeUpdate();
83
    SyncChangeUpdate( OSyncChangeUpdate* );
79
    SyncChangeUpdate( OSyncChangeUpdate* );
84
    ~SyncChangeUpdate();
80
    ~SyncChangeUpdate();
85
81
86
    Type type() const;
82
    Type type() const;
87
    Result result() const;
83
    Result result() const;
88
    SyncChange change() const;
84
    SyncChange change() const;
89
    int memberId() const;
85
    Member member() const;
90
    int mappingId() const;
86
    int mappingId() const;
91
87
92
  private:
88
  private:
93
    Type mType;
89
    Type mType;
94
    Result mResult;
90
    Result mResult;
95
    SyncChange mChange;
91
    SyncChange mChange;
96
    int mMemberId;
92
    Member mMember;
97
    int mMappingId;
93
    int mMappingId;
98
};
94
};
99
95
100
class SyncMappingUpdate
96
class SyncMappingUpdate
101
{
97
{
102
  friend class CallbackHandler;
98
  friend class CallbackHandler;
103
99
104
  public:
100
  public:
105
    enum Type {
101
    enum Type {
106
      Solved = 1,
102
      Solved = 1,
107
      Synced,
103
      //Synced,
108
      WriteError
104
      Error
109
    };
105
    };
110
106
111
    SyncMappingUpdate();
107
    SyncMappingUpdate();
112
    SyncMappingUpdate( OSyncMappingUpdate*, OSyncEngine* );
108
    SyncMappingUpdate( OSyncMappingUpdate*, OSyncEngine* );
113
    ~SyncMappingUpdate();
109
    ~SyncMappingUpdate();
Lines 128-145 Link Here
128
{
124
{
129
  friend class CallbackHandler;
125
  friend class CallbackHandler;
130
126
131
  public:
127
  public:
132
    enum Type {
128
    enum Type {
133
      EndPhaseConnected = 1,
129
      Connected = 1,
134
      EndPhaseRead,
130
      Read,
135
      EndPhaseWrite,
131
      Written,
136
      EndPhaseDisconnected,
132
      Disconnected,
137
      Error,
133
      Error,
138
      SyncSuccessfull,
134
      SyncSuccessful,
139
      PrevUnclean,
135
      PrevUnclean,
140
      EndConflicts
136
      EndConflicts,
137
      SyncDone
141
    };
138
    };
142
139
143
    SyncEngineUpdate();
140
    SyncEngineUpdate();
144
    SyncEngineUpdate( OSyncEngineUpdate* );
141
    SyncEngineUpdate( OSyncEngineUpdate* );
145
    ~SyncEngineUpdate();
142
    ~SyncEngineUpdate();
(-)kitchensync.orig/src/configguifile.cpp (-14 / +26 lines)
Lines 53-81 Link Here
53
void ConfigGuiFile::load( const QString &xml )
53
void ConfigGuiFile::load( const QString &xml )
54
{
54
{
55
  QDomDocument doc;
55
  QDomDocument doc;
56
  doc.setContent( xml );
56
  doc.setContent( xml );
57
  QDomElement docElement = doc.documentElement();
57
  QDomElement docElement = doc.documentElement();
58
  QDomNode n;
58
59
  for( n = docElement.firstChild(); !n.isNull(); n = n.nextSibling() ) {
59
  QDomNode node;
60
    QDomElement e = n.toElement();
60
  for ( node = docElement.firstChild(); !node.isNull(); node = node.nextSibling() ) {
61
    if ( e.tagName() == "path" ) {
61
    QDomElement e = node.toElement();
62
      mFilename->setURL( e.text() );
62
    if ( e.tagName() == "directory" ) {
63
    } else if ( e.tagName() == "recursive" ) {
63
      QDomNode subNode;
64
      mRecursive->setChecked( e.text() == "TRUE" );
64
      for ( subNode = e.firstChild(); !subNode.isNull(); subNode = subNode.nextSibling() ) {
65
        QDomElement subElement = subNode.toElement();
66
        if ( subElement.tagName() == "path" ) {
67
          mFilename->setURL( subElement.text() );
68
        } else if ( subElement.tagName() == "recursive" ) {
69
          mRecursive->setChecked( subElement.text() == "TRUE" );
70
        }
71
      }
65
    }
72
    }
66
  }
73
  }
67
}
74
}
68
75
69
QString ConfigGuiFile::save() const
76
QString ConfigGuiFile::save() const
70
{
77
{
71
  QString xml;
78
  QString xml;
72
  xml = "<config>";
79
  xml = "<config>\n";
73
  xml += "<path>" + mFilename->url() + "</path>";
80
  xml += "  <directory>\n";
74
  xml += "<recursive>";
81
  xml += "    <path>" + mFilename->url() + "</path>\n";
75
  if ( mRecursive->isChecked() ) xml += "TRUE";
82
  xml += "    <objtype>data</objtype>\n";
76
  else xml += "FALSE";
83
  xml += "    <recursive>";
77
  xml += "</recursive>";
84
  if ( mRecursive->isChecked() )
78
  xml += "</config>";
85
    xml += "TRUE";
86
  else
87
    xml += "FALSE";
88
  xml += "</recursive>\n";
89
  xml += "  </directory>\n";
90
  xml += "</config>\n";
79
91
80
  return xml;
92
  return xml;
81
}
93
}
(-)kitchensync.orig/src/configguisyncmlhttp.cpp (-2 / +2 lines)
Lines 119-138 Link Here
119
  // recvLimit
119
  // recvLimit
120
  label = new QLabel( i18n("Receive Limit:"), optionWidget );
120
  label = new QLabel( i18n("Receive Limit:"), optionWidget );
121
  mGridLayout->addWidget( label, 5, 0 );
121
  mGridLayout->addWidget( label, 5, 0 );
122
122
123
  mRecvLimit = new QSpinBox( optionWidget );
123
  mRecvLimit = new QSpinBox( optionWidget );
124
  mRecvLimit->setMinValue( 1 );
124
  mRecvLimit->setMinValue( 0 );
125
  mRecvLimit->setMaxValue( 65536 );
125
  mRecvLimit->setMaxValue( 65536 );
126
  mGridLayout->addWidget( mRecvLimit, 5, 1 );
126
  mGridLayout->addWidget( mRecvLimit, 5, 1 );
127
127
128
  // maxObjSize 
128
  // maxObjSize 
129
  label = new QLabel( i18n("Maximum Object Size"), optionWidget );
129
  label = new QLabel( i18n("Maximum Object Size"), optionWidget );
130
  mGridLayout->addWidget( label, 6, 0 );
130
  mGridLayout->addWidget( label, 6, 0 );
131
131
132
  mMaxObjSize = new QSpinBox( optionWidget );
132
  mMaxObjSize = new QSpinBox( optionWidget );
133
  mMaxObjSize->setMinValue( 1 );
133
  mMaxObjSize->setMinValue( 0 );
134
  mMaxObjSize->setMaxValue( 65536 );
134
  mMaxObjSize->setMaxValue( 65536 );
135
  mGridLayout->addWidget( mMaxObjSize, 6, 1 );
135
  mGridLayout->addWidget( mMaxObjSize, 6, 1 );
136
136
137
  topLayout()->addStretch( 1 );
137
  topLayout()->addStretch( 1 );
138
}
138
}
(-)kitchensync.orig/src/configguisyncmlobex.cpp (-2 / +2 lines)
Lines 151-170 Link Here
151
  // recvLimit
151
  // recvLimit
152
  label = new QLabel( i18n("Receive Limit:"), optionsWidget );
152
  label = new QLabel( i18n("Receive Limit:"), optionsWidget );
153
  mGridLayout->addWidget( label, 14, 0 );
153
  mGridLayout->addWidget( label, 14, 0 );
154
154
155
  mRecvLimit = new QSpinBox( optionsWidget );
155
  mRecvLimit = new QSpinBox( optionsWidget );
156
  mRecvLimit->setMinValue( 1 );
156
  mRecvLimit->setMinValue( 0 );
157
  mRecvLimit->setMaxValue( 65536 );
157
  mRecvLimit->setMaxValue( 65536 );
158
  mGridLayout->addWidget( mRecvLimit, 14, 1 );
158
  mGridLayout->addWidget( mRecvLimit, 14, 1 );
159
159
160
  // maxObjSize
160
  // maxObjSize
161
  label = new QLabel( i18n("Maximum Object Size"), optionsWidget );
161
  label = new QLabel( i18n("Maximum Object Size"), optionsWidget );
162
  mGridLayout->addWidget( label, 15, 0 );
162
  mGridLayout->addWidget( label, 15, 0 );
163
163
164
  mMaxObjSize = new QSpinBox( optionsWidget );
164
  mMaxObjSize = new QSpinBox( optionsWidget );
165
  mMaxObjSize->setMinValue( 1 );
165
  mMaxObjSize->setMinValue( 0 );
166
  mMaxObjSize->setMaxValue( 65536 );
166
  mMaxObjSize->setMaxValue( 65536 );
167
  mGridLayout->addWidget( mMaxObjSize, 15, 1 );
167
  mGridLayout->addWidget( mMaxObjSize, 15, 1 );
168
168
169
  topLayout()->addStretch( 1 );
169
  topLayout()->addStretch( 1 );
170
}
170
}
(-)kitchensync.orig/src/groupconfigcommon.cpp (-7 / +14 lines)
Lines 28-45 Link Here
28
#include <qlabel.h>
28
#include <qlabel.h>
29
#include <qlayout.h>
29
#include <qlayout.h>
30
#include <qcheckbox.h>
30
#include <qcheckbox.h>
31
31
32
#include <libqopensync/group.h>
32
#include <libqopensync/group.h>
33
#include <libqopensync/conversion.h>
33
//#include <libqopensync/conversion.h>
34
#include <libqopensync/environment.h>
35
34
36
#include "syncprocess.h"
35
#include "syncprocess.h"
37
#include "syncprocessmanager.h"
36
#include "syncprocessmanager.h"
38
37
39
#include "groupconfigcommon.h"
38
#include "groupconfigcommon.h"
40
39
40
// TODO: port ObjectTypeSelector to ported solution of Conversation class
41
#if 0
41
ObjectTypeSelector::ObjectTypeSelector( QWidget *parent )
42
ObjectTypeSelector::ObjectTypeSelector( QWidget *parent )
42
  : QWidget( parent )
43
  : QWidget( parent )
43
{
44
{
44
  QGridLayout *layout = new QGridLayout( this );
45
  QGridLayout *layout = new QGridLayout( this );
45
  layout->setMargin( 0 );
46
  layout->setMargin( 0 );
Lines 122-131 Link Here
122
  objectTypes.append( "data" );
123
  objectTypes.append( "data" );
123
124
124
  QSync::GroupConfig config = group.config();
125
  QSync::GroupConfig config = group.config();
125
  config.setActiveObjectTypes( objectTypes );
126
  config.setActiveObjectTypes( objectTypes );
126
}
127
}
128
#endif
127
129
128
GroupConfigCommon::GroupConfigCommon( QWidget *parent )
130
GroupConfigCommon::GroupConfigCommon( QWidget *parent )
129
  : QWidget( parent )
131
  : QWidget( parent )
130
{
132
{
131
  QGridLayout *layout = new QGridLayout( this, 2, 2, KDialog::marginHint(), KDialog::spacingHint() );
133
  QGridLayout *layout = new QGridLayout( this, 2, 2, KDialog::marginHint(), KDialog::spacingHint() );
Lines 133-158 Link Here
133
  layout->addWidget( new QLabel( i18n( "Name:" ), this ), 0, 0 );
135
  layout->addWidget( new QLabel( i18n( "Name:" ), this ), 0, 0 );
134
136
135
  mGroupName = new KLineEdit( this );
137
  mGroupName = new KLineEdit( this );
136
  layout->addWidget( mGroupName, 0, 1 );
138
  layout->addWidget( mGroupName, 0, 1 );
137
139
138
  layout->addWidget( new QLabel( i18n( "Object Types to be Synchronized:"), this ), 1, 0, Qt::AlignTop );
140
  //layout->addWidget( new QLabel( i18n( "Object Types to be Synchronized:"), this ), 1, 0, Qt::AlignTop );
139
141
140
  mObjectTypeSelector = new ObjectTypeSelector( this );
142
  // TODO port ObjectTypeSelector class..
141
  layout->addWidget( mObjectTypeSelector, 1, 1 );
143
  //mObjectTypeSelector = new ObjectTypeSelector( this );
144
  //layout->addWidget( mObjectTypeSelector, 1, 1 );
142
145
143
  layout->setRowStretch( 2, 1 );
146
  layout->setRowStretch( 2, 1 );
144
}
147
}
145
148
146
void GroupConfigCommon::setSyncProcess( SyncProcess *syncProcess )
149
void GroupConfigCommon::setSyncProcess( SyncProcess *syncProcess )
147
{
150
{
148
  mSyncProcess = syncProcess;
151
  mSyncProcess = syncProcess;
149
152
150
  mGroupName->setText( mSyncProcess->group().name() );
153
  mGroupName->setText( mSyncProcess->group().name() );
151
  mObjectTypeSelector->load( mSyncProcess->group() );
154
155
  // TODO port ObjectTypeSelector class..
156
  //mObjectTypeSelector->load( mSyncProcess->group() );
152
}
157
}
153
158
154
void GroupConfigCommon::save()
159
void GroupConfigCommon::save()
155
{
160
{
156
  mSyncProcess->group().setName( mGroupName->text() );
161
  mSyncProcess->group().setName( mGroupName->text() );
157
  mObjectTypeSelector->save( mSyncProcess->group() );
162
163
  // TODO port ObjectTypeSelector class..
164
  //mObjectTypeSelector->save( mSyncProcess->group() );
158
}
165
}
(-)kitchensync.orig/src/groupconfigcommon.h (-1 / +4 lines)
Lines 28-37 Link Here
28
28
29
class KLineEdit;
29
class KLineEdit;
30
class SyncProcess;
30
class SyncProcess;
31
class QCheckBox;
31
class QCheckBox;
32
32
33
//TODO: Conversation needs to be ported before...
34
#if 0
33
class ObjectTypeSelector : public QWidget
35
class ObjectTypeSelector : public QWidget
34
{
36
{
35
  public:
37
  public:
36
    ObjectTypeSelector( QWidget *parent );
38
    ObjectTypeSelector( QWidget *parent );
37
39
Lines 39-48 Link Here
39
    void save( QSync::Group group );
41
    void save( QSync::Group group );
40
42
41
  private:
43
  private:
42
    QMap<QString,QCheckBox *> mObjectTypeChecks;
44
    QMap<QString,QCheckBox *> mObjectTypeChecks;
43
};
45
};
46
#endif
44
47
45
class GroupConfigCommon : public QWidget
48
class GroupConfigCommon : public QWidget
46
{
49
{
47
  public:
50
  public:
48
    GroupConfigCommon( QWidget *parent );
51
    GroupConfigCommon( QWidget *parent );
Lines 50-60 Link Here
50
    void setSyncProcess( SyncProcess *syncProcess );
53
    void setSyncProcess( SyncProcess *syncProcess );
51
    void save();
54
    void save();
52
55
53
  private:
56
  private:
54
    KLineEdit *mGroupName;
57
    KLineEdit *mGroupName;
55
    ObjectTypeSelector *mObjectTypeSelector;
58
  //  ObjectTypeSelector *mObjectTypeSelector;
56
59
57
    SyncProcess *mSyncProcess;
60
    SyncProcess *mSyncProcess;
58
};
61
};
59
62
60
#endif
63
#endif
(-)kitchensync.orig/src/groupconfig.cpp (-17 / +41 lines)
Lines 25-36 Link Here
25
#include "memberinfo.h"
25
#include "memberinfo.h"
26
#include "pluginpicker.h"
26
#include "pluginpicker.h"
27
#include "syncprocess.h"
27
#include "syncprocess.h"
28
#include "syncprocessmanager.h"
28
#include "syncprocessmanager.h"
29
29
30
#include <libqopensync/engine.h>
30
#include <libqopensync/group.h>
31
#include <libqopensync/group.h>
31
#include <libqopensync/plugin.h>
32
#include <libqopensync/plugin.h>
33
#include <libqopensync/result.h>
32
34
33
#include <kdialog.h>
35
#include <kdialog.h>
34
#include <kiconloader.h>
36
#include <kiconloader.h>
35
#include <kjanuswidget.h>
37
#include <kjanuswidget.h>
36
#include <klocale.h>
38
#include <klocale.h>
Lines 38-47 Link Here
38
40
39
41
40
#include <qlabel.h>
42
#include <qlabel.h>
41
#include <qlayout.h>
43
#include <qlayout.h>
42
#include <qpushbutton.h>
44
#include <qpushbutton.h>
45
#include <qtimer.h>
43
46
44
GroupConfig::GroupConfig( QWidget *parent )
47
GroupConfig::GroupConfig( QWidget *parent )
45
  : QWidget( parent )
48
  : QWidget( parent )
46
{
49
{
47
  QBoxLayout *topLayout = new QVBoxLayout( this );
50
  QBoxLayout *topLayout = new QVBoxLayout( this );
Lines 82-106 Link Here
82
  nameLayout->addStretch( 1 );
85
  nameLayout->addStretch( 1 );
83
86
84
  mMemberView = new KJanusWidget( this, 0, KJanusWidget::IconList );
87
  mMemberView = new KJanusWidget( this, 0, KJanusWidget::IconList );
85
  topLayout->addWidget( mMemberView );
88
  topLayout->addWidget( mMemberView );
86
89
87
  QBoxLayout *buttonLayout = new QHBoxLayout( topLayout );
88
89
  QPushButton *addButton = new QPushButton( i18n("Add Member..."), this );
90
  connect( addButton, SIGNAL( clicked() ), SLOT( addMember() ) );
91
  buttonLayout->addWidget( addButton );
92
93
  buttonLayout->addStretch( 1 );
94
95
  icon = KGlobal::iconLoader()->loadIcon( "bookmark", KIcon::Desktop );
90
  icon = KGlobal::iconLoader()->loadIcon( "bookmark", KIcon::Desktop );
96
  QFrame *page = mMemberView->addPage( i18n("Group"),
91
  QFrame *page = mMemberView->addPage( i18n("Group"),
97
    i18n("General Group Settings"), icon );
92
    i18n("General Group Settings"), icon );
98
  QBoxLayout *pageLayout = new QVBoxLayout( page );
93
  QBoxLayout *pageLayout = new QVBoxLayout( page );
99
94
100
  mCommonConfig = new GroupConfigCommon( page );
95
  mCommonConfig = new GroupConfigCommon( page );
101
  pageLayout->addWidget( mCommonConfig );
96
  pageLayout->addWidget( mCommonConfig );
97
98
  connect( mMemberView, SIGNAL( aboutToShowPage( QWidget* ) ), SLOT( memberWidgetSelected( QWidget* ) ) );
102
}
99
}
103
100
104
void GroupConfig::setSyncProcess( SyncProcess *process )
101
void GroupConfig::setSyncProcess( SyncProcess *process )
105
{
102
{
106
  mProcess = process;
103
  mProcess = process;
Lines 111-164 Link Here
111
  updateMembers();
108
  updateMembers();
112
}
109
}
113
110
114
void GroupConfig::updateMembers()
111
void GroupConfig::updateMembers()
115
{
112
{
116
  QValueList<MemberConfig *>::ConstIterator memberIt;
113
  QMap<QWidget*, MemberConfig *>::ConstIterator memberIt;
117
  for ( memberIt = mMemberConfigs.begin(); memberIt != mMemberConfigs.end(); ++memberIt )
114
  for ( memberIt = mMemberConfigs.begin(); memberIt != mMemberConfigs.end(); ++memberIt )
118
    (*memberIt)->saveData();
115
    memberIt.data()->saveData();
119
116
120
  QValueList<QFrame *>::ConstIterator it2;
117
  QValueList<QFrame *>::ConstIterator it2;
121
  for ( it2 = mConfigPages.begin(); it2 != mConfigPages.end(); ++it2 ) {
118
  for ( it2 = mConfigPages.begin(); it2 != mConfigPages.end(); ++it2 ) {
122
    mMemberView->removePage( *it2 );
119
    mMemberView->removePage( *it2 );
123
    delete *it2;
120
    delete *it2;
124
  }
121
  }
125
  mConfigPages.clear();
122
  mConfigPages.clear();
126
  mMemberConfigs.clear();
123
  mMemberConfigs.clear();
127
124
128
  QSync::Group group = mProcess->group();
125
  const QSync::Group group = mProcess->group();
129
  QSync::Group::Iterator it( group.begin() );
126
  for ( int i = 0; i < group.memberCount(); ++i ) {
130
  for ( ; it != group.end(); ++it ) {
127
    QSync::Member member = group.memberAt( i );
131
    QSync::Member member = *it;
132
    MemberInfo mi( member );
128
    MemberInfo mi( member );
133
    QFrame *page = mMemberView->addPage( mi.name(), 
129
    QFrame *page = mMemberView->addPage( mi.name(), 
134
      QString( "%1 (%2)" ).arg( mi.name() ).arg(member.pluginName()), mi.desktopIcon() );
130
      QString( "%1 (%2)" ).arg( mi.name() ).arg(member.pluginName()), mi.desktopIcon() );
135
131
136
    QBoxLayout *pageLayout = new QVBoxLayout( page );
132
    QBoxLayout *pageLayout = new QVBoxLayout( page );
137
    mConfigPages.append( page );
133
    mConfigPages.append( page );
138
134
139
    MemberConfig *memberConfig = new MemberConfig( page, member );
135
    MemberConfig *memberConfig = new MemberConfig( page, member );
140
    mMemberConfigs.append( memberConfig );
136
    mMemberConfigs.insert( page, memberConfig );
141
    pageLayout->addWidget( memberConfig );
137
    pageLayout->addWidget( memberConfig );
142
138
143
    memberConfig->loadData();
139
    memberConfig->loadData();
144
  }
140
  }
145
}
141
}
146
142
147
void GroupConfig::saveConfig()
143
void GroupConfig::saveConfig()
148
{
144
{
149
  mProcess->group().save();
145
  mProcess->group().save();
150
146
151
  QValueList<MemberConfig *>::ConstIterator it;
147
  QMap<QWidget*, MemberConfig*>::ConstIterator it;
152
  for ( it = mMemberConfigs.begin(); it != mMemberConfigs.end(); ++it )
148
  for ( it = mMemberConfigs.begin(); it != mMemberConfigs.end(); ++it )
153
    (*it)->saveData();
149
    it.data()->saveData();
154
150
155
  mCommonConfig->save();
151
  mCommonConfig->save();
156
152
153
  const QSync::Group group = mProcess->group();
154
  for ( int i = 0; i < group.memberCount(); ++i ) {
155
    const QSync::Member member = group.memberAt( i );
156
    mProcess->engine()->discover( member );
157
  }
158
157
  mProcess->reinitEngine();
159
  mProcess->reinitEngine();
158
}
160
}
159
161
162
void GroupConfig::memberWidgetSelected( QWidget *wdg )
163
{
164
  /**
165
   * Emit 'true' whenever a real member widget is selected by the
166
   * user.
167
   */
168
  emit memberSelected( wdg != mCommonConfig->parentWidget() );
169
}
170
160
void GroupConfig::addMember()
171
void GroupConfig::addMember()
161
{
172
{
162
  QSync::Plugin plugin = PluginPickerDialog::getPlugin( this );
173
  QSync::Plugin plugin = PluginPickerDialog::getPlugin( this );
163
174
164
  if ( plugin.isValid() ) {
175
  if ( plugin.isValid() ) {
Lines 174-179 Link Here
174
      mMemberView->showPage( index );
185
      mMemberView->showPage( index );
175
    }
186
    }
176
  }
187
  }
177
}
188
}
178
189
190
void GroupConfig::removeMember()
191
{
192
  QWidget *selectedWidget = mMemberView->pageWidget( mMemberView->activePageIndex() );
193
  if ( selectedWidget && mMemberConfigs.contains( selectedWidget ) ) {
194
    MemberConfig *config = mMemberConfigs[ selectedWidget ];
195
196
    SyncProcessManager::self()->removeMember( mProcess, config->member() );
197
    mMemberConfigs.remove( selectedWidget );
198
199
    QTimer::singleShot( 0, this, SLOT( updateMembers() ) );
200
  }
201
}
202
179
#include "groupconfig.moc"
203
#include "groupconfig.moc"
(-)kitchensync.orig/src/groupconfigdialog.cpp (-1 / +23 lines)
Lines 26-36 Link Here
26
26
27
#include <qlayout.h>
27
#include <qlayout.h>
28
28
29
GroupConfigDialog::GroupConfigDialog( QWidget *parent, SyncProcess *process )
29
GroupConfigDialog::GroupConfigDialog( QWidget *parent, SyncProcess *process )
30
  : KDialogBase( parent, 0, true, i18n("Configure Synchronization Group"),
30
  : KDialogBase( parent, 0, true, i18n("Configure Synchronization Group"),
31
     Ok )
31
     Ok | User1 | User2, Ok )
32
{
32
{
33
  QFrame *topFrame = makeMainWidget();
33
  QFrame *topFrame = makeMainWidget();
34
34
35
  QBoxLayout *topLayout = new QVBoxLayout( topFrame );
35
  QBoxLayout *topLayout = new QVBoxLayout( topFrame );
36
36
Lines 38-47 Link Here
38
  topLayout->addWidget( mConfigWidget );
38
  topLayout->addWidget( mConfigWidget );
39
39
40
  mConfigWidget->setSyncProcess( process );
40
  mConfigWidget->setSyncProcess( process );
41
41
42
  setInitialSize( configDialogSize( "size_groupconfigdialog" ) );
42
  setInitialSize( configDialogSize( "size_groupconfigdialog" ) );
43
44
  enableButton( User1, false );
45
  setButtonText( User1, i18n( "Remove Member" ) );
46
47
  connect( mConfigWidget, SIGNAL( memberSelected( bool ) ), SLOT( memberSelected( bool ) ) );
48
49
  setButtonText( User2, i18n("Add Member...") );
43
}
50
}
44
51
45
GroupConfigDialog::~GroupConfigDialog()
52
GroupConfigDialog::~GroupConfigDialog()
46
{
53
{
47
  saveDialogSize( "size_groupconfigdialog" );
54
  saveDialogSize( "size_groupconfigdialog" );
Lines 52-57 Link Here
52
  mConfigWidget->saveConfig();
59
  mConfigWidget->saveConfig();
53
60
54
  accept();
61
  accept();
55
}
62
}
56
63
64
void GroupConfigDialog::slotUser1()
65
{
66
  mConfigWidget->removeMember();
67
}
68
69
void GroupConfigDialog::slotUser2()
70
{
71
  mConfigWidget->addMember();
72
}
73
74
void GroupConfigDialog::memberSelected( bool selected )
75
{
76
  enableButton( User1, selected );
77
}
78
57
#include "groupconfigdialog.moc"
79
#include "groupconfigdialog.moc"
(-)kitchensync.orig/src/groupconfigdialog.h (+5 lines)
Lines 33-42 Link Here
33
    GroupConfigDialog( QWidget *parent, SyncProcess * );
33
    GroupConfigDialog( QWidget *parent, SyncProcess * );
34
    ~GroupConfigDialog();
34
    ~GroupConfigDialog();
35
35
36
  protected slots:
36
  protected slots:
37
    void slotOk();
37
    void slotOk();
38
    void slotUser1();
39
    void slotUser2();
40
41
  private slots:
42
    void memberSelected( bool );
38
43
39
  private:
44
  private:
40
    GroupConfig *mConfigWidget;
45
    GroupConfig *mConfigWidget;
41
};
46
};
42
47
(-)kitchensync.orig/src/groupconfig.h (-4 / +11 lines)
Lines 38-62 Link Here
38
  public:
38
  public:
39
    GroupConfig( QWidget *parent );
39
    GroupConfig( QWidget *parent );
40
40
41
    void setSyncProcess( SyncProcess *process );
41
    void setSyncProcess( SyncProcess *process );
42
42
43
    void saveConfig();
44
45
  public slots:
46
    void addMember();
47
    void removeMember();
48
43
    void updateMembers();
49
    void updateMembers();
44
50
45
    void saveConfig();
51
  signals:
52
    void memberSelected( bool );
46
53
47
  protected slots:
54
  protected slots:
48
    void addMember();
55
    void memberWidgetSelected( QWidget* );
49
56
50
  private:
57
  private:
51
    QLabel *mNameLabel;
58
    QLabel *mNameLabel;
52
59
53
    KJanusWidget *mMemberView;
60
    KJanusWidget *mMemberView;
54
61
55
    SyncProcess *mProcess;
62
    SyncProcess *mProcess;
56
63
57
    GroupConfigCommon *mCommonConfig;
64
    GroupConfigCommon *mCommonConfig;
58
    QValueList<MemberConfig *> mMemberConfigs;
65
    QMap<QWidget*, MemberConfig*> mMemberConfigs;
59
    QValueList<QFrame *> mConfigPages;
66
    QValueList<QFrame*> mConfigPages;
60
};
67
};
61
68
62
#endif
69
#endif
(-)kitchensync.orig/src/groupitem.cpp (-40 / +31 lines)
Lines 31-40 Link Here
31
#include <qlayout.h>
31
#include <qlayout.h>
32
#include <qpixmap.h>
32
#include <qpixmap.h>
33
#include <qprogressbar.h>
33
#include <qprogressbar.h>
34
#include <qvbox.h>
34
#include <qvbox.h>
35
35
36
#include <libqopensync/plugin.h>
37
#include <libqopensync/pluginenv.h>
38
36
#include "memberinfo.h"
39
#include "memberinfo.h"
37
#include "multiconflictdialog.h"
40
#include "multiconflictdialog.h"
38
#include "singleconflictdialog.h"
41
#include "singleconflictdialog.h"
39
#include "syncprocessmanager.h"
42
#include "syncprocessmanager.h"
40
43
Lines 148-163 Link Here
148
    mTime->setText( i18n( "Not synchronized yet" ) );
151
    mTime->setText( i18n( "Not synchronized yet" ) );
149
152
150
  mProgressBar->reset();
153
  mProgressBar->reset();
151
  mProgressBar->hide();
154
  mProgressBar->hide();
152
155
153
  QSync::Group group = mSyncProcess->group();
156
  const QSync::Group group = mSyncProcess->group();
154
  QSync::Group::Iterator memberIt( group.begin() );
157
  for ( int i = 0; i < group.memberCount(); ++i ) {
155
  QSync::Group::Iterator memberEndIt( group.end() );
158
    MemberItem *item = new MemberItem( mBox, mSyncProcess, group.memberAt( i ) );
156
157
  for ( ; memberIt != memberEndIt; ++memberIt ) {
158
    MemberItem *item = new MemberItem( mBox, mSyncProcess, *memberIt );
159
    item->show();
159
    item->show();
160
    item->setStatusMessage( i18n( "Ready" ) );
160
    item->setStatusMessage( i18n( "Ready" ) );
161
    mMemberItems.append( item );
161
    mMemberItems.append( item );
162
  }
162
  }
163
}
163
}
Lines 185-202 Link Here
185
}
185
}
186
186
187
void GroupItem::change( const QSync::SyncChangeUpdate &update )
187
void GroupItem::change( const QSync::SyncChangeUpdate &update )
188
{
188
{
189
  switch ( update.type() ) {
189
  switch ( update.type() ) {
190
    case QSync::SyncChangeUpdate::Received:
190
    case QSync::SyncChangeUpdate::Read:
191
      mProcessedItems++;
191
      mProcessedItems++;
192
      mStatus->setText( i18n( "%1 entries read" ).arg( mProcessedItems ) );
192
      mStatus->setText( i18n( "%1 entries read" ).arg( mProcessedItems ) );
193
      break;
193
      break;
194
    case QSync::SyncChangeUpdate::ReceivedInfo:
194
    case QSync::SyncChangeUpdate::Written:
195
      mStatus->setText( i18n( "Receive information" ) );
196
      break;
197
    case QSync::SyncChangeUpdate::Sent:
198
      mProcessedItems--;
195
      mProcessedItems--;
199
      mStatus->setText( i18n( "%1 entries written" ).arg( mMaxProcessedItems - mProcessedItems ) );
196
      mStatus->setText( i18n( "%1 entries written" ).arg( mMaxProcessedItems - mProcessedItems ) );
200
197
201
      mProgressBar->show();
198
      mProgressBar->show();
202
199
Lines 209-223 Link Here
209
          progress = 0;
206
          progress = 0;
210
207
211
        mProgressBar->setProgress( 100 - progress );
208
        mProgressBar->setProgress( 100 - progress );
212
      }
209
      }
213
      break;
210
      break;
214
    case QSync::SyncChangeUpdate::WriteError:
211
    case QSync::SyncChangeUpdate::Error:
215
      mStatus->setText( i18n( "Error" ) );
216
      KPassivePopup::message( update.result().message(), this );
217
      break;
218
    case QSync::SyncChangeUpdate::ReceiveError:
219
      mStatus->setText( i18n( "Error" ) );
212
      mStatus->setText( i18n( "Error" ) );
220
      KPassivePopup::message( update.result().message(), this );
213
      KPassivePopup::message( update.result().message(), this );
221
      break;
214
      break;
222
    default:
215
    default:
223
      mStatus->setText( QString() );
216
      mStatus->setText( QString() );
Lines 230-265 Link Here
230
}
223
}
231
224
232
void GroupItem::engine( const QSync::SyncEngineUpdate &update )
225
void GroupItem::engine( const QSync::SyncEngineUpdate &update )
233
{
226
{
234
  switch ( update.type() ) {
227
  switch ( update.type() ) {
235
    case QSync::SyncEngineUpdate::EndPhaseConnected:
228
    case QSync::SyncEngineUpdate::Connected:
236
      mStatus->setText( i18n( "Connected" ) );
229
      mStatus->setText( i18n( "Connected" ) );
237
      mProgressBar->setProgress( 0 );
230
      mProgressBar->setProgress( 0 );
238
      mSynchronizing = true;
231
      mSynchronizing = true;
239
      mSyncAction->setText( "Abort Synchronization" );
232
      mSyncAction->setText( "Abort Synchronization" );
240
      break;
233
      break;
241
    case QSync::SyncEngineUpdate::EndPhaseRead:
234
    case QSync::SyncEngineUpdate::Read:
242
      mStatus->setText( i18n( "Data read" ) );
235
      mStatus->setText( i18n( "Data read" ) );
243
      break;
236
      break;
244
    case QSync::SyncEngineUpdate::EndPhaseWrite:
237
    case QSync::SyncEngineUpdate::Written:
245
      mStatus->setText( i18n( "Data written" ) );
238
      mStatus->setText( i18n( "Data written" ) );
246
      mProgressBar->setProgress( 100 );
239
      mProgressBar->setProgress( 100 );
247
      mProcessedItems = mMaxProcessedItems = 0;
240
      mProcessedItems = mMaxProcessedItems = 0;
248
      break;
241
      break;
249
    case QSync::SyncEngineUpdate::EndPhaseDisconnected:
242
    case QSync::SyncEngineUpdate::Disconnected:
250
      mStatus->setText( i18n( "Disconnected" ) );
243
      mStatus->setText( i18n( "Disconnected" ) );
251
      break;
244
      break;
252
    case QSync::SyncEngineUpdate::Error:
245
    case QSync::SyncEngineUpdate::Error:
253
      mStatus->setText( i18n( "Synchronization failed" ) );
246
      mStatus->setText( i18n( "Synchronization failed" ) );
254
      KPassivePopup::message( update.result().message(), this );
247
      KPassivePopup::message( update.result().message(), this );
255
      this->update();
248
      this->update();
256
249
257
      mSynchronizing = false;
250
      mSynchronizing = false;
258
      mSyncAction->setText( i18n( "Synchronize Now" ) );
251
      mSyncAction->setText( i18n( "Synchronize Now" ) );
259
      break;
252
      break;
260
    case QSync::SyncEngineUpdate::SyncSuccessfull:
253
    case QSync::SyncEngineUpdate::SyncSuccessful:
261
      mStatus->setText( i18n( "Successfully synchronized" ) );
254
      mStatus->setText( i18n( "Successfully synchronized" ) );
262
      mSyncProcess->group().setLastSynchronization( QDateTime::currentDateTime() );
255
      mSyncProcess->group().setLastSynchronization( QDateTime::currentDateTime() );
263
      mSyncProcess->group().save();
256
      mSyncProcess->group().save();
264
      this->update();
257
      this->update();
265
258
Lines 286-317 Link Here
286
    if ( (*it)->member() == update.member() ) {
279
    if ( (*it)->member() == update.member() ) {
287
      switch ( update.type() ) {
280
      switch ( update.type() ) {
288
        case QSync::SyncMemberUpdate::Connected:
281
        case QSync::SyncMemberUpdate::Connected:
289
          (*it)->setStatusMessage( i18n( "Connected" ) );
282
          (*it)->setStatusMessage( i18n( "Connected" ) );
290
          break;
283
          break;
291
        case QSync::SyncMemberUpdate::SentChanges:
284
        case QSync::SyncMemberUpdate::Read:
292
          (*it)->setStatusMessage( i18n( "Changes read" ) );
285
          (*it)->setStatusMessage( i18n( "Changes read" ) );
293
          break;
286
          break;
294
        case QSync::SyncMemberUpdate::CommittedAll:
287
        case QSync::SyncMemberUpdate::Written:
295
          (*it)->setStatusMessage( i18n( "Changes written" ) );
288
          (*it)->setStatusMessage( i18n( "Changes written" ) );
296
          break;
289
          break;
297
        case QSync::SyncMemberUpdate::Disconnected:
290
        case QSync::SyncMemberUpdate::Disconnected:
298
          (*it)->setStatusMessage( i18n( "Disconnected" ) );
291
          (*it)->setStatusMessage( i18n( "Disconnected" ) );
299
          break;
292
          break;
300
        case QSync::SyncMemberUpdate::ConnectError:
293
        case QSync::SyncMemberUpdate::SyncDone:
301
          (*it)->setStatusMessage( i18n( "Error: %1" ).arg( update.result().message() ) );
294
          (*it)->setStatusMessage( i18n( "Synchronization done" ) );
302
          break;
295
          break;
303
        case QSync::SyncMemberUpdate::GetChangesError:
296
        case QSync::SyncMemberUpdate::Discovered:
304
          (*it)->setStatusMessage( i18n( "Error: %1" ).arg( update.result().message() ) );
297
          (*it)->setStatusMessage( i18n( "Discovered" ) );
305
          break;
298
          break;
306
        case QSync::SyncMemberUpdate::CommittedAllError:
299
        case QSync::SyncMemberUpdate::Error:
307
          (*it)->setStatusMessage( i18n( "Error: %1" ).arg( update.result().message() ) );
308
          break;
309
        case QSync::SyncMemberUpdate::SyncDoneError:
310
          (*it)->setStatusMessage( i18n( "Error: %1" ).arg( update.result().message() ) );
311
          break;
312
        case QSync::SyncMemberUpdate::DisconnectedError:
313
          (*it)->setStatusMessage( i18n( "Error: %1" ).arg( update.result().message() ) );
300
          (*it)->setStatusMessage( i18n( "Error: %1" ).arg( update.result().message() ) );
314
          break;
301
          break;
315
        default:
302
        default:
316
          break;
303
          break;
317
      }
304
      }
Lines 350-364 Link Here
350
  : QWidget( parent ), mSyncProcess( process ), mMember( member )
337
  : QWidget( parent ), mSyncProcess( process ), mMember( member )
351
{
338
{
352
  QFont boldFont;
339
  QFont boldFont;
353
  boldFont.setBold( true );
340
  boldFont.setBold( true );
354
341
355
  MemberInfo mi( member );
342
  const MemberInfo mi( member );
356
343
  const QPixmap icon = mi.smallIcon();
357
  QPixmap icon = mi.smallIcon();
358
359
  QSync::Plugin plugin = member.plugin();
360
344
361
  QVBoxLayout *layout = new QVBoxLayout( this );
345
  QVBoxLayout *layout = new QVBoxLayout( this );
362
346
363
  QHBox* box = new QHBox( this );
347
  QHBox* box = new QHBox( this );
364
  box->setMargin( 5 );
348
  box->setMargin( 5 );
Lines 376-386 Link Here
376
  mDescription = new QLabel( nameBox );
360
  mDescription = new QLabel( nameBox );
377
361
378
  mStatus = new QLabel( box );
362
  mStatus = new QLabel( box );
379
363
380
  mMemberName->setText( member.name() );
364
  mMemberName->setText( member.name() );
381
  mDescription->setText( plugin.longName() );
365
366
  const QSync::PluginEnv *env = SyncProcessManager::self()->pluginEnv();
367
  const QSync::Plugin plugin = env->pluginByName( member.pluginName() );
368
369
  if ( plugin.isValid() )
370
    mDescription->setText( plugin.longName() );
371
  else
372
    mDescription->setText( i18n("Plugin \"%1\" can't get initialized!").arg( member.pluginName() ) );
382
}
373
}
383
374
384
void MemberItem::setStatusMessage( const QString &msg )
375
void MemberItem::setStatusMessage( const QString &msg )
385
{
376
{
386
  mStatus->setText( msg );
377
  mStatus->setText( msg );
(-)kitchensync.orig/src/kitchensync.desktop (-2 / +1 lines)
Lines 1-20 Link Here
1
[Desktop Entry]
1
[Desktop Entry]
2
Encoding=UTF-8
2
Encoding=UTF-8
3
Name=KitchenSync
3
Name=KitchenSync
4
Name[pt]=KitchenSyncFilter
4
Name[pt]=KitchenSyncFilter
5
Name[pt_BR]=KitchenSyncFilter
5
Name[sv]=Kitchensync
6
Name[sv]=Kitchensync
6
GenericName=Synchronization
7
GenericName=Synchronization
7
GenericName[af]=Sinkronisasie
8
GenericName[af]=Sinkronisasie
8
GenericName[bg]=Синхронизация
9
GenericName[bg]=Синхронизация
9
GenericName[ca]=Sincronització
10
GenericName[ca]=Sincronització
10
GenericName[cs]=Synchronizace
11
GenericName[cs]=Synchronizace
11
GenericName[cy]=Cydamseriad
12
GenericName[cy]=Cydamseriad
12
GenericName[da]=Synkronisering
13
GenericName[da]=Synkronisering
13
GenericName[de]=Abgleich
14
GenericName[de]=Abgleich
14
GenericName[el]=Συγχρονισμός
15
GenericName[el]=Συγχρονισμός
15
GenericName[eo]=Sinkronigo
16
GenericName[es]=Sincronización
16
GenericName[es]=Sincronización
17
GenericName[et]=Sünkroniseerimine
17
GenericName[et]=Sünkroniseerimine
18
GenericName[eu]=Sinkronizazioa
18
GenericName[eu]=Sinkronizazioa
19
GenericName[fa]=همگامی
19
GenericName[fa]=همگامی
20
GenericName[fi]=Synkronointi
20
GenericName[fi]=Synkronointi
Lines 45-55 Link Here
45
GenericName[sr@Latn]=Sinhronizacija
45
GenericName[sr@Latn]=Sinhronizacija
46
GenericName[sv]=Synkronisering
46
GenericName[sv]=Synkronisering
47
GenericName[ta]=கூட்டிணைப்பு
47
GenericName[ta]=கூட்டிணைப்பு
48
GenericName[tr]=Senkronizasyon
48
GenericName[tr]=Senkronizasyon
49
GenericName[uk]=Синхронізація
49
GenericName[uk]=Синхронізація
50
GenericName[zh_CN]=同步
51
Exec=kitchensync
50
Exec=kitchensync
52
Icon=kitchensync
51
Icon=kitchensync
53
Type=Application
52
Type=Application
54
DocPath=kitchensync/index.html
53
DocPath=kitchensync/index.html
55
Terminal=false
54
Terminal=false
(-)kitchensync.orig/src/mainwidget.cpp (-10 / +10 lines)
Lines 24-34 Link Here
24
#include "groupconfigdialog.h"
24
#include "groupconfigdialog.h"
25
#include "groupview.h"
25
#include "groupview.h"
26
#include "syncprocess.h"
26
#include "syncprocess.h"
27
#include "syncprocessmanager.h"
27
#include "syncprocessmanager.h"
28
28
29
#include <libqopensync/environment.h>
29
#include <libqopensync/result.h>
30
30
31
#include <kaboutdata.h>
31
#include <kaboutdata.h>
32
#include <kaction.h>
32
#include <kaction.h>
33
#include <kdebug.h>
33
#include <kdebug.h>
34
#include <kinputdialog.h>
34
#include <kinputdialog.h>
Lines 44-60 Link Here
44
  : QWidget( widget, name ), mGUIClient( guiClient )
44
  : QWidget( widget, name ), mGUIClient( guiClient )
45
{
45
{
46
  initGUI();
46
  initGUI();
47
  initActions();
47
  initActions();
48
48
49
  /** apply object type filter hack **/
50
  int count = SyncProcessManager::self()->count();
51
  for ( int i = 0; i < count; ++i ) {
52
    SyncProcessManager::self()->at( i )->applyObjectTypeFilter();
53
  }
54
  /** apply object type filter hack **/
55
56
  mGroupView->updateView();
49
  mGroupView->updateView();
57
50
58
  connect( SyncProcessManager::self(), SIGNAL( changed() ),
51
  connect( SyncProcessManager::self(), SIGNAL( changed() ),
59
           mGroupView, SLOT( updateView() ) );
52
           mGroupView, SLOT( updateView() ) );
60
  connect( SyncProcessManager::self(), SIGNAL( syncProcessChanged( SyncProcess* ) ),
53
  connect( SyncProcessManager::self(), SIGNAL( syncProcessChanged( SyncProcess* ) ),
Lines 123-138 Link Here
123
116
124
void MainWidget::addGroup()
117
void MainWidget::addGroup()
125
{
118
{
126
  bool ok;
119
  bool ok;
127
  QString name = KInputDialog::getText( i18n("Create Synchronization Group"),
120
  QString name = KInputDialog::getText( i18n("Create Synchronization Group"),
128
    i18n("Name for new synchronization group."), QString::null, &ok, this );
121
    i18n("Name for new synchronization group."), i18n( "Default" ), &ok, this );
129
  if ( ok ) {
122
  if ( ok ) {
123
    SyncProcess *process = SyncProcessManager::self()->byGroupName( name );
124
    if ( process ) {
125
      KMessageBox::error( this, i18n( "A group with the same name exists already.\nPlease choose another name." ),
126
                          i18n( "Duplicated Group Name" ) );
127
      return;
128
    }
129
130
    SyncProcessManager::self()->addGroup( name );
130
    SyncProcessManager::self()->addGroup( name );
131
    enableActions();
131
    enableActions();
132
132
133
    SyncProcess *process = SyncProcessManager::self()->byGroupName( name );
133
    process = SyncProcessManager::self()->byGroupName( name );
134
    if ( process )
134
    if ( process )
135
      editGroup( process );
135
      editGroup( process );
136
  }
136
  }
137
}
137
}
138
138
(-)kitchensync.orig/src/Makefile.am (-1 / +1 lines)
Lines 22-32 Link Here
22
                            groupconfig.cpp groupitem.cpp groupview.cpp memberconfig.cpp \
22
                            groupconfig.cpp groupitem.cpp groupview.cpp memberconfig.cpp \
23
                            syncprocess.cpp syncprocessmanager.cpp connectionwidgets.cpp \
23
                            syncprocess.cpp syncprocessmanager.cpp connectionwidgets.cpp \
24
                            pluginpicker.cpp configgui.cpp configguiblank.cpp configguifile.cpp \
24
                            pluginpicker.cpp configgui.cpp configguiblank.cpp configguifile.cpp \
25
                            memberinfo.cpp groupconfigcommon.cpp kwidgetlist.cpp \
25
                            memberinfo.cpp groupconfigcommon.cpp kwidgetlist.cpp \
26
                            configguipalm.cpp conflictdialog.cpp singleconflictdialog.cpp \
26
                            configguipalm.cpp conflictdialog.cpp singleconflictdialog.cpp \
27
                            addresseediffalgo.cpp calendardiffalgo.cpp \
27
                            addresseediffalgo.cpp calendardiffalgo.cpp xmldiffalgo.cpp \
28
                            htmldiffalgodisplay.cpp genericdiffalgo.cpp multiconflictdialog.cpp \
28
                            htmldiffalgodisplay.cpp genericdiffalgo.cpp multiconflictdialog.cpp \
29
                            configguiirmc.cpp \
29
                            configguiirmc.cpp \
30
                            configguisyncmlobex.cpp configguisyncmlhttp.cpp configguiopie.cpp  \
30
                            configguisyncmlobex.cpp configguisyncmlhttp.cpp configguiopie.cpp  \
31
                            configguignokii.cpp configguigcalendar.cpp configguildap.cpp configguigpe.cpp \
31
                            configguignokii.cpp configguigcalendar.cpp configguildap.cpp configguigpe.cpp \
32
                            configguijescs.cpp configguievo2.cpp configguimoto.cpp configguisynce.cpp \
32
                            configguijescs.cpp configguievo2.cpp configguimoto.cpp configguisynce.cpp \
(-)kitchensync.orig/src/memberconfig.cpp (-3 / +8 lines)
Lines 21-30 Link Here
21
#include "memberconfig.h"
21
#include "memberconfig.h"
22
22
23
#include "configgui.h"
23
#include "configgui.h"
24
#include "memberinfo.h"
24
#include "memberinfo.h"
25
25
26
#include <libqopensync/result.h>
27
26
#include <klocale.h>
28
#include <klocale.h>
27
#include <kmessagebox.h>
29
#include <kmessagebox.h>
28
30
29
#include <qlabel.h>
31
#include <qlabel.h>
30
#include <qlayout.h>
32
#include <qlayout.h>
Lines 65-79 Link Here
65
  QString txt = mGui->save();
67
  QString txt = mGui->save();
66
68
67
  if ( txt.isEmpty() ) {
69
  if ( txt.isEmpty() ) {
68
    KMessageBox::sorry( this, i18n("Configuration of %1 is empty.").arg( mMember.pluginName() ) );
70
    KMessageBox::sorry( this, i18n("Configuration of %1 is empty.").arg( mMember.pluginName() ) );
69
  } else {
71
  } else {
70
    QByteArray cfg = txt.utf8();
72
    mMember.setConfiguration( txt.utf8() );
71
    cfg.truncate(cfg.size() - 1); /* discard NUL terminator */
72
    mMember.setConfiguration( cfg );
73
    mMember.setName( mGui->instanceName() );
73
    mMember.setName( mGui->instanceName() );
74
    // TODO: Check for save() error.
74
    // TODO: Check for save() error.
75
    mMember.save();
75
    mMember.save();
76
  }
76
  }
77
}
77
}
78
78
79
QSync::Member MemberConfig::member() const
80
{
81
  return mMember;
82
}
83
79
#include "memberconfig.moc"
84
#include "memberconfig.moc"
(-)kitchensync.orig/src/memberconfig.h (+2 lines)
Lines 36-45 Link Here
36
    ~MemberConfig();
36
    ~MemberConfig();
37
37
38
    void loadData();
38
    void loadData();
39
    void saveData();
39
    void saveData();
40
40
41
    QSync::Member member() const;
42
41
  private:
43
  private:
42
    QSync::Member mMember;
44
    QSync::Member mMember;
43
45
44
    ConfigGui *mGui;
46
    ConfigGui *mGui;
45
};
47
};
(-)kitchensync.orig/src/multiconflictdialog.cpp (-2 / +4 lines)
Lines 37-48 Link Here
37
      : KWidgetListItem( parent ),
37
      : KWidgetListItem( parent ),
38
        mChange( change )
38
        mChange( change )
39
    {
39
    {
40
      QGridLayout *layout = new QGridLayout( this, 2, 1, KDialog::marginHint(), KDialog::spacingHint() );
40
      QGridLayout *layout = new QGridLayout( this, 2, 1, KDialog::marginHint(), KDialog::spacingHint() );
41
41
42
      MemberInfo mi( change.member() );
42
      // TODO change doesn't contain member as struct member .. use SyncMapping to determine the correct member.
43
      layout->addWidget( new QLabel( mi.name(), this ), 0, 0 );
43
      //MemberInfo mi( change.member() );
44
      //layout->addWidget( new QLabel( mi.name(), this ), 0, 0 );
45
      layout->addWidget( new QLabel( "PORTING TODO", this ), 0, 0 );
44
46
45
      QString type;
47
      QString type;
46
      switch ( change.changeType() ) {
48
      switch ( change.changeType() ) {
47
        case QSync::SyncChange::UnknownChange:
49
        case QSync::SyncChange::UnknownChange:
48
          type = i18n( "Unknown" );
50
          type = i18n( "Unknown" );
(-)kitchensync.orig/src/pluginpicker.cpp (-6 / +8 lines)
Lines 22-32 Link Here
22
#include "pluginpicker.h"
22
#include "pluginpicker.h"
23
23
24
#include "memberinfo.h"
24
#include "memberinfo.h"
25
#include "syncprocessmanager.h"
25
#include "syncprocessmanager.h"
26
26
27
#include <libqopensync/environment.h>
27
#include <libqopensync/pluginenv.h>
28
28
29
#include <kdialog.h>
29
#include <kdialog.h>
30
#include <kglobal.h>
30
#include <kglobal.h>
31
#include <kiconloader.h>
31
#include <kiconloader.h>
32
#include <klocale.h>
32
#include <klocale.h>
Lines 75-90 Link Here
75
75
76
void PluginPicker::updatePluginList()
76
void PluginPicker::updatePluginList()
77
{
77
{
78
  mPluginList->clear();
78
  mPluginList->clear();
79
79
80
  QSync::Environment *env = SyncProcessManager::self()->environment();
80
  const QSync::PluginEnv *env = SyncProcessManager::self()->pluginEnv();
81
82
  for ( int i = 0; i < env->pluginCount(); ++i ) {
83
    QSync::Plugin plugin = env->pluginAt( i );
84
85
    if ( plugin.isValid() )
86
      mPluginList->appendItem( new PluginItem( mPluginList, plugin ) );
81
87
82
  QSync::Environment::PluginIterator it( env->pluginBegin() );
83
  for( ; it != env->pluginEnd(); ++it ) {
84
    QSync::Plugin plugin = *it;
85
    mPluginList->appendItem( new PluginItem( mPluginList, plugin ) );
86
  }
88
  }
87
}
89
}
88
90
89
QSync::Plugin PluginPicker::selectedPlugin() const
91
QSync::Plugin PluginPicker::selectedPlugin() const
90
{
92
{
(-)kitchensync.orig/src/singleconflictdialog.cpp (-3 / +11 lines)
Lines 25-34 Link Here
25
#include <qlayout.h>
25
#include <qlayout.h>
26
#include <qpushbutton.h>
26
#include <qpushbutton.h>
27
27
28
#include "addresseediffalgo.h"
28
#include "addresseediffalgo.h"
29
#include "genericdiffalgo.h"
29
#include "genericdiffalgo.h"
30
#include "xmldiffalgo.h"
30
#include "htmldiffalgodisplay.h"
31
#include "htmldiffalgodisplay.h"
31
#include "memberinfo.h"
32
#include "memberinfo.h"
32
33
33
#include "singleconflictdialog.h"
34
#include "singleconflictdialog.h"
34
35
Lines 41-60 Link Here
41
  QSync::SyncChange leftChange = mapping.changeAt( 0 );
42
  QSync::SyncChange leftChange = mapping.changeAt( 0 );
42
  QSync::SyncChange rightChange = mapping.changeAt( 1 );
43
  QSync::SyncChange rightChange = mapping.changeAt( 1 );
43
44
44
  if ( format == "file" ) {
45
  if ( format == "file" ) {
45
    mDiffAlgo = new KSync::GenericDiffAlgo( leftChange.data(), rightChange.data() );
46
    mDiffAlgo = new KSync::GenericDiffAlgo( leftChange.data(), rightChange.data() );
46
  } else if ( format == "vcard" ) {
47
  } else if ( format == "vcard21" || format == "vcard30" ) {
47
  } else if ( format == "calendar" ) {
48
  } else if ( format == "xml-contact" ) {
49
    mDiffAlgo = new KSync::AddresseeDiffAlgo( leftChange.data(), rightChange.data() );
48
    mDiffAlgo = new KSync::AddresseeDiffAlgo( leftChange.data(), rightChange.data() );
49
  } else if ( format == "calendar" ) {
50
  } else if ( format == "xmlformat-contact" || format == "xmlformat-note"
51
	   || format == "xmlformat-event" || format == "xmlformat-todo") { 
52
    mDiffAlgo = new KSync::XmlDiffAlgo( leftChange.data(), rightChange.data() );
50
  }
53
  }
51
54
55
// TODO: SyncChange doesn't have member as struct member anymore ...
56
// Use SyncMapping to determine the member .. see msynctool for example implementation of conlicthandler
57
#if 0  
52
  MemberInfo miLeft( leftChange.member() );
58
  MemberInfo miLeft( leftChange.member() );
53
  mDiffAlgoDisplay->setLeftSourceTitle( miLeft.name() );
59
  mDiffAlgoDisplay->setLeftSourceTitle( miLeft.name() );
54
  MemberInfo miRight( rightChange.member() );
60
  MemberInfo miRight( rightChange.member() );
55
  mDiffAlgoDisplay->setRightSourceTitle( miRight.name() );
61
  mDiffAlgoDisplay->setRightSourceTitle( miRight.name() );
62
#endif  
56
63
57
  if ( mDiffAlgo ) {
64
  if ( mDiffAlgo ) {
58
    mDiffAlgo->addDisplay( mDiffAlgoDisplay );
65
    mDiffAlgo->addDisplay( mDiffAlgoDisplay );
59
    mDiffAlgo->run();
66
    mDiffAlgo->run();
60
  }
67
  }
Lines 97-106 Link Here
97
void SingleConflictDialog::initGUI()
104
void SingleConflictDialog::initGUI()
98
{
105
{
99
  QGridLayout *layout = new QGridLayout( this, 3, 4, KDialog::marginHint(), KDialog::spacingHint() );
106
  QGridLayout *layout = new QGridLayout( this, 3, 4, KDialog::marginHint(), KDialog::spacingHint() );
100
107
101
  layout->addMultiCellWidget( new QLabel( i18n( "A conflict has appeared, please solve it manually." ), this ), 0, 0, 0, 3 );
108
  layout->addMultiCellWidget( new QLabel( i18n( "A conflict has appeared, please solve it manually." ), this ), 0, 0, 0, 3 );
109
102
  mDiffAlgoDisplay = new KSync::HTMLDiffAlgoDisplay( this );
110
  mDiffAlgoDisplay = new KSync::HTMLDiffAlgoDisplay( this );
103
111
104
  layout->addMultiCellWidget( mDiffAlgoDisplay, 1, 1, 0, 3 );
112
  layout->addMultiCellWidget( mDiffAlgoDisplay, 1, 1, 0, 3 );
105
113
106
  QPushButton *button = new QPushButton( i18n( "Use Item" ), this );
114
  QPushButton *button = new QPushButton( i18n( "Use Item" ), this );
(-)kitchensync.orig/src/syncprocess.cpp (-27 / +16 lines)
Lines 17-30 Link Here
17
    along with this program; if not, write to the Free Software
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
*/
19
*/
20
20
21
#include <libqopensync/engine.h>
21
#include <libqopensync/engine.h>
22
#include <libqopensync/environment.h>
22
#include <libqopensync/member.h>
23
#include <libqopensync/result.h>
23
24
24
#include <kdebug.h>
25
#include <kdebug.h>
25
#include <klocale.h>
26
#include <klocale.h>
27
#include <kmessagebox.h>
26
28
27
#include "syncprocess.h"
29
#include "syncprocess.h"
28
#include "syncprocessmanager.h"
30
#include "syncprocessmanager.h"
29
31
30
using namespace QSync;
32
using namespace QSync;
Lines 58-108 Link Here
58
  return i18n( "Ready" );
60
  return i18n( "Ready" );
59
}
61
}
60
62
61
QSync::Result SyncProcess::addMember( const QSync::Plugin &plugin )
63
QSync::Result SyncProcess::addMember( const QSync::Plugin &plugin )
62
{
64
{
63
  QSync::Member member = mGroup.addMember();
65
  QSync::Member member = mGroup.addMember( plugin );
64
  QSync::Result result = member.instance( plugin );
66
  QSync::Result result = member.instance();
65
67
66
  if ( !result.isError() )
68
  if ( !result.isError() )
67
    mGroup.save();
69
    mGroup.save();
68
70
69
  return result;
71
  return result;
70
}
72
}
71
73
74
void SyncProcess::removeMember( const QSync::Member &member )
75
{
76
  member.cleanup();
77
  mGroup.removeMember( member );
78
  mGroup.save();
79
}
80
72
void SyncProcess::reinitEngine()
81
void SyncProcess::reinitEngine()
73
{
82
{
74
  mEngine->finalize();
83
  mEngine->finalize();
75
  delete mEngine;
84
  delete mEngine;
76
  mEngine = new QSync::Engine( mGroup );
85
  mEngine = new QSync::Engine( mGroup );
77
  Result result = mEngine->initialize();
86
  Result result = mEngine->initialize();
78
  if ( result.isError() )
87
  if ( result.isError() ) {
79
    kdDebug() << "SyncProcess::reinitEngine: " << result.message() << endl;
88
    kdDebug() << "SyncProcess::reinitEngine: " << result.message() << endl;
89
    KMessageBox::error( 0, i18n("Error initializing Synchronization Engine for group \"%1\":\n %2")
90
		    .arg( mGroup.name() ).arg( result.message() ) );
80
91
81
  applyObjectTypeFilter();
92
  }
82
93
83
  emit engineChanged( mEngine );
94
  emit engineChanged( mEngine );
84
}
95
}
85
96
86
void SyncProcess::applyObjectTypeFilter()
87
{
88
  const QSync::Conversion conversion = SyncProcessManager::self()->environment()->conversion();
89
  const QStringList objectTypes = conversion.objectTypes();
90
  const QStringList activeObjectTypes = mGroup.config().activeObjectTypes();
91
92
  for ( uint i = 0; i < objectTypes.count(); ++i ) {
93
    if ( activeObjectTypes.contains( objectTypes[ i ] ) ) {
94
      kdDebug() << "Enabled object type: " <<  objectTypes[ i ] << endl;
95
      /*
96
       * This is not required. Also this lead to filtering problems when sync with "file-sync".
97
       * Uncomment this line again when OpenSync is fixed!
98
       *
99
       * mGroup.setObjectTypeEnabled( objectTypes[ i ], true );
100
       */
101
    } else {
102
      kdDebug() << "Disabled object type: " <<  objectTypes[ i ] << endl;
103
      mGroup.setObjectTypeEnabled( objectTypes[ i ], false );
104
    }
105
  }
106
}
107
108
#include "syncprocess.moc"
97
#include "syncprocess.moc"
(-)kitchensync.orig/src/syncprocess.h (-3 / +1 lines)
Lines 42-57 Link Here
42
42
43
    QString groupStatus() const;
43
    QString groupStatus() const;
44
    QString memberStatus( const QSync::Member &member ) const;
44
    QString memberStatus( const QSync::Member &member ) const;
45
45
46
    QSync::Result addMember( const QSync::Plugin &plugin );
46
    QSync::Result addMember( const QSync::Plugin &plugin );
47
    void removeMember( const QSync::Member &member );
47
48
48
    void reinitEngine();
49
    void reinitEngine();
49
50
50
    /** apply object type filter hack **/
51
    void applyObjectTypeFilter();
52
53
  signals:
51
  signals:
54
    /**
52
    /**
55
      This signal is emitted whenever the engine has changed ( reinitialized ).
53
      This signal is emitted whenever the engine has changed ( reinitialized ).
56
     */
54
     */
57
    void engineChanged( QSync::Engine *engine );
55
    void engineChanged( QSync::Engine *engine );
(-)kitchensync.orig/src/syncprocessmanager.cpp (-14 / +34 lines)
Lines 21-31 Link Here
21
21
22
#include "syncprocessmanager.h"
22
#include "syncprocessmanager.h"
23
23
24
#include "syncprocess.h"
24
#include "syncprocess.h"
25
25
26
#include <libqopensync/environment.h>
26
#include <libqopensync/groupenv.h>
27
#include <libqopensync/member.h>
28
#include <libqopensync/pluginenv.h>
29
#include <libqopensync/result.h>
27
30
28
#include <kstaticdeleter.h>
31
#include <kstaticdeleter.h>
29
#include <kmessagebox.h>
32
#include <kmessagebox.h>
30
#include <klocale.h>
33
#include <klocale.h>
31
34
Lines 41-70 Link Here
41
  return mSelf;
44
  return mSelf;
42
}
45
}
43
46
44
SyncProcessManager::SyncProcessManager()
47
SyncProcessManager::SyncProcessManager()
45
{
48
{
46
  mEnvironment = new QSync::Environment;
49
  mGroupEnv = new QSync::GroupEnv;
47
  QSync::Result result = mEnvironment->initialize();
50
  QSync::Result result = mGroupEnv->initialize();
48
  if ( result.isError() ) {
51
  if ( result.isError() ) {
49
    KMessageBox::error( 0, i18n("Error initializing OpenSync.\n%1")
52
    KMessageBox::error( 0, i18n("Error initializing OpenSync.\n%1")
50
      .arg( result.message() ) );
53
      .arg( result.message() ) );
51
  } else {
54
  } else {
52
    init( mEnvironment );
55
    initGroup( mGroupEnv );
53
  }
56
  }
57
58
  mPluginEnv = new QSync::PluginEnv;
59
  result = mPluginEnv->initialize();
60
  if ( result.isError() ) {
61
    KMessageBox::error( 0, i18n("Error initializing OpenSync.\n%1")
62
      .arg( result.message() ) );
63
  } else {
64
//    initPlugin( mPluginEnv );
65
  }
66
54
}
67
}
55
68
56
SyncProcessManager::~SyncProcessManager()
69
SyncProcessManager::~SyncProcessManager()
57
{
70
{
58
  QValueList<SyncProcess*>::Iterator it;
71
  QValueList<SyncProcess*>::Iterator it;
59
  for ( it = mProcesses.begin(); it != mProcesses.end(); ++it )
72
  for ( it = mProcesses.begin(); it != mProcesses.end(); ++it )
60
    delete *it;
73
    delete *it;
61
74
62
  mProcesses.clear();
75
  mProcesses.clear();
63
76
64
  mEnvironment->finalize();
77
  mGroupEnv->finalize();
65
  delete mEnvironment;
78
  delete mGroupEnv;
66
}
79
}
67
80
68
int SyncProcessManager::count() const
81
int SyncProcessManager::count() const
69
{
82
{
70
  return mProcesses.count();
83
  return mProcesses.count();
Lines 100-111 Link Here
100
113
101
void SyncProcessManager::addGroup( const QString &name )
114
void SyncProcessManager::addGroup( const QString &name )
102
{
115
{
103
  SyncProcess* process = byGroupName( name );
116
  SyncProcess* process = byGroupName( name );
104
  if ( !process ) {
117
  if ( !process ) {
105
    QSync::Group group = mEnvironment->addGroup();
118
    QSync::Group group = mGroupEnv->addGroup( name );
106
    group.setName( name );
107
    group.save();
119
    group.save();
108
120
109
    mProcesses.append( new SyncProcess( group ) );
121
    mProcesses.append( new SyncProcess( group ) );
110
122
111
    emit changed();
123
    emit changed();
Lines 118-143 Link Here
118
  if ( syncProcess ) {
130
  if ( syncProcess ) {
119
    mProcesses.remove( syncProcess );
131
    mProcesses.remove( syncProcess );
120
    const QSync::Group group = syncProcess->group();
132
    const QSync::Group group = syncProcess->group();
121
    delete syncProcess;
133
    delete syncProcess;
122
134
123
    mEnvironment->removeGroup( group );
135
    mGroupEnv->removeGroup( group );
124
136
125
    emit changed();
137
    emit changed();
126
  }
138
  }
127
}
139
}
128
140
129
void SyncProcessManager::init( QSync::Environment *environment )
141
void SyncProcessManager::initGroup( QSync::GroupEnv *groupEnv )
130
{
142
{
131
  QSync::Environment::GroupIterator it( environment->groupBegin() );
143
  for ( int i = 0; i < groupEnv->groupCount(); ++i ) {
132
  for ( ; it != environment->groupEnd(); ++it ) {
133
    /**
144
    /**
134
     * We check whether the group is valid before we append them
145
     * We check whether the group is valid before we append them
135
     * to mProcesses. That avoids crashes if the plugin of one of
146
     * to mProcesses. That avoids crashes if the plugin of one of
136
     * the members isn't loaded (e.g. not installed).
147
     * the members isn't loaded (e.g. not installed).
137
     */
148
     */
138
    const QSync::Group group = *it;
149
    const QSync::Group group = groupEnv->groupAt( i );
139
    int count = group.memberCount();
150
    int count = group.memberCount();
140
151
141
    bool isValid = true;
152
    bool isValid = true;
142
    for ( int i = 0; i < count; ++i ) {
153
    for ( int i = 0; i < count; ++i ) {
143
      const QSync::Member member = group.memberAt( i );
154
      const QSync::Member member = group.memberAt( i );
Lines 147-157 Link Here
147
        break;
158
        break;
148
      }
159
      }
149
    }
160
    }
150
161
151
    if ( isValid )
162
    if ( isValid )
152
      mProcesses.append( new SyncProcess( *it ) );
163
      mProcesses.append( new SyncProcess( group ) );
153
  }
164
  }
154
165
155
  emit changed();
166
  emit changed();
156
}
167
}
157
168
Lines 167-172 Link Here
167
  }
178
  }
168
179
169
  return result;
180
  return result;
170
}
181
}
171
182
183
void SyncProcessManager::removeMember( SyncProcess *process, const QSync::Member &member )
184
{
185
  Q_ASSERT( process );
186
187
  process->removeMember( member );
188
  process->group().save();
189
  emit syncProcessChanged( process );
190
}
191
172
#include "syncprocessmanager.moc"
192
#include "syncprocessmanager.moc"
(-)kitchensync.orig/src/syncprocessmanager.h (-5 / +18 lines)
Lines 24-34 Link Here
24
#include <qobject.h>
24
#include <qobject.h>
25
25
26
#include <libqopensync/group.h>
26
#include <libqopensync/group.h>
27
27
28
namespace QSync {
28
namespace QSync {
29
class Environment;
29
class GroupEnv;
30
class PluginEnv;
30
}
31
}
31
32
32
class SyncProcess;
33
class SyncProcess;
33
34
34
class SyncProcessManager : public QObject
35
class SyncProcessManager : public QObject
Lines 41-53 Link Here
41
      Destroys the SyncProcessList.
42
      Destroys the SyncProcessList.
42
     */
43
     */
43
    ~SyncProcessManager();
44
    ~SyncProcessManager();
44
45
45
    /**
46
    /**
46
      Return OpenSync Environment.
47
      Return OpenSync GroupEnv.
47
    */
48
    */
48
    QSync::Environment *environment() const { return mEnvironment; }
49
    QSync::GroupEnv *groupEnv() const { return mGroupEnv; }
50
51
    /**
52
      Return OpenSync PluginEnv.
53
    */
54
    QSync::PluginEnv *pluginEnv() const { return mPluginEnv; }
49
55
50
    /**
56
    /**
51
      Returns the number of SyncProcesses.
57
      Returns the number of SyncProcesses.
52
     */
58
     */
53
    int count() const;
59
    int count() const;
Lines 80-100 Link Here
80
    /**
86
    /**
81
      Adds @param plugin instance as member to the group of @param process.
87
      Adds @param plugin instance as member to the group of @param process.
82
     */
88
     */
83
    QSync::Result addMember( SyncProcess *process, const QSync::Plugin &plugin );
89
    QSync::Result addMember( SyncProcess *process, const QSync::Plugin &plugin );
84
90
91
    /**
92
      Removes the @param member from the group of @param process.
93
     */
94
    void removeMember( SyncProcess *process, const QSync::Member &member );
95
85
  signals:
96
  signals:
86
    void changed();
97
    void changed();
87
    void syncProcessChanged( SyncProcess *process );
98
    void syncProcessChanged( SyncProcess *process );
88
99
89
  private:
100
  private:
90
    SyncProcessManager();
101
    SyncProcessManager();
91
102
92
    void init( QSync::Environment *environment );
103
    void initGroup( QSync::GroupEnv *groupEnv );
104
//    void initPlugin( QSync::PluginEnv *pluginEnv );
93
105
94
    QValueList<SyncProcess*> mProcesses;
106
    QValueList<SyncProcess*> mProcesses;
95
    QSync::Environment *mEnvironment;
107
    QSync::GroupEnv *mGroupEnv;
108
    QSync::PluginEnv *mPluginEnv;
96
109
97
    static SyncProcessManager *mSelf;
110
    static SyncProcessManager *mSelf;
98
};
111
};
99
112
100
#endif
113
#endif
(-)kitchensync.orig/src/xmldiffalgo.cpp (+166 lines)
Line 0 Link Here
1
/*
2
    This file is part of KitchenSync.
3
4
    Copyright (c) 2006 Daniel Gollub <dgollub@suse.de> 
5
6
    This program is free software; you can redistribute it and/or
7
    modify it under the terms of the GNU Library General Public
8
    License as published by the Free Software Foundation; either
9
    version 2 of the License, or (at your option) any later version.
10
11
    This library is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
    Library General Public License for more details.
15
16
    You should have received a copy of the GNU Library General Public License
17
    along with this library; see the file COPYING.LIB.  If not, write to
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
20
*/
21
22
#include "xmldiffalgo.h"
23
24
#include <kdebug.h>
25
26
using namespace KSync;
27
28
#ifndef KDE_USE_FINAL
29
// With --enable-final, we get the (identical) compareString from
30
// addresseediffalgo.cpp
31
//
32
static bool compareString( const QString &left, const QString &right )
33
{
34
  if ( left.isEmpty() && right.isEmpty() )
35
    return true;
36
  else
37
    return left == right;
38
}
39
#endif
40
41
XmlDiffAlgo::XmlDiffAlgo( const QString &leftXml, const QString &rightXml )
42
{
43
  kdDebug() << __func__ << " " << __LINE__ << endl;
44
45
  mLeftXml.setContent( leftXml );
46
  mRightXml.setContent( rightXml );
47
48
}
49
50
XmlDiffAlgo::XmlDiffAlgo( const QDomDocument &leftXml, const QDomDocument &rightXml )
51
  : mLeftXml( leftXml ), mRightXml( rightXml )
52
{
53
  kdDebug() << __func__ << " " << __LINE__ << endl;
54
}
55
56
void XmlDiffAlgo::appendSingleNodes(QDomElement &element, bool isLeft)
57
{
58
  QDomNode node;
59
60
  for ( node = element.firstChild(); !node.isNull(); node = node.nextSibling() ) {
61
    QDomElement child = node.toElement();
62
63
    if (isLeft)
64
      additionalLeftField( node.nodeName(), child.text() );
65
    else
66
      additionalRightField( node.nodeName(), child.text() );
67
  }
68
69
}
70
71
void XmlDiffAlgo::appendConflictNodes(QDomElement &leftElement, QDomElement &rightElement)
72
{
73
  QDomNode left, right;
74
  QDomElement leftChild, rightChild;
75
76
  for ( left = leftElement.firstChild(); !left.isNull(); left = left.nextSibling() ) {
77
    leftChild = left.toElement();
78
79
    for ( right = rightElement.firstChild(); !right.isNull(); right = right.nextSibling() ) {
80
      rightChild = right.toElement();
81
82
      if ( leftChild.tagName() != rightChild.tagName() )
83
        continue;
84
85
      if (leftChild.text().isEmpty() || rightChild.text().isEmpty())
86
        continue;
87
88
      QString id = leftChild.tagName();
89
      if (id == "Content")
90
        id = left.parentNode().nodeName();
91
92
      conflictField( id, leftChild.text(), rightChild.text() );
93
94
      left.parentNode().removeChild( left );
95
      left = leftElement.firstChild();
96
97
      right.parentNode().removeChild( right );
98
      right = rightElement.firstChild();
99
100
    }
101
  }
102
}
103
104
void XmlDiffAlgo::compareNode(QDomElement &leftElement, QDomElement &rightElement)
105
{
106
  QDomNode left, right;
107
  QDomElement leftChild, rightChild;
108
  QDomNodeList nlist;
109
top:;
110
111
  for ( left = leftElement.firstChild(); !left.isNull(); left = left.nextSibling() ) {
112
    leftChild = left.toElement();
113
114
    for ( right = rightElement.firstChild(); !right.isNull(); right = right.nextSibling() ) {
115
      rightChild = right.toElement();
116
117
      if (leftChild.tagName() != rightChild.tagName())
118
        continue;
119
120
      if ( left.childNodes().count() > 1 && right.childNodes().count() > 1 ) {
121
        compareNode( leftChild, rightChild );
122
123
        if ( !left.hasChildNodes() && !right.hasChildNodes() ) {
124
          left.parentNode().removeChild( left );
125
          right.parentNode().removeChild( right );
126
          goto top;
127
        }
128
129
        break;
130
      }
131
132
      if ( leftChild.text() == rightChild.text() ) {
133
        QString id = leftChild.tagName();
134
135
        if ( id == "Content" )
136
          id = left.parentNode().nodeName(); 
137
 
138
	if ( id != "Type" )
139
          //matchingField( id, leftChild.text(), rightChild.text() );
140
141
        left.parentNode().removeChild( left );
142
        right.parentNode().removeChild( right );
143
        goto top;
144
      }
145
    }
146
  }
147
148
  appendConflictNodes(rightElement, leftElement);
149
150
  appendSingleNodes(rightElement, false);
151
  appendSingleNodes(leftElement, true);
152
}
153
154
void XmlDiffAlgo::run()
155
{
156
  kdDebug() << __func__ << endl;	
157
  begin();
158
159
  QDomElement leftElement = mLeftXml.documentElement();
160
  QDomElement rightElement = mRightXml.documentElement();
161
162
  compareNode( leftElement, rightElement );
163
164
  end();
165
}
166
(-)kitchensync.orig/src/xmldiffalgo.h (+54 lines)
Line 0 Link Here
1
/*
2
    This file is part of KitchenSync 
3
4
    Copyright (c) 2006 Daniel Gollub <dgollub@suse.de>
5
6
    This program is free software; you can redistribute it and/or
7
    modify it under the terms of the GNU Library General Public
8
    License as published by the Free Software Foundation; either
9
    version 2 of the License, or (at your option) any later version.
10
11
    This library is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
    Library General Public License for more details.
15
16
    You should have received a copy of the GNU Library General Public License
17
    along with this library; see the file COPYING.LIB.  If not, write to
18
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
    Boston, MA 02110-1301, USA.
20
*/
21
22
#ifndef KSYNC_XMLDIFFALGO_H
23
#define KSYNC_XMLDIFFALGO_H
24
25
#include <qdom.h>
26
27
#include <libkdepim/diffalgo.h>
28
29
using namespace KPIM;
30
31
namespace KSync {
32
33
class XmlDiffAlgo : public DiffAlgo
34
{
35
  public:
36
    XmlDiffAlgo( const QString &leftXml, const QString &rightXml );
37
    XmlDiffAlgo( const QDomDocument &leftXml, const QDomDocument &rightXml );
38
39
    void run();
40
41
  private:
42
    void appendConflictNodes(QDomElement &leftElement, QDomElement &rightElement);
43
    void appendSingleNodes(QDomElement &element, bool isLeft);
44
45
46
    void compareNode(QDomElement &leftElement, QDomElement &rightElement);
47
48
    QDomDocument mLeftXml;
49
    QDomDocument mRightXml;
50
};
51
52
}
53
54
#endif

Return to bug 202974