Kaydet (Commit) 32d16030 authored tarafından Yousuf Philips's avatar Yousuf Philips Kaydeden (comit) Szymon Kłos

tdf#87938 Add descriptive instructions to 2fa dialog

Change-Id: I0bbe3ae4591785e32467dec8554493f0b549d009
Reviewed-on: https://gerrit.libreoffice.org/28105Reviewed-by: 's avatarSzymon Kłos <eszkadev@gmail.com>
Tested-by: 's avatarSzymon Kłos <eszkadev@gmail.com>
üst 5a70a760
......@@ -17,29 +17,37 @@ using namespace boost;
AuthFallbackDlg::AuthFallbackDlg(Window* pParent, const OUString& instructions,
const OUString& url)
: ModalDialog(pParent, "AuthFallbackDlg", "uui/ui/authfallback.ui")
, m_bGoogleMode( false )
{
get( m_pTVInstructions, "instructions" );
get( m_pEDUrl, "url" );
get( m_pEDCode, "code" );
get( m_pEDGoogleCode, "google_code" );
get( m_pBTOk, "ok" );
get( m_pBTCancel, "cancel" );
get( m_pFTGooglePrefixLabel, "google_prefix_label" );
get( m_pGoogleBox, "GDrive" );
get( m_pOneDriveBox, "OneDrive" );
m_pBTOk->SetClickHdl( LINK( this, AuthFallbackDlg, OKHdl) );
m_pBTCancel->SetClickHdl( LINK( this, AuthFallbackDlg, CancelHdl) );
m_pBTOk->Enable();
m_pTVInstructions->SetText( instructions );
m_pTVInstructions->SetPaintTransparent(true);
if( url.isEmpty() )
{
// Google 2FA
m_pFTGooglePrefixLabel->Show();
m_bGoogleMode = true;
m_pGoogleBox->Show();
m_pOneDriveBox->Hide();
m_pEDUrl->Hide();
}
else
{
// OneDrive
m_pFTGooglePrefixLabel->Hide();
m_bGoogleMode = false;
m_pGoogleBox->Hide();
m_pOneDriveBox->Show();
m_pEDUrl->SetText( url );
}
}
......@@ -49,14 +57,25 @@ AuthFallbackDlg::~AuthFallbackDlg()
disposeOnce();
}
OUString AuthFallbackDlg::GetCode() const
{
if( m_bGoogleMode )
return m_pEDGoogleCode->GetText();
else
return m_pEDCode->GetText();
}
void AuthFallbackDlg::dispose()
{
m_pTVInstructions.clear();
m_pEDUrl.clear();
m_pEDCode.clear();
m_pEDGoogleCode.clear();
m_pBTOk.clear();
m_pBTCancel.clear();
m_pFTGooglePrefixLabel.clear();
m_pGoogleBox.clear();
m_pOneDriveBox.clear();
ModalDialog::dispose();
}
......
......@@ -15,7 +15,7 @@
#include <vcl/edit.hxx>
#include <vcl/vclmedit.hxx>
#include <vcl/fixed.hxx>
#include <vcl/layout.hxx>
class AuthFallbackDlg : public ModalDialog
{
......@@ -23,9 +23,12 @@ private:
VclPtr<VclMultiLineEdit> m_pTVInstructions;
VclPtr<Edit> m_pEDUrl;
VclPtr<Edit> m_pEDCode;
VclPtr<Edit> m_pEDGoogleCode;
VclPtr<PushButton> m_pBTOk;
VclPtr<PushButton> m_pBTCancel;
VclPtr<FixedText> m_pFTGooglePrefixLabel;
VclPtr<VclVBox> m_pGoogleBox;
VclPtr<VclVBox> m_pOneDriveBox;
bool m_bGoogleMode;
public:
AuthFallbackDlg(Window* pParent, const OUString& instructions,
......@@ -33,7 +36,7 @@ public:
virtual ~AuthFallbackDlg();
virtual void dispose() override;
OUString GetCode() const { return m_pEDCode->GetText(); }
OUString GetCode() const;
private:
......
......@@ -64,13 +64,52 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkTextView" id="instructions">
<object class="GtkBox" id="OneDrive">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixels_below_lines">4</property>
<property name="editable">False</property>
<property name="wrap_mode">word</property>
<property name="cursor_visible">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkTextView" id="instructions">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixels_below_lines">4</property>
<property name="editable">False</property>
<property name="wrap_mode">word</property>
<property name="cursor_visible">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="url">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="code">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char"></property>
<property name="width_chars">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
......@@ -79,26 +118,17 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="url">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="editable">False</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<object class="GtkBox" id="GDrive">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="google_prefix_label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="no">G-</property>
<property name="label" translatable="yes">Enter the 6 digit PIN:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -107,10 +137,36 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="code">
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="invisible_char"></property>
<property name="halign">center</property>
<child>
<object class="GtkLabel" id="google_prefix_label">
<property name="can_focus">False</property>
<property name="margin_right">3</property>
<property name="label">G-</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="google_code">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="max_length">6</property>
<property name="invisible_char"></property>
<property name="width_chars">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment