aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/controllerpasswords.cpp
blob: 6e39d9adb942f3da060becbeaea0025b7bf647b5 (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
/*
 *  controllerpasswords.cpp
 *  SecondLife
 *
 *  Created by RMS on 8/5/08.
 *
 */

#include "authentication_model.h"
#include "prefpanelpasswords.h"
#include "controllerpasswords.h"

PasswordsController::PasswordsController(PasswordsPrefPanel *panel)
:	mPanel(panel)
{
	accounts_list = mPanel->getChild<LLScrollListCtrl>("accounts_list");
	remove_btn = mPanel->getChild<LLButton>("remove_btn");
	mModel = AuthenticationModel::getInstance();
	
	// subscribe to the model
	mModelConnection = mModel->subscribeToModelUpdates(boost::bind(&PasswordsController::update, this));
	// request an initial update
	mModel->requestUpdate();
}

PasswordsController::~PasswordsController()
{
	mModel->unsubscribe(mModelConnection);
	mModel = NULL;
}

void PasswordsController::update()
{
	std::list<std::string> newAccountData;
	mModel->getAllAccountNames(newAccountData);
	
	if(mAccountData == newAccountData)
		return;
	
	accounts_list->deleteAllItems();
}