Tracker: Added a "Skip all" functionality.
* Also, the copy prompt gets a missing "Replace" button (instead of only offering "Replace all").
This commit is contained in:
@@ -101,6 +101,7 @@ enum {
|
|||||||
enum ConflictCheckResult {
|
enum ConflictCheckResult {
|
||||||
kCanceled = kUserCanceled,
|
kCanceled = kUserCanceled,
|
||||||
kPrompt,
|
kPrompt,
|
||||||
|
kSkipAll,
|
||||||
kReplace,
|
kReplace,
|
||||||
kReplaceAll,
|
kReplaceAll,
|
||||||
kNoConflicts
|
kNoConflicts
|
||||||
@@ -2019,9 +2020,12 @@ PreFlightNameCheck(BObjectList<entry_ref>* srcList, const BDirectory* destDir,
|
|||||||
BString replaceMsg(B_TRANSLATE_NOCOLLECT(kReplaceManyStr));
|
BString replaceMsg(B_TRANSLATE_NOCOLLECT(kReplaceManyStr));
|
||||||
replaceMsg.ReplaceAll("%verb", verb);
|
replaceMsg.ReplaceAll("%verb", verb);
|
||||||
|
|
||||||
BAlert* alert = new BAlert("", replaceMsg.String(),
|
BAlert* alert = new BAlert();
|
||||||
B_TRANSLATE("Cancel"), B_TRANSLATE("Prompt"),
|
alert->SetText(replaceMsg.String());
|
||||||
B_TRANSLATE("Replace all"));
|
alert->AddButton(B_TRANSLATE("Cancel"));
|
||||||
|
alert->AddButton(B_TRANSLATE("Prompt"));
|
||||||
|
alert->AddButton(B_TRANSLATE("Skip all"));
|
||||||
|
alert->AddButton(B_TRANSLATE("Replace all"));
|
||||||
alert->SetShortcut(0, B_ESCAPE);
|
alert->SetShortcut(0, B_ESCAPE);
|
||||||
switch (alert->Go()) {
|
switch (alert->Go()) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -2032,7 +2036,11 @@ PreFlightNameCheck(BObjectList<entry_ref>* srcList, const BDirectory* destDir,
|
|||||||
return kPrompt;
|
return kPrompt;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
// user selected "Replace All"
|
// user selected "Skip all"
|
||||||
|
return kSkipAll;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
// user selected "Replace all"
|
||||||
return kReplaceAll;
|
return kReplaceAll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2060,7 +2068,7 @@ FileStatToString(StatStruct* stat, char* buffer, int32 length)
|
|||||||
status_t
|
status_t
|
||||||
CheckName(uint32 moveMode, const BEntry* sourceEntry,
|
CheckName(uint32 moveMode, const BEntry* sourceEntry,
|
||||||
const BDirectory* destDir, bool multipleCollisions,
|
const BDirectory* destDir, bool multipleCollisions,
|
||||||
ConflictCheckResult& conflictMode)
|
ConflictCheckResult& conflictResolution)
|
||||||
{
|
{
|
||||||
if (moveMode == kDuplicateSelection) {
|
if (moveMode == kDuplicateSelection) {
|
||||||
// when duplicating, we will never have a conflict
|
// when duplicating, we will never have a conflict
|
||||||
@@ -2147,7 +2155,10 @@ CheckName(uint32 moveMode, const BEntry* sourceEntry,
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conflictMode != kReplaceAll) {
|
if (conflictResolution == kSkipAll)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
if (conflictResolution != kReplaceAll) {
|
||||||
// prompt user to determine whether to replace or not
|
// prompt user to determine whether to replace or not
|
||||||
BString replaceMsg;
|
BString replaceMsg;
|
||||||
|
|
||||||
@@ -2187,24 +2198,38 @@ CheckName(uint32 moveMode, const BEntry* sourceEntry,
|
|||||||
// special case single collision (don't need Replace All shortcut)
|
// special case single collision (don't need Replace All shortcut)
|
||||||
BAlert* alert;
|
BAlert* alert;
|
||||||
if (multipleCollisions || sourceIsDirectory) {
|
if (multipleCollisions || sourceIsDirectory) {
|
||||||
alert = new BAlert("", replaceMsg.String(),
|
alert = new BAlert();
|
||||||
B_TRANSLATE("Skip"), B_TRANSLATE("Replace all"));
|
alert->SetText(replaceMsg.String());
|
||||||
|
alert->AddButton(B_TRANSLATE("Skip"));
|
||||||
|
alert->AddButton(B_TRANSLATE("Skip all"));
|
||||||
|
alert->AddButton(B_TRANSLATE("Replace"));
|
||||||
|
alert->AddButton(B_TRANSLATE("Replace all"));
|
||||||
|
switch (alert->Go()) {
|
||||||
|
case 0:
|
||||||
|
conflictResolution = kCanceled;
|
||||||
|
return B_ERROR;
|
||||||
|
case 1:
|
||||||
|
conflictResolution = kSkipAll;
|
||||||
|
return B_ERROR;
|
||||||
|
case 2:
|
||||||
|
conflictResolution = kReplace;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
conflictResolution = kReplaceAll;
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
alert = new BAlert("", replaceMsg.String(),
|
alert = new BAlert("", replaceMsg.String(),
|
||||||
B_TRANSLATE("Cancel"), B_TRANSLATE("Replace"));
|
B_TRANSLATE("Cancel"), B_TRANSLATE("Replace"));
|
||||||
alert->SetShortcut(0, B_ESCAPE);
|
alert->SetShortcut(0, B_ESCAPE);
|
||||||
}
|
switch (alert->Go()) {
|
||||||
switch (alert->Go()) {
|
case 0:
|
||||||
case 0: // user selected "Cancel" or "Skip"
|
conflictResolution = kCanceled;
|
||||||
replaceAll = kCanceled;
|
return B_ERROR;
|
||||||
return B_ERROR;
|
case 1:
|
||||||
|
conflictResolution = kReplace;
|
||||||
case 1: // user selected "Replace" or "Replace All"
|
break;
|
||||||
replaceAll = kReplaceAll;
|
}
|
||||||
// doesn't matter which since a single
|
|
||||||
// collision "Replace" is equivalent to a
|
|
||||||
// "Replace All"
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user