[Libreoffice-commits] core.git: dbaccess/inc dbaccess/source dbaccess/uiconfig dbaccess/UIConfig_dbaccess.mk

Caolán McNamara caolanm at redhat.com
Tue Apr 1 04:30:12 PDT 2014


 dbaccess/UIConfig_dbaccess.mk           |    1 
 dbaccess/inc/dbaccess_helpid.hrc        |    1 
 dbaccess/source/ui/dlg/UserAdmin.cxx    |   64 ++++------
 dbaccess/source/ui/dlg/UserAdmin.hrc    |   14 --
 dbaccess/source/ui/dlg/UserAdmin.src    |   83 -------------
 dbaccess/source/ui/inc/dbu_resource.hrc |    2 
 dbaccess/uiconfig/ui/password.ui        |  194 ++++++++++++++++++++++++++++++++
 7 files changed, 221 insertions(+), 138 deletions(-)

New commits:
commit 6dae22bd43747ab3631af021299642ae0c26da09
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 1 12:18:08 2014 +0100

    convert user admin password dialog to .ui
    
    Change-Id: Ia94c3b27b80d8c58e287ae588a5f6a40fb64fa38

diff --git a/dbaccess/UIConfig_dbaccess.mk b/dbaccess/UIConfig_dbaccess.mk
index a90e161..2caa8d8 100644
--- a/dbaccess/UIConfig_dbaccess.mk
+++ b/dbaccess/UIConfig_dbaccess.mk
@@ -22,6 +22,7 @@ $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \
     dbaccess/uiconfig/ui/generalpagewizard \
     dbaccess/uiconfig/ui/generatedvaluespage \
     dbaccess/uiconfig/ui/joindialog \
+    dbaccess/uiconfig/ui/password \
     dbaccess/uiconfig/ui/queryfilterdialog \
     dbaccess/uiconfig/ui/querypropertiesdialog  \
     dbaccess/uiconfig/ui/relationdialog \
diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc
index 5da3fac..99a2a5d 100644
--- a/dbaccess/inc/dbaccess_helpid.hrc
+++ b/dbaccess/inc/dbaccess_helpid.hrc
@@ -190,7 +190,6 @@
 #define HID_BROWSER_OPEN_DOCUMENT                         "DBACCESS_HID_BROWSER_OPEN_DOCUMENT"
 #define HID_BROWSER_EDIT_DOCUMENT                         "DBACCESS_HID_BROWSER_EDIT_DOCUMENT"
 #define HID_BROWSER_BEW_DOCUMENT                          "DBACCESS_HID_BROWSER_BEW_DOCUMENT"
-#define HID_DLG_PASSWORD                                  "DBACCESS_HID_DLG_PASSWORD"
 
 #define HID_DLGIDX_NEWINDEX                               "DBACCESS_HID_DLGIDX_NEWINDEX"
 #define HID_DLGIDX_DROPINDEX                              "DBACCESS_HID_DLGIDX_DROPINDEX"
diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx
index 1c3256c..6fbbc52 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.cxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.cxx
@@ -38,6 +38,7 @@
 #include "dbadmin.hxx"
 #include "moduledbu.hxx"
 #include <vcl/msgbox.hxx>
+#include <vcl/layout.hxx>
 #include <sfx2/passwd.hxx>
 
 using namespace ::com::sun::star::container;
@@ -52,16 +53,11 @@ using namespace comphelper;
 
 class OPasswordDialog : public ModalDialog
 {
-    FixedLine       aFLUser;
-    FixedText       aFTOldPassword;
-    Edit            aEDOldPassword;
-    FixedText       aFTPassword;
-    Edit            aEDPassword;
-    FixedText       aFTPasswordRepeat;
-    Edit            aEDPasswordRepeat;
-    OKButton        aOKBtn;
-    CancelButton    aCancelBtn;
-    HelpButton      aHelpBtn;
+    VclFrame* m_pUser;
+    Edit*     m_pEDOldPassword;
+    Edit*     m_pEDPassword;
+    Edit*     m_pEDPasswordRepeat;
+    OKButton* m_pOKBtn;
 
     DECL_LINK( OKHdl_Impl, void * );
     DECL_LINK( ModifiedHdl, Edit * );
@@ -69,57 +65,47 @@ class OPasswordDialog : public ModalDialog
 public:
     OPasswordDialog( Window* pParent,const OUString& _sUserName);
 
-    OUString        GetOldPassword() const { return aEDOldPassword.GetText(); }
-    OUString        GetNewPassword() const { return aEDPassword.GetText(); }
+    OUString        GetOldPassword() const { return m_pEDOldPassword->GetText(); }
+    OUString        GetNewPassword() const { return m_pEDPassword->GetText(); }
 };
 
