dbaccess/source/ui/tabledesign/TEditControl.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
New commits: commit 4bab6b0b870ae56b8d40eac22dbb0a433006789e Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Fri Sep 15 16:53:17 2023 +0200 Commit: Julien Nabet <serval2...@yahoo.fr> CommitDate: Fri Sep 15 18:48:42 2023 +0200 tdf#71224: Remove "Insert fields" option for an existing table (workaround) For the moment, we don't implement insert field at specific position It's not SQL standard and each database has made its choice (some use "BEFORE", other "FIRST" and "AFTER") and some, like Postgresql, don't allow this. So for the moment, test if the table already exists (and so it's an edition), in this case only we remove "Insert fields" entry. Indeed, in case of new table, there's no pb. The real fix is to implement the insert for each database + error message for those which don't support this Change-Id: I27010ed2dddee3f8746245406f2a0cb629b3d8e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156948 Reviewed-by: Julien Nabet <serval2...@yahoo.fr> Tested-by: Jenkins diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index b3f5dbbe33c8..55696fe36463 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -1412,8 +1412,17 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt) xContextMenu->remove("paste"); if (!IsDeleteAllowed()) xContextMenu->remove("delete"); - if (!IsInsertNewAllowed(nRow)) + // tdf#71224: WORKAROUND for the moment, we don't implement insert field at specific position + // It's not SQL standard and each database has made its choice (some use "BEFORE", other "FIRST" and "AFTER") + // and some, like Postgresql, don't allow this. + // So for the moment, test if the table already exists (and so it's an edition), in this case only + // we remove "Insert Fields" entry. Indeed, in case of new table, there's no pb. + // + // The real fix is to implement the insert for each database + error message for those which don't support this + //if (!IsInsertNewAllowed(nRow)) + if ( GetView()->getController().getTable().is() ) xContextMenu->remove("insert"); + if (IsPrimaryKeyAllowed()) { xContextMenu->set_active("primarykey", IsRowSelected(GetCurRow()) && IsPrimaryKey());