Trash limit: clean up previous patch (KDE -> TDE conversion, debug messages, TQt

signals/slots...). Improved error message when a file is too big to fit
within the max trash size limit.
This relates to bug 1923.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/2/head
Michele Calgaro 8 years ago
parent ee3091bc41
commit 6110a523f9

@ -1,5 +1,5 @@
/*
This file is part of the KDE project
This file is part of the TDE project
Copyright (C) 2008 Tobias Koenig <tokoe@kde.org>
@ -102,9 +102,9 @@ void DiscSpaceUtil::done()
void DiscSpaceUtil::calculateFullSize()
{
KDiskFreeSp *sp = KDiskFreeSp::findUsageInfo( mDirectory );
connect( sp, SIGNAL( foundMountPoint( const TQString&, unsigned long, unsigned long, unsigned long ) ),
this, SLOT( foundMountPoint( const TQString&, unsigned long, unsigned long, unsigned long ) ) );
connect( sp, SIGNAL( done() ), this, SLOT( done() ) );
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();
}

@ -1,5 +1,5 @@
/*
This file is part of the KDE project
This file is part of the TDE project
Copyright (C) 2008 Tobias Koenig <tokoe@kde.org>

@ -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 <faure@kde.org>
This library is free software; you can redistribute it and/or

@ -1,5 +1,5 @@
/*
This file is part of the KDE project
This file is part of the TDE project
Copyright (C) 2008 Tobias Koenig <tokoe@kde.org>
Copyright (C) 2016 Emanoil Kotsev <deloptes@yahoo.com>
@ -46,7 +46,6 @@ K_EXPORT_COMPONENT_FACTORY( ktrashpropsdlgplugin, Factory( "ktrashpropsdlgplugin
KTrashPropsDlgPlugin::KTrashPropsDlgPlugin( KPropertiesDialog *dialog, const char*, const TQStringList& )
: KPropsDlgPlugin( dialog )
{
kdDebug() << "KTrashPropsDlgPlugin::KTrashPropsDlgPlugin called" << endl;
if ( dialog->items().count() != 1 )
return;
@ -55,13 +54,11 @@ KTrashPropsDlgPlugin::KTrashPropsDlgPlugin( KPropertiesDialog *dialog, const cha
if ( !KPropsDlgPlugin::isDesktopFile( item ) )
return;
kdDebug() << "KPropsDlgPlugin::isDesktopFile( item ) passed" << endl;
KDesktopFile deskFile( item->url().path(), true /* readonly */ );
if ( deskFile.readURL() != "trash:/" )
return;
kdDebug() << "deskFile.readURL() != \"trash:/\") passed" << endl;
TDEGlobal::locale()->insertCatalogue( "tdeio_trash" );
mTrashImpl = new TrashImpl();
@ -83,22 +80,22 @@ KTrashPropsDlgPlugin::KTrashPropsDlgPlugin( KPropertiesDialog *dialog, const cha
useTypeChanged();
connect( mUseTimeLimit, SIGNAL( toggled( bool ) ),
this, SLOT( setDirty() ) );
connect( mUseTimeLimit, SIGNAL( toggled( bool ) ),
this, SLOT( useTypeChanged() ) );
connect( mDays, SIGNAL( valueChanged( int ) ),
this, SLOT( setDirty() ) );
connect( mUseSizeLimit, SIGNAL( toggled( bool ) ),
this, SLOT( setDirty() ) );
connect( mUseSizeLimit, SIGNAL( toggled( bool ) ),
this, SLOT( useTypeChanged() ) );
connect( mPercent, SIGNAL( valueChanged( double ) ),
this, SLOT( percentChanged( double ) ) );
connect( mPercent, SIGNAL( valueChanged( double ) ),
this, SLOT( setDirty() ) );
connect( mLimitReachedAction, SIGNAL( activated( int ) ),
this, SLOT( setDirty() ) );
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( mPercent, TQT_SIGNAL( valueChanged( double ) ),
this, TQT_SLOT( percentChanged( double ) ) );
connect( mPercent, TQT_SIGNAL( valueChanged( double ) ),
this, TQT_SLOT( setDirty() ) );
connect( mLimitReachedAction, TQT_SIGNAL( activated( int ) ),
this, TQT_SLOT( setDirty() ) );
trashChanged( 0 );
}
@ -130,9 +127,7 @@ void KTrashPropsDlgPlugin::percentChanged( double percent )
double size = partitionSize*(percent/100.0);
// Step should be depending on size
// https://api.kde.org/3.5-api/kdelibs-apidocs/kdeui/html/classKDoubleSpinBox.html
// https://api.kde.org/3.5-api/kdelibs-apidocs/kdeui/html/knuminput_8cpp_source.html
// FIXME It would be good if precision step depended on max HD size
mPercent->setPrecision(3);
TQString unit = i18n( "Byte" );
@ -203,7 +198,6 @@ void KTrashPropsDlgPlugin::useTypeChanged()
void KTrashPropsDlgPlugin::readConfig()
{
kdDebug() << "KTrashPropsDlgPlugin::readConfig() called" << endl;
TDEConfig config( "trashrc" );
mConfigMap.clear();
@ -224,7 +218,6 @@ void KTrashPropsDlgPlugin::readConfig()
void KTrashPropsDlgPlugin::writeConfig()
{
kdDebug() << "KTrashPropsDlgPlugin::writeConfig() called" << endl;
TDEConfig config( "trashrc" );
// first delete all existing groups
@ -248,7 +241,6 @@ void KTrashPropsDlgPlugin::writeConfig()
void KTrashPropsDlgPlugin::setupGui( TQFrame *frame )
{
kdDebug() << "KTrashPropsDlgPlugin::setupGui( TQFrame *frame )" << endl;
TQVBoxLayout *layout = new TQVBoxLayout( frame, 11, 6 );
TrashImpl::TrashDirMap map = mTrashImpl->trashDirectories();
@ -267,7 +259,7 @@ void KTrashPropsDlgPlugin::setupGui( TQFrame *frame )
mountPoints->setCurrentItem( 0 );
connect( mountPoints, SIGNAL( highlighted( int ) ), SLOT( trashChanged( int ) ) );
connect( mountPoints, TQT_SIGNAL( highlighted( int ) ), TQT_SLOT( trashChanged( int ) ) );
} else {
mCurrentTrash = map[0];
}

@ -2,5 +2,6 @@
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

@ -1,5 +1,5 @@
/*
This file is part of the KDE project
This file is part of the TDE project
Copyright (C) 2008 Tobias Koenig <tokoe@kde.org>

@ -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 <faure@kde.org>
* Based on tdefile_txt.cpp by Nadeem Hasan <nhasan@kde.org>
*

@ -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 <faure@kde.org>
* Based on tdefile_txt.h by Nadeem Hasan <nhasan@kde.org>
*

@ -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 <faure@kde.org>
This library is free software; you can redistribute it and/or

@ -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 <faure@kde.org>
This library is free software; you can redistribute it and/or

@ -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 <faure@kde.org>
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>

@ -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 <faure@kde.org>
This library is free software; you can redistribute it and/or

@ -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 <faure@kde.org>
This library is free software; you can redistribute it and/or
@ -1018,7 +1018,7 @@ bool TrashImpl::adaptTrashSize( const TQString& origPath, int trashId )
if ( ((double)fileSize*100/(double)partitionSize) >= percent ) {
m_lastErrorCode = TDEIO::ERR_SLAVE_DEFINED;
m_lastErrorMessage = i18n( "The file is too large to be trashed." );
m_lastErrorMessage = i18n( "The file is too big to be trashed because it exceeds the maximum size set for the trash bin." );
return false;
}

@ -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 <faure@kde.org>
This library is free software; you can redistribute it and/or

Loading…
Cancel
Save