land Magnus' fix for 231654, make delete only apply to folder if no message selected, and put folder name in delete confirmation prompt, r/sr=bienvenu
land Magnus' fix for 231654, make delete only apply to folder if no message selected, and put folder name in delete confirmation prompt, r/sr=bienvenu
--- a/mail/base/content/hiddenWindow.js
+++ b/mail/base/content/hiddenWindow.js
@@ -36,17 +36,18 @@
#
# ***** END LICENSE BLOCK *****
function hiddenWindowStartup()
{
// Disable menus which are not appropriate
var disabledItems = ['newNewMsgCmd', 'menu_newFolder', 'newAccountMenuItem', 'menu_close', 'menu_saveAs',
'menu_saveAsFile', 'menu_newVirtualFolder', 'menu_find', 'menu_findCmd', 'menu_findAgainCmd',
- 'menu_sendunsentmsgs', 'menu_subscribe', 'menu_renameFolder', 'menu_select',
+ 'menu_sendunsentmsgs', 'menu_subscribe', 'menu_deleteFolder',
+ 'menu_renameFolder', 'menu_select',
'menu_selectAll', 'menu_selectThread',
'menu_favoriteFolder', 'menu_properties',
'menu_Toolbars', 'menu_MessagePaneLayout', 'menu_showMessage', 'menu_FolderViews',
'viewSortMenu', 'groupBySort', 'viewMessageViewMenu', 'mailviewCharsetMenu',
'viewMessagesMenu', 'menu_expandAllThreads', 'collapseAllThreads',
'viewheadersmenu', 'viewBodyMenu', 'viewAttachmentsInlineMenuitem',
'viewTextSizeMenu', 'menu_textZoomEnlarge', 'menu_textZoomReduce',
'goNextMenu', 'menu_nextMsg', 'menu_nextUnreadMsg', 'menu_nextUnreadThread',
--- a/mail/base/content/mail3PaneWindowCommands.js
+++ b/mail/base/content/mail3PaneWindowCommands.js
@@ -45,16 +45,17 @@ var gMessengerBundle = document.getEleme
var FolderPaneController =
{
supportsCommand: function(command)
{
switch ( command )
{
case "cmd_delete":
case "button_delete":
+ case "cmd_deleteFolder":
case "button_compact":
//case "cmd_selectAll": the folder pane currently only handles single selection
case "cmd_cut":
case "cmd_copy":
case "cmd_paste":
return true;
default:
@@ -67,16 +68,22 @@ var FolderPaneController =
switch ( command )
{
case "cmd_cut":
case "cmd_copy":
case "cmd_paste":
return false;
case "cmd_delete":
case "button_delete":
+ // Even if the folder pane has focus, don't do a folder delete if
+ // we have a selected message, but do a message delete instead.
+ if (GetNumSelectedMessages() != 0)
+ return DefaultController.isCommandEnabled(command);
+ // else fall through
+ case "cmd_deleteFolder":
// Make sure the button doesn't show "Undelete" for folders.
UpdateDeleteToolbarButton();
case "button_compact":
if ( command == "cmd_delete" )
goSetMenuValue(command, 'valueFolder');
var folders = GetSelectedMsgFolders();
if (folders.length) {
@@ -85,19 +92,23 @@ var FolderPaneController =
var isServer = null;
var serverType = null;
try {
var folder = folders[0];
specialFolder = getSpecialFolderString(folder);
isServer = folder.isServer;
serverType = folder.server.type;
if (serverType == "nntp") {
- if ( command == "cmd_delete" ) {
- goSetMenuValue(command, 'valueNewsgroup');
- goSetAccessKey(command, 'valueNewsgroupAccessKey');
+ if (command == "cmd_deleteFolder") {
+ // Just disable the command for news.
+ return false;
+ }
+ else if (command == "cmd_delete") {
+ goSetMenuValue(command, 'valueNewsgroup');
+ goSetAccessKey(command, 'valueNewsgroupAccessKey');
}
}
}
catch (ex) {
//dump("specialFolder failure: " + ex + "\n");
}
if (specialFolder == "Inbox" || specialFolder == "Trash" || specialFolder == "Drafts" ||
specialFolder == "Sent" || specialFolder == "Templates" || specialFolder == "Unsent Messages" ||
@@ -121,16 +132,24 @@ var FolderPaneController =
// if the user invoked a key short cut then it is possible that we got here for a command which is
// really disabled. kick out if the command should be disabled.
if (!this.isCommandEnabled(command)) return;
switch ( command )
{
case "cmd_delete":
case "button_delete":
+ // Even if the folder pane has focus, don't do a folder delete if
+ // we have a selected message, but delete the message instead.
+ if (GetNumSelectedMessages() == 0)
+ MsgDeleteFolder();
+ else
+ DefaultController.doCommand(command);
+ break;
+ case "cmd_deleteFolder":
MsgDeleteFolder();
break;
case "button_compact":
MsgCompactFolder(false);
break;
}
},
@@ -156,16 +175,17 @@ var DefaultController =
case "button_replyall":
case "cmd_forward":
case "button_forward":
case "cmd_forwardInline":
case "cmd_forwardAttachment":
case "cmd_editAsNew":
case "cmd_createFilterFromMenu":
case "cmd_delete":
+ case "cmd_deleteFolder":
case "button_delete":
case "button_junk":
case "cmd_shiftDelete":
case "cmd_nextMsg":
case "button_next":
case "button_previous":
case "cmd_nextUnreadMsg":
case "cmd_nextFlaggedMsg":
@@ -264,16 +284,18 @@ var DefaultController =
UpdateDeleteToolbarButton();
if (gDBView)
gDBView.getCommandStatus(nsMsgViewCommandType.deleteMsg, enabled, checkStatus);
return enabled.value;
case "cmd_shiftDelete":
if (gDBView)
gDBView.getCommandStatus(nsMsgViewCommandType.deleteNoTrash, enabled, checkStatus);
return enabled.value;
+ case "cmd_deleteFolder":
+ return FolderPaneController.isCommandEnabled(command);
case "button_junk":
UpdateJunkToolbarButton();
if (gDBView)
gDBView.getCommandStatus(nsMsgViewCommandType.junk, enabled, checkStatus);
return enabled.value;
case "cmd_killThread":
case "cmd_killSubthread":
return GetNumSelectedMessages() > 0;
@@ -512,16 +534,19 @@ var DefaultController =
gDBView.doCommand(nsMsgViewCommandType.deleteMsg);
break;
case "cmd_shiftDelete":
if (gMarkViewedMessageAsReadTimer)
MarkCurrentMessageAsRead();
SetNextMessageAfterDelete();
gDBView.doCommand(nsMsgViewCommandType.deleteNoTrash);
break;
+ case "cmd_deleteFolder":
+ FolderPaneController.doCommand(command);
+ break;
case "cmd_killThread":
/* kill thread kills the thread and then does a next unread */
GoNextMessage(nsMsgNavigationType.toggleThreadKilled, true);
break;
case "cmd_killSubthread":
GoNextMessage(nsMsgNavigationType.toggleSubthreadKilled, true);
break;
case "cmd_watchThread":
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -783,23 +783,24 @@ function UpdateJunkToolbarButton()
}
function UpdateDeleteToolbarButton()
{
var deleteButtonDeck = document.getElementById("delete-deck");
if (!deleteButtonDeck)
return;
- // Never show "Undelete" for folders.
- if (WhichPaneHasFocus() == GetFolderTree())
+ // Never show "Undelete" in the 3-pane for folders, when delete would
+ // apply to the selected folder.
+ if (this.WhichPaneHasFocus && WhichPaneHasFocus() == GetFolderTree()
+ && GetNumSelectedMessages() == 0)
deleteButtonDeck.selectedIndex = 0;
else
deleteButtonDeck.selectedIndex = SelectedMessagesAreDeleted() ? 1 : 0;
}
-
function UpdateDeleteCommand()
{
var value = "value";
var uri = GetFirstSelectedMessage();
if (IsNewsMessage(uri))
value += "News";
else if (SelectedMessagesAreDeleted())
value += "IMAPDeleted";
--- a/mail/base/content/mailWindowOverlay.xul
+++ b/mail/base/content/mailWindowOverlay.xul
@@ -106,16 +106,17 @@
<command id="cmd_emptyTrash" oncommand="goDoCommand('cmd_emptyTrash')" disabled="true"/>
<command id="cmd_compactFolder" oncommand="goDoCommand('cmd_compactFolder')" disabled="true"/>
<command id="cmd_printSetup" oncommand="goDoCommand('cmd_printSetup')" disabled="true"/>
<command id="cmd_print" oncommand="goDoCommand('cmd_print')" disabled="true"/>
<command id="cmd_printpreview" oncommand="goDoCommand('cmd_printpreview')" disabled="true"/>
<command id="cmd_saveAsFile" oncommand="goDoCommand('cmd_saveAsFile')" disabled="true"/>
<command id="cmd_saveAsTemplate" oncommand="goDoCommand('cmd_saveAsTemplate')" disabled="true"/>
<command id="cmd_getNextNMessages" oncommand="goDoCommand('cmd_getNextNMessages')" disabled="true"/>
+ <command id="cmd_deleteFolder" oncommand="goDoCommand('cmd_deleteFolder')"/>
<command id="cmd_renameFolder" oncommand="goDoCommand('cmd_renameFolder')" />
<command id="cmd_sendUnsentMsgs" oncommand="goDoCommand('cmd_sendUnsentMsgs')" />
<command id="cmd_synchronizeOffline" oncommand="goDoCommand('cmd_synchronizeOffline')" disabled="true"/>
<command id="cmd_downloadFlagged" oncommand="goDoCommand('cmd_downloadFlagged')" disabled="true"/>
<command id="cmd_downloadSelected" oncommand="goDoCommand('cmd_downloadSelected')" disabled="true"/>
<command id="cmd_settingsOffline" oncommand="goDoCommand('cmd_settingsOffline')" disabled="true"/>
</commandset>
@@ -945,16 +946,19 @@
</menu>
<menuitem id="menu_getnextnmsg" label="&getNextNMsgCmd.label;" accesskey="&getNextNMsgCmd.accesskey;"
command="cmd_getNextNMessages"/>
<menuitem id="menu_sendunsentmsgs" label="&sendUnsentCmd.label;"
accesskey="&sendUnsentCmd.accesskey;" command="cmd_sendUnsentMsgs"/>
<menuitem id="menu_subscribe" label="&subscribeCmd.label;"
accesskey="&subscribeCmd.accesskey;" oncommand="MsgSubscribe();"/>
<menuseparator id="fileMenuAfterSubscribeSeparator"/>
+ <menuitem id="menu_deleteFolder" label="&deleteFolder.label;"
+ accesskey="&deleteFolder.accesskey;"
+ command="cmd_deleteFolder"/>
<menuitem id="menu_renameFolder" label="&renameFolder.label;"
accesskey="&renameFolder.accesskey;"
key="key_renameFolder"
command="cmd_renameFolder"/>
<menuitem id="menu_compactFolder" label="&compactFolders.label;" accesskey="&compactFolder.accesskey;" command="cmd_compactFolder"/>
<menuitem id="menu_emptyTrash" label="&emptyTrashCmd.label;"
accesskey="&emptyTrashCmd.accesskey;"
command="cmd_emptyTrash"/>
--- a/mail/base/content/messageWindow.js
+++ b/mail/base/content/messageWindow.js
@@ -481,16 +481,20 @@ function HideMenus()
var showSearch_showMessage_Separator = document.getElementById('menu_showSearch_showMessage_Separator');
if (showSearch_showMessage_Separator)
showSearch_showMessage_Separator.setAttribute("hidden", "true");
var expandOrCollapseMenu = document.getElementById('menu_expandOrCollapse');
if (expandOrCollapseMenu)
expandOrCollapseMenu.setAttribute("hidden", "true");
+ var menuDeleteFolder = document.getElementById('menu_deleteFolder');
+ if (menuDeleteFolder)
+ menuDeleteFolder.hidden = true;
+
var renameFolderMenu = document.getElementById('menu_renameFolder');
if (renameFolderMenu)
renameFolderMenu.setAttribute("hidden", "true");
var viewLayoutMenu = document.getElementById("menu_MessagePaneLayout");
if (viewLayoutMenu)
viewLayoutMenu.setAttribute("hidden", "true");
--- a/mail/locales/en-US/chrome/messenger/imapMsgs.properties
+++ b/mail/locales/en-US/chrome/messenger/imapMsgs.properties
@@ -278,33 +278,25 @@ 5052=Failed to connect to server %S.
## @name IMAP_IMAP_CONNECTION_REFUSED_ERROR
## @loc None
5053=Could not connect to mail server %S; the connection was refused.
## @name IMAP_NET_TIMEOUT_ERROR
## @loc None
5054=Connection to server %S timed out.
-## @name IMAP_MOVE_FOLDER_TO_TRASH
-## @loc None
-5055=Are you sure you want to move the selected folder into the Trash?
-
# Status - no messages to download
## @name IMAP_NO_NEW_MESSAGES
## @loc None
5056=There are no new messages on the server.
## @name IMAP_DEFAULT_ACCOUNT_NAME
## @loc None
5057=Mail for %S
-## @name IMAP_DELETE_NO_TRASH
-## @loc None
-5058=Deleting this folder is not undoable and will delete all of the messages it contains, and its sub-folders. Are you sure you still want to delete this folder?
-
## @name IMAP_EMPTY_TRASH_CONFIRM
## @loc None
5061=Emptying trash will delete %S and all of the messages it contains. Do you want to delete this folder?
## @name IMAP_PERSONAL_FILING_CABINET
## @loc None
5062=Personal Filing Cabinet
@@ -444,8 +436,28 @@ 5102=You cannot log in to %S because you
# Place the word %3$S in your translation where the name of the destination folder should appear.
# Place the word %1$S where the currently copying message should appear.
# Place the word %2$S where the total number of messages should appear.
5103=Copying Message %1$S of %2$S to %3$S
## @name IMAP_LOGIN_DISABLED
## @loc None
5104=You cannot log in to %S because the server has disabled login. You may need to connect via SSL or TLS. Please check the account settings for your mail server.
+
+## @name IMAP_MOVE_FOLDER_TO_TRASH
+## @loc None
+# LOCALIZATION NOTE (5105): Do not translate the word %S below.
+# "%S" is the the name of the folder.
+5105=Are you sure you want to delete the folder '%S'?
+
+## @name IMAP_DELETE_NO_TRASH
+## @loc None
+# LOCALIZATION NOTE (5106): Do not translate the word %S below.
+# "%S" is the the name of the folder.
+5106=Deleting this folder is not undoable and will delete all of the messages it contains, and its sub-folders. Are you sure you still want to delete the folder '%S'?
+
+## @name IMAP_DELETE_FOLDER_DIALOG_TITLE
+## @loc None
+5107=Delete Folder
+
+## @name IMAP_DELETE_FOLDER_BUTTON_LABEL
+## @loc None
+5108=&Delete Folder
--- a/mail/locales/en-US/chrome/messenger/localMsgs.properties
+++ b/mail/locales/en-US/chrome/messenger/localMsgs.properties
@@ -151,20 +151,16 @@ 4018=Please enter a new password for use
## @name POP3_NO_ANSWER
## @loc None
4019=No Answer
## @name POP3_ENTER_PASSWORD_PROMPT_TITLE
## @loc None
4020=Enter your password:
-## @name moveFolderToTrash
-## @loc None
-4021=Are you sure you want to move the selected folder into the Trash?
-
## @name POP3_FOLDER_FOR_TRASH
## @loc None
4023=The Trash already contained a folder named %s. The folder which you just deleted can be found in the Trash under the new name %s.
# Status - stat failed
## @name POP3_STAT
## @loc None
4024= The STAT command did not succeed. Error getting message number and sizes.
@@ -244,8 +240,22 @@ 4041=The POP3 mail server (%S) does not
# secure authentication failed and unsure why
## @name CANNOT_PROCESS_APOP_AUTH
## @loc None
4042=The mail server does not support secure authentication or you have entered an incorrect password. Please check your password, or turn off secure authentication in the Server Settings for your mail server in the Account Settings window.\n
## @name NS_ERROR_COULD_NOT_CONNECT_VIA_TLS
## @loc None
4043=Unable to establish TLS connection to POP3 server. The server may be down or may be incorrectly configured. Please verify the correct configuration in the Server Settings for your mail server in the Account Settings window and try again.
+
+## @name POP3_MOVE_FOLDER_TO_TRASH
+## @loc None
+# LOCALIZATION NOTE (4044): Do not translate the word %S below.
+# "%S" is the the name of the folder.
+4044=Are you sure you want to delete the folder '%S'?
+
+## @name POP3_DELETE_FOLDER_DIALOG_TITLE
+## @loc None
+4045=Delete Folder
+
+## @name POP3_DELETE_FOLDER_BUTTON_LABEL
+## @loc None
+4046=&Delete Folder
--- a/mail/locales/en-US/chrome/messenger/messenger.dtd
+++ b/mail/locales/en-US/chrome/messenger/messenger.dtd
@@ -33,16 +33,18 @@
<!ENTITY getNewMsgCurrentAccountCmdPopupMenu.label "Current Account">
<!ENTITY getNewMsgCurrentAccountCmdPopupMenu.accesskey "C">
<!ENTITY getNextNMsgCmd.label "Get Next 500 News Messages">
<!ENTITY getNextNMsgCmd.accesskey "t">
<!ENTITY sendUnsentCmd.label "Send Unsent Messages">
<!ENTITY sendUnsentCmd.accesskey "d">
<!ENTITY subscribeCmd.label "Subscribe…">
<!ENTITY subscribeCmd.accesskey "b">
+<!ENTITY deleteFolder.label "Delete Folder">
+<!ENTITY deleteFolder.accesskey "e">
<!ENTITY renameFolder.label "Rename Folder…">
<!ENTITY renameFolder.accesskey "R">
<!ENTITY renameFolder.key "VK_F2">
<!ENTITY compactFolders.label "Compact Folders">
<!ENTITY compactFolder.accesskey "F">
<!ENTITY emptyTrashCmd.label "Empty Trash">
<!ENTITY emptyTrashCmd.accesskey "y">
<!ENTITY importCmd.label "Import…">
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -2212,28 +2212,62 @@ nsImapMailFolder::DeleteSubFolders(nsIAr
if (!canHaveSubFoldersOfTrash)
deleteNoTrash = PR_TRUE;
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
prefBranch->GetBoolPref("mailnews.confirm.moveFoldersToTrash", &confirmDeletion);
}
if (!confirmed && (confirmDeletion || deleteNoTrash)) //let us alert the user if we are deleting folder immediately
{
- nsString confirmationStr;
- IMAPGetStringByID(((!deleteNoTrash) ? IMAP_MOVE_FOLDER_TO_TRASH : IMAP_DELETE_NO_TRASH),
- getter_Copies(confirmationStr));
+ nsCOMPtr<nsIStringBundle> bundle;
+ rv = IMAPGetStringBundle(getter_AddRefs(bundle));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsAutoString folderName;
+ rv = curFolder->GetName(folderName);
+ NS_ENSURE_SUCCESS(rv, rv);
+ const PRUnichar *formatStrings[1] = { folderName.get() };
+
+ nsAutoString deleteFolderDialogTitle;
+ rv = bundle->GetStringFromID(IMAP_DELETE_FOLDER_DIALOG_TITLE,
+ getter_Copies(deleteFolderDialogTitle));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsAutoString deleteFolderButtonLabel;
+ rv = bundle->GetStringFromID(IMAP_DELETE_FOLDER_BUTTON_LABEL,
+ getter_Copies(deleteFolderButtonLabel));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsAutoString confirmationStr;
+ rv = bundle->FormatStringFromID(
+ (!deleteNoTrash) ? IMAP_MOVE_FOLDER_TO_TRASH : IMAP_DELETE_NO_TRASH,
+ formatStrings, 1, getter_Copies(confirmationStr));
+ NS_ENSURE_SUCCESS(rv, rv);
if (!msgWindow)
return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIDocShell> docShell;
msgWindow->GetRootDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIPrompt> dialog;
if (docShell)
dialog = do_GetInterface(docShell);
- if (dialog && !confirmationStr.IsEmpty())
- dialog->Confirm(nsnull, confirmationStr.get(), &confirmed);
+ if (dialog)
+ {
+ PRInt32 buttonPressed = 0;
+ // Default the dialog to "cancel".
+ const PRUint32 buttonFlags =
+ (nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_0) +
+ (nsIPrompt::BUTTON_TITLE_CANCEL * nsIPrompt::BUTTON_POS_1);
+
+ rv = dialog->ConfirmEx(deleteFolderDialogTitle.get(), confirmationStr.get(),
+ buttonFlags, deleteFolderButtonLabel.get(),
+ nsnull, nsnull, nsnull, nsnull,
+ &buttonPressed);
+ NS_ENSURE_SUCCESS(rv, rv);
+ confirmed = !buttonPressed; // "ok" is in position 0
+ }
}
else
confirmed = PR_TRUE;
if (confirmed)
{
for (i = 0; i < folderCount; i++)
{
--- a/mailnews/imap/src/nsImapStringBundle.h
+++ b/mailnews/imap/src/nsImapStringBundle.h
@@ -42,18 +42,16 @@
PR_BEGIN_EXTERN_C
nsresult IMAPGetStringByID(PRInt32 stringID, PRUnichar **aString);
nsresult IMAPGetStringBundle(nsIStringBundle **aBundle);
PR_END_EXTERN_C
-
-
#define IMAP_STATUS_SELECTING_MAILBOX 5000
#define IMAP_STATUS_CREATING_MAILBOX 5001
#define IMAP_STATUS_DELETING_MAILBOX 5002
#define IMAP_STATUS_RENAMING_MAILBOX 5003
#define IMAP_STATUS_LOOKING_FOR_MAILBOX 5004
#define IMAP_STATUS_SUBSCRIBE_TO_MAILBOX 5005
#define IMAP_STATUS_UNSUBSCRIBE_MAILBOX 5006
#define IMAP_STATUS_SEARCH_MAILBOX 5007
@@ -91,20 +89,18 @@ PR_END_EXTERN_C
#define IMAP_ENTER_PASSWORD_PROMPT 5047
#define IMAP_SERVER_NOT_IMAP4 5048
#define IMAP_SERVER_SAID 5049
#define IMAP_DONE 5050
#define IMAP_ENTER_PASSWORD_PROMPT_TITLE 5051
#define IMAP_UNKNOWN_HOST_ERROR 5052
#define IMAP_CONNECTION_REFUSED_ERROR 5053
#define IMAP_NET_TIMEOUT_ERROR 5054
-#define IMAP_MOVE_FOLDER_TO_TRASH 5055
#define IMAP_NO_NEW_MESSAGES 5056
#define IMAP_DEFAULT_ACCOUNT_NAME 5057
-#define IMAP_DELETE_NO_TRASH 5058
#define IMAP_HTML_NO_CACHED_BODY_TITLE 5059
#define IMAP_HTML_NO_CACHED_BODY_BODY 5060
#define IMAP_EMPTY_TRASH_CONFIRM 5061
#define IMAP_PERSONAL_FILING_CABINET 5062
#define IMAP_PFC_READ_MAIL 5063
#define IMAP_PFC_SENT_MAIL 5064
#define IMAP_SPECIAL_CHAR 5065
#define IMAP_PERSONAL_SHARED_FOLDER_TYPE_NAME 5066
@@ -133,9 +129,13 @@ PR_END_EXTERN_C
#define IMAP_SERVER_DROPPED_CONNECTION 5093
#define IMAP_QUOTA_STATUS_FOLDERNOTOPEN 5095
#define IMAP_QUOTA_STATUS_NOTSUPPORTED 5096
#define IMAP_QUOTA_STATUS_NOQUOTA 5097
#define IMAP_OUT_OF_MEMORY 5100
#define IMAP_AUTH_SECURE_NOTSUPPORTED 5102
#define IMAP_COPYING_MESSAGE_OF 5103
#define IMAP_LOGIN_DISABLED 5104
+#define IMAP_MOVE_FOLDER_TO_TRASH 5105
+#define IMAP_DELETE_NO_TRASH 5106
+#define IMAP_DELETE_FOLDER_DIALOG_TITLE 5107
+#define IMAP_DELETE_FOLDER_BUTTON_LABEL 5108
#endif /* _nsImapStringBundle_H__ */
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -1007,41 +1007,74 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Dele
nsCOMPtr<nsIMsgCopyService> copyService(do_GetService(NS_MSGCOPYSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
rv = copyService->CopyFolders(folders, trashFolder, PR_TRUE, nsnull, msgWindow);
}
}
return rv;
}
-nsresult nsMsgLocalMailFolder::ConfirmFolderDeletion(nsIMsgWindow *aMsgWindow, PRBool *aResult)
+nsresult nsMsgLocalMailFolder::ConfirmFolderDeletion(nsIMsgWindow *aMsgWindow,
+ nsIMsgFolder *aFolder, PRBool *aResult)
{
NS_ENSURE_ARG(aResult);
NS_ENSURE_ARG(aMsgWindow);
+ NS_ENSURE_ARG(aFolder);
nsCOMPtr<nsIDocShell> docShell;
aMsgWindow->GetRootDocShell(getter_AddRefs(docShell));
if (docShell)
{
PRBool confirmDeletion = PR_TRUE;
nsresult rv;
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
pPrefBranch->GetBoolPref("mailnews.confirm.moveFoldersToTrash", &confirmDeletion);
if (confirmDeletion)
{
nsCOMPtr<nsIStringBundleService> bundleService(do_GetService("@mozilla.org/intl/stringbundle;1", &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStringBundle> bundle;
rv = bundleService->CreateBundle("chrome://messenger/locale/localMsgs.properties", getter_AddRefs(bundle));
NS_ENSURE_SUCCESS(rv, rv);
- nsString alertString;
- bundle->GetStringFromID(POP3_MOVE_FOLDER_TO_TRASH, getter_Copies(alertString));
+
+ nsAutoString folderName;
+ rv = aFolder->GetName(folderName);
+ NS_ENSURE_SUCCESS(rv, rv);
+ const PRUnichar *formatStrings[1] = { folderName.get() };
+
+ nsAutoString deleteFolderDialogTitle;
+ rv = bundle->GetStringFromID(POP3_DELETE_FOLDER_DIALOG_TITLE,
+ getter_Copies(deleteFolderDialogTitle));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsAutoString deleteFolderButtonLabel;
+ rv = bundle->GetStringFromID(POP3_DELETE_FOLDER_BUTTON_LABEL,
+ getter_Copies(deleteFolderButtonLabel));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsAutoString confirmationStr;
+ rv = bundle->FormatStringFromID(POP3_MOVE_FOLDER_TO_TRASH, formatStrings, 1,
+ getter_Copies(confirmationStr));
+ NS_ENSURE_SUCCESS(rv, rv);
+
nsCOMPtr<nsIPrompt> dialog(do_GetInterface(docShell));
if (dialog)
- dialog->Confirm(nsnull, alertString.get(), aResult);
+ {
+ PRInt32 buttonPressed = 0;
+ // Default the dialog to "cancel".
+ const PRUint32 buttonFlags =
+ (nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_0) +
+ (nsIPrompt::BUTTON_TITLE_CANCEL * nsIPrompt::BUTTON_POS_1);
+ rv = dialog->ConfirmEx(deleteFolderDialogTitle.get(), confirmationStr.get(),
+ buttonFlags, deleteFolderButtonLabel.get(),
+ nsnull, nsnull, nsnull, nsnull,
+ &buttonPressed);
+ NS_ENSURE_SUCCESS(rv, rv);
+ *aResult = !buttonPressed; // "ok" is in position 0
+ }
}
else
*aResult = PR_TRUE;
}
return NS_OK;
}
NS_IMETHODIMP nsMsgLocalMailFolder::Rename(const nsAString& aNewName, nsIMsgWindow *msgWindow)
@@ -1860,17 +1893,17 @@ nsMsgLocalMailFolder::CopyFolderLocal(ns
// don't confirm for rss folders.
if (isMoveFolder)
{
// if there's a msgWindow, confirm the deletion
if (msgWindow)
{
PRBool okToDelete = PR_FALSE;
- ConfirmFolderDeletion(msgWindow, &okToDelete);
+ ConfirmFolderDeletion(msgWindow, srcFolder, &okToDelete);
if (!okToDelete)
return NS_MSG_ERROR_COPY_FOLDER_ABORTED;
}
// if we are moving a favorite folder to trash, we should clear the favorites flag
// so it gets removed from the view.
srcFolder->ClearFlag(nsMsgFolderFlags::Favorite);
}
--- a/mailnews/local/src/nsLocalMailFolder.h
+++ b/mailnews/local/src/nsLocalMailFolder.h
@@ -200,17 +200,17 @@ public:
protected:
nsresult CopyFolderAcrossServer(nsIMsgFolder *srcFolder, nsIMsgWindow *msgWindow,nsIMsgCopyServiceListener* listener);
nsresult CreateSubFolders(nsIFile *path);
nsresult GetTrashFolder(nsIMsgFolder** trashFolder);
nsresult WriteStartOfNewMessage();
nsresult IsChildOfTrash(PRBool *result);
nsresult RecursiveSetDeleteIsMoveTrash(PRBool bVal);
- nsresult ConfirmFolderDeletion(nsIMsgWindow *aMsgWindow, PRBool *aResult);
+ nsresult ConfirmFolderDeletion(nsIMsgWindow *aMsgWindow, nsIMsgFolder *aFolder, PRBool *aResult);
nsresult DeleteMessage(nsISupports *message, nsIMsgWindow *msgWindow,
PRBool deleteStorage, PRBool commit);
nsresult GetDatabase(nsIMsgWindow *msgWindow);
// copy message helper
nsresult DisplayMoveCopyStatusMsg();
nsresult SortMessagesBasedOnKey(nsTArray<nsMsgKey> &aKeyArray, nsIMsgFolder *srcFolder, nsIMutableArray* messages);
--- a/mailnews/local/src/nsLocalStrings.h
+++ b/mailnews/local/src/nsLocalStrings.h
@@ -21,17 +21,16 @@
#define POP3_PASSWORD_UNDEFINED 4013
#define POP3_USERNAME_UNDEFINED 4014
#define POP3_LIST_FAILURE 4015
#define POP3_DELE_FAILURE 4016
#define POP3_ENTER_PASSWORD_PROMPT 4017
#define POP3_PREVIOUSLY_ENTERED_PASSWORD_IS_INVALID_ETC 4018
#define POP3_NO_ANSWER 4019
#define POP3_ENTER_PASSWORD_PROMPT_TITLE 4020
-#define POP3_MOVE_FOLDER_TO_TRASH 4021
#define POP3_FOLDER_FOR_TRASH 4023
#define POP3_STAT_FAILURE 4024
#define POP3_SERVER_SAID 4025
#define DELETING_MSGS_STATUS 4026
#define COPYING_MSGS_STATUS 4027
#define MOVING_MSGS_STATUS 4028
#define POP3_MESSAGE_FOLDER_BUSY 4029
#define CANNOT_PROCESS_SECURE_AUTH 4030
@@ -41,10 +40,13 @@
#define MOVEMAIL_CANT_DELETE_LOCK 4035
#define MOVEMAIL_CANT_TRUNCATE_SPOOL_FILE 4036
#define MOVEMAIL_SPOOL_FILE_NOT_FOUND 4037
#define POP3_TMP_DOWNLOAD_FAILED 4038
#define POP3_SERVER_DOES_NOT_SUPPORT_UIDL_ETC 4040
#define POP3_SERVER_DOES_NOT_SUPPORT_THE_TOP_COMMAND 4041
#define CANNOT_PROCESS_APOP_AUTH 4042
#define NS_ERROR_COULD_NOT_CONNECT_VIA_TLS 4043
+#define POP3_MOVE_FOLDER_TO_TRASH 4044
+#define POP3_DELETE_FOLDER_DIALOG_TITLE 4045
+#define POP3_DELETE_FOLDER_BUTTON_LABEL 4046
#endif /* _nsLocalStrings_H__ */
--- a/suite/locales/en-US/chrome/mailnews/imapMsgs.properties
+++ b/suite/locales/en-US/chrome/mailnews/imapMsgs.properties
@@ -278,33 +278,25 @@ 5052=Failed to connect to server %S.
## @name IMAP_IMAP_CONNECTION_REFUSED_ERROR
## @loc None
5053=Could not connect to mail server %S; the connection was refused.
## @name IMAP_NET_TIMEOUT_ERROR
## @loc None
5054=Connection to server %S timed out.
-## @name IMAP_MOVE_FOLDER_TO_TRASH
-## @loc None
-5055=Are you sure you want to move the selected folder into the Trash?
-
# Status - no messages to download
## @name IMAP_NO_NEW_MESSAGES
## @loc None
5056=There are no new messages on the server.
## @name IMAP_DEFAULT_ACCOUNT_NAME
## @loc None
5057=Mail for %S
-## @name IMAP_DELETE_NO_TRASH
-## @loc None
-5058=Deleting this folder is not undoable and will delete all of the messages it contains, and its sub-folders. Are you sure you still want to delete this folder?
-
## @name IMAP_EMPTY_TRASH_CONFIRM
## @loc None
5061=Emptying trash will delete %S and all of the messages it contains. Do you want to delete this folder?
## @name IMAP_PERSONAL_FILING_CABINET
## @loc None
5062=Personal Filing Cabinet
@@ -444,8 +436,28 @@ 5102=You cannot log in to %S because you
# Place the word %3$S in your translation where the name of the destination folder should appear.
# Place the word %1$S where the currently copying message should appear.
# Place the word %2$S where the total number of messages should appear.
5103=Copying Message %1$S of %2$S to %3$S
## @name IMAP_LOGIN_DISABLED
## @loc None
5104=You cannot log in to %S because the server has disabled login. You may need to connect via SSL or TLS. Please check the account settings for your mail server.
+
+## @name IMAP_MOVE_FOLDER_TO_TRASH
+## @loc None
+# LOCALIZATION NOTE (5105): Do not translate the word %S below.
+# "%S" is the the name of the folder.
+5105=Are you sure you want to delete the folder '%S'?
+
+## @name IMAP_DELETE_NO_TRASH
+## @loc None
+# LOCALIZATION NOTE (5106): Do not translate the word %S below.
+# "%S" is the the name of the folder.
+5106=Deleting this folder is not undoable and will delete all of the messages it contains, and its sub-folders. Are you sure you still want to delete the folder '%S'?
+
+## @name IMAP_DELETE_FOLDER_DIALOG_TITLE
+## @loc None
+5107=Delete Folder
+
+## @name IMAP_DELETE_FOLDER_BUTTON_LABEL
+## @loc None
+5108=&Delete Folder
--- a/suite/locales/en-US/chrome/mailnews/localMsgs.properties
+++ b/suite/locales/en-US/chrome/mailnews/localMsgs.properties
@@ -156,20 +156,16 @@ 4018=Please enter a new password for use
## @name POP3_NO_ANSWER
## @loc None
4019=No Answer
## @name POP3_ENTER_PASSWORD_PROMPT_TITLE
## @loc None
4020=Enter your password:
-## @name moveFolderToTrash
-## @loc None
-4021=Are you sure you want to move the selected folder into the Trash?
-
## @name POP3_FOLDER_FOR_TRASH
## @loc None
4023=The Trash already contained a folder named %s. The folder which you just deleted can be found in the Trash under the new name %s.
# Status - stat failed
## @name POP3_STAT
## @loc None
4024= The STAT command did not succeed. Error getting message number and sizes.
@@ -244,8 +240,22 @@ 4041=The POP3 mail server (%S) does not
# secure authentication failed and unsure why
## @name CANNOT_PROCESS_APOP_AUTH
## @loc None
4042=The mail server does not support secure authentication or you have entered an incorrect password. Please check your password, or turn off secure authentication in the Server Settings for your mail server in the Account Settings window.\n
## @name NS_ERROR_COULD_NOT_CONNECT_VIA_TLS
## @loc None
4043=Unable to establish TLS connection to POP3 server. The server may be down or may be incorrectly configured. Please verify the correct configuration in the Server Settings for your mail server in the Account Settings window and try again.
+
+## @name POP3_MOVE_FOLDER_TO_TRASH
+## @loc None
+# LOCALIZATION NOTE (4044): Do not translate the word %S below.
+# "%S" is the the name of the folder.
+4044=Are you sure you want to delete the folder '%S'?
+
+## @name POP3_DELETE_FOLDER_DIALOG_TITLE
+## @loc None
+4045=Delete Folder
+
+## @name POP3_DELETE_FOLDER_BUTTON_LABEL
+## @loc None
+4046=&Delete Folder