Restrict to allowed extensions import
parent
e47b726467
commit
c746f26abd
|
@ -93,24 +93,9 @@ fun app() {
|
||||||
glossairePage(
|
glossairePage(
|
||||||
onAjouterMotClick = { currentPage.value = "formulaire" },
|
onAjouterMotClick = { currentPage.value = "formulaire" },
|
||||||
onImporterClick = {
|
onImporterClick = {
|
||||||
val fileDialog = FileDialog(Frame(), "Select a file", FileDialog.LOAD)
|
selectFile(setOf("csv")) { filePath ->
|
||||||
fileDialog.file = "Untitled.csv" // Initial file name
|
println("Importing file: $filePath")
|
||||||
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")
|
|
||||||
|
|
||||||
importCSV(filePath)
|
importCSV(filePath)
|
||||||
|
|
||||||
} else {
|
|
||||||
println("Open command cancelled by user.")
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onExporterClick = {
|
onExporterClick = {
|
||||||
|
|
Loading…
Reference in New Issue