X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Ftodesbaum%2Fjsite%2Fgui%2FProjectPage.java;h=ad3f2e5550171e2b2edc61fc0ab34003da1019b3;hb=389a1331d623ad71ffcccbfbd9a5da043b48f70f;hp=98ad847d04d9fca07fc91aeff21497881705b430;hpb=0e88169c3e8decfcd99f39f5ecf3a85df50c3fca;p=jSite.git
diff --git a/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java b/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java
index 98ad847..ad3f2e5 100644
--- a/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java
+++ b/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java
@@ -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.Map.Entry;
import javax.swing.AbstractAction;
import javax.swing.Action;
@@ -57,12 +58,13 @@ import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.DocumentFilter;
+import net.pterodactylus.util.swing.SortedListModel;
+import de.todesbaum.jsite.application.FileOption;
import de.todesbaum.jsite.application.Freenet7Interface;
-import de.todesbaum.jsite.application.KeyDialog;
import de.todesbaum.jsite.application.Project;
+import de.todesbaum.jsite.application.WebOfTrustInterface;
import de.todesbaum.jsite.i18n.I18n;
import de.todesbaum.jsite.i18n.I18nContainer;
-import de.todesbaum.util.swing.SortedListModel;
import de.todesbaum.util.swing.TLabel;
import de.todesbaum.util.swing.TWizard;
import de.todesbaum.util.swing.TWizardPage;
@@ -77,6 +79,9 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
/** The freenet interface. */
private Freenet7Interface freenetInterface;
+ /** The web of trust interface. */
+ private WebOfTrustInterface webOfTrustInterface;
+
/** The âbrowseâ action. */
private Action projectLocalPathBrowseAction;
@@ -143,6 +148,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
public void run() {
setHeading(I18n.getMessage("jsite.project.heading"));
setDescription(I18n.getMessage("jsite.project.description"));
@@ -206,6 +212,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
private void createActions() {
projectLocalPathBrowseAction = new AbstractAction(I18n.getMessage("jsite.project.action.browse")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionLocalPathBrowse();
@@ -217,6 +224,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
projectAddAction = new AbstractAction(I18n.getMessage("jsite.project.action.add-project")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionAdd();
@@ -227,6 +235,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
projectDeleteAction = new AbstractAction(I18n.getMessage("jsite.project.action.delete-project")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionDelete();
@@ -238,6 +247,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
projectCloneAction = new AbstractAction(I18n.getMessage("jsite.project.action.clone-project")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionClone();
@@ -249,6 +259,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
projectCopyURIAction = new AbstractAction(I18n.getMessage("jsite.project.action.copy-uri")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionCopyURI();
@@ -260,6 +271,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
projectManageKeysAction = new AbstractAction(I18n.getMessage("jsite.project.action.manage-keys")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionManageKeys();
@@ -271,6 +283,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
projectResetEditionAction = new AbstractAction(I18n.getMessage("jsite.project.action.reset-edition")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionResetEdition();
@@ -282,6 +295,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
projectLocalPathBrowseAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.browse"));
@@ -407,6 +421,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
public void run() {
projectInformationLabel.setText("" + I18n.getMessage("jsite.project.project.information") + "");
projectNameLabel.setText(I18n.getMessage("jsite.project.project.name") + ":");
@@ -454,6 +469,16 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
}
/**
+ * Sets the web of trust interface to use.
+ *
+ * @param webOfTrustInterface
+ * The web of trust interface to use
+ */
+ public void setWebOfTrustInterface(WebOfTrustInterface webOfTrustInterface) {
+ this.webOfTrustInterface = webOfTrustInterface;
+ }
+
+ /**
* Returns the currently selected project.
*
* @return The currently selected project
@@ -606,6 +631,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
KeyDialog keyDialog = new KeyDialog(freenetInterface, wizard);
keyDialog.setPrivateKey(selectedProject.getInsertURI());
keyDialog.setPublicKey(selectedProject.getRequestURI());
+ keyDialog.setOwnIdentities(webOfTrustInterface.getOwnIdentities());
keyDialog.setVisible(true);
if (!keyDialog.wasCancelled()) {
String originalPublicKey = selectedProject.getRequestURI();
@@ -614,6 +640,9 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
selectedProject.setRequestURI(keyDialog.getPublicKey());
if (!originalPublicKey.equals(selectedProject.getRequestURI()) || !originalPrivateKey.equals(selectedProject.getInsertURI())) {
selectedProject.setEdition(-1);
+ for (Entry fileOption : selectedProject.getFileOptions().entrySet()) {
+ fileOption.getValue().setLastInsertHash(null);
+ }
}
updateCompleteURI();
}
@@ -653,6 +682,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
/**
* {@inheritDoc}
*/
+ @Override
public void valueChanged(ListSelectionEvent listSelectionEvent) {
int selectedRow = projectList.getSelectedIndex();
Project selectedProject = (Project) projectList.getSelectedValue();
@@ -692,6 +722,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
/**
* {@inheritDoc}
*/
+ @Override
public void insertUpdate(DocumentEvent documentEvent) {
setTextField(documentEvent);
}
@@ -699,6 +730,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
/**
* {@inheritDoc}
*/
+ @Override
public void removeUpdate(DocumentEvent documentEvent) {
setTextField(documentEvent);
}
@@ -706,6 +738,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
/**
* {@inheritDoc}
*/
+ @Override
public void changedUpdate(DocumentEvent documentEvent) {
setTextField(documentEvent);
}
@@ -717,6 +750,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
/**
* {@inheritDoc}
*/
+ @Override
public void lostOwnership(Clipboard clipboard, Transferable contents) {
/* ignore. */
}