Author: jflesch
Date: 2006-11-30 21:13:01 +0000 (Thu, 30 Nov 2006)
New Revision: 11149

Modified:
   trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java
   trunk/apps/Thaw/src/thaw/plugins/index/Index.java
   trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
Log:
Bug https://bugs.freenetproject.org/view.php?id=914 should be fixed

Modified: trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java  2006-11-30 20:53:09 UTC 
(rev 11148)
+++ trunk/apps/Thaw/src/thaw/plugins/QueueWatcher.java  2006-11-30 21:13:01 UTC 
(rev 11149)
@@ -80,7 +80,7 @@
                        panelAdded = split;
                }

-               split.setSize(MainWindow.DEFAULT_SIZE_X - 150, 
MainWindow.DEFAULT_SIZE_Y - 150);
+               split.setSize(MainWindow.DEFAULT_SIZE_X - 150, 
MainWindow.DEFAULT_SIZE_Y - 150); /* needed to avoid size = 0at the begining */
                split.setResizeWeight(0.5);

                setMainWindow(core.getMainWindow());

Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2006-11-30 20:53:09 UTC 
(rev 11148)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2006-11-30 21:13:01 UTC 
(rev 11149)
@@ -65,6 +65,7 @@

        private FCPClientPut publicKeyRecalculation = null;

+       private boolean updateWhenKeyAreAvailable = false;

        /**
         * The bigest constructor of the world ...
@@ -133,12 +134,12 @@
        }

        public void generateKeys() {
-               this.publicKey = "N/A";
-               this.privateKey = "N/A";
+               publicKey = null;
+               privateKey = null;

-               this.sskGenerator = new FCPGenerateSSK();
-               this.sskGenerator.addObserver(this);
-               this.sskGenerator.start(queueManager);
+               sskGenerator = new FCPGenerateSSK();
+               sskGenerator.addObserver(this);
+               sskGenerator.start(queueManager);
        }

        public boolean create() {
@@ -247,6 +248,15 @@


        public void update() {
+               if (publicKey != null && privateKey == null) /* non modifiable 
*/
+                       return;
+
+               if (publicKey == null && privateKey == null) {
+                       generateKeys();
+                       updateWhenKeyAreAvailable = true;
+                       return;
+               }
+
                String tmpdir = System.getProperty("java.io.tmpdir");

                if (tmpdir == null)
@@ -348,7 +358,7 @@
        }

        public boolean isUpdating() {
-               return (this.transfer != null && (!this.transfer.isFinished()));
+               return (sskGenerator != null || (transfer != null && 
(!transfer.isFinished())));
        }


@@ -512,13 +522,18 @@
        public void update(java.util.Observable o, Object p) {

                if(o == this.sskGenerator) {
-                       this.sskGenerator.deleteObserver(this);
-                       this.publicKey = this.sskGenerator.getPublicKey();
-                       this.privateKey = this.sskGenerator.getPrivateKey();
+                       sskGenerator.deleteObserver(this);
+                       publicKey = sskGenerator.getPublicKey();
+                       privateKey = sskGenerator.getPrivateKey();
+                       sskGenerator = null;

-                       Logger.debug(this, "Index public key: " 
+this.publicKey);
-                       Logger.debug(this, "Index private key: 
"+this.privateKey);
+                       Logger.debug(this, "Index public key: " +publicKey);
+                       Logger.debug(this, "Index private key: "+privateKey);

+                       if (updateWhenKeyAreAvailable) {
+                               updateWhenKeyAreAvailable = false;
+                               update();
+                       }
                }

                if(o == this.transfer) {

Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2006-11-30 
20:53:09 UTC (rev 11148)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexTree.java       2006-11-30 
21:13:01 UTC (rev 11149)
@@ -205,15 +205,15 @@
                indexMenu.add(item);
                indexAndFileActions.add(new 
IndexManagementHelper.IndexDeleter(this, item));

+               item = new 
JMenuItem(I18n.getMessage("thaw.plugin.index.copyPrivateKey"));
+               indexMenu.add(item);
+               indexAndFileActions.add(new 
IndexManagementHelper.PrivateKeyCopier(item));
+
                item = new 
JMenuItem(I18n.getMessage("thaw.plugin.index.copyKey"));
                indexMenu.add(item);
                indexAndFileActions.add(new 
IndexManagementHelper.PublicKeyCopier(item));

-               item = new 
JMenuItem(I18n.getMessage("thaw.plugin.index.copyPrivateKey"));
-               indexMenu.add(item);
-               indexAndFileActions.add(new 
IndexManagementHelper.PrivateKeyCopier(item));

-
                // File menu

                item = new 
JMenuItem(I18n.getMessage("thaw.plugin.index.addFilesWithInserting"));


Reply via email to