File indexing completed on 2024-11-10 10:27:37
0001 /* 0002 The configuration page for the synchronization options 0003 0004 SPDX-FileCopyrightText: 2005-2023 Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 // application specific includes 0009 #include "smb4kconfigpagesynchronization.h" 0010 #include "core/smb4ksettings.h" 0011 0012 // Qt includes 0013 #include <QApplication> 0014 #include <QGroupBox> 0015 #include <QHBoxLayout> 0016 #include <QLabel> 0017 #include <QVBoxLayout> 0018 0019 // KDE includes 0020 #include <KLocalizedString> 0021 0022 Smb4KConfigPageSynchronization::Smb4KConfigPageSynchronization(QWidget *parent) 0023 : QTabWidget(parent) 0024 { 0025 // 0026 // 'Basic Settings' tab 0027 // 0028 QWidget *basicTab = new QWidget(this); 0029 QVBoxLayout *basicTabLayout = new QVBoxLayout(basicTab); 0030 0031 // Synchronization Directory 0032 QGroupBox *synchronizationDirectoryBox = new QGroupBox(i18n("Synchronization Directory"), basicTab); 0033 QGridLayout *synchronizationDirectoryBoxLayout = new QGridLayout(synchronizationDirectoryBox); 0034 0035 QLabel *synchronizationPrefixLabel = new QLabel(synchronizationDirectoryBox); 0036 synchronizationPrefixLabel->setText(Smb4KSettings::self()->rsyncPrefixItem()->label()); 0037 0038 synchronizationDirectoryBoxLayout->addWidget(synchronizationPrefixLabel, 0, 0); 0039 0040 m_synchronizationPrefix = new KUrlRequester(synchronizationDirectoryBox); 0041 m_synchronizationPrefix->setMode(KFile::Directory | KFile::LocalOnly); 0042 m_synchronizationPrefix->setObjectName(QStringLiteral("kcfg_RsyncPrefix")); 0043 0044 synchronizationDirectoryBoxLayout->addWidget(m_synchronizationPrefix, 0, 1); 0045 0046 synchronizationPrefixLabel->setBuddy(m_synchronizationPrefix); 0047 0048 basicTabLayout->addWidget(synchronizationDirectoryBox); 0049 0050 // Behavior 0051 QGroupBox *behaviorBox = new QGroupBox(i18n("Behavior"), basicTab); 0052 QGridLayout *behaviorBoxLayout = new QGridLayout(behaviorBox); 0053 0054 QCheckBox *archiveMode = new QCheckBox(Smb4KSettings::self()->archiveModeItem()->label(), behaviorBox); 0055 archiveMode->setObjectName(QStringLiteral("kcfg_ArchiveMode")); 0056 0057 behaviorBoxLayout->addWidget(archiveMode, 0, 0); 0058 0059 QCheckBox *recurseDirectories = new QCheckBox(Smb4KSettings::self()->recurseIntoDirectoriesItem()->label(), behaviorBox); 0060 recurseDirectories->setObjectName(QStringLiteral("kcfg_RecurseIntoDirectories")); 0061 0062 behaviorBoxLayout->addWidget(recurseDirectories, 0, 1); 0063 0064 QCheckBox *relativePaths = new QCheckBox(Smb4KSettings::self()->relativePathNamesItem()->label(), behaviorBox); 0065 relativePaths->setObjectName(QStringLiteral("kcfg_RelativePathNames")); 0066 0067 behaviorBoxLayout->addWidget(relativePaths, 1, 0); 0068 0069 QCheckBox *noImpliedDirs = new QCheckBox(Smb4KSettings::self()->noImpliedDirectoriesItem()->label(), behaviorBox); 0070 noImpliedDirs->setObjectName(QStringLiteral("kcfg_NoImpliedDirectories")); 0071 0072 behaviorBoxLayout->addWidget(noImpliedDirs, 1, 1); 0073 0074 QCheckBox *transferDirs = new QCheckBox(Smb4KSettings::self()->transferDirectoriesItem()->label(), behaviorBox); 0075 transferDirs->setObjectName(QStringLiteral("kcfg_TransferDirectories")); 0076 0077 behaviorBoxLayout->addWidget(transferDirs, 2, 0); 0078 0079 basicTabLayout->addWidget(behaviorBox); 0080 0081 // Backups 0082 QGroupBox *backupsBox = new QGroupBox(i18n("Backups"), basicTab); 0083 QVBoxLayout *backupsBoxLayout = new QVBoxLayout(backupsBox); 0084 0085 m_makeBackups = new QCheckBox(Smb4KSettings::self()->makeBackupsItem()->label(), backupsBox); 0086 m_makeBackups->setObjectName(QStringLiteral("kcfg_MakeBackups")); 0087 0088 backupsBoxLayout->addWidget(m_makeBackups); 0089 0090 m_backupSettingsWidget = new QWidget(backupsBox); 0091 m_backupSettingsWidget->setEnabled(false); 0092 QGridLayout *backupSettingsWidgetLayout = new QGridLayout(m_backupSettingsWidget); 0093 backupSettingsWidgetLayout->setContentsMargins(0, 0, 0, 0); 0094 0095 m_useBackupSuffix = new QCheckBox(Smb4KSettings::self()->useBackupSuffixItem()->label(), m_backupSettingsWidget); 0096 m_useBackupSuffix->setObjectName(QStringLiteral("kcfg_UseBackupSuffix")); 0097 m_backupSuffix = new KLineEdit(m_backupSettingsWidget); 0098 m_backupSuffix->setObjectName(QStringLiteral("kcfg_BackupSuffix")); 0099 m_backupSuffix->setClearButtonEnabled(true); 0100 0101 backupSettingsWidgetLayout->addWidget(m_useBackupSuffix, 0, 0); 0102 backupSettingsWidgetLayout->addWidget(m_backupSuffix, 0, 1); 0103 0104 m_useBackupDirectory = new QCheckBox(Smb4KSettings::self()->useBackupDirectoryItem()->label(), m_backupSettingsWidget); 0105 m_useBackupDirectory->setObjectName(QStringLiteral("kcfg_UseBackupDirectory")); 0106 m_backupDirectory = new KUrlRequester(m_backupSettingsWidget); 0107 m_backupDirectory->setObjectName(QStringLiteral("kcfg_BackupDirectory")); 0108 m_backupDirectory->setMode(KFile::Directory | KFile::LocalOnly); 0109 0110 backupSettingsWidgetLayout->addWidget(m_useBackupDirectory, 1, 0); 0111 backupSettingsWidgetLayout->addWidget(m_backupDirectory, 1, 1); 0112 0113 backupsBoxLayout->addWidget(m_backupSettingsWidget); 0114 0115 basicTabLayout->addWidget(backupsBox); 0116 basicTabLayout->addStretch(100); 0117 0118 addTab(basicTab, i18n("Basic Settings")); 0119 0120 // 0121 // 'File Handling' tab 0122 // 0123 QWidget *fileHandlingTab = new QWidget(this); 0124 QVBoxLayout *fileHandlingTabLayout = new QVBoxLayout(fileHandlingTab); 0125 0126 // General 0127 QGroupBox *generalBox = new QGroupBox(i18n("General"), fileHandlingTab); 0128 QGridLayout *generalBoxLayout = new QGridLayout(generalBox); 0129 0130 QCheckBox *updateTarget = new QCheckBox(Smb4KSettings::self()->updateTargetItem()->label(), generalBox); 0131 updateTarget->setObjectName(QStringLiteral("kcfg_UpdateTarget")); 0132 0133 generalBoxLayout->addWidget(updateTarget, 0, 0); 0134 0135 QCheckBox *updateInPlace = new QCheckBox(Smb4KSettings::self()->updateInPlaceItem()->label(), generalBox); 0136 updateInPlace->setObjectName(QStringLiteral("kcfg_UpdateInPlace")); 0137 0138 generalBoxLayout->addWidget(updateInPlace, 0, 1); 0139 0140 QCheckBox *sparseFiles = new QCheckBox(Smb4KSettings::self()->efficientSparseFileHandlingItem()->label(), generalBox); 0141 sparseFiles->setObjectName(QStringLiteral("kcfg_EfficientSparseFileHandling")); 0142 0143 generalBoxLayout->addWidget(sparseFiles, 1, 0); 0144 0145 QCheckBox *copyFilesWhole = new QCheckBox(Smb4KSettings::self()->copyFilesWholeItem()->label(), generalBox); 0146 copyFilesWhole->setObjectName(QStringLiteral("kcfg_CopyFilesWhole")); 0147 0148 generalBoxLayout->addWidget(copyFilesWhole, 1, 1); 0149 0150 QCheckBox *updateExisting = new QCheckBox(Smb4KSettings::self()->updateExistingItem()->label(), generalBox); 0151 updateExisting->setObjectName(QStringLiteral("kcfg_UpdateExisting")); 0152 0153 generalBoxLayout->addWidget(updateExisting, 2, 0); 0154 0155 QCheckBox *ignoreExisting = new QCheckBox(Smb4KSettings::self()->ignoreExistingItem()->label(), generalBox); 0156 ignoreExisting->setObjectName(QStringLiteral("kcfg_IgnoreExisting")); 0157 0158 generalBoxLayout->addWidget(ignoreExisting, 2, 1); 0159 0160 fileHandlingTabLayout->addWidget(generalBox); 0161 0162 // Links 0163 QGroupBox *linksBox = new QGroupBox(i18n("Links"), fileHandlingTab); 0164 QGridLayout *linksBoxLayout = new QGridLayout(linksBox); 0165 0166 QCheckBox *preserveLinks = new QCheckBox(Smb4KSettings::self()->preserveSymlinksItem()->label(), linksBox); 0167 preserveLinks->setObjectName(QStringLiteral("kcfg_PreserveSymlinks")); 0168 0169 linksBoxLayout->addWidget(preserveLinks, 0, 0); 0170 0171 QCheckBox *transformLinks = new QCheckBox(Smb4KSettings::self()->transformSymlinksItem()->label(), linksBox); 0172 transformLinks->setObjectName(QStringLiteral("kcfg_TransformSymlinks")); 0173 0174 linksBoxLayout->addWidget(transformLinks, 0, 1); 0175 0176 QCheckBox *transformUnsafe = new QCheckBox(Smb4KSettings::self()->transformUnsafeSymlinksItem()->label(), linksBox); 0177 transformUnsafe->setObjectName(QStringLiteral("kcfg_TransformUnsafeSymlinks")); 0178 0179 linksBoxLayout->addWidget(transformUnsafe, 1, 0); 0180 0181 QCheckBox *ignoreUnsafe = new QCheckBox(Smb4KSettings::self()->ignoreUnsafeSymlinksItem()->label(), linksBox); 0182 ignoreUnsafe->setObjectName(QStringLiteral("kcfg_IgnoreUnsafeSymlinks")); 0183 0184 linksBoxLayout->addWidget(ignoreUnsafe, 1, 1); 0185 0186 QCheckBox *mungeLinks = new QCheckBox(Smb4KSettings::self()->mungeSymlinksItem()->label(), linksBox); 0187 mungeLinks->setObjectName(QStringLiteral("kcfg_MungeSymlinks")); 0188 0189 linksBoxLayout->addWidget(mungeLinks, 2, 0); 0190 0191 QCheckBox *preserveHardLinks = new QCheckBox(Smb4KSettings::self()->preserveHardLinksItem()->label(), linksBox); 0192 preserveHardLinks->setObjectName(QStringLiteral("kcfg_PreserveHardLinks")); 0193 0194 linksBoxLayout->addWidget(preserveHardLinks, 2, 1); 0195 0196 QCheckBox *copyDirLinks = new QCheckBox(Smb4KSettings::self()->copyDirectorySymlinksItem()->label(), linksBox); 0197 ; 0198 copyDirLinks->setObjectName(QStringLiteral("kcfg_CopyDirectorySymlinks")); 0199 0200 linksBoxLayout->addWidget(copyDirLinks, 3, 0); 0201 0202 QCheckBox *keepDirLinks = new QCheckBox(Smb4KSettings::self()->keepDirectorySymlinksItem()->label(), linksBox); 0203 keepDirLinks->setObjectName(QStringLiteral("kcfg_KeepDirectorySymlinks")); 0204 0205 linksBoxLayout->addWidget(keepDirLinks, 3, 1); 0206 0207 fileHandlingTabLayout->addWidget(linksBox); 0208 fileHandlingTabLayout->addStretch(100); 0209 0210 addTab(fileHandlingTab, i18n("File Handling")); 0211 0212 // 0213 // 'File Attributes and Ownership' tab 0214 // 0215 QWidget *attributesAndOwnershipTab = new QWidget(this); 0216 QVBoxLayout *attributesAndOwnershipTabLayout = new QVBoxLayout(attributesAndOwnershipTab); 0217 0218 QGroupBox *attributesBox = new QGroupBox(i18n("File Attributes"), attributesAndOwnershipTab); 0219 QGridLayout *attributesBoxLayout = new QGridLayout(attributesBox); 0220 0221 QCheckBox *preservePermissions = new QCheckBox(Smb4KSettings::self()->preservePermissionsItem()->label(), attributesBox); 0222 preservePermissions->setObjectName(QStringLiteral("kcfg_PreservePermissions")); 0223 0224 attributesBoxLayout->addWidget(preservePermissions, 0, 0); 0225 0226 QCheckBox *preserveACLs = new QCheckBox(Smb4KSettings::self()->preserveACLsItem()->label(), attributesBox); 0227 preserveACLs->setObjectName(QStringLiteral("kcfg_PreserveACLs")); 0228 0229 attributesBoxLayout->addWidget(preserveACLs, 0, 1); 0230 0231 QCheckBox *preserveExtendedArrtibutes = new QCheckBox(Smb4KSettings::self()->preserveExtendedAttributesItem()->label(), attributesBox); 0232 preserveExtendedArrtibutes->setObjectName(QStringLiteral("kcfg_PreserveExtendedAttributes")); 0233 0234 attributesBoxLayout->addWidget(preserveExtendedArrtibutes, 1, 0); 0235 0236 QCheckBox *preserveAccessTimes = new QCheckBox(Smb4KSettings::self()->preserveAccessTimesItem()->label(), attributesBox); 0237 preserveAccessTimes->setObjectName(QStringLiteral("kcfg_PreserveAccessTimes")); 0238 0239 attributesBoxLayout->addWidget(preserveAccessTimes, 1, 1); 0240 0241 QCheckBox *preserveCreateTimes = new QCheckBox(Smb4KSettings::self()->preserveCreateTimesItem()->label(), attributesBox); 0242 preserveCreateTimes->setObjectName(QStringLiteral("kcfg_PreserveCreateTimes")); 0243 0244 attributesBoxLayout->addWidget(preserveCreateTimes, 2, 0); 0245 0246 QCheckBox *preserveDevices = new QCheckBox(Smb4KSettings::self()->preserveDevicesAndSpecialsItem()->label(), attributesBox); 0247 preserveDevices->setObjectName(QStringLiteral("kcfg_PreserveDevicesAndSpecials")); 0248 0249 attributesBoxLayout->addWidget(preserveDevices, 2, 1); 0250 0251 QCheckBox *preserveTimes = new QCheckBox(Smb4KSettings::self()->preserveTimesItem()->label(), attributesBox); 0252 preserveTimes->setObjectName(QStringLiteral("kcfg_PreserveTimes")); 0253 0254 attributesBoxLayout->addWidget(preserveTimes, 3, 0); 0255 0256 QCheckBox *omitDirectoriesTimes = new QCheckBox(Smb4KSettings::self()->omitDirectoryTimesItem()->label(), attributesBox); 0257 omitDirectoriesTimes->setObjectName(QStringLiteral("kcfg_OmitDirectoryTimes")); 0258 0259 attributesBoxLayout->addWidget(omitDirectoriesTimes, 3, 1); 0260 0261 attributesAndOwnershipTabLayout->addWidget(attributesBox); 0262 0263 QGroupBox *ownershipBox = new QGroupBox(i18n("Ownership"), attributesAndOwnershipTab); 0264 QGridLayout *ownershipBoxLayout = new QGridLayout(ownershipBox); 0265 0266 QCheckBox *preserveOwner = new QCheckBox(Smb4KSettings::self()->preserveOwnerItem()->label(), ownershipBox); 0267 preserveOwner->setObjectName(QStringLiteral("kcfg_PreserveOwner")); 0268 0269 ownershipBoxLayout->addWidget(preserveOwner, 1, 0); 0270 0271 QCheckBox *preserveGroup = new QCheckBox(Smb4KSettings::self()->preserveGroupItem()->label(), ownershipBox); 0272 preserveGroup->setObjectName(QStringLiteral("kcfg_PreserveGroup")); 0273 0274 ownershipBoxLayout->addWidget(preserveGroup, 1, 1); 0275 0276 attributesAndOwnershipTabLayout->addWidget(ownershipBox); 0277 attributesAndOwnershipTabLayout->addStretch(100); 0278 0279 addTab(attributesAndOwnershipTab, i18n("File Attributes && Ownership")); 0280 0281 // 0282 // 'File Transfer' tab 0283 // 0284 QWidget *transferTab = new QWidget(this); 0285 QVBoxLayout *transferTabLayout = new QVBoxLayout(transferTab); 0286 0287 // Compression 0288 QGroupBox *compressionBox = new QGroupBox(i18n("Compression"), transferTab); 0289 QVBoxLayout *compressionBoxLayout = new QVBoxLayout(compressionBox); 0290 0291 QCheckBox *compressData = new QCheckBox(Smb4KSettings::self()->compressDataItem()->label(), compressionBox); 0292 compressData->setObjectName(QStringLiteral("kcfg_CompressData")); 0293 0294 compressionBoxLayout->addWidget(compressData); 0295 0296 m_compressionSettingsWidget = new QWidget(compressionBox); 0297 m_compressionSettingsWidget->setEnabled(false); 0298 QGridLayout *compressionSettingsWidgetLayout = new QGridLayout(m_compressionSettingsWidget); 0299 compressionSettingsWidgetLayout->setContentsMargins(0, 0, 0, 0); 0300 0301 QCheckBox *compressionLevelButton = new QCheckBox(Smb4KSettings::self()->useCompressionLevelItem()->label(), m_compressionSettingsWidget); 0302 compressionLevelButton->setObjectName(QStringLiteral("kcfg_UseCompressionLevel")); 0303 0304 compressionSettingsWidgetLayout->addWidget(compressionLevelButton, 0, 0); 0305 0306 QSpinBox *compressionLevel = new QSpinBox(m_compressionSettingsWidget); 0307 compressionLevel->setObjectName(QStringLiteral("kcfg_CompressionLevel")); 0308 0309 compressionSettingsWidgetLayout->addWidget(compressionLevel, 0, 1); 0310 0311 QCheckBox *skipCompressionButton = new QCheckBox(Smb4KSettings::self()->useSkipCompressionItem()->label(), m_compressionSettingsWidget); 0312 skipCompressionButton->setObjectName(QStringLiteral("kcfg_UseSkipCompression")); 0313 0314 compressionSettingsWidgetLayout->addWidget(skipCompressionButton, 1, 0); 0315 0316 KLineEdit *skipCompression = new KLineEdit(m_compressionSettingsWidget); 0317 skipCompression->setObjectName(QStringLiteral("kcfg_SkipCompression")); 0318 skipCompression->setClearButtonEnabled(true); 0319 0320 compressionSettingsWidgetLayout->addWidget(skipCompression, 1, 1); 0321 0322 compressionBoxLayout->addWidget(m_compressionSettingsWidget); 0323 0324 transferTabLayout->addWidget(compressionBox); 0325 0326 // Files 0327 QGroupBox *filesBox = new QGroupBox(i18n("Files"), transferTab); 0328 QGridLayout *filesBoxLayout = new QGridLayout(filesBox); 0329 0330 m_useMinimalTransferSize = new QCheckBox(Smb4KSettings::self()->useMinimalTransferSizeItem()->label(), filesBox); 0331 m_useMinimalTransferSize->setObjectName(QStringLiteral("kcfg_UseMinimalTransferSize")); 0332 0333 filesBoxLayout->addWidget(m_useMinimalTransferSize, 0, 0); 0334 0335 m_minimalTransferSize = new QSpinBox(filesBox); 0336 m_minimalTransferSize->setObjectName(QStringLiteral("kcfg_MinimalTransferSize")); 0337 m_minimalTransferSize->setSuffix(i18n(" kB")); 0338 0339 filesBoxLayout->addWidget(m_minimalTransferSize, 0, 1); 0340 0341 m_useMaximalTransferSize = new QCheckBox(Smb4KSettings::self()->useMaximalTransferSizeItem()->label(), filesBox); 0342 m_useMaximalTransferSize->setObjectName(QStringLiteral("kcfg_UseMaximalTransferSize")); 0343 0344 filesBoxLayout->addWidget(m_useMaximalTransferSize, 1, 0); 0345 0346 m_maximalTransferSize = new QSpinBox(filesBox); 0347 m_maximalTransferSize->setObjectName(QStringLiteral("kcfg_MaximalTransferSize")); 0348 m_maximalTransferSize->setSuffix(i18n(" kB")); 0349 0350 filesBoxLayout->addWidget(m_maximalTransferSize, 1, 1); 0351 0352 QCheckBox *keepPartial = new QCheckBox(Smb4KSettings::self()->keepPartialItem()->label(), filesBox); 0353 keepPartial->setObjectName(QStringLiteral("kcfg_KeepPartial")); 0354 0355 filesBoxLayout->addWidget(keepPartial, 2, 0, 1, 2); 0356 0357 m_usePartialDirectory = new QCheckBox(Smb4KSettings::self()->usePartialDirectoryItem()->label(), filesBox); 0358 m_usePartialDirectory->setObjectName(QStringLiteral("kcfg_UsePartialDirectory")); 0359 m_usePartialDirectory->setEnabled(false); 0360 0361 filesBoxLayout->addWidget(m_usePartialDirectory, 3, 0); 0362 0363 m_partialDirectory = new KUrlRequester(filesBox); 0364 m_partialDirectory->setObjectName(QStringLiteral("kcfg_PartialDirectory")); 0365 m_partialDirectory->setMode(KFile::Directory | KFile::LocalOnly); 0366 m_partialDirectory->setEnabled(false); 0367 0368 filesBoxLayout->addWidget(m_partialDirectory, 3, 1); 0369 0370 transferTabLayout->addWidget(filesBox); 0371 0372 // Restrictions 0373 QGroupBox *miscellaneousBox = new QGroupBox(i18n("Miscellaneous"), transferTab); 0374 QGridLayout *miscellaneousBoxLayout = new QGridLayout(miscellaneousBox); 0375 0376 QCheckBox *bandwidthLimitButton = new QCheckBox(Smb4KSettings::self()->useBandwidthLimitItem()->label(), miscellaneousBox); 0377 bandwidthLimitButton->setObjectName(QStringLiteral("kcfg_UseBandwidthLimit")); 0378 0379 miscellaneousBoxLayout->addWidget(bandwidthLimitButton, 0, 0); 0380 0381 QSpinBox *bandwidthLimit = new QSpinBox(miscellaneousBox); 0382 bandwidthLimit->setObjectName(QStringLiteral("kcfg_BandwidthLimit")); 0383 bandwidthLimit->setSuffix(i18n(" kB/s")); 0384 0385 miscellaneousBoxLayout->addWidget(bandwidthLimit, 0, 1); 0386 0387 transferTabLayout->addWidget(miscellaneousBox); 0388 transferTabLayout->addStretch(100); 0389 0390 addTab(transferTab, i18n("File Transfer")); 0391 0392 // 0393 // 'File Deletion' tab 0394 // 0395 QWidget *deleteTab = new QWidget(this); 0396 QVBoxLayout *deleteTabLayout = new QVBoxLayout(deleteTab); 0397 0398 // Files and Directories 0399 QGroupBox *filesAndDirectoriesBox = new QGroupBox(i18n("Files && Directories"), deleteTab); 0400 QGridLayout *filesAndDirectoriesBoxLayout = new QGridLayout(filesAndDirectoriesBox); 0401 0402 QCheckBox *removeSource = new QCheckBox(Smb4KSettings::self()->removeSourceFilesItem()->label(), filesAndDirectoriesBox); 0403 removeSource->setObjectName(QStringLiteral("kcfg_RemoveSourceFiles")); 0404 0405 filesAndDirectoriesBoxLayout->addWidget(removeSource, 0, 0); 0406 0407 QCheckBox *deleteExtraneous = new QCheckBox(Smb4KSettings::self()->deleteExtraneousItem()->label(), filesAndDirectoriesBox); 0408 deleteExtraneous->setObjectName(QStringLiteral("kcfg_DeleteExtraneous")); 0409 0410 filesAndDirectoriesBoxLayout->addWidget(deleteExtraneous, 0, 1); 0411 0412 QCheckBox *deleteBefore = new QCheckBox(Smb4KSettings::self()->deleteBeforeItem()->label(), filesAndDirectoriesBox); 0413 deleteBefore->setObjectName(QStringLiteral("kcfg_DeleteBefore")); 0414 0415 filesAndDirectoriesBoxLayout->addWidget(deleteBefore, 1, 0); 0416 0417 QCheckBox *deleteAfter = new QCheckBox(Smb4KSettings::self()->deleteAfterItem()->label(), filesAndDirectoriesBox); 0418 deleteAfter->setObjectName(QStringLiteral("kcfg_DeleteAfter")); 0419 0420 filesAndDirectoriesBoxLayout->addWidget(deleteAfter, 1, 1); 0421 0422 QCheckBox *deleteDuring = new QCheckBox(Smb4KSettings::self()->deleteDuringItem()->label(), filesAndDirectoriesBox); 0423 deleteDuring->setObjectName(QStringLiteral("kcfg_DeleteDuring")); 0424 0425 filesAndDirectoriesBoxLayout->addWidget(deleteDuring, 2, 0); 0426 0427 QCheckBox *deleteExcluded = new QCheckBox(Smb4KSettings::self()->deleteExcludedItem()->label(), filesAndDirectoriesBox); 0428 deleteExcluded->setObjectName(QStringLiteral("kcfg_DeleteExcluded")); 0429 0430 filesAndDirectoriesBoxLayout->addWidget(deleteExcluded, 2, 1); 0431 0432 QCheckBox *ignoreIoErrors = new QCheckBox(Smb4KSettings::self()->ignoreErrorsItem()->label(), filesAndDirectoriesBox); 0433 ignoreIoErrors->setObjectName(QStringLiteral("kcfg_IgnoreErrors")); 0434 0435 filesAndDirectoriesBoxLayout->addWidget(ignoreIoErrors, 3, 0); 0436 0437 QCheckBox *forceDirDeletion = new QCheckBox(Smb4KSettings::self()->forceDirectoryDeletionItem()->label(), filesAndDirectoriesBox); 0438 forceDirDeletion->setObjectName(QStringLiteral("kcfg_ForceDirectoryDeletion")); 0439 0440 filesAndDirectoriesBoxLayout->addWidget(forceDirDeletion, 3, 1); 0441 0442 deleteTabLayout->addWidget(filesAndDirectoriesBox); 0443 0444 // Restrictions 0445 QGroupBox *restrictionsBox = new QGroupBox(i18n("Restrictions"), deleteTab); 0446 QGridLayout *restrictionsBoxLayout = new QGridLayout(restrictionsBox); 0447 0448 QCheckBox *maximumDeleteButton = new QCheckBox(Smb4KSettings::self()->useMaximumDeleteItem()->label(), restrictionsBox); 0449 maximumDeleteButton->setObjectName(QStringLiteral("kcfg_UseMaximumDelete")); 0450 0451 restrictionsBoxLayout->addWidget(maximumDeleteButton, 0, 0); 0452 0453 QSpinBox *maximumDelete = new QSpinBox(restrictionsBox); 0454 maximumDelete->setObjectName(QStringLiteral("kcfg_MaximumDeleteValue")); 0455 0456 restrictionsBoxLayout->addWidget(maximumDelete, 0, 1); 0457 0458 deleteTabLayout->addWidget(restrictionsBox); 0459 deleteTabLayout->addStretch(100); 0460 0461 addTab(deleteTab, i18n("File Deletion")); 0462 0463 // 0464 // 'Filter' tab 0465 // 0466 QWidget *filterTab = new QWidget(this); 0467 QVBoxLayout *filterTabLayout = new QVBoxLayout(filterTab); 0468 0469 // General 0470 QGroupBox *generalFilteringBox = new QGroupBox(i18n("General Filtering Settings"), filterTab); 0471 QGridLayout *generalFilteringBoxLayout = new QGridLayout(generalFilteringBox); 0472 0473 QCheckBox *cvsExclude = new QCheckBox(Smb4KSettings::self()->useCVSExcludeItem()->label(), generalFilteringBox); 0474 cvsExclude->setObjectName(QStringLiteral("kcfg_UseCVSExclude")); 0475 0476 generalFilteringBoxLayout->addWidget(cvsExclude, 0, 0, 1, 2); 0477 0478 m_useExcludePattern = new QCheckBox(Smb4KSettings::self()->useExcludePatternItem()->label(), generalFilteringBox); 0479 m_useExcludePattern->setObjectName(QStringLiteral("kcfg_UseExcludePattern")); 0480 0481 generalFilteringBoxLayout->addWidget(m_useExcludePattern, 1, 0); 0482 0483 m_excludePattern = new KLineEdit(generalFilteringBox); 0484 m_excludePattern->setObjectName(QStringLiteral("kcfg_ExcludePattern")); 0485 m_excludePattern->setClearButtonEnabled(true); 0486 0487 generalFilteringBoxLayout->addWidget(m_excludePattern, 1, 1); 0488 0489 m_useExcludeFrom = new QCheckBox(Smb4KSettings::self()->useExcludeFromItem()->label(), generalFilteringBox); 0490 m_useExcludeFrom->setObjectName(QStringLiteral("kcfg_UseExcludeFrom")); 0491 0492 generalFilteringBoxLayout->addWidget(m_useExcludeFrom, 2, 0); 0493 0494 m_excludeFrom = new KUrlRequester(generalFilteringBox); 0495 m_excludeFrom->setObjectName(QStringLiteral("kcfg_ExcludeFrom")); 0496 m_excludeFrom->setMode(KFile::File | KFile::LocalOnly); 0497 0498 generalFilteringBoxLayout->addWidget(m_excludeFrom, 2, 1); 0499 0500 m_useIncludePattern = new QCheckBox(Smb4KSettings::self()->useIncludePatternItem()->label(), generalFilteringBox); 0501 m_useIncludePattern->setObjectName(QStringLiteral("kcfg_UseIncludePattern")); 0502 0503 generalFilteringBoxLayout->addWidget(m_useIncludePattern, 3, 0); 0504 0505 m_includePattern = new KLineEdit(generalFilteringBox); 0506 m_includePattern->setObjectName(QStringLiteral("kcfg_IncludePattern")); 0507 m_includePattern->setClearButtonEnabled(true); 0508 0509 generalFilteringBoxLayout->addWidget(m_includePattern, 3, 1); 0510 0511 m_useIncludeFrom = new QCheckBox(Smb4KSettings::self()->useIncludeFromItem()->label(), generalFilteringBox); 0512 m_useIncludeFrom->setObjectName(QStringLiteral("kcfg_UseIncludeFrom")); 0513 0514 generalFilteringBoxLayout->addWidget(m_useIncludeFrom, 4, 0); 0515 0516 m_includeFrom = new KUrlRequester(generalFilteringBox); 0517 m_includeFrom->setObjectName(QStringLiteral("kcfg_IncludeFrom")); 0518 m_includeFrom->setMode(KFile::File | KFile::LocalOnly); 0519 0520 generalFilteringBoxLayout->addWidget(m_includeFrom, 4, 1); 0521 0522 filterTabLayout->addWidget(generalFilteringBox); 0523 0524 // Filter rules 0525 QGroupBox *filterRulesBox = new QGroupBox(i18n("Filter Rules"), filterTab); 0526 QGridLayout *filterRulesBoxLayout = new QGridLayout(filterRulesBox); 0527 0528 m_useFFilterRule = new QCheckBox(Smb4KSettings::self()->useFFilterRuleItem()->label(), filterRulesBox); 0529 m_useFFilterRule->setObjectName(QStringLiteral("kcfg_UseFFilterRule")); 0530 0531 filterRulesBoxLayout->addWidget(m_useFFilterRule, 0, 0, 1, 2); 0532 0533 m_useFFFilterRule = new QCheckBox(Smb4KSettings::self()->useFFFilterRuleItem()->label(), filterRulesBox); 0534 m_useFFFilterRule->setObjectName(QStringLiteral("kcfg_UseFFFilterRule")); 0535 0536 filterRulesBoxLayout->addWidget(m_useFFFilterRule, 1, 0, 1, 2); 0537 0538 QCheckBox *useCustomFilterRules = new QCheckBox(Smb4KSettings::self()->useCustomFilteringRulesItem()->label(), filterRulesBox); 0539 useCustomFilterRules->setObjectName(QStringLiteral("kcfg_UseCustomFilteringRules")); 0540 0541 filterRulesBoxLayout->addWidget(useCustomFilterRules, 2, 0); 0542 0543 KLineEdit *customFilterRules = new KLineEdit(filterTab); 0544 customFilterRules->setObjectName(QStringLiteral("kcfg_CustomFilteringRules")); 0545 customFilterRules->setClearButtonEnabled(true); 0546 0547 filterRulesBoxLayout->addWidget(customFilterRules, 2, 1); 0548 0549 filterTabLayout->addWidget(filterRulesBox); 0550 filterTabLayout->addStretch(100); 0551 0552 addTab(filterTab, i18n("Filtering")); 0553 0554 // 0555 // 'Miscellaneous' tab 0556 // 0557 QWidget *miscellaneousTab = new QWidget(this); 0558 QVBoxLayout *miscellaneousTabLayout = new QVBoxLayout(miscellaneousTab); 0559 0560 // Checksums 0561 QGroupBox *checksumsBox = new QGroupBox(i18n("Checksums"), miscellaneousTab); 0562 QGridLayout *checksumsBoxLayout = new QGridLayout(checksumsBox); 0563 0564 m_useBlockSize = new QCheckBox(Smb4KSettings::self()->useBlockSizeItem()->label(), checksumsBox); 0565 m_useBlockSize->setObjectName(QStringLiteral("kcfg_UseBlockSize")); 0566 0567 checksumsBoxLayout->addWidget(m_useBlockSize, 0, 0); 0568 0569 m_blockSize = new QSpinBox(checksumsBox); 0570 m_blockSize->setObjectName(QStringLiteral("kcfg_BlockSize")); 0571 0572 checksumsBoxLayout->addWidget(m_blockSize, 0, 1); 0573 0574 QCheckBox *checksumSeedButton = new QCheckBox(Smb4KSettings::self()->useChecksumSeedItem()->label(), checksumsBox); 0575 checksumSeedButton->setObjectName(QStringLiteral("kcfg_UseChecksumSeed")); 0576 0577 checksumsBoxLayout->addWidget(checksumSeedButton, 1, 0); 0578 0579 QSpinBox *checksumSeed = new QSpinBox(checksumsBox); 0580 checksumSeed->setObjectName(QStringLiteral("kcfg_ChecksumSeed")); 0581 0582 checksumsBoxLayout->addWidget(checksumSeed, 1, 1); 0583 0584 QCheckBox *useChecksum = new QCheckBox(Smb4KSettings::self()->useChecksumItem()->label(), checksumsBox); 0585 useChecksum->setObjectName(QStringLiteral("kcfg_UseChecksum")); 0586 0587 checksumsBoxLayout->addWidget(useChecksum, 2, 0, 1, 2); 0588 0589 miscellaneousTabLayout->addWidget(checksumsBox); 0590 0591 // Miscellaneous 0592 QGroupBox *miscellaneousBox2 = new QGroupBox(i18n("Miscellaneous"), miscellaneousTab); 0593 QGridLayout *miscellaneousBox2Layout = new QGridLayout(miscellaneousBox2); 0594 0595 QCheckBox *oneFilesystem = new QCheckBox(Smb4KSettings::self()->oneFileSystemItem()->label(), miscellaneousBox2); 0596 oneFilesystem->setObjectName(QStringLiteral("kcfg_OneFileSystem")); 0597 0598 miscellaneousBox2Layout->addWidget(oneFilesystem, 0, 0); 0599 0600 QCheckBox *delayUpdates = new QCheckBox(Smb4KSettings::self()->delayUpdatesItem()->label(), miscellaneousBox2); 0601 delayUpdates->setObjectName(QStringLiteral("kcfg_DelayUpdates")); 0602 0603 miscellaneousBox2Layout->addWidget(delayUpdates, 0, 1); 0604 0605 miscellaneousTabLayout->addWidget(miscellaneousBox2); 0606 miscellaneousTabLayout->addStretch(100); 0607 0608 addTab(miscellaneousTab, i18n("Miscellaneous")); 0609 0610 // 0611 // Connections 0612 // 0613 connect(m_useFFilterRule, &QCheckBox::toggled, this, &Smb4KConfigPageSynchronization::slotFFilterRuleToggled); 0614 connect(m_useFFFilterRule, &QCheckBox::toggled, this, &Smb4KConfigPageSynchronization::slotFFFilterRuleToggled); 0615 connect(m_makeBackups, &QCheckBox::toggled, this, &Smb4KConfigPageSynchronization::slotBackupToggled); 0616 connect(compressData, &QCheckBox::toggled, this, &Smb4KConfigPageSynchronization::slotCompressToggled); 0617 connect(keepPartial, &QCheckBox::toggled, this, &Smb4KConfigPageSynchronization::slotKeepPartialToggled); 0618 } 0619 0620 Smb4KConfigPageSynchronization::~Smb4KConfigPageSynchronization() 0621 { 0622 } 0623 0624 bool Smb4KConfigPageSynchronization::checkSettings() 0625 { 0626 for (int i = 0; i < count(); i++) { 0627 // Synchronization prefix 0628 if (widget(i)->isAncestorOf(m_synchronizationPrefix) && !m_synchronizationPrefix->url().isValid()) { 0629 setCurrentIndex(i); 0630 m_synchronizationPrefix->setFocus(); 0631 return false; 0632 } 0633 0634 // Backups 0635 if (widget(i)->isAncestorOf(m_makeBackups) && m_makeBackups->isChecked()) { 0636 if (m_useBackupSuffix->isChecked() && m_backupSuffix->text().trimmed().isEmpty()) { 0637 setCurrentIndex(i); 0638 m_backupSuffix->setFocus(); 0639 return false; 0640 } 0641 0642 if (m_useBackupDirectory->isChecked() && !m_backupDirectory->url().isValid()) { 0643 setCurrentIndex(i); 0644 m_backupDirectory->setFocus(); 0645 return false; 0646 } 0647 } 0648 0649 // Minimal transfer size 0650 if (widget(i)->isAncestorOf(m_useMinimalTransferSize) && widget(i)->isAncestorOf(m_minimalTransferSize) && m_useMinimalTransferSize->isChecked() 0651 && m_minimalTransferSize->value() == 0) { 0652 setCurrentIndex(i); 0653 m_minimalTransferSize->setFocus(); 0654 return false; 0655 } 0656 0657 // Maximal transfer size 0658 if (widget(i)->isAncestorOf(m_useMaximalTransferSize) && widget(i)->isAncestorOf(m_maximalTransferSize) && m_useMaximalTransferSize->isChecked() 0659 && m_maximalTransferSize->value() == 0) { 0660 setCurrentIndex(i); 0661 m_maximalTransferSize->setFocus(); 0662 return false; 0663 } 0664 0665 // Partial directory 0666 if (widget(i)->isAncestorOf(m_usePartialDirectory) && widget(i)->isAncestorOf(m_partialDirectory) && m_usePartialDirectory->isChecked() 0667 && !m_partialDirectory->url().isValid()) { 0668 setCurrentIndex(i); 0669 m_partialDirectory->setFocus(); 0670 return false; 0671 } 0672 0673 // Exclude exclude 0674 if (widget(i)->isAncestorOf(m_useExcludePattern) && widget(i)->isAncestorOf(m_excludePattern) && m_useExcludePattern->isChecked() 0675 && m_excludePattern->text().trimmed().isEmpty()) { 0676 setCurrentIndex(i); 0677 m_excludePattern->setFocus(); 0678 return false; 0679 } 0680 0681 // Read exclude pattern from file 0682 if (widget(i)->isAncestorOf(m_useExcludeFrom) && widget(i)->isAncestorOf(m_excludeFrom) && m_useExcludeFrom->isChecked() 0683 && !m_excludeFrom->url().isValid()) { 0684 setCurrentIndex(i); 0685 m_excludeFrom->setFocus(); 0686 return false; 0687 } 0688 0689 // Exclude exclude 0690 if (widget(i)->isAncestorOf(m_useIncludePattern) && widget(i)->isAncestorOf(m_includePattern) && m_useIncludePattern->isChecked() 0691 && m_includePattern->text().trimmed().isEmpty()) { 0692 setCurrentIndex(i); 0693 m_includePattern->setFocus(); 0694 return false; 0695 } 0696 0697 // Read exclude pattern from file 0698 if (widget(i)->isAncestorOf(m_useIncludeFrom) && widget(i)->isAncestorOf(m_includeFrom) && m_useIncludeFrom->isChecked() 0699 && !m_includeFrom->url().isValid()) { 0700 setCurrentIndex(i); 0701 m_includeFrom->setFocus(); 0702 return false; 0703 } 0704 0705 // Block size 0706 if (widget(i)->isAncestorOf(m_useBlockSize) && widget(i)->isAncestorOf(m_blockSize) && m_useBlockSize->isChecked() && m_blockSize->value() == 0) { 0707 setCurrentIndex(i); 0708 m_blockSize->setFocus(); 0709 return false; 0710 } 0711 0712 // NOTE: There is no need to check the following settings, because they may be empty or 0: 0713 // - kcfg_UseCompressionLevel & kcfg_CompressionLevel 0714 // - kcfg_UseSkipCompression & kcfg_SkipCompression 0715 // - kcfg_UseBandwidthLimit & kcfg_BandwidthLimit 0716 // - kcfg_UseMaximumDelete & kcfg_MaximumDeleteValue 0717 // - kcfg_CustomFilteringRules 0718 // - kcfg_UseChecksumSeed & kcfg_ChecksumSeed 0719 } 0720 0721 return true; 0722 } 0723 0724 ///////////////////////////////////////////////////////////////////////////// 0725 // SLOT IMPLEMENTATIONS 0726 ///////////////////////////////////////////////////////////////////////////// 0727 0728 void Smb4KConfigPageSynchronization::slotBackupToggled(bool checked) 0729 { 0730 m_backupSettingsWidget->setEnabled(checked); 0731 } 0732 0733 void Smb4KConfigPageSynchronization::slotCompressToggled(bool checked) 0734 { 0735 m_compressionSettingsWidget->setEnabled(checked); 0736 } 0737 0738 void Smb4KConfigPageSynchronization::slotKeepPartialToggled(bool checked) 0739 { 0740 m_usePartialDirectory->setEnabled(checked); 0741 m_partialDirectory->setEnabled(checked); 0742 } 0743 0744 void Smb4KConfigPageSynchronization::slotFFilterRuleToggled(bool on) 0745 { 0746 if (on && m_useFFFilterRule->isChecked()) { 0747 m_useFFFilterRule->setChecked(false); 0748 } 0749 } 0750 0751 void Smb4KConfigPageSynchronization::slotFFFilterRuleToggled(bool on) 0752 { 0753 if (on && m_useFFilterRule->isChecked()) { 0754 m_useFFilterRule->setChecked(false); 0755 } 0756 }