summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/tabledesign/TEditControl.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-04-18 10:34:10 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-04-18 10:39:11 +0100
commit9714e7460c3ff67f2683483bf3634b2f31cda361 (patch)
treee6cbb126c725508916456289e1b486f2aacd27f4 /dbaccess/source/ui/tabledesign/TEditControl.cxx
parente7cd5953c3df5904cbcf07cc1b017cf3b7138d56 (diff)
convert table design row menu to .ui
Change-Id: I8a6be28ccd7cbd2b8f18255e3da01df2dfe13fb8
Diffstat (limited to 'dbaccess/source/ui/tabledesign/TEditControl.cxx')
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx64
1 files changed, 31 insertions, 33 deletions
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() );
}
}
}