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; ...@@ -17,29 +17,37 @@ using namespace boost;
AuthFallbackDlg::AuthFallbackDlg(Window* pParent, const OUString& instructions, AuthFallbackDlg::AuthFallbackDlg(Window* pParent, const OUString& instructions,
const OUString& url) const OUString& url)
: ModalDialog(pParent, "AuthFallbackDlg", "uui/ui/authfallback.ui") : ModalDialog(pParent, "AuthFallbackDlg", "uui/ui/authfallback.ui")
, m_bGoogleMode( false )
{ {
get( m_pTVInstructions, "instructions" ); get( m_pTVInstructions, "instructions" );
get( m_pEDUrl, "url" ); get( m_pEDUrl, "url" );
get( m_pEDCode, "code" ); get( m_pEDCode, "code" );
get( m_pEDGoogleCode, "google_code" );
get( m_pBTOk, "ok" ); get( m_pBTOk, "ok" );
get( m_pBTCancel, "cancel" ); 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_pBTOk->SetClickHdl( LINK( this, AuthFallbackDlg, OKHdl) );
m_pBTCancel->SetClickHdl( LINK( this, AuthFallbackDlg, CancelHdl) ); m_pBTCancel->SetClickHdl( LINK( this, AuthFallbackDlg, CancelHdl) );
m_pBTOk->Enable(); m_pBTOk->Enable();
m_pTVInstructions->SetText( instructions ); m_pTVInstructions->SetText( instructions );
m_pTVInstructions->SetPaintTransparent(true);
if( url.isEmpty() ) if( url.isEmpty() )
{ {
// Google 2FA // Google 2FA
m_pFTGooglePrefixLabel->Show(); m_bGoogleMode = true;
m_pGoogleBox->Show();
m_pOneDriveBox->Hide();
m_pEDUrl->Hide(); m_pEDUrl->Hide();
} }
else else
{ {
// OneDrive // OneDrive
m_pFTGooglePrefixLabel->Hide(); m_bGoogleMode = false;
m_pGoogleBox->Hide();
m_pOneDriveBox->Show();
m_pEDUrl->SetText( url ); m_pEDUrl->SetText( url );
} }
} }
...@@ -49,14 +57,25 @@ AuthFallbackDlg::~AuthFallbackDlg() ...@@ -49,14 +57,25 @@ AuthFallbackDlg::~AuthFallbackDlg()
disposeOnce(); disposeOnce();
} }
OUString AuthFallbackDlg::GetCode() const
{
if( m_bGoogleMode )
return m_pEDGoogleCode->GetText();
else
return m_pEDCode->GetText();
}
void AuthFallbackDlg::dispose() void AuthFallbackDlg::dispose()
{ {
m_pTVInstructions.clear(); m_pTVInstructions.clear();
m_pEDUrl.clear(); m_pEDUrl.clear();
m_pEDCode.clear(); m_pEDCode.clear();
m_pEDGoogleCode.clear();
m_pBTOk.clear(); m_pBTOk.clear();
m_pBTCancel.clear(); m_pBTCancel.clear();
m_pFTGooglePrefixLabel.clear(); m_pGoogleBox.clear();
m_pOneDriveBox.clear();
ModalDialog::dispose(); ModalDialog::dispose();
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <vcl/edit.hxx> #include <vcl/edit.hxx>
#include <vcl/vclmedit.hxx> #include <vcl/vclmedit.hxx>
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
#include <vcl/layout.hxx>
class AuthFallbackDlg : public ModalDialog class AuthFallbackDlg : public ModalDialog
{ {
...@@ -23,9 +23,12 @@ private: ...@@ -23,9 +23,12 @@ private:
VclPtr<VclMultiLineEdit> m_pTVInstructions; VclPtr<VclMultiLineEdit> m_pTVInstructions;
VclPtr<Edit> m_pEDUrl; VclPtr<Edit> m_pEDUrl;
VclPtr<Edit> m_pEDCode; VclPtr<Edit> m_pEDCode;
VclPtr<Edit> m_pEDGoogleCode;
VclPtr<PushButton> m_pBTOk; VclPtr<PushButton> m_pBTOk;
VclPtr<PushButton> m_pBTCancel; VclPtr<PushButton> m_pBTCancel;
VclPtr<FixedText> m_pFTGooglePrefixLabel; VclPtr<VclVBox> m_pGoogleBox;
VclPtr<VclVBox> m_pOneDriveBox;
bool m_bGoogleMode;
public: public:
AuthFallbackDlg(Window* pParent, const OUString& instructions, AuthFallbackDlg(Window* pParent, const OUString& instructions,
...@@ -33,7 +36,7 @@ public: ...@@ -33,7 +36,7 @@ public:
virtual ~AuthFallbackDlg(); virtual ~AuthFallbackDlg();
virtual void dispose() override; virtual void dispose() override;
OUString GetCode() const { return m_pEDCode->GetText(); } OUString GetCode() const;
private: private:
......
...@@ -59,6 +59,12 @@ ...@@ -59,6 +59,12 @@
</child> </child>
<child> <child>
<object class="GtkBox" id="box"> <object class="GtkBox" id="box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox" id="OneDrive">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
...@@ -81,7 +87,7 @@ ...@@ -81,7 +87,7 @@
<child> <child>
<object class="GtkEntry" id="url"> <object class="GtkEntry" id="url">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="editable">False</property> <property name="editable">False</property>
<property name="invisible_char"></property> <property name="invisible_char"></property>
</object> </object>
...@@ -92,13 +98,54 @@ ...@@ -92,13 +98,54 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkBox" id="box1"> <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>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<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="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Enter the 6 digit PIN:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">center</property>
<child> <child>
<object class="GtkLabel" id="google_prefix_label"> <object class="GtkLabel" id="google_prefix_label">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="no">G-</property> <property name="margin_right">3</property>
<property name="label">G-</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
...@@ -107,10 +154,19 @@ ...@@ -107,10 +154,19 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry" id="code"> <object class="GtkEntry" id="google_code">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="max_length">6</property>
<property name="invisible_char"></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> </object>
<packing> <packing>
<property name="expand">False</property> <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