From 9530b9d2b717d338af79108c60c2aa67e33ba6e5 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Fri, 1 Mar 2013 14:24:47 +0200 Subject: CHUI-694 FIXED Handle ALT + Up/Down and ALT + Right/Left to switch conversations in the list. Handle ALT + Enter to expand participant list of selected conversation. --- indra/llui/llfolderviewitem.cpp | 2 +- indra/newview/llfloaterimcontainer.cpp | 88 ++++++++++++++++++++++++++------- indra/newview/llfloaterimcontainer.h | 6 ++- indra/newview/llfloaterimnearbychat.cpp | 17 ++++++- indra/newview/llfloaterimsessiontab.cpp | 21 ++++++++ indra/newview/llfloaterimsessiontab.h | 2 +- indra/newview/llviewerwindow.cpp | 9 +++- 7 files changed, 121 insertions(+), 24 deletions(-) (limited to 'indra') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index f67c134751..fdb4108afb 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -2072,7 +2072,7 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it if (fit != fend) { // try selecting child element of this folder - if ((*fit)->isOpen()) + if ((*fit)->isOpen() && include_children) { result = (*fit)->getPreviousFromChild(NULL); } diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index f9f0173ec7..49c30e8768 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1339,25 +1339,14 @@ void LLFloaterIMContainer::selectConversation(const LLUUID& session_id) // Select the conversation *after* (or before if none after) the passed uuid conversation // Used to change the selection on key hits -void LLFloaterIMContainer::selectNextConversation(const LLUUID& uuid) +void LLFloaterIMContainer::selectNextConversationByID(const LLUUID& uuid) { - LLFolderViewItem* new_selection = NULL; - LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,uuid); - if (widget) + bool new_selection = false; + selectConversation(uuid); + new_selection = selectNextorPreviousConversation(true); + if (!new_selection) { - new_selection = mConversationsRoot->getNextFromChild(widget, FALSE); - if (!new_selection) - { - new_selection = mConversationsRoot->getPreviousFromChild(widget, FALSE); - } - } - if (new_selection) - { - LLConversationItem* vmi = dynamic_cast(new_selection->getViewModelItem()); - if (vmi) - { - selectConversationPair(vmi->getUUID(), true); - } + selectNextorPreviousConversation(false); } } @@ -1887,6 +1876,71 @@ bool LLFloaterIMContainer::isScrolledOutOfSight(LLConversationViewSession* conve return !mConversationsRoot->getVisibleRect().overlaps(widget_rect); } +BOOL LLFloaterIMContainer::handleKeyHere(KEY key, MASK mask ) +{ + if(mask == MASK_ALT) + { + if (KEY_RETURN == key ) + { + expandConversation(); + } + + if ((KEY_DOWN == key ) || (KEY_RIGHT == key)) + { + selectNextorPreviousConversation(true); + } + if ((KEY_UP == key) || (KEY_LEFT == key)) + { + selectNextorPreviousConversation(false); + } + } + return TRUE; +} + +bool LLFloaterIMContainer::selectNextorPreviousConversation(bool select_next) +{ + if (mConversationsWidgets.size() > 1) + { + LLFolderViewItem* new_selection = NULL; + LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,getSelectedSession()); + if (widget) + { + if(select_next) + { + new_selection = mConversationsRoot->getNextFromChild(widget, FALSE); + } + else + { + new_selection = mConversationsRoot->getPreviousFromChild(widget, FALSE); + } + if (new_selection) + { + LLConversationItem* vmi = dynamic_cast(new_selection->getViewModelItem()); + if (vmi) + { + selectConversationPair(vmi->getUUID(), true); + LLFloater* floaterp = get_ptr_in_map(mSessions, getSelectedSession()); + if(floaterp && !floaterp->isTornOff()) + { + setFocus(TRUE); + } + return true; + } + } + } + } + return false; +} + +void LLFloaterIMContainer::expandConversation() +{ + LLConversationViewSession* widget = dynamic_cast(get_ptr_in_map(mConversationsWidgets,getSelectedSession())); + if (widget) + { + widget->setOpen(!widget->isOpen()); + } +} + void LLFloaterIMContainer::closeFloater(bool app_quitting/* = false*/) { // Always unminimize before trying to close. diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index f1415cd2e6..c84d4978ec 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -69,9 +69,11 @@ public: void returnFloaterToHost(); void showConversation(const LLUUID& session_id); void selectConversation(const LLUUID& session_id); - void selectNextConversation(const LLUUID& session_id); + void selectNextConversationByID(const LLUUID& session_id); BOOL selectConversationPair(const LLUUID& session_id, bool select_widget, bool focus_floater = true); void clearAllFlashStates(); + bool selectNextorPreviousConversation(bool select_next); + void expandConversation(); /*virtual*/ void tabClose(); void showStub(bool visible); @@ -109,7 +111,7 @@ public: void doToParticipants(const std::string& item, uuid_vec_t& selectedIDS); void assignResizeLimits(); - + virtual BOOL handleKeyHere(KEY key, MASK mask ); /*virtual*/ void closeFloater(bool app_quitting = false); private: diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index a3b81e037a..02f54e76db 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -150,7 +150,7 @@ void LLFloaterIMNearbyChat::closeHostedFloater() { setVisible(FALSE); } - floater_container->selectNextConversation(LLUUID()); + floater_container->selectNextConversationByID(LLUUID()); } } @@ -354,6 +354,21 @@ BOOL LLFloaterIMNearbyChat::handleKeyHere( KEY key, MASK mask ) handled = TRUE; } + if((mask == MASK_ALT) && isTornOff()) + { + LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance(); + if ((KEY_UP == key) || (KEY_LEFT == key)) + { + floater_container->selectNextorPreviousConversation(false); + handled = TRUE; + } + if ((KEY_DOWN == key ) || (KEY_RIGHT == key)) + { + floater_container->selectNextorPreviousConversation(true); + handled = TRUE; + } + } + return handled; } diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 6dbcdb4474..47744b6ba0 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -918,3 +918,24 @@ LLConversationItem* LLFloaterIMSessionTab::getCurSelectedViewModelItem() return conversationItem; } + +BOOL LLFloaterIMSessionTab::handleKeyHere(KEY key, MASK mask ) +{ + if(mask == MASK_ALT) + { + LLFloaterIMContainer* floater_container = LLFloaterIMContainer::getInstance(); + if (KEY_RETURN == key && !isTornOff()) + { + floater_container->expandConversation(); + } + if ((KEY_UP == key) || (KEY_LEFT == key)) + { + floater_container->selectNextorPreviousConversation(false); + } + if ((KEY_DOWN == key ) || (KEY_RIGHT == key)) + { + floater_container->selectNextorPreviousConversation(true); + } + } + return TRUE; +} diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index e90fcbb806..b52bdfd8cd 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -95,8 +95,8 @@ public: void initBtns(); virtual void updateMessages() {} LLConversationItem* getCurSelectedViewModelItem(); - void forceReshape(); + virtual BOOL handleKeyHere( KEY key, MASK mask ); protected: diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index e6e93d81bc..e44a2cc4df 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2515,7 +2515,9 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) { // let Control-Up and Control-Down through for chat line history, if (!(key == KEY_UP && mask == MASK_CONTROL) - && !(key == KEY_DOWN && mask == MASK_CONTROL)) + && !(key == KEY_DOWN && mask == MASK_CONTROL) + && !(key == KEY_UP && mask == MASK_ALT) + && !(key == KEY_DOWN && mask == MASK_ALT)) { switch(key) { @@ -2607,7 +2609,10 @@ BOOL LLViewerWindow::handleUnicodeChar(llwchar uni_char, MASK mask) if ((uni_char == 13 && mask != MASK_CONTROL) || (uni_char == 3 && mask == MASK_NONE)) { - return gViewerKeyboard.handleKey(KEY_RETURN, mask, gKeyboard->getKeyRepeated(KEY_RETURN)); + if (mask != MASK_ALT) + { + return gViewerKeyboard.handleKey(KEY_RETURN, mask, gKeyboard->getKeyRepeated(KEY_RETURN)); + } } // let menus handle navigation (jump) keys -- cgit v1.2.3