Bug 1409882 - Include a message theme selector in the chat preferences, r=clokep.
--- a/mail/components/preferences/chat.js
+++ b/mail/components/preferences/chat.js
@@ -2,16 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
var gChatPane = {
init: function ()
{
+ previewObserver.load();
this.updateDisabledState();
},
updateDisabledState: function ()
{
let broadcaster = document.getElementById("idleReportingEnabled");
if (document.getElementById("messenger.status.reportIdle").value) {
broadcaster.removeAttribute("disabled");
--- a/mail/components/preferences/chat.xul
+++ b/mail/components/preferences/chat.xul
@@ -11,16 +11,17 @@
%chatDTD;
]>
<overlay id="ChatPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="paneChat" onpaneload="gChatPane.init();">
<script type="application/javascript" src="chrome://messenger/content/preferences/chat.js"/>
+ <script type="application/javascript" src="chrome://messenger/content/preferences/messagestyle.js"/>
<preferences id="chatPreferences">
<preference id="messenger.startup.action" name="messenger.startup.action" type="int"/>
<preference id="purple.conversations.im.send_typing" name="purple.conversations.im.send_typing" type="bool"/>
<preference id="messenger.status.reportIdle" name="messenger.status.reportIdle" type="bool"
onchange="gChatPane.updateDisabledState();"/>
<preference id="messenger.status.timeBeforeIdle" name="messenger.status.timeBeforeIdle" type="int"/>
<preference id="messenger.status.awayWhenIdle" name="messenger.status.awayWhenIdle" type="bool"
@@ -30,127 +31,204 @@
<preference id="purple.logging.log_ims" name="purple.logging.log_ims" type="bool"/>
<preference id="purple.logging.log_system" name="purple.logging.log_system" type="bool"/>
<preference id="pref.privacy.disable_button.view_passwords" name="pref.privacy.disable_button.view_passwords" type="bool"/>
<preference id="mail.chat.show_desktop_notifications" name="mail.chat.show_desktop_notifications" type="bool"/>
<preference id="mail.chat.notification_info" name="mail.chat.notification_info" type="int"/>
<preference id="mail.chat.play_sound" name="mail.chat.play_sound" type="bool"/>
<preference id="mail.chat.play_sound.type" name="mail.chat.play_sound.type" type="int"/>
<preference id="mail.chat.play_sound.url" name="mail.chat.play_sound.url" type="string"/>
+ <preference id="messenger.options.messagesStyle.theme" name="messenger.options.messagesStyle.theme" type="string"/>
+ <preference id="messenger.options.messagesStyle.variant" name="messenger.options.messagesStyle.variant" type="string"/>
+ <preference id="messenger.options.messagesStyle.showHeader" name="messenger.options.messagesStyle.showHeader" type="bool"/>
</preferences>
<broadcaster id="idleReportingEnabled"/>
- <!-- Startup -->
- <hbox align="center">
- <label id ="chatStartupAction" value="&startupAction.label;"
- accesskey="&startupAction.accesskey;" control="messengerStartupAction"/>
- <menulist id="messengerStartupAction" preference="messenger.startup.action">
- <menupopup>
- <menuitem label="&startupOffline.label;" value="0"/>
- <menuitem label="&startupConnectAuto.label;" value="1"/>
- </menupopup>
- </menulist>
- </hbox>
- <separator/>
+ <stringbundle id="themesBundle"
+ src="chrome://messenger/locale/preferences/messagestyle.properties"/>
+
+ <tabbox id="chatPrefs" flex="1">
+ <tabs id="chatPrefsTabs">
+ <tab id="chatGeneralTab" label="&generalTab.label;"/>
+ <tab id="chatMessageStylesTab" label="&messageStyleTab.title;"/>
+ </tabs>
+
+ <tabpanels id="chatPrefsPanels" flex="1">
+
+ <tabpanel orient="vertical">
+
+ <!-- Startup -->
+ <hbox align="center">
+ <label id ="chatStartupAction" value="&startupAction.label;"
+ accesskey="&startupAction.accesskey;" control="messengerStartupAction"/>
+ <menulist id="messengerStartupAction" preference="messenger.startup.action">
+ <menupopup>
+ <menuitem label="&startupOffline.label;" value="0"/>
+ <menuitem label="&startupConnectAuto.label;" value="1"/>
+ </menupopup>
+ </menulist>
+ </hbox>
+ <separator/>
- <!-- Status -->
- <hbox align="center">
- <checkbox id="reportIdle" label="&reportIdleAfter.label;"
- accesskey="&reportIdleAfter.accesskey;"
- preference="messenger.status.reportIdle"/>
- <textbox id="timeBeforeAway" type="number" min="1" max="720"
- observes="idleReportingEnabled"
- preference="messenger.status.timeBeforeIdle"
- onsyncfrompreference="var elt = document.getElementById(this.getAttribute('preference'));
- return (elt.instantApply ? elt.valueFromPreferences : elt.value) / 60;"
- onsynctopreference="return this.value * 60;"/>
- <label value="&idleTime;" control="timeBeforeAway"/>
- </hbox>
- <vbox class="indent">
- <hbox>
- <checkbox id="autoAway"
- label="&andSetStatusToAway.label;"
- observes="idleReportingEnabled"
- accesskey="&andSetStatusToAway.accesskey;"
- preference="messenger.status.awayWhenIdle"/>
- <spacer flex="1"/>
- </hbox>
- <textbox id="defaultIdleAwayMessage" class="indent"
- observes="idleReportingEnabled"
- preference="messenger.status.defaultIdleAwayMessage"/>
- </vbox>
- <separator/>
- <hbox>
- <checkbox id="sendTyping"
- label="&sendTyping.label;"
- accesskey="&sendTyping.accesskey;"
- preference="purple.conversations.im.send_typing"/>
- <spacer flex="1"/>
- </hbox>
- <groupbox>
- <caption label="&chatNotifications.label;"/>
- <hbox>
- <hbox>
- <checkbox id="desktopChatNotifications"
- label="&desktopChatNotifications.label;"
- accesskey="&desktopChatNotifications.accesskey;"
- preference="mail.chat.show_desktop_notifications"/>
- <spacer flex="1"/>
- </hbox>
- <menulist id="chatNotificationInfo" preference="mail.chat.notification_info">
- <menupopup>
- <menuitem label="&completeNotification.label;" value="0"/>
- <menuitem label="&buddyInfoOnly.label;" value="1"/>
- <menuitem label="&dummyNotification.label;" value="2"/>
- </menupopup>
- </menulist>
- </hbox>
- <hbox align="center">
- <checkbox id="chatNotification"
- label="&chatSound.label;"
- accesskey="&chatSound.accesskey;"
- preference="mail.chat.play_sound"
- oncommand="gChatPane.updatePlaySound();"/>
- <spacer flex="1"/>
- <button id="playChatSound" label="&play.label;" accesskey="&play.accesskey;"
- oncommand="gChatPane.previewSound();"/>
- </hbox>
- <radiogroup id="chatSoundType"
- class="indent"
- orient="vertical"
- preference="mail.chat.play_sound.type"
- oncommand="gChatPane.updatePlaySound();"
- aria-labelledby="chatNotification">
- <hbox>
- <radio id="chatSoundSystemSound"
- label="&systemSound.label;"
- value="0"
- accesskey="&systemSound.accesskey;"/>
- <spacer flex="1"/>
- </hbox>
- <hbox>
- <radio id="chatSoundCustom"
- label="&customsound.label;"
- value="1"
- accesskey="&customsound.accesskey;"/>
- <spacer flex="1"/>
- </hbox>
- <hbox>
- <filefield id="chatSoundUrlLocation"
- class="indent"
- readonly="true"
- preference="mail.chat.play_sound.url"
- preference-editable="true"
- onsyncfrompreference="return gChatPane.readSoundLocation();"
- aria-labelledby="chatSoundCustom"
- flex="1"/>
- <button id="browseForChatSound"
- label="&browse.label;"
- accesskey="&browse.accesskey;"
- oncommand="gChatPane.browseForSoundFile();">
- <observes element="chatSoundUrlLocation" attribute="disabled"/>
- </button>
- </hbox>
- </radiogroup>
- </groupbox>
+ <!-- Status -->
+ <hbox align="center">
+ <checkbox id="reportIdle" label="&reportIdleAfter.label;"
+ accesskey="&reportIdleAfter.accesskey;"
+ preference="messenger.status.reportIdle"/>
+ <textbox id="timeBeforeAway" type="number" min="1" max="720"
+ observes="idleReportingEnabled"
+ preference="messenger.status.timeBeforeIdle"
+ onsyncfrompreference="var elt = document.getElementById(this.getAttribute('preference'));
+ return (elt.instantApply ? elt.valueFromPreferences : elt.value) / 60;"
+ onsynctopreference="return this.value * 60;"/>
+ <label value="&idleTime;" control="timeBeforeAway"/>
+ </hbox>
+ <vbox class="indent">
+ <hbox>
+ <checkbox id="autoAway"
+ label="&andSetStatusToAway.label;"
+ observes="idleReportingEnabled"
+ accesskey="&andSetStatusToAway.accesskey;"
+ preference="messenger.status.awayWhenIdle"/>
+ <spacer flex="1"/>
+ </hbox>
+ <textbox id="defaultIdleAwayMessage" class="indent"
+ observes="idleReportingEnabled"
+ preference="messenger.status.defaultIdleAwayMessage"/>
+ </vbox>
+ <separator/>
+ <hbox>
+ <checkbox id="sendTyping"
+ label="&sendTyping.label;"
+ accesskey="&sendTyping.accesskey;"
+ preference="purple.conversations.im.send_typing"/>
+ <spacer flex="1"/>
+ </hbox>
+ <groupbox>
+ <caption label="&chatNotifications.label;"/>
+ <hbox>
+ <hbox>
+ <checkbox id="desktopChatNotifications"
+ label="&desktopChatNotifications.label;"
+ accesskey="&desktopChatNotifications.accesskey;"
+ preference="mail.chat.show_desktop_notifications"/>
+ <spacer flex="1"/>
+ </hbox>
+ <menulist id="chatNotificationInfo" preference="mail.chat.notification_info">
+ <menupopup>
+ <menuitem label="&completeNotification.label;" value="0"/>
+ <menuitem label="&buddyInfoOnly.label;" value="1"/>
+ <menuitem label="&dummyNotification.label;" value="2"/>
+ </menupopup>
+ </menulist>
+ </hbox>
+ <hbox align="center">
+ <checkbox id="chatNotification"
+ label="&chatSound.label;"
+ accesskey="&chatSound.accesskey;"
+ preference="mail.chat.play_sound"
+ oncommand="gChatPane.updatePlaySound();"/>
+ <spacer flex="1"/>
+ <button id="playChatSound" label="&play.label;" accesskey="&play.accesskey;"
+ oncommand="gChatPane.previewSound();"/>
+ </hbox>
+ <radiogroup id="chatSoundType"
+ class="indent"
+ orient="vertical"
+ preference="mail.chat.play_sound.type"
+ oncommand="gChatPane.updatePlaySound();"
+ aria-labelledby="chatNotification">
+ <hbox>
+ <radio id="chatSoundSystemSound"
+ label="&systemSound.label;"
+ value="0"
+ accesskey="&systemSound.accesskey;"/>
+ <spacer flex="1"/>
+ </hbox>
+ <hbox>
+ <radio id="chatSoundCustom"
+ label="&customsound.label;"
+ value="1"
+ accesskey="&customsound.accesskey;"/>
+ <spacer flex="1"/>
+ </hbox>
+ <hbox>
+ <filefield id="chatSoundUrlLocation"
+ class="indent"
+ readonly="true"
+ preference="mail.chat.play_sound.url"
+ preference-editable="true"
+ onsyncfrompreference="return gChatPane.readSoundLocation();"
+ aria-labelledby="chatSoundCustom"
+ flex="1"/>
+ <button id="browseForChatSound"
+ label="&browse.label;"
+ accesskey="&browse.accesskey;"
+ oncommand="gChatPane.browseForSoundFile();">
+ <observes element="chatSoundUrlLocation" attribute="disabled"/>
+ </button>
+ </hbox>
+ </radiogroup>
+ </groupbox>
+ </tabpanel>
+
+ <tabpanel orient="vertical">
+
+ <hbox align="baseline">
+ <label value="&messageStyleTheme.label;" control="themename"
+ accesskey="&messageStyleTheme.accesskey;"/>
+ <menulist id="messagestyle-themename"
+ flex="1" crop="end"
+ preference="messenger.options.messagesStyle.theme"
+ onselect="previewObserver.currentThemeChanged();">
+ <menupopup id="theme-menupopup">
+ <menuitem id="mail-menuitem"
+ label="&messageStyleThunderbirdTheme.label;"
+ value="mail"/>
+ <menuitem id="bubbles-menuitem"
+ label="&messageStyleBubblesTheme.label;"
+ value="bubbles"/>
+ <menuitem id="dark-menuitem"
+ label="&messageStyleDarkTheme.label;"
+ value="dark"/>
+ <menuitem id="papersheets-menuitem"
+ label="&messageStylePaperSheetsTheme.label;"
+ value="papersheets"/>
+ <menuitem id="simple-menuitem"
+ label="&messageStyleSimpleTheme.label;"
+ value="simple"/>
+ </menupopup>
+ </menulist>
+ </hbox>
+ <separator class="thin"/>
+ <label value="&messageStylePreview.label;"/>
+ <tooltip id="aHTMLTooltip" page="true"/>
+ <deck flex="1" id="previewDeck" selectedIndex="1">
+ <vbox flex="1" id="noPreviewScreen" align="center" pack="center">
+ <hbox id="noPreviewBox" align="top">
+ <vbox id="noPreviewInnerBox" flex="1">
+ <label id="noPreviewTitle" value="&messageStyleNoPreview.title;"/>
+ <description id="noAccountDesc">&messageStyleNoPreview.description;</description>
+ </vbox>
+ </hbox>
+ </vbox>
+ <browser flex="1" id="previewbrowser" type="content"
+ style="-moz-binding: url(chrome://chat/content/convbrowser.xml#browser)"
+ tooltip="aHTMLTooltip"/>
+ </deck>
+ <hbox align="baseline">
+ <label value="&messageStyleVariant.label;" control="themevariant"
+ accesskey="&messageStyleVariant.accesskey;"/>
+ <menulist id="themevariant"
+ preference="messenger.options.messagesStyle.variant"
+ onselect="previewObserver.currentVariantChanged();"/>
+ </hbox>
+ <checkbox id="showHeaderCheckbox" label="&messageStyleShowHeader.label;"
+ accesskey="&messageStyleShowHeader.accesskey;"
+ preference="messenger.options.messagesStyle.showHeader"/>
+
+ </tabpanel>
+ </tabpanels>
+ </tabbox>
+
</prefpane>
</overlay>
--- a/mail/components/preferences/jar.mn
+++ b/mail/components/preferences/jar.mn
@@ -13,16 +13,17 @@ messenger.jar:
content/messenger/preferences/general.js
#ifdef XP_MACOSX
content/messenger/preferences/dockoptions.xul
#endif
content/messenger/preferences/display.xul
content/messenger/preferences/display.js
content/messenger/preferences/chat.xul
content/messenger/preferences/chat.js
+ content/messenger/preferences/messagestyle.js
* content/messenger/preferences/colors.xul
content/messenger/preferences/compose.xul
content/messenger/preferences/compose.js
content/messenger/preferences/privacy.xul
content/messenger/preferences/privacy.js
* content/messenger/preferences/sendoptions.xul
content/messenger/preferences/sendoptions.js
content/messenger/preferences/security.xul
copy from im/content/preferences/messagestyle.js
copy to mail/components/preferences/messagestyle.js
--- a/im/content/preferences/messagestyle.js
+++ b/mail/components/preferences/messagestyle.js
@@ -1,14 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var jsProtoHelper = {};
-Components.utils.import("resource:///modules/jsProtoHelper.jsm", jsProtoHelper);
+Cu.import("resource:///modules/jsProtoHelper.jsm", jsProtoHelper);
+Cu.import("resource:///modules/imThemes.jsm");
function Conversation(aName) {
this._name = aName;
this._observers = [];
let now = new Date();
this._date = new Date(now.getFullYear(), now.getMonth(), now.getDate(),
10, 42, 22) * 1000;
}
@@ -28,18 +29,16 @@ Message.prototype = {
};
// Message style tooltips use this.
function getBrowser() { return document.getElementById("previewbrowser"); }
var previewObserver = {
_loaded: false,
load: function() {
- gThemePane.buildThemeList("messagestyle");
-
let makeDate = function(aDateString) {
let array = aDateString.split(":");
let now = new Date();
return (new Date(now.getFullYear(), now.getMonth(), now.getDate(),
array[0], array[1], array[2])) / 1000;
};
let bundle = document.getElementById("themesBundle");
let msg = {};
@@ -140,17 +139,17 @@ var previewObserver = {
popup.appendChild(menuitem);
}
});
this._ignoreVariantChange = true;
if (!this._loaded)
menulist.value = this.theme.variant = menulist.value;
else {
menulist.value = this.theme.variant; // (reset to "default")
- document.getElementById("paneThemes").userChangedValue(menulist);
+ document.getElementById("paneChat").userChangedValue(menulist);
}
this._ignoreVariantChange = false;
// disable the variant menulist if there's no variant, or only one
// which is the default
menulist.disabled = variants.length == 0 ||
variants.length == 1 && defaultVariant;
--- a/mail/locales/en-US/chrome/messenger/preferences/chat.dtd
+++ b/mail/locales/en-US/chrome/messenger/preferences/chat.dtd
@@ -1,12 +1,14 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<!ENTITY generalTab.label "General">
+
<!ENTITY startupAction.label "When &brandShortName; starts:">
<!ENTITY startupAction.accesskey "s">
<!ENTITY startupOffline.label "Keep my Chat Accounts offline">
<!ENTITY startupConnectAuto.label "Connect my chat accounts automatically">
<!-- LOCALIZATION NOTE: reportIdleAfter.label is displayed first, then
there's a field where the user can enter a number, and itemTime is
displayed at the end of the line. The translations of the
@@ -35,8 +37,24 @@ sentence. -->
<!ENTITY play.accesskey "P">
<!ENTITY systemSound.label "Default system sound for new mail">
<!ENTITY systemSound.accesskey "D">
<!ENTITY customsound.label "Use the following sound file">
<!ENTITY customsound.accesskey "U">
<!ENTITY browse.label "Browse…">
<!ENTITY browse.accesskey "B">
+<!ENTITY messageStyleTab.title "Message Styles">
+<!ENTITY messageStylePreview.label "Preview:">
+<!ENTITY messageStyleTheme.label "Theme:">
+<!ENTITY messageStyleTheme.accesskey "T">
+<!ENTITY messageStyleThunderbirdTheme.label "Thunderbird">
+<!ENTITY messageStyleBubblesTheme.label "Bubbles">
+<!ENTITY messageStyleDarkTheme.label "Dark">
+<!ENTITY messageStylePaperSheetsTheme.label "Paper Sheets">
+<!ENTITY messageStyleSimpleTheme.label "Simple">
+<!ENTITY messageStyleDefaultTheme.label "Default">
+<!ENTITY messageStyleVariant.label "Variant:">
+<!ENTITY messageStyleVariant.accesskey "V">
+<!ENTITY messageStyleShowHeader.label "Show Header">
+<!ENTITY messageStyleShowHeader.accesskey "H">
+<!ENTITY messageStyleNoPreview.title "No preview available">
+<!ENTITY messageStyleNoPreview.description "This theme is not valid or is currently unavailable (disabled addon, safe-mode, …).">
copy from im/locales/en-US/chrome/instantbird/preferences/themes.properties
copy to mail/locales/en-US/chrome/messenger/preferences/messagestyle.properties
--- a/im/locales/en-US/chrome/instantbird/preferences/themes.properties
+++ b/mail/locales/en-US/chrome/messenger/preferences/messagestyle.properties
@@ -1,18 +1,13 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-# Labels for disabled or incompatible themes in the dropdown boxes
-# Used for both the message style themes and emoticon themes
-disabled=(disabled)
-incompatible=(incompatible)
-
-# Content of preview conversation for message styles
+# Content of preview conversation for chat message styles
default=Default
nick1=Florian
buddy1=florian@im.instantbird.org
-nick2=Dan
-buddy2=dan@im.instantbird.org
+nick2=Patrick
+buddy2=patrick@im.instantbird.org
message1=Hi! :-)
message2=What's up?
-message3=I'm trying Instantbird! ;-)
+message3=I'm trying Thunderbird! ;-)
--- a/mail/locales/jar.mn
+++ b/mail/locales/jar.mn
@@ -154,16 +154,17 @@
locale/@AB_CD@/messenger/preferences/preferences.dtd (%chrome/messenger/preferences/preferences.dtd)
locale/@AB_CD@/messenger/preferences/general.dtd (%chrome/messenger/preferences/general.dtd)
#ifdef XP_MACOSX
locale/@AB_CD@/messenger/preferences/dockoptions.dtd (%chrome/messenger/preferences/dockoptions.dtd)
#endif
locale/@AB_CD@/messenger/preferences/display.dtd (%chrome/messenger/preferences/display.dtd)
locale/@AB_CD@/messenger/preferences/colors.dtd (%chrome/messenger/preferences/colors.dtd)
locale/@AB_CD@/messenger/preferences/chat.dtd (%chrome/messenger/preferences/chat.dtd)
+ locale/@AB_CD@/messenger/preferences/messagestyle.properties (%chrome/messenger/preferences/messagestyle.properties)
locale/@AB_CD@/messenger/preferences/compose.dtd (%chrome/messenger/preferences/compose.dtd)
locale/@AB_CD@/messenger/preferences/privacy.dtd (%chrome/messenger/preferences/privacy.dtd)
locale/@AB_CD@/messenger/preferences/sendoptions.dtd (%chrome/messenger/preferences/sendoptions.dtd)
locale/@AB_CD@/messenger/preferences/security.dtd (%chrome/messenger/preferences/security.dtd)
locale/@AB_CD@/messenger/preferences/advanced.dtd (%chrome/messenger/preferences/advanced.dtd)
locale/@AB_CD@/messenger/preferences/attachmentReminder.dtd (%chrome/messenger/preferences/attachmentReminder.dtd)
locale/@AB_CD@/messenger/preferences/receipts.dtd (%chrome/messenger/preferences/receipts.dtd)
locale/@AB_CD@/messenger/preferences/connection.dtd (%chrome/messenger/preferences/connection.dtd)