-OPasswordDialog::OPasswordDialog(Window* _pParent,const OUString& _sUserName) :
-
-    ModalDialog( _pParent, ModuleRes( DLG_PASSWORD) ),
-
-    aFLUser             ( this, ModuleRes( FL_USER ) ),
-    aFTOldPassword      ( this, ModuleRes( FT_OLDPASSWORD ) ),
-    aEDOldPassword      ( this, ModuleRes( ED_OLDPASSWORD ) ),
-    aFTPassword         ( this, ModuleRes( FT_PASSWORD ) ),
-    aEDPassword         ( this, ModuleRes( ED_PASSWORD ) ),
-    aFTPasswordRepeat   ( this, ModuleRes( FT_PASSWORD_REPEAT ) ),
-    aEDPasswordRepeat   ( this, ModuleRes( ED_PASSWORD_REPEAT ) ),
-    aOKBtn              ( this, ModuleRes( BTN_PASSWORD_OK ) ),
-    aCancelBtn          ( this, ModuleRes( BTN_PASSWORD_CANCEL ) ),
-    aHelpBtn            ( this, ModuleRes( BTN_PASSWORD_HELP ) )
+OPasswordDialog::OPasswordDialog(Window* _pParent,const OUString& _sUserName)
+    : ModalDialog(_pParent, "PasswordDialog", "dbaccess/ui/password.ui")
 {
-    // hide until a help is available
-    aHelpBtn.Hide();
+    get(m_pUser, "userframe");
+    get(m_pEDOldPassword, "oldpassword");
+    get(m_pEDPassword, "newpassword");
+    get(m_pEDPasswordRepeat, "confirmpassword");
+    get(m_pOKBtn, "ok");
 
-    FreeResource();
-    OUString sUser = aFLUser.GetText();
+    OUString sUser = m_pUser->get_label();
     sUser = sUser.replaceFirst("$name$:  $",_sUserName);
-    aFLUser.SetText(sUser);
-    aOKBtn.Disable();
+    m_pUser->set_label(sUser);
+    m_pOKBtn->Disable();
 
-    aOKBtn.SetClickHdl( LINK( this, OPasswordDialog, OKHdl_Impl ) );
-    aEDOldPassword.SetModifyHdl( LINK( this, OPasswordDialog, ModifiedHdl ) );
+    m_pOKBtn->SetClickHdl( LINK( this, OPasswordDialog, OKHdl_Impl ) );
+    m_pEDOldPassword->SetModifyHdl( LINK( this, OPasswordDialog, ModifiedHdl ) );
 }
 
 IMPL_LINK_NOARG(OPasswordDialog, OKHdl_Impl)
 {
-    if( aEDPassword.GetText() == aEDPasswordRepeat.GetText() )
+    if( m_pEDPassword->GetText() == m_pEDPasswordRepeat->GetText() )
         EndDialog( RET_OK );
     else
     {
         OUString aErrorMsg( ModuleRes( STR_ERROR_PASSWORDS_NOT_IDENTICAL));
         ErrorBox aErrorBox( this, WB_OK, aErrorMsg );
         aErrorBox.Execute();
-        aEDPassword.SetText( OUString() );
-        aEDPasswordRepeat.SetText( OUString() );
-        aEDPassword.GrabFocus();
+        m_pEDPassword->SetText( OUString() );
+        m_pEDPasswordRepeat->SetText( OUString() );
+        m_pEDPassword->GrabFocus();
     }
     return 0;
 }
 
 IMPL_LINK( OPasswordDialog, ModifiedHdl, Edit *, pEdit )
 {
-    aOKBtn.Enable(!pEdit->GetText().isEmpty());
+    m_pOKBtn->Enable(!pEdit->GetText().isEmpty());
     return 0;
 }
 
diff --git a/dbaccess/source/ui/dlg/UserAdmin.hrc b/dbaccess/source/ui/dlg/UserAdmin.hrc
index 65b89bf..131f569 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.hrc
+++ b/dbaccess/source/ui/dlg/UserAdmin.hrc
@@ -34,20 +34,6 @@
 #define PB_CHANGEPWD        3
 #define PB_DELETEUSER       4
 
-
-
-#define FT_OLDPASSWORD      19
-#define ED_OLDPASSWORD      19
-#define FT_PASSWORD         20
-#define ED_PASSWORD         21
-#define FT_PASSWORD_REPEAT  22
-#define ED_PASSWORD_REPEAT  23
-
-#define BTN_PASSWORD_OK     50
-#define BTN_PASSWORD_CANCEL 51
-#define BTN_PASSWORD_HELP   52
-
-
 #endif // DBAUI_USERADMIN_HRC
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/dlg/UserAdmin.src b/dbaccess/source/ui/dlg/UserAdmin.src
index 1b6c808..a17fbb6 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.src
+++ b/dbaccess/source/ui/dlg/UserAdmin.src
@@ -115,89 +115,6 @@ String STR_USERADMIN_NOT_AVAILABLE
     Text [ en-US ] = "The database does not support user administration." ;
 };
 
