Renamed Tracker option "Don't move files to Trash" (#9352)

Renamed that option as it is the only negatively phrased to
"Move deleted files to Trash first" and also the option below
that to "Ask before deleting for good".
Also renamed every function name etc. in that regard and also
settings string of the Tracker settings file.
This commit is contained in:
Humdinger 2013-01-06 20:04:07 +01:00
parent c0bc9998d1
commit 45f77dcd70
10 changed files with 46 additions and 46 deletions

View File

@ -140,7 +140,7 @@ const uint32 kUpdateVolumeSpaceBar = 'UpSB';
const uint32 kShowVolumeSpaceBar = 'ShSB';
const uint32 kSpaceBarColorChanged = 'SBcc';
const uint32 kDontMoveFilesToTrashChanged = 'STdm';
const uint32 kMoveFilesToTrashChanged = 'STdm';
const uint32 kAskBeforeDeleteFileChanged = 'STad';
} // namespace BPrivate

View File

@ -604,7 +604,7 @@ BContainerWindow::BContainerWindow(LockingList<BWindow>* list,
app->StartWatching(this, kWindowsShowFullPathChanged);
app->StartWatching(this, kSingleWindowBrowseChanged);
app->StartWatching(this, kShowNavigatorChanged);
app->StartWatching(this, kDontMoveFilesToTrashChanged);
app->StartWatching(this, kMoveFilesToTrashChanged);
app->Unlock();
}
@ -625,7 +625,7 @@ BContainerWindow::~BContainerWindow()
app->StopWatching(this, kWindowsShowFullPathChanged);
app->StopWatching(this, kSingleWindowBrowseChanged);
app->StopWatching(this, kShowNavigatorChanged);
app->StopWatching(this, kDontMoveFilesToTrashChanged);
app->StopWatching(this, kMoveFilesToTrashChanged);
app->Unlock();
}
@ -1687,10 +1687,10 @@ BContainerWindow::MessageReceived(BMessage* message)
settings.SingleWindowBrowse());
break;
case kDontMoveFilesToTrashChanged:
case kMoveFilesToTrashChanged:
{
bool dontMoveToTrash
= settings.DontMoveFilesToTrash();
= settings.MoveFilesToTrash();
BMenuItem* item
= fFileContextMenu->FindItem(kMoveToTrash);
@ -1934,8 +1934,8 @@ BContainerWindow::AddFileMenu(BMenu* menu)
menu->AddItem(new BMenuItem(B_TRANSLATE("Duplicate"),
new BMessage(kDuplicateSelection), 'D'));
menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash()
? B_TRANSLATE("Delete") : B_TRANSLATE("Move to Trash"),
menu->AddItem(new BMenuItem(TrackerSettings().MoveFilesToTrash()
? B_TRANSLATE("Move to Trash") : B_TRANSLATE("Delete"),
new BMessage(kMoveToTrash), 'T'));
menu->AddSeparatorItem();
@ -2758,8 +2758,8 @@ BContainerWindow::AddFileContextMenus(BMenu* menu)
}
if (!IsTrash() && !InTrash()) {
menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash()
? B_TRANSLATE("Delete") : B_TRANSLATE("Move to Trash"),
menu->AddItem(new BMenuItem(TrackerSettings().MoveFilesToTrash()
? B_TRANSLATE("Move to Trash") : B_TRANSLATE("Delete"),
new BMessage(kMoveToTrash), 'T'));
// add separator for copy to/move to items (navigation items)

View File

@ -2842,9 +2842,9 @@ status_t
_DeleteTask(BObjectList<entry_ref>* list, bool confirm)
{
if (confirm) {
bool dontMoveToTrash = TrackerSettings().DontMoveFilesToTrash();
bool MoveToTrash = TrackerSettings().MoveFilesToTrash();
if (!dontMoveToTrash) {
if (MoveToTrash) {
BAlert* alert = new BAlert("",
B_TRANSLATE_NOCOLLECT(kDeleteConfirmationStr),
B_TRANSLATE("Cancel"), B_TRANSLATE("Move to Trash"),

View File

@ -885,9 +885,9 @@ TFilePanel::AddFileContextMenus(BMenu* menu)
new BMessage(kGetInfo), 'I'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Edit name"),
new BMessage(kEditItem), 'E'));
menu->AddItem(new BMenuItem(TrackerSettings().DontMoveFilesToTrash()
? B_TRANSLATE("Delete")
: B_TRANSLATE("Move to Trash"),
menu->AddItem(new BMenuItem(TrackerSettings().MoveFilesToTrash()
? B_TRANSLATE("Move to Trash")
: B_TRANSLATE("Delete"),
new BMessage(kMoveToTrash), 'T'));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Cut"),

View File

@ -2323,7 +2323,7 @@ BPoseView::MessageReceived(BMessage* message)
{
TrackerSettings settings;
if ((modifiers() & B_SHIFT_KEY) != 0 || settings.DontMoveFilesToTrash())
if ((modifiers() & B_SHIFT_KEY) != 0 || !settings.MoveFilesToTrash())
DeleteSelection(true, settings.AskBeforeDeleteFile());
else
MoveSelectionToTrash();
@ -6461,7 +6461,7 @@ BPoseView::KeyDown(const char* bytes, int32 count)
} else {
TrackerSettings settings;
if ((modifiers() & B_SHIFT_KEY) != 0 || settings.DontMoveFilesToTrash())
if ((modifiers() & B_SHIFT_KEY) != 0 || !settings.MoveFilesToTrash())
DeleteSelection(true, settings.AskBeforeDeleteFile());
else
MoveSelectionToTrash();

View File

@ -491,7 +491,7 @@ BPoseView::DeleteProperty(BMessage* _SCRIPTING_ONLY(specifier),
if (error == B_OK) {
TrackerSettings settings;
if (!settings.DontMoveFilesToTrash()) {
if (settings.MoveFilesToTrash()) {
// move the list we build into trash, don't make the
// trashing task select the next item
MoveListToTrash(entryList, false, false);

View File

@ -956,12 +956,12 @@ TrashSettingsView::TrashSettingsView()
:
SettingsView("TrashSettingsView")
{
fDontMoveFilesToTrashCheckBox = new BCheckBox("",
B_TRANSLATE("Don't move files to Trash"),
new BMessage(kDontMoveFilesToTrashChanged));
fMoveFilesToTrashCheckBox = new BCheckBox("",
B_TRANSLATE("Move deleted files to Trash first"),
new BMessage(kMoveFilesToTrashChanged));
fAskBeforeDeleteFileCheckBox = new BCheckBox("",
B_TRANSLATE("Ask before delete"),
B_TRANSLATE("Ask before deleting for good"),
new BMessage(kAskBeforeDeleteFileChanged));
const float spacing = be_control_look->DefaultItemSpacing();
@ -970,7 +970,7 @@ TrashSettingsView::TrashSettingsView()
layout->SetOrientation(B_VERTICAL);
layout->SetSpacing(0);
BGroupLayoutBuilder(layout)
.Add(fDontMoveFilesToTrashCheckBox)
.Add(fMoveFilesToTrashCheckBox)
.Add(fAskBeforeDeleteFileCheckBox)
.AddGlue()
.SetInsets(spacing, spacing, spacing, spacing);
@ -981,7 +981,7 @@ TrashSettingsView::TrashSettingsView()
void
TrashSettingsView::AttachedToWindow()
{
fDontMoveFilesToTrashCheckBox->SetTarget(this);
fMoveFilesToTrashCheckBox->SetTarget(this);
fAskBeforeDeleteFileCheckBox->SetTarget(this);
}
@ -995,11 +995,11 @@ TrashSettingsView::MessageReceived(BMessage* message)
TrackerSettings settings;
switch (message->what) {
case kDontMoveFilesToTrashChanged:
settings.SetDontMoveFilesToTrash(
fDontMoveFilesToTrashCheckBox->Value() == 1);
case kMoveFilesToTrashChanged:
settings.SetMoveFilesToTrash(
fMoveFilesToTrashCheckBox->Value() == 1);
tracker->SendNotices(kDontMoveFilesToTrashChanged);
tracker->SendNotices(kMoveFilesToTrashChanged);
Window()->PostMessage(kSettingsContentsModified);
break;
@ -1023,7 +1023,7 @@ TrashSettingsView::SetDefaults()
{
TrackerSettings settings;
settings.SetDontMoveFilesToTrash(false);
settings.SetMoveFilesToTrash(true);
settings.SetAskBeforeDeleteFile(true);
ShowCurrentSettings();
@ -1036,7 +1036,7 @@ TrashSettingsView::IsDefaultable() const
{
TrackerSettings settings;
return settings.DontMoveFilesToTrash() != false
return settings.MoveFilesToTrash() != true
|| settings.AskBeforeDeleteFile() != true;
}
@ -1046,7 +1046,7 @@ TrashSettingsView::Revert()
{
TrackerSettings settings;
settings.SetDontMoveFilesToTrash(fDontMoveFilesToTrash);
settings.SetMoveFilesToTrash(fMoveFilesToTrash);
settings.SetAskBeforeDeleteFile(fAskBeforeDeleteFile);
ShowCurrentSettings();
@ -1061,7 +1061,7 @@ TrashSettingsView::_SendNotices()
if (!tracker)
return;
tracker->SendNotices(kDontMoveFilesToTrashChanged);
tracker->SendNotices(kMoveFilesToTrashChanged);
tracker->SendNotices(kAskBeforeDeleteFileChanged);
}
@ -1071,7 +1071,7 @@ TrashSettingsView::ShowCurrentSettings()
{
TrackerSettings settings;
fDontMoveFilesToTrashCheckBox->SetValue(settings.DontMoveFilesToTrash());
fMoveFilesToTrashCheckBox->SetValue(settings.MoveFilesToTrash());
fAskBeforeDeleteFileCheckBox->SetValue(settings.AskBeforeDeleteFile());
}
@ -1081,7 +1081,7 @@ TrashSettingsView::RecordRevertSettings()
{
TrackerSettings settings;
fDontMoveFilesToTrash = settings.DontMoveFilesToTrash();
fMoveFilesToTrash = settings.MoveFilesToTrash();
fAskBeforeDeleteFile = settings.AskBeforeDeleteFile();
}
@ -1089,8 +1089,8 @@ TrashSettingsView::RecordRevertSettings()
bool
TrashSettingsView::IsRevertable() const
{
return fDontMoveFilesToTrash
!= (fDontMoveFilesToTrashCheckBox->Value() > 0)
return fMoveFilesToTrash
!= (fMoveFilesToTrashCheckBox->Value() > 0)
|| fAskBeforeDeleteFile
!= (fAskBeforeDeleteFileCheckBox->Value() > 0);
}

View File

@ -181,10 +181,10 @@ class TrashSettingsView : public SettingsView {
private:
void _SendNotices();
BCheckBox* fDontMoveFilesToTrashCheckBox;
BCheckBox* fMoveFilesToTrashCheckBox;
BCheckBox* fAskBeforeDeleteFileCheckBox;
bool fDontMoveFilesToTrash;
bool fMoveFilesToTrash;
bool fAskBeforeDeleteFile;
typedef SettingsView _inherited;

View File

@ -82,7 +82,7 @@ class TTrackerState : public Settings {
HexScalarValueSetting* fFreeSpaceColor;
HexScalarValueSetting* fWarningSpaceColor;
BooleanValueSetting* fDontMoveFilesToTrash;
BooleanValueSetting* fMoveFilesToTrash;
BooleanValueSetting* fAskBeforeDeleteFile;
Benaphore fInitLock;
@ -202,8 +202,8 @@ TTrackerState::LoadSettingsIfNeeded()
Add(fWarningSpaceColor
= new HexScalarValueSetting("WarningSpaceColor", 0xc0cb0000, "", ""));
Add(fDontMoveFilesToTrash
= new BooleanValueSetting("DontMoveFilesToTrash", false));
Add(fMoveFilesToTrash
= new BooleanValueSetting("MoveFilesToTrash", true));
Add(fAskBeforeDeleteFile
= new BooleanValueSetting("AskBeforeDeleteFile", true));
@ -509,16 +509,16 @@ TrackerSettings::SetRecentFoldersCount(int32 count)
bool
TrackerSettings::DontMoveFilesToTrash()
TrackerSettings::MoveFilesToTrash()
{
return gTrackerState.fDontMoveFilesToTrash->Value();
return gTrackerState.fMoveFilesToTrash->Value();
}
void
TrackerSettings::SetDontMoveFilesToTrash(bool enabled)
TrackerSettings::SetMoveFilesToTrash(bool enabled)
{
gTrackerState.fDontMoveFilesToTrash->SetValue(enabled);
gTrackerState.fMoveFilesToTrash->SetValue(enabled);
}

View File

@ -118,8 +118,8 @@ class TrackerSettings {
bool ClockIs24Hr();
void SetClockTo24Hr(bool);
bool DontMoveFilesToTrash();
void SetDontMoveFilesToTrash(bool);
bool MoveFilesToTrash();
void SetMoveFilesToTrash(bool);
bool AskBeforeDeleteFile();
void SetAskBeforeDeleteFile(bool);