Fix typo found by Yuri Chornoivan
[kdepim.git] / libkdepim / diffalgo.h
blobc2e09849852e96cc1598d706234bde1db6adbed7
1 /*
2 This file is part of libkdepim.
4 Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
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.
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.
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.
22 #ifndef KDEPIM_DIFFALGO_H
23 #define KDEPIM_DIFFALGO_H
25 #include "kdepim_export.h"
26 #include <QList>
28 namespace KPIM {
30 /**
31 DiffAlgo and DiffAlgoDisplay work together for displaying differences between
32 two PIM objects like contacts, events or todos.
33 DiffAlgo is the bas class for the diffing algorithm and DiffAlgoDisplay is
34 responsible for representation. The separation makes it possible to use one
35 display for all diffing algorithm and vice versa.
37 class DiffAlgoDisplay
39 public:
40 virtual ~DiffAlgoDisplay(){}
41 /**
42 Is called on the start of the diff.
44 virtual void begin() = 0;
46 /**
47 Is called on the end of the diff.
49 virtual void end() = 0;
51 /**
52 Sets the title of the left data source.
54 virtual void setLeftSourceTitle( const QString &title ) = 0;
56 /**
57 Sets the title of the right data source.
59 virtual void setRightSourceTitle( const QString &title ) = 0;
61 /**
62 Adds a field which is only available in the left data source.
64 virtual void additionalLeftField( const QString &id, const QString &value ) = 0;
66 /**
67 Adds a field which is only available in the right data source.
69 virtual void additionalRightField( const QString &id, const QString &value ) = 0;
71 /**
72 Adds a conflict between two fields.
74 virtual void conflictField( const QString &id, const QString &leftValue,
75 const QString &rightValue ) = 0;
79 class KDEPIM_EXPORT DiffAlgo
81 public:
82 /**
83 Destructor.
85 virtual ~DiffAlgo() {}
87 /**
88 Starts the diffing algorithm.
90 virtual void run() = 0;
92 /**
93 Must be called on the start of the diff.
95 void begin();
97 /**
98 Must be called on the end of the diff.
100 void end();
103 Sets the title of the left data source.
105 void setLeftSourceTitle( const QString &title );
108 Sets the title of the right data source.
110 void setRightSourceTitle( const QString &title );
113 Adds a field which is only available in the left data source.
115 void additionalLeftField( const QString &id, const QString &value );
118 Adds a field which is only available in the right data source.
120 void additionalRightField( const QString &id, const QString &value );
123 Adds a conflict between two fields.
125 void conflictField( const QString &id, const QString &leftValue,
126 const QString &rightValue );
128 void addDisplay( DiffAlgoDisplay *display );
129 void removeDisplay( DiffAlgoDisplay *display );
132 private:
133 QList<DiffAlgoDisplay*> mDisplays;
138 #endif