Author: jflesch
Date: 2007-04-29 22:22:11 +0000 (Sun, 29 Apr 2007)
New Revision: 13060

Modified:
   trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
   trunk/apps/Thaw/src/thaw/i18n/thaw.properties
   trunk/apps/Thaw/src/thaw/plugins/index/AutoRefresh.java
   trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java
Log:
Update randomly the indexes instead of sequentially

Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-04-29 
20:54:17 UTC (rev 13059)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-04-29 
22:22:11 UTC (rev 13060)
@@ -420,6 +420,9 @@
 thaw.plugin.signature.trustLevel.none=(aucun)
 thaw.plugin.signature.trustLevel.me=MOI

+thaw.plugin.signature.import=Importer une identit?
+thaw.plugin.signature.export=Exporter une identit?
+
 thaw.plugin.signature.ignoreLowerThan=Ignorer les signatures avec un status 
inf?rieur ?



Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-04-29 20:54:17 UTC 
(rev 13059)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-04-29 22:22:11 UTC 
(rev 13060)
@@ -426,6 +426,10 @@
 thaw.plugin.signature.trustLevel.none=(none)
 thaw.plugin.signature.trustLevel.me=ME

+
+thaw.plugin.signature.import=Import identity
+thaw.plugin.signature.export=Export identity
+
 thaw.plugin.signature.setOriginal=Set as original



Modified: trunk/apps/Thaw/src/thaw/plugins/index/AutoRefresh.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/AutoRefresh.java     2007-04-29 
20:54:17 UTC (rev 13059)
+++ trunk/apps/Thaw/src/thaw/plugins/index/AutoRefresh.java     2007-04-29 
22:22:11 UTC (rev 13060)
@@ -93,17 +93,11 @@
                        ResultSet results;
                        int ret;

-                       if (lastIdx != -1) {
-                               st = c.prepareStatement("SELECT id, 
originalName, displayName, publicKey, privateKey, author, positionInTree, 
revision "+
-                                                       "FROM indexes WHERE id 
> ? ORDER by id LIMIT 1");
+                       st = c.prepareStatement("SELECT id, originalName, 
displayName, publicKey, privateKey, author, positionInTree, revision "+
+                                               "FROM indexes ORDER by RAND() 
LIMIT 1");

-                               st.setInt(1, lastIdx);
+                       results = st.executeQuery();

-                               results = st.executeQuery();
-                       } else {
-                               results = db.executeQuery("SELECT id, 
originalName, displayName, publicKey, privateKey, author, positionInTree, 
revision "+
-                                                         "FROM indexes ORDER 
by Id LIMIT 1");
-                       }

                        if (results == null || !results.next())
                                return -1;

Modified: trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java       
2007-04-29 20:54:17 UTC (rev 13059)
+++ trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java       
2007-04-29 22:22:11 UTC (rev 13060)
@@ -125,11 +125,6 @@

                int min = Integer.parseInt(config.getValue("minTrustLevel"));

-               if (min == -254) {
-                       
minLevel.setSelectedItem(I18n.getMessage("thaw.plugin.signature.trustLevel.none"));
-                       return;
-               }
-
                for (i = 0 ; i < Identity.trustLevelInt.length ; i++) {
                        if (Identity.trustLevelInt[i] == min)
                                break;
@@ -141,13 +136,17 @@
                
minLevel.setSelectedItem(I18n.getMessage(Identity.trustLevelStr[i]));
        }

-       protected class YourIdentitiesPanel implements ActionListener, 
java.awt.event.WindowListener, Runnable {
+       protected class YourIdentitiesPanel implements ActionListener, 
java.awt.event.WindowListener {
                private JDialog dialog;

                private JList list;

                private JButton addIdentity;
                private JButton removeIdentity;
+
+               private JButton exportIdentity;
+               private JButton importIdentity;
+
                private JButton closeWindow;


@@ -180,18 +179,26 @@

                        addIdentity = new JButton(IconBox.minAdd);
                        removeIdentity = new JButton(IconBox.minRemove);
+                       importIdentity = new JButton(IconBox.minImportAction);
+                       exportIdentity = new JButton(IconBox.minExportAction);
                        closeWindow = new JButton(IconBox.minClose);

                        
addIdentity.setToolTipText(I18n.getMessage("thaw.plugin.signature.addIdentity"));
                        
removeIdentity.setToolTipText(I18n.getMessage("thaw.plugin.signature.removeIdentity"));
+                       
importIdentity.setToolTipText(I18n.getMessage("thaw.plugin.signature.import"));
+                       
exportIdentity.setToolTipText(I18n.getMessage("thaw.plugin.signature.export"));
                        
closeWindow.setToolTipText(I18n.getMessage("thaw.common.closeWin"));

                        addIdentity.addActionListener(this);
                        removeIdentity.addActionListener(this);
+                       importIdentity.addActionListener(this);
+                       exportIdentity.addActionListener(this);
                        closeWindow.addActionListener(this);

                        buttonPanel.add(addIdentity);
                        buttonPanel.add(removeIdentity);
+                       buttonPanel.add(importIdentity);
+                       buttonPanel.add(exportIdentity);
                        buttonPanel.add(closeWindow);

                        southPanel.add(buttonPanel, BorderLayout.EAST);
@@ -208,25 +215,48 @@
                        list.setListData(Identity.getYourIdentities(db));
                }

-               public void run() {
-                       dialog.setEnabled(false);
-                       String nick = JOptionPane.showInputDialog(dialog,
-                                                                 
I18n.getMessage("thaw.plugin.signature.enterNick"),
-                                                                 
I18n.getMessage("thaw.plugin.signature.enterNick"),
-                                                                 
JOptionPane.QUESTION_MESSAGE);
-                       dialog.setEnabled(true);

-                       if (nick != null) {
-                               Identity id = Identity.generate(db, nick);
-                               id.insert();
-                               updateList();
+               private class IdentityAdder implements Runnable {
+
+
+                       public void run() {
+                               dialog.setEnabled(false);
+                               String nick = 
JOptionPane.showInputDialog(dialog,
+                                                                         
I18n.getMessage("thaw.plugin.signature.enterNick"),
+                                                                         
I18n.getMessage("thaw.plugin.signature.enterNick"),
+                                                                         
JOptionPane.QUESTION_MESSAGE);
+                               dialog.setEnabled(true);
+
+                               if (nick != null) {
+                                       Identity id = Identity.generate(db, 
nick);
+                                       id.insert();
+                                       updateList();
+                               }
                        }
                }


+               private class IdentityImporter implements Runnable {
+                       public IdentityImporter() { }
+
+                       public void run() {
+
+                       }
+               }
+
+
+               private class IdentityExporter implements Runnable {
+                       public IdentityExporter() { }
+
+                       public void run() {
+
+                       }
+               }
+
+
                public void actionPerformed(ActionEvent e) {
                        if (e.getSource() == addIdentity) {
-                               Thread th = new Thread(this);
+                               Thread th = new Thread(new IdentityAdder());
                                th.start();
                        }

@@ -238,6 +268,16 @@
                                }
                        }

+                       if (e.getSource() == importIdentity) {
+                               Thread th = new Thread(new IdentityImporter());
+                               th.start();
+                       }
+
+                       if (e.getSource() == exportIdentity) {
+                               Thread th = new Thread(new IdentityExporter());
+                               th.start();
+                       }
+
                        if (e.getSource() == closeWindow) {
                                dialog.setVisible(false);
                                configWindow.setEnabled(true);


Reply via email to