Bug 954845 - Get rid of the status bar: Port bug 1084109 from TB and replace current status bar usage. r=clokep
authoraleth <aleth@instantbird.org>
Sat, 08 Nov 2014 02:27:51 +0100
changeset 17036 d351cea9d237b46a1aa56400f4219611b31b8f3f
parent 17035 a13012cd179d9bf5444f52a1c490bddb114617ba
child 17037 f333d6ce03ca6875cf747e5d3f2902abb094f9d9
push id10566
push userclokep@gmail.com
push dateSat, 08 Nov 2014 02:43:44 +0000
treeherdercomm-central@d351cea9d237 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersclokep
bugs954845, 1084109
Bug 954845 - Get rid of the status bar: Port bug 1084109 from TB and replace current status bar usage. r=clokep
im/content/conversation.xml
im/themes/conversation.css
im/themes/instantbird-aero.css
im/themes/instantbird.css
--- a/im/content/conversation.xml
+++ b/im/content/conversation.xml
@@ -43,16 +43,19 @@
             <xul:listbox anonid="nicklist" class="conv-nicklist"
                          flex="1" seltype="multiple"
                          xbl:inherits="contextmenu=contentcontextmenu"
                          tooltip="imTooltip"
                          onclick="onNickClick(event);"
                          onkeypress="onNicklistKeyPress(event);"/>
           </xul:vbox>
         </xul:hbox>
+        <hbox anonid="convStatusContainer" class="conv-status-container" hidden="true">
+          <xul:description anonid="convStatus" class="conv-status" crop="end" />
+        </hbox>
         <xul:splitter class="splitter splitter-bottom" anonid="splitter-bottom"/>
         <xul:stack anonid="conv-bottom" class="conv-bottom">
           <xul:textbox anonid="inputBox" class="conv-textbox" multiline="true" flex="1"/>
           <xul:description anonid="charCounter" class="conv-counter" value=""
                            right="0" bottom="0"/>
         </xul:stack>
       </xul:vbox>
     </content>
@@ -188,20 +191,16 @@
           if (this._readCount)
             this._writingContextMessages = true;
           messages.forEach(this.addMsg.bind(this));
           delete this._writingContextMessages;
         ]]>
         </body>
       </method>
 
-      <field name="_statusText">""</field>
-      <field name="_statusTextEnd">""</field>
-      <field name="_statusTextEndIsError">false</field>
-
       <method name="addMsg">
         <parameter name="aMsg"/>
         <body>
         <![CDATA[
           if (!this.loaded)
             throw "Calling addMsg before the browser is ready?";
 
           var conv = aMsg.conversation;
@@ -879,29 +878,28 @@
             // 200 is a 'magic' constant to avoid showing big numbers.
             charCounter.setAttribute("value", (left < 200 ? left : ""));
 
             if (left >= 0)
               inputBox.removeAttribute("invalidInput");
             else if (left < 0)
               inputBox.setAttribute("invalidInput", "true");
           }
-          this.displayStatusText();
         ]]>
         </body>
       </method>
 
       <method name="resetInput">
         <body>
         <![CDATA[
           var inputBox = this.editor;
           inputBox.value = "";
-          this._statusTextEnd = "";
-          this._statusTextEndIsError = false;
+          this._statusText = "";
           this.displayStatusText();
+          this.updateTyping();
 
           let overflow = "";
           if (TextboxSize.autoResize) {
             let currHeight = parseInt(inputBox.parentNode.height);
             if (inputBox.defaultHeight + this._TEXTBOX_VERTICAL_OVERHEAD > currHeight)
               inputBox.defaultHeight = currHeight - this._TEXTBOX_VERTICAL_OVERHEAD;
             this.getElt("conv-bottom").height =
               inputBox.defaultHeight + this._TEXTBOX_VERTICAL_OVERHEAD;
@@ -1485,16 +1483,17 @@
         ]]>
         </body>
       </method>
 
       <method name="onSelect">
         <body>
         <![CDATA[
           this.displayStatusText();
+          this.updateTyping();
           if (!this.loaded)
             return;
 
           this.tab.removeAttribute("unread");
           this.tab.removeAttribute("attention");
           this._conv.markAsRead();
         ]]>
         </body>
@@ -1619,57 +1618,60 @@
             window.openDialog("chrome://instantbird/content/viewlog.xul",
                               "Logs", "chrome,resizable", {logs: aLogs},
                               this.conv.title);
           });
         ]]>
         </body>
       </method>
 
