Improve UI, take "dirty" check into account, move launcher to Main.java
[jvcard.git] / src / be / nikiroo / jvcard / Card.java
index a9018ca066d1cc590fcb92b76ce884919150a1ea..65ab6fa5225b91fdacdd3430fdc52abdbb317395 100644 (file)
@@ -24,10 +24,15 @@ public class Card {
        private List<Contact> contacts;
        private File file;
        private boolean dirty;
+       private String name;
 
        public Card(File file, Format format) throws IOException {
                this.file = file;
 
+               if (file != null) {
+                       name = file.getName();
+               }
+
                BufferedReader buffer = new BufferedReader(new FileReader(file));
                List<String> lines = new LinkedList<String>();
                for (String line = buffer.readLine(); line != null; line = buffer
@@ -36,6 +41,7 @@ public class Card {
                }
 
                load(lines, format);
+               dirty = false; // initial load, so no change yet
        }
 
        public List<Contact> getContacts() {
@@ -88,6 +94,15 @@ public class Card {
                return dirty;
        }
 
+       /**
+        * Return the name of this card.
+        * 
+        * @return the name
+        */
+       public String getName() {
+               return name;
+       }
+
        /**
         * Notify that this element has unsaved changes.
         */