KDirStat – a graphical disk usage utility
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

151 lines
4.0KB

  1. /*
  2. * File name: kstdcleanup.cpp
  3. * Summary: Support classes for KDirStat
  4. * License: LGPL - See file COPYING.LIB for details.
  5. * Author: Stefan Hundhammer <sh@suse.de>
  6. *
  7. * Updated: 2004-11-23
  8. */
  9. #include <tdelocale.h>
  10. #include "kcleanup.h"
  11. #include "kstdcleanup.h"
  12. using namespace KDirStat;
  13. KCleanup *
  14. KStdCleanup::openInKonqueror( TDEActionCollection *parent )
  15. {
  16. KCleanup *cleanup = new KCleanup( "cleanup_open_in_konqueror",
  17. "kfmclient openURL %p",
  18. i18n( "Open in &Konqueror" ),
  19. parent );
  20. TQ_CHECK_PTR( cleanup );
  21. cleanup->setWorksForDir ( true );
  22. cleanup->setWorksForFile ( true );
  23. cleanup->setWorksForDotEntry( true );
  24. cleanup->setWorksLocalOnly ( false );
  25. cleanup->setRefreshPolicy( KCleanup::noRefresh );
  26. cleanup->setIcon( "konqueror.png" );
  27. cleanup->setShortcut( TQt::CTRL + TQt::Key_K );
  28. return cleanup;
  29. }
  30. KCleanup *
  31. KStdCleanup::openInTerminal( TDEActionCollection *parent )
  32. {
  33. KCleanup *cleanup = new KCleanup( "cleanup_open_in_terminal",
  34. "konsole",
  35. i18n( "Open in &Terminal" ),
  36. parent );
  37. TQ_CHECK_PTR( cleanup );
  38. cleanup->setWorksForDir ( true );
  39. cleanup->setWorksForFile ( true );
  40. cleanup->setWorksForDotEntry( true );
  41. cleanup->setRefreshPolicy( KCleanup::noRefresh );
  42. cleanup->setIcon( "konsole.png" );
  43. cleanup->setShortcut( TQt::CTRL + TQt::Key_T );
  44. return cleanup;
  45. }
  46. KCleanup *
  47. KStdCleanup::compressSubtree( TDEActionCollection *parent )
  48. {
  49. KCleanup *cleanup = new KCleanup( "cleanup_compress_subtree",
  50. "cd ..; tar cjvf %n.tar.bz2 %n && rm -rf %n",
  51. i18n( "&Compress" ),
  52. parent );
  53. TQ_CHECK_PTR( cleanup );
  54. cleanup->setWorksForDir ( true );
  55. cleanup->setWorksForFile ( false );
  56. cleanup->setWorksForDotEntry( false );
  57. cleanup->setRefreshPolicy( KCleanup::refreshParent );
  58. cleanup->setIcon( "ark.png" );
  59. return cleanup;
  60. }
  61. KCleanup *
  62. KStdCleanup::makeClean( TDEActionCollection *parent )
  63. {
  64. KCleanup *cleanup = new KCleanup( "cleanup_make_clean",
  65. "make clean",
  66. i18n( "&make clean" ),
  67. parent );
  68. TQ_CHECK_PTR( cleanup );
  69. cleanup->setWorksForDir ( true );
  70. cleanup->setWorksForFile ( false );
  71. cleanup->setWorksForDotEntry( true );
  72. cleanup->setRefreshPolicy( KCleanup::refreshThis );
  73. return cleanup;
  74. }
  75. KCleanup *
  76. KStdCleanup::deleteTrash( TDEActionCollection *parent )
  77. {
  78. KCleanup *cleanup = new KCleanup( "cleanup_delete_trash",
  79. "rm -f *.o *~ *.bak *.auto core",
  80. i18n( "Delete T&rash Files" ),
  81. parent );
  82. TQ_CHECK_PTR( cleanup );
  83. cleanup->setWorksForDir ( true );
  84. cleanup->setWorksForFile ( false );
  85. cleanup->setWorksForDotEntry( true );
  86. cleanup->setRefreshPolicy( KCleanup::refreshThis );
  87. cleanup->setRecurse( true );
  88. return cleanup;
  89. }
  90. KCleanup *
  91. KStdCleanup::moveToTrashBin( TDEActionCollection *parent )
  92. {
  93. KCleanup *cleanup = new KCleanup( "cleanup_move_to_trash_bin",
  94. "kfmclient move %p %t",
  95. i18n( "Delete (to Trash &Bin)" ),
  96. parent );
  97. TQ_CHECK_PTR( cleanup );
  98. cleanup->setWorksForDir ( true );
  99. cleanup->setWorksForFile ( true );
  100. cleanup->setWorksForDotEntry( false );
  101. cleanup->setRefreshPolicy( KCleanup::assumeDeleted );
  102. cleanup->setIcon( "edittrash.png" );
  103. cleanup->setShortcut( TQt::CTRL + TQt::Key_X );
  104. return cleanup;
  105. }
  106. KCleanup *
  107. KStdCleanup::hardDelete( TDEActionCollection *parent )
  108. {
  109. KCleanup *cleanup = new KCleanup( "cleanup_hard_delete",
  110. "rm -rf %p",
  111. i18n( "&Delete (no way to undelete!)" ),
  112. parent );
  113. TQ_CHECK_PTR( cleanup );
  114. cleanup->setWorksForDir ( true );
  115. cleanup->setWorksForFile ( true );
  116. cleanup->setWorksForDotEntry( false );
  117. cleanup->setAskForConfirmation( true );
  118. cleanup->setRefreshPolicy( KCleanup::assumeDeleted );
  119. cleanup->setIcon( "editdelete.png" );
  120. cleanup->setShortcut( TQt::CTRL + TQt::Key_Delete );
  121. return cleanup;
  122. }
  123. // EOF