Changeset View
Changeset View
Standalone View
Standalone View
src/ioslaves/trash/kcmtrash.cpp
Show First 20 Lines • Show All 158 Lines • ▼ Show 20 Line(s) | 130 | { | |||
---|---|---|---|---|---|
159 | 159 | | |||
160 | percentChanged(mPercent->value()); | 160 | percentChanged(mPercent->value()); | ||
161 | 161 | | |||
162 | } | 162 | } | ||
163 | 163 | | |||
164 | void TrashConfigModule::useTypeChanged() | 164 | void TrashConfigModule::useTypeChanged() | ||
165 | { | 165 | { | ||
166 | mDays->setEnabled(mUseTimeLimit->isChecked()); | 166 | mDays->setEnabled(mUseTimeLimit->isChecked()); | ||
167 | mSizeWidget->setEnabled(mUseSizeLimit->isChecked()); | 167 | mPercent->setEnabled(mUseSizeLimit->isChecked()); | ||
168 | mSizeLabel->setEnabled(mUseSizeLimit->isChecked()); | ||||
168 | } | 169 | } | ||
169 | 170 | | |||
170 | void TrashConfigModule::readConfig() | 171 | void TrashConfigModule::readConfig() | ||
171 | { | 172 | { | ||
172 | KConfig config(QStringLiteral("ktrashrc")); | 173 | KConfig config(QStringLiteral("ktrashrc")); | ||
173 | mConfigMap.clear(); | 174 | mConfigMap.clear(); | ||
174 | 175 | | |||
175 | const QStringList groups = config.groupList(); | 176 | const QStringList groups = config.groupList(); | ||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 232 | if (map.count() != 1) { | |||
247 | mountPoints->setCurrentRow(0); | 248 | mountPoints->setCurrentRow(0); | ||
248 | 249 | | |||
249 | connect(mountPoints, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), | 250 | connect(mountPoints, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), | ||
250 | this, SLOT(trashChanged(QListWidgetItem*))); | 251 | this, SLOT(trashChanged(QListWidgetItem*))); | ||
251 | } else { | 252 | } else { | ||
252 | mCurrentTrash = map.value(0); | 253 | mCurrentTrash = map.value(0); | ||
253 | } | 254 | } | ||
254 | 255 | | |||
256 | QFormLayout* formLayout = new QFormLayout(); | ||||
257 | layout->addLayout(formLayout); | ||||
258 | | ||||
255 | QHBoxLayout *daysLayout = new QHBoxLayout(); | 259 | QHBoxLayout *daysLayout = new QHBoxLayout(); | ||
256 | layout->addLayout(daysLayout); | | |||
257 | 260 | | |||
258 | mUseTimeLimit = new QCheckBox(i18n("Delete files older than:"), this); | 261 | mUseTimeLimit = new QCheckBox(i18n("Delete files older than"), this); | ||
259 | mUseTimeLimit->setWhatsThis(xi18nc("@info:whatsthis", | 262 | mUseTimeLimit->setWhatsThis(xi18nc("@info:whatsthis", | ||
260 | "<para>Check this box to allow <emphasis strong='true'>automatic deletion</emphasis> of files that are older than the value specified. " | 263 | "<para>Check this box to allow <emphasis strong='true'>automatic deletion</emphasis> of files that are older than the value specified. " | ||
261 | "Leave this disabled to <emphasis strong='true'>not</emphasis> automatically delete any items after a certain timespan</para>")); | 264 | "Leave this disabled to <emphasis strong='true'>not</emphasis> automatically delete any items after a certain timespan</para>")); | ||
262 | daysLayout->addWidget(mUseTimeLimit); | 265 | daysLayout->addWidget(mUseTimeLimit); | ||
263 | mDays = new QSpinBox(this); | 266 | mDays = new QSpinBox(this); | ||
264 | 267 | | |||
265 | mDays->setRange(1, 365); | 268 | mDays->setRange(1, 365); | ||
266 | mDays->setSingleStep(1); | 269 | mDays->setSingleStep(1); | ||
267 | mDays->setSuffix(i18np(" day", " days", mDays->value())); | 270 | mDays->setSuffix(i18np(" day", " days", mDays->value())); | ||
268 | mDays->setWhatsThis(xi18nc("@info:whatsthis", | 271 | mDays->setWhatsThis(xi18nc("@info:whatsthis", | ||
269 | "<para>Set the number of days that files can remain in the trash. " | 272 | "<para>Set the number of days that files can remain in the trash. " | ||
270 | "Any files older than this will be automatically deleted.</para>")); | 273 | "Any files older than this will be automatically deleted.</para>")); | ||
271 | daysLayout->addWidget(mDays); | 274 | daysLayout->addWidget(mDays); | ||
272 | daysLayout->addStretch(); | 275 | daysLayout->addStretch(); | ||
276 | formLayout->addRow(i18n("Cleanup:"), daysLayout); | ||||
273 | 277 | | |||
274 | QFormLayout *sizeLayout = new QFormLayout(); | | |||
275 | layout->addLayout(sizeLayout); | | |||
276 | 278 | | |||
277 | mUseSizeLimit = new QCheckBox(i18n("Limit to maximum size"), this); | 279 | QHBoxLayout *maximumSizeLayout = new QHBoxLayout(); | ||
280 | mUseSizeLimit = new QCheckBox(i18n("Limit to"), this); | ||||
278 | mUseSizeLimit->setWhatsThis(xi18nc("@info:whatsthis", | 281 | mUseSizeLimit->setWhatsThis(xi18nc("@info:whatsthis", | ||
279 | "<para>Check this box to limit the trash to the maximum amount of disk space that you specify below. " | 282 | "<para>Check this box to limit the trash to the maximum amount of disk space that you specify below. " | ||
280 | "Otherwise, it will be unlimited.</para>")); | 283 | "Otherwise, it will be unlimited.</para>")); | ||
281 | sizeLayout->addRow(mUseSizeLimit); | 284 | maximumSizeLayout->addWidget(mUseSizeLimit); | ||
282 | 285 | formLayout->addRow(i18n("Size:"), maximumSizeLayout); | |||
283 | mSizeWidget = new QWidget(this); | | |||
284 | sizeLayout->addRow(mSizeWidget); | | |||
285 | 286 | | |||
286 | QFormLayout *sizeWidgetLayout = new QFormLayout(mSizeWidget); | | |||
287 | sizeWidgetLayout->setMargin(0); | | |||
288 | 287 | | |||
289 | QHBoxLayout *maximumSizeLayout = new QHBoxLayout(); | 288 | mPercent = new QDoubleSpinBox(this); | ||
290 | | ||||
291 | mPercent = new QDoubleSpinBox(mSizeWidget); | | |||
292 | mPercent->setRange(0.001, 100); | 289 | mPercent->setRange(0.001, 100); | ||
293 | mPercent->setDecimals(3); | 290 | mPercent->setDecimals(3); | ||
294 | mPercent->setSingleStep(1); | 291 | mPercent->setSingleStep(1); | ||
295 | mPercent->setSuffix(QStringLiteral(" %")); | 292 | mPercent->setSuffix(QStringLiteral(" %")); | ||
296 | mPercent->setWhatsThis(xi18nc("@info:whatsthis", | 293 | mPercent->setWhatsThis(xi18nc("@info:whatsthis", | ||
297 | "<para>This is the maximum percent of disk space that will be used for the trash.</para>")); | 294 | "<para>This is the maximum percent of disk space that will be used for the trash.</para>")); | ||
298 | maximumSizeLayout->addWidget(mPercent); | 295 | maximumSizeLayout->addWidget(mPercent); | ||
299 | 296 | | |||
300 | mSizeLabel = new QLabel(mSizeWidget); | 297 | mSizeLabel = new QLabel(this); | ||
301 | mSizeLabel->setWhatsThis(xi18nc("@info:whatsthis", | 298 | mSizeLabel->setWhatsThis(xi18nc("@info:whatsthis", | ||
302 | "<para>This is the calculated amount of disk space that will be allowed for the trash, the maximum.</para>")); | 299 | "<para>This is the calculated amount of disk space that will be allowed for the trash, the maximum.</para>")); | ||
303 | maximumSizeLayout->addWidget(mSizeLabel); | 300 | maximumSizeLayout->addWidget(mSizeLabel); | ||
304 | 301 | | |||
305 | sizeWidgetLayout->addRow(i18n("Maximum size:"), maximumSizeLayout); | | |||
306 | | ||||
307 | QLabel *label = new QLabel(i18n("When limit reached:")); | | |||
308 | sizeWidgetLayout->addRow(label); | | |||
309 | 302 | | |||
310 | mLimitReachedAction = new QComboBox(mSizeWidget); | 303 | mLimitReachedAction = new QComboBox(); | ||
311 | mLimitReachedAction->addItem(i18n("Warn Me")); | 304 | mLimitReachedAction->addItem(i18n("Show a Warning")); | ||
davidedmundson: There's no benefit in changing the initial parent of these.
It's all moot as QFormLayout… | |||||
Ah right, I think I wrote this before I found that out. In fact, you can omit the parent entirely, so I think I'll do that. ngraham: Ah right, I think I wrote this before I found that out. In fact, you can omit the parent… | |||||
312 | mLimitReachedAction->addItem(i18n("Delete Oldest Files From Trash")); | 305 | mLimitReachedAction->addItem(i18n("Delete Oldest Files From Trash")); | ||
313 | mLimitReachedAction->addItem(i18n("Delete Biggest Files From Trash")); | 306 | mLimitReachedAction->addItem(i18n("Delete Biggest Files From Trash")); | ||
314 | mLimitReachedAction->setWhatsThis(xi18nc("@info:whatsthis", | 307 | mLimitReachedAction->setWhatsThis(xi18nc("@info:whatsthis", | ||
315 | "<para>When the size limit is reached, it will prefer to delete the type of files that you specify, first. " | 308 | "<para>When the size limit is reached, it will prefer to delete the type of files that you specify, first. " | ||
316 | "If this is set to warn you, it will do so instead of automatically deleting files.</para>")); | 309 | "If this is set to warn you, it will do so instead of automatically deleting files.</para>")); | ||
317 | sizeWidgetLayout->addRow(nullptr, mLimitReachedAction); | 310 | formLayout->addRow(i18n("Full Trash:"), mLimitReachedAction); | ||
318 | 311 | | |||
319 | layout->addStretch(); | 312 | layout->addStretch(); | ||
320 | } | 313 | } | ||
321 | 314 | | |||
322 | #include "kcmtrash.moc" | 315 | #include "kcmtrash.moc" |
There's no benefit in changing the initial parent of these.
It's all moot as QFormLayout::addItem takes ownership