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