Restrict to allowed extensions import
parent
e47b726467
commit
c746f26abd
|
@ -93,24 +93,9 @@ fun app() {
|
|||
glossairePage(
|
||||
onAjouterMotClick = { currentPage.value = "formulaire" },
|
||||
onImporterClick = {
|
||||
val fileDialog = FileDialog(Frame(), "Select a file", FileDialog.LOAD)
|
||||
fileDialog.file = "Untitled.csv" // Initial file name
|
||||
fileDialog.isMultipleMode = false // To enable selecting only one file
|
||||
|
||||
fileDialog.setFile("*.csv")
|
||||
fileDialog.isVisible = true
|
||||
|
||||
val selectedFile = fileDialog.file
|
||||
val selectedDirectory = fileDialog.directory
|
||||
|
||||
if (selectedFile != null) {
|
||||
val filePath = selectedDirectory + selectedFile
|
||||
println("Opening: $filePath")
|
||||
|
||||
selectFile(setOf("csv")) { filePath ->
|
||||
println("Importing file: $filePath")
|
||||
importCSV(filePath)
|
||||
|
||||
} else {
|
||||
println("Open command cancelled by user.")
|
||||
}
|
||||
},
|
||||
onExporterClick = {
|
||||
|
|
Loading…
Reference in New Issue