[Libreoffice-commits] core.git: uui/source uui/uiconfig

Yousuf Philips philipz85 at hotmail.com
Thu Aug 18 09:08:20 UTC 2016


 uui/source/authfallbackdlg.cxx  |   27 +++++++++-
 uui/source/authfallbackdlg.hxx  |    9 ++-
 uui/uiconfig/ui/authfallback.ui |  102 ++++++++++++++++++++++++++++++----------
 3 files changed, 108 insertions(+), 30 deletions(-)

New commits:
commit 32d160300e7bd51c0f273275a3d8872e55af9ad3
Author: Yousuf Philips <philipz85 at hotmail.com>
Date:   Mon Aug 15 13:14:58 2016 +0400

    tdf#87938 Add descriptive instructions to 2fa dialog
    
    Change-Id: I0bbe3ae4591785e32467dec8554493f0b549d009
    Reviewed-on: https://gerrit.libreoffice.org/28105
    Reviewed-by: Szymon Kłos <eszkadev at gmail.com>
    Tested-by: Szymon Kłos <eszkadev at gmail.com>

diff --git a/uui/source/authfallbackdlg.cxx b/uui/source/authfallbackdlg.cxx
index 8911074..dedcdc8 100644
--- a/uui/source/authfallbackdlg.cxx
+++ b/uui/source/authfallbackdlg.cxx
@@ -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();
 }
 
diff --git a/uui/source/authfallbackdlg.hxx b/uui/source/authfallbackdlg.hxx
index 9e5eb52..4df88dd 100644
--- a/uui/source/authfallbackdlg.hxx
+++ b/uui/source/authfallbackdlg.hxx
@@ -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:
 
diff --git a/uui/uiconfig/ui/authfallback.ui b/uui/uiconfig/ui/authfallback.ui
index d99fa99..09b0dc8 100644
--- a/uui/uiconfig/ui/authfallback.ui
+++ b/uui/uiconfig/ui/authfallback.ui
@@ -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>


More information about the Libreoffice-commits mailing list