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

Caolán McNamara caolanm at redhat.com
Tue Apr 18 09:56:06 UTC 2017


 dbaccess/UIConfig_dbaccess.mk           |    1 
 dbaccess/inc/dbaccess_helpid.hrc        |    1 
 dbaccess/inc/dbaccess_slotid.hrc        |    4 ---
 dbaccess/source/ui/inc/dbu_resource.hrc |    1 
 dbaccess/source/ui/misc/WTypeSelect.cxx |   33 ++++++++++++++------------------
 dbaccess/source/ui/misc/WizardPages.src |   14 -------------
 dbaccess/uiconfig/ui/keymenu.ui         |   17 ++++++++++++++++
 7 files changed, 34 insertions(+), 37 deletions(-)

New commits:
commit 1660bdd08bde5efa7cbfc9e8b2aed5d90504fceb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 18 10:52:22 2017 +0100

    convert primary key menu to .ui
    
    Change-Id: I78b4f6edc33ddc908402d8ab952bfebc11e4f929

diff --git a/dbaccess/UIConfig_dbaccess.mk b/dbaccess/UIConfig_dbaccess.mk
index 096b8ee26f6c..61a49fcb19c6 100644
--- a/dbaccess/UIConfig_dbaccess.mk
+++ b/dbaccess/UIConfig_dbaccess.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \
     dbaccess/uiconfig/ui/indexdesigndialog \
     dbaccess/uiconfig/ui/jdbcconnectionpage \
     dbaccess/uiconfig/ui/joindialog \
+    dbaccess/uiconfig/ui/keymenu \
     dbaccess/uiconfig/ui/ldapconnectionpage \
     dbaccess/uiconfig/ui/ldappage \
     dbaccess/uiconfig/ui/migratepage \
diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc
index 236957f246dd..79bb6eafbee9 100644
--- a/dbaccess/inc/dbaccess_helpid.hrc
+++ b/dbaccess/inc/dbaccess_helpid.hrc
@@ -58,7 +58,6 @@
 #define HID_TABDESIGN_NAMECELL                            "DBACCESS_HID_TABDESIGN_NAMECELL"
 #define HID_TABDESIGN_TYPECELL                            "DBACCESS_HID_TABDESIGN_TYPECELL"
 #define HID_TABDESIGN_COMMENTCELL                         "DBACCESS_HID_TABDESIGN_COMMENTCELL"
-#define HID_TABLEDESIGN_TABED_PRIMARYKEY                  "DBACCESS_HID_TABLEDESIGN_TABED_PRIMARYKEY"
 #define HID_TAB_DESIGN_HELP_TEXT_FRAME                    "DBACCESS_HID_TAB_DESIGN_HELP_TEXT_FRAME"
 #define HID_TABLE_DESIGN_TABPAGE_GENERAL                  "DBACCESS_HID_TABLE_DESIGN_TABPAGE_GENERAL"
 #define HID_TAB_ENT_DEFAULT                               "DBACCESS_HID_TAB_ENT_DEFAULT"
diff --git a/dbaccess/inc/dbaccess_slotid.hrc b/dbaccess/inc/dbaccess_slotid.hrc
index 934a1f737be0..9ac775cbf9bd 100644
--- a/dbaccess/inc/dbaccess_slotid.hrc
+++ b/dbaccess/inc/dbaccess_slotid.hrc
@@ -99,10 +99,8 @@
 #define SID_APP_NEW_REPORT              ( SID_DBACCESS_START +  65 )
 
 #define SID_DB_APP_EDIT_SQL_VIEW        ( SID_DBACCESS_START +  66 )
-
-#define SID_TABLEDESIGN_TABED_PRIMARYKEY ( SID_DBACCESS_START + 67 )
 //FREE
-
+//FREE
 #define SID_QUERY_PROP_DLG              ( SID_DBACCESS_START +  69 )
 
 #endif
diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc
index 85da27797fff..70d00dbd234f 100644
--- a/dbaccess/source/ui/inc/dbu_resource.hrc
+++ b/dbaccess/source/ui/inc/dbu_resource.hrc
@@ -124,7 +124,6 @@
 // menus
 
 #define RID_QUERYFUNCTION_POPUPMENU     RID_MENU_START +  6
