summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorManal Alhassoun <malhassoun@kacst.edu.sa>2013-09-30 11:22:50 +0300
committerCaolán McNamara <caolanm@redhat.com>2013-10-01 09:55:52 +0000
commitff3203c5c567ed14a8ff2e80408c304d3cdd84e0 (patch)
tree178f9ccc0046dfb31a015661bdb234c2002c7018 /svx
parent5249bd69ff7fa41d785a5bf9f4e7539ef8288438 (diff)
Convert change password dialog to widget UI
Change-Id: I0ff0eda77b849927fe6cffe5cf203c46ba9ef340 Reviewed-on: https://gerrit.libreoffice.org/6089 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/UIConfig_svx.mk1
-rw-r--r--svx/inc/helpid.hrc1
-rw-r--r--svx/source/dialog/passwd.cxx69
-rw-r--r--svx/source/dialog/passwd.hrc44
-rw-r--r--svx/source/dialog/passwd.src97
-rw-r--r--svx/uiconfig/ui/passwd.ui270
6 files changed, 309 insertions, 173 deletions
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index 7b98a08ccdfe..cb4c7590bf75 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
svx/uiconfig/ui/headfootformatpage \
svx/uiconfig/ui/findreplacedialog \
svx/uiconfig/ui/optgridpage \
+ svx/uiconfig/ui/passwd \
svx/uiconfig/ui/redlinecontrol \
svx/uiconfig/ui/redlinefilterpage \
svx/uiconfig/ui/redlineviewpage \
diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc
index e9e1666bcdac..2e41991413f0 100644
--- a/svx/inc/helpid.hrc
+++ b/svx/inc/helpid.hrc
@@ -143,7 +143,6 @@
#define HID_MNU_ZOOM_OPTIMAL "SVX_HID_MNU_ZOOM_OPTIMAL"
#define HID_MNU_ZOOM_PAGE_WIDTH "SVX_HID_MNU_ZOOM_PAGE_WIDTH"
#define HID_MNU_ZOOM_WHOLE_PAGE "SVX_HID_MNU_ZOOM_WHOLE_PAGE"
-#define HID_PASSWORD "SVX_HID_PASSWORD"
#define HID_POPUP_COLOR "SVX_HID_POPUP_COLOR"
#define HID_POPUP_COLOR_CTRL "SVX_HID_POPUP_COLOR_CTRL"
#define HID_POPUP_FONTWORK_ALIGN "SVX_HID_POPUP_FONTWORK_ALIGN"
diff --git a/svx/source/dialog/passwd.cxx b/svx/source/dialog/passwd.cxx
index 2e80408f2753..25b2314a4388 100644
--- a/svx/source/dialog/passwd.cxx
+++ b/svx/source/dialog/passwd.cxx
@@ -23,7 +23,6 @@
#include "svx/passwd.hxx"
#include <svx/dialmgr.hxx>
#include <svx/dialogs.hrc>
-#include "passwd.hrc"
// class SvxPasswordDialog -----------------------------------------------
@@ -33,20 +32,20 @@ IMPL_LINK_NOARG(SvxPasswordDialog, ButtonHdl)
short nRet = RET_OK;
OUString aEmpty;
- if ( aNewPasswdED.GetText() != aRepeatPasswdED.GetText() )
+ if ( m_pNewPasswdED->GetText() != m_pRepeatPasswdED->GetText() )
{
ErrorBox( this, WB_OK, aRepeatPasswdErrStr ).Execute();
- aNewPasswdED.SetText( aEmpty );
- aRepeatPasswdED.SetText( aEmpty );
- aNewPasswdED.GrabFocus();
+ m_pNewPasswdED->SetText( aEmpty );
+ m_pRepeatPasswdED->SetText( aEmpty );
+ m_pNewPasswdED->GrabFocus();
bOK = false;
}
if ( bOK && aCheckPasswordHdl.IsSet() && !aCheckPasswordHdl.Call( this ) )
{
ErrorBox( this, WB_OK, aOldPasswdErrStr ).Execute();
- aOldPasswdED.SetText( aEmpty );
- aOldPasswdED.GrabFocus();
+ m_pOldPasswdED->SetText( aEmpty );
+ m_pOldPasswdED->GrabFocus();
bOK = false;
}
@@ -62,48 +61,42 @@ IMPL_LINK_NOARG(SvxPasswordDialog, EditModifyHdl)
{
if ( !bEmpty )
{
- OUString aPasswd = comphelper::string::strip(aRepeatPasswdED.GetText(), ' ');
- if ( aPasswd.isEmpty() && aOKBtn.IsEnabled() )
- aOKBtn.Disable();
- else if ( !aPasswd.isEmpty() && !aOKBtn.IsEnabled() )
- aOKBtn.Enable();
+ OUString aPasswd = comphelper::string::strip(m_pRepeatPasswdED->GetText(), ' ');
+ if ( aPasswd.isEmpty() && m_pOKBtn->IsEnabled() )
+ m_pOKBtn->Disable();
+ else if ( !aPasswd.isEmpty() && !m_pOKBtn->IsEnabled() )
+ m_pOKBtn->Enable();
}
- else if ( !aOKBtn.IsEnabled() )
- aOKBtn.Enable();
+ else if ( !m_pOKBtn->IsEnabled() )
+ m_pOKBtn->Enable();
return 0;
}
// -----------------------------------------------------------------------
-SvxPasswordDialog::SvxPasswordDialog( Window* pParent, sal_Bool bAllowEmptyPasswords, sal_Bool bDisableOldPassword ) :
- SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_PASSWORD ) ),
- aOldFL ( this, SVX_RES( FL_OLD_PASSWD ) ),
- aOldPasswdFT ( this, SVX_RES( FT_OLD_PASSWD ) ),
- aOldPasswdED ( this, SVX_RES( ED_OLD_PASSWD ) ),
- aNewFL ( this, SVX_RES( FL_NEW_PASSWD ) ),
- aNewPasswdFT ( this, SVX_RES( FT_NEW_PASSWD ) ),
- aNewPasswdED ( this, SVX_RES( ED_NEW_PASSWD ) ),
- aRepeatPasswdFT ( this, SVX_RES( FT_REPEAT_PASSWD ) ),
- aRepeatPasswdED ( this, SVX_RES( ED_REPEAT_PASSWD ) ),
- aOKBtn ( this, SVX_RES( BTN_PASSWD_OK ) ),
- aEscBtn ( this, SVX_RES( BTN_PASSWD_ESC ) ),
- aHelpBtn ( this, SVX_RES( BTN_PASSWD_HELP ) ),
- aOldPasswdErrStr ( SVX_RESSTR( STR_ERR_OLD_PASSWD ) ),
- aRepeatPasswdErrStr ( SVX_RESSTR( STR_ERR_REPEAT_PASSWD ) ),
- bEmpty ( bAllowEmptyPasswords )
+SvxPasswordDialog::SvxPasswordDialog(Window* pParent, sal_Bool bAllowEmptyPasswords, sal_Bool bDisableOldPassword)
+ : SfxModalDialog(pParent, "PasswordDialog", "svx/ui/passwd.ui")
+ , aOldPasswdErrStr(SVX_RESSTR(RID_SVXSTR_ERR_OLD_PASSWD))
+ , aRepeatPasswdErrStr(SVX_RESSTR(RID_SVXSTR_ERR_REPEAT_PASSWD ))
+ , bEmpty(bAllowEmptyPasswords)
{
- FreeResource();
-
- aOKBtn.SetClickHdl( LINK( this, SvxPasswordDialog, ButtonHdl ) );
- aRepeatPasswdED.SetModifyHdl( LINK( this, SvxPasswordDialog, EditModifyHdl ) );
+ get(m_pOldFL, "oldpass");
+ get(m_pOldPasswdFT, "oldpassL");
+ get(m_pOldPasswdED, "oldpassEntry");
+ get(m_pNewPasswdED, "newpassEntry");
+ get(m_pRepeatPasswdED, "confirmpassEntry");
+ get(m_pOKBtn, "ok");
+
+ m_pOKBtn->SetClickHdl( LINK( this, SvxPasswordDialog, ButtonHdl ) );
+ m_pRepeatPasswdED->SetModifyHdl( LINK( this, SvxPasswordDialog, EditModifyHdl ) );
EditModifyHdl( 0 );
if ( bDisableOldPassword )
{
- aOldFL.Disable();
- aOldPasswdFT.Disable();
- aOldPasswdED.Disable();
- aNewPasswdED.GrabFocus();
+ m_pOldFL->Disable();
+ m_pOldPasswdFT->Disable();
+ m_pOldPasswdED->Disable();
+ m_pNewPasswdED->GrabFocus();
}
}
diff --git a/svx/source/dialog/passwd.hrc b/svx/source/dialog/passwd.hrc
deleted file mode 100644
index 2f8552e2dcba..000000000000
--- a/svx/source/dialog/passwd.hrc
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef _SVX_PASSWD_HRC
-#define _SVX_PASSWD_HRC
-
-// defines ------------------------------------------------------------------
-
-#define FT_OLD_PASSWD 10
-#define ED_OLD_PASSWD 11
-#define FL_OLD_PASSWD 12
-
-#define FT_NEW_PASSWD 20
-#define ED_NEW_PASSWD 21
-#define FT_REPEAT_PASSWD 22
-#define ED_REPEAT_PASSWD 23
-#define FL_NEW_PASSWD 24
-
-#define BTN_PASSWD_OK 30
-#define BTN_PASSWD_ESC 31
-#define BTN_PASSWD_HELP 32
-
-#define STR_ERR_OLD_PASSWD 40
-#define STR_ERR_REPEAT_PASSWD 41
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/passwd.src b/svx/source/dialog/passwd.src
index bb0d96139223..11d4e0cf1f27 100644
--- a/svx/source/dialog/passwd.src
+++ b/svx/source/dialog/passwd.src
@@ -18,98 +18,15 @@
*/
#include <svx/dialogs.hrc>
-#include "helpid.hrc"
-#include "passwd.hrc"
- // RID_SVXDLG_PASSWORD ---------------------------------------------------
-ModalDialog RID_SVXDLG_PASSWORD
+String RID_SVXSTR_ERR_OLD_PASSWD
{
- HelpId = HID_PASSWORD ;
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 210 , 77 ) ;
- Moveable = TRUE ;
- FixedText FT_OLD_PASSWD
- {
- Pos = MAP_APPFONT ( 12 , 16 ) ;
- Size = MAP_APPFONT ( 57 , 8 ) ;
- Text [ en-US ] = "~Password" ;
- };
- Edit ED_OLD_PASSWD
- {
- HelpID = "svx:Edit:RID_SVXDLG_PASSWORD:ED_OLD_PASSWD";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 71 , 14 ) ;
- Size = MAP_APPFONT ( 71 , 12 ) ;
- PassWord = TRUE ;
- };
- FixedLine FL_OLD_PASSWD
- {
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 142 , 8 ) ;
- Text [ en-US ] = "Old password" ;
- };
- FixedText FT_NEW_PASSWD
- {
- Pos = MAP_APPFONT ( 12 , 45 ) ;
- Size = MAP_APPFONT ( 57 , 8 ) ;
- Text [ en-US ] = "Pa~ssword" ;
- };
- Edit ED_NEW_PASSWD
- {
- HelpID = "svx:Edit:RID_SVXDLG_PASSWORD:ED_NEW_PASSWD";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 71 , 43 ) ;
- Size = MAP_APPFONT ( 71 , 12 ) ;
- PassWord = TRUE ;
- };
- FixedText FT_REPEAT_PASSWD
- {
- Pos = MAP_APPFONT ( 12 , 61 ) ;
- Size = MAP_APPFONT ( 57 , 8 ) ;
- Text [ en-US ] = "Confi~rm";
- };
- Edit ED_REPEAT_PASSWD
- {
- HelpID = "svx:Edit:RID_SVXDLG_PASSWORD:ED_REPEAT_PASSWD";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 71 , 59 ) ;
- Size = MAP_APPFONT ( 71 , 12 ) ;
- PassWord = TRUE ;
- };
- FixedLine FL_NEW_PASSWD
- {
- Pos = MAP_APPFONT ( 6 , 32 ) ;
- Size = MAP_APPFONT ( 142 , 8 ) ;
- Text [ en-US ] = "New password" ;
- };
- OKButton BTN_PASSWD_OK
- {
- Pos = MAP_APPFONT ( 154 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- DefButton = TRUE ;
- Disable = TRUE ;
- };
- CancelButton BTN_PASSWD_ESC
- {
- Pos = MAP_APPFONT ( 154 , 23 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- };
- HelpButton BTN_PASSWD_HELP
- {
- Pos = MAP_APPFONT ( 154 , 43 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- };
- String STR_ERR_OLD_PASSWD
- {
- Text [ en-US ] = "Invalid password" ;
- };
- String STR_ERR_REPEAT_PASSWD
- {
- Text [ en-US ] = "Passwords do not match" ;
- };
- Text [ en-US ] = "Change Password" ;
+ Text [ en-US ] = "Invalid password" ;
+};
+
+String RID_SVXSTR_ERR_REPEAT_PASSWD
+{
+ Text [ en-US ] = "Passwords do not match" ;
};
- // ********************************************************************** EOF
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/uiconfig/ui/passwd.ui b/svx/uiconfig/ui/passwd.ui
new file mode 100644
index 000000000000..33750677bb8c
--- /dev/null
+++ b/svx/uiconfig/ui/passwd.ui
@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkDialog" id="PasswordDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes">Change Password</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="layout_style">start</property>
+ <child>
+ <object class="GtkButton" id="ok">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="cancel">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">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="help">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</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="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkBox" id="box2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="oldpassL">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Password</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">oldpassEntry</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="oldpassEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</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>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="oldpass">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Old password</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkEntry" id="newpassEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="confirmpassEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Pa_ssword</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">newpassEntry</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Confi_rm</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">confirmpassEntry</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">New password</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </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>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">ok</action-widget>
+ <action-widget response="0">cancel</action-widget>
+ <action-widget response="0">help</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkSizeGroup" id="sizegroup1">
+ <widgets>
+ <widget name="oldpassL"/>
+ <widget name="label4"/>
+ <widget name="label5"/>
+ </widgets>
+ </object>
+</interface>