summaryrefslogtreecommitdiffstats
path: root/tdeioslave/trash
diff options
context:
space:
mode:
Diffstat (limited to 'tdeioslave/trash')
-rw-r--r--tdeioslave/trash/CMakeLists.txt19
-rw-r--r--tdeioslave/trash/Makefile.am13
-rw-r--r--tdeioslave/trash/discspaceutil.cpp112
-rw-r--r--tdeioslave/trash/discspaceutil.h81
-rw-r--r--tdeioslave/trash/ktrash.cpp2
-rw-r--r--tdeioslave/trash/ktrashpropsdlgplugin.cpp449
-rw-r--r--tdeioslave/trash/ktrashpropsdlgplugin.desktop7
-rw-r--r--tdeioslave/trash/ktrashpropsdlgplugin.h90
-rw-r--r--tdeioslave/trash/tdefile-plugin/tdefile_trash.cpp7
-rw-r--r--tdeioslave/trash/tdefile-plugin/tdefile_trash.h2
-rw-r--r--tdeioslave/trash/tdeio_trash.cpp2
-rw-r--r--tdeioslave/trash/tdeio_trash.h3
-rw-r--r--tdeioslave/trash/testtrash.cpp4
-rw-r--r--tdeioslave/trash/testtrash.h2
-rw-r--r--tdeioslave/trash/trash.protocol2
-rw-r--r--tdeioslave/trash/trash_constant.h41
-rw-r--r--tdeioslave/trash/trashimpl.cpp102
-rw-r--r--tdeioslave/trash/trashimpl.h7
18 files changed, 920 insertions, 25 deletions
diff --git a/tdeioslave/trash/CMakeLists.txt b/tdeioslave/trash/CMakeLists.txt
index 1569d07ca..1082b57af 100644
--- a/tdeioslave/trash/CMakeLists.txt
+++ b/tdeioslave/trash/CMakeLists.txt
@@ -25,7 +25,7 @@ link_directories(
##### other data ################################
-install( FILES trash.protocol DESTINATION ${SERVICES_INSTALL_DIR} )
+install( FILES ktrashpropsdlgplugin.desktop trash.protocol DESTINATION ${SERVICES_INSTALL_DIR} )
##### trashcommon (static) ######################
@@ -33,7 +33,7 @@ install( FILES trash.protocol DESTINATION ${SERVICES_INSTALL_DIR} )
set( target trashcommon )
tde_add_library( ${target} STATIC_PIC AUTOMOC
- SOURCES trashimpl.cpp
+ SOURCES trashimpl.cpp discspaceutil.cpp
)
@@ -47,6 +47,15 @@ tde_add_kpart( ${target} AUTOMOC
DESTINATION ${PLUGIN_INSTALL_DIR}
)
+##### ktrashpropsdlgplugin (module) ########################
+
+set( target ktrashpropsdlgplugin )
+
+tde_add_kpart( ${target} AUTOMOC
+ SOURCES ktrashpropsdlgplugin.cpp
+ LINK trashcommon-static tdeio-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}
+)
##### ktrash (executable) #######################
@@ -57,3 +66,9 @@ tde_add_executable( ${target}
LINK tdeio-shared
DESTINATION ${BIN_INSTALL_DIR}
)
+
+##### testtrash (executable) #######################
+tde_add_executable( testtrash
+ SOURCES testtrash.cpp AUTOMOC
+ LINK trashcommon-static tdeio-shared
+)
diff --git a/tdeioslave/trash/Makefile.am b/tdeioslave/trash/Makefile.am
index 02b43e90a..ee27b3d2a 100644
--- a/tdeioslave/trash/Makefile.am
+++ b/tdeioslave/trash/Makefile.am
@@ -3,7 +3,7 @@ METASOURCES = AUTO
SUBDIRS = . tdefile-plugin
-kde_module_LTLIBRARIES = tdeio_trash.la
+kde_module_LTLIBRARIES = tdeio_trash.la ktrashpropsdlgplugin.la
tdeio_trash_la_SOURCES = tdeio_trash.cpp
tdeio_trash_la_LIBADD = libtrashcommon.la $(LIB_TDEIO)
@@ -17,7 +17,7 @@ ktrash_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $
kde_services_DATA = trash.protocol
noinst_LTLIBRARIES = libtrashcommon.la
-libtrashcommon_la_SOURCES = trashimpl.cpp
+libtrashcommon_la_SOURCES = trashimpl.cpp discspaceutil.cpp
check_PROGRAMS = testtrash
testtrash_SOURCES = testtrash.cpp
@@ -29,3 +29,12 @@ TESTS = testtrash
messages:
$(XGETTEXT) `find . -name "*.cc" -o -name "*.cpp" -o -name "*.h"` -o $(podir)/tdeio_trash.pot
+# ktrashpropsdlgplugin target
+noinst_HEADERS = ktrashpropsdlgplugin.h discspaceutil.h trash_constant.h
+
+ktrashpropsdlgplugin_la_SOURCES = ktrashpropsdlgplugin.cpp discspaceutil.cpp trashimpl.cpp
+ktrashpropsdlgplugin_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+ktrashpropsdlgplugin_la_LIBADD = $(LIB_TDEIO)
+
+services_DATA = ktrashpropsdlgplugin.desktop
+servicesdir = $(kde_servicesdir)
diff --git a/tdeioslave/trash/discspaceutil.cpp b/tdeioslave/trash/discspaceutil.cpp
new file mode 100644
index 000000000..186cb0e7f
--- /dev/null
+++ b/tdeioslave/trash/discspaceutil.cpp
@@ -0,0 +1,112 @@
+/*
+ This file is part of the TDE project
+
+ Copyright (C) 2008 Tobias Koenig <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <tqapplication.h>
+#include <tqdir.h>
+#include <tqeventloop.h>
+#include <tqfileinfo.h>
+
+#include <kdiskfreesp.h>
+#include <kdebug.h>
+
+#include "discspaceutil.h"
+
+DiscSpaceUtil::DiscSpaceUtil( const TQString &directory, TQObject *parent )
+ : TQObject( parent ),
+ mDirectory( directory ),
+ mFullSize( 0 )
+{
+ calculateFullSize();
+}
+
+unsigned long DiscSpaceUtil::sizeOfPath( const TQString &path )
+{
+ TQFileInfo info( path );
+ if ( !info.exists() ) {
+ return 0;
+ }
+
+ if ( info.isFile() ) {
+ return info.size();
+ } else if ( info.isDir() ) {
+ TQDir dir( path );
+ const TQFileInfoList *infos = dir.entryInfoList( TQDir::Files | TQDir::Dirs | TQDir::NoSymLinks );
+ TQFileInfoListIterator it( *infos );
+
+ unsigned long sum = 0;
+ TQFileInfo *info = 0;
+ while ( (info = it.current()) != 0 ) {
+ if ( info->fileName() != "." && info->fileName() != ".." )
+ sum += sizeOfPath( info->absFilePath() );
+ ++it;
+ }
+
+ return sum;
+ } else {
+ return 0;
+ }
+}
+
+double DiscSpaceUtil::usage( unsigned long additional ) const
+{
+ if ( mFullSize == 0 )
+ return 0;
+
+ unsigned long sum = sizeOfPath( mDirectory );
+ sum += additional;
+
+ sum = sum/1024; // convert to kB
+
+ return (((double)sum*100)/(double)mFullSize);
+}
+
+unsigned long DiscSpaceUtil::size() const
+{
+ return mFullSize;
+}
+
+TQString DiscSpaceUtil::mountPoint() const
+{
+ return mMountPoint;
+}
+
+void DiscSpaceUtil::foundMountPoint( const TQString &mountPoint, unsigned long kbSize, unsigned long, unsigned long )
+{
+ mFullSize = kbSize;
+ mMountPoint = mountPoint;
+}
+
+void DiscSpaceUtil::done()
+{
+ tqApp->eventLoop()->exitLoop();
+}
+
+void DiscSpaceUtil::calculateFullSize()
+{
+ KDiskFreeSp *sp = KDiskFreeSp::findUsageInfo( mDirectory );
+ connect( sp, TQT_SIGNAL( foundMountPoint( const TQString&, unsigned long, unsigned long, unsigned long ) ),
+ this, TQT_SLOT( foundMountPoint( const TQString&, unsigned long, unsigned long, unsigned long ) ) );
+ connect( sp, TQT_SIGNAL( done() ), this, TQT_SLOT( done() ) );
+
+ tqApp->eventLoop()->enterLoop();
+}
+
+#include "discspaceutil.moc"
diff --git a/tdeioslave/trash/discspaceutil.h b/tdeioslave/trash/discspaceutil.h
new file mode 100644
index 000000000..a00141296
--- /dev/null
+++ b/tdeioslave/trash/discspaceutil.h
@@ -0,0 +1,81 @@
+/*
+ This file is part of the TDE project
+
+ Copyright (C) 2008 Tobias Koenig <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef DISCSPACEUTIL_H
+#define DISCSPACEUTIL_H
+
+#include <tqobject.h>
+#include <tqstring.h>
+
+/**
+ * A small utility class to access and calculate
+ * size and usage of mount points.
+ */
+class DiscSpaceUtil : public TQObject
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * Creates a new disc space util.
+ *
+ * @param directory A directory the util shall work on.
+ * @param parent The parent object.
+ */
+ explicit DiscSpaceUtil( const TQString &directory, TQObject *parent = 0 );
+
+ /**
+ * Returns the usage of the directory pass in the constructor on this
+ * mount point in percent.
+ *
+ * @param additional An additional amount of bytes that is added to the
+ * directory size before the usage is calculated.
+ */
+ double usage( unsigned long additional = 0 ) const;
+
+ /**
+ * Returns the size of the partition in kilo bytes.
+ */
+ unsigned long size() const;
+
+ /**
+ * Returns the mount point of the directory.
+ */
+ TQString mountPoint() const;
+
+ /**
+ * Returns the size of the given path in bytes.
+ */
+ static unsigned long sizeOfPath( const TQString &path );
+
+ private slots:
+ void foundMountPoint( const TQString&, unsigned long, unsigned long, unsigned long );
+ void done();
+
+ private:
+ void calculateFullSize();
+
+ TQString mDirectory;
+ unsigned long mFullSize;
+ TQString mMountPoint;
+};
+
+#endif
diff --git a/tdeioslave/trash/ktrash.cpp b/tdeioslave/trash/ktrash.cpp
index 162d27876..4450156f8 100644
--- a/tdeioslave/trash/ktrash.cpp
+++ b/tdeioslave/trash/ktrash.cpp
@@ -1,4 +1,4 @@
-/* This file is part of the KDE project
+/* This file is part of the TDE project
Copyright (C) 2004 David Faure <[email protected]>
This library is free software; you can redistribute it and/or
diff --git a/tdeioslave/trash/ktrashpropsdlgplugin.cpp b/tdeioslave/trash/ktrashpropsdlgplugin.cpp
new file mode 100644
index 000000000..87a70ae45
--- /dev/null
+++ b/tdeioslave/trash/ktrashpropsdlgplugin.cpp
@@ -0,0 +1,449 @@
+/*
+ This file is part of the TDE project
+
+ Copyright (C) 2008 Tobias Koenig <[email protected]>
+ Copyright (C) 2016 Emanoil Kotsev <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "ktrashpropsdlgplugin.h"
+#include "discspaceutil.h"
+#include "trash_constant.h"
+#include "trashimpl.h"
+
+#include <tqbuttongroup.h>
+#include <tqcheckbox.h>
+#include <tqcombobox.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqlistbox.h>
+#include <tqradiobutton.h>
+#include <tqspinbox.h>
+
+#include <kdesktopfile.h>
+#include <kgenericfactory.h>
+#include <tdeglobal.h>
+#include <kiconloader.h>
+#include <tdelocale.h>
+#include <knuminput.h>
+
+#include <kdebug.h>
+
+using namespace TrashConstant;
+
+typedef KGenericFactory<KTrashPropsDlgPlugin, KPropertiesDialog> Factory;
+K_EXPORT_COMPONENT_FACTORY( ktrashpropsdlgplugin, Factory( "ktrashpropsdlgplugin" ) )
+
+KTrashPropsDlgPlugin::KTrashPropsDlgPlugin( KPropertiesDialog *dialog, const char*, const TQStringList& )
+ : KPropsDlgPlugin( dialog )
+{
+ if ( dialog->items().count() != 1 )
+ return;
+
+ KFileItem *item = dialog->items().first();
+
+ if ( !KPropsDlgPlugin::isDesktopFile( item ) )
+ return;
+
+ KDesktopFile deskFile( item->url().path(), true /* readonly */ );
+
+ if ( deskFile.readURL() != "trash:/" )
+ return;
+
+ TDEGlobal::locale()->insertCatalogue( "tdeio_trash" );
+
+ mTrashImpl = new TrashImpl();
+ mTrashImpl->init();
+
+ readConfig();
+
+ TQFrame *frame = dialog->addPage( i18n( "Size Limits" ) );
+ setupGui( frame );
+
+ mUseTimeLimit->setChecked( mConfigMap[ mCurrentTrash ].useTimeLimit );
+ mUseSizeLimit->setChecked( mConfigMap[ mCurrentTrash ].useSizeLimit );
+ mSizeLimitType = mConfigMap[ mCurrentTrash ].sizeLimitType;
+ if ( mSizeLimitType == SIZE_LIMIT_FIXED )
+ {
+ mRbFixedSize->setChecked( true );
+ }
+ else
+ {
+ mRbPercentSize->setChecked( true );
+ }
+
+ mDays->setValue( mConfigMap[ mCurrentTrash ].days );
+ mPercentSize->setValue( mConfigMap[ mCurrentTrash ].percent );
+ mFixedSize->setValue( mConfigMap[ mCurrentTrash ].fixedSize );
+ mFixedSizeUnit->setCurrentItem( mConfigMap[ mCurrentTrash ].fixedSizeUnit );
+ mLimitReachedAction->setCurrentItem( mConfigMap[ mCurrentTrash ].actionType );
+ percentSizeChanged(mPercentSize->value());
+ fixedSizeChanged(mFixedSize->value());
+
+ useTypeChanged();
+
+ connect( mUseTimeLimit, TQT_SIGNAL( toggled( bool ) ),
+ this, TQT_SLOT( setDirty() ) );
+ connect( mUseTimeLimit, TQT_SIGNAL( toggled( bool ) ),
+ this, TQT_SLOT( useTypeChanged() ) );
+ connect( mDays, TQT_SIGNAL( valueChanged( int ) ),
+ this, TQT_SLOT( setDirty() ) );
+ connect( mUseSizeLimit, TQT_SIGNAL( toggled( bool ) ),
+ this, TQT_SLOT( setDirty() ) );
+ connect( mUseSizeLimit, TQT_SIGNAL( toggled( bool ) ),
+ this, TQT_SLOT( useTypeChanged() ) );
+ connect( mPercentSize, TQT_SIGNAL( valueChanged( double ) ),
+ this, TQT_SLOT( percentSizeChanged( double ) ) );
+ connect( mFixedSize, TQT_SIGNAL( valueChanged( double ) ),
+ this, TQT_SLOT( fixedSizeChanged( double ) ) );
+ connect( mPercentSize, TQT_SIGNAL( valueChanged( double ) ),
+ this, TQT_SLOT( setDirty() ) );
+ connect( mFixedSize, TQT_SIGNAL( valueChanged( double ) ),
+ this, TQT_SLOT( setDirty() ) );
+ connect( mFixedSizeUnit, TQT_SIGNAL( activated( int ) ),
+ this, TQT_SLOT( fixedSizeUnitActivated( int ) ) );
+ connect( mRbPercentSize, TQT_SIGNAL( toggled( bool ) ),
+ this, TQT_SLOT( rbPercentSizeToggled( bool ) ) );
+ connect( mRbPercentSize, TQT_SIGNAL( toggled( bool ) ),
+ this, TQT_SLOT( setDirty() ) );
+ connect( mRbFixedSize, TQT_SIGNAL( toggled( bool ) ),
+ this, TQT_SLOT( rbFixedSizeToggled( bool ) ) );
+ connect( mRbFixedSize, TQT_SIGNAL( toggled( bool ) ),
+ this, TQT_SLOT( setDirty() ) );
+ connect( mLimitReachedAction, TQT_SIGNAL( activated( int ) ),
+ this, TQT_SLOT( setDirty() ) );
+
+ trashChanged( 0 );
+}
+
+KTrashPropsDlgPlugin::~KTrashPropsDlgPlugin()
+{
+}
+
+void KTrashPropsDlgPlugin::setupGui( TQFrame *frame )
+{
+ TQVBoxLayout *layout = new TQVBoxLayout( frame, 11, 6 );
+
+ TrashImpl::TrashDirMap map = mTrashImpl->trashDirectories();
+ if ( map.count() != 1 ) {
+ // If we have multiple trashes, we setup a widget to choose
+ // which trash to configure
+ TQListBox *mountPoints = new TQListBox( frame );
+ layout->addWidget( mountPoints );
+
+ const TQPixmap folderPixmap = TDEGlobal::iconLoader()->loadIcon( "folder", TDEIcon::Small );
+ TQMapConstIterator<int, TQString> it;
+ for ( it = map.begin(); it != map.end(); ++it ) {
+ DiscSpaceUtil util( it.data() );
+ mountPoints->insertItem( folderPixmap, util.mountPoint(), it.key() );
+ }
+
+ mountPoints->setCurrentItem( 0 );
+
+ connect( mountPoints, TQT_SIGNAL( highlighted( int ) ), TQT_SLOT( trashChanged( int ) ) );
+ } else {
+ mCurrentTrash = map[0];
+ }
+
+ TQHBoxLayout *daysLayout = new TQHBoxLayout( layout );
+
+ mUseTimeLimit = new TQCheckBox( i18n( "Delete files older than:" ), frame );
+ daysLayout->addWidget( mUseTimeLimit );
+ mDays = new TQSpinBox( 1, 365, 1, frame );
+ mDays->setSuffix( " days" );
+ daysLayout->addWidget( mDays );
+
+ TQGridLayout *sizeLayout = new TQGridLayout( layout, 2, 2 );
+ mUseSizeLimit = new TQCheckBox( i18n( "Limit to maximum size" ), frame );
+ sizeLayout->addMultiCellWidget( mUseSizeLimit, 0, 0, 0, 1 );
+
+ mSizeWidget = new TQWidget( frame );
+ sizeLayout->setColSpacing( 0, 30 );
+ sizeLayout->addWidget( mSizeWidget, 1, 1 );
+
+ TQGridLayout *sizeWidgetLayout = new TQGridLayout( mSizeWidget, 3, 3, 11, 6 );
+
+ mRbPercentSize = new TQRadioButton( i18n("&Percentage:"), mSizeWidget );
+ mRbFixedSize = new TQRadioButton( i18n("&Fixed size:"), mSizeWidget );
+ sizeWidgetLayout->addWidget( mRbPercentSize, 0, 0 );
+ sizeWidgetLayout->addWidget( mRbFixedSize, 1, 0 );
+
+ mPercentSize = new KDoubleSpinBox( 0, 100, 0.1, 10, 2, mSizeWidget );
+ mPercentSize->setSuffix( " %" );
+ sizeWidgetLayout->addWidget( mPercentSize, 0, 1 );
+ mSizeLabel = new TQLabel( mSizeWidget );
+ sizeWidgetLayout->addWidget( mSizeLabel, 0, 2 );
+
+ mFixedSize = new KDoubleSpinBox( 0, 1024*1024, 1, 500, 2, mSizeWidget );
+ sizeWidgetLayout->addWidget( mFixedSize, 1, 1 );
+ mFixedSizeUnit = new TQComboBox( mSizeWidget );
+ mFixedSizeUnit->setEditable( false );
+ mFixedSizeUnit->insertItem( i18n( "Bytes" ), SIZE_ID_B );
+ mFixedSizeUnit->insertItem( i18n( "KBytes" ), SIZE_ID_KB );
+ mFixedSizeUnit->insertItem( i18n( "MBytes" ), SIZE_ID_MB );
+ mFixedSizeUnit->insertItem( i18n( "GBytes" ), SIZE_ID_GB );
+ mFixedSizeUnit->insertItem( i18n( "TBytes" ), SIZE_ID_TB );
+ mFixedSizeUnit->setCurrentItem( 2 );
+ sizeWidgetLayout->addWidget( mFixedSizeUnit, 1, 2 );
+
+ TQLabel *label = new TQLabel( i18n( "When limit reached:" ), mSizeWidget );
+ sizeWidgetLayout->addWidget( label, 2, 0 );
+
+ mLimitReachedAction = new TQComboBox( mSizeWidget );
+ mLimitReachedAction->insertItem( i18n( "Warn me" ) );
+ mLimitReachedAction->insertItem( i18n( "Delete oldest files from trash" ) );
+ mLimitReachedAction->insertItem( i18n( "Delete biggest files from trash" ) );
+ sizeWidgetLayout->addMultiCellWidget( mLimitReachedAction, 2, 2, 1, 2 );
+
+ layout->addStretch();
+}
+
+void KTrashPropsDlgPlugin::applyChanges()
+{
+ if ( !mCurrentTrash.isEmpty() ) {
+ ConfigEntry entry;
+ entry.useTimeLimit = mUseTimeLimit->isChecked();
+ entry.days = mDays->value();
+ entry.useSizeLimit = mUseSizeLimit->isChecked();
+ if (mRbFixedSize->isChecked())
+ {
+ entry.sizeLimitType = SIZE_LIMIT_FIXED;
+ }
+ else
+ {
+ entry.sizeLimitType = SIZE_LIMIT_PERCENT;
+ }
+ entry.percent = mPercentSize->value();
+ entry.fixedSize = mFixedSize->value();
+ entry.fixedSizeUnit = mFixedSizeUnit->currentItem();
+ entry.actionType = mLimitReachedAction->currentItem();
+ mConfigMap.insert( mCurrentTrash, entry );
+ }
+
+ writeConfig();
+}
+
+void KTrashPropsDlgPlugin::percentSizeChanged( double percent )
+{
+ DiscSpaceUtil util( mCurrentTrash );
+ double partitionSize = util.size() * 1024.0; // convert to byte
+ double size = partitionSize*(percent/100.0);
+
+ TQString unit = i18n( "Bytes" );
+ if ( size >= 1024 ) {
+ unit = i18n( "KBytes" );
+ size = size/1024.0;
+ }
+ if ( size >= 1024 ) {
+ unit = i18n( "MBytes" );
+ size = size/1024.0;
+ }
+ if ( size >= 1024 ) {
+ unit = i18n( "GBytes" );
+ size = size/1024.0;
+ }
+ if ( size >= 1024 ) {
+ unit = i18n( "TBytes" );
+ size = size/1024.0;
+ }
+
+ mSizeLabel->setText( i18n( "(%1 %2)" ).arg( TQString::number( size, 'f', 2 ) ).arg( unit ) );
+}
+
+void KTrashPropsDlgPlugin::fixedSizeChanged( double value )
+{
+ int currItem = mFixedSizeUnit->currentItem();
+ if (value > 1023.999 && currItem >= SIZE_ID_TB)
+ {
+ // Max limit 1024 TBytes
+ mFixedSizeUnit->setCurrentItem(SIZE_ID_TB);
+ mFixedSize->setValue(1024.0);
+ }
+ else if (value > 1023.999 && currItem < SIZE_ID_TB)
+ {
+ // Scale up to higher measure unit
+ while (value > 1023.999 && currItem < SIZE_ID_TB)
+ {
+ ++currItem;
+ value /= 1024.0;
+ }
+ mFixedSizeUnit->setCurrentItem(currItem);
+ mFixedSize->setValue(value);
+ }
+ else if (value < 0.001)
+ {
+ // Scale down to lower measure unit
+ int currItem = mFixedSizeUnit->currentItem();
+ if (currItem > SIZE_ID_B)
+ {
+ mFixedSizeUnit->setCurrentItem(currItem - 1);
+ mFixedSize->setValue(1023.0);
+ }
+ }
+ // Need to call this manually because "activated" is not emitted by "mFixedSizeUnit"
+ // when the index is changed programmatically (see TQComboBox API docs)
+ fixedSizeUnitActivated(mFixedSizeUnit->currentItem());
+}
+
+void KTrashPropsDlgPlugin::fixedSizeUnitActivated(int index)
+{
+ // Bytes can not be split into fractions
+ if (index == SIZE_ID_B)
+ {
+ mFixedSize->setPrecision(0);
+ }
+ else
+ {
+ mFixedSize->setPrecision(2);
+ }
+}
+
+void KTrashPropsDlgPlugin::rbPercentSizeToggled( bool buttonOn)
+{
+ if (buttonOn)
+ {
+ mRbFixedSize->setChecked(false);
+ mSizeLimitType = SIZE_LIMIT_PERCENT;
+ }
+ else if (!mRbFixedSize->isChecked())
+ {
+ // Set the button back on if the user clicked it twice
+ mRbPercentSize->setChecked(true);
+ }
+}
+
+void KTrashPropsDlgPlugin::rbFixedSizeToggled( bool buttonOn)
+{
+ if (buttonOn)
+ {
+ mRbPercentSize->setChecked(false);
+ mSizeLimitType = SIZE_LIMIT_FIXED;
+ }
+ else if (!mRbPercentSize->isChecked())
+ {
+ // Set the button back on if the user clicked it twice
+ mRbFixedSize->setChecked(true);
+ }
+}
+
+void KTrashPropsDlgPlugin::trashChanged( int value )
+{
+ const TrashImpl::TrashDirMap map = mTrashImpl->trashDirectories();
+
+ if ( !mCurrentTrash.isEmpty() ) {
+ ConfigEntry entry;
+ entry.useTimeLimit = mUseTimeLimit->isChecked();
+ entry.days = mDays->value();
+ entry.useSizeLimit = mUseSizeLimit->isChecked();
+ entry.sizeLimitType = mSizeLimitType;
+ entry.percent = mPercentSize->value(),
+ entry.fixedSize = mFixedSize->value();
+ entry.fixedSizeUnit = mFixedSizeUnit->currentItem();
+ entry.actionType = mLimitReachedAction->currentItem();
+ mConfigMap.insert( mCurrentTrash, entry );
+ }
+
+ mCurrentTrash = map[ value ];
+
+ if ( mConfigMap.contains( mCurrentTrash ) ) {
+ const ConfigEntry entry = mConfigMap[ mCurrentTrash ];
+ mUseTimeLimit->setChecked( entry.useTimeLimit );
+ mDays->setValue( entry.days );
+ mUseSizeLimit->setChecked( entry.useSizeLimit );
+ if ( mSizeLimitType == SIZE_LIMIT_FIXED )
+ {
+ mRbFixedSize->setChecked( true );
+ }
+ else
+ {
+ mRbPercentSize->setChecked( true );
+ }
+ mPercentSize->setValue( entry.percent );
+ mFixedSize->setValue( entry.fixedSize );
+ mFixedSizeUnit->setCurrentItem( entry.fixedSizeUnit );
+ mLimitReachedAction->setCurrentItem( entry.actionType );
+ } else {
+ mUseTimeLimit->setChecked( false );
+ mDays->setValue( 7 );
+ mUseSizeLimit->setChecked( true );
+ mRbPercentSize->setChecked( true );
+ mPercentSize->setValue( 10.0 );
+ mFixedSize->setValue( 500 );
+ mFixedSizeUnit->setCurrentItem( SIZE_ID_MB );
+ mLimitReachedAction->setCurrentItem( 0 );
+ }
+
+ percentSizeChanged( mPercentSize->value() );
+ fixedSizeChanged( mFixedSize->value() );
+}
+
+void KTrashPropsDlgPlugin::useTypeChanged()
+{
+ mDays->setEnabled( mUseTimeLimit->isChecked() );
+ mSizeWidget->setEnabled( mUseSizeLimit->isChecked() );
+}
+
+void KTrashPropsDlgPlugin::readConfig()
+{
+ TDEConfig config( "trashrc" );
+ mConfigMap.clear();
+
+ const TQStringList groups = config.groupList();
+ for ( uint i = 0; i < groups.count(); ++i ) {
+ if ( groups[ i ].startsWith( "/" ) ) {
+ config.setGroup( groups[ i ] );
+ ConfigEntry entry;
+ entry.useTimeLimit = config.readBoolEntry( "UseTimeLimit", false );
+ entry.days = config.readNumEntry( "Days", 7 );
+ 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 );
+ mConfigMap.insert( groups[ i ], entry );
+ }
+ }
+}
+
+void KTrashPropsDlgPlugin::writeConfig()
+{
+ TDEConfig config( "trashrc" );
+
+ // first delete all existing groups
+ const TQStringList groups = config.groupList();
+ for ( uint i = 0; i < groups.count(); ++i )
+ if ( groups[ i ].startsWith( "/" ) )
+ config.deleteGroup( groups[ i ] );
+
+ TQMapConstIterator<TQString, ConfigEntry> it;
+ for ( it = mConfigMap.begin(); it != mConfigMap.end(); ++it ) {
+ config.setGroup( it.key() );
+ config.writeEntry( "UseTimeLimit", it.data().useTimeLimit );
+ config.writeEntry( "Days", it.data().days );
+ config.writeEntry( "UseSizeLimit", it.data().useSizeLimit );
+ config.writeEntry( "SizeLimitType", it.data().sizeLimitType );
+ config.writeEntry( "Percent", it.data().percent );
+ config.writeEntry( "FixedSize", it.data().fixedSize );
+ config.writeEntry( "FixedSizeUnit", it.data().fixedSizeUnit );
+ config.writeEntry( "LimitReachedAction", it.data().actionType );
+ }
+
+ config.sync();
+}
+
+#include "ktrashpropsdlgplugin.moc"
diff --git a/tdeioslave/trash/ktrashpropsdlgplugin.desktop b/tdeioslave/trash/ktrashpropsdlgplugin.desktop
new file mode 100644
index 000000000..39782d602
--- /dev/null
+++ b/tdeioslave/trash/ktrashpropsdlgplugin.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Service
+Name=Trash Properties Page
+Name[bg]=Свойства на кошчето
+Name[it]=Proprietà del cestino
+X-TDE-Library=ktrashpropsdlgplugin
+X-TDE-ServiceTypes=KPropsDlg/Plugin,media/builtin-trash
diff --git a/tdeioslave/trash/ktrashpropsdlgplugin.h b/tdeioslave/trash/ktrashpropsdlgplugin.h
new file mode 100644
index 000000000..d21dd4578
--- /dev/null
+++ b/tdeioslave/trash/ktrashpropsdlgplugin.h
@@ -0,0 +1,90 @@
+/*
+ This file is part of the TDE project
+
+ Copyright (C) 2008 Tobias Koenig <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KTRASHPROPSDLGPLUGIN_H
+#define KTRASHPROPSDLGPLUGIN_H
+
+#include "kpropertiesdialog.h"
+
+class KDoubleSpinBox;
+class TQCheckBox;
+class TQComboBox;
+class TQFrame;
+class TQLabel;
+class TQRadioButton;
+class TQSpinBox;
+class TrashImpl;
+
+class KTrashPropsDlgPlugin : public KPropsDlgPlugin
+{
+ Q_OBJECT
+
+ public:
+ KTrashPropsDlgPlugin( KPropertiesDialog *dialog, const char*, const TQStringList& );
+ ~KTrashPropsDlgPlugin();
+
+ virtual void applyChanges();
+
+ private slots:
+ void percentSizeChanged( double );
+ void fixedSizeChanged( double );
+ void fixedSizeUnitActivated ( int );
+ void rbPercentSizeToggled( bool );
+ void rbFixedSizeToggled( bool );
+ void trashChanged( int );
+ void useTypeChanged();
+
+ private:
+ void readConfig();
+ void writeConfig();
+ void setupGui( TQFrame *frame );
+
+ TQCheckBox *mUseTimeLimit;
+ TQSpinBox *mDays;
+ TQCheckBox *mUseSizeLimit;
+ int mSizeLimitType;
+ TQWidget *mSizeWidget;
+ TQRadioButton *mRbPercentSize, *mRbFixedSize;
+ KDoubleSpinBox *mPercentSize;
+ KDoubleSpinBox *mFixedSize;
+ TQComboBox *mFixedSizeUnit;
+ TQLabel *mSizeLabel;
+ TQComboBox *mLimitReachedAction;
+
+ TrashImpl *mTrashImpl;
+ TQString mCurrentTrash;
+
+ typedef struct {
+ bool useTimeLimit;
+ int days;
+ bool useSizeLimit;
+ int sizeLimitType;
+ double percent;
+ double fixedSize;
+ int fixedSizeUnit;
+ int actionType;
+ } ConfigEntry;
+
+ typedef TQMap<TQString, ConfigEntry> ConfigMap;
+ ConfigMap mConfigMap;
+};
+
+#endif
diff --git a/tdeioslave/trash/tdefile-plugin/tdefile_trash.cpp b/tdeioslave/trash/tdefile-plugin/tdefile_trash.cpp
index 983a09db2..e7bfdc280 100644
--- a/tdeioslave/trash/tdefile-plugin/tdefile_trash.cpp
+++ b/tdeioslave/trash/tdefile-plugin/tdefile_trash.cpp
@@ -1,4 +1,4 @@
-/* This file is part of the KDE project
+/* This file is part of the TDE project
* Copyright (C) 2004 David Faure <[email protected]>
* Based on tdefile_txt.cpp by Nadeem Hasan <[email protected]>
*
@@ -51,9 +51,8 @@ void KTrashPlugin::makeMimeTypeInfo(const TQString& mimeType)
KFileMimeTypeInfo::GroupInfo* group =
addGroupInfo(info, "General", i18n("General"));
- KFileMimeTypeInfo::ItemInfo* item;
- item = addItemInfo(group, "OriginalPath", i18n("Original Path"), TQVariant::String);
- item = addItemInfo(group, "DateOfDeletion", i18n("Date of Deletion"), TQVariant::DateTime);
+ addItemInfo(group, "OriginalPath", i18n("Original Path"), TQVariant::String);
+ addItemInfo(group, "DateOfDeletion", i18n("Date of Deletion"), TQVariant::DateTime);
}
bool KTrashPlugin::readInfo(KFileMetaInfo& info, uint)
diff --git a/tdeioslave/trash/tdefile-plugin/tdefile_trash.h b/tdeioslave/trash/tdefile-plugin/tdefile_trash.h
index 71e4f2bff..fbd6c9e3d 100644
--- a/tdeioslave/trash/tdefile-plugin/tdefile_trash.h
+++ b/tdeioslave/trash/tdefile-plugin/tdefile_trash.h
@@ -1,4 +1,4 @@
-/* This file is part of the KDE project
+/* This file is part of the TDE project
* Copyright (C) 2004 David Faure <[email protected]>
* Based on tdefile_txt.h by Nadeem Hasan <[email protected]>
*
diff --git a/tdeioslave/trash/tdeio_trash.cpp b/tdeioslave/trash/tdeio_trash.cpp
index e8fdec8f5..90431afd5 100644
--- a/tdeioslave/trash/tdeio_trash.cpp
+++ b/tdeioslave/trash/tdeio_trash.cpp
@@ -1,4 +1,4 @@
-/* This file is part of the KDE project
+/* This file is part of the TDE project
Copyright (C) 2004 David Faure <[email protected]>
This library is free software; you can redistribute it and/or
diff --git a/tdeioslave/trash/tdeio_trash.h b/tdeioslave/trash/tdeio_trash.h
index 954dbe7a6..964e05f9a 100644
--- a/tdeioslave/trash/tdeio_trash.h
+++ b/tdeioslave/trash/tdeio_trash.h
@@ -1,4 +1,4 @@
-/* This file is part of the KDE project
+/* This file is part of the TDE project
Copyright (C) 2004 David Faure <[email protected]>
This library is free software; you can redistribute it and/or
@@ -22,6 +22,7 @@
#include <tdeio/slavebase.h>
#include "trashimpl.h"
+
namespace TDEIO { class Job; }
typedef TrashImpl::TrashedFileInfo TrashedFileInfo;
diff --git a/tdeioslave/trash/testtrash.cpp b/tdeioslave/trash/testtrash.cpp
index db2e73fb3..60fe2d1a6 100644
--- a/tdeioslave/trash/testtrash.cpp
+++ b/tdeioslave/trash/testtrash.cpp
@@ -1,4 +1,4 @@
-/* This file is part of the KDE project
+/* This file is part of the TDE project
Copyright (C) 2004 David Faure <[email protected]>
This library is free software; you can redistribute it and/or
@@ -24,8 +24,6 @@
#include "tdeio_trash.h"
#include "testtrash.h"
-#include <config.h>
-
#include <kurl.h>
#include <tdelocale.h>
#include <tdeapplication.h>
diff --git a/tdeioslave/trash/testtrash.h b/tdeioslave/trash/testtrash.h
index ebc217aac..e87b9c3a0 100644
--- a/tdeioslave/trash/testtrash.h
+++ b/tdeioslave/trash/testtrash.h
@@ -1,4 +1,4 @@
-/* This file is part of the KDE project
+/* This file is part of the TDE project
Copyright (C) 2004 David Faure <[email protected]>
This library is free software; you can redistribute it and/or
diff --git a/tdeioslave/trash/trash.protocol b/tdeioslave/trash/trash.protocol
index ba3fd5dc7..e1029d038 100644
--- a/tdeioslave/trash/trash.protocol
+++ b/tdeioslave/trash/trash.protocol
@@ -86,4 +86,4 @@ ExtraNames[vi]=Đường dẫn Trước khi vứt,Ngày Vứt
ExtraNames[wa]=Oridjinå tchmin,Date di disfaçaedje
ExtraNames[zh_CN]=原始路径,删除日期
ExtraNames[zh_TW]=原始路徑,刪除日期
-ExtraTypes=QString,QDateTime
+ExtraTypes=TQString,TQDateTime
diff --git a/tdeioslave/trash/trash_constant.h b/tdeioslave/trash/trash_constant.h
new file mode 100644
index 000000000..aab42b3aa
--- /dev/null
+++ b/tdeioslave/trash/trash_constant.h
@@ -0,0 +1,41 @@
+/* This file is part of the TDE project
+ Copyright (C) 2016 Michele Calgaro <michele__DOT__calgaro__AT__yahoo__DOT__it
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef TRASH_CONSTANT_H
+#define TRASH_CONSTANT_H
+
+namespace TrashConstant
+{
+ enum
+ {
+ SIZE_LIMIT_PERCENT = 0,
+ SIZE_LIMIT_FIXED = 1,
+ };
+
+ enum
+ {
+ SIZE_ID_B = 0,
+ SIZE_ID_KB = 1,
+ SIZE_ID_MB = 2,
+ SIZE_ID_GB = 3,
+ SIZE_ID_TB = 4
+ };
+}
+
+#endif
diff --git a/tdeioslave/trash/trashimpl.cpp b/tdeioslave/trash/trashimpl.cpp
index c96d15d3a..6de7edd2a 100644
--- a/tdeioslave/trash/trashimpl.cpp
+++ b/tdeioslave/trash/trashimpl.cpp
@@ -1,4 +1,4 @@
-/* This file is part of the KDE project
+/* This file is part of the TDE project
Copyright (C) 2004 David Faure <[email protected]>
This library is free software; you can redistribute it and/or
@@ -18,9 +18,10 @@
*/
#include "trashimpl.h"
+#include "discspaceutil.h"
+
#include <tdelocale.h>
#include <klargefile.h>
-#include <tdeio/global.h>
#include <tdeio/renamedlg.h>
#include <tdeio/job.h>
#include <kdebug.h>
@@ -33,8 +34,6 @@
#include <tdefileitem.h>
#include <tdeio/chmodjob.h>
-#include <dcopref.h>
-
#include <tqapplication.h>
#include <tqeventloop.h>
#include <tqfile.h>
@@ -49,6 +48,8 @@
#include <stdlib.h>
#include <errno.h>
+#include "trash_constant.h"
+
TrashImpl::TrashImpl() :
TQObject(),
m_lastErrorCode( 0 ),
@@ -322,6 +323,9 @@ bool TrashImpl::deleteInfo( int trashId, const TQString& fileId )
bool TrashImpl::moveToTrash( const TQString& origPath, int trashId, const TQString& fileId )
{
kdDebug() << k_funcinfo << endl;
+ if ( !adaptTrashSize( origPath, trashId ) )
+ return false;
+
const TQString dest = filesPath( trashId, fileId );
if ( !move( origPath, dest ) ) {
// Maybe the move failed due to no permissions to delete source.
@@ -387,6 +391,9 @@ void TrashImpl::jobFinished(TDEIO::Job* job)
bool TrashImpl::copyToTrash( const TQString& origPath, int trashId, const TQString& fileId )
{
kdDebug() << k_funcinfo << endl;
+ if ( !adaptTrashSize( origPath, trashId ) )
+ return false;
+
const TQString dest = filesPath( trashId, fileId );
if ( !copy( origPath, dest ) )
return false;
@@ -959,4 +966,91 @@ bool TrashImpl::parseURL( const KURL& url, int& trashId, TQString& fileId, TQStr
return true;
}
+bool TrashImpl::adaptTrashSize( const TQString& origPath, int trashId )
+{
+ TDEConfig config( "trashrc" );
+
+ const TQString trashPath = trashDirectoryPath( trashId );
+ config.setGroup( trashPath );
+
+ bool useTimeLimit = config.readBoolEntry( "UseTimeLimit", false );
+ bool useSizeLimit = config.readBoolEntry( "UseSizeLimit", true );
+ int sizeLimitType = config.readNumEntry( "SizeLimitType", TrashConstant::SIZE_LIMIT_PERCENT );
+ double percent = config.readDoubleNumEntry( "Percent", 10 );
+ double fixedSize = config.readDoubleNumEntry( "FixedSize", 500 );
+ int fixedSizeUnit = config.readNumEntry( "FixedSizeUnit", TrashConstant::SIZE_ID_MB );
+ int actionType = config.readNumEntry( "LimitReachedAction", 0 );
+
+ if ( useTimeLimit ) { // delete all files in trash older than X days
+ const int maxDays = config.readNumEntry( "Days", 7 );
+ const TQDateTime currentDate = TQDateTime::currentDateTime();
+
+ const TrashedFileInfoList trashedFiles = list();
+ for ( uint i = 0; i < trashedFiles.count(); ++i ) {
+ struct TrashedFileInfo info = trashedFiles[ i ];
+ if ( info.trashId != trashId )
+ continue;
+
+ if ( info.deletionDate.daysTo( currentDate ) > maxDays )
+ del( info.trashId, info.fileId );
+ }
+
+ return true;
+
+ }
+
+ if ( useSizeLimit ) { // check if size limit exceeded
+ // calculate size of the files to be put into the trash
+ unsigned long additionalSize = DiscSpaceUtil::sizeOfPath( origPath );
+ TQString trashPathName = trashPath + "/files/";
+ DiscSpaceUtil util( trashPathName );
+ unsigned long requiredTrashSpace = util.sizeOfPath(trashPathName) + additionalSize;
+ unsigned long trashLimit = 0;
+ if ( sizeLimitType == TrashConstant::SIZE_LIMIT_PERCENT)
+ {
+ trashLimit = (unsigned long)(1024 * percent * util.size() / 100.0);
+ }
+ else if ( sizeLimitType == TrashConstant::SIZE_LIMIT_FIXED)
+ {
+ double trashLimitTemp = fixedSize;
+ while (fixedSizeUnit > TrashConstant::SIZE_ID_B)
+ {
+ trashLimitTemp *= 1024;
+ --fixedSizeUnit;
+ }
+ trashLimit = (unsigned long)trashLimitTemp;
+ }
+ if ( requiredTrashSpace > trashLimit ) {
+ if ( actionType == 0 ) { // warn the user only
+ m_lastErrorCode = TDEIO::ERR_SLAVE_DEFINED;
+ m_lastErrorMessage = i18n( "The trash has reached its maximum size!\nClean the trash manually." );
+ return false;
+ } else {
+ TQDir dir( trashPath + "/files" );
+ const TQFileInfoList *infos = 0;
+ if ( actionType == 1 ) // delete oldest files first
+ infos = dir.entryInfoList( TQDir::Files | TQDir::Dirs, TQDir::Time | TQDir::Reversed );
+ else if ( actionType == 2 ) // delete biggest files first
+ infos = dir.entryInfoList( TQDir::Files | TQDir::Dirs, TQDir::Size );
+ else
+ tqWarning( "Should never happen!" );
+
+ TQFileInfoListIterator it( *infos );
+ TQFileInfo *info;
+ bool deleteFurther = true;
+ while ( ((info = it.current()) != 0) && deleteFurther ) {
+ if ( info->fileName() != "." && info->fileName() != ".." ) {
+ del( trashId, info->fileName() ); // delete trashed file
+ if ( (util.sizeOfPath(trashPathName) + additionalSize) < trashLimit ) // check whether we have enough space now
+ deleteFurther = false;
+ }
+ ++it;
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
#include "trashimpl.moc"
diff --git a/tdeioslave/trash/trashimpl.h b/tdeioslave/trash/trashimpl.h
index 3a06dd9e8..6e7af2bad 100644
--- a/tdeioslave/trash/trashimpl.h
+++ b/tdeioslave/trash/trashimpl.h
@@ -1,4 +1,4 @@
-/* This file is part of the KDE project
+/* This file is part of the TDE project
Copyright (C) 2004 David Faure <[email protected]>
This library is free software; you can redistribute it and/or
@@ -25,9 +25,6 @@
#include <tqstring.h>
#include <tqdatetime.h>
-#include <tqmap.h>
-#include <tqvaluelist.h>
-#include <tqstrlist.h>
#include <assert.h>
/**
@@ -123,6 +120,8 @@ private:
void fileAdded();
void fileRemoved();
+ bool adaptTrashSize( const TQString& origPath, int trashId );
+
// Warning, returns error code, not a bool
int testDir( const TQString& name ) const;
void error( int e, const TQString& s );