nss: upgrade to release 3.73
[LibreOffice.git] / uui / source / authfallbackdlg.cxx
blobdaad28b77feb76b75331631d8cde9f2fc8a49cde
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include "authfallbackdlg.hxx"
12 AuthFallbackDlg::AuthFallbackDlg(weld::Window* pParent, const OUString& instructions,
13 const OUString& url)
14 : GenericDialogController(pParent, "uui/ui/authfallback.ui", "AuthFallbackDlg")
15 , m_bGoogleMode(false)
16 , m_xTVInstructions(m_xBuilder->weld_label("instructions"))
17 , m_xEDUrl(m_xBuilder->weld_entry("url"))
18 , m_xEDCode(m_xBuilder->weld_entry("code"))
19 , m_xEDGoogleCode(m_xBuilder->weld_entry("google_code"))
20 , m_xBTOk(m_xBuilder->weld_button("ok"))
21 , m_xBTCancel(m_xBuilder->weld_button("cancel"))
22 , m_xGoogleBox(m_xBuilder->weld_widget("GDrive"))
23 , m_xOneDriveBox(m_xBuilder->weld_widget("OneDrive"))
25 m_xBTOk->connect_clicked(LINK(this, AuthFallbackDlg, OKHdl));
26 m_xBTCancel->connect_clicked(LINK(this, AuthFallbackDlg, CancelHdl));
27 m_xBTOk->set_sensitive(true);
29 m_xTVInstructions->set_label(instructions);
30 if (url.isEmpty())
32 // Google 2FA
33 m_bGoogleMode = true;
34 m_xGoogleBox->show();
35 m_xOneDriveBox->hide();
36 m_xEDUrl->hide();
38 else
40 // OneDrive
41 m_bGoogleMode = false;
42 m_xGoogleBox->hide();
43 m_xOneDriveBox->show();
44 m_xEDUrl->set_text(url);
48 AuthFallbackDlg::~AuthFallbackDlg() {}
50 OUString AuthFallbackDlg::GetCode() const
52 if (m_bGoogleMode)
53 return m_xEDGoogleCode->get_text();
54 else
55 return m_xEDCode->get_text();
58 IMPL_LINK_NOARG(AuthFallbackDlg, OKHdl, weld::Button&, void) { m_xDialog->response(RET_OK); }
60 IMPL_LINK_NOARG(AuthFallbackDlg, CancelHdl, weld::Button&, void)
62 m_xDialog->response(RET_CANCEL);