summaryrefslogtreecommitdiff
path: root/plugins/CloudFile/src/oauth.cpp
blob: 7815c277719e1dc96c238a42ac4bae128500e093 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "stdafx.h"

COAuthDlg::COAuthDlg(CCloudService *service, const char *authUrl, pThreadFuncOwner requestAccessTokenThread)
	: CDlgBase(hInstance, IDD_OAUTH), m_service(service),
	m_requestAccessTokenThread(requestAccessTokenThread),
	m_auth(this, IDC_OAUTH_AUTHORIZE, authUrl),
	m_code(this, IDC_OAUTH_CODE), m_ok(this, IDOK)
{
	m_autoClose = CLOSE_ON_CANCEL;
	m_code.OnChange = Callback(this, &COAuthDlg::Code_OnChange);
	m_ok.OnClick = Callback(this, &COAuthDlg::Ok_OnClick);
}

void COAuthDlg::Code_OnChange(CCtrlBase*)
{
	ptrA requestToken(m_code.GetTextA());
	m_ok.Enable(mir_strlen(requestToken) != 0);
}

void COAuthDlg::Ok_OnClick(CCtrlButton*)
{
	mir_forkthreadowner(m_requestAccessTokenThread, m_service, m_hwnd);
}