Merge branch 'next' into polish-translation
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 22 Sep 2012 07:54:42 +0000 (09:54 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 22 Sep 2012 07:54:42 +0000 (09:54 +0200)
pom.xml
src/main/java/de/todesbaum/jsite/application/UpdateChecker.java
src/main/java/de/todesbaum/jsite/gui/KeyDialog.java
src/main/java/de/todesbaum/jsite/gui/ProjectPage.java
src/main/java/de/todesbaum/jsite/main/CLI.java
src/main/java/de/todesbaum/jsite/main/Configuration.java
src/main/java/de/todesbaum/jsite/main/Main.java
src/main/resources/de/todesbaum/jsite/i18n/jSite.properties
src/main/resources/de/todesbaum/jsite/i18n/jSite_de.properties
src/main/resources/de/todesbaum/jsite/i18n/jSite_fr.properties

diff --git a/pom.xml b/pom.xml
index 4d9b0e3..b7cbad9 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -2,12 +2,12 @@
        <modelVersion>4.0.0</modelVersion>
        <groupId>net.pterodactylus</groupId>
        <artifactId>jSite</artifactId>
-       <version>0.11-SNAPSHOT</version>
+       <version>0.11</version>
        <dependencies>
                <dependency>
                        <groupId>net.pterodactylus</groupId>
                        <artifactId>utils</artifactId>
-                       <version>0.12.1-SNAPSHOT</version>
+                       <version>0.12.1</version>
                </dependency>
        </dependencies>
        <repositories>
index 0c78010..11be944 100644 (file)
@@ -51,7 +51,7 @@ public class UpdateChecker implements Runnable {
        private static int counter = 0;
 
        /** The edition for the update check URL. */
-       private static final int UPDATE_EDITION = 17;
+       private static final int UPDATE_EDITION = 18;
 
        /** The URL for update checks. */
        private static final String UPDATE_KEY = "USK@e3myoFyp5avg6WYN16ImHri6J7Nj8980Fm~aQe4EX1U,QvbWT0ImE0TwLODTl7EoJx2NBnwDxTbLTE6zkB-eGPs,AQACAAE";
index 732bb6e..ae8cea4 100644 (file)
@@ -59,6 +59,7 @@ import javax.swing.SwingConstants;
 
 import net.pterodactylus.util.swing.ComboBoxModelList;
 import de.todesbaum.jsite.application.Freenet7Interface;
+import de.todesbaum.jsite.application.Project;
 import de.todesbaum.jsite.i18n.I18n;
 import de.todesbaum.jsite.i18n.I18nContainer;
 import de.todesbaum.util.freenet.fcp2.wot.OwnIdentity;
@@ -88,6 +89,9 @@ public class KeyDialog extends JDialog {
        /** The “Regenerate” button’s action. */
        private Action generateAction;
 
+       /** The “Copy from Project” action. */
+       private Action copyFromProjectAction;
+
        /** The “Copy from Identity” action. */
        private Action copyFromIdentityAction;
 
@@ -97,12 +101,18 @@ public class KeyDialog extends JDialog {
        /** The text field for the public key. */
        private JTextField publicKeyTextField;
 
+       /** The select box for the projects. */
+       private JComboBox projectsComboBox;
+
        /** The select box for the own identities. */
        private JComboBox ownIdentitiesComboBox;
 
        /** Whether the dialog was cancelled. */
        private boolean cancelled;
 
+       /** The list of projects. */
+       private final List<Project> projects = new ArrayList<Project>();
+
        /** The list of own identities. */
        private final List<OwnIdentity> ownIdentities = new ArrayList<OwnIdentity>();
 
@@ -184,6 +194,20 @@ public class KeyDialog extends JDialog {
        }
 
        /**
+        * Sets the projects to display and copy URIs from.
+        *
+        * @param projects
+        *            The list of projects
+        */
+       public void setProjects(Collection<? extends Project> projects) {
+               synchronized (this.projects) {
+                       this.projects.clear();
+                       this.projects.addAll(projects);
+               }
+               projectsComboBox.setSelectedIndex(-1);
+       }
+
+       /**
         * Sets the own identities to display and copy URIs from.
         *
         * @param ownIdentities
@@ -256,6 +280,18 @@ public class KeyDialog extends JDialog {
                cancelAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.key-dialog.button.cancel.tooltip"));
                cancelAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_ESCAPE);
 
+               copyFromProjectAction = new AbstractAction(I18n.getMessage("jsite.key-dialog.button.copy-from-project")) {
+
+                       @Override
+                       @SuppressWarnings("synthetic-access")
+                       public void actionPerformed(ActionEvent actionevent) {
+                               actionCopyFromProject();
+                       }
+               };
+               copyFromProjectAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.key-dialog.button.copy-from-project.tooltip"));
+               copyFromProjectAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_P);
+               copyFromProjectAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK));
+
                copyFromIdentityAction = new AbstractAction(I18n.getMessage("jsite.key-dialog.button.copy-from-identity")) {
 
                        @Override
@@ -265,7 +301,8 @@ public class KeyDialog extends JDialog {
                        }
                };
                copyFromIdentityAction.putValue(Action.SHORT_DESCRIPTION, I18n.getMessage("jsite.key-dialog.button.copy-from-identity.tooltip"));
-               copyFromIdentityAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK));
+               copyFromIdentityAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_I);
+               copyFromIdentityAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK));
 
                generateAction = new AbstractAction(I18n.getMessage("jsite.key-dialog.button.generate")) {
 
@@ -305,11 +342,29 @@ public class KeyDialog extends JDialog {
                publicKeyTextField = new JTextField();
                contentPanel.add(publicKeyTextField, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 12, 0, 0), 0, 0));
 
-               final JLabel identitiesLabel = new JLabel(I18n.getMessage("jsite.key-dialog.label.identities"));
-               contentPanel.add(identitiesLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(12, 0, 0, 0), 0, 0));
+               final JLabel copyKeysLabel = new JLabel(I18n.getMessage("jsite.key-dialog.label.copy-keys"));
+               contentPanel.add(copyKeysLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(12, 0, 0, 0), 0, 0));
+
+               final JLabel projectLabel = new JLabel(I18n.getMessage("jsite.key-dialog.label.project"));
+               contentPanel.add(projectLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(12, 18, 0, 0), 0, 0));
+
+               projectsComboBox = new JComboBox(new ComboBoxModelList<Project>(projects));
+               projectsComboBox.addActionListener(new ActionListener() {
+
+                       @Override
+                       @SuppressWarnings("synthetic-access")
+                       public void actionPerformed(ActionEvent actionEvent) {
+                               copyFromProjectAction.setEnabled(projectsComboBox.getSelectedIndex() > -1);
+                       }
+
+               });
+               contentPanel.add(projectsComboBox, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 12, 0, 0), 0, 0));
+
+               JButton copyFromProjectButton = new JButton(copyFromProjectAction);
+               contentPanel.add(copyFromProjectButton, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(6, 12, 0, 0), 0, 0));
 
                final JLabel identityLabel = new JLabel(I18n.getMessage("jsite.key-dialog.label.identity"));
-               contentPanel.add(identityLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(12, 18, 0, 0), 0, 0));
+               contentPanel.add(identityLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(12, 18, 0, 0), 0, 0));
 
                ownIdentitiesComboBox = new JComboBox(new ComboBoxModelList<OwnIdentity>(ownIdentities));
                ownIdentitiesComboBox.addActionListener(new ActionListener() {
@@ -334,17 +389,17 @@ public class KeyDialog extends JDialog {
                                return this;
                        }
                });
-               contentPanel.add(ownIdentitiesComboBox, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 12, 0, 0), 0, 0));
+               contentPanel.add(ownIdentitiesComboBox, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(6, 12, 0, 0), 0, 0));
 
                JButton copyFromIdentityButton = new JButton(copyFromIdentityAction);
-               contentPanel.add(copyFromIdentityButton, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(6, 12, 0, 0), 0, 0));
+               contentPanel.add(copyFromIdentityButton, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(6, 12, 0, 0), 0, 0));
 
                final JLabel actionsLabel = new JLabel(I18n.getMessage("jsite.key-dialog.label.actions"));
-               contentPanel.add(actionsLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(12, 0, 0, 0), 0, 0));
+               contentPanel.add(actionsLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(12, 0, 0, 0), 0, 0));
 
                JPanel actionButtonPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 12, 12));
                actionButtonPanel.setBorder(BorderFactory.createEmptyBorder(-12, -12, -12, -12));
-               contentPanel.add(actionButtonPanel, new GridBagConstraints(0, 6, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(12, 18, 0, 0), 0, 0));
+               contentPanel.add(actionButtonPanel, new GridBagConstraints(0, 7, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(12, 18, 0, 0), 0, 0));
 
                actionButtonPanel.add(new JButton(generateAction));
 
@@ -365,8 +420,9 @@ public class KeyDialog extends JDialog {
                                keysLabel.setText(I18n.getMessage("jsite.key-dialog.label.keys"));
                                privateKeyLabel.setText(I18n.getMessage("jsite.key-dialog.label.private-key"));
                                publicKeyLabel.setText(I18n.getMessage("jsite.key-dialog.label.public-key"));
-                               identitiesLabel.setText(I18n.getMessage("jsite.key-dialog.label.identities"));
+                               copyKeysLabel.setText(I18n.getMessage("jsite.key-dialog.label.copy-keys"));
                                identityLabel.setText(I18n.getMessage("jsite.key-dialog.label.identity"));
+                               projectLabel.setText(I18n.getMessage("jsite.key-dialog.label.project"));
                                actionsLabel.setText(I18n.getMessage("jsite.key-dialog.label.actions"));
                        }
                });
@@ -399,6 +455,18 @@ public class KeyDialog extends JDialog {
        }
 
        /**
+        * Copies the public and private key from the selected project.
+        */
+       private void actionCopyFromProject() {
+               Project project = (Project) projectsComboBox.getSelectedItem();
+               if (project == null) {
+                       return;
+               }
+               setPublicKey(project.getRequestURI());
+               setPrivateKey(project.getInsertURI());
+       }
+
+       /**
         * Copies the public and private key from the selected identity.
         */
        private void actionCopyFromIdentity() {
index ad3f2e5..ceee143 100644 (file)
@@ -33,6 +33,7 @@ import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
 import java.io.IOException;
 import java.text.MessageFormat;
+import java.util.List;
 import java.util.Map.Entry;
 
 import javax.swing.AbstractAction;
@@ -442,7 +443,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
         * @param projects
         *            The list of projects
         */
-       public void setProjects(Project[] projects) {
+       public void setProjects(List<Project> projects) {
                projectListModel.clear();
                for (Project project : projects) {
                        projectListModel.add(project);
@@ -454,8 +455,8 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
         *
         * @return The list of projects
         */
-       public Project[] getProjects() {
-               return projectListModel.toArray(new Project[projectListModel.size()]);
+       public List<Project> getProjects() {
+               return projectListModel;
        }
 
        /**
@@ -631,6 +632,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
                        KeyDialog keyDialog = new KeyDialog(freenetInterface, wizard);
                        keyDialog.setPrivateKey(selectedProject.getInsertURI());
                        keyDialog.setPublicKey(selectedProject.getRequestURI());
+                       keyDialog.setProjects(getProjects());
                        keyDialog.setOwnIdentities(webOfTrustInterface.getOwnIdentities());
                        keyDialog.setVisible(true);
                        if (!keyDialog.wasCancelled()) {
index bbe76c7..9f0b2db 100644 (file)
@@ -19,6 +19,7 @@
 package de.todesbaum.jsite.main;
 
 import java.io.PrintWriter;
+import java.util.List;
 
 import net.pterodactylus.util.io.StreamCopier.ProgressListener;
 import de.todesbaum.jsite.application.Freenet7Interface;
@@ -50,7 +51,7 @@ public class CLI implements InsertListener {
        private Node[] nodes;
 
        /** The projects. */
-       private Project[] projects;
+       private List<Project> projects;
 
        /** Whether the insert has finished. */
        private boolean finished = false;
index 0cc7750..4b49577 100644 (file)
@@ -307,7 +307,7 @@ public class Configuration {
         *
         * @return A list of all projects
         */
-       public Project[] getProjects() {
+       public List<Project> getProjects() {
                List<Project> projects = new ArrayList<Project>();
                SimpleXML projectsNode = rootNode.getNode("project-list");
                if (projectsNode != null) {
@@ -381,7 +381,7 @@ public class Configuration {
                                }
                        }
                }
-               return projects.toArray(new Project[projects.size()]);
+               return projects;
        }
 
        /**
@@ -390,7 +390,7 @@ public class Configuration {
         * @param projects
         *            The list of all projects
         */
-       public void setProjects(Project[] projects) {
+       public void setProjects(List<Project> projects) {
                SimpleXML projectsNode = new SimpleXML("project-list");
                for (Project project : projects) {
                        SimpleXML projectNode = projectsNode.append("project");
index e8f6277..5e1e67a 100644 (file)
@@ -80,7 +80,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
        private static final Logger logger = Logger.getLogger(Main.class.getName());
 
        /** The version. */
-       private static final Version VERSION = new Version(0, 10);
+       private static final Version VERSION = new Version(0, 11);
 
        /** The configuration. */
        private Configuration configuration;
index e483ce7..19ea78d 100644 (file)
@@ -177,6 +177,8 @@ jsite.update-checker.latest-version.okay.message=<html>You are currently running
 jsite.key-dialog.title=Manage Project Keys
 jsite.key-dialog.button.ok.tooltip=Accepts the changes
 jsite.key-dialog.button.cancel.tooltip=Discards the changes
+jsite.key-dialog.button.copy-from-project=Copy from Project
+jsite.key-dialog.button.copy-from-project.tooltip=Copies the public and private keys from the selected project
 jsite.key-dialog.button.copy-from-identity=Copy from Identity
 jsite.key-dialog.button.copy-from-identity.tooltip=Copies the public and private keys from the selected identity
 jsite.key-dialog.button.generate=Regenerate Keys
@@ -184,7 +186,8 @@ jsite.key-dialog.button.generate.tooltip=Create a new key pair
 jsite.key-dialog.label.keys=<html><b>Keys</b></html>
 jsite.key-dialog.label.private-key=Private Key
 jsite.key-dialog.label.public-key=Public Key
-jsite.key-dialog.label.identities=<html><b>Identities</b></html>
+jsite.key-dialog.label.copy-keys=<html><b>Copy Keys</b></html>
+jsite.key-dialog.label.project=Project
 jsite.key-dialog.label.identity=Identity
 jsite.key-dialog.label.actions=<html><b>Actions</b></html>
 
index 0752114..7f82138 100644 (file)
@@ -177,6 +177,8 @@ jsite.update-checker.latest-version.okay.message=<html>Es l\u00e4uft momentan Ve
 jsite.key-dialog.title=Projektschl\u00fcsselverwaltung
 jsite.key-dialog.button.ok.tooltip=\u00c4nderungen akzeptieren
 jsite.key-dialog.button.cancel.tooltip=\u00c4nderungen verwerfen
+jsite.key-dialog.button.copy-from-project=Von Projekt kopieren
+jsite.key-dialog.button.copy-from-project.tooltip=Kopiert das Schl\u00fcsselpaar des ausgew\u00e4hlten Projekts
 jsite.key-dialog.button.copy-from-identity=Von Identit\u00e4t kopieren
 jsite.key-dialog.button.copy-from-identity.tooltip=Kopiert das Schl\u00fcsselpaar der ausgew\u00e4hlten Identit\u00e4t
 jsite.key-dialog.button.generate=Schl\u00fcssel neu generieren
@@ -184,7 +186,8 @@ jsite.key-dialog.button.generate.tooltip=Generiert ein neues Schl\u00fcsselpaar
 jsite.key-dialog.label.keys=<html><b>Schl\u00fcssel</b></html>
 jsite.key-dialog.label.private-key=Privater Schl\u00fcssel
 jsite.key-dialog.label.public-key=\u00d6ffentlicher Schl\u00fcssel
-jsite.key-dialog.label.identities=<html><b>Identit\u00e4ten</b></html>
+jsite.key-dialog.label.copy-keys=<html><b>Schl\u00fcssel kopieren</b></html>
+jsite.key-dialog.label.project=Projekt
 jsite.key-dialog.label.identity=Identit\u00e4t
 jsite.key-dialog.label.actions=<html><b>Aktionen</b></html>
 
index 80d3fc5..39beff1 100644 (file)
@@ -177,6 +177,8 @@ jsite.update-checker.latest-version.okay.message=<html>Vous utilisez la version
 jsite.key-dialog.title=G\u00e9rer les cl\u00e9s des projets
 jsite.key-dialog.button.ok.tooltip=Accepter les changements
 jsite.key-dialog.button.cancel.tooltip=Annuler les changements
+jsite.key-dialog.button.copy-from-project=Copy from Project
+jsite.key-dialog.button.copy-from-project.tooltip=Copies the public and private keys from the selected project
 jsite.key-dialog.button.copy-from-identity=Copy from Identity
 jsite.key-dialog.button.copy-from-identity.tooltip=Copies the public and private keys from the selected identity
 jsite.key-dialog.button.generate=Reg\u00e9n\u00e9rer les cl\u00e9s
@@ -184,7 +186,8 @@ jsite.key-dialog.button.generate.tooltip=Cr\u00e9er une nouvelle paire de cl\u00
 jsite.key-dialog.label.keys=<html><b>Cl\u00e9s</b></html>
 jsite.key-dialog.label.private-key=Cl\u00e9 priv\u00e9e
 jsite.key-dialog.label.public-key=Cl\u00e9 publique
-jsite.key-dialog.label.identities=<html><b>Identities</b></html>
+jsite.key-dialog.label.copy-keys=<html><b>Copy Keys</b></html>
+jsite.key-dialog.label.project=Project
 jsite.key-dialog.label.identity=Identity
 jsite.key-dialog.label.actions=<html><b>Actions</b></html>
 
@@ -201,4 +204,4 @@ jsite.error.index-not-inserted=<html><b>Fichier par d\u00e9faut non ins\u00e9r\u
 jsite.error.no-custom-key=<html><b>Pas de clef existante sp\u00e9cifi\u00e9e pour ce fichier</b><br><br>Vous avez sp\u00e9cifier de ne pas ins\u00e9rer <code>{0}</code><br> mais n'avez pas sp\u00e9cifier de clef ou rediriger!</html>
 jsite.error.no-files-to-insert=<html><b>Aucun fichier \u00e0 ins\u00e9rer</b><br><br>Vous n'avez s\u00e9lectionn\u00e9 aucun fichier pour l'insertion !<br>Veuillez s\u00e9lectionner au moins un fichier \u00e0 ins\u00e9rer.</html>
 jsite.error.duplicate-file=<html><b>Fichier dupliqu\u00e9</b><br><br>Le fichier <code>{0}</code> est ins\u00e9r\u00e9 deux fois !<br>Veuillez v\u00e9rifier les noms de fichier et les redirections.</html>
-# to update: 144, 145, 180, 181, 187-189, 193
\ No newline at end of file
+# to update: 144, 145, 180-183, 189-192, 196
\ No newline at end of file