File indexing completed on 2024-12-08 12:55:12
0001 /*************************************************************************** 0002 The configuration page for the synchronization options 0003 ------------------- 0004 begin : So Nov 20 2005 0005 copyright : (C) 2005-2019 by Alexander Reinholdt 0006 email : alexander.reinholdt@kdemail.net 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * This program is free software; you can redistribute it and/or modify * 0011 * it under the terms of the GNU General Public License as published by * 0012 * the Free Software Foundation; either version 2 of the License, or * 0013 * (at your option) any later version. * 0014 * * 0015 * This program is distributed in the hope that it will be useful, but * 0016 * WITHOUT ANY WARRANTY; without even the implied warranty of * 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 0018 * General Public License for more details. * 0019 * * 0020 * You should have received a copy of the GNU General Public License * 0021 * along with this program; if not, write to the * 0022 * Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,* 0023 * MA 02110-1335, USA * 0024 ***************************************************************************/ 0025 0026 #ifdef HAVE_CONFIG_H 0027 #include <config.h> 0028 #endif 0029 0030 // application specific includes 0031 #include "smb4kconfigpagesynchronization.h" 0032 #include "core/smb4ksettings.h" 0033 0034 // Qt includes 0035 #include <QGridLayout> 0036 #include <QVBoxLayout> 0037 #include <QGroupBox> 0038 #include <QLabel> 0039 #include <QCheckBox> 0040 #include <QSpinBox> 0041 #include <QButtonGroup> 0042 0043 // KDE includes 0044 #include <KI18n/KLocalizedString> 0045 #include <KIOWidgets/KUrlRequester> 0046 #include <KCompletion/KLineEdit> 0047 0048 0049 Smb4KConfigPageSynchronization::Smb4KConfigPageSynchronization(QWidget *parent) 0050 : QTabWidget(parent) 0051 { 0052 // 0053 // 'Basic Settings' tab 0054 // 0055 QWidget *basicTab = new QWidget(this); 0056 QVBoxLayout *basicTabLayout = new QVBoxLayout(basicTab); 0057 basicTabLayout->setSpacing(5); 0058 basicTabLayout->setMargin(0); 0059 0060 // Default destination (rsync) 0061 QGroupBox *pathsBox = new QGroupBox(i18n("Default Destination"), basicTab); 0062 QGridLayout *pathsBoxLayout = new QGridLayout(pathsBox); 0063 pathsBoxLayout->setSpacing(5); 0064 0065 QLabel *rsyncPrefixLabel = new QLabel(Smb4KSettings::self()->rsyncPrefixItem()->label(), pathsBox); 0066 KUrlRequester *rsyncPrefix = new KUrlRequester(pathsBox); 0067 rsyncPrefix->setMode(KFile::Directory|KFile::LocalOnly); 0068 rsyncPrefix->setObjectName("kcfg_RsyncPrefix"); 0069 rsyncPrefixLabel->setBuddy(rsyncPrefix); 0070 0071 pathsBoxLayout->addWidget(rsyncPrefixLabel, 0, 0, 0); 0072 pathsBoxLayout->addWidget(rsyncPrefix, 0, 1, 0); 0073 0074 // Behavior 0075 QGroupBox *behaviorBox = new QGroupBox(i18n("Behavior"), basicTab); 0076 QGridLayout *behaviorBoxLayout = new QGridLayout(behaviorBox); 0077 behaviorBoxLayout->setSpacing(5); 0078 0079 QCheckBox *archiveMode = new QCheckBox(Smb4KSettings::self()->archiveModeItem()->label(), behaviorBox); 0080 archiveMode->setObjectName("kcfg_ArchiveMode"); 0081 QCheckBox *recurseDirs = new QCheckBox(Smb4KSettings::self()->recurseIntoDirectoriesItem()->label(), behaviorBox); 0082 recurseDirs->setObjectName("kcfg_RecurseIntoDirectories"); 0083 QCheckBox *relativePaths = new QCheckBox(Smb4KSettings::self()->relativePathNamesItem()->label(), behaviorBox); 0084 relativePaths->setObjectName("kcfg_RelativePathNames"); 0085 QCheckBox *noImpliedDirs = new QCheckBox(Smb4KSettings::self()->noImpliedDirectoriesItem()->label(), behaviorBox); 0086 noImpliedDirs->setObjectName("kcfg_NoImpliedDirectories"); 0087 QCheckBox *transferDirs = new QCheckBox(Smb4KSettings::self()->transferDirectoriesItem()->label(), behaviorBox); 0088 transferDirs->setObjectName("kcfg_TransferDirectories"); 0089 0090 behaviorBoxLayout->addWidget(archiveMode, 0, 0, 0); 0091 behaviorBoxLayout->addWidget(recurseDirs, 0, 1, 0); 0092 behaviorBoxLayout->addWidget(relativePaths, 1, 0, 0); 0093 behaviorBoxLayout->addWidget(noImpliedDirs, 1, 1, 0); 0094 behaviorBoxLayout->addWidget(transferDirs, 2, 0, 0); 0095 0096 // Backup 0097 QGroupBox *backupBox = new QGroupBox(i18n("Backup"), basicTab); 0098 QGridLayout *backupBoxLayout = new QGridLayout(backupBox); 0099 backupBoxLayout->setSpacing(5); 0100 0101 QCheckBox *makeBackups = new QCheckBox(Smb4KSettings::self()->makeBackupsItem()->label(), backupBox); 0102 makeBackups->setObjectName("kcfg_MakeBackups"); 0103 QCheckBox *backupSuffixButton = new QCheckBox(Smb4KSettings::self()->useBackupSuffixItem()->label(), backupBox); 0104 backupSuffixButton->setObjectName("kcfg_UseBackupSuffix"); 0105 KLineEdit *backupSuffix = new KLineEdit(backupBox); 0106 backupSuffix->setObjectName("kcfg_BackupSuffix"); 0107 backupSuffix->setClearButtonEnabled(true); 0108 QCheckBox *backupDirButton = new QCheckBox(Smb4KSettings::self()->useBackupDirectoryItem()->label(), backupBox); 0109 backupDirButton->setObjectName("kcfg_UseBackupDirectory"); 0110 KUrlRequester *backupDir= new KUrlRequester(backupBox); 0111 backupDir->setObjectName("kcfg_BackupDirectory"); 0112 backupDir->setMode(KFile::Directory | KFile::LocalOnly); 0113 0114 backupBoxLayout->addWidget(makeBackups, 0, 0, 0); 0115 backupBoxLayout->addWidget(backupSuffixButton, 1, 0, 0); 0116 backupBoxLayout->addWidget(backupSuffix, 1, 1, 0); 0117 backupBoxLayout->addWidget(backupDirButton, 2, 0, 0); 0118 backupBoxLayout->addWidget(backupDir, 2, 1, 0); 0119 0120 basicTabLayout->addWidget(pathsBox, 0); 0121 basicTabLayout->addWidget(behaviorBox, 0); 0122 basicTabLayout->addWidget(backupBox, 0); 0123 basicTabLayout->addStretch(100); 0124 0125 addTab(basicTab, i18n("Basic Settings")); 0126 0127 // 0128 // 'File Handling' tab 0129 // 0130 QWidget *fileHandlingTab = new QWidget(this); 0131 QVBoxLayout *fileHandlingTabLayout = new QVBoxLayout(fileHandlingTab); 0132 fileHandlingTabLayout->setSpacing(5); 0133 fileHandlingTabLayout->setMargin(0); 0134 0135 // General 0136 QGroupBox *generalHandlingBox = new QGroupBox(i18n("General"), fileHandlingTab); 0137 QGridLayout *generalHandlingBoxLayout = new QGridLayout(generalHandlingBox); 0138 generalHandlingBoxLayout->setSpacing(5); 0139 0140 QCheckBox *updateTarget = new QCheckBox(Smb4KSettings::self()->updateTargetItem()->label(), generalHandlingBox); 0141 updateTarget->setObjectName("kcfg_UpdateTarget"); 0142 QCheckBox *updateInPlace = new QCheckBox(Smb4KSettings::self()->updateInPlaceItem()->label(), generalHandlingBox); 0143 updateInPlace->setObjectName("kcfg_UpdateInPlace"); 0144 QCheckBox *sparseFiles = new QCheckBox(Smb4KSettings::self()->efficientSparseFileHandlingItem()->label(), generalHandlingBox); 0145 sparseFiles->setObjectName("kcfg_EfficientSparseFileHandling"); 0146 QCheckBox *copyFilesWhole = new QCheckBox(Smb4KSettings::self()->copyFilesWholeItem()->label(), generalHandlingBox); 0147 copyFilesWhole->setObjectName("kcfg_CopyFilesWhole"); 0148 QCheckBox *updateExisting = new QCheckBox(Smb4KSettings::self()->updateExistingItem()->label(), generalHandlingBox); 0149 updateExisting->setObjectName("kcfg_UpdateExisting"); 0150 QCheckBox *ignoreExisting = new QCheckBox(Smb4KSettings::self()->ignoreExistingItem()->label(), generalHandlingBox); 0151 ignoreExisting->setObjectName("kcfg_IgnoreExisting"); 0152 0153 generalHandlingBoxLayout->addWidget(updateTarget, 0, 0, 0); 0154 generalHandlingBoxLayout->addWidget(updateInPlace, 0, 1, 0); 0155 generalHandlingBoxLayout->addWidget(sparseFiles, 1, 0, 0); 0156 generalHandlingBoxLayout->addWidget(copyFilesWhole, 1, 1, 0); 0157 generalHandlingBoxLayout->addWidget(updateExisting, 2, 0, 0); 0158 generalHandlingBoxLayout->addWidget(ignoreExisting, 2, 1, 0); 0159 0160 // Links 0161 QGroupBox *linksBox = new QGroupBox(i18n("Links"), fileHandlingTab); 0162 QGridLayout *linksBoxLayout = new QGridLayout(linksBox); 0163 linksBoxLayout->setSpacing(5); 0164 0165 QCheckBox *preserveLinks = new QCheckBox(Smb4KSettings::self()->preserveSymlinksItem()->label(), linksBox); 0166 preserveLinks->setObjectName("kcfg_PreserveSymlinks"); 0167 QCheckBox *transformLinks = new QCheckBox(Smb4KSettings::self()->transformSymlinksItem()->label(), linksBox); 0168 transformLinks->setObjectName("kcfg_TransformSymlinks"); 0169 QCheckBox *transformUnsafe = new QCheckBox(Smb4KSettings::self()->transformUnsafeSymlinksItem()->label(), linksBox); 0170 transformUnsafe->setObjectName("kcfg_TransformUnsafeSymlinks"); 0171 QCheckBox *ignoreUnsafe = new QCheckBox(Smb4KSettings::self()->ignoreUnsafeSymlinksItem()->label(), linksBox); 0172 ignoreUnsafe->setObjectName("kcfg_IgnoreUnsafeSymlinks"); 0173 QCheckBox *mungeLinks = new QCheckBox(Smb4KSettings::self()->mungeSymlinksItem()->label(), linksBox); 0174 mungeLinks->setObjectName("kcfg_MungeSymlinks"); 0175 QCheckBox *preserveHlinks = new QCheckBox(Smb4KSettings::self()->preserveHardLinksItem()->label(), linksBox); 0176 preserveHlinks->setObjectName("kcfg_PreserveHardLinks"); 0177 QCheckBox *copyDirLinks = new QCheckBox(Smb4KSettings::self()->copyDirectorySymlinksItem()->label(), linksBox); 0178 copyDirLinks->setObjectName("kcfg_CopyDirectorySymlinks"); 0179 QCheckBox *keepDirLinks = new QCheckBox(Smb4KSettings::self()->keepDirectorySymlinksItem()->label(), linksBox); 0180 keepDirLinks->setObjectName("kcfg_KeepDirectorySymlinks"); 0181 0182 linksBoxLayout->addWidget(preserveLinks, 0, 0, 0); 0183 linksBoxLayout->addWidget(transformLinks, 0, 1, 0); 0184 linksBoxLayout->addWidget(transformUnsafe, 1, 0, 0); 0185 linksBoxLayout->addWidget(ignoreUnsafe, 1, 1, 0); 0186 linksBoxLayout->addWidget(mungeLinks, 2, 0, 0); 0187 linksBoxLayout->addWidget(preserveHlinks, 2, 1, 0); 0188 linksBoxLayout->addWidget(copyDirLinks, 3, 0, 0); 0189 linksBoxLayout->addWidget(keepDirLinks, 3, 1, 0); 0190 0191 // Permissions & Attributes 0192 QGroupBox *permissionsBox = new QGroupBox(i18n("Permissions, etc."), fileHandlingTab); 0193 QGridLayout *permissionsBoxLayout = new QGridLayout(permissionsBox); 0194 permissionsBoxLayout->setSpacing(5); 0195 0196 QCheckBox *preservePerms = new QCheckBox(Smb4KSettings::self()->preservePermissionsItem()->label(), permissionsBox); 0197 preservePerms->setObjectName("kcfg_PreservePermissions"); 0198 QCheckBox *preserveOwner = new QCheckBox(Smb4KSettings::self()->preserveOwnerItem()->label(), permissionsBox); 0199 preserveOwner->setObjectName("kcfg_PreserveOwner"); 0200 QCheckBox *preserveGroup = new QCheckBox(Smb4KSettings::self()->preserveGroupItem()->label(), permissionsBox); 0201 preserveGroup->setObjectName("kcfg_PreserveGroup"); 0202 QCheckBox *preserveDevices = new QCheckBox(Smb4KSettings::self()->preserveDevicesAndSpecialsItem()->label(), permissionsBox); 0203 preserveDevices->setObjectName("kcfg_PreserveDevicesAndSpecials"); 0204 QCheckBox *preserveTimes = new QCheckBox(Smb4KSettings::self()->preserveTimesItem()->label(), permissionsBox); 0205 preserveTimes->setObjectName("kcfg_PreserveTimes"); 0206 QCheckBox *omitDirTimes = new QCheckBox(Smb4KSettings::self()->omitDirectoryTimesItem()->label(), permissionsBox); 0207 omitDirTimes->setObjectName("kcfg_OmitDirectoryTimes"); 0208 0209 permissionsBoxLayout->addWidget(preservePerms, 0, 0, 0); 0210 permissionsBoxLayout->addWidget(preserveOwner, 0, 1, 0); 0211 permissionsBoxLayout->addWidget(preserveGroup, 1, 0, 0); 0212 permissionsBoxLayout->addWidget(preserveDevices, 1, 1, 0); 0213 permissionsBoxLayout->addWidget(preserveTimes, 2, 0, 0); 0214 permissionsBoxLayout->addWidget(omitDirTimes, 2, 1, 0); 0215 0216 fileHandlingTabLayout->addWidget(generalHandlingBox, 0); 0217 fileHandlingTabLayout->addWidget(linksBox, 0); 0218 fileHandlingTabLayout->addWidget(permissionsBox, 0); 0219 fileHandlingTabLayout->addStretch(100); 0220 0221 addTab(fileHandlingTab, i18n("File Handling")); 0222 0223 // 0224 // 'File Transfer' tab 0225 // 0226 QWidget *transferTab = new QWidget(this); 0227 QVBoxLayout *transferTabLayout = new QVBoxLayout(transferTab); 0228 transferTabLayout->setSpacing(5); 0229 transferTabLayout->setMargin(0); 0230 0231 // Compression 0232 QGroupBox *compressionBox = new QGroupBox(i18n("Compression"), transferTab); 0233 QGridLayout *compressionBoxLayout = new QGridLayout(compressionBox); 0234 compressionBoxLayout->setSpacing(5); 0235 0236 QCheckBox *compressData = new QCheckBox(Smb4KSettings::self()->compressDataItem()->label(), compressionBox); 0237 compressData->setObjectName("kcfg_CompressData"); 0238 QCheckBox *compressionLevelButton = new QCheckBox(Smb4KSettings::self()->useCompressionLevelItem()->label(), compressionBox); 0239 compressionLevelButton->setObjectName("kcfg_UseCompressionLevel"); 0240 QSpinBox *compressionLevel = new QSpinBox(compressionBox); 0241 compressionLevel->setObjectName("kcfg_CompressionLevel"); 0242 QCheckBox *skipCompressionButton = new QCheckBox(Smb4KSettings::self()->useSkipCompressionItem()->label(), compressionBox); 0243 skipCompressionButton->setObjectName("kcfg_UseSkipCompression"); 0244 KLineEdit *skipCompression = new KLineEdit(compressionBox); 0245 skipCompression->setObjectName("kcfg_SkipCompression"); 0246 skipCompression->setClearButtonEnabled(true); 0247 0248 compressionBoxLayout->addWidget(compressData, 0, 0, 1, -1, 0); 0249 compressionBoxLayout->addWidget(compressionLevelButton, 1, 0, 1, 1, 0); 0250 compressionBoxLayout->addWidget(compressionLevel, 1, 1, 1, 1, 0); 0251 compressionBoxLayout->addWidget(skipCompressionButton, 2, 0, 1, 1, 0); 0252 compressionBoxLayout->addWidget(skipCompression, 2, 1, 1, 1, 0); 0253 0254 // Files 0255 QGroupBox *filesBox = new QGroupBox(i18n("Files"), transferTab); 0256 QGridLayout *filesBoxLayout = new QGridLayout(filesBox); 0257 filesBoxLayout->setSpacing(5); 0258 0259 QCheckBox *minTransferSizeButton = new QCheckBox(Smb4KSettings::self()->useMinimalTransferSizeItem()->label(), filesBox); 0260 minTransferSizeButton->setObjectName("kcfg_UseMinimalTransferSize"); 0261 QSpinBox *minTransferSize = new QSpinBox(filesBox); 0262 minTransferSize->setObjectName("kcfg_MinimalTransferSize"); 0263 minTransferSize->setSuffix(i18n(" KiB")); 0264 QCheckBox *maxTransferSizeButton = new QCheckBox(Smb4KSettings::self()->useMaximalTransferSizeItem()->label(), filesBox); 0265 maxTransferSizeButton->setObjectName("kcfg_UseMaximalTransferSize"); 0266 QSpinBox *maxTransferSize = new QSpinBox(filesBox); 0267 maxTransferSize->setObjectName("kcfg_MaximalTransferSize"); 0268 maxTransferSize->setSuffix(i18n(" KiB")); 0269 QCheckBox *keepPartial = new QCheckBox(Smb4KSettings::self()->keepPartialItem()->label(), filesBox); 0270 keepPartial->setObjectName("kcfg_KeepPartial"); 0271 QCheckBox *partialDirButton = new QCheckBox(Smb4KSettings::self()->usePartialDirectoryItem()->label(), filesBox); 0272 partialDirButton->setObjectName("kcfg_UsePartialDirectory"); 0273 KUrlRequester *partialDir = new KUrlRequester(filesBox); 0274 partialDir->setObjectName("kcfg_PartialDirectory"); 0275 partialDir->setMode(KFile::Directory | KFile::LocalOnly); 0276 0277 filesBoxLayout->addWidget(minTransferSizeButton, 0, 0, 0); 0278 filesBoxLayout->addWidget(minTransferSize, 0, 1, 0); 0279 filesBoxLayout->addWidget(maxTransferSizeButton, 1, 0, 0); 0280 filesBoxLayout->addWidget(maxTransferSize, 1, 1, 0); 0281 filesBoxLayout->addWidget(keepPartial, 2, 0, 1, -1, 0); 0282 filesBoxLayout->addWidget(partialDirButton, 3, 0, 0); 0283 filesBoxLayout->addWidget(partialDir, 3, 1, 0); 0284 0285 // Miscellaneous 0286 QGroupBox *miscTransferBox = new QGroupBox(i18n("Miscellaneous"), transferTab); 0287 QGridLayout *miscTransferBoxLayout = new QGridLayout(miscTransferBox); 0288 miscTransferBoxLayout->setSpacing(5); 0289 0290 QCheckBox *bwLimitButton = new QCheckBox(Smb4KSettings::self()->useBandwidthLimitItem()->label(), miscTransferBox); 0291 bwLimitButton->setObjectName("kcfg_UseBandwidthLimit"); 0292 QSpinBox *bwLimit = new QSpinBox(miscTransferBox); 0293 bwLimit->setObjectName("kcfg_BandwidthLimit"); 0294 bwLimit->setSuffix(i18n(" KiB/s")); 0295 0296 miscTransferBoxLayout->addWidget(bwLimitButton, 0, 0, 0); 0297 miscTransferBoxLayout->addWidget(bwLimit, 0, 1, 0); 0298 0299 transferTabLayout->addWidget(compressionBox, 0); 0300 transferTabLayout->addWidget(filesBox, 0); 0301 transferTabLayout->addWidget(miscTransferBox, 0); 0302 transferTabLayout->addStretch(100); 0303 0304 addTab(transferTab, i18n("File Transfer")); 0305 0306 // 0307 // 'File Deletion' tab 0308 // 0309 QWidget *deleteTab = new QWidget(this); 0310 QVBoxLayout *deleteTabLayout = new QVBoxLayout(deleteTab); 0311 deleteTabLayout->setSpacing(5); 0312 deleteTabLayout->setMargin(0); 0313 0314 // Files and Directories 0315 QGroupBox *filesAndDirsBox = new QGroupBox(i18n("Files && Directories"), deleteTab); 0316 QGridLayout *filesAndDirsBoxLayout = new QGridLayout(filesAndDirsBox); 0317 filesAndDirsBoxLayout->setSpacing(5); 0318 0319 QCheckBox *removeSource = new QCheckBox(Smb4KSettings::self()->removeSourceFilesItem()->label(), filesAndDirsBox); 0320 removeSource->setObjectName("kcfg_RemoveSourceFiles"); 0321 QCheckBox *deleteExtraneous = new QCheckBox(Smb4KSettings::self()->deleteExtraneousItem()->label(), filesAndDirsBox); 0322 deleteExtraneous->setObjectName("kcfg_DeleteExtraneous"); 0323 QCheckBox *deleteBefore = new QCheckBox(Smb4KSettings::self()->deleteBeforeItem()->label(), filesAndDirsBox); 0324 deleteBefore->setObjectName("kcfg_DeleteBefore"); 0325 QCheckBox *deleteAfter = new QCheckBox(Smb4KSettings::self()->deleteAfterItem()->label(), filesAndDirsBox); 0326 deleteAfter->setObjectName("kcfg_DeleteAfter"); 0327 QCheckBox *deleteDuring = new QCheckBox(Smb4KSettings::self()->deleteDuringItem()->label(), filesAndDirsBox); 0328 deleteDuring->setObjectName("kcfg_DeleteDuring"); 0329 QCheckBox *deleteExcluded = new QCheckBox(Smb4KSettings::self()->deleteExcludedItem()->label(), filesAndDirsBox); 0330 deleteExcluded->setObjectName("kcfg_DeleteExcluded"); 0331 QCheckBox *ignoreIOErrors = new QCheckBox(Smb4KSettings::self()->ignoreErrorsItem()->label(), filesAndDirsBox); 0332 ignoreIOErrors->setObjectName("kcfg_IgnoreErrors"); 0333 QCheckBox *forceDirDeletion = new QCheckBox(Smb4KSettings::self()->forceDirectoryDeletionItem()->label(), filesAndDirsBox); 0334 forceDirDeletion->setObjectName("kcfg_ForceDirectoryDeletion"); 0335 0336 filesAndDirsBoxLayout->addWidget(removeSource, 0, 0, 0); 0337 filesAndDirsBoxLayout->addWidget(deleteExtraneous, 0, 1, 0); 0338 filesAndDirsBoxLayout->addWidget(deleteBefore, 1, 0, 0); 0339 filesAndDirsBoxLayout->addWidget(deleteAfter, 1, 1, 0); 0340 filesAndDirsBoxLayout->addWidget(deleteDuring, 2, 0, 0); 0341 filesAndDirsBoxLayout->addWidget(deleteExcluded, 2, 1, 0); 0342 filesAndDirsBoxLayout->addWidget(ignoreIOErrors, 3, 0, 0); 0343 filesAndDirsBoxLayout->addWidget(forceDirDeletion, 3, 1, 0); 0344 0345 // Restrictions 0346 QGroupBox *restrictionsBox = new QGroupBox(i18n("Restrictions"), deleteTab); 0347 QGridLayout *restrictionsBoxLayout = new QGridLayout(restrictionsBox); 0348 restrictionsBoxLayout->setSpacing(5); 0349 0350 QCheckBox *maxDeleteButton = new QCheckBox(Smb4KSettings::self()->useMaximumDeleteItem()->label(), restrictionsBox); 0351 maxDeleteButton->setObjectName("kcfg_UseMaximumDelete"); 0352 QSpinBox *maxDelete = new QSpinBox(restrictionsBox); 0353 maxDelete->setObjectName("kcfg_MaximumDeleteValue"); 0354 0355 restrictionsBoxLayout->addWidget(maxDeleteButton, 0, 0, 0); 0356 restrictionsBoxLayout->addWidget(maxDelete, 0, 1, 0); 0357 0358 deleteTabLayout->addWidget(filesAndDirsBox, 0); 0359 deleteTabLayout->addWidget(restrictionsBox, 0); 0360 deleteTabLayout->addStretch(100); 0361 0362 addTab(deleteTab, i18n("File Deletion")); 0363 0364 // 0365 // 'Filter' tab 0366 // 0367 QWidget *filterTab = new QWidget(this); 0368 QVBoxLayout *filterTabLayout = new QVBoxLayout(filterTab); 0369 filterTabLayout->setSpacing(5); 0370 filterTabLayout->setMargin(0); 0371 0372 // General 0373 QGroupBox *generalFilterBox = new QGroupBox(i18n("General"), filterTab); 0374 QGridLayout *generalFilterBoxLayout = new QGridLayout(generalFilterBox); 0375 generalFilterBoxLayout->setSpacing(5); 0376 0377 QCheckBox *cvsExclude = new QCheckBox(Smb4KSettings::self()->useCVSExcludeItem()->label(), generalFilterBox); 0378 cvsExclude->setObjectName("kcfg_UseCVSExclude"); 0379 QCheckBox *excludePatternButton = new QCheckBox(Smb4KSettings::self()->useExcludePatternItem()->label(), generalFilterBox); 0380 excludePatternButton->setObjectName("kcfg_UseExcludePattern"); 0381 KLineEdit *excludePattern = new KLineEdit(generalFilterBox); 0382 excludePattern->setObjectName("kcfg_ExcludePattern"); 0383 excludePattern->setClearButtonEnabled(true); 0384 QCheckBox *excludeFromButton = new QCheckBox(Smb4KSettings::self()->useExcludeFromItem()->label(), generalFilterBox); 0385 excludeFromButton->setObjectName("kcfg_UseExcludeFrom"); 0386 KUrlRequester *excludeFrom = new KUrlRequester(generalFilterBox); 0387 excludeFrom->setObjectName("kcfg_ExcludeFrom"); 0388 excludeFrom->setMode(KFile::File | KFile::LocalOnly); 0389 QCheckBox *includePatternButton = new QCheckBox(Smb4KSettings::self()->useIncludePatternItem()->label(), generalFilterBox); 0390 includePatternButton->setObjectName("kcfg_UseIncludePattern"); 0391 KLineEdit *includePattern = new KLineEdit(generalFilterBox); 0392 includePattern->setObjectName("kcfg_IncludePattern"); 0393 includePattern->setClearButtonEnabled(true); 0394 QCheckBox *includeFromButton = new QCheckBox(Smb4KSettings::self()->useIncludeFromItem()->label(), generalFilterBox); 0395 includeFromButton->setObjectName("kcfg_UseIncludeFrom"); 0396 KUrlRequester *includeFrom = new KUrlRequester(generalFilterBox); 0397 includeFrom->setObjectName("kcfg_IncludeFrom"); 0398 includeFrom->setMode(KFile::File | KFile::LocalOnly); 0399 0400 generalFilterBoxLayout->addWidget(cvsExclude, 0, 0, 1, -1, 0); 0401 generalFilterBoxLayout->addWidget(excludePatternButton, 1, 0, 0); 0402 generalFilterBoxLayout->addWidget(excludePattern, 1, 1, 0); 0403 generalFilterBoxLayout->addWidget(excludeFromButton, 2, 0, 0); 0404 generalFilterBoxLayout->addWidget(excludeFrom, 2, 1, 0); 0405 generalFilterBoxLayout->addWidget(includePatternButton, 3, 0, 0); 0406 generalFilterBoxLayout->addWidget(includePattern, 3, 1, 0); 0407 generalFilterBoxLayout->addWidget(includeFromButton, 4, 0, 0); 0408 generalFilterBoxLayout->addWidget(includeFrom, 4, 1, 0); 0409 0410 // Filter rules 0411 QGroupBox *filterRulesBox = new QGroupBox(i18n("Filter Rules"), filterTab); 0412 QGridLayout *filterRulesBoxLayout = new QGridLayout(filterRulesBox); 0413 filterRulesBoxLayout->setSpacing(5); 0414 0415 QLabel *customRulesLabel = new QLabel(Smb4KSettings::self()->customFilteringRulesItem()->label(), filterRulesBox); 0416 KLineEdit *customRules = new KLineEdit(filterRulesBox); 0417 customRules->setObjectName("kcfg_CustomFilteringRules"); 0418 customRules->setClearButtonEnabled(true); 0419 customRulesLabel->setBuddy(customRules); 0420 QLabel *specialRulesLabel = new QLabel(i18n("Special filter rules:"), filterRulesBox); 0421 QCheckBox *useFFilterRule = new QCheckBox(Smb4KSettings::self()->useFFilterRuleItem()->label(), filterRulesBox); 0422 useFFilterRule->setObjectName("kcfg_UseFFilterRule"); 0423 QCheckBox *useFFFilterRule = new QCheckBox(Smb4KSettings::self()->useFFFilterRuleItem()->label(), filterRulesBox); 0424 useFFFilterRule->setObjectName("kcfg_UseFFFilterRule"); 0425 0426 filterRulesBoxLayout->addWidget(customRulesLabel, 0, 0, 0); 0427 filterRulesBoxLayout->addWidget(customRules, 0, 1, 0); 0428 filterRulesBoxLayout->addWidget(specialRulesLabel, 1, 0, 1, -1, 0); 0429 filterRulesBoxLayout->addWidget(useFFilterRule, 2, 0, 1, -1, 0); 0430 filterRulesBoxLayout->addWidget(useFFFilterRule, 3, 0, 1, -1, 0); 0431 0432 filterTabLayout->addWidget(generalFilterBox, 0); 0433 filterTabLayout->addWidget(filterRulesBox, 0); 0434 filterTabLayout->addStretch(100); 0435 0436 addTab(filterTab, i18n("Filtering")); 0437 0438 // 0439 // 'Miscellaneous' tab 0440 // 0441 QWidget *miscTab = new QWidget(this); 0442 QVBoxLayout *miscTabLayout = new QVBoxLayout(miscTab); 0443 miscTabLayout->setSpacing(5); 0444 miscTabLayout->setMargin(0); 0445 0446 // Checksums 0447 QGroupBox *checksumsBox= new QGroupBox(i18n("Checksums"), miscTab); 0448 QGridLayout *checksumsBoxLayout = new QGridLayout(checksumsBox); 0449 checksumsBoxLayout->setSpacing(5); 0450 0451 QCheckBox *blockSizeButton = new QCheckBox(Smb4KSettings::self()->useBlockSizeItem()->label(), checksumsBox); 0452 blockSizeButton->setObjectName("kcfg_UseBlockSize"); 0453 QSpinBox *blockSize = new QSpinBox(checksumsBox); 0454 blockSize->setObjectName("kcfg_BlockSize"); 0455 0456 QCheckBox *checksumSeedButton = new QCheckBox(Smb4KSettings::self()->useChecksumSeedItem()->label(), checksumsBox); 0457 checksumSeedButton->setObjectName("kcfg_UseChecksumSeed"); 0458 QSpinBox *checksumSeed = new QSpinBox(checksumsBox); 0459 checksumSeed->setObjectName("kcfg_ChecksumSeed"); 0460 QCheckBox *useChecksum = new QCheckBox(Smb4KSettings::self()->useChecksumItem()->label(), checksumsBox); 0461 useChecksum->setObjectName("kcfg_UseChecksum"); 0462 0463 checksumsBoxLayout->addWidget(blockSizeButton, 0, 0, 0); 0464 checksumsBoxLayout->addWidget(blockSize, 0, 1, 0); 0465 checksumsBoxLayout->addWidget(checksumSeedButton, 1, 0, 0); 0466 checksumsBoxLayout->addWidget(checksumSeed, 1, 1, 0); 0467 checksumsBoxLayout->addWidget(useChecksum, 2, 0, 0); 0468 0469 // Miscellaneous 0470 QGroupBox *miscBox = new QGroupBox(i18n("Miscellaneous"), miscTab); 0471 QGridLayout *miscBoxLayout = new QGridLayout(miscBox); 0472 miscBoxLayout->setSpacing(5); 0473 0474 QCheckBox *oneFilesystem = new QCheckBox(Smb4KSettings::self()->oneFileSystemItem()->label(), miscBox); 0475 oneFilesystem->setObjectName("kcfg_OneFileSystem"); 0476 QCheckBox *delayUpdates = new QCheckBox(Smb4KSettings::self()->delayUpdatesItem()->label(), miscBox); 0477 delayUpdates->setObjectName("kcfg_DelayUpdates"); 0478 0479 miscBoxLayout->addWidget(oneFilesystem, 0, 0, 0); 0480 miscBoxLayout->addWidget(delayUpdates, 0, 1, 0); 0481 0482 miscTabLayout->addWidget(checksumsBox, 0); 0483 miscTabLayout->addWidget(miscBox, 0); 0484 miscTabLayout->addStretch(100); 0485 0486 addTab(miscTab, i18n("Miscellaneous")); 0487 0488 // 0489 // Connections 0490 // 0491 connect(archiveMode, SIGNAL(toggled(bool)), this, SLOT(slotArchiveToggled(bool))); 0492 connect(recurseDirs, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool))); 0493 connect(preserveLinks, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool))); 0494 connect(preservePerms, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool))); 0495 connect(preserveTimes, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool))); 0496 connect(preserveGroup, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool))); 0497 connect(preserveOwner, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool))); 0498 connect(preserveDevices, SIGNAL(toggled(bool)), this, SLOT(slotUncheckArchive(bool))); 0499 connect(useFFilterRule, SIGNAL(toggled(bool)), this, SLOT(slotFFilterRuleToggled(bool))); 0500 connect(useFFFilterRule, SIGNAL(toggled(bool)), this, SLOT(slotFFFilterRuleToggled(bool))); 0501 connect(makeBackups, SIGNAL(toggled(bool)), this, SLOT(slotBackupToggled(bool))); 0502 connect(compressData, SIGNAL(toggled(bool)), this, SLOT(slotCompressToggled(bool))); 0503 connect(keepPartial, SIGNAL(toggled(bool)), this, SLOT(slotKeepPartialToggled(bool))); 0504 0505 slotArchiveToggled(Smb4KSettings::archiveMode()); 0506 slotBackupToggled(Smb4KSettings::makeBackups()); 0507 slotCompressToggled(Smb4KSettings::compressData()); 0508 slotKeepPartialToggled(Smb4KSettings::keepPartial()); 0509 } 0510 0511 0512 Smb4KConfigPageSynchronization::~Smb4KConfigPageSynchronization() 0513 { 0514 } 0515 0516 0517 ///////////////////////////////////////////////////////////////////////////// 0518 // SLOT IMPLEMENTATIONS 0519 ///////////////////////////////////////////////////////////////////////////// 0520 0521 void Smb4KConfigPageSynchronization::slotArchiveToggled(bool checked) 0522 { 0523 if (checked) 0524 { 0525 findChild<QCheckBox *>("kcfg_RecurseIntoDirectories")->setChecked(checked); 0526 findChild<QCheckBox *>("kcfg_PreserveSymlinks")->setChecked(checked); 0527 findChild<QCheckBox *>("kcfg_PreservePermissions")->setChecked(checked); 0528 findChild<QCheckBox *>("kcfg_PreserveTimes")->setChecked(checked); 0529 findChild<QCheckBox *>("kcfg_PreserveGroup")->setChecked(checked); 0530 findChild<QCheckBox *>("kcfg_PreserveOwner")->setChecked(checked); 0531 findChild<QCheckBox *>("kcfg_PreserveDevicesAndSpecials")->setChecked(checked); 0532 } 0533 } 0534 0535 0536 void Smb4KConfigPageSynchronization::slotUncheckArchive(bool checked) 0537 { 0538 if (!checked) 0539 { 0540 findChild<QCheckBox *>("kcfg_ArchiveMode")->setChecked(checked); 0541 } 0542 } 0543 0544 0545 void Smb4KConfigPageSynchronization::slotBackupToggled(bool checked) 0546 { 0547 findChild<QCheckBox *>("kcfg_UseBackupDirectory")->setEnabled(checked); 0548 findChild<KUrlRequester *>("kcfg_BackupDirectory")->setEnabled(checked); 0549 findChild<QCheckBox *>("kcfg_UseBackupSuffix")->setEnabled(checked); 0550 findChild<KLineEdit *>("kcfg_BackupSuffix")->setEnabled(checked); 0551 } 0552 0553 0554 void Smb4KConfigPageSynchronization::slotCompressToggled(bool checked) 0555 { 0556 findChild<QCheckBox *>("kcfg_UseCompressionLevel")->setEnabled(checked); 0557 findChild<QSpinBox *>("kcfg_CompressionLevel")->setEnabled(checked); 0558 findChild<QCheckBox *>("kcfg_UseSkipCompression")->setEnabled(checked); 0559 findChild<KLineEdit *>("kcfg_SkipCompression")->setEnabled(checked); 0560 } 0561 0562 0563 void Smb4KConfigPageSynchronization::slotKeepPartialToggled(bool checked) 0564 { 0565 findChild<QCheckBox *>("kcfg_UsePartialDirectory")->setEnabled(checked); 0566 findChild<KUrlRequester *>("kcfg_PartialDirectory")->setEnabled(checked); 0567 } 0568 0569 0570 void Smb4KConfigPageSynchronization::slotFFilterRuleToggled(bool on) 0571 { 0572 QCheckBox *ff_filter = findChild<QCheckBox *>("kcfg_UseFFFilterRule"); 0573 0574 if (on && ff_filter->isChecked()) 0575 { 0576 ff_filter->setChecked(false); 0577 } 0578 } 0579 0580 0581 void Smb4KConfigPageSynchronization::slotFFFilterRuleToggled(bool on) 0582 { 0583 QCheckBox *f_filter = findChild<QCheckBox *>("kcfg_UseFFilterRule"); 0584 0585 if (on && f_filter->isChecked()) 0586 { 0587 f_filter->setChecked(false); 0588 } 0589 } 0590