Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/uui/source/authfallbackdlg.cxx
Line
Count
Source
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
#include <vcl/vclenum.hxx>
12
#include <vcl/weld/Builder.hxx>
13
#include <vcl/weld/Dialog.hxx>
14
15
AuthFallbackDlg::AuthFallbackDlg(weld::Window* pParent, const OUString& instructions,
16
                                 const OUString& url)
17
0
    : GenericDialogController(pParent, u"uui/ui/authfallback.ui"_ustr, u"AuthFallbackDlg"_ustr)
18
0
    , m_bGoogleMode(false)
19
0
    , m_xTVInstructions(m_xBuilder->weld_label(u"instructions"_ustr))
20
0
    , m_xEDUrl(m_xBuilder->weld_entry(u"url"_ustr))
21
0
    , m_xEDCode(m_xBuilder->weld_entry(u"code"_ustr))
22
0
    , m_xEDGoogleCode(m_xBuilder->weld_entry(u"google_code"_ustr))
23
0
    , m_xBTOk(m_xBuilder->weld_button(u"ok"_ustr))
24
0
    , m_xBTCancel(m_xBuilder->weld_button(u"cancel"_ustr))
25
0
    , m_xGoogleBox(m_xBuilder->weld_widget(u"GDrive"_ustr))
26
0
    , m_xOneDriveBox(m_xBuilder->weld_widget(u"OneDrive"_ustr))
27
0
{
28
0
    m_xBTOk->connect_clicked(LINK(this, AuthFallbackDlg, OKHdl));
29
0
    m_xBTCancel->connect_clicked(LINK(this, AuthFallbackDlg, CancelHdl));
30
0
    m_xBTOk->set_sensitive(true);
31
32
0
    m_xTVInstructions->set_label(instructions);
33
0
    if (url.isEmpty())
34
0
    {
35
        // Google 2FA
36
0
        m_bGoogleMode = true;
37
0
        m_xGoogleBox->show();
38
0
        m_xOneDriveBox->hide();
39
0
        m_xEDUrl->hide();
40
0
    }
41
0
    else
42
0
    {
43
        // OneDrive
44
0
        m_bGoogleMode = false;
45
0
        m_xGoogleBox->hide();
46
0
        m_xOneDriveBox->show();
47
0
        m_xEDUrl->set_text(url);
48
0
    }
49
0
}
50
51
0
AuthFallbackDlg::~AuthFallbackDlg() {}
52
53
OUString AuthFallbackDlg::GetCode() const
54
0
{
55
0
    if (m_bGoogleMode)
56
0
        return m_xEDGoogleCode->get_text();
57
0
    else
58
0
        return m_xEDCode->get_text();
59
0
}
60
61
0
IMPL_LINK_NOARG(AuthFallbackDlg, OKHdl, weld::Button&, void) { m_xDialog->response(RET_OK); }
62
63
IMPL_LINK_NOARG(AuthFallbackDlg, CancelHdl, weld::Button&, void)
64
0
{
65
0
    m_xDialog->response(RET_CANCEL);
66
0
}