-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
kpropertiesdialog_p.h
304 lines (248 loc) · 7.86 KB
/
kpropertiesdialog_p.h
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
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
Copyright (c) 1999, 2000 Preston Brown <pbrown@kde.org>
Copyright (c) 2000 Simon Hausmann <hausmann@kde.org>
Copyright (c) 2000 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/*
* This file holds the definitions for all classes used to
* display a properties dialog.
*/
#ifndef KPROPERTIESDIALOGP_H
#define KPROPERTIESDIALOGP_H
#include "kpropertiesdialog.h"
#include <QCryptographicHash>
class QComboBox;
class QLabel;
namespace KDEPrivate
{
/**
* 'General' plugin
* This plugin displays the name of the file, its size and access times.
* @internal
*/
class KFilePropsPlugin : public KPropertiesDialogPlugin
{
Q_OBJECT
public:
/**
* Constructor
*/
explicit KFilePropsPlugin(KPropertiesDialog *_props);
virtual ~KFilePropsPlugin();
/**
* Applies all changes made. This plugin must be always the first
* plugin in the dialog, since this function may rename the file which
* may confuse other applyChanges functions.
*/
void applyChanges() override;
/**
* Tests whether the files specified by _items need a 'General' plugin.
*/
static bool supports(const KFileItemList &_items);
/**
* Called after all plugins applied their changes
*/
void postApplyChanges();
void setFileNameReadOnly(bool ro);
protected Q_SLOTS:
void slotEditFileType();
void slotCopyFinished(KJob *);
void slotFileRenamed(KIO::Job *, const QUrl &, const QUrl &);
void slotDirSizeUpdate();
void slotDirSizeFinished(KJob *);
void slotFreeSpaceResult(KIO::Job *job, KIO::filesize_t size, KIO::filesize_t available);
void slotSizeStop();
void slotSizeDetermine();
void slotSizeDetails();
Q_SIGNALS:
void leaveModality();
private Q_SLOTS:
void nameFileChanged(const QString &text);
void slotIconChanged();
private:
bool enableIconButton() const;
void determineRelativePath(const QString &path);
void applyIconChanges();
class KFilePropsPluginPrivate;
KFilePropsPluginPrivate *const d;
};
/**
* 'Permissions' plugin
* In this plugin you can modify permissions and change
* the owner of a file.
* @internal
*/
class KFilePermissionsPropsPlugin : public KPropertiesDialogPlugin
{
Q_OBJECT
public:
enum PermissionsMode {
PermissionsOnlyFiles = 0,
PermissionsOnlyDirs = 1,
PermissionsOnlyLinks = 2,
PermissionsMixed = 3
};
enum PermissionsTarget {
PermissionsOwner = 0,
PermissionsGroup = 1,
PermissionsOthers = 2
};
/**
* Constructor
*/
explicit KFilePermissionsPropsPlugin(KPropertiesDialog *_props);
virtual ~KFilePermissionsPropsPlugin();
void applyChanges() override;
/**
* Tests whether the file specified by _items needs a 'Permissions' plugin.
*/
static bool supports(const KFileItemList &_items);
private Q_SLOTS:
void slotChmodResult(KJob *);
void slotShowAdvancedPermissions();
Q_SIGNALS:
void leaveModality();
private:
void setComboContent(QComboBox *combo, PermissionsTarget target,
mode_t permissions, mode_t partial);
bool isIrregular(mode_t permissions, bool isDir, bool isLink);
void enableAccessControls(bool enable);
void updateAccessControls();
void getPermissionMasks(mode_t &andFilePermissions,
mode_t &andDirPermissions,
mode_t &orFilePermissions,
mode_t &orDirPermissions);
static const mode_t permissionsMasks[3];
static const mode_t standardPermissions[4];
static const char *const permissionsTexts[4][4];
static const mode_t fperm[3][4];
class KFilePermissionsPropsPluginPrivate;
KFilePermissionsPropsPluginPrivate *const d;
};
class KChecksumsPlugin : public KPropertiesDialogPlugin
{
Q_OBJECT
public:
explicit KChecksumsPlugin(KPropertiesDialog *dialog);
virtual ~KChecksumsPlugin();
static bool supports(const KFileItemList &items);
private Q_SLOTS:
void slotInvalidateCache();
void slotShowMd5();
void slotShowSha1();
void slotShowSha256();
void slotShowSha512();
/**
* Compare @p input (required to be lowercase) with the checksum in cache.
*/
void slotVerifyChecksum(const QString &input);
private:
static bool isMd5(const QString &input);
static bool isSha1(const QString &input);
static bool isSha256(const QString &input);
static bool isSha512(const QString &input);
static QString computeChecksum(QCryptographicHash::Algorithm algorithm, const QString &path);
static QCryptographicHash::Algorithm detectAlgorithm(const QString &input);
void setDefaultState();
void setInvalidChecksumState();
void setMatchState();
void setMismatchState();
void setVerifyState();
void showChecksum(QCryptographicHash::Algorithm algorithm, QLabel *label, QPushButton *copyButton);
QString cachedChecksum(QCryptographicHash::Algorithm algorithm) const;
void cacheChecksum(const QString &checksum, QCryptographicHash::Algorithm algorithm);
class KChecksumsPluginPrivate;
KChecksumsPluginPrivate *const d;
};
/**
* Used to edit the files containing
* [Desktop Entry]
* URL=....
*
* Such files are used to represent a program in kicker and konqueror.
* @internal
*/
class KUrlPropsPlugin : public KPropertiesDialogPlugin
{
Q_OBJECT
public:
/**
* Constructor
*/
explicit KUrlPropsPlugin(KPropertiesDialog *_props);
virtual ~KUrlPropsPlugin();
void applyChanges() override;
void setFileNameReadOnly(bool ro);
static bool supports(const KFileItemList &_items);
private:
class KUrlPropsPluginPrivate;
KUrlPropsPluginPrivate *const d;
};
/**
* Properties plugin for device .desktop files
* @internal
*/
class KDevicePropsPlugin : public KPropertiesDialogPlugin
{
Q_OBJECT
public:
explicit KDevicePropsPlugin(KPropertiesDialog *_props);
virtual ~KDevicePropsPlugin();
void applyChanges() override;
static bool supports(const KFileItemList &_items);
private Q_SLOTS:
void slotActivated(int);
void slotDeviceChanged();
void slotFoundMountPoint(const QString &mp, quint64 kibSize,
quint64 kibUsed, quint64 kibAvail);
private:
void updateInfo();
private:
class KDevicePropsPluginPrivate;
KDevicePropsPluginPrivate *const d;
};
/**
* Used to edit the files containing
* [Desktop Entry]
* Type=Application
*
* Such files are used to represent a program in kicker and konqueror.
* @internal
*/
class KDesktopPropsPlugin : public KPropertiesDialogPlugin
{
Q_OBJECT
public:
/**
* Constructor
*/
explicit KDesktopPropsPlugin(KPropertiesDialog *_props);
virtual ~KDesktopPropsPlugin();
void applyChanges() override;
static bool supports(const KFileItemList &_items);
public Q_SLOTS:
void slotAddFiletype();
void slotDelFiletype();
void slotBrowseExec();
void slotAdvanced();
private:
void checkCommandChanged();
private:
class KDesktopPropsPluginPrivate;
KDesktopPropsPluginPrivate *const d;
};
}
#endif