-#define EDIT_SIZE_X     50
-#define FT_SIZE_X       90
-#define WIN_X           220
-#define WIN_Y           72
-
-ModalDialog DLG_PASSWORD
-{
-    HelpId = HID_DLG_PASSWORD ;
-    Border = TRUE ;
-    Moveable = TRUE ;
-    OutputSize = TRUE ;
-    SVLook = TRUE ;
-    Size = MAP_APPFONT ( WIN_X , WIN_Y ) ;
-
-    FixedLine FL_USER
-    {
-        Pos = MAP_APPFONT ( 3 , 3 ) ;
-        Size = MAP_APPFONT ( WIN_X - 3 - 6 - 6 - 50 , 8 ) ;
-        Text [ en-US ] = "User \"$name$:  $\"";
-    };
-    FixedText FT_OLDPASSWORD
-    {
-        Pos = MAP_APPFONT ( 6 , 17 ) ;
-        Size = MAP_APPFONT ( FT_SIZE_X , 10 ) ;
-        Text [ en-US ] = "Old p~assword";
-    };
-    Edit ED_OLDPASSWORD
-    {
-        HelpID = "dbaccess:Edit:DLG_PASSWORD:ED_OLDPASSWORD";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 12 + FT_SIZE_X , 16 ) ;
-        Size = MAP_APPFONT ( EDIT_SIZE_X , 12 ) ;
-        PassWord = TRUE ;
-    };
-
-    FixedText FT_PASSWORD
-    {
-        Pos = MAP_APPFONT ( 6 , 35 ) ;
-        Size = MAP_APPFONT ( FT_SIZE_X , 10 ) ;
-        Text [ en-US ] = "~Password";
-    };
-    Edit ED_PASSWORD
-    {
-        HelpID = "dbaccess:Edit:DLG_PASSWORD:ED_PASSWORD";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 12 + FT_SIZE_X , 34 ) ;
-        Size = MAP_APPFONT ( EDIT_SIZE_X , 12 ) ;
-        PassWord = TRUE ;
-    };
-    FixedText FT_PASSWORD_REPEAT
-    {
-        Pos = MAP_APPFONT ( 6 , 52 ) ;
-        Size = MAP_APPFONT ( FT_SIZE_X , 10 ) ;
-        Text [ en-US ] = "~Confirm password";
-    };
-    Edit ED_PASSWORD_REPEAT
-    {
-        HelpID = "dbaccess:Edit:DLG_PASSWORD:ED_PASSWORD_REPEAT";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 12 + FT_SIZE_X , 51 ) ;
-        Size = MAP_APPFONT ( EDIT_SIZE_X , 12 ) ;
-        PassWord = TRUE ;
-    };
-
-    OKButton BTN_PASSWORD_OK
-    {
-        Pos = MAP_APPFONT ( WIN_X - 56 , 6 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        DefButton = TRUE ;
-    };
-    CancelButton BTN_PASSWORD_CANCEL
-    {
-        Pos = MAP_APPFONT ( WIN_X - 56 , 23 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-    };
-    HelpButton BTN_PASSWORD_HELP
-    {
-        Pos = MAP_APPFONT ( WIN_X - 56 , 43 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-    };
-    Text [ en-US ] = "Change Password";
-};
-
 String STR_ERROR_PASSWORDS_NOT_IDENTICAL
 {
     Text [ en-US ] = "The passwords do not match. Please enter the password again.";
diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc
index a496afe..589fdaa 100644
--- a/dbaccess/source/ui/inc/dbu_resource.hrc
+++ b/dbaccess/source/ui/inc/dbu_resource.hrc
@@ -88,7 +88,7 @@
     // FREE
     // FREE
     // FREE
-#define DLG_PASSWORD                    RID_DIALOG_START + 23
+    // FREE
 #define DLG_COLLECTION_VIEW             RID_DIALOG_START + 27
 #define DLG_DATABASE_TYPE_CHANGE        RID_DIALOG_START + 28
 #define DLG_DATABASE_WIZARD             RID_DIALOG_START + 29
diff --git a/dbaccess/uiconfig/ui/password.ui b/dbaccess/uiconfig/ui/password.ui
new file mode 100644
index 0000000..9c01867
--- /dev/null
+++ b/dbaccess/uiconfig/ui/password.ui
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface>
+  <requires lib="gtk+" version="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="orientation">vertical</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="layout_style">end</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>
+          </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="GtkFrame" id="userframe">
+            <property name="visible">True</property>
+            <property name="can_focus">False</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="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="oldpassword">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="visibility">False</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="newpassword">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="visibility">False</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="label2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Old p_assword</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">oldpassword</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="label3">
+                        <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">newpassword</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>
+                    <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">_Confirm password</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">confirmpassword</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">2</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="confirmpassword">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="visibility">False</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">2</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">User "$name$:  $"</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>
+    </child>
+    <action-widgets>
+      <action-widget response="0">ok</action-widget>
+      <action-widget response="0">cancel</action-widget>
+    </action-widgets>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list