diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /uui/source/authfallbackdlg.cxx | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'uui/source/authfallbackdlg.cxx')
-rw-r--r-- | uui/source/authfallbackdlg.cxx | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/uui/source/authfallbackdlg.cxx b/uui/source/authfallbackdlg.cxx new file mode 100644 index 000000000..daad28b77 --- /dev/null +++ b/uui/source/authfallbackdlg.cxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "authfallbackdlg.hxx" + +AuthFallbackDlg::AuthFallbackDlg(weld::Window* pParent, const OUString& instructions, + const OUString& url) + : GenericDialogController(pParent, "uui/ui/authfallback.ui", "AuthFallbackDlg") + , m_bGoogleMode(false) + , m_xTVInstructions(m_xBuilder->weld_label("instructions")) + , m_xEDUrl(m_xBuilder->weld_entry("url")) + , m_xEDCode(m_xBuilder->weld_entry("code")) + , m_xEDGoogleCode(m_xBuilder->weld_entry("google_code")) + , m_xBTOk(m_xBuilder->weld_button("ok")) + , m_xBTCancel(m_xBuilder->weld_button("cancel")) + , m_xGoogleBox(m_xBuilder->weld_widget("GDrive")) + , m_xOneDriveBox(m_xBuilder->weld_widget("OneDrive")) +{ + m_xBTOk->connect_clicked(LINK(this, AuthFallbackDlg, OKHdl)); + m_xBTCancel->connect_clicked(LINK(this, AuthFallbackDlg, CancelHdl)); + m_xBTOk->set_sensitive(true); + + m_xTVInstructions->set_label(instructions); + if (url.isEmpty()) + { + // Google 2FA + m_bGoogleMode = true; + m_xGoogleBox->show(); + m_xOneDriveBox->hide(); + m_xEDUrl->hide(); + } + else + { + // OneDrive + m_bGoogleMode = false; + m_xGoogleBox->hide(); + m_xOneDriveBox->show(); + m_xEDUrl->set_text(url); + } +} + +AuthFallbackDlg::~AuthFallbackDlg() {} + +OUString AuthFallbackDlg::GetCode() const +{ + if (m_bGoogleMode) + return m_xEDGoogleCode->get_text(); + else + return m_xEDCode->get_text(); +} + +IMPL_LINK_NOARG(AuthFallbackDlg, OKHdl, weld::Button&, void) { m_xDialog->response(RET_OK); } + +IMPL_LINK_NOARG(AuthFallbackDlg, CancelHdl, weld::Button&, void) +{ + m_xDialog->response(RET_CANCEL); +} |