Skip to content

Commit

Permalink
Renamed Tracker option "Don't move files to Trash" (#9352)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Humdinger committed Jan 6, 2013
1 parent c0bc999 commit 45f77dc
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion src/kits/tracker/Commands.h
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/kits/tracker/ContainerWindow.cpp
Expand Up @@ -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();
}

Expand All @@ -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();
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/kits/tracker/FSUtils.cpp
Expand Up @@ -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"),
Expand Down
6 changes: 3 additions & 3 deletions src/kits/tracker/FilePanelPriv.cpp
Expand Up @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions src/kits/tracker/PoseView.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/kits/tracker/PoseViewScripting.cpp
Expand Up @@ -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);
Expand Down
36 changes: 18 additions & 18 deletions src/kits/tracker/SettingsViews.cpp
Expand Up @@ -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();
Expand All @@ -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);
Expand All @@ -981,7 +981,7 @@ TrashSettingsView::TrashSettingsView()
void
TrashSettingsView::AttachedToWindow()
{
fDontMoveFilesToTrashCheckBox->SetTarget(this);
fMoveFilesToTrashCheckBox->SetTarget(this);
fAskBeforeDeleteFileCheckBox->SetTarget(this);
}

Expand All @@ -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;

Expand All @@ -1023,7 +1023,7 @@ TrashSettingsView::SetDefaults()
{
TrackerSettings settings;

settings.SetDontMoveFilesToTrash(false);
settings.SetMoveFilesToTrash(true);
settings.SetAskBeforeDeleteFile(true);

ShowCurrentSettings();
Expand All @@ -1036,7 +1036,7 @@ TrashSettingsView::IsDefaultable() const
{
TrackerSettings settings;

return settings.DontMoveFilesToTrash() != false
return settings.MoveFilesToTrash() != true
|| settings.AskBeforeDeleteFile() != true;
}

Expand All @@ -1046,7 +1046,7 @@ TrashSettingsView::Revert()
{
TrackerSettings settings;

settings.SetDontMoveFilesToTrash(fDontMoveFilesToTrash);
settings.SetMoveFilesToTrash(fMoveFilesToTrash);
settings.SetAskBeforeDeleteFile(fAskBeforeDeleteFile);

ShowCurrentSettings();
Expand All @@ -1061,7 +1061,7 @@ TrashSettingsView::_SendNotices()
if (!tracker)
return;

tracker->SendNotices(kDontMoveFilesToTrashChanged);
tracker->SendNotices(kMoveFilesToTrashChanged);
tracker->SendNotices(kAskBeforeDeleteFileChanged);
}

Expand All @@ -1071,7 +1071,7 @@ TrashSettingsView::ShowCurrentSettings()
{
TrackerSettings settings;

fDontMoveFilesToTrashCheckBox->SetValue(settings.DontMoveFilesToTrash());
fMoveFilesToTrashCheckBox->SetValue(settings.MoveFilesToTrash());
fAskBeforeDeleteFileCheckBox->SetValue(settings.AskBeforeDeleteFile());
}

Expand All @@ -1081,16 +1081,16 @@ TrashSettingsView::RecordRevertSettings()
{
TrackerSettings settings;

fDontMoveFilesToTrash = settings.DontMoveFilesToTrash();
fMoveFilesToTrash = settings.MoveFilesToTrash();
fAskBeforeDeleteFile = settings.AskBeforeDeleteFile();
}


bool
TrashSettingsView::IsRevertable() const
{
return fDontMoveFilesToTrash
!= (fDontMoveFilesToTrashCheckBox->Value() > 0)
return fMoveFilesToTrash
!= (fMoveFilesToTrashCheckBox->Value() > 0)
|| fAskBeforeDeleteFile
!= (fAskBeforeDeleteFileCheckBox->Value() > 0);
}
Expand Down
4 changes: 2 additions & 2 deletions src/kits/tracker/SettingsViews.h
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions src/kits/tracker/TrackerSettings.cpp
Expand Up @@ -82,7 +82,7 @@ class TTrackerState : public Settings {
HexScalarValueSetting* fFreeSpaceColor;
HexScalarValueSetting* fWarningSpaceColor;

BooleanValueSetting* fDontMoveFilesToTrash;
BooleanValueSetting* fMoveFilesToTrash;
BooleanValueSetting* fAskBeforeDeleteFile;

Benaphore fInitLock;
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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);
}


Expand Down
4 changes: 2 additions & 2 deletions src/kits/tracker/TrackerSettings.h
Expand Up @@ -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);

Expand Down

0 comments on commit 45f77dc

Please sign in to comment.