Closed Bug 954705 Opened 10 years ago Closed 10 years ago

Pressing "Enter" on a participant in the list doesn't start a private chat

Categories

(Instantbird Graveyard :: Conversation, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: benediktp, Assigned: benediktp)

References

Details

Attachments

(1 file)

*** Original post on bio 1274 at 2012-02-16 13:18:00 UTC ***

Trying to start a direct conversation from the participant list by pressing "Enter" on a participant does nothing (double clicking is working).

Expected result: "Enter" should start a direct conversation.
*** Original post on bio 1274 by Peter Vagner <pvdeejay AT gmail.com> at 2012-03-09 17:26:03 UTC ***

in the file chrome/instantbird/content/instantbird/conversation.xml is a method called onNicklistKeyPress.
Change the method as follows:

     <method name="onNicklistKeyPress">
      <parameter name="event"/>
      <body>
      <![CDATA[
        if ((event.keyCode != event.DOM_VK_RETURN) && (event.keyCode != event.DOM_VK_ENTER))
          return;

        // Return is pressed
        var conv = document.getBindingParent(this);
        var listbox = event.originalTarget;
        for (var i = 0; i < listbox.selectedCount; ++i) {
          var nick = listbox.getSelectedItem(i).chatBuddy.name;
          let name = this._conv.target.getNormalizedChatBuddyName(nick);
          let newConv = this._conv.account.createConversation(name);
          Conversations.focusConversation(newConv);
        }
      ]]>
      </body>
     </method>

Please note this is also verry simple tweak and greatly affects accessibility. If you can please review, fix and commit as soon as possible.
*** Original post on bio 1274 by Peter Vagner <pvdeejay AT gmail.com> at 2012-03-09 19:47:50 UTC ***

btw bug 954578 (bio 1145) is duplicate of this one or this one is a duplicate of bug 954578 (bio 1145).
I've been warned about some edge cases via IRC, and I've attempted to address these.
It is now possible to select multiple nicks in the participants list and hit enter key to open all the conversations. The most recent conversation is given the focus in such case.
When nothing is selected nothing happens.

here's the updated method...

     <method name="onNicklistKeyPress">
      <parameter name="event"/>
      <body>
      <![CDATA[
        if ((event.keyCode != event.DOM_VK_RETURN) && (event.keyCode != event.DOM_VK_ENTER))
          return;

        // Return is pressed
        var conv = document.getBindingParent(this);
        var listbox = event.originalTarget;
        var selectedCount =listbox.selectedCount;
        if (selectedCount ==0)
          return;
        for (var i = 0; i < selectedCount; ++i) {
          var nick = listbox.getSelectedItem(i).chatBuddy.name;
          let name = this._conv.target.getNormalizedChatBuddyName(nick);
          let newConv = this._conv.account.createConversation(name);
        }
        Conversations.focusConversation(newConv);
      ]]>
      </body>
     </method>
Attached patch Patch v1Splinter Review
*** Original post on bio 1274 as attmnt 1238 at 2012-03-09 22:10:00 UTC ***

This is Peter Vagner's code turned into a patch with some additional changes. Maybe we could remove some of the code duplication that exists with the |onNickClick| method but I doubt it would give us less lines of code since the xml notation of these methods is so lengthy.

Requesting review from clokep, since flo's review queue seems rather long.
Attachment #8352991 - Flags: review?(clokep)
Assignee: nobody → benediktp
Comment on attachment 8352991 [details] [diff] [review]
Patch v1

*** Original change on bio 1274 attmnt 1238 at 2012-03-09 22:27:22 UTC ***

This looks good, thanks for cleaning this bit up. Please file another bug to clean up this code. :)
Attachment #8352991 - Flags: review?(clokep) → review+
Status: NEW → ASSIGNED
*** Original post on bio 1274 at 2012-03-12 23:53:17 UTC ***

Committed as http://hg.instantbird.org/instantbird/rev/ddaca8093e6d

Thanks for fixing this! :)
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.2
You need to log in before you can comment on or make changes to this bug.