diff --git a/src/ioslaves/trash/kcmtrash.cpp b/src/ioslaves/trash/kcmtrash.cpp --- a/src/ioslaves/trash/kcmtrash.cpp +++ b/src/ioslaves/trash/kcmtrash.cpp @@ -164,7 +164,8 @@ void TrashConfigModule::useTypeChanged() { mDays->setEnabled(mUseTimeLimit->isChecked()); - mSizeWidget->setEnabled(mUseSizeLimit->isChecked()); + mPercent->setEnabled(mUseSizeLimit->isChecked()); + mSizeLabel->setEnabled(mUseSizeLimit->isChecked()); } void TrashConfigModule::readConfig() @@ -252,10 +253,12 @@ mCurrentTrash = map.value(0); } + QFormLayout* formLayout = new QFormLayout(this); + layout->addLayout(formLayout); + QHBoxLayout *daysLayout = new QHBoxLayout(); - layout->addLayout(daysLayout); - mUseTimeLimit = new QCheckBox(i18n("Delete files older than:"), this); + mUseTimeLimit = new QCheckBox(this); mUseTimeLimit->setWhatsThis(xi18nc("@info:whatsthis", "Check this box to allow automatic deletion of files that are older than the value specified. " "Leave this disabled to not automatically delete any items after a certain timespan")); @@ -270,51 +273,41 @@ "Any files older than this will be automatically deleted.")); daysLayout->addWidget(mDays); daysLayout->addStretch(); + formLayout->addRow(i18n("Delete files after:"), daysLayout); - QFormLayout *sizeLayout = new QFormLayout(); - layout->addLayout(sizeLayout); - mUseSizeLimit = new QCheckBox(i18n("Limit to maximum size"), this); + QHBoxLayout *maximumSizeLayout = new QHBoxLayout(); + mUseSizeLimit = new QCheckBox(this); mUseSizeLimit->setWhatsThis(xi18nc("@info:whatsthis", "Check this box to limit the trash to the maximum amount of disk space that you specify below. " "Otherwise, it will be unlimited.")); - sizeLayout->addRow(mUseSizeLimit); - - mSizeWidget = new QWidget(this); - sizeLayout->addRow(mSizeWidget); + maximumSizeLayout->addWidget(mUseSizeLimit); + formLayout->addRow(i18n("Limit to maximum size:"), maximumSizeLayout); - QFormLayout *sizeWidgetLayout = new QFormLayout(mSizeWidget); - sizeWidgetLayout->setMargin(0); - QHBoxLayout *maximumSizeLayout = new QHBoxLayout(); - - mPercent = new QDoubleSpinBox(mSizeWidget); + mPercent = new QDoubleSpinBox(this); mPercent->setRange(0.001, 100); mPercent->setDecimals(3); mPercent->setSingleStep(1); mPercent->setSuffix(QStringLiteral(" %")); mPercent->setWhatsThis(xi18nc("@info:whatsthis", "This is the maximum percent of disk space that will be used for the trash.")); maximumSizeLayout->addWidget(mPercent); - mSizeLabel = new QLabel(mSizeWidget); + mSizeLabel = new QLabel(this); mSizeLabel->setWhatsThis(xi18nc("@info:whatsthis", "This is the calculated amount of disk space that will be allowed for the trash, the maximum.")); maximumSizeLayout->addWidget(mSizeLabel); - sizeWidgetLayout->addRow(i18n("Maximum size:"), maximumSizeLayout); - - QLabel *label = new QLabel(i18n("When limit reached:")); - sizeWidgetLayout->addRow(label); - mLimitReachedAction = new QComboBox(mSizeWidget); + mLimitReachedAction = new QComboBox(this); mLimitReachedAction->addItem(i18n("Warn Me")); mLimitReachedAction->addItem(i18n("Delete Oldest Files From Trash")); mLimitReachedAction->addItem(i18n("Delete Biggest Files From Trash")); mLimitReachedAction->setWhatsThis(xi18nc("@info:whatsthis", "When the size limit is reached, it will prefer to delete the type of files that you specify, first. " "If this is set to warn you, it will do so instead of automatically deleting files.")); - sizeWidgetLayout->addRow(nullptr, mLimitReachedAction); + formLayout->addRow(i18n("When limit reached:"), mLimitReachedAction); layout->addStretch(); }