Author: jflesch
Date: 2007-04-21 21:09:20 +0000 (Sat, 21 Apr 2007)
New Revision: 12847

Added:
   trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java
   trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java
Log:
Fix build (missing files, as usual)

Added: trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java                   
        (rev 0)
+++ trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java   2007-04-21 
21:09:20 UTC (rev 12847)
@@ -0,0 +1,105 @@
+package thaw.plugins.signatures;
+
+import java.awt.Color;
+
+
+import freenet.crypt.DSAPrivateKey;
+import freenet.crypt.DSAGroup;
+import freenet.crypt.DSAPublicKey;
+import freenet.crypt.DSASignature;
+import freenet.crypt.Yarrow;
+
+import thaw.plugins.Hsqldb;
+
+
+public class Identity {
+
+       public final static int[] trustLevelInt = {
+               100,
+               2,
+               1,
+               0,
+               -1,
+               -2
+       };
+
+       public final static String[] trustLevelStr = {
+               "thaw.plugin.signature.trustLevel.dev",
+               "thaw.plugin.signature.trustLevel.good",
+               "thaw.plugin.signature.trustLevel.observe",
+               "thaw.plugin.signature.trustLevel.check",
+               "thaw.plugin.signature.trustLevel.bad",
+               "thaw.plugin.signature.trustLevel.evil"
+       };
+
+       public final static Color[] trustLevelColor = {
+               Color.BLUE,
+               Color.GREEN,
+               new java.awt.Color(0, 128, 0), /* light green */
+               Color.ORANGE,
+               new java.awt.Color(175, 0, 0), /* moderatly red */
+               Color.RED
+       };
+
+
+       private Hsqldb db;
+
+       private int id;
+
+       private String nick;
+
+
+       /* public key */
+       private byte[] y;
+
+       /* private key */
+       private byte[] x;
+
+
+       public Identity(Hsqldb db, int id, String nick,
+                       byte[] y, byte[] x) {
+
+       }
+
+
+       /**
+        * Generate a new identity
+        * you have to insert() it
+        */
+       public static Identity generate(String nick) {
+               Yarrow y = new Yarrow();
+
+               return null;
+       }
+
+
+       public void insert() {
+
+       }
+
+
+
+       /**
+        * All the parameters are Base64 encoded, except text.
+        */
+       public static boolean isValid(String text, /* signed text */
+                                     String r, /* sig */
+                                     String s, /* sig */
+                                     String p, /* publicKey */
+                                     String q, /* publicKey */
+                                     String g, /* publicKey */
+                                     String y) /* publicKey */ {
+               return true;
+       }
+
+
+       /**
+        * we use q as a reference
+        */
+       public static boolean isDuplicata(Hsqldb db, String nickName, String q) 
{
+               return false;
+       }
+
+
+}
+

Added: trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java               
                (rev 0)
