Author: jflesch
Date: 2007-04-23 00:35:01 +0000 (Mon, 23 Apr 2007)
New Revision: 12888
Modified:
trunk/apps/Thaw/src/thaw/gui/WarningWindow.java
trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
trunk/apps/Thaw/src/thaw/i18n/thaw.properties
trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
trunk/apps/Thaw/src/thaw/plugins/index/Index.java
trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
Log:
Add a button in the index settings to reset the comments
Modified: trunk/apps/Thaw/src/thaw/gui/WarningWindow.java
===================================================================
--- trunk/apps/Thaw/src/thaw/gui/WarningWindow.java 2007-04-23 00:07:04 UTC
(rev 12887)
+++ trunk/apps/Thaw/src/thaw/gui/WarningWindow.java 2007-04-23 00:35:01 UTC
(rev 12888)
@@ -3,6 +3,7 @@
import javax.swing.JOptionPane;
import thaw.core.Core;
+import thaw.core.MainWindow;
import thaw.core.I18n;
/**
@@ -17,8 +18,13 @@
public WarningWindow(final Core core,
final String warning)
{
- if((core != null) && (core.getMainWindow() != null)) {
-
JOptionPane.showMessageDialog(core.getMainWindow().getMainFrame(),
+ this(core != null ? core.getMainWindow() : null, warning);
+ }
+
+ public WarningWindow(final MainWindow mainWindow, String warning) {
+
+ if (mainWindow != null) {
+ JOptionPane.showMessageDialog(mainWindow.getMainFrame(),
warning,
"Thaw -
"+I18n.getMessage("thaw.warning.title"),
JOptionPane.WARNING_MESSAGE);
Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-04-23
00:07:04 UTC (rev 12887)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-04-23
00:35:01 UTC (rev 12888)
@@ -337,6 +337,12 @@
thaw.plugin.index.comment.mustSelectIdentity=Vous devez selectionner une
identit?
+thaw.plugin.index.comment.reset=Remettre les commentaires ? 0
+
+thaw.plugin.index.mustReinsert=Vous devez r?inserer l'index pour que les
changements fassent effet
+
+
+
thaw.plugin.peerMonitor.peerMonitor=Connexion
thaw.plugin.peerMonitor.yourReference=Votre r?f?rence:
thaw.plugin.peerMonitor.copyReference=Copier votre r?f?rence vers le
presse-papier
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-04-23 00:07:04 UTC
(rev 12887)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-04-23 00:35:01 UTC
(rev 12888)
@@ -331,7 +331,9 @@
thaw.plugin.index.stillRev0=Don't forget to insert this index on Freenet
before giving the key to someone
+thaw.plugin.index.mustReinsert=You must reinsert the index for the changes to
take effect
+
thaw.plugin.index.comment.comments=See the comments (?)
thaw.plugin.index.comment.readComments=See the comments
thaw.plugin.index.comment.comment=Comment
@@ -341,6 +343,10 @@
thaw.plugin.index.comment.mustSelectIdentity=You must select an identity
+thaw.plugin.index.comment.reset=Reinit comments
+
+
+
thaw.plugin.peerMonitor.peerMonitor=Connection
thaw.plugin.peerMonitor.yourReference=Your reference:
thaw.plugin.peerMonitor.copyReference=Copy your reference to the clipboard
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-04-23 00:07:04 UTC
(rev 12887)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-04-23 00:35:01 UTC
(rev 12888)
@@ -337,6 +337,12 @@
thaw.plugin.index.comment.mustSelectIdentity=Vous devez selectionner une
identit\u00e9
+thaw.plugin.index.comment.reset=Remettre les commentaires \u00e0 0
+
+thaw.plugin.index.mustReinsert=Vous devez r\u00e9inserer l'index pour que les
changements fassent effet
+
+
+
thaw.plugin.peerMonitor.peerMonitor=Connexion
thaw.plugin.peerMonitor.yourReference=Votre r\u00e9f\u00e9rence:
thaw.plugin.peerMonitor.copyReference=Copier votre r\u00e9f\u00e9rence vers le
presse-papier
Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java 2007-04-23 00:07:04 UTC
(rev 12887)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java 2007-04-23 00:35:01 UTC
(rev 12888)
@@ -1826,7 +1826,7 @@
}
- public void regeneratedCommentKeys(FCPQueueManager queueManager) {
+ public void regenerateCommentKeys(FCPQueueManager queueManager) {
new CommentKeyRegenerator(queueManager);
}
Modified: trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
2007-04-23 00:07:04 UTC (rev 12887)
+++ trunk/apps/Thaw/src/thaw/plugins/index/IndexManagementHelper.java
2007-04-23 00:35:01 UTC (rev 12888)
@@ -42,6 +42,7 @@
import thaw.core.Config;
import thaw.core.FileChooser;
+import thaw.core.MainWindow;
import thaw.fcp.FreenetURIHelper;
import thaw.core.I18n;
import thaw.core.Logger;
@@ -50,8 +51,8 @@
import thaw.fcp.FCPTransferQuery;
import thaw.plugins.Hsqldb;
import thaw.plugins.signatures.Identity;
+import thaw.gui.WarningWindow;
-
/**
* Index.java, IndexFolder.java and IndexTree.java must NEVER use this helper
(to avoid loops).
*/
@@ -255,12 +256,18 @@
/**
* In fact, this dialog allows to change various settings related to
the index
+ * THIS DIALOG BECOME REALLY DIRTY ! TO REWRITE !
*/
public static class KeyAsker implements ActionListener, MouseListener {
+ private Index index;
+ private FCPQueueManager queueManager;
+
private JButton okButton;
private JButton cancelButton;
private int formState;
+ private JButton resetCommentsButton;
+
private JTextField publicKeyField = null;
private JTextField privateKeyField = null;
private JCheckBox publishPrivateKeyBox = null;
@@ -273,8 +280,13 @@
}
-
- public static KeyAsker askKeys(final boolean askPrivateKey,
+ /**
+ * @param index can be null
+ * @param queueManager can be null if index is null
+ */
+ public static KeyAsker askKeys(final Index index,
+ final FCPQueueManager
queueManager,
+ final boolean askPrivateKey,
final String defaultPublicKey,
final String defaultPrivateKey,
final boolean
defaultPublishPrivateKey,
@@ -282,7 +294,8 @@
final boolean
enablePublishPrivateKeyChoice,
final IndexBrowserPanel
indexBrowser) {
KeyAsker asker = new KeyAsker();
- asker.askKeysBis(askPrivateKey, defaultPublicKey,
+ asker.askKeysBis(index, queueManager,
+ askPrivateKey, defaultPublicKey,
defaultPrivateKey,
defaultPublishPrivateKey,
defaultAllowComments,
enablePublishPrivateKeyChoice,
@@ -316,13 +329,17 @@
return allowComments;
}
- public synchronized void askKeysBis(final boolean askPrivateKey,
+ public synchronized void askKeysBis(Index index,
FCPQueueManager queueManager,
+ final boolean askPrivateKey,
String defaultPublicKey,
String defaultPrivateKey,
boolean
defaultPublishPrivateKey,
boolean
defaultAllowComments,
final boolean
enablePublishPrivateKeyChoice,
final IndexBrowserPanel
indexBrowser) {
+ this.index = index;
+ this.queueManager = queueManager;
+
formState = 0;
if (defaultPublicKey == null)
@@ -344,6 +361,9 @@
defaultAllowComments);
allowCommentsBox.setEnabled(enablePublishPrivateKeyChoice); /* if we can't
publish the private key, we can't change comment setting */
+ resetCommentsButton = new
JButton(I18n.getMessage("thaw.plugin.index.comment.reset"));
+ resetCommentsButton.addActionListener(this);
+
final JPanel subPanelA = new JPanel(); /* left =>
labels */
final JPanel subPanelB = new JPanel(); /* right =>
textfield */
@@ -388,8 +408,15 @@
subSubPanelC.add(okButton);
subSubPanelC.add(cancelButton);
+ JPanel commentPanel = new JPanel(new BorderLayout());
+ commentPanel.add(allowCommentsBox, BorderLayout.CENTER);
+
+ if (index != null)
+ commentPanel.add(resetCommentsButton,
BorderLayout.EAST);
+
+
subPanelC.add(publishPrivateKeyBox);
- subPanelC.add(allowCommentsBox);
+ subPanelC.add(commentPanel);
subPanelC.add(subSubPanelC);
frame.getContentPane().add(subPanelC,
BorderLayout.SOUTH);
@@ -434,13 +461,19 @@
public synchronized void actionPerformed(final ActionEvent e) {
if (e.getSource() == okButton) {
formState = 1;
+ notifyAll();
+ return;
}
if (e.getSource() == cancelButton) {
formState = 2;
+ notifyAll();
+ return;
}
- notifyAll();
+ if (e.getSource() == resetCommentsButton) {
+ index.regenerateCommentKeys(queueManager);
+ }
}
public void mouseClicked(final MouseEvent e) { }
@@ -483,7 +516,8 @@
public void apply() {
final Index index = ((Index)getTarget());
- final KeyAsker asker = KeyAsker.askKeys(true,
index.getPublicKey(),
+ final KeyAsker asker = KeyAsker.askKeys(index,
getQueueManager(),
+ true,
index.getPublicKey(),
index.getPrivateKey(), index.getPublishPrivateKey(),
index.canHaveComments(), true, getIndexBrowserPanel());
@@ -502,10 +536,13 @@
index.purgeCommentKeys();
} else if (!index.canHaveComments() &&
asker.getAllowComments()) {
Logger.notice(this, "Purging comments &
regenerating keys ...");
- index.regeneratedCommentKeys(getQueueManager());
+ index.regenerateCommentKeys(getQueueManager());
}
getIndexBrowserPanel().getIndexTree().refresh(index);
+
+ new
WarningWindow(getIndexBrowserPanel().getMainWindow(),
+
I18n.getMessage("thaw.plugin.index.mustReinsert"));
}
}
@@ -528,7 +565,9 @@
String privateKey = null;
boolean publishPrivate = false;
- asker = KeyAsker.askKeys(true, "USK@", "SSK@", false,
false, false, getIndexBrowserPanel());
+ asker = KeyAsker.askKeys(null, null,
+ true, "USK@", "SSK@",
+ false, false, false,
getIndexBrowserPanel());
if (asker == null)
return;
@@ -890,7 +929,7 @@
if (node instanceof Index) {
if (((Index)node).getRevision() <= 0) {
- new thaw.gui.WarningWindow(null,
I18n.getMessage("thaw.plugin.index.stillRev0"));
+ new WarningWindow((MainWindow)null,
I18n.getMessage("thaw.plugin.index.stillRev0"));
}
}
@@ -1610,7 +1649,8 @@
Identity i =
((Identity)author.getSelectedItem());
if (i == null) {
- new
thaw.gui.WarningWindow(null,
I18n.getMessage("thaw.plugin.index.comment.mustSelectIdentity"));
+ new
WarningWindow(getIndexBrowserPanel().getMainWindow(),
+
I18n.getMessage("thaw.plugin.index.comment.mustSelectIdentity"));
return;
}