1 /***************************************************************************
2 The configuration page for the synchronization options
3 -------------------
4 begin : So Nov 20 2005
5 copyright : (C) 2005-2019 by Alexander Reinholdt
6 email : alexander.reinholdt@kdemail.net
7 ***************************************************************************/
8
9 /***************************************************************************
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, but *
16 * WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
18 * General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,*
23 * MA 02110-1335, USA *
24 ***************************************************************************/
25
26 // application specific includes
27 #include "smb4kconfigpagesynchronization.h"
28 #include "core/smb4ksettings.h"
29
30 // Qt includes
31 #include <QGridLayout>
32 #include <QVBoxLayout>
33 #include <QGroupBox>
34 #include <QLabel>
35 #include <QCheckBox>
36 #include <QSpinBox>
37 #include <QButtonGroup>
38
39 // KDE includes
40 #include <KI18n/KLocalizedString>
41 #include <KIOWidgets/KUrlRequester>
42 #include <KCompletion/KLineEdit>
43
44
Smb4KConfigPageSynchronization(QWidget * parent)45 Smb4KConfigPageSynchronization::Smb4KConfigPageSynchronization(QWidget *parent)
46 : QTabWidget(parent)
47 {
48 //
49 // 'Basic Settings' tab
50 //
51 QWidget *basicTab = new QWidget(this);
52 QVBoxLayout *basicTabLayout = new QVBoxLayout(basicTab);
53
54 // Default destination (rsync)
55 QGroupBox *pathsBox = new QGroupBox(i18n("Default Destination"), basicTab);
56 QGridLayout *pathsBoxLayout = new QGridLayout(pathsBox);
57
58 QLabel *rsyncPrefixLabel = new QLabel(Smb4KSettings::self()->rsyncPrefixItem()->label(), pathsBox);
59 KUrlRequester *rsyncPrefix = new KUrlRequester(pathsBox);
60 rsyncPrefix->setMode(KFile::Directory|KFile::LocalOnly);
61 rsyncPrefix->setObjectName("kcfg_RsyncPrefix");
62 rsyncPrefixLabel->setBuddy(rsyncPrefix);
63
64 pathsBoxLayout->addWidget(rsyncPrefixLabel, 0, 0);
65 pathsBoxLayout->addWidget(rsyncPrefix, 0, 1);
66
67 // Behavior
68 QGroupBox *behaviorBox = new QGroupBox(i18n("Behavior"), basicTab);
69 QGridLayout *behaviorBoxLayout = new QGridLayout(behaviorBox);
70
71 QCheckBox *archiveMode = new QCheckBox(Smb4KSettings::self()->archiveModeItem()->label(), behaviorBox);
72 archiveMode->setObjectName("kcfg_ArchiveMode");
73 QCheckBox *recurseDirs = new QCheckBox(Smb4KSettings::self()->recurseIntoDirectoriesItem()->label(), behaviorBox);
74 recurseDirs->setObjectName("kcfg_RecurseIntoDirectories");
75 QCheckBox *relativePaths = new QCheckBox(Smb4KSettings::self()->relativePathNamesItem()->label(), behaviorBox);
76 relativePaths->setObjectName("kcfg_RelativePathNames");
77 QCheckBox *noImpliedDirs = new QCheckBox(Smb4KSettings::self()->noImpliedDirectoriesItem()->label(), behaviorBox);
78 noImpliedDirs->setObjectName("kcfg_NoImpliedDirectories");
79 QCheckBox *transferDirs = new QCheckBox(Smb4KSettings::self()->transferDirectoriesItem()->label(), behaviorBox);
80 transferDirs->setObjectName("kcfg_TransferDirectories");
81
82 behaviorBoxLayout->addWidget(archiveMode, 0, 0);
83 behaviorBoxLayout->addWidget(recurseDirs, 0, 1);
84 behaviorBoxLayout->addWidget(relativePaths, 1, 0);
85 behaviorBoxLayout->addWidget(noImpliedDirs, 1, 1);
86 behaviorBoxLayout->addWidget(transferDirs, 2, 0);
87
88 // Backup
89 QGroupBox *backupBox = new QGroupBox(i18n("Backup"), basicTab);
90 QGridLayout *backupBoxLayout = new QGridLayout(backupBox);
91
92 QCheckBox *makeBackups = new QCheckBox(Smb4KSettings::self()->makeBackupsItem()->label(), backupBox);
93 makeBackups->setObjectName("kcfg_MakeBackups");
94 QCheckBox *backupSuffixButton = new QCheckBox(Smb4KSettings::self()->useBackupSuffixItem()->label(), backupBox);
95 backupSuffixButton->setObjectName("kcfg_UseBackupSuffix");
96 KLineEdit *backupSuffix = new KLineEdit(backupBox);
97 backupSuffix->setObjectName("kcfg_BackupSuffix");
98 backupSuffix->setClearButtonEnabled(true);
99 QCheckBox *backupDirButton = new QCheckBox(Smb4KSettings::self()->useBackupDirectoryItem()->label(), backupBox);
100 backupDirButton->setObjectName("kcfg_UseBackupDirectory");
101 KUrlRequester *backupDir= new KUrlRequester(backupBox);
102 backupDir->setObjectName("kcfg_BackupDirectory");
103 backupDir->setMode(KFile::Directory | KFile::LocalOnly);
104
105 backupBoxLayout->addWidget(makeBackups, 0, 0);
106 backupBoxLayout->addWidget(backupSuffixButton, 1, 0);
107 backupBoxLayout->addWidget(backupSuffix, 1, 1);
108 backupBoxLayout->addWidget(backupDirButton, 2, 0);
109 backupBoxLayout->addWidget(backupDir, 2, 1);
110
111 basicTabLayout->addWidget(pathsBox, 0);
112 basicTabLayout->addWidget(behaviorBox, 0);
113 basicTabLayout->addWidget(backupBox, 0);
114 basicTabLayout->addStretch(100);
115
116 addTab(basicTab, i18n("Basic Settings"));
117
118 //
119 // 'File Handling' tab
120 //
121 QWidget *fileHandlingTab = new QWidget(this);
122 QVBoxLayout *fileHandlingTabLayout = new QVBoxLayout(fileHandlingTab);
123
124 // General
125 QGroupBox *generalHandlingBox = new QGroupBox(i18n("General"), fileHandlingTab);
126 QGridLayout *generalHandlingBoxLayout = new QGridLayout(generalHandlingBox);
127
128 QCheckBox *updateTarget = new QCheckBox(Smb4KSettings::self()->updateTargetItem()->label(), generalHandlingBox);
129 updateTarget->setObjectName("kcfg_UpdateTarget");
130 QCheckBox *updateInPlace = new QCheckBox(Smb4KSettings::self()->updateInPlaceItem()->label(), generalHandlingBox);
131 updateInPlace->setObjectName("kcfg_UpdateInPlace");
132 QCheckBox *sparseFiles = new QCheckBox(Smb4KSettings::self()->efficientSparseFileHandlingItem()->label(), generalHandlingBox);
133 sparseFiles->setObjectName("kcfg_EfficientSparseFileHandling");
134 QCheckBox *copyFilesWhole = new QCheckBox(Smb4KSettings::self()->copyFilesWholeItem()->label(), generalHandlingBox);
135 copyFilesWhole->setObjectName("kcfg_CopyFilesWhole");
136 QCheckBox *updateExisting = new QCheckBox(Smb4KSettings::self()->updateExistingItem()->label(), generalHandlingBox);
137 updateExisting->setObjectName("kcfg_UpdateExisting");
138 QCheckBox *ignoreExisting = new QCheckBox(Smb4KSettings::self()->ignoreExistingItem()->label(), generalHandlingBox);
139 ignoreExisting->setObjectName("kcfg_IgnoreExisting");
140
141 generalHandlingBoxLayout->addWidget(updateTarget, 0, 0);
142 generalHandlingBoxLayout->addWidget(updateInPlace, 0, 1);
143 generalHandlingBoxLayout->addWidget(sparseFiles, 1, 0);
144 generalHandlingBoxLayout->addWidget(copyFilesWhole, 1, 1);
145 generalHandlingBoxLayout->addWidget(updateExisting, 2, 0);
146 generalHandlingBoxLayout->addWidget(ignoreExisting, 2, 1);
147
148 // Links
149 QGroupBox *linksBox = new QGroupBox(i18n("Links"), fileHandlingTab);
150 QGridLayout *linksBoxLayout = new QGridLayout(linksBox);
151
152 QCheckBox *preserveLinks = new QCheckBox(Smb4KSettings::self()->preserveSymlinksItem()->label(), linksBox);
153 preserveLinks->setObjectName("kcfg_PreserveSymlinks");
154 QCheckBox *transformLinks = new QCheckBox(Smb4KSettings::self()->transformSymlinksItem()->label(), linksBox);
155 transformLinks->setObjectName("kcfg_TransformSymlinks");
156 QCheckBox *transformUnsafe = new QCheckBox(Smb4KSettings::self()->transformUnsafeSymlinksItem()->label(), linksBox);
157 transformUnsafe->setObjectName("kcfg_TransformUnsafeSymlinks");
158 QCheckBox *ignoreUnsafe = new QCheckBox(Smb4KSettings::self()->ignoreUnsafeSymlinksItem()->label(), linksBox);
159 ignoreUnsafe->setObjectName("kcfg_IgnoreUnsafeSymlinks");
160 QCheckBox *mungeLinks = new QCheckBox(Smb4KSettings::self()->mungeSymlinksItem()->label(), linksBox);
161 mungeLinks->setObjectName("kcfg_MungeSymlinks");
162 QCheckBox *preserveHlinks = new QCheckBox(Smb4KSettings::self()->preserveHardLinksItem()->label(), linksBox);
163 preserveHlinks->setObjectName("kcfg_PreserveHardLinks");
164 QCheckBox *copyDirLinks = new QCheckBox(Smb4KSettings::self()->copyDirectorySymlinksItem()->label(), linksBox);
165 copyDirLinks->setObjectName("kcfg_CopyDirectorySymlinks");
166 QCheckBox *keepDirLinks = new QCheckBox(Smb4KSettings::self()->keepDirectorySymlinksItem()->label(), linksBox);
167 keepDirLinks->setObjectName("kcfg_KeepDirectorySymlinks");
168
169 linksBoxLayout->addWidget(preserveLinks, 0, 0);
170 linksBoxLayout->addWidget(transformLinks, 0, 1);
171 linksBoxLayout->addWidget(transformUnsafe, 1, 0);
172 linksBoxLayout->addWidget(ignoreUnsafe, 1, 1);
173 linksBoxLayout->addWidget(mungeLinks, 2, 0);
174 linksBoxLayout->addWidget(preserveHlinks, 2, 1);
175 linksBoxLayout->addWidget(copyDirLinks, 3, 0);
176 linksBoxLayout->addWidget(keepDirLinks, 3, 1);
177
178 // Permissions & Attributes
179 QGroupBox *permissionsBox = new QGroupBox(i18n("Permissions, etc."), fileHandlingTab);
180 QGridLayout *permissionsBoxLayout = new QGridLayout(permissionsBox);
181
182 QCheckBox *preservePerms = new QCheckBox(Smb4KSettings::self()->preservePermissionsItem()->label(), permissionsBox);
183 preservePerms->setObjectName("kcfg_PreservePermissions");
184 QCheckBox *preserveOwner = new QCheckBox(Smb4KSettings::self()->preserveOwnerItem()->label(), permissionsBox);
185 preserveOwner->setObjectName("kcfg_PreserveOwner");
186 QCheckBox *preserveGroup = new QCheckBox(Smb4KSettings::self()->preserveGroupItem()->label(), permissionsBox);
187 preserveGroup->setObjectName("kcfg_PreserveGroup");
188 QCheckBox *preserveDevices = new QCheckBox(Smb4KSettings::self()->preserveDevicesAndSpecialsItem()->label(), permissionsBox);
189 preserveDevices->setObjectName("kcfg_PreserveDevicesAndSpecials");
190 QCheckBox *preserveTimes = new QCheckBox(Smb4KSettings::self()->preserveTimesItem()->label(), permissionsBox);
191 preserveTimes->setObjectName("kcfg_PreserveTimes");
192 QCheckBox *omitDirTimes = new QCheckBox(Smb4KSettings::self()->omitDirectoryTimesItem()->label(), permissionsBox);
193 omitDirTimes->setObjectName("kcfg_OmitDirectoryTimes");
194
195 permissionsBoxLayout->addWidget(preservePerms, 0, 0);
196 permissionsBoxLayout->addWidget(preserveOwner, 0, 1);
197 permissionsBoxLayout->addWidget(preserveGroup, 1, 0);
198 permissionsBoxLayout->addWidget(preserveDevices, 1, 1);
199 permissionsBoxLayout->addWidget(preserveTimes, 2, 0);
200 permissionsBoxLayout->addWidget(omitDirTimes, 2, 1);
201
202 fileHandlingTabLayout->addWidget(generalHandlingBox, 0);
203 fileHandlingTabLayout->addWidget(linksBox, 0);
204 fileHandlingTabLayout->addWidget(permissionsBox, 0);
205 fileHandlingTabLayout->addStretch(100);
206
207 addTab(fileHandlingTab, i18n("File Handling"));
208
209 //
210 // 'File Transfer' tab
211 //
212 QWidget *transferTab = new QWidget(this);
213 QVBoxLayout *transferTabLayout = new QVBoxLayout(transferTab);
214
215 // Compression
216 QGroupBox *compressionBox = new QGroupBox(i18n("Compression"), transferTab);
217 QGridLayout *compressionBoxLayout = new QGridLayout(compressionBox);
218
219 QCheckBox *compressData = new QCheckBox(Smb4KSettings::self()->compressDataItem()->label(), compressionBox);
220 compressData->setObjectName("kcfg_CompressData");
221 QCheckBox *compressionLevelButton = new QCheckBox(Smb4KSettings::self()->useCompressionLevelItem()->label(), compressionBox);
222 compressionLevelButton->setObjectName("kcfg_UseCompressionLevel");
223 QSpinBox *compressionLevel = new QSpinBox(compressionBox);
224 compressionLevel->setObjectName("kcfg_CompressionLevel");
225 QCheckBox *skipCompressionButton = new QCheckBox(Smb4KSettings::self()->useSkipCompressionItem()->label(), compressionBox);
226 skipCompressionButton->setObjectName("kcfg_UseSkipCompression");
227 KLineEdit *skipCompression = new KLineEdit(compressionBox);
228 skipCompression->setObjectName("kcfg_SkipCompression");
229 skipCompression->setClearButtonEnabled(true);
230
231 compressionBoxLayout->addWidget(compressData, 0, 0, 1, -1);
232 compressionBoxLayout->addWidget(compressionLevelButton, 1, 0);
233 compressionBoxLayout->addWidget(compressionLevel, 1, 1);
234 compressionBoxLayout->addWidget(skipCompressionButton, 2, 0);
235 compressionBoxLayout->addWidget(skipCompression, 2, 1);
236
237 // Files
238 QGroupBox *filesBox = new QGroupBox(i18n("Files"), transferTab);
239 QGridLayout *filesBoxLayout = new QGridLayout(filesBox);
240
241 QCheckBox *minTransferSizeButton = new QCheckBox(Smb4KSettings::self()->useMinimalTransferSizeItem()->label(), filesBox);
242 minTransferSizeButton->setObjectName("kcfg_UseMinimalTransferSize");
243 QSpinBox *minTransferSize = new QSpinBox(filesBox);
244 minTransferSize->setObjectName("kcfg_MinimalTransferSize");
245 minTransferSize->setSuffix(i18n(" KiB"));
246 QCheckBox *maxTransferSizeButton = new QCheckBox(Smb4KSettings::self()->useMaximalTransferSizeItem()->label(), filesBox);
247 maxTransferSizeButton->setObjectName("kcfg_UseMaximalTransferSize");
248 QSpinBox *maxTransferSize = new QSpinBox(filesBox);
249 maxTransferSize->setObjectName("kcfg_MaximalTransferSize");
250 maxTransferSize->setSuffix(i18n(" KiB"));
251 QCheckBox *keepPartial = new QCheckBox(Smb4KSettings::self()->keepPartialItem()->label(), filesBox);
252 keepPartial->setObjectName("kcfg_KeepPartial");
253 QCheckBox *partialDirButton = new QCheckBox(Smb4KSettings::self()->usePartialDirectoryItem()->label(), filesBox);
254 partialDirButton->setObjectName("kcfg_UsePartialDirectory");
255 KUrlRequester *partialDir = new KUrlRequester(filesBox);
256 partialDir->setObjectName("kcfg_PartialDirectory");
257 partialDir->setMode(KFile::Directory | KFile::LocalOnly);
258
259 filesBoxLayout->addWidget(minTransferSizeButton, 0, 0);
260 filesBoxLayout->addWidget(minTransferSize, 0, 1);
261 filesBoxLayout->addWidget(maxTransferSizeButton, 1, 0);
262 filesBoxLayout->addWidget(maxTransferSize, 1, 1);
263 filesBoxLayout->addWidget(keepPartial, 2, 0, 1, -1);
264 filesBoxLayout->addWidget(partialDirButton, 3, 0);
265 filesBoxLayout->addWidget(partialDir, 3, 1);
266
267 // Miscellaneous
268 QGroupBox *miscTransferBox = new QGroupBox(i18n("Miscellaneous"), transferTab);
269 QGridLayout *miscTransferBoxLayout = new QGridLayout(miscTransferBox);
270
271 QCheckBox *bwLimitButton = new QCheckBox(Smb4KSettings::self()->useBandwidthLimitItem()->label(), miscTransferBox);
272 bwLimitButton->setObjectName("kcfg_UseBandwidthLimit");
273 QSpinBox *bwLimit = new QSpinBox(miscTransferBox);
274 bwLimit->setObjectName("kcfg_BandwidthLimit");
275 bwLimit->setSuffix(i18n(" KiB/s"));
276
277 miscTransferBoxLayout->addWidget(bwLimitButton, 0, 0);
278 miscTransferBoxLayout->addWidget(bwLimit, 0, 1);
279
280 transferTabLayout->addWidget(compressionBox, 0);
281 transferTabLayout->addWidget(filesBox, 0);
282 transferTabLayout->addWidget(miscTransferBox, 0);
283 transferTabLayout->addStretch(100);
284
285 addTab(transferTab, i18n("File Transfer"));
286
287 //
288 // 'File Deletion' tab
289 //
290 QWidget *deleteTab = new QWidget(this);
291 QVBoxLayout *deleteTabLayout = new QVBoxLayout(deleteTab);
292
293 // Files and Directories
294 QGroupBox *filesAndDirsBox = new QGroupBox(i18n("Files && Directories"), deleteTab);
295 QGridLayout *filesAndDirsBoxLayout = new QGridLayout(filesAndDirsBox);
296
297 QCheckBox *removeSource = new QCheckBox(Smb4KSettings::self()->removeSourceFilesItem()->label(), filesAndDirsBox);
298 removeSource->setObjectName("kcfg_RemoveSourceFiles");
299 QCheckBox *deleteExtraneous = new QCheckBox(Smb4KSettings::self()->deleteExtraneousItem()->label(), filesAndDirsBox);
300 deleteExtraneous->setObjectName("kcfg_DeleteExtraneous");
301 QCheckBox *deleteBefore = new QCheckBox(Smb4KSettings::self()->deleteBeforeItem()->label(), filesAndDirsBox);
302 deleteBefore->setObjectName("kcfg_DeleteBefore");
303 QCheckBox *deleteAfter = new QCheckBox(Smb4KSettings::self()->deleteAfterItem()->label(), filesAndDirsBox);
304 deleteAfter->setObjectName("kcfg_DeleteAfter");
305 QCheckBox *deleteDuring = new QCheckBox(Smb4KSettings::self()->deleteDuringItem()->label(), filesAndDirsBox);
306 deleteDuring->setObjectName("kcfg_DeleteDuring");
307 QCheckBox *deleteExcluded = new QCheckBox(Smb4KSettings::self()->deleteExcludedItem()->label(), filesAndDirsBox);
308 deleteExcluded->setObjectName("kcfg_DeleteExcluded");
309 QCheckBox *ignoreIOErrors = new QCheckBox(Smb4KSettings::self()->ignoreErrorsItem()->label(), filesAndDirsBox);
310 ignoreIOErrors->setObjectName("kcfg_IgnoreErrors");
311 QCheckBox *forceDirDeletion = new QCheckBox(Smb4KSettings::self()->forceDirectoryDeletionItem()->label(), filesAndDirsBox);
312 forceDirDeletion->setObjectName("kcfg_ForceDirectoryDeletion");
313
314 filesAndDirsBoxLayout->addWidget(removeSource, 0, 0);
315 filesAndDirsBoxLayout->addWidget(deleteExtraneous, 0, 1);
316 filesAndDirsBoxLayout->addWidget(deleteBefore, 1, 0);
317 filesAndDirsBoxLayout->addWidget(deleteAfter, 1, 1);
318 filesAndDirsBoxLayout->addWidget(deleteDuring, 2, 0);
319 filesAndDirsBoxLayout->addWidget(deleteExcluded, 2, 1);
320 filesAndDirsBoxLayout->addWidget(ignoreIOErrors, 3, 0);
321 filesAndDirsBoxLayout->addWidget(forceDirDeletion, 3, 1);
322
323 // Restrictions
324 QGroupBox *restrictionsBox = new QGroupBox(i18n("Restrictions"), deleteTab);
325 QGridLayout *restrictionsBoxLayout = new QGridLayout(restrictionsBox);
326
327 QCheckBox *maxDeleteButton = new QCheckBox(Smb4KSettings::self()->useMaximumDeleteItem()->label(), restrictionsBox);
328 maxDeleteButton->setObjectName("kcfg_UseMaximumDelete");
329 QSpinBox *maxDelete = new QSpinBox(restrictionsBox);
330 maxDelete->setObjectName("kcfg_MaximumDeleteValue");
331
332 restrictionsBoxLayout->addWidget(maxDeleteButton, 0, 0);
333 restrictionsBoxLayout->addWidget(maxDelete, 0, 1);
334
335 deleteTabLayout->addWidget(filesAndDirsBox, 0);
336 deleteTabLayout->addWidget(restrictionsBox, 0);
337 deleteTabLayout->addStretch(100);
338
339 addTab(deleteTab, i18n("File Deletion"));
340
341 //
342 // 'Filter' tab
343 //
344 QWidget *filterTab = new QWidget(this);
345 QVBoxLayout *filterTabLayout = new QVBoxLayout(filterTab);
346
347 // General
348 QGroupBox *generalFilterBox = new QGroupBox(i18n("General"), filterTab);
349 QGridLayout *generalFilterBoxLayout = new QGridLayout(generalFilterBox);
350
351 QCheckBox *cvsExclude = new QCheckBox(Smb4KSettings::self()->useCVSExcludeItem()->label(), generalFilterBox);
352 cvsExclude->setObjectName("kcfg_UseCVSExclude");
353 QCheckBox *excludePatternButton = new QCheckBox(Smb4KSettings::self()->useExcludePatternItem()->label(), generalFilterBox);
354 excludePatternButton->setObjectName("kcfg_UseExcludePattern");
355 KLineEdit *excludePattern = new KLineEdit(generalFilterBox);
356 excludePattern->setObjectName("kcfg_ExcludePattern");
357 excludePattern->setClearButtonEnabled(true);
358 QCheckBox *excludeFromButton = new QCheckBox(Smb4KSettings::self()->useExcludeFromItem()->label(), generalFilterBox);
359 excludeFromButton->setObjectName("kcfg_UseExcludeFrom");
360 KUrlRequester *excludeFrom = new KUrlRequester(generalFilterBox);
361 excludeFrom->setObjectName("kcfg_ExcludeFrom");
362 excludeFrom->setMode(KFile::File | KFile::LocalOnly);
363 QCheckBox *includePatternButton = new QCheckBox(Smb4KSettings::self()->useIncludePatternItem()->label(), generalFilterBox);
364 includePatternButton->setObjectName("kcfg_UseIncludePattern");
365 KLineEdit *includePattern = new KLineEdit(generalFilterBox);
366 includePattern->setObjectName("kcfg_IncludePattern");
367 includePattern->setClearButtonEnabled(true);
368 QCheckBox *includeFromButton = new QCheckBox(Smb4KSettings::self()->useIncludeFromItem()->label(), generalFilterBox);
369 includeFromButton->setObjectName("kcfg_UseIncludeFrom");
370 KUrlRequester *includeFrom = new KUrlRequester(generalFilterBox);
371 includeFrom->setObjectName("kcfg_IncludeFrom");
372 includeFrom->setMode(KFile::File | KFile::LocalOnly);
373
374 generalFilterBoxLayout->addWidget(cvsExclude, 0, 0, 1, -1);
375 generalFilterBoxLayout->addWidget(excludePatternButton, 1, 0);
376 generalFilterBoxLayout->addWidget(excludePattern, 1, 1);
377 generalFilterBoxLayout->addWidget(excludeFromButton, 2, 0);
378 generalFilterBoxLayout->addWidget(excludeFrom, 2, 1);
379 generalFilterBoxLayout->addWidget(includePatternButton, 3, 0);
380 generalFilterBoxLayout->addWidget(includePattern, 3, 1);
381 generalFilterBoxLayout->addWidget(includeFromButton, 4, 0);
382 generalFilterBoxLayout->addWidget(includeFrom, 4, 1);
383
384 // Filter rules
385 QGroupBox *filterRulesBox = new QGroupBox(i18n("Filter Rules"), filterTab);
386 QGridLayout *filterRulesBoxLayout = new QGridLayout(filterRulesBox);
387
388 QLabel *customRulesLabel = new QLabel(Smb4KSettings::self()->customFilteringRulesItem()->label(), filterRulesBox);
389 KLineEdit *customRules = new KLineEdit(filterRulesBox);
390 customRules->setObjectName("kcfg_CustomFilteringRules");
391 customRules->setClearButtonEnabled(true);
392 customRulesLabel->setBuddy(customRules);
393 QLabel *specialRulesLabel = new QLabel(i18n("Special filter rules:"), filterRulesBox);
394 QCheckBox *useFFilterRule = new QCheckBox(Smb4KSettings::self()->useFFilterRuleItem()->label(), filterRulesBox);
395 useFFilterRule->setObjectName("kcfg_UseFFilterRule");
396 QCheckBox *useFFFilterRule = new QCheckBox(Smb4KSettings::self()->useFFFilterRuleItem()->label(), filterRulesBox);
397 useFFFilterRule->setObjectName("kcfg_UseFFFilterRule");
398
399 filterRulesBoxLayout->addWidget(customRulesLabel, 0, 0);
400 filterRulesBoxLayout->addWidget(customRules, 0, 1);
401 filterRulesBoxLayout->addWidget(specialRulesLabel, 1, 0, 1, -1);
402 filterRulesBoxLayout->addWidget(useFFilterRule, 2, 0, 1, -1);
403 filterRulesBoxLayout->addWidget(useFFFilterRule, 3, 0, 1, -1);
404
405 filterTabLayout->addWidget(generalFilterBox, 0);
406 filterTabLayout->addWidget(filterRulesBox, 0);
407 filterTabLayout->addStretch(100);
408
409 addTab(filterTab, i18n("Filtering"));
410
411 //
412 // 'Miscellaneous' tab
413 //
414 QWidget *miscTab = new QWidget(this);
415 QVBoxLayout *miscTabLayout = new QVBoxLayout(miscTab);
416
417 // Checksums
418 QGroupBox *checksumsBox= new QGroupBox(i18n("Checksums"), miscTab);
419 QGridLayout *checksumsBoxLayout = new QGridLayout(checksumsBox);
420
421 QCheckBox *blockSizeButton = new QCheckBox(Smb4KSettings::self()->useBlockSizeItem()->label(), checksumsBox);
422 blockSizeButton->setObjectName("kcfg_UseBlockSize");
423 QSpinBox *blockSize = new QSpinBox(checksumsBox);
424 blockSize->setObjectName("kcfg_BlockSize");
425
426 QCheckBox *checksumSeedButton = new QCheckBox(Smb4KSettings::self()->useChecksumSeedItem()->label(), checksumsBox);
427 checksumSeedButton->setObjectName("kcfg_UseChecksumSeed");
428 QSpinBox *checksumSeed = new QSpinBox(checksumsBox);
429 checksumSeed->setObjectName("kcfg_ChecksumSeed");
430 QCheckBox *useChecksum = new QCheckBox(Smb4KSettings::self()->useChecksumItem()->label(), checksumsBox);
431 useChecksum->setObjectName("kcfg_UseChecksum");
432
433 checksumsBoxLayout->addWidget(blockSizeButton, 0, 0);
434 checksumsBoxLayout->addWidget(blockSize, 0, 1);
435 checksumsBoxLayout->addWidget(checksumSeedButton, 1, 0);
436 checksumsBoxLayout->addWidget(checksumSeed, 1, 1);
437 checksumsBoxLayout->addWidget(useChecksum, 2, 0);
438
439 // Miscellaneous
440 QGroupBox *miscBox = new QGroupBox(i18n("Miscellaneous"), miscTab);
441 QGridLayout *miscBoxLayout = new QGridLayout(miscBox);
442
443 QCheckBox *oneFilesystem = new QCheckBox(Smb4KSettings::self()->oneFileSystemItem()->label(), miscBox);
444 oneFilesystem->setObjectName("kcfg_OneFileSystem");
445 QCheckBox *delayUpdates = new QCheckBox(Smb4KSettings::self()->delayUpdatesItem()->label(), miscBox);
446 delayUpdates->setObjectName("kcfg_DelayUpdates");
447
448 miscBoxLayout->addWidget(oneFilesystem, 0, 0);
449 miscBoxLayout->addWidget(delayUpdates, 0, 1);
450
451 miscTabLayout->addWidget(checksumsBox, 0);
452 miscTabLayout->addWidget(miscBox, 0);
453 miscTabLayout->addStretch(100);
454
455 addTab(miscTab, i18n("Miscellaneous"));
456
457 //
458 // Connections
459 //
460 connect(archiveMode, SIGNAL(toggled(bool)), this, SLOT(slotArchiveToggled(bool)));
461 connect(recurseDirs, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool)));
462 connect(preserveLinks, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool)));
463 connect(preservePerms, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool)));
464 connect(preserveTimes, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool)));
465 connect(preserveGroup, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool)));
466 connect(preserveOwner, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool)));
467 connect(preserveDevices, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool)));
468 connect(useFFilterRule, SIGNAL(toggled(bool)), this, SLOT(slotFFilterRuleToggled(bool)));
469 connect(useFFFilterRule, SIGNAL(toggled(bool)), this, SLOT(slotFFFilterRuleToggled(bool)));
470 connect(makeBackups, SIGNAL(toggled(bool)), this, SLOT(slotBackupToggled(bool)));
471 connect(compressData, SIGNAL(toggled(bool)), this, SLOT(slotCompressToggled(bool)));
472 connect(keepPartial, SIGNAL(toggled(bool)), this, SLOT(slotKeepPartialToggled(bool)));
473
474 slotArchiveToggled(Smb4KSettings::archiveMode());
475 slotBackupToggled(Smb4KSettings::makeBackups());
476 slotCompressToggled(Smb4KSettings::compressData());
477 slotKeepPartialToggled(Smb4KSettings::keepPartial());
478 }
479
480
~Smb4KConfigPageSynchronization()481 Smb4KConfigPageSynchronization::~Smb4KConfigPageSynchronization()
482 {
483 }
484
485
486 /////////////////////////////////////////////////////////////////////////////
487 // SLOT IMPLEMENTATIONS
488 /////////////////////////////////////////////////////////////////////////////
489
slotArchiveToggled(bool checked)490 void Smb4KConfigPageSynchronization::slotArchiveToggled(bool checked)
491 {
492 if (checked)
493 {
494 findChild<QCheckBox *>("kcfg_RecurseIntoDirectories")->setChecked(checked);
495 findChild<QCheckBox *>("kcfg_PreserveSymlinks")->setChecked(checked);
496 findChild<QCheckBox *>("kcfg_PreservePermissions")->setChecked(checked);
497 findChild<QCheckBox *>("kcfg_PreserveTimes")->setChecked(checked);
498 findChild<QCheckBox *>("kcfg_PreserveGroup")->setChecked(checked);
499 findChild<QCheckBox *>("kcfg_PreserveOwner")->setChecked(checked);
500 findChild<QCheckBox *>("kcfg_PreserveDevicesAndSpecials")->setChecked(checked);
501 }
502 }
503
504
slotUncheckArchive(bool checked)505 void Smb4KConfigPageSynchronization::slotUncheckArchive(bool checked)
506 {
507 if (!checked)
508 {
509 findChild<QCheckBox *>("kcfg_ArchiveMode")->setChecked(checked);
510 }
511 }
512
513
slotBackupToggled(bool checked)514 void Smb4KConfigPageSynchronization::slotBackupToggled(bool checked)
515 {
516 findChild<QCheckBox *>("kcfg_UseBackupDirectory")->setEnabled(checked);
517 findChild<KUrlRequester *>("kcfg_BackupDirectory")->setEnabled(checked);
518 findChild<QCheckBox *>("kcfg_UseBackupSuffix")->setEnabled(checked);
519 findChild<KLineEdit *>("kcfg_BackupSuffix")->setEnabled(checked);
520 }
521
522
slotCompressToggled(bool checked)523 void Smb4KConfigPageSynchronization::slotCompressToggled(bool checked)
524 {
525 findChild<QCheckBox *>("kcfg_UseCompressionLevel")->setEnabled(checked);
526 findChild<QSpinBox *>("kcfg_CompressionLevel")->setEnabled(checked);
527 findChild<QCheckBox *>("kcfg_UseSkipCompression")->setEnabled(checked);
528 findChild<KLineEdit *>("kcfg_SkipCompression")->setEnabled(checked);
529 }
530
531
slotKeepPartialToggled(bool checked)532 void Smb4KConfigPageSynchronization::slotKeepPartialToggled(bool checked)
533 {
534 findChild<QCheckBox *>("kcfg_UsePartialDirectory")->setEnabled(checked);
535 findChild<KUrlRequester *>("kcfg_PartialDirectory")->setEnabled(checked);
536 }
537
538
slotFFilterRuleToggled(bool on)539 void Smb4KConfigPageSynchronization::slotFFilterRuleToggled(bool on)
540 {
541 QCheckBox *ff_filter = findChild<QCheckBox *>("kcfg_UseFFFilterRule");
542
543 if (on && ff_filter->isChecked())
544 {
545 ff_filter->setChecked(false);
546 }
547 }
548
549
slotFFFilterRuleToggled(bool on)550 void Smb4KConfigPageSynchronization::slotFFFilterRuleToggled(bool on)
551 {
552 QCheckBox *f_filter = findChild<QCheckBox *>("kcfg_UseFFilterRule");
553
554 if (on && f_filter->isChecked())
555 {
556 f_filter->setChecked(false);
557 }
558 }
559
560