Bug 1798172 - Use getStringPref/setStringPref for folder URI preferences. r=benc

getCharPref doesn't handle unicode, so the code would fail for e.g. folders with Japanese names if the imap server is set to use utf-8 (allow_utf8_accept).

Based on https://github.com/Betterbird/thunderbird-patches/blob/main/102/bugs/1798172-fix-move-to-folder-again-non-latin1.patch

Differential Revision: https://phabricator.services.mozilla.com/D160740

--HG--
extra : rebase_source : 0b9e339624dd071b4e7ec2c257c35ce2f54fca46
extra : amend_source : 199b3f45920b5f018d00681c9d98ad05e75dc86f
This commit is contained in:
Magnus Melin 2022-11-03 15:22:56 +11:00
Родитель 8c3acda925
Коммит 84e41d5405
6 изменённых файлов: 17 добавлений и 14 удалений

Просмотреть файл

@ -1046,7 +1046,10 @@ var gFolderTreeView = {
isMove = false;
}
prefBranch.setCharPref("last_msg_movecopy_target_uri", targetFolder.URI);
prefBranch.setStringPref(
"last_msg_movecopy_target_uri",
targetFolder.URI
);
prefBranch.setBoolPref("last_msg_movecopy_was_move", isMove);
// ### ugh, so this won't work with cross-folder views. We would
// really need to partition the messages by folder.

Просмотреть файл

@ -647,7 +647,7 @@ var DefaultController = {
return false;
}
}
let targetURI = Services.prefs.getCharPref(
let targetURI = Services.prefs.getStringPref(
"mail.last_msg_movecopy_target_uri"
);
if (!targetURI) {
@ -1056,7 +1056,7 @@ var DefaultController = {
break;
case "cmd_moveToFolderAgain":
var folder = MailUtils.getOrCreateFolder(
Services.prefs.getCharPref("mail.last_msg_movecopy_target_uri")
Services.prefs.getStringPref("mail.last_msg_movecopy_target_uri")
);
if (Services.prefs.getBoolPref("mail.last_msg_movecopy_was_move")) {
MsgMoveMessage(folder);

Просмотреть файл

@ -664,7 +664,7 @@ var mailContextMenu = {
Ci.nsMsgViewCommandType.moveMessages,
destFolder
);
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"mail.last_msg_movecopy_target_uri",
destFolder.URI
);
@ -680,7 +680,7 @@ var mailContextMenu = {
Ci.nsMsgViewCommandType.copyMessages,
destFolder
);
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"mail.last_msg_movecopy_target_uri",
destFolder.URI
);
@ -797,7 +797,7 @@ var commandController = {
},
cmd_moveToFolderAgain() {
let folder = LazyModules.MailUtils.getOrCreateFolder(
Services.prefs.getCharPref("mail.last_msg_movecopy_target_uri")
Services.prefs.getStringPref("mail.last_msg_movecopy_target_uri")
);
if (Services.prefs.getBoolPref("mail.last_msg_movecopy_was_move")) {
mailContextMenu.moveMessage(folder);
@ -954,7 +954,7 @@ var commandController = {
canMoveAgain = canMove;
}
if (canMoveAgain) {
let targetURI = Services.prefs.getCharPref(
let targetURI = Services.prefs.getStringPref(
"mail.last_msg_movecopy_target_uri"
);
canMoveAgain =

Просмотреть файл

@ -775,7 +775,7 @@ function showCommandInSpecialFolder(aCommandIds, aFolderFlag) {
* @param aMenuItem the menu item to adjust
*/
function initMoveToFolderAgainMenu(aMenuItem) {
let lastFolderURI = Services.prefs.getCharPref(
let lastFolderURI = Services.prefs.getStringPref(
"mail.last_msg_movecopy_target_uri"
);
@ -1943,7 +1943,7 @@ function MsgCopyMessage(aDestFolder) {
);
}
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"mail.last_msg_movecopy_target_uri",
aDestFolder.URI
);
@ -1960,7 +1960,7 @@ function MsgMoveMessage(aDestFolder) {
Ci.nsMsgViewCommandType.moveMessages,
aDestFolder
);
Services.prefs.setCharPref(
Services.prefs.setStringPref(
"mail.last_msg_movecopy_target_uri",
aDestFolder.URI
);

Просмотреть файл

@ -1159,7 +1159,7 @@ var MessageWindowController = {
) {
return false;
}
let targetURI = Services.prefs.getCharPref(
let targetURI = Services.prefs.getStringPref(
"mail.last_msg_movecopy_target_uri"
);
if (!targetURI) {
@ -1249,7 +1249,7 @@ var MessageWindowController = {
break;
case "cmd_moveToFolderAgain":
var folder = MailUtils.getOrCreateFolder(
Services.prefs.getCharPref("mail.last_msg_movecopy_target_uri")
Services.prefs.getStringPref("mail.last_msg_movecopy_target_uri")
);
if (Services.prefs.getBoolPref("mail.last_msg_movecopy_was_move")) {
MsgMoveMessage(folder);

Просмотреть файл

@ -36,13 +36,13 @@ var SearchSupport = {
*/
__lastFolderIndexedUri: null,
set _lastFolderIndexedUri(uri) {
this._prefBranch.setCharPref("lastFolderIndexedUri", uri);
this._prefBranch.setStringPref("lastFolderIndexedUri", uri);
this.__lastFolderIndexedUri = uri;
},
get _lastFolderIndexedUri() {
// If we don't know about it, get it from the pref branch
if (this.__lastFolderIndexedUri === null) {
this.__lastFolderIndexedUri = this._prefBranch.getCharPref(
this.__lastFolderIndexedUri = this._prefBranch.getStringPref(
"lastFolderIndexedUri",
""
);