Common: Add Copy Folder Path to context menu

This commit is contained in:
Jonathan Jenne 2021-03-25 14:10:25 +01:00
parent 9f7a12dcf5
commit 5db5a508cb

View File

@ -18,7 +18,8 @@ Public Class DocumentPropertyMenu
Public Const OPEN_FILE As String = "Datei öffnen"
Public Const OPEN_DIRECTORY As String = "Ordner öffnen"
Public Const COPY_PATH As String = "Dateipfad kopieren"
Public Const COPY_FILE_PATH As String = "Dateipfad kopieren"
Public Const COPY_FOLDER_PATH As String = "Ordnerpfad kopieren"
Public Const OPEN_PROPERTIES As String = "Eigenschaften"
Public Event FileOpened As EventHandler(Of String)
@ -45,7 +46,8 @@ Public Class DocumentPropertyMenu
Public Function GetIDBMenuItems(AccessRight As AccessRight) As List(Of DXMenuItem)
Dim oOpenFile = New DXMenuItem(OPEN_FILE, AddressOf OpenFile_Click)
Dim oOpenFolder = New DXMenuItem(OPEN_DIRECTORY, AddressOf OpenFolder_Click)
Dim oCopyPath = New DXMenuItem(COPY_PATH, AddressOf CopyPath_Click)
Dim oCopyFilePath = New DXMenuItem(COPY_FILE_PATH, AddressOf CopyFilePath_Click)
Dim oCopyFolderPath = New DXMenuItem(COPY_FOLDER_PATH, AddressOf CopyFolderPath_Click)
Dim oProperties = New DXMenuItem(OPEN_PROPERTIES, AddressOf Properties_Click)
If AccessRight = AccessRight.VIEW_ONLY Then
@ -56,7 +58,8 @@ Public Class DocumentPropertyMenu
Return New List(Of DXMenuItem) From {
oOpenFile,
oOpenFolder,
oCopyPath,
oCopyFilePath,
oCopyFolderPath,
oProperties
}
End If
@ -65,7 +68,7 @@ Public Class DocumentPropertyMenu
Public Function GetLegacyMenuItems() As List(Of DXMenuItem)
Dim oOpenFile = New DXMenuItem(OPEN_FILE, AddressOf OpenFile_Click)
Dim oOpenFolder = New DXMenuItem(OPEN_DIRECTORY, AddressOf OpenFolder_Click)
Dim oCopyPath = New DXMenuItem(COPY_PATH, AddressOf CopyPath_Click)
Dim oCopyPath = New DXMenuItem(COPY_FILE_PATH, AddressOf CopyFilePath_Click)
Dim oProperties = New DXMenuItem(OPEN_PROPERTIES, AddressOf Properties_Click_Legacy)
Return New List(Of DXMenuItem) From {
@ -93,10 +96,15 @@ Public Class DocumentPropertyMenu
_File.OpenFileProperties(_FilePath)
End Sub
Public Sub CopyPath_Click(sender As Object, e As EventArgs)
Public Sub CopyFilePath_Click(sender As Object, e As EventArgs)
Clipboard.SetText(_FilePath)
End Sub
Public Sub CopyFolderPath_Click(sender As Object, e As EventArgs)
Dim oFolderPath = IO.Path.GetDirectoryName(_FilePath)
Clipboard.SetText(oFolderPath)
End Sub
Public Sub OpenFile_Click(sender As Object, e As EventArgs)
If TestPathExists(OPEN_FILE) = False Then
Exit Sub