+      <field name="_statusText">""</field>
       <method name="displayStatusText">
         <body>
         <![CDATA[
           if (!this.tab.selected)
             return;
-
-          if ("XULBrowserWindow" in window) {
-            window.XULBrowserWindow.setStatus(this._statusText);
-            if ("setStatusEnd" in window.XULBrowserWindow)
-              window.XULBrowserWindow.setStatusEnd(this._statusTextEnd,
-                                                   this._statusTextEndIsError);
-          }
+          let convStatusContainer = this.getElt("convStatusContainer");
+          let convStatus = this.getElt("convStatus");
+          convStatus.value = this._statusText;
+          if (this._statusText.length)
+            convStatusContainer.removeAttribute("hidden");
+          else
+            convStatusContainer.setAttribute("hidden", "true");
         ]]>
         </body>
       </method>
 
       <method name="updateTyping">
         <body>
         <![CDATA[
-           var typingState = this._conv.typingState;
-           if (typingState == this.typingState)
-             return;
+          let typingState = this._conv.typingState;
+          if (typingState == this.typingState)
+            return;
 
-           this.tab.removeAttribute("typing");
-           this.tab.removeAttribute("typed");
-           this._statusText = "";
+          this.tab.removeAttribute("typing");
+          this.tab.removeAttribute("typed");
 
-           var name = this._conv.title.replace(/^([a-zA-Z0-9.]+)[@\s].*/, "$1");
-           if (typingState == Ci.prplIConvIM.TYPING) {
-             this.tab.setAttribute("typing", "true");
-             this._statusText = this.bundle.formatStringFromName("isTyping",
-                                                                 [name], 1);
-           }
-           else if (typingState == Ci.prplIConvIM.TYPED) {
-             this.tab.setAttribute("typed", "true");
-             this._statusText = this.bundle.formatStringFromName("hasStoppedTyping",
-                                                                 [name], 1);
-           }
+          let typingText = "";
+          var name = this._conv.title.replace(/^([a-zA-Z0-9.]+)[@\s].*/, "$1");
+          if (typingState == Ci.prplIConvIM.TYPING) {
+            this.tab.setAttribute("typing", "true");
+            typingText = this.bundle.formatStringFromName("isTyping", [name], 1);
+          }
+          else if (typingState == Ci.prplIConvIM.TYPED) {
+            this.tab.setAttribute("typed", "true");
+            typingText =
+              this.bundle.formatStringFromName("hasStoppedTyping", [name], 1);
+          }
+          this.typingState = typingState;
 
-           this.typingState = typingState;
-           this.displayStatusText();
+          // Use browser URL popups for a more lightweight typing text display
+          // than displayStatusText provides.
+          if (this.tab.selected && "XULBrowserWindow" in window)
+            window.XULBrowserWindow.setOverLink(typingText, null);
         ]]>
         </body>
       </method>
 
       <method name="getElt">
         <parameter name="aAnonId"/>
         <body>
         <![CDATA[
@@ -1706,18 +1708,18 @@
             let buddy = this._conv.buddy;
             if (!buddy || !buddy.account.connected) {
               this.tab.removeAttribute("status");
 
               // This is ugly, but when an account gets disconnected libpurple
               // doesn't reset the typing state... :(
               this.tab.removeAttribute("typing");
               this.tab.removeAttribute("typed");
-              this._statusText = "";
-              this.displayStatusText();
+              this.typingState = Ci.prplIConvIM.NOT_TYPING;
+              this.updateTyping();
             }
             else {
               displayName = buddy.displayName;
               statusText = buddy.statusText;
               statusType = buddy.statusType;
               this.tab.setAttribute("status", Status.toAttribute(statusType));
               cti.setAttribute("userIcon", buddy.buddyIconFilename);
             }
--- a/im/themes/conversation.css
+++ b/im/themes/conversation.css
@@ -5,18 +5,22 @@
 .browser {
   margin: 0 0;
 }
 
 .conv-bottom, .conv-nicklist {
   margin: 0 0;
 }
 
+.convBox {
+  min-height: 135px;
+}
+
 .conv-top {
-  min-height: 115px;
+  min-height: 60px;
 }
 
 .conv-top-info {
   margin: 0 0;
   padding: 0 0;
   border-style: none;
   -moz-appearance: none;
 %ifdef XP_MACOSX
@@ -255,16 +259,43 @@
 
 %ifndef XP_MACOSX
 .conv-messages[chat] {
   border-right: solid 1px GrayText;
 }
 %endif
 
 
+/* Status text bar */
+
+.conv-status-container {
+  display: block;
+  padding: 3px;
+  padding-bottom: 1px;
+  margin-bottom: -2px; /* match splitter-bottom height */
+%ifdef XP_MACOSX
+  border-top: 1px solid GrayText;
+%endif
+
+  /* Animation copied from the findbar in Firefox */
+  transition-property: margin-top, opacity, visibility;
+  transition-duration: 100ms, 100ms, 0s;
+  transition-timing-function: ease-in-out, ease-in-out, linear;
+}
+
+.conv-status-container[hidden] {
+  /* Override display:none to make the transition work. */
+  display: -moz-box;
+  visibility: collapse;
+  margin-top: -1em;
+  opacity: 0;
+  transition-delay: 0s, 0s, 100ms;
+}
+
+
 /* Input box */
 
 .conv-textbox {
   margin: 0;
 }
 
 %ifdef XP_MACOSX
 .conv-textbox {
--- a/im/themes/instantbird-aero.css
+++ b/im/themes/instantbird-aero.css
@@ -19,23 +19,16 @@
   }
   #convWindow:-moz-system-metric(windows-default-theme):-moz-window-inactive {
     background-color: rgb(215, 228, 242);
   }
 }
 
 /* Use for both Aero themes. */
 @media all and (-moz-windows-theme: aero) {
-  #convWindow-statusbar {
-    -moz-appearance: none;
-    border-radius: 0 0 5px 5px;
-    border: 1px solid rgba(0, 0, 0, 0.25);
-    background: rgba(255, 255, 255, 0.8);
-  }
-
   #statusbar-display {
     -moz-appearance: none;
     border-radius: 0 0 5px 5px;
     border: none;
     background: transparent;
   }
 
   #conversations {
--- a/im/themes/instantbird.css
+++ b/im/themes/instantbird.css
@@ -24,25 +24,16 @@ statusbar {
 
 %ifdef XP_WIN
 statusbarpanel {
   -moz-appearance: none;
   border: none;
 }
 %endif
 
-#statusbar-display-end > .statusbarpanel-text {
-  -moz-margin-end: 0;
-}
-
-#statusbar-display-end[error] {
-  color: red;
-  font-weight: bold;
-}
-
 %ifndef XP_MACOSX
 notification > hbox {
   border: none !important;
   border-bottom: 1px solid ThreeDShadow !important;
 }
 %endif
 
 /* Tab colors */