LibreOffice Module uui (master) 1
authfallbackdlg.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 */
9
10#include "authfallbackdlg.hxx"
11
12AuthFallbackDlg::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"))
24{
25 m_xBTOk->connect_clicked(LINK(this, AuthFallbackDlg, OKHdl));
26 m_xBTCancel->connect_clicked(LINK(this, AuthFallbackDlg, CancelHdl));
27 m_xBTOk->set_sensitive(true);
28
29 m_xTVInstructions->set_label(instructions);
30 if (url.isEmpty())
31 {
32 // Google 2FA
33 m_bGoogleMode = true;
34 m_xGoogleBox->show();
35 m_xOneDriveBox->hide();
36 m_xEDUrl->hide();
37 }
38 else
39 {
40 // OneDrive
41 m_bGoogleMode = false;
42 m_xGoogleBox->hide();
43 m_xOneDriveBox->show();
44 m_xEDUrl->set_text(url);
45 }
46}
47
49
51{
52 if (m_bGoogleMode)
53 return m_xEDGoogleCode->get_text();
54 else
55 return m_xEDCode->get_text();
56}
57
59
61{
62 m_xDialog->response(RET_CANCEL);
63}
Reference< XExecutableDialog > m_xDialog
IMPL_LINK_NOARG(AuthFallbackDlg, OKHdl, weld::Button &, void)
std::unique_ptr< weld::Button > m_xBTOk
OUString GetCode() const
std::unique_ptr< weld::Entry > m_xEDCode
std::unique_ptr< weld::Widget > m_xOneDriveBox
std::unique_ptr< weld::Widget > m_xGoogleBox
std::unique_ptr< weld::Entry > m_xEDGoogleCode
std::unique_ptr< weld::Label > m_xTVInstructions
AuthFallbackDlg(weld::Window *pParent, const OUString &instructions, const OUString &url)
virtual ~AuthFallbackDlg() override
std::unique_ptr< weld::Button > m_xBTCancel
std::unique_ptr< weld::Entry > m_xEDUrl
RET_OK
RET_CANCEL