-#define RID_SBA_RTF_PKEYPOPUP           RID_MENU_START +  9
 #define RID_MENU_JOINVIEW_CONNECTION    RID_MENU_START + 16
 #define RID_MENU_JOINVIEW_TABLE         RID_MENU_START + 17
 
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index e7a6e3f1e233..4d3a0961a435 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -434,7 +434,8 @@ bool OWizTypeSelectList::PreNotify( NotifyEvent& rEvt )
             if (pComEvt->IsMouseEvent())
                 ptWhere = pComEvt->GetMousePosPixel();
 
-            ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_SBA_RTF_PKEYPOPUP));
+            VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "dbaccess/ui/keymenu.ui", "");
+            VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu"));
             // Should primary key checkbox be checked?
             const sal_Int32 nCount = GetEntryCount();
             bool bCheckOk = false;
@@ -454,31 +455,27 @@ bool OWizTypeSelectList::PreNotify( NotifyEvent& rEvt )
             }
 
             if (bCheckOk)
-                aContextMenu->CheckItem( SID_TABLEDESIGN_TABED_PRIMARYKEY );
+                aContextMenu->CheckItem(aContextMenu->GetItemId("primarykey"));
 
-            switch( aContextMenu->Execute( this, ptWhere ) )
+            if (aContextMenu->Execute(this, ptWhere))
             {
-                case SID_TABLEDESIGN_TABED_PRIMARYKEY:
+                for (sal_Int32 j = 0 ; j < nCount ; ++j)
                 {
-                    for(sal_Int32 j = 0 ; j < nCount ; ++j)
+                    OFieldDescription* pFieldDescr = static_cast<OFieldDescription*>(GetEntryData(j));
+                    if( pFieldDescr )
                     {
-                        OFieldDescription* pFieldDescr = static_cast<OFieldDescription*>(GetEntryData(j));
-                        if( pFieldDescr )
+                        if(!bCheckOk && IsEntryPosSelected(j))
                         {
-                            if(!bCheckOk && IsEntryPosSelected(j))
-                            {
-                                setPrimaryKey(pFieldDescr,j,true);
-                                SelectEntryPos(j);
-                            }
-                            else
-                            {
-                                setPrimaryKey(pFieldDescr,j);
-                            }
+                            setPrimaryKey(pFieldDescr,j,true);
+                            SelectEntryPos(j);
+                        }
+                        else
+                        {
+                            setPrimaryKey(pFieldDescr,j);
                         }
                     }
-                    GetSelectHdl().Call(*this);
                 }
-                break;
+                GetSelectHdl().Call(*this);
             }
             bDone = true;
         }
diff --git a/dbaccess/source/ui/misc/WizardPages.src b/dbaccess/source/ui/misc/WizardPages.src
index affd3c6f9933..7c4f403cd5c0 100644
--- a/dbaccess/source/ui/misc/WizardPages.src
+++ b/dbaccess/source/ui/misc/WizardPages.src
@@ -56,20 +56,6 @@ String STR_WIZ_PB_OK
     Text [ en-US ] = "C~reate";
 };
 
-Menu RID_SBA_RTF_PKEYPOPUP
-{
-    ItemList =
-    {
-        MenuItem
-        {
-            Identifier      = SID_TABLEDESIGN_TABED_PRIMARYKEY ;
-            HelpID          = HID_TABLEDESIGN_TABED_PRIMARYKEY ;
-            Checkable       = TRUE ;
-            Text [ en-US ] = "Primary Key" ;
-        };
-    };
-};
-
 Bitmap BMP_UP
 {
     File = "sortup.png" ;
diff --git a/dbaccess/uiconfig/ui/keymenu.ui b/dbaccess/uiconfig/ui/keymenu.ui
new file mode 100644
index 000000000000..301ad667518a
--- /dev/null
+++ b/dbaccess/uiconfig/ui/keymenu.ui
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface>
+  <requires lib="gtk+" version="3.10"/>
+  <object class="GtkMenu" id="menu">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkCheckMenuItem" id="primarykey">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Primary Key</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list