LibreOffice Module uui (master) 1
masterpasscrtdlg.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <unotools/resmgr.hxx>
21#include <vcl/svapp.hxx>
22#include <vcl/weld.hxx>
23#include <strings.hrc>
24#include "masterpasscrtdlg.hxx"
25
26// MasterPasswordCreateDialog---------------------------------------------------
27
28
30{
31 m_xOKBtn->set_sensitive(m_xEDMasterPasswordCrt->get_text().getLength() >= 1);
32}
33
35{
36 // compare both passwords and show message box if there are not equal!!
37 if (m_xEDMasterPasswordCrt->get_text() == m_xEDMasterPasswordRepeat->get_text())
38 m_xDialog->response(RET_OK);
39 else
40 {
41 OUString aErrorMsg(Translate::get(STR_ERROR_PASSWORDS_NOT_IDENTICAL, rResLocale));
42 std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_xDialog.get(),
43 VclMessageType::Warning, VclButtonsType::Ok,
44 aErrorMsg));
45 xErrorBox->run();
46 m_xEDMasterPasswordCrt->set_text( OUString() );
47 m_xEDMasterPasswordRepeat->set_text( OUString() );
48 m_xEDMasterPasswordCrt->grab_focus();
49 }
50}
51
53 : GenericDialogController(pParent, "uui/ui/setmasterpassworddlg.ui", "SetMasterPasswordDialog")
54 , rResLocale(rLocale)
55 , m_xEDMasterPasswordCrt(m_xBuilder->weld_entry("password1"))
56 , m_xEDMasterPasswordRepeat(m_xBuilder->weld_entry("password2"))
57 , m_xOKBtn(m_xBuilder->weld_button("ok"))
58{
59 m_xOKBtn->set_sensitive(false);
60 m_xOKBtn->connect_clicked( LINK( this, MasterPasswordCreateDialog, OKHdl_Impl ) );
61 m_xEDMasterPasswordCrt->connect_changed( LINK( this, MasterPasswordCreateDialog, EditHdl_Impl ) );
62}
63
65{
66}
67
68/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
std::unique_ptr< weld::Button > m_xOKBtn
virtual ~MasterPasswordCreateDialog() override
MasterPasswordCreateDialog(weld::Window *pParent, const std::locale &rLocale)
std::unique_ptr< weld::Entry > m_xEDMasterPasswordCrt
IMPL_LINK_NOARG(MasterPasswordCreateDialog, EditHdl_Impl, weld::Entry &, void)
OUString get(TranslateId sContextAndId, const std::locale &loc)
RET_OK