aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/floatergridmanager.h
blob: 55517f5b51805561e5a5e120dc058f85a919677a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 *  floatergridmanager.h
 *  This is Meerkats grid manager.
 *  -Patrick Sapinski (Monday, August 17, 2009)
 *
 *  Modified by McCabe Maxsted for Imprudence
 */

#ifndef PL_floaterlogin_H
#define PL_floaterlogin_H

#define LOGIN_OPTION_CONNECT 0
#define LOGIN_OPTION_QUIT 1

#include "llfloater.h"

class LoginController;
class AuthenticationModel;

class FloaterGridManager : public LLFloater, public LLFloaterSingleton<FloaterGridManager>
{
public:
	FloaterGridManager(const LLSD& key);
	virtual ~FloaterGridManager();
	
	/*virtual*/ BOOL postBuild();

	static void refreshGrids();
	void apply();
	//void setDefault();
	void cancel();

	void clearInfo();

	virtual void draw();

	void refresh();

	// new-style login methods
	virtual std::string& getPassword();
	virtual void setPassword(std::string &password);
	virtual bool isSamePassword(std::string &password);
	static void getFields(std::string &loginname, std::string &password,
						  BOOL &remember);
	static void setFields(const std::string &loginname, const std::string &password,
						  BOOL remember);
	
	// LLLoginPanel compatibility
	/*static void setAlwaysRefresh(bool refresh);
	static void refreshLocation(bool force_visible);
	virtual void setFocus(BOOL b);
	static void giveFocus();*/
	static void getLocation(std::string &location);
	static BOOL isGridComboDirty();
	//static void addServer(const std::string& server, S32 domain_name);
	static void hashPassword(const std::string& password, std::string& hashedPassword);
protected:
	static bool sIsInitialLogin;
	static std::string sGrid;
private:
	enum State 
	{ 
		NORMAL, 
		ADD_NEW, 
		ADD_COPY 
	};

	State mState;
	void setState(const State& state) { mState = state; }
	State getState() { return mState; }

	std::string mCurGrid;
	void setCurGrid(const std::string& grid) { mCurGrid = grid; }
	std::string getCurGrid() { return mCurGrid; }

	std::string mIncomingPassword;
	std::string mMungedPassword;
	
	void applyChanges();
	bool createNewGrid();
	void update();
	void retrieveGridInfo();

	static void onSelectGrid(LLUICtrl* ctrl, void* data);
	static void onClickDelete(void* data);
	static void onClickAdd(void* data);
	static void onClickCopy(void* data);
	static void onClickOk(void* data);
	static void onClickApply(void* data);
	static void onClickDefault(void* data);
	static void onClickGridInfo(void* data);
	static void onClickCancel(void* data);
	static void onClickClear(void* data);

	static LoginController* sController;
	static AuthenticationModel* sModel;
};

#endif // PL_floaterlogin_H