From 4bc2ef979a039ec7f6b0cefe23eb6bb787f98101 Mon Sep 17 00:00:00 2001
From: "Joseph C, Hill" <mr_j.c.h@hotmail.com>
Date: Sat, 4 Mar 2017 17:22:06 +0000
Subject: [PATCH] Tracker: Show alert when emptying trash.
By default, Tracker empties the trash without warning.
This patch adds an alert to ask the user if they are
sure or not.
---
src/kits/tracker/FSUtils.cpp | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/kits/tracker/FSUtils.cpp b/src/kits/tracker/FSUtils.cpp
index 5399efc..43d28d4 100644
a
|
b
|
static const char* kDeleteConfirmationStr =
|
150 | 150 | B_TRANSLATE_MARK("Are you sure you want to delete the " |
151 | 151 | "selected item(s)? This operation cannot be reverted."); |
152 | 152 | |
| 153 | static const char* kEmptyTrashConfirmationStr = |
| 154 | B_TRANSLATE_MARK("Are you sure you want to permanently delete " |
| 155 | "all items in the trash? This operation cannot be reverted."); |
| 156 | |
153 | 157 | static const char* kReplaceStr = |
154 | 158 | B_TRANSLATE_MARK("You are trying to replace the item:\n" |
155 | 159 | "\t%name%dest\n" |
… |
… |
FSInTrashDir(const entry_ref* ref)
|
2830 | 2834 | void |
2831 | 2835 | FSEmptyTrash() |
2832 | 2836 | { |
2833 | | if (find_thread("_tracker_empty_trash_") != B_OK) { |
2834 | | resume_thread(spawn_thread(empty_trash, "_tracker_empty_trash_", |
2835 | | B_NORMAL_PRIORITY, NULL)); |
| 2837 | BAlert* alert = new BAlert("", kEmptyTrashConfirmationStr, |
| 2838 | B_TRANSLATE("Cancel"), B_TRANSLATE("Proceed"), 0, |
| 2839 | B_WIDTH_AS_USUAL, B_WARNING_ALERT); |
| 2840 | |
| 2841 | switch (alert->Go()) { |
| 2842 | case 1: |
| 2843 | if (find_thread("_tracker_empty_trash_") != B_OK) { |
| 2844 | resume_thread(spawn_thread(empty_trash, "_tracker_empty_trash_", |
| 2845 | B_NORMAL_PRIORITY, NULL)); |
| 2846 | } |
| 2847 | break; |
2836 | 2848 | } |
2837 | 2849 | } |
2838 | 2850 | |