OSDN Git Service

Add generic icons and remember path selection.
authorRandy Baumgarte <randy@fbn.cx>
Fri, 31 Dec 2010 17:44:09 +0000 (12:44 -0500)
committerRandy Baumgarte <randy@fbn.cx>
Sat, 1 Jan 2011 23:41:07 +0000 (18:41 -0500)
58 files changed:
images/alarm_clock.png [new file with mode: 0644]
images/blueprint.png [new file with mode: 0644]
images/book.png [new file with mode: 0644]
images/calendar.png [new file with mode: 0644]
images/camera.png [new file with mode: 0644]
images/camera2.png [new file with mode: 0644]
images/canvas-picture.png [new file with mode: 0644]
images/chef.png [new file with mode: 0644]
images/classifieds.png [new file with mode: 0644]
images/clock.png [new file with mode: 0644]
images/collection.png [new file with mode: 0644]
images/conversation.png [new file with mode: 0644]
images/dollar_sign.png [new file with mode: 0644]
images/duck.png [new file with mode: 0644]
images/ekg.png [new file with mode: 0644]
images/email-red.png [new file with mode: 0644]
images/exclamation-yellow.png [new file with mode: 0644]
images/face.png [new file with mode: 0644]
images/falcon.png [new file with mode: 0644]
images/floppy.png [new file with mode: 0644]
images/floppy2.png [new file with mode: 0644]
images/folder.png [new file with mode: 0644]
images/french-fries.png [new file with mode: 0644]
images/giftbox_blue.png [new file with mode: 0644]
images/globe.png [new file with mode: 0644]
images/gold-globe.png [new file with mode: 0644]
images/green-map-mark.png [new file with mode: 0644]
images/halloween.png [new file with mode: 0644]
images/htools.png [new file with mode: 0644]
images/important.png [new file with mode: 0644]
images/info.png [new file with mode: 0644]
images/iphone.png [new file with mode: 0644]
images/link.png [new file with mode: 0644]
images/lock.png [new file with mode: 0644]
images/mail-green.png [new file with mode: 0644]
images/mammoth.png [new file with mode: 0644]
images/money.png [new file with mode: 0644]
images/mypc-icon.png [new file with mode: 0644]
images/news.png [new file with mode: 0644]
images/notebook.png [new file with mode: 0644]
images/ornament.png [new file with mode: 0644]
images/paints.png [new file with mode: 0644]
images/penguin.png [new file with mode: 0644]
images/printer.png [new file with mode: 0644]
images/puzzle.png [new file with mode: 0644]
images/red-map-mark.png [new file with mode: 0644]
images/restaurant.png [new file with mode: 0644]
images/rss.png [new file with mode: 0644]
images/safari.png [new file with mode: 0644]
images/safe-open.png [new file with mode: 0644]
images/shopping-cart.png [new file with mode: 0644]
images/smiley-glasses.png [new file with mode: 0644]
images/smiley.png [new file with mode: 0644]
images/sync.png [new file with mode: 0644]
images/tools.png [new file with mode: 0644]
images/warning.png [new file with mode: 0644]
src/cx/fbn/nevernote/NeverNote.java
src/cx/fbn/nevernote/dialog/SetIcon.java

