summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/tabledesign/TEditControl.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-12-21 11:10:05 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-12-21 22:01:47 +0100
commit8f92097111fcdbb5322dd87474c719b15c08308d (patch)
treec4a6da114888e41483ace701e976dd71571c43a0 /dbaccess/source/ui/tabledesign/TEditControl.cxx
parent46ac4c3916ac6544eb1834e714eaa676c2af8bd5 (diff)
weld tabledesignrowmenu
Change-Id: If4fc3d02308afa27a4eb4d8ee5326440a0d4f5b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108097 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source/ui/tabledesign/TEditControl.cxx')
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx36
1 files changed, 19 insertions, 17 deletions
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index fec166aa4cdb..55114d3a416a 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -41,9 +41,7 @@
#include <UITools.hxx>
#include "TableFieldControl.hxx"
#include <dsntypes.hxx>
-#include <vcl/builder.hxx>
#include <vcl/commandevent.hxx>
-#include <vcl/menu.hxx>
#include <vcl/svapp.hxx>
using namespace ::dbaui;
@@ -1399,19 +1397,24 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt)
}
else
{
- VclBuilder aBuilder(nullptr, AllSettings::GetUIRootDir(), "dbaccess/ui/tabledesignrowmenu.ui", "");
- VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu"));
-
- aContextMenu->EnableItem(aContextMenu->GetItemId("cut"), IsCutAllowed());
- aContextMenu->EnableItem(aContextMenu->GetItemId("copy"), IsCopyAllowed());
- aContextMenu->EnableItem(aContextMenu->GetItemId("paste"), IsPasteAllowed());
- aContextMenu->EnableItem(aContextMenu->GetItemId("delete"), IsDeleteAllowed());
- aContextMenu->EnableItem(aContextMenu->GetItemId("primarykey"), IsPrimaryKeyAllowed());
- aContextMenu->EnableItem(aContextMenu->GetItemId("insert"), IsInsertNewAllowed(nRow));
- aContextMenu->CheckItem("primarykey", IsRowSelected(GetCurRow()) && IsPrimaryKey());
-
- // remove all the disable entries
- aContextMenu->RemoveDisabledEntries(true, true);
+ ::tools::Rectangle aRect(aMenuPos, Size(1, 1));
+ weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect);
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, "dbaccess/ui/tabledesignrowmenu.ui"));
+ std::unique_ptr<weld::Menu> xContextMenu(xBuilder->weld_menu("menu"));
+
+ if (!IsCutAllowed())
+ xContextMenu->remove("cut");
+ if (!IsCopyAllowed())
+ xContextMenu->remove("copy");
+ if (!IsPasteAllowed())
+ xContextMenu->remove("paste");
+ if (!IsDeleteAllowed())
+ xContextMenu->remove("delete");
+ if (!IsPrimaryKeyAllowed())
+ xContextMenu->remove("primarykey");
+ if (!IsInsertNewAllowed(nRow))
+ xContextMenu->remove("insert");
+ xContextMenu->set_active("primarykey", IsRowSelected(GetCurRow()) && IsPrimaryKey());
if( SetDataPtr(m_nDataPos) )
pDescrWin->SaveData( pActRow->GetActFieldDescr() );
@@ -1419,8 +1422,7 @@ 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();
- aContextMenu->Execute(this, aMenuPos);
- OString sIdent = aContextMenu->GetCurItemIdent();
+ OString sIdent = xContextMenu->popup_at_rect(pPopupParent, aRect);
if (sIdent == "cut")
cut();
else if (sIdent == "copy")