diff options
author | James Cook <james@lindenlab.com> | 2007-01-02 08:33:20 +0000 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2007-01-02 08:33:20 +0000 |
commit | 420b91db29485df39fd6e724e782c449158811cb (patch) | |
tree | b471a94563af914d3ed3edd3e856d21cb1b69945 /indra/newview/llconfirmationmanager.cpp |
Print done when done.
Diffstat (limited to 'indra/newview/llconfirmationmanager.cpp')
-rw-r--r-- | indra/newview/llconfirmationmanager.cpp | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/indra/newview/llconfirmationmanager.cpp b/indra/newview/llconfirmationmanager.cpp new file mode 100644 index 0000000000..e47fcde225 --- /dev/null +++ b/indra/newview/llconfirmationmanager.cpp @@ -0,0 +1,100 @@ +/** + * @file llconfirmationmanager.cpp + * @brief LLConfirmationManager class implementation + * + * Copyright (c) 2006-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llconfirmationmanager.h" + +#include "lluictrlfactory.h" + +// viewer includes +#include "llviewerwindow.h" +#include "lllineeditor.h" +#include "llstring.h" + +LLConfirmationManager::ListenerBase::~ListenerBase() +{ +} + + +static void onConfirmAlert(S32 option, void* data) +{ + LLConfirmationManager::ListenerBase* listener + = (LLConfirmationManager::ListenerBase*)data; + + if (option == 0) + { + listener->confirmed(""); + } + + delete listener; +} + +static void onConfirmAlertPassword( + S32 option, const LLString& text, void* data) +{ + LLConfirmationManager::ListenerBase* listener + = (LLConfirmationManager::ListenerBase*)data; + + if (option == 0) + { + listener->confirmed(text); + } + + delete listener; +} + + +void LLConfirmationManager::confirm(Type type, + const std::string& action, + ListenerBase* listener) +{ + LLString::format_map_t args; + args["[ACTION]"] = action; + + switch (type) + { + case TYPE_CLICK: + gViewerWindow->alertXml("ConfirmPurchase", args, + onConfirmAlert, listener); + break; + + case TYPE_PASSWORD: + gViewerWindow->alertXmlEditText("ConfirmPurchasePassword", args, + NULL, NULL, + onConfirmAlertPassword, listener, + LLString::format_map_t(), + TRUE); + break; + case TYPE_NONE: + default: + listener->confirmed(""); + break; + } +} + + +void LLConfirmationManager::confirm( + const std::string& type, + const std::string& action, + ListenerBase* listener) +{ + Type decodedType = TYPE_NONE; + + if (type == "click") + { + decodedType = TYPE_CLICK; + } + else if (type == "password") + { + decodedType = TYPE_PASSWORD; + } + + confirm(decodedType, action, listener); +} + |