+++ trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java       
2007-04-21 21:09:20 UTC (rev 12847)
@@ -0,0 +1,164 @@
+package thaw.plugins.signatures;
+
+
+import javax.swing.JDialog;
+import javax.swing.JScrollPane;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JButton;
+import javax.swing.JOptionPane;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+
+
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+import thaw.core.I18n;
+import thaw.core.ConfigWindow;
+
+import thaw.gui.IconBox;
+
+import thaw.plugins.Hsqldb;
+
+
+
+public class SigConfigTab implements ActionListener {
+       private Hsqldb db;
+       private ConfigWindow configWindow;
+
+
+       private JPanel configPanel;
+
+       private JButton yourIdentitiesButton;
+       private JButton otherIdentitiesButton;
+
+
+       public SigConfigTab(ConfigWindow configWin, Hsqldb db) {
+               this.db = db;
+               this.configWindow = configWin;
+
+               configPanel = new JPanel();
+
+               yourIdentitiesButton  = new 
JButton(I18n.getMessage("thaw.plugin.signature.yourIdentities"));
+               otherIdentitiesButton = new 
JButton(I18n.getMessage("thaw.plugin.signature.otherIdentities"));
+
+               yourIdentitiesButton.addActionListener(this);
+               otherIdentitiesButton.addActionListener(this);
+
+
+               configPanel.add(yourIdentitiesButton);
+               configPanel.add(otherIdentitiesButton);
+       }
+
+       public JPanel getPanel() {
+               return configPanel;
+       }
+
+
+
+       protected class YourIdentitiesPanel implements ActionListener {
+               private JDialog dialog;
+
+               private JList list;
+
+               private JButton addIdentity;
+               private JButton removeIdentity;
+               private JButton closeWindow;
+
+
+               public YourIdentitiesPanel() {
+                       dialog = new JDialog(configWindow.getFrame(),
+                                            
I18n.getMessage("thaw.plugin.signature.dialogTitle.yourIdentities"));
+
+                       dialog.getContentPane().setLayout(new BorderLayout(5, 
5));
+
+                       dialog.getContentPane().add(new 
JLabel(I18n.getMessage("thaw.plugin.signature.dialogTitle.yourIdentities")+" 
:"),
+                                                   BorderLayout.NORTH);
+
+                       list = new JList();
+
+                       updateList();
+
+                       dialog.getContentPane().add(new JScrollPane(list), 
BorderLayout.CENTER);
+
+                       JPanel southPanel = new JPanel(new BorderLayout());
+                       southPanel.add(new JLabel(""), BorderLayout.CENTER);
+
+                       JPanel buttonPanel = new JPanel(new GridLayout(1, 3));
+
+                       addIdentity = new JButton(IconBox.minAdd);
+                       removeIdentity = new JButton(IconBox.minRemove);
+                       closeWindow = new JButton(IconBox.minClose);
+
+                       
addIdentity.setToolTipText(I18n.getMessage("thaw.plugin.signature.addIdentity"));
+                       
removeIdentity.setToolTipText(I18n.getMessage("thaw.plugin.signature.removeIdentity"));
+                       
closeWindow.setToolTipText(I18n.getMessage("thaw.common.closeWin"));
+
+                       addIdentity.addActionListener(this);
+                       removeIdentity.addActionListener(this);
+                       closeWindow.addActionListener(this);
+
+                       buttonPanel.add(addIdentity);
+                       buttonPanel.add(removeIdentity);
+                       buttonPanel.add(closeWindow);
+
+                       southPanel.add(buttonPanel, BorderLayout.EAST);
+
+                       dialog.getContentPane().add(southPanel, 
BorderLayout.SOUTH);
+
+
+                       dialog.setSize(500, 500);
+                       dialog.setVisible(true);
+               }
+
+
+               public void updateList() {
+
+               }
+
+               public void actionPerformed(ActionEvent e) {
+                       if (e.getSource() == addIdentity) {
+                               String nick = 
JOptionPane.showInputDialog(dialog,
+                                                                         
I18n.getMessage("thaw.plugin.signature.enterNick"));
+                               Identity id = Identity.generate(nick);
+                               id.insert();
+                               updateList();
+                       }
+
+                       if (e.getSource() == removeIdentity) {
+
+                       }
+
+                       if (e.getSource() == closeWindow) {
+                               dialog.setVisible(false);
+                       }
+               }
+       }
+
+
+       protected class OtherIdentitiesPanel implements ActionListener {
+               public  OtherIdentitiesPanel() {
+
+               }
+
+               public void actionPerformed(ActionEvent e) {
+
+               }
+       }
+
+
+
+       public void actionPerformed(ActionEvent e) {
+               if (e.getSource() == yourIdentitiesButton) {
+                       new YourIdentitiesPanel();
+               }
+
+               if (e.getSource() == otherIdentitiesButton) {
+                       new OtherIdentitiesPanel();
+               }
+       }
+}
+


Reply via email to