diff --git a/images/alarm_clock.png b/images/alarm_clock.png
new file mode 100644 (file)
index 0000000..0611478
Binary files /dev/null and b/images/alarm_clock.png differ
diff --git a/images/blueprint.png b/images/blueprint.png
new file mode 100644 (file)
index 0000000..862e2b2
Binary files /dev/null and b/images/blueprint.png differ
diff --git a/images/book.png b/images/book.png
new file mode 100644 (file)
index 0000000..055876e
Binary files /dev/null and b/images/book.png differ
diff --git a/images/calendar.png b/images/calendar.png
new file mode 100644 (file)
index 0000000..14edab0
Binary files /dev/null and b/images/calendar.png differ
diff --git a/images/camera.png b/images/camera.png
new file mode 100644 (file)
index 0000000..57b60da
Binary files /dev/null and b/images/camera.png differ
diff --git a/images/camera2.png b/images/camera2.png
new file mode 100644 (file)
index 0000000..aefeb80
Binary files /dev/null and b/images/camera2.png differ
diff --git a/images/canvas-picture.png b/images/canvas-picture.png
new file mode 100644 (file)
index 0000000..0fc6161
Binary files /dev/null and b/images/canvas-picture.png differ
diff --git a/images/chef.png b/images/chef.png
new file mode 100644 (file)
index 0000000..e05caa8
Binary files /dev/null and b/images/chef.png differ
diff --git a/images/classifieds.png b/images/classifieds.png
new file mode 100644 (file)
index 0000000..bbc702c
Binary files /dev/null and b/images/classifieds.png differ
diff --git a/images/clock.png b/images/clock.png
new file mode 100644 (file)
index 0000000..a5e84e6
Binary files /dev/null and b/images/clock.png differ
diff --git a/images/collection.png b/images/collection.png
new file mode 100644 (file)
index 0000000..6525a90
Binary files /dev/null and b/images/collection.png differ
diff --git a/images/conversation.png b/images/conversation.png
new file mode 100644 (file)
index 0000000..0080290
Binary files /dev/null and b/images/conversation.png differ
diff --git a/images/dollar_sign.png b/images/dollar_sign.png
new file mode 100644 (file)
index 0000000..ccd123b
Binary files /dev/null and b/images/dollar_sign.png differ
diff --git a/images/duck.png b/images/duck.png
new file mode 100644 (file)
index 0000000..324cf37
Binary files /dev/null and b/images/duck.png differ
diff --git a/images/ekg.png b/images/ekg.png
new file mode 100644 (file)
index 0000000..3c5be16
Binary files /dev/null and b/images/ekg.png differ
diff --git a/images/email-red.png b/images/email-red.png
new file mode 100644 (file)
index 0000000..d11bb5f
Binary files /dev/null and b/images/email-red.png differ
diff --git a/images/exclamation-yellow.png b/images/exclamation-yellow.png
new file mode 100644 (file)
index 0000000..e2a57d5
Binary files /dev/null and b/images/exclamation-yellow.png differ
diff --git a/images/face.png b/images/face.png
new file mode 100644 (file)
index 0000000..7da8a1b
Binary files /dev/null and b/images/face.png differ
diff --git a/images/falcon.png b/images/falcon.png
new file mode 100644 (file)
index 0000000..744d8a3
Binary files /dev/null and b/images/falcon.png differ
diff --git a/images/floppy.png b/images/floppy.png
new file mode 100644 (file)
index 0000000..4de7c96
Binary files /dev/null and b/images/floppy.png differ
diff --git a/images/floppy2.png b/images/floppy2.png
new file mode 100644 (file)
index 0000000..1775e59
Binary files /dev/null and b/images/floppy2.png differ
diff --git a/images/folder.png b/images/folder.png
new file mode 100644 (file)
index 0000000..d73a573
Binary files /dev/null and b/images/folder.png differ
diff --git a/images/french-fries.png b/images/french-fries.png
new file mode 100644 (file)
index 0000000..993d20a
Binary files /dev/null and b/images/french-fries.png differ
diff --git a/images/giftbox_blue.png b/images/giftbox_blue.png
new file mode 100644 (file)
index 0000000..2e90250
Binary files /dev/null and b/images/giftbox_blue.png differ
diff --git a/images/globe.png b/images/globe.png
new file mode 100644 (file)
index 0000000..3d4d94c
Binary files /dev/null and b/images/globe.png differ
diff --git a/images/gold-globe.png b/images/gold-globe.png
new file mode 100644 (file)
index 0000000..cc4a381
Binary files /dev/null and b/images/gold-globe.png differ
diff --git a/images/green-map-mark.png b/images/green-map-mark.png
new file mode 100644 (file)
index 0000000..0f79315
Binary files /dev/null and b/images/green-map-mark.png differ
diff --git a/images/halloween.png b/images/halloween.png
new file mode 100644 (file)
index 0000000..61a1ab4
Binary files /dev/null and b/images/halloween.png differ
diff --git a/images/htools.png b/images/htools.png
new file mode 100644 (file)
index 0000000..225f630
Binary files /dev/null and b/images/htools.png differ
diff --git a/images/important.png b/images/important.png
new file mode 100644 (file)
index 0000000..be685cc
Binary files /dev/null and b/images/important.png differ
diff --git a/images/info.png b/images/info.png
new file mode 100644 (file)
index 0000000..4dcf076
Binary files /dev/null and b/images/info.png differ
diff --git a/images/iphone.png b/images/iphone.png
new file mode 100644 (file)
index 0000000..d1d7b37
Binary files /dev/null and b/images/iphone.png differ
diff --git a/images/link.png b/images/link.png
new file mode 100644 (file)
index 0000000..f2f8e5d
Binary files /dev/null and b/images/link.png differ
diff --git a/images/lock.png b/images/lock.png
new file mode 100644 (file)
index 0000000..0983cab
Binary files /dev/null and b/images/lock.png differ
diff --git a/images/mail-green.png b/images/mail-green.png
new file mode 100644 (file)
index 0000000..3d44b12
Binary files /dev/null and b/images/mail-green.png differ
diff --git a/images/mammoth.png b/images/mammoth.png
new file mode 100644 (file)
index 0000000..853d57f
Binary files /dev/null and b/images/mammoth.png differ
diff --git a/images/money.png b/images/money.png
new file mode 100644 (file)
index 0000000..4fdb17d
Binary files /dev/null and b/images/money.png differ
diff --git a/images/mypc-icon.png b/images/mypc-icon.png
new file mode 100644 (file)
index 0000000..970a817
Binary files /dev/null and b/images/mypc-icon.png differ
diff --git a/images/news.png b/images/news.png
new file mode 100644 (file)
index 0000000..486d0a5
Binary files /dev/null and b/images/news.png differ
diff --git a/images/notebook.png b/images/notebook.png
new file mode 100644 (file)
index 0000000..25f3bc3
Binary files /dev/null and b/images/notebook.png differ
diff --git a/images/ornament.png b/images/ornament.png
new file mode 100644 (file)
index 0000000..127ce98
Binary files /dev/null and b/images/ornament.png differ
diff --git a/images/paints.png b/images/paints.png
new file mode 100644 (file)
index 0000000..c406930
Binary files /dev/null and b/images/paints.png differ
diff --git a/images/penguin.png b/images/penguin.png
new file mode 100644 (file)
index 0000000..445ab0d
Binary files /dev/null and b/images/penguin.png differ
diff --git a/images/printer.png b/images/printer.png
new file mode 100644 (file)
index 0000000..67164ab
Binary files /dev/null and b/images/printer.png differ
diff --git a/images/puzzle.png b/images/puzzle.png
new file mode 100644 (file)
index 0000000..ce2bf82
Binary files /dev/null and b/images/puzzle.png differ
diff --git a/images/red-map-mark.png b/images/red-map-mark.png
new file mode 100644 (file)
index 0000000..3d46d18
Binary files /dev/null and b/images/red-map-mark.png differ
diff --git a/images/restaurant.png b/images/restaurant.png
new file mode 100644 (file)
index 0000000..94cf0db
Binary files /dev/null and b/images/restaurant.png differ
diff --git a/images/rss.png b/images/rss.png
new file mode 100644 (file)
index 0000000..c42720c
Binary files /dev/null and b/images/rss.png differ
diff --git a/images/safari.png b/images/safari.png
new file mode 100644 (file)
index 0000000..d4e3e8a
Binary files /dev/null and b/images/safari.png differ
diff --git a/images/safe-open.png b/images/safe-open.png
new file mode 100644 (file)
index 0000000..0e05280
Binary files /dev/null and b/images/safe-open.png differ
diff --git a/images/shopping-cart.png b/images/shopping-cart.png
new file mode 100644 (file)
index 0000000..eb4690f
Binary files /dev/null and b/images/shopping-cart.png differ
diff --git a/images/smiley-glasses.png b/images/smiley-glasses.png
new file mode 100644 (file)
index 0000000..a1f1d3a
Binary files /dev/null and b/images/smiley-glasses.png differ
diff --git a/images/smiley.png b/images/smiley.png
new file mode 100644 (file)
index 0000000..116359c
Binary files /dev/null and b/images/smiley.png differ
diff --git a/images/sync.png b/images/sync.png
new file mode 100644 (file)
index 0000000..39d4492
Binary files /dev/null and b/images/sync.png differ
diff --git a/images/tools.png b/images/tools.png
new file mode 100644 (file)
index 0000000..c06afda
Binary files /dev/null and b/images/tools.png differ
diff --git a/images/warning.png b/images/warning.png
new file mode 100644 (file)
index 0000000..974abf6
Binary files /dev/null and b/images/warning.png differ
index 5f98c75..115a6c9 100644 (file)
@@ -318,6 +318,7 @@ public class NeverNote extends QMainWindow{
     List<QPixmap>              syncIcons;                                      // Array of icons used in sync animation
     private boolean            closeAction = false;            // Used to say when to close or when to minimize
     private static Logger log = Logger.getLogger(NeverNote.class); 
+    private String             saveLastPath;                           // last path we used
     
     
     String iconPath = new String("classpath:cx/fbn/nevernote/icons/");
@@ -1745,10 +1746,10 @@ public class NeverNote extends QMainWindow{
                if (!stackSelected && !allNotebookSelected) {
                        icon = conn.getNotebookTable().getIcon(guid);
                        if (icon == null) {
-                               dialog = new SetIcon(currentIcon);
+                               dialog = new SetIcon(currentIcon, saveLastPath);
                                dialog.setUseDefaultIcon(true);
                        } else {
-                               dialog = new SetIcon(icon);
+                               dialog = new SetIcon(icon, saveLastPath);
                                dialog.setUseDefaultIcon(false);
                        }
                } else {
@@ -1758,15 +1759,17 @@ public class NeverNote extends QMainWindow{
                                icon = conn.getSystemIconTable().getIcon(currentSelection.text(0), "ALLNOTEBOOK");                              
                        }
                        if (icon == null) {
-                               dialog = new SetIcon(currentIcon);
+                               dialog = new SetIcon(currentIcon, saveLastPath);
                                dialog.setUseDefaultIcon(true);
                        } else {
-                               dialog = new SetIcon(icon);
+                               dialog = new SetIcon(icon, saveLastPath);
                                dialog.setUseDefaultIcon(false);
                        }
                }
                dialog.exec();
                if (dialog.okPressed()) {
+               saveLastPath = dialog.getPath();
+
                        QIcon newIcon = dialog.getIcon();
                        if (stackSelected) {
                                conn.getSystemIconTable().setIcon(currentSelection.text(0), "STACK", newIcon, dialog.getFileType());
@@ -2122,14 +2125,15 @@ public class NeverNote extends QMainWindow{
                QIcon icon = conn.getTagTable().getIcon(guid);
                SetIcon dialog;
                if (icon == null) {
-                       dialog = new SetIcon(currentIcon);
+                       dialog = new SetIcon(currentIcon, saveLastPath);
                        dialog.setUseDefaultIcon(true);
                } else {
-                       dialog = new SetIcon(icon);
+                       dialog = new SetIcon(icon, saveLastPath);
                        dialog.setUseDefaultIcon(false);
                }
                dialog.exec();
                if (dialog.okPressed()) {
+               saveLastPath = dialog.getPath();
                        QIcon newIcon = dialog.getIcon();
                        conn.getTagTable().setIcon(guid, newIcon, dialog.getFileType());
                        if (newIcon == null) 
@@ -2357,14 +2361,15 @@ public class NeverNote extends QMainWindow{
                QIcon icon = conn.getSavedSearchTable().getIcon(guid);
                SetIcon dialog;
                if (icon == null) {
-                       dialog = new SetIcon(currentIcon);
+                       dialog = new SetIcon(currentIcon, saveLastPath);
                        dialog.setUseDefaultIcon(true);
                } else {
-                       dialog = new SetIcon(icon);
+                       dialog = new SetIcon(icon, saveLastPath);
                        dialog.setUseDefaultIcon(false);
                }
                dialog.exec();
                if (dialog.okPressed()) {
+               saveLastPath = dialog.getPath();
                        QIcon newIcon = dialog.getIcon();
                        conn.getSavedSearchTable().setIcon(guid, newIcon, dialog.getFileType());
                        if (newIcon == null) 
@@ -5261,13 +5266,18 @@ public class NeverNote extends QMainWindow{
                fd.setWindowTitle(tr("Backup Database"));
                fd.setFilter(tr("NeverNote Export (*.nnex);;All Files (*.*)"));
                fd.setAcceptMode(AcceptMode.AcceptSave);
-               fd.setDirectory(System.getProperty("user.home"));
+               if (saveLastPath == null || saveLastPath.equals(""))
+                       fd.setDirectory(System.getProperty("user.home"));
+               else
+                       fd.setDirectory(saveLastPath);
                if (fd.exec() == 0 || fd.selectedFiles().size() == 0) {
                        return;
                }
                
                
        waitCursor(true);
+       saveLastPath = fd.selectedFiles().get(0);
+       saveLastPath = saveLastPath.substring(0,saveLastPath.lastIndexOf("/"));
        setMessage(tr("Backing up database"));
        saveNote();
 //     conn.backupDatabase(Global.getUpdateSequenceNumber(), Global.getSequenceDate());
@@ -5302,13 +5312,19 @@ public class NeverNote extends QMainWindow{
                fd.setWindowTitle(tr("Restore Database"));
                fd.setFilter(tr("NeverNote Export (*.nnex);;All Files (*.*)"));
                fd.setAcceptMode(AcceptMode.AcceptOpen);
-               fd.setDirectory(System.getProperty("user.home"));
+               if (saveLastPath == null || saveLastPath.equals(""))
+                       fd.setDirectory(System.getProperty("user.home"));
+               else
+                       fd.setDirectory(saveLastPath);
                if (fd.exec() == 0 || fd.selectedFiles().size() == 0) {
                        return;
                }
                
                
                waitCursor(true);
+       saveLastPath = fd.selectedFiles().get(0);
+       saveLastPath = saveLastPath.substring(0,saveLastPath.lastIndexOf("/"));
+
                setMessage(tr("Restoring database"));
        ImportData noteReader = new ImportData(conn, true);
        noteReader.importData(fd.selectedFiles().get(0));
@@ -5367,7 +5383,10 @@ public class NeverNote extends QMainWindow{
                fd.setWindowTitle(tr("Import Notes"));
                fd.setFilter(tr("NeverNote Export (*.nnex);;All Files (*.*)"));
                fd.setAcceptMode(AcceptMode.AcceptOpen);
-               fd.setDirectory(System.getProperty("user.home"));
+               if (saveLastPath == null || saveLastPath.equals(""))
+                       fd.setDirectory(System.getProperty("user.home"));
+               else
+                       fd.setDirectory(saveLastPath);
                if (fd.exec() == 0 || fd.selectedFiles().size() == 0) {
                        return;
                }
@@ -5382,6 +5401,7 @@ public class NeverNote extends QMainWindow{
                
        ImportData noteReader = new ImportData(conn, false);
        String fileName = fd.selectedFiles().get(0);
+       saveLastPath.substring(0,fileName.lastIndexOf("/"));
 
        if (!fileName.endsWith(".nnex"))
                fileName = fileName +".nnex";
index 603a54c..7115caa 100644 (file)
@@ -29,6 +29,8 @@ import com.trolltech.qt.gui.QIcon;
 import com.trolltech.qt.gui.QPushButton;
 import com.trolltech.qt.gui.QSizePolicy.Policy;
 
+import cx.fbn.nevernote.Global;
+
 public class SetIcon extends QDialog {
        private boolean okPressed;
        QPushButton     ok;
@@ -36,11 +38,14 @@ public class SetIcon extends QDialog {
        QCheckBox               useDefault;
        QIcon                   defaultIcon;
        boolean                 startUseDefault;
+       String                  path;
+       
        private final String iconPath = new String("classpath:cx/fbn/nevernote/icons/");
        
        // Constructor
-       public SetIcon(QIcon i) {
+       public SetIcon(QIcon i, String path) {
                okPressed = false;
+               this.path = path;
                setWindowTitle(tr("Set Icon"));
                QGridLayout grid = new QGridLayout();
                setWindowIcon(new QIcon(iconPath+"nevernote.png"));
@@ -99,11 +104,16 @@ public class SetIcon extends QDialog {
                fd.setWindowTitle(tr("Icon"));
                fd.setFilter(tr("PNG (*.png);;All Files (*.*)"));
                fd.setAcceptMode(AcceptMode.AcceptOpen);
-               fd.setDirectory(System.getProperty("user.home"));
+               if (path == null || path.equals(""))
+                       fd.setDirectory(Global.getFileManager().getImageDirPath(""));
+               else
+                       fd.setDirectory(path);
                if (fd.exec() == 0 || fd.selectedFiles().size() == 0) {
                        return;
                }
                
+               this.path = fd.selectedFiles().get(0);
+               this.path = path.substring(0,path.lastIndexOf("/"));
                ok.setEnabled(true);
                String path = fd.selectedFiles().get(0);
                iconButton.setIcon(new QIcon(path));
@@ -134,4 +144,8 @@ public class SetIcon extends QDialog {
        public String getFileType() {
                return "PNG";
        }
+       
+       public String getPath() {
+               return path;
+       }
 }