1
0

MoveToTrashEvent.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 Bjoern Schiessle <bjoern@schiessle.org>
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Bjoern Schiessle <bjoern@schiessle.org>
  7. * @author Roeland Jago Douma <roeland@famdouma.nl>
  8. *
  9. * @license GNU AGPL version 3 or any later version
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  25. namespace OCA\Files_Trashbin\Events;
  26. use OCP\EventDispatcher\Event;
  27. use OCP\Files\Node;
  28. /**
  29. * Class MoveToTrashEvent
  30. *
  31. * Event to allow other apps to disable the trash bin for specific files
  32. *
  33. * @package OCA\Files_Trashbin\Events
  34. */
  35. class MoveToTrashEvent extends Event {
  36. /** @var bool */
  37. private $moveToTrashBin;
  38. /** @var Node */
  39. private $node;
  40. public function __construct(Node $node) {
  41. $this->moveToTrashBin = true;
  42. $this->node = $node;
  43. }
  44. /**
  45. * get Node which will be deleted
  46. *
  47. * @return Node
  48. */
  49. public function getNode() {
  50. return $this->node;
  51. }
  52. /**
  53. * disable trash bin for this operation
  54. */
  55. public function disableTrashBin() {
  56. $this->moveToTrashBin = false;
  57. }
  58. /**
  59. * should the file be moved to the trash bin?
  60. *
  61. * @return bool
  62. */
  63. public function shouldMoveToTrashBin() {
  64. return $this->moveToTrashBin;
  65. }
  66. }