Project browser: Use a better dialog to handle file overwrite during a copy.
[DEVELOPMENT ENVIRONMENT] * NEW: Project browser: Use a better dialog to handle file overwrite during a copy. * NEW: Update French translation.
This commit is contained in:
parent
ee1a23039d
commit
e9a050ebcb
4 changed files with 7622 additions and 7702 deletions
app/src/gambas3
File diff suppressed because it is too large
Load diff
50
app/src/gambas3/.src/Editor/Browse/FFileOverwrite.class
Normal file
50
app/src/gambas3/.src/Editor/Browse/FFileOverwrite.class
Normal file
|
@ -0,0 +1,50 @@
|
|||
' Gambas class file
|
||||
|
||||
Public Enum ACTION_OVERWRITE, ACTION_RENAME, ACTION_IGNORE
|
||||
|
||||
Static Public FileAction As Integer
|
||||
Static Public ApplyToAll As Boolean
|
||||
|
||||
Public Sub Run(sFile As String) As Boolean
|
||||
|
||||
Dim bCancel As Boolean
|
||||
Dim iBusy As Integer
|
||||
|
||||
Me.Title = Subst(("Overwrite '&1'?"), sFile)
|
||||
|
||||
iBusy = Application.Busy
|
||||
Application.Busy = 0
|
||||
bCancel = Not Me.ShowModal()
|
||||
Application.Busy = iBusy
|
||||
|
||||
If radOverwrite.Value Then
|
||||
FileAction = ACTION_OVERWRITE
|
||||
Else If radRename.Value Then
|
||||
FileAction = ACTION_RENAME
|
||||
Else If radIgnore.Value Then
|
||||
FileAction = ACTION_IGNORE
|
||||
Endif
|
||||
|
||||
ApplyToAll = chkApplyAll.Value
|
||||
|
||||
Return bCancel
|
||||
|
||||
End
|
||||
|
||||
Public Sub btnOK_Click()
|
||||
|
||||
Me.Close(True)
|
||||
|
||||
End
|
||||
|
||||
Public Sub btnCancel_Click()
|
||||
|
||||
Me.Close
|
||||
|
||||
End
|
||||
|
||||
Public Sub radAction_Click()
|
||||
|
||||
btnOK.Enabled = True
|
||||
|
||||
End
|
72
app/src/gambas3/.src/Editor/Browse/FFileOverwrite.form
Normal file
72
app/src/gambas3/.src/Editor/Browse/FFileOverwrite.form
Normal file
|
@ -0,0 +1,72 @@
|
|||
# Gambas Form File 3.0
|
||||
|
||||
{ Form Form
|
||||
MoveScaled(0,0,69,27)
|
||||
Resizable = False
|
||||
Arrangement = Arrange.Vertical
|
||||
Margin = True
|
||||
{ panMessage HBox
|
||||
MoveScaled(0,1,67,19)
|
||||
Expand = True
|
||||
Margin = True
|
||||
{ Panel3 Panel
|
||||
MoveScaled(1,1,8,17)
|
||||
{ picMessage PictureBox
|
||||
MoveScaled(0,0,8,8)
|
||||
Picture = Picture.Load("icon:/128/warning")
|
||||
Alignment = Align.Center
|
||||
Mode = PictureBox.Fill
|
||||
}
|
||||
}
|
||||
{ Panel2 Panel
|
||||
MoveScaled(10,2,2,4)
|
||||
}
|
||||
{ Panel4 VBox
|
||||
MoveScaled(14,1,48,17)
|
||||
Expand = True
|
||||
PopupMenu = "mnuPopup"
|
||||
Spacing = True
|
||||
{ txtMessage TextLabel
|
||||
MoveScaled(1,1,41,3)
|
||||
Text = ("Destination already exists. Do you want to:")
|
||||
}
|
||||
{ radOverwrite RadioButton radAction
|
||||
Name = "radOverwrite"
|
||||
MoveScaled(0,5,34,3)
|
||||
Text = ("Overwrite the file")
|
||||
}
|
||||
{ radRename RadioButton radAction
|
||||
Name = "radRename"
|
||||
MoveScaled(0,9,34,3)
|
||||
Text = ("Rename the file")
|
||||
}
|
||||
{ radIgnore RadioButton radAction
|
||||
Name = "radIgnore"
|
||||
MoveScaled(0,13,34,3)
|
||||
Text = ("Ignore the file")
|
||||
}
|
||||
}
|
||||
}
|
||||
{ HBox1 HBox
|
||||
MoveScaled(1,22,65,4)
|
||||
Spacing = True
|
||||
{ chkApplyAll CheckBox
|
||||
MoveScaled(2,0,16,4)
|
||||
AutoResize = True
|
||||
Text = ("Apply to all")
|
||||
}
|
||||
{ Panel1 Panel
|
||||
MoveScaled(24,0,4,4)
|
||||
Expand = True
|
||||
}
|
||||
{ btnOK Button
|
||||
MoveScaled(29,0,16,4)
|
||||
Text = ("Continue")
|
||||
}
|
||||
{ btnCancel Button
|
||||
MoveScaled(47,0,16,4)
|
||||
Text = ("Cancel")
|
||||
Cancel = True
|
||||
}
|
||||
}
|
||||
}
|
|
@ -218,6 +218,7 @@ Private Sub Paste(aPaths As String[], Optional sSubDir As String, Optional bClon
|
|||
Dim sStrip As String
|
||||
Dim sText As String
|
||||
Dim sButton As String
|
||||
Dim bApplyToAll As Boolean
|
||||
|
||||
If Not aPaths Or If aPaths.Count = 0 Then Return
|
||||
|
||||
|
@ -268,18 +269,29 @@ Private Sub Paste(aPaths As String[], Optional sSubDir As String, Optional bClon
|
|||
sName = File.Name(sPath)
|
||||
sDest = sDir &/ sName
|
||||
If Exist(sDest) Then
|
||||
|
||||
If bClone Then
|
||||
|
||||
sDest = sDir &/ Project.GetUniqueName(sDir, sName)
|
||||
|
||||
Else
|
||||
Select Case Message.Question(Project.GetMessagePrefix(sDest) & ("Destination already exists.") & "\n\n" & Subst(("Do you want to rename it as <b><tt>&1</tt></b>?"), Project.GetUniqueName(sDir, sName)), ("Rename"), ("Ignore"), ("Cancel"))
|
||||
Case 1
|
||||
|
||||
If Not bApplyToAll Then
|
||||
If FFileOverwrite.Run(sName) Then Break
|
||||
bApplyToAll = FFileOverwrite.ApplyToAll
|
||||
Endif
|
||||
|
||||
Select Case FFileOverwrite.FileAction
|
||||
Case FFileOverwrite.ACTION_OVERWRITE
|
||||
Try Project.DeleteFile(sDest)
|
||||
sDest = sDir &/ sName
|
||||
Case FFileOverwrite.ACTION_RENAME
|
||||
sDest = sDir &/ Project.GetUniqueName(sDir, sName)
|
||||
Case 2
|
||||
Case FFileOverwrite.ACTION_IGNORE
|
||||
Continue
|
||||
Case 3
|
||||
Break
|
||||
End Select
|
||||
Endif
|
||||
|
||||
Endif
|
||||
|
||||
If $bCut Then
|
||||
|
|
Loading…
Reference in a new issue