diff options
author | Mihai Varga <mihai.mv13@gmail.com> | 2014-07-31 11:10:07 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-12-15 11:23:25 +0100 |
commit | 1ef156897f0fb447b7ace271dbfd95beb8f1a859 (patch) | |
tree | 297f575b3b3171fdaa48b11cf56504a523709af3 /uui/source | |
parent | fc1bfd9e6d774917bd90d67b1135402d2d33ef6b (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
Diffstat (limited to 'uui/source')
-rw-r--r-- | uui/source/authfallbackdlg.cxx | 63 | ||||
-rw-r--r-- | uui/source/authfallbackdlg.hxx | 44 |
2 files changed, 107 insertions, 0 deletions
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 |