blob: 1f1e75b0ef73fab66ef35bce54b8d320af26449c (
plain)
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
/*
* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
*
* 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 or (at your option)
* version 3 of the License.
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#include "Metadata.h"
#include "Database.h"
Metadata::Metadata(Database* parent)
: QObject(parent)
{
m_generator = "KeePassX";
m_maintenanceHistoryDays = 365;
m_recycleBin = 0;
m_entryTemplatesGroup = 0;
m_lastSelectedGroup = 0;
m_lastTopVisibleGroup = 0;
QDateTime now = QDateTime::currentDateTime();
m_nameChanged = now;
m_descriptionChanged = now;
m_defaultUserNameChanged = now;
m_recycleBinChanged = now;
m_entryTemplatesGroupChanged = now;
m_masterKeyChanged = now;
m_protectTitle = false;
m_protectUsername = false;
m_protectPassword = true;
m_protectUrl = false;
m_protectNotes = false;
// TODO initalize all members
}
QString Metadata::generator() const
{
return m_generator;
}
QString Metadata::name() const
{
return m_name;
}
QDateTime Metadata::nameChanged() const
{
return m_nameChanged;
}
QString Metadata::description() const
{
return m_description;
}
QDateTime Metadata::descriptionChanged() const
{
return m_descriptionChanged;
}
QString Metadata::defaultUserName() const
{
return m_defaultUserName;
}
QDateTime Metadata::defaultUserNameChanged() const
{
return m_defaultUserNameChanged;
}
int Metadata::maintenanceHistoryDays() const
{
return m_maintenanceHistoryDays;
}
bool Metadata::protectTitle() const
{
return m_protectTitle;
}
bool Metadata::protectUsername() const
{
return m_protectUsername;
}
bool Metadata::protectPassword() const
{
return m_protectPassword;
}
bool Metadata::protectUrl() const
{
return m_protectUrl;
}
bool Metadata::protectNotes() const
{
return m_protectNotes;
}
bool Metadata::autoEnableVisualHiding() const
{
return m_autoEnableVisualHiding;
}
QIcon Metadata::customIcon(const Uuid& uuid) const
{
return m_customIcons.value(uuid);
}
QHash<Uuid, QIcon> Metadata::customIcons() const
{
return m_customIcons;
}
bool Metadata::recycleBinEnabled() const
{
return m_recycleBinEnabled;
}
const Group* Metadata::recycleBin() const
{
return m_recycleBin;
}
QDateTime Metadata::recycleBinChanged() const
{
return m_recycleBinChanged;
}
const Group* Metadata::entryTemplatesGroup() const
{
return m_entryTemplatesGroup;
}
QDateTime Metadata::entryTemplatesGroupChanged() const
{
return m_entryTemplatesGroupChanged;
}
const Group* Metadata::lastSelectedGroup() const
{
return m_lastSelectedGroup;
}
const Group* Metadata::lastTopVisibleGroup() const
{
return m_lastTopVisibleGroup;
}
QDateTime Metadata::masterKeyChanged() const
{
return m_masterKeyChanged;
}
int Metadata::masterKeyChangeRec() const
{
return m_masterKeyChangeRec;
}
int Metadata::masterKeyChangeForce() const
{
return m_masterKeyChangeForce;
}
QHash<QString, QString> Metadata::customFields() const
{
return m_customFields;
}
void Metadata::setGenerator(const QString& value)
{
m_generator = value;
}
void Metadata::setName(const QString& value)
{
m_name = value;
}
void Metadata::setNameChanged(const QDateTime& value)
{
m_nameChanged = value;
}
void Metadata::setDescription(const QString& value)
{
m_description = value;
}
void Metadata::setDescriptionChanged(const QDateTime& value)
{
m_descriptionChanged = value;
}
void Metadata::setDefaultUserName(const QString& value)
{
m_defaultUserName = value;
}
void Metadata::setDefaultUserNameChanged(const QDateTime& value)
{
m_defaultUserNameChanged = value;
}
void Metadata::setMaintenanceHistoryDays(int value)
{
m_maintenanceHistoryDays = value;
}
void Metadata::setProtectTitle(bool value)
{
m_protectTitle = value;
}
void Metadata::setProtectUsername(bool value)
{
m_protectUsername = value;
}
void Metadata::setProtectPassword(bool value)
{
m_protectPassword = value;
}
void Metadata::setProtectUrl(bool value)
{
m_protectUrl = value;
}
void Metadata::setProtectNotes(bool value)
{
m_protectNotes = value;
}
void Metadata::setAutoEnableVisualHiding(bool value)
{
m_autoEnableVisualHiding = value;
}
void Metadata::addCustomIcon(const Uuid& uuid, const QIcon& icon)
{
Q_ASSERT(!uuid.isNull());
Q_ASSERT(!m_customIcons.contains(uuid));
m_customIcons.insert(uuid, icon);
}
void Metadata::removeCustomIcon(const Uuid& uuid)
{
Q_ASSERT(!uuid.isNull());
Q_ASSERT(m_customIcons.contains(uuid));
m_customIcons.remove(uuid);
}
void Metadata::setRecycleBinEnabled(bool value)
{
m_recycleBinEnabled = value;
}
void Metadata::setRecycleBin(Group* group)
{
m_recycleBin = group;
}
void Metadata::setRecycleBinChanged(const QDateTime& value)
{
m_recycleBinChanged = value;
}
void Metadata::setEntryTemplatesGroup(Group* group)
{
m_entryTemplatesGroup = group;
}
void Metadata::setEntryTemplatesGroupChanged(const QDateTime& value)
{
m_entryTemplatesGroupChanged = value;
}
void Metadata::setLastSelectedGroup(Group* group)
{
m_lastSelectedGroup = group;
}
void Metadata::setLastTopVisibleGroup(Group* group)
{
m_lastTopVisibleGroup = group;
}
void Metadata::setMasterKeyChanged(const QDateTime& value)
{
m_masterKeyChanged = value;
}
void Metadata::setMasterKeyChangeRec(int value)
{
m_masterKeyChangeRec = value;
}
void Metadata::setMasterKeyChangeForce(int value)
{
m_masterKeyChangeForce = value;
}
void Metadata::addCustomField(const QString& key, const QString& value)
{
Q_ASSERT(!m_customFields.contains(key));
m_customFields.insert(key, value);
}
void Metadata::removeCustomField(const QString& key)
{
Q_ASSERT(m_customFields.contains(key));
m_customFields.remove(key);
}
|