summaryrefslogtreecommitdiffstats
path: root/tdeioslave/trash/ktrashpropsdlgplugin.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2019-04-14 15:07:33 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2019-04-14 15:07:33 +0900
commitc53dbf95cb42a7bb22e8690bf699fda32e657845 (patch)
tree896452138f10e9106e1533720efd0bb3923eb45c /tdeioslave/trash/ktrashpropsdlgplugin.cpp
parent691c9204a1a6dcbce52d41e62a988044e48270d4 (diff)
downloadtdebase-c53dbf95cb42a7bb22e8690bf699fda32e657845.tar.gz
tdebase-c53dbf95cb42a7bb22e8690bf699fda32e657845.zip
Improved code for trash bin management.
1. When size limit is used, a file bigger than the trash size can't be trashed anymore (a warning message is shown). 2. When size limit is used and warning policy selected, files can't be trashed anymore if the total size of the trash will exceed the set size (a warning message is shown). 3. When the trash size settings are modified, the content of the trash is adjusted based on the new settings. 4. Fixed load/saving of trash options when more than one trash folder exists. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'tdeioslave/trash/ktrashpropsdlgplugin.cpp')
-rw-r--r--tdeioslave/trash/ktrashpropsdlgplugin.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/tdeioslave/trash/ktrashpropsdlgplugin.cpp b/tdeioslave/trash/ktrashpropsdlgplugin.cpp
index 5147481bc..41c902b24 100644
--- a/tdeioslave/trash/ktrashpropsdlgplugin.cpp
+++ b/tdeioslave/trash/ktrashpropsdlgplugin.cpp
@@ -241,6 +241,13 @@ void KTrashPropsDlgPlugin::applyChanges()
}
writeConfig();
+
+ // Adjust trash size if necessary
+ TrashImpl::TrashDirMap trashDirs = mTrashImpl->trashDirectories();
+ for (TrashImpl::TrashDirMap::ConstIterator it = trashDirs.begin(); it != trashDirs.end(); ++it)
+ {
+ mTrashImpl->resizeTrash(it.key());
+ }
}
void KTrashPropsDlgPlugin::percentSizeChanged( double percent )
@@ -370,7 +377,7 @@ void KTrashPropsDlgPlugin::trashChanged( int value )
mUseTimeLimit->setChecked( entry.useTimeLimit );
mDays->setValue( entry.days );
mUseSizeLimit->setChecked( entry.useSizeLimit );
- if ( mSizeLimitType == SIZE_LIMIT_FIXED )
+ if ( entry.sizeLimitType == SIZE_LIMIT_FIXED )
{
mRbFixedSize->setChecked( true );
}
@@ -414,13 +421,13 @@ void KTrashPropsDlgPlugin::readConfig()
config.setGroup( groups[ i ] );
ConfigEntry entry;
entry.useTimeLimit = config.readBoolEntry( "UseTimeLimit", false );
- entry.days = config.readNumEntry( "Days", 7 );
+ entry.days = config.readNumEntry( "Days", 32000 );
entry.useSizeLimit = config.readBoolEntry( "UseSizeLimit", true );
entry.sizeLimitType = config.readNumEntry( "SizeLimitType", SIZE_LIMIT_PERCENT );
entry.percent = config.readDoubleNumEntry( "Percent", 10 );
entry.fixedSize = config.readDoubleNumEntry( "FixedSize", 500 );
entry.fixedSizeUnit = config.readNumEntry( "FixedSizeUnit", SIZE_ID_MB );
- entry.actionType = config.readNumEntry( "LimitReachedAction", 0 );
+ entry.actionType = config.readNumEntry( "LimitReachedAction", TrashConstant::ACTION_WARNING );
mConfigMap.insert( groups[ i ], entry );
}
}