diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-04-18 11:40:32 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-04-18 11:45:40 +0100 |
commit | d0b1f66aa76f1f74fcb6327776daed450530bef4 (patch) | |
tree | cccced2ec622cc99cd9aed310da36a080c6305f0 | |
parent | efc5643c9a11f68b4fd41ac1b019f373ada3d750 (diff) |
convert query functions menu to .ui
Change-Id: Iba4fc93d6042d873c45c58f11b7b54638ed54d82
-rw-r--r-- | dbaccess/UIConfig_dbaccess.mk | 1 | ||||
-rw-r--r-- | dbaccess/inc/dbaccess_helpid.hrc | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/browserids.hxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dbu_resource.hrc | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 51 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/query.src | 39 | ||||
-rw-r--r-- | dbaccess/uiconfig/ui/queryfuncmenu.ui | 53 |
7 files changed, 82 insertions, 75 deletions
diff --git a/dbaccess/UIConfig_dbaccess.mk b/dbaccess/UIConfig_dbaccess.mk index c324004b06f4..96c7aefe201b 100644 --- a/dbaccess/UIConfig_dbaccess.mk +++ b/dbaccess/UIConfig_dbaccess.mk @@ -55,6 +55,7 @@ $(eval $(call gb_UIConfig_add_uifiles,dbaccess, \ dbaccess/uiconfig/ui/preparepage \ dbaccess/uiconfig/ui/querycolmenu \ dbaccess/uiconfig/ui/queryfilterdialog \ + dbaccess/uiconfig/ui/queryfuncmenu \ dbaccess/uiconfig/ui/querypropertiesdialog \ dbaccess/uiconfig/ui/relationdialog \ dbaccess/uiconfig/ui/rowheightdialog \ diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc index d8a2b8c61bff..e24c1cd9ccd0 100644 --- a/dbaccess/inc/dbaccess_helpid.hrc +++ b/dbaccess/inc/dbaccess_helpid.hrc @@ -45,11 +45,6 @@ #define HID_QRYDGN_ROW_ALIAS "DBACCESS_HID_QRYDGN_ROW_ALIAS" #define HID_QRYDGN_ROW_CRIT "DBACCESS_HID_QRYDGN_ROW_CRIT" -#define HID_QUERY_FUNCTION "DBACCESS_HID_QUERY_FUNCTION" -#define HID_QUERY_TABLENAME "DBACCESS_HID_QUERY_TABLENAME" -#define HID_QUERY_ALIASNAME "DBACCESS_HID_QUERY_ALIASNAME" -#define HID_QUERY_DISTINCT "DBACCESS_HID_QUERY_DISTINCT" - #define HID_TAB_DESIGN_FIELDCONTROL "DBACCESS_HID_TAB_DESIGN_FIELDCONTROL" #define HID_TABLE_DESIGN_HELP_WINDOW "DBACCESS_HID_TABLE_DESIGN_HELP_WINDOW" #define HID_TAB_DESIGN_DESCWIN "DBACCESS_HID_TAB_DESIGN_DESCWIN" diff --git a/dbaccess/source/ui/inc/browserids.hxx b/dbaccess/source/ui/inc/browserids.hxx index 1777d619d009..fbb74328d3f5 100644 --- a/dbaccess/source/ui/inc/browserids.hxx +++ b/dbaccess/source/ui/inc/browserids.hxx @@ -95,10 +95,6 @@ #define ID_BROWSER_CLOSE SID_CLOSEWIN #define ID_BROWSER_ESCAPEPROCESSING SID_FM_NATIVESQL -#define ID_QUERY_FUNCTION (SID_SBA_START + 41) // show functions -#define ID_QUERY_TABLENAME (SID_SBA_START + 42) // show table name -#define ID_QUERY_ALIASNAME (SID_SBA_START + 43) // show alias name -#define ID_QUERY_DISTINCT (SID_SBA_START + 44) // show distinct #define ID_BROWSER_INSERT_ROW (SID_SBA_START + 46) // insert row #define ID_QUERY_ZOOM_IN SID_ZOOM_IN #define ID_QUERY_ZOOM_OUT SID_ZOOM_OUT diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc index 563eb9a88b71..0160b47aa680 100644 --- a/dbaccess/source/ui/inc/dbu_resource.hrc +++ b/dbaccess/source/ui/inc/dbu_resource.hrc @@ -121,10 +121,6 @@ // free #define FORMFOLDER_TREE_ICON RID_IMAGE_START + 55 -// menus - -#define RID_QUERYFUNCTION_POPUPMENU RID_MENU_START + 6 - // strings #define STR_TBL_TITLE RID_STR_GEN_START #define STR_ERROR_DURING_CREATION RID_STR_GEN_START + 1 diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 308f238f8f4e..8c37af77531f 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -1953,31 +1953,36 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt) { if (!static_cast<OQueryController&>(getDesignView()->getController()).isReadOnly()) { - ScopedVclPtrInstance<PopupMenu> aContextMenu(ModuleRes(RID_QUERYFUNCTION_POPUPMENU)); - aContextMenu->CheckItem( ID_QUERY_FUNCTION, m_bVisibleRow[BROW_FUNCTION_ROW]); - aContextMenu->CheckItem( ID_QUERY_TABLENAME, m_bVisibleRow[BROW_TABLE_ROW]); - aContextMenu->CheckItem( ID_QUERY_ALIASNAME, m_bVisibleRow[BROW_COLUMNALIAS_ROW]); - aContextMenu->CheckItem( ID_QUERY_DISTINCT, static_cast<OQueryController&>(getDesignView()->getController()).isDistinct()); + VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "dbaccess/ui/queryfuncmenu.ui", ""); + VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu")); + aContextMenu->CheckItem(aContextMenu->GetItemId("functions"), m_bVisibleRow[BROW_FUNCTION_ROW]); + aContextMenu->CheckItem(aContextMenu->GetItemId("tablename"), m_bVisibleRow[BROW_TABLE_ROW]); + aContextMenu->CheckItem(aContextMenu->GetItemId("alias"), m_bVisibleRow[BROW_COLUMNALIAS_ROW]); + aContextMenu->CheckItem(aContextMenu->GetItemId("distinct"), static_cast<OQueryController&>(getDesignView()->getController()).isDistinct()); + + aContextMenu->Execute(this, aMenuPos); - switch (aContextMenu->Execute(this, aMenuPos)) + OString sIdent = aContextMenu->GetCurItemIdent(); + if (sIdent == "functions") + { + SetRowVisible(BROW_FUNCTION_ROW, !IsRowVisible(BROW_FUNCTION_ROW)); + static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( SID_QUERY_VIEW_FUNCTIONS ); + } + else if (sIdent == "tablename") + { + SetRowVisible(BROW_TABLE_ROW, !IsRowVisible(BROW_TABLE_ROW)); + static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( SID_QUERY_VIEW_TABLES ); + } + else if (sIdent == "alias") + { + SetRowVisible(BROW_COLUMNALIAS_ROW, !IsRowVisible(BROW_COLUMNALIAS_ROW)); + static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( SID_QUERY_VIEW_ALIASES ); + } + else if (sIdent == "distinct") { - case ID_QUERY_FUNCTION: - SetRowVisible(BROW_FUNCTION_ROW, !IsRowVisible(BROW_FUNCTION_ROW)); - static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( SID_QUERY_VIEW_FUNCTIONS ); - break; - case ID_QUERY_TABLENAME: - SetRowVisible(BROW_TABLE_ROW, !IsRowVisible(BROW_TABLE_ROW)); - static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( SID_QUERY_VIEW_TABLES ); - break; - case ID_QUERY_ALIASNAME: - SetRowVisible(BROW_COLUMNALIAS_ROW, !IsRowVisible(BROW_COLUMNALIAS_ROW)); - static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( SID_QUERY_VIEW_ALIASES ); - break; - case ID_QUERY_DISTINCT: - static_cast<OQueryController&>(getDesignView()->getController()).setDistinct(!static_cast<OQueryController&>(getDesignView()->getController()).isDistinct()); - static_cast<OQueryController&>(getDesignView()->getController()).setModified( true ); - static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( SID_QUERY_DISTINCT_VALUES ); - break; + static_cast<OQueryController&>(getDesignView()->getController()).setDistinct(!static_cast<OQueryController&>(getDesignView()->getController()).isDistinct()); + static_cast<OQueryController&>(getDesignView()->getController()).setModified( true ); + static_cast<OQueryController&>(getDesignView()->getController()).InvalidateFeature( SID_QUERY_DISTINCT_VALUES ); } static_cast<OQueryController&>(getDesignView()->getController()).setModified( true ); diff --git a/dbaccess/source/ui/querydesign/query.src b/dbaccess/source/ui/querydesign/query.src index 4914830cebf6..d96f0c3632e7 100644 --- a/dbaccess/source/ui/querydesign/query.src +++ b/dbaccess/source/ui/querydesign/query.src @@ -104,45 +104,6 @@ String STR_QRY_ORDERBY_UNRELATED Text [ en-US ] = "The database only supports sorting for visible fields."; }; -Menu RID_QUERYFUNCTION_POPUPMENU -{ - ItemList = - { - MenuItem - { - Identifier = ID_QUERY_FUNCTION ; - HelpID = HID_QUERY_FUNCTION; - Text [ en-US ] = "Functions"; - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = ID_QUERY_TABLENAME ; - HelpID = HID_QUERY_TABLENAME ; - Text [ en-US ] = "Table Name"; - }; - MenuItem - { - Identifier = ID_QUERY_ALIASNAME ; - HelpID = HID_QUERY_ALIASNAME ; - Text [ en-US ] = "Alias"; - }; - MenuItem - { - Separator = TRUE; - }; - MenuItem - { - Identifier = ID_QUERY_DISTINCT ; - HelpID = HID_QUERY_DISTINCT ; - Text [ en-US ] = "Distinct Values"; - }; - }; -}; - String STR_QUERY_HANDLETEXT { Text [ en-US ] = "Field;Alias;Table;Sort;Visible;Function;Criterion;Or;Or"; diff --git a/dbaccess/uiconfig/ui/queryfuncmenu.ui b/dbaccess/uiconfig/ui/queryfuncmenu.ui new file mode 100644 index 000000000000..dc8793f312d7 --- /dev/null +++ b/dbaccess/uiconfig/ui/queryfuncmenu.ui @@ -0,0 +1,53 @@ +<?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="functions"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Functions</property> + <property name="use_underline">True</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="GtkMenuItem" id="tablename"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Table Name</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="alias"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Alias</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem" id="menuitem2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="distinct"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Distinct Values</property> + <property name="use_underline">True</property> + </object> + </child> + </object> +</interface> |