diff options
author | Mihai Varga <mihai.mv13@gmail.com> | 2014-07-31 11:10:07 +0300 |
---|---|---|
committer | Mihai Varga <mihai.mv13@gmail.com> | 2014-07-31 11:10:07 +0300 |
commit | 4265926f7cffa127e8ca2a94bb81820576ddc32e (patch) | |
tree | 0281cd6f54120fa645fef437eaa8cb7b718978cf | |
parent | 002f33224802da1820f3152a030833b11ec77a9b (diff) |
Authentication fallback dialog for the OneDrive connection
It asks the user to access an URL in his browser and provide a code
from the URL he has been redirected to
-rw-r--r-- | uui/Library_uui.mk | 1 | ||||
-rw-r--r-- | uui/source/authfallbackdlg.cxx | 63 | ||||
-rw-r--r-- | uui/source/authfallbackdlg.hxx | 44 | ||||
-rw-r--r-- | uui/uiconfig/ui/authfallback.ui | 96 |
4 files changed, 204 insertions, 0 deletions
diff --git a/uui/Library_uui.mk b/uui/Library_uui.mk index 560cb6565f27..cd85de668219 100644 --- a/uui/Library_uui.mk +++ b/uui/Library_uui.mk @@ -38,6 +38,7 @@ $(eval $(call gb_Library_use_libraries,uui,\ $(eval $(call gb_Library_add_exception_objects,uui,\ uui/source/alreadyopen \ + uui/source/authfallbackdlg \ uui/source/filechanged \ uui/source/fltdlg \ uui/source/iahndl \ diff --git a/uui/source/authfallbackdlg.cxx b/uui/source/authfallbackdlg.cxx new file mode 100644 index 000000000000..5f1548d2a17a --- /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" + +#include <vcl/msgbox.hxx> +#include <iostream> + +using namespace boost; + +AuthFallbackDlg::AuthFallbackDlg( Window* pParent ) : + ModalDialog( pParent, "AuthFallbackDlg", "uui/ui/authfallback.ui" ) +{ + get( m_pTVInstructions, "instructions" ); + get( m_pEDUrl, "url" ); + get( m_pEDCode, "code" ); + get( m_pBTOk, "ok" ); + get( m_pBTCancel, "cancel" ); + + m_pBTOk->SetClickHdl( LINK( this, AuthFallbackDlg, OKHdl) ); + m_pBTOk->Enable( false ); +} + +AuthFallbackDlg::AuthFallbackDlg( Window* pParent, + const OUString& instructions, + const OUString& url ) : + ModalDialog( pParent, "AuthFallbackDlg", "uui/ui/authfallback.ui" ) +{ + get( m_pTVInstructions, "instructions" ); + get( m_pEDUrl, "url" ); + get( m_pEDCode, "code" ); + get( m_pBTOk, "ok" ); + get( m_pBTCancel, "cancel" ); + + m_pBTOk->SetClickHdl( LINK( this, AuthFallbackDlg, OKHdl) ); + m_pBTCancel->SetClickHdl( LINK( this, AuthFallbackDlg, CancelHdl) ); + m_pBTOk->Enable( true ); + + m_pTVInstructions->SetText( instructions ); + m_pEDUrl->SetText( url ); +} + +AuthFallbackDlg::~AuthFallbackDlg( ) +{ +} + +IMPL_LINK ( AuthFallbackDlg, OKHdl, Button *, EMPTYARG ) +{ + EndDialog( RET_OK ); + return 1; +} + +IMPL_LINK ( AuthFallbackDlg, CancelHdl, Button *, EMPTYARG ) +{ + EndDialog( RET_CANCEL ); + return 0; +} diff --git a/uui/source/authfallbackdlg.hxx b/uui/source/authfallbackdlg.hxx new file mode 100644 index 000000000000..d068f48fd964 --- /dev/null +++ b/uui/source/authfallbackdlg.hxx @@ -0,0 +1,44 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_SVTOOLS_AUTHFALLBACKDLG_HXX +#define INCLUDED_SVTOOLS_AUTHFALLBACKDLG_HXX + +#include <vcl/button.hxx> +#include <vcl/dialog.hxx> +#include <vcl/edit.hxx> +#include <vcl/vclmedit.hxx> + + +class AuthFallbackDlg : public ModalDialog +{ +private : + + VclMultiLineEdit* m_pTVInstructions; + Edit* m_pEDUrl; + Edit* m_pEDCode; + PushButton* m_pBTOk; + PushButton* m_pBTCancel; + +public : + + AuthFallbackDlg( Window* pParent); + AuthFallbackDlg(Window* pParent, const OUString& instructions, + const OUString& url ); + virtual ~AuthFallbackDlg(); + + OUString GetCode() { return m_pEDCode->GetText(); } + +private: + + DECL_LINK ( OKHdl, Button * ); + DECL_LINK ( CancelHdl, Button * ); +}; + +#endif // INCLUDED_SVTOOLS_AUTHFALLBACKDLG_HXX diff --git a/uui/uiconfig/ui/authfallback.ui b/uui/uiconfig/ui/authfallback.ui new file mode 100644 index 000000000000..6e79a4c25f6d --- /dev/null +++ b/uui/uiconfig/ui/authfallback.ui @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="AuthFallbackDlg"> + <property name="can_focus">False</property> + <property name="title" translatable="yes">OneDrive authentication code</property> + <property name="default_width">400</property> + <property name="default_height">270</property> + <child> + <object class="GtkBox" id="box"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</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="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">False</property> + <property name="invisible_char">●</property> + <property name="editable">False</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">False</property> + <property name="invisible_char">●</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkButtonBox" id="buttonbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">46</property> + <property name="layout_style">start</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label" translatable="yes">Ok</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label" translatable="yes">Cancel</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">True</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">True</property> + <property name="fill">True</property> + <property name="padding">6</property> + <property name="position">3</property> + </packing> + </child> + </object> + </child> + </object> +</interface> |