changeset 60:d0b83fc1d62a default tip

Remember our input directory on a per-invocation basis.
author David Barts <n5jrn@me.com>
date Sun, 26 Jul 2020 15:14:03 -0700
parents 4997ae108653
children
files build.xml src/name/blackcap/exifwasher/Menus.kt
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/build.xml	Sun Jul 26 14:26:06 2020 -0700
+++ b/build.xml	Sun Jul 26 15:14:03 2020 -0700
@@ -78,7 +78,7 @@
 
   <!-- Define the properties used by the build -->
   <property name="app.name"      value="${ant.project.name}"/>
-  <property name="app.version"   value="1.04"/>
+  <property name="app.version"   value="1.05"/>
   <property name="app.domain"    value="name.blackcap.exifwasher"/>
   <property name="app.entry"     value="${app.domain}.MainKt"/>
   <property name="app.copyright" value="Copyright © 2020, David W. Barts."/>
--- a/src/name/blackcap/exifwasher/Menus.kt	Sun Jul 26 14:26:06 2020 -0700
+++ b/src/name/blackcap/exifwasher/Menus.kt	Sun Jul 26 15:14:03 2020 -0700
@@ -6,15 +6,19 @@
 import java.awt.event.ActionEvent
 import java.awt.event.ActionListener
 import java.awt.event.KeyEvent
+import java.io.File
 import java.util.logging.Level
 import java.util.logging.Logger
 import javax.swing.*
+import javax.swing.filechooser.FileNameExtensionFilter
 
 /**
  * Our menu bar. What we display depends somewhat on the system type, as
  * the Mac gives us a gratuitous menu bar entry for handling some stuff.
  */
 class MyMenuBar: JMenuBar() {
+    private var currentInputDirectory = File(System.getProperty("user.home"))
+
     init {
         add(JMenu("File").apply {
             add(JMenuItem("Wash…").apply {
@@ -61,11 +65,16 @@
 
     fun doWash() {
         val fc = JFileChooser().apply {
+            currentDirectory = currentInputDirectory
+            fileFilter = FileNameExtensionFilter("JPEG Files", "jpg", "jpeg")
             setMultiSelectionEnabled(true)
         }
         val status = fc.showOpenDialog(Application.mainFrame)
         if (status == JFileChooser.APPROVE_OPTION) {
-            for (file in fc.getSelectedFiles()) {
+            val files = fc.getSelectedFiles()
+            if (files.size > 0)
+                currentInputDirectory = files[0].canonicalFile.parentFile
+            for (file in files) {
                 WashDialog().wash(file)
             }
         }