1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
/***************************************************************************
* Copyright (C) 2004-2009 by Thomas Fischer *
* [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef KBIBTEXMERGEELEMENTS_H
#define KBIBTEXMERGEELEMENTS_H
#include <kdialogbase.h>
#include "findduplicates.h"
#include "file.h"
#include "entry.h"
class KPushButton;
class KTextEdit;
class TDEListView;
class TQProgressBar;
namespace KBibTeX
{
class MergeElementsCliqueItem : public TQObject, public TQCheckListItem
{
TQ_OBJECT
public:
MergeElementsCliqueItem( BibTeX::Entry* entry, BibTeX::Macro* macro, BibTeX::Preamble* preamble, TQListView *parent );
BibTeX::Entry* entry;
BibTeX::Macro* macro;
BibTeX::Preamble* preamble;
protected:
void stateChange( bool );
signals:
void stateChanged( MergeElementsCliqueItem* );
};
class MergeEntriesAlternativesController: public TQCheckListItem
{
public:
MergeEntriesAlternativesController( const TQString &label, TQListView *parent );
MergeEntriesAlternativesController( BibTeX::EntryField::FieldType fieldType, TQListView *parent );
BibTeX::EntryField::FieldType fieldType;
const TQString fieldName;
};
class MergeMacrosAlternativesController: public TQCheckListItem
{
public:
MergeMacrosAlternativesController( bool isKey, TQListView *parent );
};
class MergeEntriesAlternativesItem: public TQCheckListItem
{
public:
MergeEntriesAlternativesItem( BibTeX::EntryField *field, MergeEntriesAlternativesController *parent );
BibTeX::EntryField *field;
};
class MergeMacrosAlternativesItem: public TQCheckListItem
{
public:
MergeMacrosAlternativesItem( BibTeX::Value *value, MergeMacrosAlternativesController *parent );
BibTeX::Value *value;
};
class MergeElementsAlternativesId: public TQCheckListItem
{
public:
MergeElementsAlternativesId( const TQString &id, MergeEntriesAlternativesController *parent );
TQString id;
};
class MergeMacroAlternativesKey: public TQCheckListItem
{
public:
MergeMacroAlternativesKey( const TQString &key, MergeMacrosAlternativesController *parent );
TQString key;
};
class MergeEntriesAlternativesEntryType: public TQCheckListItem
{
public:
MergeEntriesAlternativesEntryType( const TQString &typeString, MergeEntriesAlternativesController *parent );
MergeEntriesAlternativesEntryType( BibTeX::Entry::EntryType type, MergeEntriesAlternativesController *parent );
TQString typeString;
BibTeX::Entry::EntryType type;
};
class MergePreambleAlternativesController: public TQCheckListItem
{
public:
MergePreambleAlternativesController( TQListView *parent );
};
class MergePreambleAlternatives: public TQCheckListItem
{
public:
MergePreambleAlternatives( const TQString &text, MergePreambleAlternativesController *parent );
TQString text;
};
/**
@author Thomas Fischer <[email protected]>
*/
class MergeElements : public KDialogBase
{
TQ_OBJECT
public:
MergeElements( TQWidget *parent );
~MergeElements();
int mergeDuplicates( BibTeX::File *bibTeXFile );
protected:
void showEvent( TQShowEvent * );
protected slots:
void slotRefreshAlternatives();
void slotNextClique();
void slotPreviousClique();
void slotPreviewElement( TQListViewItem *item );
void saveCurrentMergeSet();
void slotRestore();
private:
typedef struct
{
BibTeX::Macro *macro;
BibTeX::Entry *entry;
BibTeX::EntryField *field;
} First;
typedef struct
{
TQValueList<BibTeX::Macro*> macros;
TQValueList<BibTeX::Entry*> entries;
TQValueList<BibTeX::EntryField*> fields;
TQValueList<BibTeX::Preamble*> preambles;
TQString macroKey;
BibTeX::Value *macroValue;
TQString id, typeString;
BibTeX::Entry::EntryType type;
TQString preambleText;
} MergeSet;
TDEListView *m_listViewClique;
TDEListView *m_listViewAlternatives;
TQProgressBar *m_progressBar;
FindDuplicates::DuplicateCliqueList m_duplicateCliqueList;
MergeSet **m_mergeSetList;
int m_currentCliqueIndex;
void setupGUI();
void setClique( int cliqueIndex );
void restoreCurrentMergeSet();
void applyMergeSet( BibTeX::File *bibTeXFile, BibTeX::File *otherBibTeXFile = NULL );
void restoreWindowSize( TDEConfig *config );
void saveWindowSize( TDEConfig *config ) const;
};
}
#endif // KBIBTEXMERGEELEMENTS_H
|