diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-04-18 10:34:10 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-04-18 10:39:11 +0100 |
commit | 9714e7460c3ff67f2683483bf3634b2f31cda361 (patch) | |
tree | e6cbb126c725508916456289e1b486f2aacd27f4 /dbaccess | |
parent | e7cd5953c3df5904cbcf07cc1b017cf3b7138d56 (diff) |
convert table design row menu to .ui
Change-Id: I8a6be28ccd7cbd2b8f18255e3da01df2dfe13fb8
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/UIConfig_dbaccess.mk | 1 | ||||
-rw-r--r-- | dbaccess/inc/dbaccess_helpid.hrc | 1 | ||||
-rw-r--r-- | dbaccess/inc/dbaccess_slotid.hrc | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dbu_resource.hrc | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TEditControl.cxx | 64 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TableDesignControl.cxx | 57 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/table.src | 48 | ||||
-rw-r--r-- | dbaccess/uiconfig/ui/tabledesignrowmenu.ui | 59 |
8 files changed, 119 insertions, 114 deletions
diff --git a/dbaccess/UIConfig_dbaccess.mk b/dbaccess/UIConfig_dbaccess.mk index e6a2a8fe5f14..096b8ee26f6c 100644 --- a/dbaccess/UIConfig_dbaccess.mk +++ b/dbaccess/UIConfig_dbaccess.mk @@ -65,6 +65,7 @@ $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \ dbaccess/uiconfig/ui/sortdialog \ dbaccess/uiconfig/ui/sqlexception \ dbaccess/uiconfig/ui/summarypage \ + dbaccess/uiconfig/ui/tabledesignrowmenu \ dbaccess/uiconfig/ui/tabledesignsavemodifieddialog \ dbaccess/uiconfig/ui/tablesfilterdialog \ dbaccess/uiconfig/ui/tablesfilterpage \ diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc index db5b68a5776f..236957f246dd 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_INSERTROWS "DBACCESS_HID_TABLEDESIGN_INSERTROWS" #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" diff --git a/dbaccess/inc/dbaccess_slotid.hrc b/dbaccess/inc/dbaccess_slotid.hrc index 4b37b4dae01e..934a1f737be0 100644 --- a/dbaccess/inc/dbaccess_slotid.hrc +++ b/dbaccess/inc/dbaccess_slotid.hrc @@ -101,7 +101,7 @@ #define SID_DB_APP_EDIT_SQL_VIEW ( SID_DBACCESS_START + 66 ) #define SID_TABLEDESIGN_TABED_PRIMARYKEY ( SID_DBACCESS_START + 67 ) -#define SID_TABLEDESIGN_INSERTROWS ( SID_DBACCESS_START + 68 ) +//FREE #define SID_QUERY_PROP_DLG ( SID_DBACCESS_START + 69 ) diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc index 574042ef9616..85da27797fff 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_TABLEDESIGNROWPOPUPMENU RID_MENU_START + 7 #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/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 5a5b7bd87bdf..93f38932fdd8 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -1372,15 +1372,16 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt) } else { - ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_TABLEDESIGNROWPOPUPMENU)); + VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "dbaccess/ui/tabledesignrowmenu.ui", ""); + VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu")); - aContextMenu->EnableItem( SID_CUT, IsCutAllowed(nRow) ); - aContextMenu->EnableItem( SID_COPY, IsCopyAllowed(nRow) ); - aContextMenu->EnableItem( SID_PASTE, IsPasteAllowed(nRow) ); - aContextMenu->EnableItem( SID_DELETE, IsDeleteAllowed(nRow) ); - aContextMenu->EnableItem( SID_TABLEDESIGN_TABED_PRIMARYKEY, IsPrimaryKeyAllowed(nRow) ); - aContextMenu->EnableItem( SID_TABLEDESIGN_INSERTROWS, IsInsertNewAllowed(nRow) ); - aContextMenu->CheckItem( SID_TABLEDESIGN_TABED_PRIMARYKEY, IsRowSelected(GetCurRow()) && IsPrimaryKey() ); + aContextMenu->EnableItem(aContextMenu->GetItemId("cut"), IsCutAllowed(nRow)); + aContextMenu->EnableItem(aContextMenu->GetItemId("copy"), IsCopyAllowed(nRow)); + aContextMenu->EnableItem(aContextMenu->GetItemId("paste"), IsPasteAllowed(nRow)); + aContextMenu->EnableItem(aContextMenu->GetItemId("delete"), IsDeleteAllowed(nRow)); + aContextMenu->EnableItem(aContextMenu->GetItemId("primarykey"), IsPrimaryKeyAllowed(nRow)); + aContextMenu->EnableItem(aContextMenu->GetItemId("insert"), IsInsertNewAllowed(nRow)); + aContextMenu->CheckItem(aContextMenu->GetItemId("primarykey"), IsRowSelected(GetCurRow()) && IsPrimaryKey()); // remove all the disable entries aContextMenu->RemoveDisabledEntries(true, true); @@ -1391,32 +1392,29 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt) // All actions which change the number of rows must be run asynchronously // otherwise there may be problems between the Context menu and the Browser m_nDataPos = GetCurRow(); - switch (aContextMenu->Execute(this, aMenuPos)) + aContextMenu->Execute(this, aMenuPos); + OString sIdent = aContextMenu->GetCurItemIdent(); + if (sIdent == "cut") + cut(); + else if (sIdent == "copy") + copy(); + else if (sIdent == "paste") + paste(); + else if (sIdent == "delete") { - case SID_CUT: - cut(); - break; - case SID_COPY: - copy(); - break; - case SID_PASTE: - paste(); - break; - case SID_DELETE: - if( nDeleteEvent ) - Application::RemoveUserEvent( nDeleteEvent ); - nDeleteEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, DelayedDelete), nullptr, true ); - break; - case SID_TABLEDESIGN_INSERTROWS: - if( nInsNewRowsEvent ) - Application::RemoveUserEvent( nInsNewRowsEvent ); - nInsNewRowsEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, DelayedInsNewRows), nullptr, true ); - break; - case SID_TABLEDESIGN_TABED_PRIMARYKEY: - SetPrimaryKey( !IsPrimaryKey() ); - break; - default: - break; + if( nDeleteEvent ) + Application::RemoveUserEvent( nDeleteEvent ); + nDeleteEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, DelayedDelete), nullptr, true ); + } + else if (sIdent == "insert") + { + if( nInsNewRowsEvent ) + Application::RemoveUserEvent( nInsNewRowsEvent ); + nInsNewRowsEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, DelayedInsNewRows), nullptr, true ); + } + else if (sIdent == "primarykey") + { + SetPrimaryKey( !IsPrimaryKey() ); } } } diff --git a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx index a774f583a4ee..3fd10c6eb196 100644 --- a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx +++ b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx @@ -24,6 +24,7 @@ #include "browserids.hxx" #include <com/sun/star/util/URL.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <vcl/builder.hxx> #include "dbaccess_helpid.hrc" using namespace ::dbaui; @@ -108,38 +109,34 @@ void OTableRowView::Command(const CommandEvent& rEvt) if ( nColId == HANDLE_ID ) { - ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_TABLEDESIGNROWPOPUPMENU)); + VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "dbaccess/ui/querycolmenu.ui", ""); + VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu")); long nSelectRowCount = GetSelectRowCount(); - aContextMenu->EnableItem( SID_CUT, nSelectRowCount != 0); - aContextMenu->EnableItem( SID_COPY, nSelectRowCount != 0); - aContextMenu->EnableItem( SID_PASTE, false ); - aContextMenu->EnableItem( SID_DELETE, false ); - switch (aContextMenu->Execute(this, rEvt.GetMousePosPixel())) + aContextMenu->EnableItem(aContextMenu->GetItemId("cut"), nSelectRowCount != 0); + aContextMenu->EnableItem(aContextMenu->GetItemId("copy"), nSelectRowCount != 0); + aContextMenu->EnableItem(aContextMenu->GetItemId("paste"), false); + aContextMenu->EnableItem(aContextMenu->GetItemId("delete"), false); + aContextMenu->Execute(this, rEvt.GetMousePosPixel()); + OString sIdent = aContextMenu->GetCurItemIdent(); + if (sIdent == "cut") + cut(); + else if (sIdent == "copy") + copy(); + else if (sIdent == "paste") { - case SID_CUT: - cut(); - break; - case SID_COPY: - copy(); - break; - case SID_PASTE: - Paste( nRow ); - SetNoSelection(); - GoToRow( nRow ); - SeekRow( nRow ); - break; - - case SID_DELETE: - DeleteRows(); - break; - case SID_TABLEDESIGN_INSERTROWS: - InsertNewRows( nRow ); - SetNoSelection(); - GoToRow( nRow ); - SeekRow( nRow ); - break; - default: - break; + Paste( nRow ); + SetNoSelection(); + GoToRow( nRow ); + SeekRow( nRow ); + } + else if (sIdent == "delete") + DeleteRows(); + else if (sIdent == "insert") + { + InsertNewRows( nRow ); + SetNoSelection(); + GoToRow( nRow ); + SeekRow( nRow ); } } diff --git a/dbaccess/source/ui/tabledesign/table.src b/dbaccess/source/ui/tabledesign/table.src index 02bf4436e7d2..0f3b54f5d333 100644 --- a/dbaccess/source/ui/tabledesign/table.src +++ b/dbaccess/source/ui/tabledesign/table.src @@ -88,54 +88,6 @@ String STR_TAB_PROPERTIES Text [ en-US ] = "Field Properties" ; }; -Menu RID_TABLEDESIGNROWPOPUPMENU -{ - ItemList = - { - MenuItem - { - Identifier = SID_CUT ; - Command = ".uno:Cut" ; - Text [ en-US ] = "Cu~t" ; - }; - MenuItem - { - Identifier = SID_COPY ; - Command = ".uno:Copy" ; - Text [ en-US ] = "~Copy" ; - }; - MenuItem - { - Identifier = SID_PASTE ; - Command = ".uno:Paste" ; - Text [ en-US ] = "~Paste" ; - }; - MenuItem - { - Identifier = SID_DELETE ; - Command = ".uno:Delete" ; - Text [ en-US ] = "~Delete" ; - }; - MenuItem - { - Identifier = SID_TABLEDESIGN_INSERTROWS ; - HelpID = HID_TABLEDESIGN_INSERTROWS ; - Text [ en-US ] = "Insert Rows" ; - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = SID_TABLEDESIGN_TABED_PRIMARYKEY ; - HelpID = HID_TABLEDESIGN_TABED_PRIMARYKEY ; - Checkable = TRUE ; - Text [ en-US ] = "Primary Key" ; - }; - }; -}; - String STR_TABED_UNDO_CELLMODIFIED { Text [ en-US ] = "Modify cell" ; diff --git a/dbaccess/uiconfig/ui/tabledesignrowmenu.ui b/dbaccess/uiconfig/ui/tabledesignrowmenu.ui new file mode 100644 index 000000000000..37bc014058c2 --- /dev/null +++ b/dbaccess/uiconfig/ui/tabledesignrowmenu.ui @@ -0,0 +1,59 @@ +<?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="GtkMenuItem" id="cut"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Cu_t</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="copy"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Copy</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="paste"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Paste</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="delete"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Delete</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="insert"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Insert Rows</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem" id="menuitem1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + </child> + <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> + </object> + </child> + </object> +</interface> |