/*
- * jSite - ProjectPage.java - Copyright © 2006–2012 David Roden
+ * jSite - ProjectPage.java - Copyright © 2006–2019 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
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;
import javax.swing.Action;
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.TLabel;
/** The freenet interface. */
private Freenet7Interface freenetInterface;
+ /** The web of trust interface. */
+ private WebOfTrustInterface webOfTrustInterface;
+
/** The “browse” action. */
private Action projectLocalPathBrowseAction;
* @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);
*
* @return The list of projects
*/
- public Project[] getProjects() {
- return projectListModel.toArray(new Project[projectListModel.size()]);
+ public List<Project> getProjects() {
+ return projectListModel;
}
/**
}
/**
+ * 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
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()) {
String originalPublicKey = selectedProject.getRequestURI();
selectedProject.setRequestURI(keyDialog.getPublicKey());
if (!originalPublicKey.equals(selectedProject.getRequestURI()) || !originalPrivateKey.equals(selectedProject.getInsertURI())) {
selectedProject.setEdition(-1);
+ for (Entry<String, FileOption> fileOption : selectedProject.getFileOptions().entrySet()) {
+ fileOption.getValue().setLastInsertHash(null);
+ }
}
updateCompleteURI();
}