From b203315c04220b16ab39cd4015aa888bfecb528b Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 13 Jan 2010 09:34:39 -0700 Subject: Created drop-down Profile button in IM window --- linden/indra/newview/llimpanel.cpp | 97 +++++++++++++++----- linden/indra/newview/llimpanel.h | 5 +- .../default/xui/da/floater_instant_message.xml | 2 +- .../default/xui/de/floater_instant_message.xml | 2 +- .../default/xui/en-us/floater_instant_message.xml | 21 +++-- .../xui/en-us/floater_instant_message_group.xml | 4 +- .../default/xui/es/floater_instant_message.xml | 100 ++++++++++----------- .../default/xui/fr/floater_instant_message.xml | 100 ++++++++++----------- .../default/xui/hu/floater_instant_message.xml | 2 +- .../default/xui/it/floater_instant_message.xml | 2 +- .../default/xui/ja/floater_instant_message.xml | 2 +- .../default/xui/ko/floater_instant_message.xml | 2 +- .../default/xui/pl/floater_instant_message.xml | 2 +- .../default/xui/pt/floater_instant_message.xml | 100 ++++++++++----------- .../default/xui/ru/floater_instant_message.xml | 2 +- .../default/xui/tr/floater_instant_message.xml | 2 +- .../default/xui/uk/floater_instant_message.xml | 2 +- .../default/xui/zh/floater_instant_message.xml | 2 +- 18 files changed, 254 insertions(+), 195 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp index a5950ce..5088343 100644 --- a/linden/indra/newview/llimpanel.cpp +++ b/linden/indra/newview/llimpanel.cpp @@ -47,6 +47,7 @@ #include "llbutton.h" #include "llcallingcard.h" #include "llchat.h" +#include "llcombobox.h" #include "llconsole.h" #include "llfloater.h" #include "llfloatergroupinfo.h" @@ -60,6 +61,7 @@ #include "llfloaterchat.h" #include "llkeyboard.h" #include "lllineeditor.h" +#include "llmenucommands.h" #include "llnotify.h" #include "llresmgr.h" #include "lltabcontainer.h" @@ -1080,6 +1082,7 @@ LLFloaterIMPanel::LLFloaterIMPanel( LLFloater(session_label, LLRect(), session_label), mInputEditor(NULL), mHistoryEditor(NULL), + mComboIM(NULL), mSessionUUID(session_id), mVoiceChannel(NULL), mSessionInitialized(FALSE), @@ -1296,7 +1299,17 @@ BOOL LLFloaterIMPanel::postBuild() mInputEditor->setRevertOnEsc( FALSE ); mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); - childSetAction("profile_callee_btn", onClickProfile, this); + // Profile combobox in floater_instant_message.xml + mComboIM = getChild("profile_callee_btn"); + mComboIM->setCommitCallback(onCommitCombo); + mComboIM->setCallbackUserData(this); + +#ifdef LL_WINDOWS + mComboIM->add(getString("history_entry")); +#endif + mComboIM->add(getString("pay_entry")); + mComboIM->add(getString("teleport_entry")); + childSetAction("group_info_btn", onClickGroupInfo, this); childSetAction("history_btn", onClickHistory, this); @@ -1304,7 +1317,6 @@ BOOL LLFloaterIMPanel::postBuild() childSetAction("end_call_btn", onClickEndCall, this); childSetAction("send_btn", onClickSend, this); childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this); - childSetAction("offer_tp_btn", onClickOfferTeleport, this); childSetAction("moderator_kick_speaker", onKickSpeaker, this); //LLButton* close_btn = getChild("close_btn"); @@ -1792,26 +1804,6 @@ void LLFloaterIMPanel::onTabClick(void* userdata) } // static -void LLFloaterIMPanel::onClickOfferTeleport(void* userdata) -{ - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - - handle_lure(self->mOtherParticipantUUID); -} - -// static -void LLFloaterIMPanel::onClickProfile( void* userdata ) -{ - // Bring up the Profile window - LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; - - if (self->mOtherParticipantUUID.notNull()) - { - LLFloaterAvatarInfo::showFromDirectory(self->getOtherParticipantID()); - } -} - -// static void LLFloaterIMPanel::onClickHistory( void* userdata ) { LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; @@ -1904,6 +1896,67 @@ void LLFloaterIMPanel::onCommitChat(LLUICtrl* caller, void* userdata) } // static +void LLFloaterIMPanel::onCommitCombo(LLUICtrl* caller, void* userdata) +{ + LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; + LLCtrlListInterface* options = self->mComboIM ? self->mComboIM->getListInterface() : NULL; + if (options) + { + S32 index = options->getFirstSelectedIndex(); + if (index < 0) + { + // Open profile or group window + if (self->mOtherParticipantUUID.notNull()) + { + LLFloaterAvatarInfo::showFromDirectory(self->getOtherParticipantID()); + } + return; + } + + std::string selected = self->mComboIM->getSelectedValue().asString(); + if (selected == self->getString("history_entry")) + { + if (self->mOtherParticipantUUID.notNull()) + { + struct stat fileInfo; + int result; + + std::string fullname = self->getTitle();; + //gCacheName->getFullName(self->mOtherParticipantUUID, fullname); + //if(fullname == "(Loading...)") + std::string file_path = gDirUtilp->getPerAccountChatLogsDir() + "\\" + fullname + ".txt"; + + // check if file exists by trying to get its attributes + result = stat(file_path.c_str(), &fileInfo); + if(result == 0) + { + char command[256]; + sprintf(command, "\"%s\\%s.txt\"", gDirUtilp->getPerAccountChatLogsDir().c_str(),fullname.c_str()); + gViewerWindow->getWindow()->ShellEx(command); + + llinfos << command << llendl; + } + else + { + LLSD args; + args["[NAME]"] = fullname; + LLNotifications::instance().add("IMLogNotFound", args); + llinfos << file_path << llendl; + } + } + } + else if (selected == self->getString("pay_entry")) + { + handle_pay_by_id(self->mOtherParticipantUUID); + } + else if (selected == self->getString("teleport_entry")) + { + handle_lure(self->mOtherParticipantUUID); + } + } +} + +// static void LLFloaterIMPanel::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata ) { LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata; diff --git a/linden/indra/newview/llimpanel.h b/linden/indra/newview/llimpanel.h index f3477bb..24f5c9b 100644 --- a/linden/indra/newview/llimpanel.h +++ b/linden/indra/newview/llimpanel.h @@ -47,6 +47,7 @@ class LLInventoryItem; class LLInventoryCategory; class LLIMSpeakerMgr; class LLPanelActiveSpeakers; +class LLComboBox; class LLVoiceChannel : public LLVoiceClientStatusObserver { @@ -228,12 +229,11 @@ public: static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata); static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata); static void onCommitChat(LLUICtrl* caller, void* userdata); + static void onCommitCombo(LLUICtrl* caller, void* userdata); static void onTabClick( void* userdata ); - static void onClickProfile( void* userdata ); static void onClickHistory( void* userdata ); static void onClickGroupInfo( void* userdata ); - static void onClickOfferTeleport( void* userdata ); static void onClickClose( void* userdata ); static void onClickStartCall( void* userdata ); static void onClickEndCall( void* userdata ); @@ -300,6 +300,7 @@ private: private: LLLineEditor* mInputEditor; LLViewerTextEditor* mHistoryEditor; + LLComboBox* mComboIM; // The value of the mSessionUUID depends on how the IM session was started: // one-on-one ==> random id diff --git a/linden/indra/newview/skins/default/xui/da/floater_instant_message.xml b/linden/indra/newview/skins/default/xui/da/floater_instant_message.xml index 13a7adf..9b695b5 100644 --- a/linden/indra/newview/skins/default/xui/da/floater_instant_message.xml +++ b/linden/indra/newview/skins/default/xui/da/floater_instant_message.xml @@ -33,7 +33,7 @@ Tekst chat er ikke tilgængeligt i dette opkald. -