Skip to content
Permalink
Browse files

Add menu item "Open URL" to grid context menu, enabled only if underl…

…ying field text is a HTTP URL. Closes #692
  • Loading branch information...
ansgarbecker committed Sep 16, 2019
1 parent a5c4498 commit d114ef1adc5601f97352ffaecc49052ea9e406ff
Showing with 33 additions and 1 deletion.
  1. +7 −1 out/locale/en/LC_MESSAGES/default.po
  2. +10 −0 source/main.dfm
  3. +16 −0 source/main.pas
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2019-08-16 07:10+0200\n"
"PO-Revision-Date: 2019-09-16 20:35+0200\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"MIME-Version: 1.0\n"
@@ -6410,3 +6410,9 @@ msgstr "Security issue: Using %s %s with insecure %s."

msgid "You should install %s from %s"
msgstr "You should install %s from %s"

msgid "Open URL"
msgstr "Open URL"

msgid "Open URL in your webbrowser"
msgstr "Open URL in your webbrowser"
@@ -3088,6 +3088,13 @@ object MainForm: TMainForm
ShortCut = 24643
OnExecute = actCopyOrCutExecute
end
object actDataOpenUrl: TAction
Category = 'Data'
Caption = 'Open URL'
Hint = 'Open URL in your webbrowser'
ImageIndex = 69
OnExecute = actDataOpenUrlExecute
end
end
object menuConnections: TPopupMenu
AutoHotkeys = maManual
@@ -3390,6 +3397,9 @@ object MainForm: TMainForm
Action = actPreferencesData
end
end
object OpenURL1: TMenuItem
Action = actDataOpenUrl
end
object N4a: TMenuItem
Caption = '-'
end
@@ -653,6 +653,8 @@ TMainForm = class(TExtForm)
Switchtoqueryresults1: TMenuItem;
actGoToDataMultiFilter: TAction;
Datatabfilter1: TMenuItem;
actDataOpenUrl: TAction;
OpenURL1: TMenuItem;
procedure actCreateDBObjectExecute(Sender: TObject);
procedure menuConnectionsPopup(Sender: TObject);
procedure actExitApplicationExecute(Sender: TObject);
@@ -1022,6 +1024,7 @@ TMainForm = class(TExtForm)
procedure TimerStoreTabsTimer(Sender: TObject);
procedure actGoToQueryResultsExecute(Sender: TObject);
procedure actGoToDataMultiFilterExecute(Sender: TObject);
procedure actDataOpenUrlExecute(Sender: TObject);
private
// Executable file details
FAppVerMajor: Integer;
@@ -4935,6 +4938,17 @@ procedure TMainForm.actDataLastExecute(Sender: TObject);
ValidateControls(Sender);
end;


procedure TMainForm.actDataOpenUrlExecute(Sender: TObject);
var
Grid: TVirtualStringTree;
begin
// Open grid cell url in web browser
Grid := ActiveGrid;
ShellExec(Grid.Text[Grid.FocusedNode, Grid.FocusedColumn]);
end;


procedure TMainForm.actDataPostChangesExecute(Sender: TObject);
var
Grid: TVirtualStringTree;
@@ -5773,6 +5787,8 @@ procedure TMainForm.ValidateControls(Sender: TObject);
actDataSaveBlobToFile.Enabled := HasConnection and inDataOrQueryTabNotEmpty and Assigned(Grid.FocusedNode);
actGridEditFunction.Enabled := HasConnection and inDataOrQueryTabNotEmpty and Assigned(Grid.FocusedNode);
actDataPreview.Enabled := HasConnection and inDataOrQueryTabNotEmpty and Assigned(Grid.FocusedNode);
actDataOpenUrl.Enabled := HasConnection and inDataOrQueryTabNotEmpty and Assigned(Grid.FocusedNode)
and ExecRegExpr('^https?://[^\s]+$', Grid.Text[Grid.FocusedNode, Grid.FocusedColumn]);
actUnixTimestampColumn.Enabled := HasConnection and inDataTab and EnableTimestamp;
actUnixTimestampColumn.Checked := inDataTab and HandleUnixTimestampColumn(Grid, Grid.FocusedColumn);
actPreviousResult.Enabled := HasConnection and inDataOrQueryTabNotEmpty;

0 comments on commit d114ef1

Please sign in to comment.
You can’t perform that action at this time.