Author: jflesch
Date: 2007-04-10 19:32:02 +0000 (Tue, 10 Apr 2007)
New Revision: 12566

Modified:
   trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
   trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
   trunk/apps/Thaw/src/thaw/plugins/index/Index.java
   trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java
   trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java
   trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerMonitorPanel.java
Log:
Fix private key reading when loading an index

Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-04-10 
16:54:26 UTC (rev 12565)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-04-10 
19:32:02 UTC (rev 12566)
@@ -182,8 +182,8 @@

 thaw.plugin.statistics.statistics=Statistiques dans la barre de status
 thaw.plugin.statistics.globalProgression=Progression globale:
-thaw.plugin.statistics.finished=Fini:
-thaw.plugin.statistics.failed=?chou?:
+thaw.plugin.statistics.finished=Finis:
+thaw.plugin.statistics.failed=?chou?s:
 thaw.plugin.statistics.running=En cours:
 thaw.plugin.statistics.pending=En attente:


Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-04-10 16:54:26 UTC 
(rev 12565)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-04-10 19:32:02 UTC 
(rev 12566)
@@ -182,8 +182,8 @@

 thaw.plugin.statistics.statistics=Statistiques dans la barre de status
 thaw.plugin.statistics.globalProgression=Progression globale:
-thaw.plugin.statistics.finished=Fini:
-thaw.plugin.statistics.failed=\u00c9chou\u00e9:
+thaw.plugin.statistics.finished=Finis:
+thaw.plugin.statistics.failed=\u00c9chou\u00e9s:
 thaw.plugin.statistics.running=En cours:
 thaw.plugin.statistics.pending=En attente:


Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-04-10 16:54:26 UTC 
(rev 12565)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-04-10 19:32:02 UTC 
(rev 12566)
@@ -695,7 +695,13 @@
                rewriteKey = true;

                publicKey = getPublicKey();
+               String privateKey = getPrivateKey();

+               if (rev <= 0 && privateKey != null) {
+                       Logger.error(this, "Can't update an non-inserted index 
!");
+                       return 0;
+               }
+
                if (tree != null && tree.isIndexUpdating(this)) {
                        Logger.notice(this, "A transfer is already running !");
                        return 0;
@@ -1255,7 +1261,15 @@
                 */
                public void endElement(String nameSpaceURI, String localName,
                                       String rawName) throws SAXException {
-                               /* \_o< */
+                       if ("owner".equals(rawName)) {
+                               ownerTag = false;
+                               return;
+                       }
+
+                       if ("privateKey".equals(rawName)) {
+                               privateKeyTag = false;
+                               return;
+                       }
                }


@@ -1271,6 +1285,7 @@

                        if (ownerTag) {
                                /* \_o< ==> TODO */
+
                                return;
                        }

@@ -1280,13 +1295,17 @@
                                         * the private key was published, we 
will have to do the same later
                                         */
                                        setPublishPrivateKey(true);
+                               } else {
+                                       /**
+                                        * the provided key doesn't match with 
the one we have,
+                                        * we won't publish it anymore
+                                        */
+                                       Logger.notice(this, "A private key was 
provided, but didn't match with the one we have ; ignored.");
+
                                }
-                               else
-                                       setPublishPrivateKey(false);

                                if (privateKey == null)
                                        setPrivateKey(txt.trim());
-
                                return;
                        }


Modified: trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java       2007-04-10 
16:54:26 UTC (rev 12565)
+++ trunk/apps/Thaw/src/thaw/plugins/index/LinkTable.java       2007-04-10 
19:32:02 UTC (rev 12566)
@@ -12,6 +12,7 @@
 import java.util.Iterator;
 import java.util.Vector;

+import javax.swing.JComponent;
 import javax.swing.JButton;
 import javax.swing.JLabel;
 import javax.swing.JMenuItem;
@@ -22,7 +23,14 @@
 import javax.swing.event.TableModelEvent;
 import javax.swing.table.DefaultTableCellRenderer;

+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import javax.swing.SwingConstants;
+import javax.swing.TransferHandler;
+
 import thaw.core.I18n;
+import thaw.core.Logger;
 import thaw.gui.IconBox;
 import thaw.fcp.FCPQueueManager;
 import thaw.plugins.ToolbarModifier;
@@ -61,7 +69,13 @@
                table = new JTable(linkListModel);
                table.setShowGrid(false);
                table.setDefaultRenderer(table.getColumnClass(0), new 
LinkRenderer());
+               table.setDragEnabled(true);

+               table.setTransferHandler(new TransferHandler("text"));
+
+               MouseListener mouseListener = new DragMouseAdapter(); /* see 
below */
+               table.addMouseListener(mouseListener);
+
                panel = new JPanel();
                panel.setLayout(new BorderLayout());

@@ -113,6 +127,20 @@
                updateRightClickMenu(null);
        }

+
+       private class DragMouseAdapter extends MouseAdapter {
+               public void mousePressed(MouseEvent e) {
+                       Logger.error(this, "MOOH");
+
+                       JComponent src = (JComponent) e.getSource();
+                       TransferHandler handler = src.getTransferHandler();
+
+                       handler.exportAsDrag(src, e, TransferHandler.COPY);
+
+               }
+       }
+
+
        public ToolbarModifier getToolbarModifier() {
                return toolbarModifier;
        }

Modified: trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java        
2007-04-10 16:54:26 UTC (rev 12565)
+++ trunk/apps/Thaw/src/thaw/plugins/index/UnknownIndexList.java        
2007-04-10 19:32:02 UTC (rev 12566)
@@ -16,7 +16,14 @@
 import javax.swing.JPopupMenu;
 import javax.swing.JScrollPane;

+import java.awt.event.MouseAdapter;
+import javax.swing.SwingConstants;
+import javax.swing.TransferHandler;
+
+import javax.swing.JComponent;
+
 import thaw.core.I18n;
+import thaw.core.Logger;
 import thaw.gui.IconBox;
 import thaw.fcp.FCPQueueManager;
 import thaw.plugins.ToolbarModifier;
@@ -64,6 +71,12 @@

                
list.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

+               list.setDragEnabled(true);
+               list.setTransferHandler(new TransferHandler("text"));
+
+               MouseListener mouseListener = new DragMouseAdapter(); /* see 
below */
+               list.addMouseListener(mouseListener);
+
                panel = new JPanel(new BorderLayout());
                panel.add(new 
JLabel(I18n.getMessage("thaw.plugin.index.unknownIndexes")),
                          BorderLayout.NORTH);
@@ -83,6 +96,18 @@
                list.addMouseListener(this);
        }

+       private class DragMouseAdapter extends MouseAdapter {
+               public void mousePressed(MouseEvent e) {
+                       Logger.error(this, "MOOH");
+
+                       JComponent src = (JComponent) e.getSource();
+                       TransferHandler handler = src.getTransferHandler();
+
+                       handler.exportAsDrag(src, e, TransferHandler.COPY);
+
+               }
+       }
+
        public ToolbarModifier getToolbarModifier() {
                return toolbarModifier;
        }

Modified: trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerMonitorPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerMonitorPanel.java  
2007-04-10 16:54:26 UTC (rev 12565)
+++ trunk/apps/Thaw/src/thaw/plugins/peerMonitor/PeerMonitorPanel.java  
2007-04-10 19:32:02 UTC (rev 12566)
@@ -35,10 +35,13 @@
 import java.util.Observer;


+
+
 import thaw.core.Config;
 import thaw.core.I18n;
 import thaw.core.Logger;

+
 import thaw.fcp.FCPQueueManager;

 import thaw.gui.IconBox;


Reply via email to