From 5d4211f1ba25560be14a3dd0f1f478db254877e5 Mon Sep 17 00:00:00 2001 From: Raj Date: Mon, 18 Nov 2019 13:04:09 -0700 Subject: [PATCH] Copy headers and rows tab-separated Added context menu to allow for copying of queried data with headers and rows with tabs as separators. Will make life easier to copy and paste into Excel --- backend/wbpublic/sqlide/recordset_be.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/wbpublic/sqlide/recordset_be.cpp b/backend/wbpublic/sqlide/recordset_be.cpp index 5163e0054..46aefdd84 100644 --- a/backend/wbpublic/sqlide/recordset_be.cpp +++ b/backend/wbpublic/sqlide/recordset_be.cpp @@ -1157,6 +1157,12 @@ void Recordset::update_selection_for_menu(const std::vector &rows, int clic std::bind(&Recordset::activate_menu_item, this, "copy_row_unquoted_with_names", rows, clicked_column), "Copy Row With Names and Unquoted)", "copy_row_unquoted_with_names"); + item = _context_menu->add_item_with_title( + "Copy Row (with names, tab separated)", + std::bind(&Recordset::activate_menu_item, this, "copy_row_with_names_tabsep", rows, clicked_column), + "Copy Row with Names Tab Separated", "copy_row_with_names_tabsep"); + item->set_enabled(rows.size() > 0); + item = _context_menu->add_item_with_title( "Copy Row (tab separated)", std::bind(&Recordset::activate_menu_item, this, "copy_row_tabsep", rows, clicked_column), @@ -1244,6 +1250,8 @@ void Recordset::activate_menu_item(const std::string &action, const std::vector< } } else if (action == "copy_row_unquoted_with_names") { copy_rows_to_clipboard(rows, ", ", false, true); + } else if (action == "copy_row_with_names_tabsep") { + copy_rows_to_clipboard(rows, "\t", false, true); } else if (action == "copy_row_tabsep") { if (rows.size() > 0) { copy_rows_to_clipboard(rows, "\t", false);